Author: Ziqing Luo
Date: 2026-08-28T11:52:36-07:00
New Revision: 4303ea8d11bc507a9bfcb152d2e463203b3b1854

URL: 
https://github.com/llvm/llvm-project/commit/4303ea8d11bc507a9bfcb152d2e463203b3b1854
DIFF: 
https://github.com/llvm/llvm-project/commit/4303ea8d11bc507a9bfcb152d2e463203b3b1854.diff

LOG: [SSAF] Remove useless anchor variable from test plugin (#219081)

The plugin code defines the extern variable
SSAFTestTransformationAnchorSource, which is supposed to be used to
force static linking, so not needed here.

The variable definition should undoubtedly be removed, as doing so
solves the build issue locally. The explanation below regarding why this
variable causes the issue was provided by Claude. I repeatedly asked
Claude questions, and he revised his reasoning several times until it
became consistent. However, we should still take the following
explanation with a grain of salt:

ASan created a private alias symbol for the extern variable
SSAFTestTransformationAnchorSource. The linker, when in
'-flat_namespace' mode, treated the symbol as a name-based bind, which
later failed to be resolved through name searching by the loader.

rdar://185749574

Assisted by Claude

Added: 
    

Modified: 
    
clang/test/Analysis/Scalable/source-edit-generation/Plugins/TestTransformationPlugin/TestTransformation.cpp
    clang/test/Analysis/Scalable/source-edit-generation/coexistence.cpp
    clang/test/Analysis/Scalable/source-edit-generation/happy-path.cpp
    clang/test/Analysis/Scalable/source-edit-generation/write-failure.cpp

Removed: 
    


################################################################################
diff  --git 
a/clang/test/Analysis/Scalable/source-edit-generation/Plugins/TestTransformationPlugin/TestTransformation.cpp
 
b/clang/test/Analysis/Scalable/source-edit-generation/Plugins/TestTransformationPlugin/TestTransformation.cpp
index 33a8319cd5b6a..2909cdfc5821b 100644
--- 
a/clang/test/Analysis/Scalable/source-edit-generation/Plugins/TestTransformationPlugin/TestTransformation.cpp
+++ 
b/clang/test/Analysis/Scalable/source-edit-generation/Plugins/TestTransformationPlugin/TestTransformation.cpp
@@ -89,15 +89,7 @@ class TestTransformation final : public Transformation {
 
 } // namespace
 
-namespace clang::ssaf {
-// NOLINTNEXTLINE(misc-use-internal-linkage)
-volatile int SSAFTestTransformationAnchorSource = 0;
-} // namespace clang::ssaf
-
-// This global causes issue in stage2 with ASan-instrumented clang so
-// adding the no-ASan attribute.
 static TransformationRegistry::Add<TestTransformation>
-    __attribute__((no_sanitize("address")))
     RegisterTestTransformation("test-transformation",
                                "Test transformation for the SSAF "
                                "source-edit-generation lit suite");

diff  --git 
a/clang/test/Analysis/Scalable/source-edit-generation/coexistence.cpp 
b/clang/test/Analysis/Scalable/source-edit-generation/coexistence.cpp
index 410022caaa3a9..f93eafa9e3ab1 100644
--- a/clang/test/Analysis/Scalable/source-edit-generation/coexistence.cpp
+++ b/clang/test/Analysis/Scalable/source-edit-generation/coexistence.cpp
@@ -6,8 +6,6 @@
 
 // REQUIRES: plugins
 
-// UNSUPPORTED: target={{.*}}
-
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: %clang_cc1 -load %llvmshlibdir/SSAFTestTransformationPlugin%pluginext \
 // RUN:   --ssaf-extract-summaries=CallGraph \

diff  --git 
a/clang/test/Analysis/Scalable/source-edit-generation/happy-path.cpp 
b/clang/test/Analysis/Scalable/source-edit-generation/happy-path.cpp
index a0e6ab0de7a88..d22c901217c31 100644
--- a/clang/test/Analysis/Scalable/source-edit-generation/happy-path.cpp
+++ b/clang/test/Analysis/Scalable/source-edit-generation/happy-path.cpp
@@ -7,9 +7,6 @@
 
 // REQUIRES: plugins
 
-// UNSUPPORTED: target={{.*}}
-
-
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: %clang_cc1 -load %llvmshlibdir/SSAFTestTransformationPlugin%pluginext \
 // RUN:   --ssaf-source-transformation=test-transformation \

diff  --git 
a/clang/test/Analysis/Scalable/source-edit-generation/write-failure.cpp 
b/clang/test/Analysis/Scalable/source-edit-generation/write-failure.cpp
index 4c077702b1014..74ef0421045a8 100644
--- a/clang/test/Analysis/Scalable/source-edit-generation/write-failure.cpp
+++ b/clang/test/Analysis/Scalable/source-edit-generation/write-failure.cpp
@@ -5,8 +5,6 @@
 
 // REQUIRES: plugins
 
-// UNSUPPORTED: target={{.*}}
-
 // RUN: rm -rf %t && mkdir -p %t
 
 // 
=============================================================================


        
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to