summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-08-29 19:54:19 +0000
committerAnders Carlsson <andersca@mac.com>2009-08-29 19:54:19 +0000
commit7b194b780d3bb152ef25b37911c818b3e16bdce0 (patch)
tree21bb87cc156fe518ffd3311534964c3a8d84d9dc
parent4bb87ce33e80efe4c01c7f94d9681bbeef5c92d9 (diff)
downloadbcm5719-llvm-7b194b780d3bb152ef25b37911c818b3e16bdce0.tar.gz
bcm5719-llvm-7b194b780d3bb152ef25b37911c818b3e16bdce0.zip
Set the access specifier for using decls.
llvm-svn: 80435
-rw-r--r--clang/include/clang/Parse/Action.h1
-rw-r--r--clang/include/clang/Parse/Parser.h3
-rw-r--r--clang/lib/Parse/MinimalAction.cpp15
-rw-r--r--clang/lib/Parse/ParseDeclCXX.cpp7
-rw-r--r--clang/lib/Sema/Sema.h1
-rw-r--r--clang/lib/Sema/SemaDeclCXX.cpp5
6 files changed, 20 insertions, 12 deletions
diff --git a/clang/include/clang/Parse/Action.h b/clang/include/clang/Parse/Action.h
index 5a025caaf74..108d43d9e66 100644
--- a/clang/include/clang/Parse/Action.h
+++ b/clang/include/clang/Parse/Action.h
@@ -1079,6 +1079,7 @@ public:
/// ActOnUsingDirective - This is called when using-directive is parsed.
virtual DeclPtrTy ActOnUsingDeclaration(Scope *CurScope,
+ AccessSpecifier AS,
SourceLocation UsingLoc,
const CXXScopeSpec &SS,
SourceLocation IdentLoc,
diff --git a/clang/include/clang/Parse/Parser.h b/clang/include/clang/Parse/Parser.h
index cf29e434eb5..e366c2f2569 100644
--- a/clang/include/clang/Parse/Parser.h
+++ b/clang/include/clang/Parse/Parser.h
@@ -1157,7 +1157,8 @@ private:
DeclPtrTy ParseUsingDirective(unsigned Context, SourceLocation UsingLoc,
SourceLocation &DeclEnd);
DeclPtrTy ParseUsingDeclaration(unsigned Context, SourceLocation UsingLoc,
- SourceLocation &DeclEnd);
+ SourceLocation &DeclEnd,
+ AccessSpecifier AS = AS_none);
DeclPtrTy ParseStaticAssertDeclaration(SourceLocation &DeclEnd);
DeclPtrTy ParseNamespaceAlias(SourceLocation NamespaceLoc,
SourceLocation AliasLoc, IdentifierInfo *Alias,
diff --git a/clang/lib/Parse/MinimalAction.cpp b/clang/lib/Parse/MinimalAction.cpp
index 4e32de34b7e..ee23c0038ac 100644
--- a/clang/lib/Parse/MinimalAction.cpp
+++ b/clang/lib/Parse/MinimalAction.cpp
@@ -44,13 +44,14 @@ Action::DeclPtrTy Action::ActOnUsingDirective(Scope *CurScope,
// Defined out-of-line here because of dependecy on AttributeList
Action::DeclPtrTy Action::ActOnUsingDeclaration(Scope *CurScope,
- SourceLocation UsingLoc,
- const CXXScopeSpec &SS,
- SourceLocation IdentLoc,
- IdentifierInfo *TargetName,
- OverloadedOperatorKind Op,
- AttributeList *AttrList,
- bool IsTypeName) {
+ AccessSpecifier AS,
+ SourceLocation UsingLoc,
+ const CXXScopeSpec &SS,
+ SourceLocation IdentLoc,
+ IdentifierInfo *TargetName,
+ OverloadedOperatorKind Op,
+ AttributeList *AttrList,
+ bool IsTypeName) {
// FIXME: Parser seems to assume that Action::ActOn* takes ownership over
// passed AttributeList, however other actions don't free it, is it
diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp
index c002d48d721..31926ce0f5c 100644
--- a/clang/lib/Parse/ParseDeclCXX.cpp
+++ b/clang/lib/Parse/ParseDeclCXX.cpp
@@ -259,7 +259,8 @@ Parser::DeclPtrTy Parser::ParseUsingDirective(unsigned Context,
///
Parser::DeclPtrTy Parser::ParseUsingDeclaration(unsigned Context,
SourceLocation UsingLoc,
- SourceLocation &DeclEnd) {
+ SourceLocation &DeclEnd,
+ AccessSpecifier AS) {
CXXScopeSpec SS;
bool IsTypeName;
@@ -324,7 +325,7 @@ Parser::DeclPtrTy Parser::ParseUsingDeclaration(unsigned Context,
ExpectAndConsume(tok::semi, diag::err_expected_semi_after,
AttrList ? "attributes list" : "namespace name", tok::semi);
- return Actions.ActOnUsingDeclaration(CurScope, UsingLoc, SS,
+ return Actions.ActOnUsingDeclaration(CurScope, AS, UsingLoc, SS,
IdentLoc, TargetName, Op,
AttrList, IsTypeName);
}
@@ -949,7 +950,7 @@ void Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS,
else {
SourceLocation DeclEnd;
// Otherwise, it must be using-declaration.
- ParseUsingDeclaration(Declarator::MemberContext, UsingLoc, DeclEnd);
+ ParseUsingDeclaration(Declarator::MemberContext, UsingLoc, DeclEnd, AS);
}
return;
}
diff --git a/clang/lib/Sema/Sema.h b/clang/lib/Sema/Sema.h
index accbcd14790..f3d202c2ffb 100644
--- a/clang/lib/Sema/Sema.h
+++ b/clang/lib/Sema/Sema.h
@@ -1750,6 +1750,7 @@ public:
bool IsTypeName);
virtual DeclPtrTy ActOnUsingDeclaration(Scope *CurScope,
+ AccessSpecifier AS,
SourceLocation UsingLoc,
const CXXScopeSpec &SS,
SourceLocation IdentLoc,
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index 4c4dd410179..6d32f3fdbf6 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -2094,6 +2094,7 @@ void Sema::PushUsingDirective(Scope *S, UsingDirectiveDecl *UDir) {
Sema::DeclPtrTy Sema::ActOnUsingDeclaration(Scope *S,
+ AccessSpecifier AS,
SourceLocation UsingLoc,
const CXXScopeSpec &SS,
SourceLocation IdentLoc,
@@ -2112,8 +2113,10 @@ Sema::DeclPtrTy Sema::ActOnUsingDeclaration(Scope *S,
NamedDecl *UD = BuildUsingDeclaration(UsingLoc, SS, IdentLoc,
Name, AttrList, IsTypeName);
- if (UD)
+ if (UD) {
PushOnScopeChains(UD, S);
+ UD->setAccess(AS);
+ }
return DeclPtrTy::make(UD);
}
OpenPOWER on IntegriCloud