aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorFlorian Hahn <flo@fhahn.com>2024-02-27 20:09:54 +0000
committerGitHub <noreply@github.com>2024-02-27 20:09:54 +0000
commitd2a9df2c8ffd21fd52fbd8199a191d10078f41af (patch)
tree20508d92cbbcca0978a9d4364d3afd7a6e17310d /clang/lib/CodeGen/CodeGenModule.cpp
parent0d1f95760b07a31293ccc82086306833326b70a4 (diff)
downloadllvm-d2a9df2c8ffd21fd52fbd8199a191d10078f41af.zip
llvm-d2a9df2c8ffd21fd52fbd8199a191d10078f41af.tar.gz
llvm-d2a9df2c8ffd21fd52fbd8199a191d10078f41af.tar.bz2
[TBAA] Handle bitfields when generating !tbaa.struct metadata. (#82922)
At the moment, clang generates what I believe are incorrect !tbaa.struct fields for named bitfields. At the moment, the base type size is used for named bifields (e.g. sizeof(int)) instead of the bifield width per field. This results in overalpping fields in !tbaa.struct metadata. This causes incorrect results when extracting individual copied fields from !tbaa.struct as in added in dc85719d5. This patch fixes that by skipping by combining adjacent bitfields in fields with correct sizes. Fixes https://github.com/llvm/llvm-project/issues/82586
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 1550b00..d16d12f 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -397,8 +397,8 @@ CodeGenModule::CodeGenModule(ASTContext &C,
// Enable TBAA unless it's suppressed. ThreadSanitizer needs TBAA even at O0.
if (LangOpts.Sanitize.has(SanitizerKind::Thread) ||
(!CodeGenOpts.RelaxedAliasing && CodeGenOpts.OptimizationLevel > 0))
- TBAA.reset(new CodeGenTBAA(Context, TheModule, CodeGenOpts, getLangOpts(),
- getCXXABI().getMangleContext()));
+ TBAA.reset(new CodeGenTBAA(Context, getTypes(), TheModule, CodeGenOpts,
+ getLangOpts(), getCXXABI().getMangleContext()));
// If debug info or coverage generation is enabled, create the CGDebugInfo
// object.