summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorCaitlin Sadowski <supertri@google.com>2011-09-08 17:42:31 +0000
committerCaitlin Sadowski <supertri@google.com>2011-09-08 17:42:31 +0000
commit990d57122698609de21fdcc4c8a8ce8ce62c7f97 (patch)
treec724d3c5e460dd31f28128b38b1f9b665f524415 /clang/lib/Sema/SemaDecl.cpp
parent9385dd7415826abe3484d49caa30fe97c7df1407 (diff)
downloadbcm5719-llvm-990d57122698609de21fdcc4c8a8ce8ce62c7f97.tar.gz
bcm5719-llvm-990d57122698609de21fdcc4c8a8ce8ce62c7f97.zip
Thread safety: added support for function scopes in attribute arguments.
This patch was written by DeLesley Hutchins. llvm-svn: 139302
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 251913eb796..10b53f2a816 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -782,6 +782,29 @@ void Sema::ExitDeclaratorContext(Scope *S) {
// disappear.
}
+
+void Sema::ActOnReenterFunctionContext(Scope* S, Decl *D) {
+ FunctionDecl *FD = dyn_cast<FunctionDecl>(D);
+ if (FunctionTemplateDecl *TFD = dyn_cast_or_null<FunctionTemplateDecl>(D)) {
+ // We assume that the caller has already called
+ // ActOnReenterTemplateScope
+ FD = TFD->getTemplatedDecl();
+ }
+ if (!FD)
+ return;
+
+ PushDeclContext(S, FD);
+ for (unsigned P = 0, NumParams = FD->getNumParams(); P < NumParams; ++P) {
+ ParmVarDecl *Param = FD->getParamDecl(P);
+ // If the parameter has an identifier, then add it to the scope
+ if (Param->getIdentifier()) {
+ S->AddDecl(Param);
+ IdResolver.AddDecl(Param);
+ }
+ }
+}
+
+
/// \brief Determine whether we allow overloading of the function
/// PrevDecl with another declaration.
///
OpenPOWER on IntegriCloud