aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDeclCXX.cpp
diff options
context:
space:
mode:
authorMichael Han <fragmentshaders@gmail.com>2013-02-22 17:15:32 +0000
committerMichael Han <fragmentshaders@gmail.com>2013-02-22 17:15:32 +0000
commit684aa73192d92850a926870be62a1787eb5b7ed9 (patch)
tree36381fcea5e163589fe33a8de99c91b817ce336a /lib/Sema/SemaDeclCXX.cpp
parent5dd8f280980451d475a37db087adab991c1b5655 (diff)
[Sema] Semantic analysis for empty-declaration and attribute-declaration.
Introduce a new AST Decl node "EmptyDecl" to model empty-declaration. Have attributes from attribute-declaration appertain to the EmptyDecl node by creating the AST representations of these attributes and attach them to the EmptyDecl node so these attributes can be sema checked just as attributes attached to "normal" declarations. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175900 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclCXX.cpp')
-rw-r--r--lib/Sema/SemaDeclCXX.cpp28
1 files changed, 11 insertions, 17 deletions
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp
index 8198856547..ce526a9ed3 100644
--- a/lib/Sema/SemaDeclCXX.cpp
+++ b/lib/Sema/SemaDeclCXX.cpp
@@ -10085,23 +10085,17 @@ Decl *Sema::ActOnFinishLinkageSpecification(Scope *S,
return LinkageSpec;
}
-/// \brief Perform semantic checks on a C++11 attribute-declaration.
-void Sema::ActOnAttributeDeclaration(AttributeList *AttrList) {
- // FIXME: Build an AST node for an attribute declaration and return it.
-
- // Since we do not support any attributes which can be used in an attribute
- // declaration, just diagnose standard and unknown attributes appropriately.
- for (/**/; AttrList; AttrList = AttrList->getNext()) {
- if (AttrList->getKind() == AttributeList::IgnoredAttribute ||
- AttrList->isInvalid())
- continue;
-
- Diag(AttrList->getLoc(),
- AttrList->getKind() == AttributeList::UnknownAttribute
- ? diag::warn_unknown_attribute_ignored
- : diag::err_attribute_declaration)
- << AttrList->getName();
- }
+Decl *Sema::ActOnEmptyDeclaration(Scope *S,
+ AttributeList *AttrList,
+ SourceLocation SemiLoc) {
+ Decl *ED = EmptyDecl::Create(Context, CurContext, SemiLoc);
+ // Attribute declarations appertain to empty declaration so we handle
+ // them here.
+ if (AttrList)
+ ProcessDeclAttributeList(S, ED, AttrList);
+
+ CurContext->addDecl(ED);
+ return ED;
}
/// \brief Perform semantic analysis for the variable declaration that