summaryrefslogtreecommitdiff
path: root/tools/libclang/CXSourceLocation.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/libclang/CXSourceLocation.cpp')
-rw-r--r--tools/libclang/CXSourceLocation.cpp21
1 files changed, 5 insertions, 16 deletions
diff --git a/tools/libclang/CXSourceLocation.cpp b/tools/libclang/CXSourceLocation.cpp
index 1b7464b25af9..2e0ea4e44099 100644
--- a/tools/libclang/CXSourceLocation.cpp
+++ b/tools/libclang/CXSourceLocation.cpp
@@ -38,8 +38,6 @@ static bool isASTUnitSourceLocation(const CXSourceLocation &L) {
// Basic construction and comparison of CXSourceLocations and CXSourceRanges.
//===----------------------------------------------------------------------===//
-extern "C" {
-
CXSourceLocation clang_getNullLocation() {
CXSourceLocation Result = { { nullptr, nullptr }, 0 };
return Result;
@@ -110,14 +108,10 @@ CXSourceLocation clang_getRangeEnd(CXSourceRange range) {
return Result;
}
-} // end extern "C"
-
//===----------------------------------------------------------------------===//
// Getting CXSourceLocations and CXSourceRanges from a translation unit.
//===----------------------------------------------------------------------===//
-extern "C" {
-
CXSourceLocation clang_getLocation(CXTranslationUnit TU,
CXFile file,
unsigned line,
@@ -131,7 +125,7 @@ CXSourceLocation clang_getLocation(CXTranslationUnit TU,
if (line == 0 || column == 0)
return clang_getNullLocation();
- LogRef Log = Logger::make(LLVM_FUNCTION_NAME);
+ LogRef Log = Logger::make(__func__);
ASTUnit *CXXUnit = cxtu::getASTUnit(TU);
ASTUnit::ConcurrencyCheck Check(*CXXUnit);
const FileEntry *File = static_cast<const FileEntry *>(file);
@@ -139,16 +133,17 @@ CXSourceLocation clang_getLocation(CXTranslationUnit TU,
if (SLoc.isInvalid()) {
if (Log)
*Log << llvm::format("(\"%s\", %d, %d) = invalid",
- File->getName(), line, column);
+ File->getName().str().c_str(), line, column);
return clang_getNullLocation();
}
CXSourceLocation CXLoc =
cxloc::translateSourceLocation(CXXUnit->getASTContext(), SLoc);
if (Log)
- *Log << llvm::format("(\"%s\", %d, %d) = ", File->getName(), line, column)
+ *Log << llvm::format("(\"%s\", %d, %d) = ", File->getName().str().c_str(),
+ line, column)
<< CXLoc;
-
+
return CXLoc;
}
@@ -173,8 +168,6 @@ CXSourceLocation clang_getLocationForOffset(CXTranslationUnit TU,
return cxloc::translateSourceLocation(CXXUnit->getASTContext(), SLoc);
}
-} // end extern "C"
-
//===----------------------------------------------------------------------===//
// Routines for expanding and manipulating CXSourceLocations, regardless
// of their origin.
@@ -204,8 +197,6 @@ static void createNullLocation(CXString *filename, unsigned *line,
*offset = 0;
}
-extern "C" {
-
int clang_Location_isInSystemHeader(CXSourceLocation location) {
const SourceLocation Loc =
SourceLocation::getFromRawEncoding(location.int_data);
@@ -381,5 +372,3 @@ void clang_getFileLocation(CXSourceLocation location,
if (offset)
*offset = FileOffset;
}
-
-} // end extern "C"