Give AST-walk passes a way to access DeclSpec attributes on functions and
variables.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44073 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Sema/SemaDecl.cpp b/Sema/SemaDecl.cpp
index 6ae36c8..1540b7c 100644
--- a/Sema/SemaDecl.cpp
+++ b/Sema/SemaDecl.cpp
@@ -615,7 +615,11 @@
FunctionDecl *NewFD = new FunctionDecl(D.getIdentifierLoc(), II, R, SC,
D.getDeclSpec().isInlineSpecified(),
- LastDeclarator);
+ LastDeclarator,
+ D.getDeclSpec().getAttributes());
+
+ // Transfer ownership of DeclSpec attributes to FunctionDecl
+ D.getDeclSpec().clearAttributes();
// Merge the decl with the existing one if appropriate.
if (PrevDecl) {
@@ -838,7 +842,7 @@
parmDeclType = Context.getPointerType(parmDeclType);
ParmVarDecl *New = new ParmVarDecl(PI.IdentLoc, II, parmDeclType,
- VarDecl::None, 0);
+ VarDecl::None, 0, PI.AttrList);
if (PI.InvalidType)
New->setInvalidDecl();