[clang] [compiler-rt] [llvm] [TySan] Let TypeSanitizer know about conservative path TBAA data (PR #227782)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 30 09:49:24 PDT 2026
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp -- compiler-rt/test/tysan/no-false-positive-issue208646.cpp compiler-rt/test/tysan/no-false-positive-issue208647.cpp compiler-rt/test/tysan/no-false-positive-issue208655.cpp compiler-rt/test/tysan/no-false-positive-issue210643.cpp clang/lib/CodeGen/CodeGenTBAA.cpp compiler-rt/lib/tysan/tysan.cpp llvm/lib/Transforms/Instrumentation/TypeSanitizer.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/CodeGen/CodeGenTBAA.cpp b/clang/lib/CodeGen/CodeGenTBAA.cpp
index acdf6abc5..166ef2493 100644
--- a/clang/lib/CodeGen/CodeGenTBAA.cpp
+++ b/clang/lib/CodeGen/CodeGenTBAA.cpp
@@ -367,7 +367,7 @@ llvm::MDNode *CodeGenTBAA::getTypeInfoHelper(const Type *Ty) {
}
// For now, handle any other kind of type conservatively.
- if(Features.Sanitize.has(SanitizerKind::Type)){
+ if (Features.Sanitize.has(SanitizerKind::Type)) {
return createScalarTypeNode("TysanConservativeTBAA", getChar(), 1);
}
return getChar();
diff --git a/compiler-rt/test/tysan/no-false-positive-issue208646.cpp b/compiler-rt/test/tysan/no-false-positive-issue208646.cpp
index 236b4a86d..fc8a2da6e 100644
--- a/compiler-rt/test/tysan/no-false-positive-issue208646.cpp
+++ b/compiler-rt/test/tysan/no-false-positive-issue208646.cpp
@@ -1,11 +1,11 @@
// RUN: %clangxx_tysan -O0 %s -o %t && %run %t
-#include <string>
#include <optional>
+#include <string>
static std::optional<std::string> optional_var = std::nullopt;
-int main() {
+int main() {
optional_var = "this is a random long string (short one does not reproduce)";
return 0;
}
diff --git a/compiler-rt/test/tysan/no-false-positive-issue208655.cpp b/compiler-rt/test/tysan/no-false-positive-issue208655.cpp
index 7518b2445..cba71c5b5 100644
--- a/compiler-rt/test/tysan/no-false-positive-issue208655.cpp
+++ b/compiler-rt/test/tysan/no-false-positive-issue208655.cpp
@@ -3,13 +3,13 @@
#include <vector>
struct Registry {
- std::vector<int> arr;
- char temp_byte;
- bool bool_var = false;
+ std::vector<int> arr;
+ char temp_byte;
+ bool bool_var = false;
};
int main() {
- static Registry r;
- r.arr.push_back(0);
- r.bool_var = true;
+ static Registry r;
+ r.arr.push_back(0);
+ r.bool_var = true;
}
diff --git a/compiler-rt/test/tysan/no-false-positive-issue210643.cpp b/compiler-rt/test/tysan/no-false-positive-issue210643.cpp
index d667f7564..4a74abd43 100644
--- a/compiler-rt/test/tysan/no-false-positive-issue210643.cpp
+++ b/compiler-rt/test/tysan/no-false-positive-issue210643.cpp
@@ -1,11 +1,9 @@
// RUN: %clangxx_tysan -O0 %s -o %t && %run %t
struct A {
- int elems[3];
+ int elems[3];
};
A a;
-int main() {
- a.elems[0] = 1;
-}
+int main() { a.elems[0] = 1; }
``````````
</details>
https://github.com/llvm/llvm-project/pull/227782
More information about the llvm-commits
mailing list