diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-02-18 17:45:20 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-02-18 17:45:20 +0000 |
commit | 809070a886684cb5b92eb0e00a6581ab1fa6b17a (patch) | |
tree | c3e6242279c488480f00bd966c7c46fcd7371eb3 /lib/Parse/ParseObjc.cpp | |
parent | e53f8206ebb36a17e95e64270704e2608d1796f4 (diff) |
Update Parser::ParseTypeName to return a TypeResult, which also tells
us whether there was an error in trying to parse a type-name (type-id
in C++). This allows propagation of errors further in the compiler,
suppressing more bogus error messages.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64922 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseObjc.cpp')
-rw-r--r-- | lib/Parse/ParseObjc.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp index a147ee47e8..4ddddb3749 100644 --- a/lib/Parse/ParseObjc.cpp +++ b/lib/Parse/ParseObjc.cpp @@ -629,8 +629,11 @@ Parser::TypeTy *Parser::ParseObjCTypeName(ObjCDeclSpec &DS) { ParseObjCTypeQualifierList(DS); TypeTy *Ty = 0; - if (isTypeSpecifierQualifier()) - Ty = ParseTypeName(); + if (isTypeSpecifierQualifier()) { + TypeResult TypeSpec = ParseTypeName(); + if (!TypeSpec.isInvalid()) + Ty = TypeSpec.get(); + } if (Tok.is(tok::r_paren)) ConsumeParen(); @@ -1627,12 +1630,15 @@ Parser::ParseObjCEncodeExpression(SourceLocation AtLoc) { SourceLocation LParenLoc = ConsumeParen(); - TypeTy *Ty = ParseTypeName(); + TypeResult Ty = ParseTypeName(); SourceLocation RParenLoc = MatchRHSPunctuation(tok::r_paren, LParenLoc); - return Owned(Actions.ParseObjCEncodeExpression(AtLoc, EncLoc, LParenLoc, Ty, - RParenLoc)); + if (Ty.isInvalid()) + return ExprError(); + + return Owned(Actions.ParseObjCEncodeExpression(AtLoc, EncLoc, LParenLoc, + Ty.get(), RParenLoc)); } /// objc-protocol-expression |