diff options
Diffstat (limited to 'tools/libclang/CIndex.cpp')
-rw-r--r-- | tools/libclang/CIndex.cpp | 40 |
1 files changed, 28 insertions, 12 deletions
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp index a9c3077e5f..d7eee5e684 100644 --- a/tools/libclang/CIndex.cpp +++ b/tools/libclang/CIndex.cpp @@ -1,9 +1,8 @@ //===- CIndex.cpp - Clang-C Source Indexing Library -----------------------===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // @@ -172,7 +171,6 @@ CXSourceRange cxloc::translateSourceRange(const SourceManager &SM, static SourceRange getRawCursorExtent(CXCursor C); static SourceRange getFullCursorExtent(CXCursor C, SourceManager &SrcMgr); - RangeComparisonResult CursorVisitor::CompareRegionOfInterest(SourceRange R) { return RangeCompare(AU->getSourceManager(), R, RegionOfInterest); } @@ -2169,6 +2167,10 @@ void OMPClauseEnqueue::VisitOMPSimdlenClause(const OMPSimdlenClause *C) { Visitor->AddStmt(C->getSimdlen()); } +void OMPClauseEnqueue::VisitOMPAllocatorClause(const OMPAllocatorClause *C) { + Visitor->AddStmt(C->getAllocator()); +} + void OMPClauseEnqueue::VisitOMPCollapseClause(const OMPCollapseClause *C) { Visitor->AddStmt(C->getNumForLoops()); } @@ -2260,6 +2262,10 @@ void OMPClauseEnqueue::VisitOMPClauseList(T *Node) { } } +void OMPClauseEnqueue::VisitOMPAllocateClause(const OMPAllocateClause *C) { + VisitOMPClauseList(C); + Visitor->AddStmt(C->getAllocator()); +} void OMPClauseEnqueue::VisitOMPPrivateClause(const OMPPrivateClause *C) { VisitOMPClauseList(C); for (const auto *E : C->private_copies()) { @@ -2473,7 +2479,7 @@ void EnqueueVisitor::VisitCXXNewExpr(const CXXNewExpr *E) { // Enqueue the initializer , if any. AddStmt(E->getInitializer()); // Enqueue the array size, if any. - AddStmt(E->getArraySize()); + AddStmt(E->getArraySize().getValueOr(nullptr)); // Enqueue the allocated type. AddTypeLoc(E->getAllocatedTypeSourceInfo()); // Enqueue the placement arguments. @@ -3409,7 +3415,7 @@ clang_parseTranslationUnit_Impl(CXIndex CIdx, const char *source_filename, Diags(CompilerInstance::createDiagnostics(new DiagnosticOptions)); if (options & CXTranslationUnit_KeepGoing) - Diags->setSuppressAfterFatalError(false); + Diags->setFatalsAsError(true); // Recover resources if we crash before exiting this function. llvm::CrashRecoveryContextCleanupRegistrar<DiagnosticsEngine, @@ -4221,7 +4227,7 @@ const char *clang_getFileContents(CXTranslationUnit TU, CXFile file, const SourceManager &SM = cxtu::getASTUnit(TU)->getSourceManager(); FileID fid = SM.translateFile(static_cast<FileEntry *>(file)); bool Invalid = true; - llvm::MemoryBuffer *buf = SM.getBuffer(fid, &Invalid); + const llvm::MemoryBuffer *buf = SM.getBuffer(fid, &Invalid); if (Invalid) { if (size) *size = 0; @@ -5474,7 +5480,15 @@ CXString clang_getCursorKindSpelling(enum CXCursorKind Kind) { case CXCursor_StaticAssert: return cxstring::createRef("StaticAssert"); case CXCursor_FriendDecl: - return cxstring::createRef("FriendDecl"); + return cxstring::createRef("FriendDecl"); + case CXCursor_ConvergentAttr: + return cxstring::createRef("attribute(convergent)"); + case CXCursor_WarnUnusedAttr: + return cxstring::createRef("attribute(warn_unused)"); + case CXCursor_WarnUnusedResultAttr: + return cxstring::createRef("attribute(warn_unused_result)"); + case CXCursor_AlignedAttr: + return cxstring::createRef("attribute(aligned)"); } llvm_unreachable("Unhandled CXCursorKind"); @@ -6228,7 +6242,9 @@ CXCursor clang_getCursorDefinition(CXCursor C) { case Decl::CXXDeductionGuide: case Decl::Import: case Decl::OMPThreadPrivate: + case Decl::OMPAllocate: case Decl::OMPDeclareReduction: + case Decl::OMPDeclareMapper: case Decl::OMPRequires: case Decl::ObjCTypeParam: case Decl::BuiltinTemplate: @@ -8361,7 +8377,7 @@ unsigned clang_CXXMethod_isConst(CXCursor C) { const Decl *D = cxcursor::getCursorDecl(C); const CXXMethodDecl *Method = D ? dyn_cast_or_null<CXXMethodDecl>(D->getAsFunction()) : nullptr; - return (Method && Method->getTypeQualifiers().hasConst()) ? 1 : 0; + return (Method && Method->getMethodQualifiers().hasConst()) ? 1 : 0; } unsigned clang_CXXMethod_isDefaulted(CXCursor C) { @@ -8706,8 +8722,8 @@ void clang::setThreadBackgroundPriority() { if (getenv("LIBCLANG_BGPRIO_DISABLE")) return; -#ifdef USE_DARWIN_THREADS - setpriority(PRIO_DARWIN_THREAD, 0, PRIO_DARWIN_BG); +#if LLVM_ENABLE_THREADS + llvm::set_thread_priority(llvm::ThreadPriority::Background); #endif } |