diff options
Diffstat (limited to 'include/clang')
-rw-r--r-- | include/clang/AST/Attr.h | 15 | ||||
-rw-r--r-- | include/clang/Parse/Action.h | 12 |
2 files changed, 24 insertions, 3 deletions
diff --git a/include/clang/AST/Attr.h b/include/clang/AST/Attr.h index ea052559be..71f981bd50 100644 --- a/include/clang/AST/Attr.h +++ b/include/clang/AST/Attr.h @@ -28,6 +28,7 @@ public: Alias, Aligned, Annotate, + AsmLabel, // Represent GCC asm label extension. Constructor, Deprecated, Destructor, @@ -115,6 +116,20 @@ public: static bool classof(const AnnotateAttr *A) { return true; } }; +class AsmLabelAttr : public Attr { + std::string Label; +public: + AsmLabelAttr(const std::string &L) : Attr(AsmLabel), Label(L) {} + + const std::string& getLabel() const { return Label; } + + // Implement isa/cast/dyncast/etc. + static bool classof(const Attr *A) { + return A->getKind() == AsmLabel; + } + static bool classof(const AsmLabelAttr *A) { return true; } +}; + class AliasAttr : public Attr { std::string Aliasee; public: diff --git a/include/clang/Parse/Action.h b/include/clang/Parse/Action.h index 2b6f713441..4f7937a36c 100644 --- a/include/clang/Parse/Action.h +++ b/include/clang/Parse/Action.h @@ -105,7 +105,12 @@ public: /// LastInGroup is non-null for cases where one declspec has multiple /// declarators on it. For example in 'int A, B', ActOnDeclarator will be /// called with LastInGroup=A when invoked for B. - virtual DeclTy *ActOnDeclarator(Scope *S, Declarator &D,DeclTy *LastInGroup) { + /// + /// AsmLabel is non-null only for top-level function declarations + /// which use the GCC asm-label extension (the expression must be a + /// constant string). + virtual DeclTy *ActOnDeclarator(Scope *S, Declarator &D, DeclTy *LastInGroup, + ExprTy *AsmLabel) { return 0; } @@ -139,7 +144,7 @@ public: virtual DeclTy *ActOnStartOfFunctionDef(Scope *FnBodyScope, Declarator &D) { // Default to ActOnDeclarator. return ActOnStartOfFunctionDef(FnBodyScope, - ActOnDeclarator(FnBodyScope, D, 0)); + ActOnDeclarator(FnBodyScope, D, 0, 0)); } /// ActOnStartOfFunctionDef - This is called at the start of a function @@ -834,7 +839,8 @@ public: /// ActOnDeclarator - If this is a typedef declarator, we modify the /// IdentifierInfo::FETokenInfo field to keep track of this fact, until S is /// popped. - virtual DeclTy *ActOnDeclarator(Scope *S, Declarator &D, DeclTy *LastInGroup); + virtual DeclTy *ActOnDeclarator(Scope *S, Declarator &D, DeclTy *LastInGroup, + ExprTy *AsmLabel); /// ActOnPopScope - When a scope is popped, if any typedefs are now /// out-of-scope, they are removed from the IdentifierInfo::FETokenInfo field. |