[compiler-rt] [UBSan] Wrap Location variants in anonymous union (PR #168866)
Benjamin Stott via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 20 04:16:48 PST 2025
https://github.com/BStott6 created https://github.com/llvm/llvm-project/pull/168866
(Addresses the FIXME)
>From a362bdcc1715146752a38487b6facd9433406497 Mon Sep 17 00:00:00 2001
From: BStott <Benjamin.Stott at sony.com>
Date: Thu, 20 Nov 2025 12:08:53 +0000
Subject: [PATCH] [UBSan] Wrap Location variants in anonymous union
---
compiler-rt/lib/ubsan/ubsan_diag.h | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/compiler-rt/lib/ubsan/ubsan_diag.h b/compiler-rt/lib/ubsan/ubsan_diag.h
index c836647c98f3c..d37bc309fdd0a 100644
--- a/compiler-rt/lib/ubsan/ubsan_diag.h
+++ b/compiler-rt/lib/ubsan/ubsan_diag.h
@@ -37,10 +37,11 @@ class Location {
private:
LocationKind Kind;
- // FIXME: In C++11, wrap these in an anonymous union.
- SourceLocation SourceLoc;
- MemoryLocation MemoryLoc;
- const SymbolizedStack *SymbolizedLoc; // Not owned.
+ union {
+ SourceLocation SourceLoc;
+ MemoryLocation MemoryLoc;
+ const SymbolizedStack *SymbolizedLoc; // Not owned.
+ };
public:
Location() : Kind(LK_Null) {}
More information about the llvm-commits
mailing list