aboutsummaryrefslogtreecommitdiff
path: root/lib/Parse/ParseDecl.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-10-20 04:57:38 +0000
committerChris Lattner <sabre@nondot.org>2008-10-20 04:57:38 +0000
commitaab740af64daaa8d94d34789a6ea7e2d2fc5ab39 (patch)
treefadefa455582b8fe69333d0bd1afc3c0b8562af0 /lib/Parse/ParseDecl.cpp
parent7399ee0aa6ffaeab0a8f83408b1c5127fb2bf5b8 (diff)
Support attributes in *yet another* place. Is there any place you
can't stick an attributes? git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57795 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseDecl.cpp')
-rw-r--r--lib/Parse/ParseDecl.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index 78793cef1e..041d876f56 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/lib/Parse/ParseDecl.cpp
@@ -321,6 +321,17 @@ ParseInitDeclaratorListAfterFirstDeclarator(Declarator &D) {
// Parse the next declarator.
D.clear();
+
+ // Accept attributes in an init-declarator. In the first declarator in a
+ // declaration, these would be part of the declspec. In subsequent
+ // declarators, they become part of the declarator itself, so that they
+ // don't apply to declarators after *this* one. Examples:
+ // short __attribute__((common)) var; -> declspec
+ // short var __attribute__((common)); -> declarator
+ // short x, __attribute__((common)) var; -> declarator
+ if (Tok.is(tok::kw___attribute))
+ D.AddAttributes(ParseAttributes());
+
ParseDeclarator(D);
}