r233347 - Diagnose delayed typos in an expr list that is in an invalid expression.
Kaelyn Takata
rikka at google.com
Thu Mar 26 18:44:48 PDT 2015
Author: rikka
Date: Thu Mar 26 20:44:47 2015
New Revision: 233347
URL: http://llvm.org/viewvc/llvm-project?rev=233347&view=rev
Log:
Diagnose delayed typos in an expr list that is in an invalid expression.
Previously, if the expr list parsed fine but the expr to the left of the
open parenthesis was invalid (when parsing the suffix of a
postfix-expression), the parsed expr list was just ignored.
Fixes PR23005.
Modified:
cfe/trunk/lib/Parse/ParseExpr.cpp
cfe/trunk/test/SemaCXX/typo-correction-delayed.cpp
Modified: cfe/trunk/lib/Parse/ParseExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExpr.cpp?rev=233347&r1=233346&r2=233347&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseExpr.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExpr.cpp Thu Mar 26 20:44:47 2015
@@ -1459,6 +1459,9 @@ Parser::ParsePostfixExpressionSuffix(Exp
})) {
(void)Actions.CorrectDelayedTyposInExpr(LHS);
LHS = ExprError();
+ } else if (LHS.isInvalid()) {
+ for (auto &E : ArgExprs)
+ Actions.CorrectDelayedTyposInExpr(E);
}
}
}
Modified: cfe/trunk/test/SemaCXX/typo-correction-delayed.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/typo-correction-delayed.cpp?rev=233347&r1=233346&r2=233347&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/typo-correction-delayed.cpp (original)
+++ cfe/trunk/test/SemaCXX/typo-correction-delayed.cpp Thu Mar 26 20:44:47 2015
@@ -193,3 +193,8 @@ void f() {
TimeTicks::now(); // expected-error {{no member named 'now' in 'PR22297::TimeTicks'; did you mean 'Now'?}}
}
}
+
+namespace PR23005 {
+void f() { int a = Unknown::b(c); } // expected-error {{use of undeclared identifier 'Unknown'}}
+// expected-error at -1 {{use of undeclared identifier 'c'}}
+}
More information about the cfe-commits
mailing list