diff options
Diffstat (limited to 'include/clang')
-rw-r--r-- | include/clang/AST/TemplateBase.h | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/include/clang/AST/TemplateBase.h b/include/clang/AST/TemplateBase.h index 9d3f45f4b2..76cbcfbf7f 100644 --- a/include/clang/AST/TemplateBase.h +++ b/include/clang/AST/TemplateBase.h @@ -244,12 +244,13 @@ public: /// \brief Retrieve the template argument as an integral value. // FIXME: Provide a way to read the integral data without copying the value. llvm::APSInt getAsIntegral() const { + using namespace llvm; if (Integer.BitWidth <= 64) - return llvm::APSInt(llvm::APInt(Integer.BitWidth, Integer.VAL), - Integer.IsUnsigned); - return llvm::APSInt(llvm::APInt(Integer.BitWidth, - llvm::makeArrayRef(Integer.pVal, Integer.BitWidth / 8)), - Integer.IsUnsigned); + return APSInt(APInt(Integer.BitWidth, Integer.VAL), Integer.IsUnsigned); + + unsigned NumWords = APInt::getNumWords(Integer.BitWidth); + return APSInt(APInt(Integer.BitWidth, makeArrayRef(Integer.pVal, NumWords)), + Integer.IsUnsigned); } /// \brief Retrieve the type of the integral value. |