r232760 - Correct typos in C11 generic-selection expressions.
Kaelyn Takata
rikka at google.com
Thu Mar 19 13:56:07 PDT 2015
Author: rikka
Date: Thu Mar 19 15:56:07 2015
New Revision: 232760
URL: http://llvm.org/viewvc/llvm-project?rev=232760&view=rev
Log:
Correct typos in C11 generic-selection expressions.
Modified:
cfe/trunk/lib/Parse/ParseExpr.cpp
cfe/trunk/test/Sema/typo-correction.c
Modified: cfe/trunk/lib/Parse/ParseExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExpr.cpp?rev=232760&r1=232759&r2=232760&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseExpr.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExpr.cpp Thu Mar 19 15:56:07 2015
@@ -2368,7 +2368,8 @@ ExprResult Parser::ParseGenericSelection
// C11 6.5.1.1p3 "The controlling expression of a generic selection is
// not evaluated."
EnterExpressionEvaluationContext Unevaluated(Actions, Sema::Unevaluated);
- ControllingExpr = ParseAssignmentExpression();
+ ControllingExpr =
+ Actions.CorrectDelayedTyposInExpr(ParseAssignmentExpression());
if (ControllingExpr.isInvalid()) {
SkipUntil(tok::r_paren, StopAtSemi);
return ExprError();
@@ -2414,7 +2415,8 @@ ExprResult Parser::ParseGenericSelection
// FIXME: These expressions should be parsed in a potentially potentially
// evaluated context.
- ExprResult ER(ParseAssignmentExpression());
+ ExprResult ER(
+ Actions.CorrectDelayedTyposInExpr(ParseAssignmentExpression()));
if (ER.isInvalid()) {
SkipUntil(tok::r_paren, StopAtSemi);
return ExprError();
Modified: cfe/trunk/test/Sema/typo-correction.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/typo-correction.c?rev=232760&r1=232759&r2=232760&view=diff
==============================================================================
--- cfe/trunk/test/Sema/typo-correction.c (original)
+++ cfe/trunk/test/Sema/typo-correction.c Thu Mar 19 15:56:07 2015
@@ -28,3 +28,9 @@ void func(int arg) {
;
}
}
+
+void banana(void); // expected-note {{'banana' declared here}}
+int c11Generic(int arg) {
+ _Generic(hello, int : banana)(); // expected-error-re {{use of undeclared identifier 'hello'{{$}}}}
+ _Generic(arg, int : bandana)(); // expected-error {{use of undeclared identifier 'bandana'; did you mean 'banana'?}}
+}
More information about the cfe-commits
mailing list