summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseDecl.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2008-08-05 01:35:17 +0000
committerDaniel Dunbar <daniel@zuster.org>2008-08-05 01:35:17 +0000
commit4983df37a74714d99f2db3bb04919087f9328ecc (patch)
tree732ef9e70ac76bfe86b6b3a20810e6c83284601b /clang/lib/Parse/ParseDecl.cpp
parent5aa55d51ca1df0c28dd91d65680e04091f53fdf3 (diff)
downloadbcm5719-llvm-4983df37a74714d99f2db3bb04919087f9328ecc.tar.gz
bcm5719-llvm-4983df37a74714d99f2db3bb04919087f9328ecc.zip
Add more Parser/Sema support for GCC asm-label extension.
- ActOnDeclarator now takes an additional parameter which is the AsmLabel if used. Its unfortunate that this bubbles up this high, but we cannot just lump it in as an attribute without mistakenly *accepting* it as an attribute. - The actual asm-label itself is, however, encoded as an AsmLabelAttr on the FunctionDecl. - Slightly improved parser error recovery on malformed asm-labels. - CodeGen support still missing... llvm-svn: 54339
Diffstat (limited to 'clang/lib/Parse/ParseDecl.cpp')
-rw-r--r--clang/lib/Parse/ParseDecl.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp
index 81cb0ce6271..33482c5700f 100644
--- a/clang/lib/Parse/ParseDecl.cpp
+++ b/clang/lib/Parse/ParseDecl.cpp
@@ -256,8 +256,14 @@ ParseInitDeclaratorListAfterFirstDeclarator(Declarator &D) {
// rest of the init-declarator-list.
while (1) {
// If a simple-asm-expr is present, parse it.
- if (Tok.is(tok::kw_asm))
- ParseSimpleAsm();
+ ExprResult AsmLabel;
+ if (Tok.is(tok::kw_asm)) {
+ AsmLabel = ParseSimpleAsm();
+ if (AsmLabel.isInvalid) {
+ SkipUntil(tok::semi);
+ return 0;
+ }
+ }
// If attributes are present, parse them.
if (Tok.is(tok::kw___attribute))
@@ -265,13 +271,13 @@ ParseInitDeclaratorListAfterFirstDeclarator(Declarator &D) {
// Inform the current actions module that we just parsed this declarator.
// FIXME: pass asm & attributes.
- LastDeclInGroup = Actions.ActOnDeclarator(CurScope, D, LastDeclInGroup);
+ LastDeclInGroup = Actions.ActOnDeclarator(CurScope, D, LastDeclInGroup,
+ AsmLabel.Val);
// Parse declarator '=' initializer.
- ExprResult Init;
if (Tok.is(tok::equal)) {
ConsumeToken();
- Init = ParseInitializer();
+ ExprResult Init = ParseInitializer();
if (Init.isInvalid) {
SkipUntil(tok::semi);
return 0;
OpenPOWER on IntegriCloud