[llvm-branch-commits] [cfe-branch] r277525 - Merging r277095:

Hans Wennborg via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Aug 2 14:29:54 PDT 2016


Author: hans
Date: Tue Aug  2 16:29:54 2016
New Revision: 277525

URL: http://llvm.org/viewvc/llvm-project?rev=277525&view=rev
Log:
Merging r277095:
------------------------------------------------------------------------
r277095 | epilk | 2016-07-28 17:55:40 -0700 (Thu, 28 Jul 2016) | 5 lines

[Parser] Fix bug where delayed typo in conditional expression was corrected twice

Patch by David Tarditi!

Differential revision: https://reviews.llvm.org/D22930
------------------------------------------------------------------------

Modified:
    cfe/branches/release_39/   (props changed)
    cfe/branches/release_39/lib/Parse/ParseExpr.cpp
    cfe/branches/release_39/test/Sema/typo-correction.c

Propchange: cfe/branches/release_39/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Aug  2 16:29:54 2016
@@ -1,4 +1,4 @@
 /cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:275880,275967,276102,276350,276361,276473,276653,276716,276887,276891,276979,276983,277138,277141,277221,277307
+/cfe/trunk:275880,275967,276102,276350,276361,276473,276653,276716,276887,276891,276979,276983,277095,277138,277141,277221,277307
 /cfe/trunk/test:170344
 /cfe/trunk/test/SemaTemplate:126920

Modified: cfe/branches/release_39/lib/Parse/ParseExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/lib/Parse/ParseExpr.cpp?rev=277525&r1=277524&r2=277525&view=diff
==============================================================================
--- cfe/branches/release_39/lib/Parse/ParseExpr.cpp (original)
+++ cfe/branches/release_39/lib/Parse/ParseExpr.cpp Tue Aug  2 16:29:54 2016
@@ -447,14 +447,15 @@ Parser::ParseRHSOfBinaryExpression(ExprR
         LHS = Actions.ActOnBinOp(getCurScope(), OpToken.getLocation(),
                                  OpToken.getKind(), LHS.get(), RHS.get());
 
-        // In this case, ActOnBinOp performed the CorrectDelayedTyposInExpr check.
-        if (!getLangOpts().CPlusPlus)
-          continue;
       } else {
         LHS = Actions.ActOnConditionalOp(OpToken.getLocation(), ColonLoc,
                                          LHS.get(), TernaryMiddle.get(),
                                          RHS.get());
       }
+      // In this case, ActOnBinOp or ActOnConditionalOp performed the
+      // CorrectDelayedTyposInExpr check.
+      if (!getLangOpts().CPlusPlus)
+        continue;
     }
     // Ensure potential typos aren't left undiagnosed.
     if (LHS.isInvalid()) {

Modified: cfe/branches/release_39/test/Sema/typo-correction.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/test/Sema/typo-correction.c?rev=277525&r1=277524&r2=277525&view=diff
==============================================================================
--- cfe/branches/release_39/test/Sema/typo-correction.c (original)
+++ cfe/branches/release_39/test/Sema/typo-correction.c Tue Aug  2 16:29:54 2016
@@ -65,3 +65,18 @@ int fn_with_rs(int r) { r = TYPO + r * T
 void fn_with_unknown(int a, int b) {
   fn_with_unknown(unknown, unknown | unknown); // expected-error 3 {{use of undeclared identifier}}
 }
+
+// Two typos in a parenthesized expression or argument list with a conditional
+// expression caused a crash in C mode.
+//
+// r272587 fixed a similar bug for binary operations. The same fix was needed for
+// conditional expressions.
+
+int g(int x, int y) {
+  return x + y;
+}
+
+int h() {
+  g(x, 5 ? z : 0); // expected-error 2 {{use of undeclared identifier}}
+  (x, 5 ? z : 0);  // expected-error 2 {{use of undeclared identifier}}
+}




More information about the llvm-branch-commits mailing list