[PATCH] D34912: Handle cases where the value is too large to fit into the underlying type.

Vassil Vassilev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 30 14:59:19 PDT 2017


v.g.vassilev created this revision.

Patch by Axel Naumann!


Repository:
  rL LLVM

https://reviews.llvm.org/D34912

Files:
  lib/AST/TemplateBase.cpp


Index: lib/AST/TemplateBase.cpp
===================================================================
--- lib/AST/TemplateBase.cpp
+++ lib/AST/TemplateBase.cpp
@@ -62,6 +62,12 @@
     Out << "'";
   } else {
     Out << Val;
+    // Handle cases where the value is too large to fit into the underlying type
+    // i.e. where the unsignedness matters.
+    if (const BuiltinType *BT = T->getAs<BuiltinType>()) {
+      if (Val.isUnsigned() && Val.getBitWidth() == 64 && Val.isNegative())
+        Out << "ull";
+    }
   }
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34912.104941.patch
Type: text/x-patch
Size: 526 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170630/6648282c/attachment.bin>


More information about the cfe-commits mailing list