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/ParseTemplate.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/ParseTemplate.cpp')
-rw-r--r-- | lib/Parse/ParseTemplate.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/Parse/ParseTemplate.cpp b/lib/Parse/ParseTemplate.cpp index 52824f51c1..747a4de152 100644 --- a/lib/Parse/ParseTemplate.cpp +++ b/lib/Parse/ParseTemplate.cpp @@ -240,9 +240,10 @@ Parser::DeclTy *Parser::ParseTypeParameter(unsigned Depth, unsigned Position) { if(Tok.is(tok::equal)) { SourceLocation EqualLoc = ConsumeToken(); SourceLocation DefaultLoc = Tok.getLocation(); - if (TypeTy *DefaultType = ParseTypeName()) + TypeResult DefaultType = ParseTypeName(); + if (!DefaultType.isInvalid()) Actions.ActOnTypeParameterDefault(TypeParam, EqualLoc, DefaultLoc, - DefaultType); + DefaultType.get()); } return TypeParam; @@ -529,7 +530,10 @@ void *Parser::ParseTemplateArgument(bool &ArgIsType) { // Therefore, we initially try to parse a type-id. if (isCXXTypeId(TypeIdAsTemplateArgument)) { ArgIsType = true; - return ParseTypeName(); + TypeResult TypeArg = ParseTypeName(); + if (TypeArg.isInvalid()) + return 0; + return TypeArg.get(); } OwningExprResult ExprArg = ParseAssignmentExpression(); |