diff --git a/include/llvm/CodeGen/DIE.h b/include/llvm/CodeGen/DIE.h index c843f3fd1a6..e247d46ba5b 100644 --- a/include/llvm/CodeGen/DIE.h +++ b/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"