From 8dd16259287f58f9273002717ec4d27e97127719 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 12 Jun 2024 07:43:14 +0200 Subject: Merging upstream version 127.0. Signed-off-by: Daniel Baumann --- build/clang-plugin/Utils.h | 4 ++++ .../mozsearch-plugin/BindingOperations.cpp | 12 +++++++++--- .../mozsearch-plugin/MozsearchIndexer.cpp | 22 ++++++++++++++++++++-- 3 files changed, 33 insertions(+), 5 deletions(-) (limited to 'build/clang-plugin') diff --git a/build/clang-plugin/Utils.h b/build/clang-plugin/Utils.h index c25caf43ee..d252eeda15 100644 --- a/build/clang-plugin/Utils.h +++ b/build/clang-plugin/Utils.h @@ -169,7 +169,11 @@ inline bool isInIgnoredNamespaceForImplicitCtor(const Decl *Declaration) { Name == "boost" || // boost Name == "webrtc" || // upstream webrtc Name == "rtc" || // upstream webrtc 'base' package +#if CLANG_VERSION_MAJOR >= 16 + Name.starts_with("icu_") || // icu +#else Name.startswith("icu_") || // icu +#endif Name == "google" || // protobuf Name == "google_breakpad" || // breakpad Name == "soundtouch" || // libsoundtouch diff --git a/build/clang-plugin/mozsearch-plugin/BindingOperations.cpp b/build/clang-plugin/mozsearch-plugin/BindingOperations.cpp index 79f7f3aebf..cc277f1f2f 100644 --- a/build/clang-plugin/mozsearch-plugin/BindingOperations.cpp +++ b/build/clang-plugin/mozsearch-plugin/BindingOperations.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -173,10 +174,15 @@ constexpr StringRef BoundAs::ANNOTATION; template void setBindingAttr(ASTContext &C, Decl &decl, B binding) { +#if CLANG_VERSION_MAJOR >= 18 + auto utf8 = StringLiteralKind::UTF8; +#else + auto utf8 = StringLiteral::UTF8; +#endif // recent LLVM: CreateImplicit then setDelayedArgs - Expr *langExpr = StringLiteral::Create(C, AbstractBinding::stringFromLang(binding.lang), StringLiteral::UTF8, false, {}, {}); - Expr *kindExpr = StringLiteral::Create(C, AbstractBinding::stringFromKind(binding.kind), StringLiteral::UTF8, false, {}, {}); - Expr *symbolExpr = StringLiteral::Create(C, binding.symbol, StringLiteral::UTF8, false, {}, {}); + Expr *langExpr = StringLiteral::Create(C, AbstractBinding::stringFromLang(binding.lang), utf8, false, {}, {}); + Expr *kindExpr = StringLiteral::Create(C, AbstractBinding::stringFromKind(binding.kind), utf8, false, {}, {}); + Expr *symbolExpr = StringLiteral::Create(C, binding.symbol, utf8, false, {}, {}); auto **args = new (C, 16) Expr *[3]{langExpr, kindExpr, symbolExpr}; auto *attr = AnnotateAttr::CreateImplicit(C, B::ANNOTATION, args, 3); decl.addAttr(attr); diff --git a/build/clang-plugin/mozsearch-plugin/MozsearchIndexer.cpp b/build/clang-plugin/mozsearch-plugin/MozsearchIndexer.cpp index f6958384a8..5e09e093d0 100644 --- a/build/clang-plugin/mozsearch-plugin/MozsearchIndexer.cpp +++ b/build/clang-plugin/mozsearch-plugin/MozsearchIndexer.cpp @@ -138,6 +138,14 @@ struct RAIITracer { class IndexConsumer; +bool isPure(FunctionDecl* D) { +#if CLANG_VERSION_MAJOR >= 18 + return D->isPureVirtual(); +#else + return D->isPure(); +#endif +} + // For each C++ file seen by the analysis (.cpp or .h), we track a // FileInfo. This object tracks whether the file is "interesting" (i.e., whether // it's in the source dir or the objdir). We also store the analysis output @@ -191,7 +199,12 @@ public: #endif StringRef SearchPath, StringRef RelativePath, +#if CLANG_VERSION_MAJOR >= 19 + const Module *SuggestedModule, + bool ModuleImported, +#else const Module *Imported, +#endif SrcMgr::CharacteristicKind FileType) override; virtual void MacroDefined(const Token &Tok, @@ -1749,7 +1762,7 @@ public: D = D2->getTemplateInstantiationPattern(); } // We treat pure virtual declarations as definitions. - Kind = (D2->isThisDeclarationADefinition() || D2->isPure()) ? "def" : "decl"; + Kind = (D2->isThisDeclarationADefinition() || isPure(D2)) ? "def" : "decl"; PrettyKind = "function"; PeekRange = getFunctionPeekRange(D2); @@ -1881,7 +1894,7 @@ public: } } if (FunctionDecl *D2 = dyn_cast(D)) { - if ((D2->isThisDeclarationADefinition() || D2->isPure()) && + if ((D2->isThisDeclarationADefinition() || isPure(D2)) && // a clause at the top should have generalized and set wasTemplate so // it shouldn't be the case that isTemplateInstantiation() is true. !D2->isTemplateInstantiation() && @@ -2335,7 +2348,12 @@ void PreprocessorHook::InclusionDirective(SourceLocation HashLoc, #endif StringRef SearchPath, StringRef RelativePath, +#if CLANG_VERSION_MAJOR >= 19 + const Module *SuggestedModule, + bool ModuleImported, +#else const Module *Imported, +#endif SrcMgr::CharacteristicKind FileType) { #if CLANG_VERSION_MAJOR >= 15 if (!File) { -- cgit v1.2.3