aboutsummaryrefslogtreecommitdiff
path: root/lib/Parse/ParseDecl.cpp
diff options
context:
space:
mode:
authorNate Begeman <natebegeman@mac.com>2009-06-26 06:32:41 +0000
committerNate Begeman <natebegeman@mac.com>2009-06-26 06:32:41 +0000
commit6f3d838867538638b9bbf412028e8537ae12f3e5 (patch)
tree9670fbb8d2c18f884cd0407c6a0ea764fe75161b /lib/Parse/ParseDecl.cpp
parente136e0e1b74760d7ec3ede38e0e739d5c52a3c0a (diff)
OpenCL 1.0 support: attributes
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74280 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseDecl.cpp')
-rw-r--r--lib/Parse/ParseDecl.cpp27
1 files changed, 25 insertions, 2 deletions
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index 9a8e34211d..c11383c3ec 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/lib/Parse/ParseDecl.cpp
@@ -149,13 +149,35 @@ AttributeList *Parser::ParseAttributes(SourceLocation *EndLoc) {
}
}
} else { // not an identifier
+ switch (Tok.getKind()) {
+ case tok::r_paren:
// parse a possibly empty comma separated list of expressions
- if (Tok.is(tok::r_paren)) {
// __attribute__(( nonnull() ))
ConsumeParen(); // ignore the right paren loc for now
CurrAttr = new AttributeList(AttrName, AttrNameLoc,
0, SourceLocation(), 0, 0, CurrAttr);
- } else {
+ break;
+ case tok::kw_char:
+ case tok::kw_wchar_t:
+ case tok::kw_bool:
+ case tok::kw_short:
+ case tok::kw_int:
+ case tok::kw_long:
+ case tok::kw_signed:
+ case tok::kw_unsigned:
+ case tok::kw_float:
+ case tok::kw_double:
+ case tok::kw_void:
+ case tok::kw_typeof:
+ // If it's a builtin type name, eat it and expect a rparen
+ // __attribute__(( vec_type_hint(char) ))
+ ConsumeToken();
+ CurrAttr = new AttributeList(AttrName, AttrNameLoc,
+ 0, SourceLocation(), 0, 0, CurrAttr);
+ if (Tok.is(tok::r_paren))
+ ConsumeParen();
+ break;
+ default:
// __attribute__(( aligned(16) ))
ExprVector ArgExprs(Actions);
bool ArgExprsOk = true;
@@ -181,6 +203,7 @@ AttributeList *Parser::ParseAttributes(SourceLocation *EndLoc) {
SourceLocation(), ArgExprs.take(), ArgExprs.size(),
CurrAttr);
}
+ break;
}
}
} else {