]> granicus.if.org Git - clang/commitdiff
Set the access specifier for using decls.
authorAnders Carlsson <andersca@mac.com>
Sat, 29 Aug 2009 19:54:19 +0000 (19:54 +0000)
committerAnders Carlsson <andersca@mac.com>
Sat, 29 Aug 2009 19:54:19 +0000 (19:54 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80435 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Parse/Action.h
include/clang/Parse/Parser.h
lib/Parse/MinimalAction.cpp
lib/Parse/ParseDeclCXX.cpp
lib/Sema/Sema.h
lib/Sema/SemaDeclCXX.cpp

index 5a025caaf7492f76296cd092a27b9589961e074c..108d43d9e66799ae7a86f073b2cc001737146ec0 100644 (file)
@@ -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,
index cf29e434eb5237076f8207b7c8469f91d3dd88cb..e366c2f256997e9e43990d7fa4cfb744ecc039d8 100644 (file)
@@ -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,
index 4e32de34b7eea87412ddc45600cfdddb4a8b7d69..ee23c0038ac088ea8a141d4add3c94c8cbf0e9c9 100644 (file)
@@ -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
index c002d48d72192e0056ee6c63536cd5faef3c3e43..31926ce0f5cc02f6e7234a74f8c405eb70de1ba8 100644 (file)
@@ -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;
   }
index accbcd14790aa68dbd7b9609559ec7e0b38cbd09..f3d202c2ffb6e1b7a16436dcd2a6c15677970f3e 100644 (file)
@@ -1750,6 +1750,7 @@ public:
                                    bool IsTypeName);
   
   virtual DeclPtrTy ActOnUsingDeclaration(Scope *CurScope,
+                                          AccessSpecifier AS,
                                           SourceLocation UsingLoc,
                                           const CXXScopeSpec &SS,
                                           SourceLocation IdentLoc,
index 4c4dd410179a7a97ead1f129be6f16e56e4e1986..6d32f3fdbf63ba1e225f86cf9d6606217d025d09 100644 (file)
@@ -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);
 }