From 34683d10bf1bef61882101413a855c12062be24b Mon Sep 17 00:00:00 2001 From: "Duncan P. N. Exon Smith" Date: Thu, 28 May 2015 18:09:13 +0000 Subject: [PATCH] AsmPrinter: Suppress warnings on GCC from r238362, NFC GCC seems to have some overzealous warnings about strict aliasing. Rafael reports that this patch suppresses them on GCC 4.9, and I'm hoping this will work for GCC 4.7 as well. I'll watch [1] and iterate if necessary. [1]: http://bb.pgr.jp/builders/clang-3stage-x86_64-linux/builds/8597 llvm-svn: 238447 --- llvm/include/llvm/CodeGen/DIE.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/llvm/include/llvm/CodeGen/DIE.h b/llvm/include/llvm/CodeGen/DIE.h index c843f3f..e247d46 100644 --- a/llvm/include/llvm/CodeGen/DIE.h +++ b/llvm/include/llvm/CodeGen/DIE.h @@ -340,11 +340,11 @@ private: new (reinterpret_cast(Val.buffer)) T(V); } - template T &get() { return *reinterpret_cast(Val.buffer); } - template const T &get() const { - return *reinterpret_cast(Val.buffer); + template T *get() { return reinterpret_cast(Val.buffer); } + template const T *get() const { + return reinterpret_cast(Val.buffer); } - template void destruct() { get().~T(); } + template void destruct() { get()->~T(); } /// Destroy the underlying value. /// @@ -378,11 +378,11 @@ private: return; #define HANDLE_DIEVALUE_SMALL(T) \ case is##T: \ - construct(X.get()); \ + construct(*X.get()); \ return; #define HANDLE_DIEVALUE_LARGE(T) \ case is##T: \ - construct(X.get()); \ + construct(*X.get()); \ return; #include "llvm/CodeGen/DIEValue.def" } @@ -425,12 +425,12 @@ public: #define HANDLE_DIEVALUE_SMALL(T) \ const DIE##T &getDIE##T() const { \ assert(getType() == is##T && "Expected " #T); \ - return get(); \ + return *get(); \ } #define HANDLE_DIEVALUE_LARGE(T) \ const DIE##T &getDIE##T() const { \ assert(getType() == is##T && "Expected " #T); \ - return *get(); \ + return **get(); \ } #include "llvm/CodeGen/DIEValue.def" -- 2.7.4