-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[analyzer] Delay the checker constructions after parsing #127409
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[analyzer] Delay the checker constructions after parsing #127409
Conversation
If we were to delay checker constructions after we have a filled ASTContext, then we could get rid of a bunch of "lazy initializers" in checkers. Turns out in the register functions of the checkers we could transfer the ASTContext and all other things to checkers, so those could benefit from in-class initializers and const fields. For example, if a checker would take the ASTContext as the first field, then the rest of the fields could use it in their in-class initializers, so the ctor of the checker would only need to set a single field! This would open uup countless opportunities for cleaning up the asthetics of our checkers. I attached a single use-case for the AST and the PP as demonstrating purposes. You can imagine the rest.
@llvm/pr-subscribers-clang Author: Balazs Benics (steakhal) ChangesIf we were to delay checker constructions after we have a filled ASTContext, then we could get rid of a bunch of "lazy initializers" in checkers. Turns out in the register functions of the checkers we could transfer the ASTContext and all other things to checkers, so those could benefit from in-class initializers and const fields. For example, if a checker would take the ASTContext as the first field, then the rest of the fields could use it in their in-class initializers, so the ctor of the checker would only need to set a single field! This would open uup countless opportunities for cleaning up the asthetics of our checkers. I attached a single use-case for the AST and the PP as demonstrating purposes. You can imagine the rest. FYI: This may be a breaking change to some downstream users that may had some means to attach different listeners and what not to e.g. the Preprocessor inside their checker register functions. Since we delay the calls to these register fns after parsing is already done, they would of course miss the parsing Preprocessor events. Full diff: https://github.com/llvm/llvm-project/pull/127409.diff 3 Files Affected:
diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerHelpers.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerHelpers.h
index b4afaaeec9a4b..f7635aa0342d1 100644
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerHelpers.h
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerHelpers.h
@@ -73,6 +73,23 @@ Nullability getNullabilityAnnotation(QualType Type);
/// returned.
std::optional<int> tryExpandAsInteger(StringRef Macro, const Preprocessor &PP);
+class CachedMacroValue {
+public:
+ CachedMacroValue(StringRef MacroSpelling, const Preprocessor &PP)
+ : MacroValueOrFailure(tryExpandAsInteger(MacroSpelling, PP)) {}
+ explicit CachedMacroValue(int ConcreteValue)
+ : MacroValueOrFailure(ConcreteValue) {}
+
+ int valueOr(int Default) const {
+ return MacroValueOrFailure.value_or(Default);
+ }
+ bool hasValue() const { return MacroValueOrFailure.has_value(); }
+ int value() const { return MacroValueOrFailure.value(); }
+
+private:
+ std::optional<int> MacroValueOrFailure;
+};
+
class OperatorKind {
union {
BinaryOperatorKind Bin;
diff --git a/clang/lib/StaticAnalyzer/Checkers/UnixAPIChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/UnixAPIChecker.cpp
index da2d16ca9b5dd..0452e541e8d5c 100644
--- a/clang/lib/StaticAnalyzer/Checkers/UnixAPIChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/UnixAPIChecker.cpp
@@ -40,17 +40,28 @@ enum class OpenVariant {
OpenAt
};
+static CachedMacroValue getCreateFlagValue(const ASTContext &Ctx,
+ const Preprocessor &PP) {
+ CachedMacroValue MacroVal("O_CREAT", PP);
+ if (MacroVal.hasValue())
+ return MacroVal;
+
+ // If we failed, fall-back to known values.
+ if (Ctx.getTargetInfo().getTriple().getVendor() == llvm::Triple::Apple)
+ return CachedMacroValue{0x0200};
+ return MacroVal;
+}
+
namespace {
-class UnixAPIMisuseChecker
- : public Checker<check::PreCall, check::ASTDecl<TranslationUnitDecl>> {
+class UnixAPIMisuseChecker : public Checker<check::PreCall> {
const BugType BT_open{this, "Improper use of 'open'", categories::UnixAPI};
const BugType BT_getline{this, "Improper use of getdelim",
categories::UnixAPI};
const BugType BT_pthreadOnce{this, "Improper use of 'pthread_once'",
categories::UnixAPI};
const BugType BT_ArgumentNull{this, "NULL pointer", categories::UnixAPI};
- mutable std::optional<uint64_t> Val_O_CREAT;
+ const CachedMacroValue Val_O_CREAT;
ProgramStateRef
EnsurePtrNotNull(SVal PtrVal, const Expr *PtrExpr, CheckerContext &C,
@@ -63,6 +74,9 @@ class UnixAPIMisuseChecker
const Expr *SizePtrExpr, CheckerContext &C, ProgramStateRef State) const;
public:
+ UnixAPIMisuseChecker(const ASTContext &Ctx, const Preprocessor &PP)
+ : Val_O_CREAT(getCreateFlagValue(Ctx, PP)) {}
+
void checkASTDecl(const TranslationUnitDecl *TU, AnalysisManager &Mgr,
BugReporter &BR) const;
@@ -134,20 +148,6 @@ ProgramStateRef UnixAPIMisuseChecker::EnsurePtrNotNull(
return PtrNotNull;
}
-void UnixAPIMisuseChecker::checkASTDecl(const TranslationUnitDecl *TU,
- AnalysisManager &Mgr,
- BugReporter &) const {
- // The definition of O_CREAT is platform specific.
- // Try to get the macro value from the preprocessor.
- Val_O_CREAT = tryExpandAsInteger("O_CREAT", Mgr.getPreprocessor());
- // If we failed, fall-back to known values.
- if (!Val_O_CREAT) {
- if (TU->getASTContext().getTargetInfo().getTriple().getVendor() ==
- llvm::Triple::Apple)
- Val_O_CREAT = 0x0200;
- }
-}
-
//===----------------------------------------------------------------------===//
// "open" (man 2 open)
//===----------------------------------------------------------------------===/
@@ -262,7 +262,7 @@ void UnixAPIMisuseChecker::CheckOpenVariant(CheckerContext &C,
return;
}
- if (!Val_O_CREAT) {
+ if (!Val_O_CREAT.hasValue()) {
return;
}
@@ -276,7 +276,7 @@ void UnixAPIMisuseChecker::CheckOpenVariant(CheckerContext &C,
}
NonLoc oflags = V.castAs<NonLoc>();
NonLoc ocreateFlag = C.getSValBuilder()
- .makeIntVal(*Val_O_CREAT, oflagsEx->getType())
+ .makeIntVal(Val_O_CREAT.value(), oflagsEx->getType())
.castAs<NonLoc>();
SVal maskedFlagsUC = C.getSValBuilder().evalBinOpNN(state, BO_And,
oflags, ocreateFlag,
@@ -621,14 +621,17 @@ void UnixAPIPortabilityChecker::checkPreStmt(const CallExpr *CE,
// Registration.
//===----------------------------------------------------------------------===//
-#define REGISTER_CHECKER(CHECKERNAME) \
- void ento::register##CHECKERNAME(CheckerManager &mgr) { \
- mgr.registerChecker<CHECKERNAME>(); \
- } \
- \
- bool ento::shouldRegister##CHECKERNAME(const CheckerManager &mgr) { \
- return true; \
- }
+void ento::registerUnixAPIMisuseChecker(CheckerManager &Mgr) {
+ Mgr.registerChecker<UnixAPIMisuseChecker>(Mgr.getASTContext(),
+ Mgr.getPreprocessor());
+}
+bool ento::shouldRegisterUnixAPIMisuseChecker(const CheckerManager &Mgr) {
+ return true;
+}
-REGISTER_CHECKER(UnixAPIMisuseChecker)
-REGISTER_CHECKER(UnixAPIPortabilityChecker)
+void ento::registerUnixAPIPortabilityChecker(CheckerManager &Mgr) {
+ Mgr.registerChecker<UnixAPIPortabilityChecker>();
+}
+bool ento::shouldRegisterUnixAPIPortabilityChecker(const CheckerManager &Mgr) {
+ return true;
+}
diff --git a/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp b/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
index 189d7d6bede8e..db177b584b4f5 100644
--- a/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
+++ b/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
@@ -224,16 +224,6 @@ class AnalysisConsumer : public AnalysisASTConsumer,
}
}
- void Initialize(ASTContext &Context) override {
- Ctx = &Context;
- checkerMgr = std::make_unique<CheckerManager>(*Ctx, Opts, PP, Plugins,
- CheckerRegistrationFns);
-
- Mgr = std::make_unique<AnalysisManager>(*Ctx, PP, PathConsumers,
- CreateStoreMgr, CreateConstraintMgr,
- checkerMgr.get(), Opts, Injector);
- }
-
/// Store the top level decls in the set to be processed later on.
/// (Doing this pre-processing avoids deserialization of data from PCH.)
bool HandleTopLevelDecl(DeclGroupRef D) override;
@@ -615,6 +605,14 @@ void AnalysisConsumer::HandleTranslationUnit(ASTContext &C) {
if (Diags.hasErrorOccurred() || Diags.hasFatalErrorOccurred())
return;
+ Ctx = &C;
+ checkerMgr = std::make_unique<CheckerManager>(*Ctx, Opts, PP, Plugins,
+ CheckerRegistrationFns);
+
+ Mgr = std::make_unique<AnalysisManager>(*Ctx, PP, PathConsumers,
+ CreateStoreMgr, CreateConstraintMgr,
+ checkerMgr.get(), Opts, Injector);
+
// Explicitly destroy the PathDiagnosticConsumer. This will flush its output.
// FIXME: This should be replaced with something that doesn't rely on
// side-effects in PathDiagnosticConsumer's destructor. This is required when
|
@llvm/pr-subscribers-clang-static-analyzer-1 Author: Balazs Benics (steakhal) ChangesIf we were to delay checker constructions after we have a filled ASTContext, then we could get rid of a bunch of "lazy initializers" in checkers. Turns out in the register functions of the checkers we could transfer the ASTContext and all other things to checkers, so those could benefit from in-class initializers and const fields. For example, if a checker would take the ASTContext as the first field, then the rest of the fields could use it in their in-class initializers, so the ctor of the checker would only need to set a single field! This would open uup countless opportunities for cleaning up the asthetics of our checkers. I attached a single use-case for the AST and the PP as demonstrating purposes. You can imagine the rest. FYI: This may be a breaking change to some downstream users that may had some means to attach different listeners and what not to e.g. the Preprocessor inside their checker register functions. Since we delay the calls to these register fns after parsing is already done, they would of course miss the parsing Preprocessor events. Full diff: https://github.com/llvm/llvm-project/pull/127409.diff 3 Files Affected:
diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerHelpers.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerHelpers.h
index b4afaaeec9a4b..f7635aa0342d1 100644
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerHelpers.h
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerHelpers.h
@@ -73,6 +73,23 @@ Nullability getNullabilityAnnotation(QualType Type);
/// returned.
std::optional<int> tryExpandAsInteger(StringRef Macro, const Preprocessor &PP);
+class CachedMacroValue {
+public:
+ CachedMacroValue(StringRef MacroSpelling, const Preprocessor &PP)
+ : MacroValueOrFailure(tryExpandAsInteger(MacroSpelling, PP)) {}
+ explicit CachedMacroValue(int ConcreteValue)
+ : MacroValueOrFailure(ConcreteValue) {}
+
+ int valueOr(int Default) const {
+ return MacroValueOrFailure.value_or(Default);
+ }
+ bool hasValue() const { return MacroValueOrFailure.has_value(); }
+ int value() const { return MacroValueOrFailure.value(); }
+
+private:
+ std::optional<int> MacroValueOrFailure;
+};
+
class OperatorKind {
union {
BinaryOperatorKind Bin;
diff --git a/clang/lib/StaticAnalyzer/Checkers/UnixAPIChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/UnixAPIChecker.cpp
index da2d16ca9b5dd..0452e541e8d5c 100644
--- a/clang/lib/StaticAnalyzer/Checkers/UnixAPIChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/UnixAPIChecker.cpp
@@ -40,17 +40,28 @@ enum class OpenVariant {
OpenAt
};
+static CachedMacroValue getCreateFlagValue(const ASTContext &Ctx,
+ const Preprocessor &PP) {
+ CachedMacroValue MacroVal("O_CREAT", PP);
+ if (MacroVal.hasValue())
+ return MacroVal;
+
+ // If we failed, fall-back to known values.
+ if (Ctx.getTargetInfo().getTriple().getVendor() == llvm::Triple::Apple)
+ return CachedMacroValue{0x0200};
+ return MacroVal;
+}
+
namespace {
-class UnixAPIMisuseChecker
- : public Checker<check::PreCall, check::ASTDecl<TranslationUnitDecl>> {
+class UnixAPIMisuseChecker : public Checker<check::PreCall> {
const BugType BT_open{this, "Improper use of 'open'", categories::UnixAPI};
const BugType BT_getline{this, "Improper use of getdelim",
categories::UnixAPI};
const BugType BT_pthreadOnce{this, "Improper use of 'pthread_once'",
categories::UnixAPI};
const BugType BT_ArgumentNull{this, "NULL pointer", categories::UnixAPI};
- mutable std::optional<uint64_t> Val_O_CREAT;
+ const CachedMacroValue Val_O_CREAT;
ProgramStateRef
EnsurePtrNotNull(SVal PtrVal, const Expr *PtrExpr, CheckerContext &C,
@@ -63,6 +74,9 @@ class UnixAPIMisuseChecker
const Expr *SizePtrExpr, CheckerContext &C, ProgramStateRef State) const;
public:
+ UnixAPIMisuseChecker(const ASTContext &Ctx, const Preprocessor &PP)
+ : Val_O_CREAT(getCreateFlagValue(Ctx, PP)) {}
+
void checkASTDecl(const TranslationUnitDecl *TU, AnalysisManager &Mgr,
BugReporter &BR) const;
@@ -134,20 +148,6 @@ ProgramStateRef UnixAPIMisuseChecker::EnsurePtrNotNull(
return PtrNotNull;
}
-void UnixAPIMisuseChecker::checkASTDecl(const TranslationUnitDecl *TU,
- AnalysisManager &Mgr,
- BugReporter &) const {
- // The definition of O_CREAT is platform specific.
- // Try to get the macro value from the preprocessor.
- Val_O_CREAT = tryExpandAsInteger("O_CREAT", Mgr.getPreprocessor());
- // If we failed, fall-back to known values.
- if (!Val_O_CREAT) {
- if (TU->getASTContext().getTargetInfo().getTriple().getVendor() ==
- llvm::Triple::Apple)
- Val_O_CREAT = 0x0200;
- }
-}
-
//===----------------------------------------------------------------------===//
// "open" (man 2 open)
//===----------------------------------------------------------------------===/
@@ -262,7 +262,7 @@ void UnixAPIMisuseChecker::CheckOpenVariant(CheckerContext &C,
return;
}
- if (!Val_O_CREAT) {
+ if (!Val_O_CREAT.hasValue()) {
return;
}
@@ -276,7 +276,7 @@ void UnixAPIMisuseChecker::CheckOpenVariant(CheckerContext &C,
}
NonLoc oflags = V.castAs<NonLoc>();
NonLoc ocreateFlag = C.getSValBuilder()
- .makeIntVal(*Val_O_CREAT, oflagsEx->getType())
+ .makeIntVal(Val_O_CREAT.value(), oflagsEx->getType())
.castAs<NonLoc>();
SVal maskedFlagsUC = C.getSValBuilder().evalBinOpNN(state, BO_And,
oflags, ocreateFlag,
@@ -621,14 +621,17 @@ void UnixAPIPortabilityChecker::checkPreStmt(const CallExpr *CE,
// Registration.
//===----------------------------------------------------------------------===//
-#define REGISTER_CHECKER(CHECKERNAME) \
- void ento::register##CHECKERNAME(CheckerManager &mgr) { \
- mgr.registerChecker<CHECKERNAME>(); \
- } \
- \
- bool ento::shouldRegister##CHECKERNAME(const CheckerManager &mgr) { \
- return true; \
- }
+void ento::registerUnixAPIMisuseChecker(CheckerManager &Mgr) {
+ Mgr.registerChecker<UnixAPIMisuseChecker>(Mgr.getASTContext(),
+ Mgr.getPreprocessor());
+}
+bool ento::shouldRegisterUnixAPIMisuseChecker(const CheckerManager &Mgr) {
+ return true;
+}
-REGISTER_CHECKER(UnixAPIMisuseChecker)
-REGISTER_CHECKER(UnixAPIPortabilityChecker)
+void ento::registerUnixAPIPortabilityChecker(CheckerManager &Mgr) {
+ Mgr.registerChecker<UnixAPIPortabilityChecker>();
+}
+bool ento::shouldRegisterUnixAPIPortabilityChecker(const CheckerManager &Mgr) {
+ return true;
+}
diff --git a/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp b/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
index 189d7d6bede8e..db177b584b4f5 100644
--- a/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
+++ b/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
@@ -224,16 +224,6 @@ class AnalysisConsumer : public AnalysisASTConsumer,
}
}
- void Initialize(ASTContext &Context) override {
- Ctx = &Context;
- checkerMgr = std::make_unique<CheckerManager>(*Ctx, Opts, PP, Plugins,
- CheckerRegistrationFns);
-
- Mgr = std::make_unique<AnalysisManager>(*Ctx, PP, PathConsumers,
- CreateStoreMgr, CreateConstraintMgr,
- checkerMgr.get(), Opts, Injector);
- }
-
/// Store the top level decls in the set to be processed later on.
/// (Doing this pre-processing avoids deserialization of data from PCH.)
bool HandleTopLevelDecl(DeclGroupRef D) override;
@@ -615,6 +605,14 @@ void AnalysisConsumer::HandleTranslationUnit(ASTContext &C) {
if (Diags.hasErrorOccurred() || Diags.hasFatalErrorOccurred())
return;
+ Ctx = &C;
+ checkerMgr = std::make_unique<CheckerManager>(*Ctx, Opts, PP, Plugins,
+ CheckerRegistrationFns);
+
+ Mgr = std::make_unique<AnalysisManager>(*Ctx, PP, PathConsumers,
+ CreateStoreMgr, CreateConstraintMgr,
+ checkerMgr.get(), Opts, Injector);
+
// Explicitly destroy the PathDiagnosticConsumer. This will flush its output.
// FIXME: This should be replaced with something that doesn't rely on
// side-effects in PathDiagnosticConsumer's destructor. This is required when
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm happy to see this opportunity to improve the code quality 🙂
I'm not familiar with the initialization procedure of the analyzer, but this change should affect every analysis run equally, so if you managed to run at least the check-clang-analyzer
tests (which I presume), then the commit should be good to go.
clang/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerHelpers.h
Outdated
Show resolved
Hide resolved
return CachedMacroValue{0x0200}; | ||
return MacroVal; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tryExpandAsInteger
could have a version which returns a non-optional (or optional) value and takes a default value or a lambda for the default value. It could be used instead of this function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd refrain from generalizing right away. If we see this pattern appear again, we can think about concrete steps reducing the code duplication. So far I don't think it's the time.
I am OK with this tradeoff but wondering if it is possible to add back support. E.g., having a special pre-parsing callback that can do this sort of setup (but does not do any registration yet). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the reviews!
clang/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerHelpers.h
Outdated
Show resolved
Hide resolved
return CachedMacroValue{0x0200}; | ||
return MacroVal; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd refrain from generalizing right away. If we see this pattern appear again, we can think about concrete steps reducing the code duplication. So far I don't think it's the time.
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/55/builds/7431 Here is the relevant piece of the build log for the reference
|
…28350) Reverts #127409 This caused a test failure: LLVM Buildbot has detected a new failure on builder `sanitizer-aarch64-linux-bootstrap-hwasan` running on `sanitizer-buildbot11` while building `clang` at step 2 "annotate". Full details are available at: https://lab.llvm.org/buildbot/#/builders/55/builds/7431 <details> <summary>Here is the relevant piece of the build log for the reference</summary> ``` Step 2 (annotate) failure: 'python ../sanitizer_buildbot/sanitizers/zorg/buildbot/builders/sanitizers/buildbot_selector.py' (failure) ... llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:512: note: using lld-link: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/lld-link llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:512: note: using ld64.lld: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/ld64.lld llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:512: note: using wasm-ld: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/wasm-ld llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:512: note: using ld.lld: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/ld.lld llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:512: note: using lld-link: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/lld-link llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:512: note: using ld64.lld: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/ld64.lld llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:512: note: using wasm-ld: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/wasm-ld llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/main.py:72: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 900 seconds was requested on the command line. Forcing timeout to be 900 seconds. -- Testing: 86643 tests, 72 workers -- Testing: FAIL: Clang :: Analysis/cxx11-crashes.cpp (1006 of 86643) ******************** TEST 'Clang :: Analysis/cxx11-crashes.cpp' FAILED ******************** Exit Code: 134 Command Output (stderr): -- RUN: at line 1: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/clang -cc1 -internal-isystem /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/lib/clang/21/include -nostdsysteminc -analyze -analyzer-constraints=range -setup-static-analyzer -analyzer-checker=core -std=c++11 -verify /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/clang/test/Analysis/cxx11-crashes.cpp + /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/clang -cc1 -internal-isystem /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/lib/clang/21/include -nostdsysteminc -analyze -analyzer-constraints=range -setup-static-analyzer -analyzer-checker=core -std=c++11 -verify /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/clang/test/Analysis/cxx11-crashes.cpp libc++abi: Pure virtual function called! /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/tools/clang/test/Analysis/Output/cxx11-crashes.cpp.script: line 1: 1936960 Aborted /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/clang -cc1 -internal-isystem /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/lib/clang/21/include -nostdsysteminc -analyze -analyzer-constraints=range -setup-static-analyzer -analyzer-checker=core -std=c++11 -verify /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/clang/test/Analysis/cxx11-crashes.cpp -- ******************** Testing: FAIL: Clang :: Analysis/stack-block-returned.cpp (1505 of 86643) ******************** TEST 'Clang :: Analysis/stack-block-returned.cpp' FAILED ******************** Exit Code: 134 Command Output (stderr): -- RUN: at line 1: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/clang -cc1 -internal-isystem /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/lib/clang/21/include -nostdsysteminc -analyze -analyzer-constraints=range -setup-static-analyzer -analyzer-checker=core -fblocks -verify /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/clang/test/Analysis/stack-block-returned.cpp + /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/clang -cc1 -internal-isystem /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/lib/clang/21/include -nostdsysteminc -analyze -analyzer-constraints=range -setup-static-analyzer -analyzer-checker=core -fblocks -verify /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/clang/test/Analysis/stack-block-returned.cpp libc++abi: Pure virtual function called! /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/tools/clang/test/Analysis/Output/stack-block-returned.cpp.script: line 1: 1940139 Aborted /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/clang -cc1 -internal-isystem /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/lib/clang/21/include -nostdsysteminc -analyze -analyzer-constraints=range -setup-static-analyzer -analyzer-checker=core -fblocks -verify /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/clang/test/Analysis/stack-block-returned.cpp -- ******************** Testing: 0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.. Slowest Tests: -------------------------------------------------------------------------- 59.70s: Clang :: Driver/fsanitize.c 48.34s: Clang :: Preprocessor/riscv-target-features.c 41.66s: Clang :: OpenMP/target_defaultmap_codegen_01.cpp 40.68s: Clang :: OpenMP/target_update_codegen.cpp 39.21s: Clang :: Driver/arm-cortex-cpus-2.c 38.19s: Clang :: Driver/arm-cortex-cpus-1.c 36.55s: Clang :: Preprocessor/arm-target-features.c Step 11 (stage2/hwasan check) failure: stage2/hwasan check (failure) ... llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:512: note: using lld-link: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/lld-link llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:512: note: using ld64.lld: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/ld64.lld llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:512: note: using wasm-ld: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/wasm-ld llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:512: note: using ld.lld: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/ld.lld llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:512: note: using lld-link: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/lld-link llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:512: note: using ld64.lld: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/ld64.lld llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:512: note: using wasm-ld: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/wasm-ld llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/main.py:72: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 900 seconds was requested on the command line. Forcing timeout to be 900 seconds. -- Testing: 86643 tests, 72 workers -- Testing: FAIL: Clang :: Analysis/cxx11-crashes.cpp (1006 of 86643) ******************** TEST 'Clang :: Analysis/cxx11-crashes.cpp' FAILED ******************** Exit Code: 134 Command Output (stderr): -- RUN: at line 1: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/clang -cc1 -internal-isystem /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/lib/clang/21/include -nostdsysteminc -analyze -analyzer-constraints=range -setup-static-analyzer -analyzer-checker=core -std=c++11 -verify /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/clang/test/Analysis/cxx11-crashes.cpp + /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/clang -cc1 -internal-isystem /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/lib/clang/21/include -nostdsysteminc -analyze -analyzer-constraints=range -setup-static-analyzer -analyzer-checker=core -std=c++11 -verify /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/clang/test/Analysis/cxx11-crashes.cpp libc++abi: Pure virtual function called! /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/tools/clang/test/Analysis/Output/cxx11-crashes.cpp.script: line 1: 1936960 Aborted /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/clang -cc1 -internal-isystem /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/lib/clang/21/include -nostdsysteminc -analyze -analyzer-constraints=range -setup-static-analyzer -analyzer-checker=core -std=c++11 -verify /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/clang/test/Analysis/cxx11-crashes.cpp -- ******************** Testing: FAIL: Clang :: Analysis/stack-block-returned.cpp (1505 of 86643) ******************** TEST 'Clang :: Analysis/stack-block-returned.cpp' FAILED ******************** Exit Code: 134 Command Output (stderr): -- RUN: at line 1: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/clang -cc1 -internal-isystem /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/lib/clang/21/include -nostdsysteminc -analyze -analyzer-constraints=range -setup-static-analyzer -analyzer-checker=core -fblocks -verify /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/clang/test/Analysis/stack-block-returned.cpp + /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/clang -cc1 -internal-isystem /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/lib/clang/21/include -nostdsysteminc -analyze -analyzer-constraints=range -setup-static-analyzer -analyzer-checker=core -fblocks -verify /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/clang/test/Analysis/stack-block-returned.cpp libc++abi: Pure virtual function called! /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/tools/clang/test/Analysis/Output/stack-block-returned.cpp.script: line 1: 1940139 Aborted /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/clang -cc1 -internal-isystem /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/lib/clang/21/include -nostdsysteminc -analyze -analyzer-constraints=range -setup-static-analyzer -analyzer-checker=core -fblocks -verify /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/clang/test/Analysis/stack-block-returned.cpp -- ******************** Testing: 0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.. Slowest Tests: -------------------------------------------------------------------------- 59.70s: Clang :: Driver/fsanitize.c 48.34s: Clang :: Preprocessor/riscv-target-features.c 41.66s: Clang :: OpenMP/target_defaultmap_codegen_01.cpp 40.68s: Clang :: OpenMP/target_update_codegen.cpp 39.21s: Clang :: Driver/arm-cortex-cpus-2.c 38.19s: Clang :: Driver/arm-cortex-cpus-1.c 36.55s: Clang :: Preprocessor/arm-target-features.c ``` </details>
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/169/builds/8731 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/24/builds/5580 Here is the relevant piece of the build log for the reference
|
…arsing" (#128350) Reverts llvm/llvm-project#127409 This caused a test failure: LLVM Buildbot has detected a new failure on builder `sanitizer-aarch64-linux-bootstrap-hwasan` running on `sanitizer-buildbot11` while building `clang` at step 2 "annotate". Full details are available at: https://lab.llvm.org/buildbot/#/builders/55/builds/7431 <details> <summary>Here is the relevant piece of the build log for the reference</summary> ``` Step 2 (annotate) failure: 'python ../sanitizer_buildbot/sanitizers/zorg/buildbot/builders/sanitizers/buildbot_selector.py' (failure) ... llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:512: note: using lld-link: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/lld-link llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:512: note: using ld64.lld: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/ld64.lld llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:512: note: using wasm-ld: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/wasm-ld llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:512: note: using ld.lld: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/ld.lld llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:512: note: using lld-link: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/lld-link llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:512: note: using ld64.lld: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/ld64.lld llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:512: note: using wasm-ld: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/wasm-ld llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/main.py:72: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 900 seconds was requested on the command line. Forcing timeout to be 900 seconds. -- Testing: 86643 tests, 72 workers -- Testing: FAIL: Clang :: Analysis/cxx11-crashes.cpp (1006 of 86643) ******************** TEST 'Clang :: Analysis/cxx11-crashes.cpp' FAILED ******************** Exit Code: 134 Command Output (stderr): -- RUN: at line 1: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/clang -cc1 -internal-isystem /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/lib/clang/21/include -nostdsysteminc -analyze -analyzer-constraints=range -setup-static-analyzer -analyzer-checker=core -std=c++11 -verify /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/clang/test/Analysis/cxx11-crashes.cpp + /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/clang -cc1 -internal-isystem /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/lib/clang/21/include -nostdsysteminc -analyze -analyzer-constraints=range -setup-static-analyzer -analyzer-checker=core -std=c++11 -verify /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/clang/test/Analysis/cxx11-crashes.cpp libc++abi: Pure virtual function called! /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/tools/clang/test/Analysis/Output/cxx11-crashes.cpp.script: line 1: 1936960 Aborted /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/clang -cc1 -internal-isystem /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/lib/clang/21/include -nostdsysteminc -analyze -analyzer-constraints=range -setup-static-analyzer -analyzer-checker=core -std=c++11 -verify /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/clang/test/Analysis/cxx11-crashes.cpp -- ******************** Testing: FAIL: Clang :: Analysis/stack-block-returned.cpp (1505 of 86643) ******************** TEST 'Clang :: Analysis/stack-block-returned.cpp' FAILED ******************** Exit Code: 134 Command Output (stderr): -- RUN: at line 1: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/clang -cc1 -internal-isystem /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/lib/clang/21/include -nostdsysteminc -analyze -analyzer-constraints=range -setup-static-analyzer -analyzer-checker=core -fblocks -verify /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/clang/test/Analysis/stack-block-returned.cpp + /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/clang -cc1 -internal-isystem /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/lib/clang/21/include -nostdsysteminc -analyze -analyzer-constraints=range -setup-static-analyzer -analyzer-checker=core -fblocks -verify /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/clang/test/Analysis/stack-block-returned.cpp libc++abi: Pure virtual function called! /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/tools/clang/test/Analysis/Output/stack-block-returned.cpp.script: line 1: 1940139 Aborted /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/clang -cc1 -internal-isystem /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/lib/clang/21/include -nostdsysteminc -analyze -analyzer-constraints=range -setup-static-analyzer -analyzer-checker=core -fblocks -verify /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/clang/test/Analysis/stack-block-returned.cpp -- ******************** Testing: 0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.. Slowest Tests: -------------------------------------------------------------------------- 59.70s: Clang :: Driver/fsanitize.c 48.34s: Clang :: Preprocessor/riscv-target-features.c 41.66s: Clang :: OpenMP/target_defaultmap_codegen_01.cpp 40.68s: Clang :: OpenMP/target_update_codegen.cpp 39.21s: Clang :: Driver/arm-cortex-cpus-2.c 38.19s: Clang :: Driver/arm-cortex-cpus-1.c 36.55s: Clang :: Preprocessor/arm-target-features.c Step 11 (stage2/hwasan check) failure: stage2/hwasan check (failure) ... llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:512: note: using lld-link: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/lld-link llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:512: note: using ld64.lld: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/ld64.lld llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:512: note: using wasm-ld: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/wasm-ld llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:512: note: using ld.lld: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/ld.lld llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:512: note: using lld-link: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/lld-link llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:512: note: using ld64.lld: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/ld64.lld llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:512: note: using wasm-ld: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/wasm-ld llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/main.py:72: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 900 seconds was requested on the command line. Forcing timeout to be 900 seconds. -- Testing: 86643 tests, 72 workers -- Testing: FAIL: Clang :: Analysis/cxx11-crashes.cpp (1006 of 86643) ******************** TEST 'Clang :: Analysis/cxx11-crashes.cpp' FAILED ******************** Exit Code: 134 Command Output (stderr): -- RUN: at line 1: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/clang -cc1 -internal-isystem /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/lib/clang/21/include -nostdsysteminc -analyze -analyzer-constraints=range -setup-static-analyzer -analyzer-checker=core -std=c++11 -verify /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/clang/test/Analysis/cxx11-crashes.cpp + /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/clang -cc1 -internal-isystem /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/lib/clang/21/include -nostdsysteminc -analyze -analyzer-constraints=range -setup-static-analyzer -analyzer-checker=core -std=c++11 -verify /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/clang/test/Analysis/cxx11-crashes.cpp libc++abi: Pure virtual function called! /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/tools/clang/test/Analysis/Output/cxx11-crashes.cpp.script: line 1: 1936960 Aborted /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/clang -cc1 -internal-isystem /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/lib/clang/21/include -nostdsysteminc -analyze -analyzer-constraints=range -setup-static-analyzer -analyzer-checker=core -std=c++11 -verify /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/clang/test/Analysis/cxx11-crashes.cpp -- ******************** Testing: FAIL: Clang :: Analysis/stack-block-returned.cpp (1505 of 86643) ******************** TEST 'Clang :: Analysis/stack-block-returned.cpp' FAILED ******************** Exit Code: 134 Command Output (stderr): -- RUN: at line 1: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/clang -cc1 -internal-isystem /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/lib/clang/21/include -nostdsysteminc -analyze -analyzer-constraints=range -setup-static-analyzer -analyzer-checker=core -fblocks -verify /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/clang/test/Analysis/stack-block-returned.cpp + /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/clang -cc1 -internal-isystem /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/lib/clang/21/include -nostdsysteminc -analyze -analyzer-constraints=range -setup-static-analyzer -analyzer-checker=core -fblocks -verify /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/clang/test/Analysis/stack-block-returned.cpp libc++abi: Pure virtual function called! /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/tools/clang/test/Analysis/Output/stack-block-returned.cpp.script: line 1: 1940139 Aborted /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/clang -cc1 -internal-isystem /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/lib/clang/21/include -nostdsysteminc -analyze -analyzer-constraints=range -setup-static-analyzer -analyzer-checker=core -fblocks -verify /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/clang/test/Analysis/stack-block-returned.cpp -- ******************** Testing: 0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.. Slowest Tests: -------------------------------------------------------------------------- 59.70s: Clang :: Driver/fsanitize.c 48.34s: Clang :: Preprocessor/riscv-target-features.c 41.66s: Clang :: OpenMP/target_defaultmap_codegen_01.cpp 40.68s: Clang :: OpenMP/target_update_codegen.cpp 39.21s: Clang :: Driver/arm-cortex-cpus-2.c 38.19s: Clang :: Driver/arm-cortex-cpus-1.c 36.55s: Clang :: Preprocessor/arm-target-features.c ``` </details>
…lyzer Well, yes. It's not pretty. At least after this we would have a bit more unique pointers than before. This is for fixing the memory leak diagnosed by: https://lab.llvm.org/buildbot/#/builders/24/builds/5580 And that caused the revert of llvm#127409. After these uptrs that patch can re-land finally.
…lyzer (#128368) Well, yes. It's not pretty. At least after this we would have a bit more unique pointers than before. This is for fixing the memory leak diagnosed by: https://lab.llvm.org/buildbot/#/builders/24/builds/5580 And that caused the revert of #127409. After these uptrs that patch can re-land finally.
If we were to delay checker constructions after we have a filled ASTContext, then we could get rid of a bunch of "lazy initializers" in checkers.
Turns out in the register functions of the checkers we could transfer the ASTContext and all other things to checkers, so those could benefit from in-class initializers and const fields.
For example, if a checker would take the ASTContext as the first field, then the rest of the fields could use it in their in-class initializers, so the ctor of the checker would only need to set a single field!
This would open uup countless opportunities for cleaning up the asthetics of our checkers.
I attached a single use-case for the AST and the PP as demonstrating purposes. You can imagine the rest.
FYI: This may be a breaking change to some downstream users that may had some means to attach different listeners and what not to e.g. the Preprocessor inside their checker register functions. Since we delay the calls to these register fns after parsing is already done, they would of course miss the parsing Preprocessor events.