summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Brewer <ben.brewer@codethink.co.uk>2015-08-18 14:19:36 +0100
committerBen Brewer <ben.brewer@codethink.co.uk>2015-08-19 17:10:22 +0100
commit2fd4986965e8f91ac26f6d572ea978e4f52e05b6 (patch)
tree92360f085573ebd09f313c2bdb350fdc2d0553ac
parent3257f9a77a0fa5e49429d7a323a3d594bf971947 (diff)
downloadflang-2fd4986965e8f91ac26f6d572ea978e4f52e05b6.tar.gz
Properly support type kinds
-rw-r--r--lib/Parse/ParseDecl.cpp23
1 files changed, 12 insertions, 11 deletions
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index 9e626637a3..9cd4330614 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/lib/Parse/ParseDecl.cpp
@@ -300,6 +300,7 @@ bool Parser::ParseDeclarationTypeSpec(DeclSpec &DS, bool AllowSelectors,
case tok::kw_BYTE:
DS.SetTypeSpecType(DeclSpec::TST_logical);
DS.setByte(); // equivalent to Kind = 1
+ AllowSelectors = false;
break;
case tok::kw_LOGICAL:
DS.SetTypeSpecType(DeclSpec::TST_logical);
@@ -307,10 +308,12 @@ bool Parser::ParseDeclarationTypeSpec(DeclSpec &DS, bool AllowSelectors,
case tok::kw_DOUBLEPRECISION:
DS.SetTypeSpecType(DeclSpec::TST_real);
DS.setDoublePrecision(); // equivalent to Kind = 8
+ AllowSelectors = false;
break;
case tok::kw_DOUBLECOMPLEX:
DS.SetTypeSpecType(DeclSpec::TST_complex);
DS.setDoublePrecision(); // equivalent to Kind = 8
+ AllowSelectors = false;
break;
}
@@ -321,27 +324,25 @@ bool Parser::ParseDeclarationTypeSpec(DeclSpec &DS, bool AllowSelectors,
ExprResult Kind;
ExprResult Len;
- // FIXME: no Kind for double complex, double precision and byte
switch (DS.getTypeSpecType()) {
case DeclSpec::TST_struct:
break;
default:
ConsumeToken();
- if (ConsumeIfPresent(tok::star)) {
- // FIXME: proper obsolete COMPLEX*16 support
- ConsumeAnyToken();
- DS.setDoublePrecision();
- }
if (!AllowSelectors)
break;
- if (ConsumeIfPresent(tok::l_paren)) {
- Kind = ParseSelector(true);
- if (Kind.isInvalid())
- return true;
- if(!ExpectAndConsume(tok::r_paren, 0, "", tok::r_paren))
+ if (ConsumeIfPresent(tok::star)) {
+ Kind = ParseExpectedFollowupExpression("*");
+ if (Kind.isInvalid())
return true;
+ } else if (ConsumeIfPresent(tok::l_paren)) {
+ Kind = ParseSelector(true);
+ if (Kind.isInvalid())
+ return true;
+ if(!ExpectAndConsume(tok::r_paren))
+ return true;
}
break;