[PATCH] PR15677 - Crash in template diffing.

Richard Trieu rtrieu at google.com
Mon Jun 30 20:17:10 PDT 2014


LGTM

Address the one comment and you are ready to submit.

================
Comment at: lib/AST/ASTDiagnostic.cpp:1131-1137
@@ +1130,9 @@
+    if (Iter.isEnd() && ArgExpr->isValueDependent()) {
+      TemplateArgument::ArgKind Kind = Iter.getDesugar().getKind();
+      if (Kind == TemplateArgument::Integral) {
+        Int = Iter.getDesugar().getAsIntegral();
+      } else if (Kind == TemplateArgument::Expression) {
+        ArgExpr = Iter.getDesugar().getAsExpr();
+        Int = ArgExpr->EvaluateKnownConstInt(Context);
+      } else {
+        llvm_unreachable("Unexpected template argument kind");
----------------
Nikola Smiljanić wrote:
> Richard Trieu wrote:
> > Why did you change from a switch statement to an if chain here?
> The entire function was coded in Phabricator and was missing breaks. After adding those it seem to be a fair bit longer than needed. Do you want me to change it?
Yes, please change it back.  Also, use "return true;" instead of breaks and remove the "return true;" below.  This mirrors the old codeflow better.

http://reviews.llvm.org/D4226






More information about the cfe-commits mailing list