summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/Decl.cpp
diff options
context:
space:
mode:
authorJames Molloy <james.molloy@arm.com>2012-02-28 18:12:11 +0000
committerJames Molloy <james.molloy@arm.com>2012-02-28 18:12:11 +0000
commit051390fffab6f63a76ca919d2fe8e4c5f1ba13f2 (patch)
treef00aebf83d6f192405852f5afb442374bcd0e75c /clang/lib/AST/Decl.cpp
parent0c281a7deb6a4b9c64bf4a4a7289e69cced4c275 (diff)
downloadbcm5719-llvm-051390fffab6f63a76ca919d2fe8e4c5f1ba13f2.tar.gz
bcm5719-llvm-051390fffab6f63a76ca919d2fe8e4c5f1ba13f2.zip
Correctly track tags and enum members defined in the prototype of a function, and ensure they are properly scoped.
This fixes code such as: enum e {x, y}; int f(enum {y, x} n) { return 0; } This finally fixes PR5464 and PR5477. llvm-svn: 151638
Diffstat (limited to 'clang/lib/AST/Decl.cpp')
-rw-r--r--clang/lib/AST/Decl.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index 433ce100cfd..bd7579996f4 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -1847,6 +1847,16 @@ void FunctionDecl::setParams(ASTContext &C,
}
}
+void FunctionDecl::setDeclsInPrototypeScope(llvm::ArrayRef<NamedDecl *> NewDecls) {
+ assert(DeclsInPrototypeScope.empty() && "Already has prototype decls!");
+
+ if (!NewDecls.empty()) {
+ NamedDecl **A = new (getASTContext()) NamedDecl*[NewDecls.size()];
+ std::copy(NewDecls.begin(), NewDecls.end(), A);
+ DeclsInPrototypeScope = llvm::ArrayRef<NamedDecl*>(A, NewDecls.size());
+ }
+}
+
/// getMinRequiredArguments - Returns the minimum number of arguments
/// needed to call this function. This may be fewer than the number of
/// function parameters, if some of the parameters have default
OpenPOWER on IntegriCloud