summaryrefslogtreecommitdiffstats
path: root/build/clang-plugin
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:43:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:43:14 +0000
commit8dd16259287f58f9273002717ec4d27e97127719 (patch)
tree3863e62a53829a84037444beab3abd4ed9dfc7d0 /build/clang-plugin
parentReleasing progress-linux version 126.0.1-1~progress7.99u1. (diff)
downloadfirefox-8dd16259287f58f9273002717ec4d27e97127719.tar.xz
firefox-8dd16259287f58f9273002717ec4d27e97127719.zip
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'build/clang-plugin')
-rw-r--r--build/clang-plugin/Utils.h4
-rw-r--r--build/clang-plugin/mozsearch-plugin/BindingOperations.cpp12
-rw-r--r--build/clang-plugin/mozsearch-plugin/MozsearchIndexer.cpp22
3 files changed, 33 insertions, 5 deletions
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 <clang/AST/Attr.h>
#include <clang/AST/Expr.h>
#include <clang/AST/RecursiveASTVisitor.h>
+#include <clang/Basic/Version.h>
#include <algorithm>
#include <array>
@@ -173,10 +174,15 @@ constexpr StringRef BoundAs::ANNOTATION;
template<typename B>
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<FunctionDecl>(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) {