aboutsummaryrefslogtreecommitdiff
path: root/lib/Parse/ParseStmt.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Parse/ParseStmt.cpp')
-rw-r--r--lib/Parse/ParseStmt.cpp53
1 files changed, 1 insertions, 52 deletions
diff --git a/lib/Parse/ParseStmt.cpp b/lib/Parse/ParseStmt.cpp
index 5138cc1595..28be864bdf 100644
--- a/lib/Parse/ParseStmt.cpp
+++ b/lib/Parse/ParseStmt.cpp
@@ -114,7 +114,6 @@ Retry:
}
if (Next.isNot(tok::coloncolon)) {
- // FIXME: Temporarily enable this code only for C.
CXXScopeSpec SS;
IdentifierInfo *Name = Tok.getIdentifierInfo();
SourceLocation NameLoc = Tok.getLocation();
@@ -147,63 +146,13 @@ Retry:
// we're in a syntactic context we haven't handled yet.
break;
- case Sema::NC_Type: {
- // We have a type. In C, this means that we have a declaration.
- if (!getLang().CPlusPlus) {
- ParsedType Type = Classification.getType();
- const char *PrevSpec = 0;
- unsigned DiagID;
- ConsumeToken(); // the identifier
- ParsingDeclSpec DS(*this);
- DS.takeAttributesFrom(attrs);
- DS.SetTypeSpecType(DeclSpec::TST_typename, NameLoc, PrevSpec, DiagID,
- Type);
- DS.SetRangeStart(NameLoc);
- DS.SetRangeEnd(NameLoc);
-
- // In Objective-C, check whether this is the start of a class message
- // send that is missing an opening square bracket ('[').
- if (getLang().ObjC1 && Tok.is(tok::identifier) &&
- Type.get()->isObjCObjectOrInterfaceType() &&
- isColonOrRSquareBracket(NextToken())) {
- // Fake up a Declarator to use with ActOnTypeName.
- Declarator DeclaratorInfo(DS, Declarator::TypeNameContext);
- TypeResult Ty = Actions.ActOnTypeName(getCurScope(), DeclaratorInfo);
- if (Ty.isInvalid()) {
- SkipUntil(tok::r_brace, /*StopAtSemi=*/true, /*DontConsume=*/true);
- if (Tok.is(tok::semi))
- ConsumeToken();
- return StmtError();
- }
-
- ExprResult MsgExpr = ParseObjCMessageExpressionBody(SourceLocation(),
- SourceLocation(),
- Ty.get(), 0);
- return ParseExprStatement(attrs, MsgExpr);
- }
-
- // Objective-C supports syntax of the form 'id<proto1,proto2>' where
- // 'id' is a specific typedef and 'itf<proto1,proto2>' where 'itf' is
- // an Objective-C interface.
- if (Tok.is(tok::less) && getLang().ObjC1)
- ParseObjCProtocolQualifiers(DS);
-
- SourceLocation DeclStart = NameLoc, DeclEnd;
- DeclGroupPtrTy Decl = ParseSimpleDeclaration(DS, Stmts,
- Declarator::BlockContext,
- DeclEnd, true);
- return Actions.ActOnDeclStmt(Decl, DeclStart, DeclEnd);
- }
-
- // In C++, we might also have a functional-style cast. Just annotate
- // this as a type token.
+ case Sema::NC_Type:
Tok.setKind(tok::annot_typename);
setTypeAnnotation(Tok, Classification.getType());
Tok.setAnnotationEndLoc(NameLoc);
Tok.setLocation(NameLoc);
PP.AnnotateCachedTokens(Tok);
break;
- }
case Sema::NC_Expression:
ConsumeToken(); // the identifier