diff options
| author | John McCall <rjmccall@apple.com> | 2010-03-15 10:12:16 +0000 |
|---|---|---|
| committer | John McCall <rjmccall@apple.com> | 2010-03-15 10:12:16 +0000 |
| commit | 3e11ebebc83643747f15bcafa28b3b7e232f6cc1 (patch) | |
| tree | 5bc9d793fb1e75fccc7da56e4314642242d497d7 /clang/lib/Sema/SemaDeclAttr.cpp | |
| parent | 1e3a1a7eff8549fbb5295e4c2014f9b9a7a7b30f (diff) | |
| download | bcm5719-llvm-3e11ebebc83643747f15bcafa28b3b7e232f6cc1.tar.gz bcm5719-llvm-3e11ebebc83643747f15bcafa28b3b7e232f6cc1.zip | |
Remember declaration scope qualifiers in the AST. Imposes no memory overhead
on unqualified declarations.
Patch by Enea Zaffanella! Minimal adjustments: allocate the ExtInfo nodes
with the ASTContext and delete them during Destroy(). I audited a bunch of
Destroy methods at the same time, to ensure that the correct teardown was
being done.
llvm-svn: 98540
Diffstat (limited to 'clang/lib/Sema/SemaDeclAttr.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaDeclAttr.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index 242d66fa521..d369b773e8d 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -1945,11 +1945,19 @@ NamedDecl * Sema::DeclClonePragmaWeak(NamedDecl *ND, IdentifierInfo *II) { NewD = FunctionDecl::Create(FD->getASTContext(), FD->getDeclContext(), FD->getLocation(), DeclarationName(II), FD->getType(), FD->getTypeSourceInfo()); + if (FD->getQualifier()) { + FunctionDecl *NewFD = cast<FunctionDecl>(NewD); + NewFD->setQualifierInfo(FD->getQualifier(), FD->getQualifierRange()); + } } else if (VarDecl *VD = dyn_cast<VarDecl>(ND)) { NewD = VarDecl::Create(VD->getASTContext(), VD->getDeclContext(), VD->getLocation(), II, VD->getType(), VD->getTypeSourceInfo(), VD->getStorageClass()); + if (VD->getQualifier()) { + VarDecl *NewVD = cast<VarDecl>(NewD); + NewVD->setQualifierInfo(VD->getQualifier(), VD->getQualifierRange()); + } } return NewD; } |

