Fix the parser error hanlding for __builtin_offsetof to actually print
out an error for a malformed __builtin_offsetof.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74388 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Parse/ParseExpr.cpp b/lib/Parse/ParseExpr.cpp
index 13b32ac..ee2f209 100644
--- a/lib/Parse/ParseExpr.cpp
+++ b/lib/Parse/ParseExpr.cpp
@@ -1172,17 +1172,18 @@
Comps.back().LocEnd =
MatchRHSPunctuation(tok::r_square, Comps.back().LocStart);
- } else if (Tok.is(tok::r_paren)) {
- if (Ty.isInvalid())
+ } else {
+ if (Tok.isNot(tok::r_paren)) {
+ MatchRHSPunctuation(tok::r_paren, LParenLoc);
Res = ExprError();
- else
+ } else if (Ty.isInvalid()) {
+ Res = ExprError();
+ } else {
Res = Actions.ActOnBuiltinOffsetOf(CurScope, StartLoc, TypeLoc,
Ty.get(), &Comps[0],
Comps.size(), ConsumeParen());
+ }
break;
- } else {
- // Error occurred.
- return ExprError();
}
}
break;