[PATCH] PR15677 - Crash in template diffing.

Richard Trieu rtrieu at google.com
Tue Jun 24 22:21:25 PDT 2014


Besides the above, PrintAPSInt needs to updated since a new node format is being introduced.  On the else branch where "(no argument)" is printed, this should be changed to print the expression if E is valid, and print "(no argument)" if it is not.

================
Comment at: lib/AST/ASTDiagnostic.cpp:970
@@ -967,3 +969,3 @@
             Tree.SetKind(DiffTree::Integer);
           } else {
             Tree.SetSame(IsEqualExpr(Context, ParamWidth, FromExpr, ToExpr));
----------------
This needs another case here, (HasFromInt || HasToInt).  Use same SetNode and SetKind as above, but use SetSame(false).

================
Comment at: lib/AST/ASTDiagnostic.cpp:1122
@@ -1123,3 +1121,3 @@
   /// default arguments.
-  llvm::APInt GetInt(const TSTiterator &Iter, Expr *ArgExpr) {
+  llvm::APInt GetInt(const TSTiterator &Iter, Expr *ArgExpr, bool &HasInt) {
     // Default, value-depenedent expressions require fetching
----------------
Go with version you put in the summary: returns bool and takes APInt as an reference argument.  Update the comment here.

================
Comment at: test/Misc/diag-template-diffing.cpp:1100
@@ -1071,1 +1099,3 @@
+}
+
 // CHECK-ELIDE-NOTREE: {{[0-9]*}} errors generated.
----------------
Add another test case, just like E, but use 21 + 21 and test that "21 + 21 aka 42" is printed.

http://reviews.llvm.org/D4226






More information about the cfe-commits mailing list