summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseTemplate.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-02-18 17:45:20 +0000
committerDouglas Gregor <dgregor@apple.com>2009-02-18 17:45:20 +0000
commit220cac5e898d1c89f1813a9198e2c4b4a0f25012 (patch)
treec49b52296042d55afad66e6075396e795bbfe8b8 /clang/lib/Parse/ParseTemplate.cpp
parentab89bc8ca1d93f7052daff3b7ca3b361fc83a47b (diff)
downloadbcm5719-llvm-220cac5e898d1c89f1813a9198e2c4b4a0f25012.tar.gz
bcm5719-llvm-220cac5e898d1c89f1813a9198e2c4b4a0f25012.zip
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. llvm-svn: 64922
Diffstat (limited to 'clang/lib/Parse/ParseTemplate.cpp')
-rw-r--r--clang/lib/Parse/ParseTemplate.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/clang/lib/Parse/ParseTemplate.cpp b/clang/lib/Parse/ParseTemplate.cpp
index 52824f51c13..747a4de1523 100644
--- a/clang/lib/Parse/ParseTemplate.cpp
+++ b/clang/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();
OpenPOWER on IntegriCloud