|
@@ -3110,7 +3110,6 @@ struct RegisterFatalErrorHandler {
|
|
|
|
|
|
static llvm::ManagedStatic<RegisterFatalErrorHandler> RegisterFatalErrorHandlerOnce;
|
|
static llvm::ManagedStatic<RegisterFatalErrorHandler> RegisterFatalErrorHandlerOnce;
|
|
|
|
|
|
-extern "C" {
|
|
|
|
CXIndex clang_createIndex(int excludeDeclarationsFromPCH,
|
|
CXIndex clang_createIndex(int excludeDeclarationsFromPCH,
|
|
int displayDiagnostics) {
|
|
int displayDiagnostics) {
|
|
// We use crash recovery to make some of our APIs more reliable, implicitly
|
|
// We use crash recovery to make some of our APIs more reliable, implicitly
|
|
@@ -3968,13 +3967,10 @@ CXCursor clang_getTranslationUnitCursor(CXTranslationUnit TU) {
|
|
return MakeCXCursor(CXXUnit->getASTContext().getTranslationUnitDecl(), TU);
|
|
return MakeCXCursor(CXXUnit->getASTContext().getTranslationUnitDecl(), TU);
|
|
}
|
|
}
|
|
|
|
|
|
-} // end: extern "C"
|
|
|
|
-
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
//===----------------------------------------------------------------------===//
|
|
// CXFile Operations.
|
|
// CXFile Operations.
|
|
//===----------------------------------------------------------------------===//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
-extern "C" {
|
|
|
|
CXString clang_getFileName(CXFile SFile) {
|
|
CXString clang_getFileName(CXFile SFile) {
|
|
if (!SFile)
|
|
if (!SFile)
|
|
return cxstring::createNull();
|
|
return cxstring::createNull();
|
|
@@ -4043,8 +4039,6 @@ int clang_File_isEqual(CXFile file1, CXFile file2) {
|
|
return FEnt1->getUniqueID() == FEnt2->getUniqueID();
|
|
return FEnt1->getUniqueID() == FEnt2->getUniqueID();
|
|
}
|
|
}
|
|
|
|
|
|
-} // end: extern "C"
|
|
|
|
-
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
//===----------------------------------------------------------------------===//
|
|
// CXCursor Operations.
|
|
// CXCursor Operations.
|
|
//===----------------------------------------------------------------------===//
|
|
//===----------------------------------------------------------------------===//
|
|
@@ -4120,8 +4114,6 @@ static SourceLocation getLocationFromExpr(const Expr *E) {
|
|
return E->getLocStart();
|
|
return E->getLocStart();
|
|
}
|
|
}
|
|
|
|
|
|
-extern "C" {
|
|
|
|
-
|
|
|
|
unsigned clang_visitChildren(CXCursor parent,
|
|
unsigned clang_visitChildren(CXCursor parent,
|
|
CXCursorVisitor visitor,
|
|
CXCursorVisitor visitor,
|
|
CXClientData client_data) {
|
|
CXClientData client_data) {
|
|
@@ -5383,8 +5375,6 @@ CXSourceLocation clang_getCursorLocation(CXCursor C) {
|
|
return cxloc::translateSourceLocation(getCursorContext(C), Loc);
|
|
return cxloc::translateSourceLocation(getCursorContext(C), Loc);
|
|
}
|
|
}
|
|
|
|
|
|
-} // end extern "C"
|
|
|
|
-
|
|
|
|
CXCursor cxcursor::getCursor(CXTranslationUnit TU, SourceLocation SLoc) {
|
|
CXCursor cxcursor::getCursor(CXTranslationUnit TU, SourceLocation SLoc) {
|
|
assert(TU);
|
|
assert(TU);
|
|
|
|
|
|
@@ -5554,8 +5544,6 @@ static SourceRange getFullCursorExtent(CXCursor C, SourceManager &SrcMgr) {
|
|
return getRawCursorExtent(C);
|
|
return getRawCursorExtent(C);
|
|
}
|
|
}
|
|
|
|
|
|
-extern "C" {
|
|
|
|
-
|
|
|
|
CXSourceRange clang_getCursorExtent(CXCursor C) {
|
|
CXSourceRange clang_getCursorExtent(CXCursor C) {
|
|
SourceRange R = getRawCursorExtent(C);
|
|
SourceRange R = getRawCursorExtent(C);
|
|
if (R.isInvalid())
|
|
if (R.isInvalid())
|
|
@@ -6048,8 +6036,6 @@ void clang_executeOnThread(void (*fn)(void*), void *user_data,
|
|
llvm::llvm_execute_on_thread(fn, user_data, stack_size);
|
|
llvm::llvm_execute_on_thread(fn, user_data, stack_size);
|
|
}
|
|
}
|
|
|
|
|
|
-} // end: extern "C"
|
|
|
|
-
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
//===----------------------------------------------------------------------===//
|
|
// Token-based Operations.
|
|
// Token-based Operations.
|
|
//===----------------------------------------------------------------------===//
|
|
//===----------------------------------------------------------------------===//
|
|
@@ -6062,8 +6048,6 @@ void clang_executeOnThread(void (*fn)(void*), void *user_data,
|
|
* ptr_data: for identifiers and keywords, an IdentifierInfo*.
|
|
* ptr_data: for identifiers and keywords, an IdentifierInfo*.
|
|
* otherwise unused.
|
|
* otherwise unused.
|
|
*/
|
|
*/
|
|
-extern "C" {
|
|
|
|
-
|
|
|
|
CXTokenKind clang_getTokenKind(CXToken CXTok) {
|
|
CXTokenKind clang_getTokenKind(CXToken CXTok) {
|
|
return static_cast<CXTokenKind>(CXTok.int_data[0]);
|
|
return static_cast<CXTokenKind>(CXTok.int_data[0]);
|
|
}
|
|
}
|
|
@@ -6252,8 +6236,6 @@ void clang_disposeTokens(CXTranslationUnit TU,
|
|
free(Tokens);
|
|
free(Tokens);
|
|
}
|
|
}
|
|
|
|
|
|
-} // end: extern "C"
|
|
|
|
-
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
//===----------------------------------------------------------------------===//
|
|
// Token annotation APIs.
|
|
// Token annotation APIs.
|
|
//===----------------------------------------------------------------------===//
|
|
//===----------------------------------------------------------------------===//
|
|
@@ -6921,8 +6903,6 @@ static void clang_annotateTokensImpl(CXTranslationUnit TU, ASTUnit *CXXUnit,
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-extern "C" {
|
|
|
|
-
|
|
|
|
void clang_annotateTokens(CXTranslationUnit TU,
|
|
void clang_annotateTokens(CXTranslationUnit TU,
|
|
CXToken *Tokens, unsigned NumTokens,
|
|
CXToken *Tokens, unsigned NumTokens,
|
|
CXCursor *Cursors) {
|
|
CXCursor *Cursors) {
|
|
@@ -6962,13 +6942,10 @@ void clang_annotateTokens(CXTranslationUnit TU,
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-} // end: extern "C"
|
|
|
|
-
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
//===----------------------------------------------------------------------===//
|
|
// Operations for querying linkage of a cursor.
|
|
// Operations for querying linkage of a cursor.
|
|
//===----------------------------------------------------------------------===//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
-extern "C" {
|
|
|
|
CXLinkageKind clang_getCursorLinkage(CXCursor cursor) {
|
|
CXLinkageKind clang_getCursorLinkage(CXCursor cursor) {
|
|
if (!clang_isDeclaration(cursor.kind))
|
|
if (!clang_isDeclaration(cursor.kind))
|
|
return CXLinkage_Invalid;
|
|
return CXLinkage_Invalid;
|
|
@@ -6985,13 +6962,11 @@ CXLinkageKind clang_getCursorLinkage(CXCursor cursor) {
|
|
|
|
|
|
return CXLinkage_Invalid;
|
|
return CXLinkage_Invalid;
|
|
}
|
|
}
|
|
-} // end: extern "C"
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
//===----------------------------------------------------------------------===//
|
|
// Operations for querying visibility of a cursor.
|
|
// Operations for querying visibility of a cursor.
|
|
//===----------------------------------------------------------------------===//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
-extern "C" {
|
|
|
|
CXVisibilityKind clang_getCursorVisibility(CXCursor cursor) {
|
|
CXVisibilityKind clang_getCursorVisibility(CXCursor cursor) {
|
|
if (!clang_isDeclaration(cursor.kind))
|
|
if (!clang_isDeclaration(cursor.kind))
|
|
return CXVisibility_Invalid;
|
|
return CXVisibility_Invalid;
|
|
@@ -7006,7 +6981,6 @@ CXVisibilityKind clang_getCursorVisibility(CXCursor cursor) {
|
|
|
|
|
|
return CXVisibility_Invalid;
|
|
return CXVisibility_Invalid;
|
|
}
|
|
}
|
|
-} // end: extern "C"
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
//===----------------------------------------------------------------------===//
|
|
// Operations for querying language of a cursor.
|
|
// Operations for querying language of a cursor.
|
|
@@ -7062,8 +7036,6 @@ static CXLanguageKind getDeclLanguage(const Decl *D) {
|
|
return CXLanguage_C;
|
|
return CXLanguage_C;
|
|
}
|
|
}
|
|
|
|
|
|
-extern "C" {
|
|
|
|
-
|
|
|
|
static CXAvailabilityKind getCursorAvailabilityForDecl(const Decl *D) {
|
|
static CXAvailabilityKind getCursorAvailabilityForDecl(const Decl *D) {
|
|
if (isa<FunctionDecl>(D) && cast<FunctionDecl>(D)->isDeleted())
|
|
if (isa<FunctionDecl>(D) && cast<FunctionDecl>(D)->isDeleted())
|
|
return CXAvailability_NotAvailable;
|
|
return CXAvailability_NotAvailable;
|
|
@@ -7533,14 +7505,10 @@ CXFile clang_Module_getTopLevelHeader(CXTranslationUnit TU,
|
|
return nullptr;
|
|
return nullptr;
|
|
}
|
|
}
|
|
|
|
|
|
-} // end: extern "C"
|
|
|
|
-
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
//===----------------------------------------------------------------------===//
|
|
// C++ AST instrospection.
|
|
// C++ AST instrospection.
|
|
//===----------------------------------------------------------------------===//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
-extern "C" {
|
|
|
|
-
|
|
|
|
unsigned clang_CXXConstructor_isDefaultConstructor(CXCursor C) {
|
|
unsigned clang_CXXConstructor_isDefaultConstructor(CXCursor C) {
|
|
if (!clang_isDeclaration(C.kind))
|
|
if (!clang_isDeclaration(C.kind))
|
|
return 0;
|
|
return 0;
|
|
@@ -7641,13 +7609,11 @@ unsigned clang_CXXMethod_isVirtual(CXCursor C) {
|
|
D ? dyn_cast_or_null<CXXMethodDecl>(D->getAsFunction()) : nullptr;
|
|
D ? dyn_cast_or_null<CXXMethodDecl>(D->getAsFunction()) : nullptr;
|
|
return (Method && Method->isVirtual()) ? 1 : 0;
|
|
return (Method && Method->isVirtual()) ? 1 : 0;
|
|
}
|
|
}
|
|
-} // end: extern "C"
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
//===----------------------------------------------------------------------===//
|
|
// Attribute introspection.
|
|
// Attribute introspection.
|
|
//===----------------------------------------------------------------------===//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
-extern "C" {
|
|
|
|
CXType clang_getIBOutletCollectionType(CXCursor C) {
|
|
CXType clang_getIBOutletCollectionType(CXCursor C) {
|
|
if (C.kind != CXCursor_IBOutletCollectionAttr)
|
|
if (C.kind != CXCursor_IBOutletCollectionAttr)
|
|
return cxtype::MakeCXType(QualType(), cxcursor::getCursorTU(C));
|
|
return cxtype::MakeCXType(QualType(), cxcursor::getCursorTU(C));
|
|
@@ -7657,7 +7623,6 @@ CXType clang_getIBOutletCollectionType(CXCursor C) {
|
|
|
|
|
|
return cxtype::MakeCXType(A->getInterface(), cxcursor::getCursorTU(C));
|
|
return cxtype::MakeCXType(A->getInterface(), cxcursor::getCursorTU(C));
|
|
}
|
|
}
|
|
-} // end: extern "C"
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
//===----------------------------------------------------------------------===//
|
|
// Inspecting memory usage.
|
|
// Inspecting memory usage.
|
|
@@ -7672,8 +7637,6 @@ static inline void createCXTUResourceUsageEntry(MemUsageEntries &entries,
|
|
entries.push_back(entry);
|
|
entries.push_back(entry);
|
|
}
|
|
}
|
|
|
|
|
|
-extern "C" {
|
|
|
|
-
|
|
|
|
const char *clang_getTUResourceUsageName(CXTUResourceUsageKind kind) {
|
|
const char *clang_getTUResourceUsageName(CXTUResourceUsageKind kind) {
|
|
const char *str = "";
|
|
const char *str = "";
|
|
switch (kind) {
|
|
switch (kind) {
|
|
@@ -7894,8 +7857,6 @@ void clang_disposeSourceRangeList(CXSourceRangeList *ranges) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-} // end extern "C"
|
|
|
|
-
|
|
|
|
void clang::PrintLibclangResourceUsage(CXTranslationUnit TU) {
|
|
void clang::PrintLibclangResourceUsage(CXTranslationUnit TU) {
|
|
CXTUResourceUsage Usage = clang_getCXTUResourceUsage(TU);
|
|
CXTUResourceUsage Usage = clang_getCXTUResourceUsage(TU);
|
|
for (unsigned I = 0; I != Usage.numEntries; ++I)
|
|
for (unsigned I = 0; I != Usage.numEntries; ++I)
|
|
@@ -8058,14 +8019,10 @@ cxindex::checkForMacroInMacroDefinition(const MacroInfo *MI, SourceLocation Loc,
|
|
return checkForMacroInMacroDefinition(MI, Tok, TU);
|
|
return checkForMacroInMacroDefinition(MI, Tok, TU);
|
|
}
|
|
}
|
|
|
|
|
|
-extern "C" {
|
|
|
|
-
|
|
|
|
CXString clang_getClangVersion() {
|
|
CXString clang_getClangVersion() {
|
|
return cxstring::createDup(getClangFullVersion());
|
|
return cxstring::createDup(getClangFullVersion());
|
|
}
|
|
}
|
|
|
|
|
|
-} // end: extern "C"
|
|
|
|
-
|
|
|
|
Logger &cxindex::Logger::operator<<(CXTranslationUnit TU) {
|
|
Logger &cxindex::Logger::operator<<(CXTranslationUnit TU) {
|
|
if (TU) {
|
|
if (TU) {
|
|
if (ASTUnit *Unit = cxtu::getASTUnit(TU)) {
|
|
if (ASTUnit *Unit = cxtu::getASTUnit(TU)) {
|