diff options
author | Florian Hahn <flo@fhahn.com> | 2024-12-17 15:13:42 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-17 15:13:42 +0000 |
commit | c135f6ffe2542bdde5a2a3e1d6515a6fc7031967 (patch) | |
tree | 0b8badc5e67d8cd0bf21b6aec8cca78c5d43d9c3 /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | cf4375d107e8055e52ff43f66b65092b075d8442 (diff) | |
download | llvm-c135f6ffe2542bdde5a2a3e1d6515a6fc7031967.zip llvm-c135f6ffe2542bdde5a2a3e1d6515a6fc7031967.tar.gz llvm-c135f6ffe2542bdde5a2a3e1d6515a6fc7031967.tar.bz2 |
[TySan] Add initial Type Sanitizer support to Clang) (#76260)
This patch introduces the Clang components of type sanitizer: a
sanitizer for type-based aliasing violations.
It is based on Hal Finkel's https://reviews.llvm.org/D32198.
The Clang changes are mostly formulaic, the one specific change being
that when the TBAA sanitizer is enabled, TBAA is always generated, even
at -O0.
It goes together with the corresponding LLVM changes
(https://github.com/llvm/llvm-project/pull/76259) and compiler-rt
changes (https://github.com/llvm/llvm-project/pull/76261)
PR: https://github.com/llvm/llvm-project/pull/76260
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 841fb1c..5ac3eef 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -397,8 +397,8 @@ CodeGenModule::CodeGenModule(ASTContext &C, if (LangOpts.HLSL) createHLSLRuntime(); - // Enable TBAA unless it's suppressed. ThreadSanitizer needs TBAA even at O0. - if (LangOpts.Sanitize.has(SanitizerKind::Thread) || + // Enable TBAA unless it's suppressed. TSan and TySan need TBAA even at O0. + if (LangOpts.Sanitize.hasOneOf(SanitizerKind::Thread | SanitizerKind::Type) || (!CodeGenOpts.RelaxedAliasing && CodeGenOpts.OptimizationLevel > 0)) TBAA.reset(new CodeGenTBAA(Context, getTypes(), TheModule, CodeGenOpts, getLangOpts())); |