[cfe-commits] r80435 - in /cfe/trunk: 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

Anders Carlsson andersca at mac.com
Sat Aug 29 12:54:20 PDT 2009


Author: andersca
Date: Sat Aug 29 14:54:19 2009
New Revision: 80435

URL: http://llvm.org/viewvc/llvm-project?rev=80435&view=rev
Log:
Set the access specifier for using decls.

Modified:
    cfe/trunk/include/clang/Parse/Action.h
    cfe/trunk/include/clang/Parse/Parser.h
    cfe/trunk/lib/Parse/MinimalAction.cpp
    cfe/trunk/lib/Parse/ParseDeclCXX.cpp
    cfe/trunk/lib/Sema/Sema.h
    cfe/trunk/lib/Sema/SemaDeclCXX.cpp

Modified: cfe/trunk/include/clang/Parse/Action.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Action.h?rev=80435&r1=80434&r2=80435&view=diff

==============================================================================
--- cfe/trunk/include/clang/Parse/Action.h (original)
+++ cfe/trunk/include/clang/Parse/Action.h Sat Aug 29 14:54:19 2009
@@ -1079,6 +1079,7 @@
 
   /// ActOnUsingDirective - This is called when using-directive is parsed.
   virtual DeclPtrTy ActOnUsingDeclaration(Scope *CurScope,
+                                          AccessSpecifier AS,
                                           SourceLocation UsingLoc,
                                           const CXXScopeSpec &SS,
                                           SourceLocation IdentLoc,

Modified: cfe/trunk/include/clang/Parse/Parser.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Parser.h?rev=80435&r1=80434&r2=80435&view=diff

==============================================================================
--- cfe/trunk/include/clang/Parse/Parser.h (original)
+++ cfe/trunk/include/clang/Parse/Parser.h Sat Aug 29 14:54:19 2009
@@ -1157,7 +1157,8 @@
   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,

Modified: cfe/trunk/lib/Parse/MinimalAction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/MinimalAction.cpp?rev=80435&r1=80434&r2=80435&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/MinimalAction.cpp (original)
+++ cfe/trunk/lib/Parse/MinimalAction.cpp Sat Aug 29 14:54:19 2009
@@ -44,13 +44,14 @@
 
 // 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

Modified: cfe/trunk/lib/Parse/ParseDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=80435&r1=80434&r2=80435&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/ParseDeclCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp Sat Aug 29 14:54:19 2009
@@ -259,7 +259,8 @@
 ///
 Parser::DeclPtrTy Parser::ParseUsingDeclaration(unsigned Context,
                                                 SourceLocation UsingLoc,
-                                                SourceLocation &DeclEnd) {
+                                                SourceLocation &DeclEnd,
+                                                AccessSpecifier AS) {
   CXXScopeSpec SS;
   bool IsTypeName;
 
@@ -324,7 +325,7 @@
   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 @@
     else {
       SourceLocation DeclEnd;
       // Otherwise, it must be using-declaration.
-      ParseUsingDeclaration(Declarator::MemberContext, UsingLoc, DeclEnd);
+      ParseUsingDeclaration(Declarator::MemberContext, UsingLoc, DeclEnd, AS);
     }
     return;
   }

Modified: cfe/trunk/lib/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.h?rev=80435&r1=80434&r2=80435&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/Sema.h (original)
+++ cfe/trunk/lib/Sema/Sema.h Sat Aug 29 14:54:19 2009
@@ -1750,6 +1750,7 @@
                                    bool IsTypeName);
   
   virtual DeclPtrTy ActOnUsingDeclaration(Scope *CurScope,
+                                          AccessSpecifier AS,
                                           SourceLocation UsingLoc,
                                           const CXXScopeSpec &SS,
                                           SourceLocation IdentLoc,

Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=80435&r1=80434&r2=80435&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Sat Aug 29 14:54:19 2009
@@ -2094,6 +2094,7 @@
 
 
 Sema::DeclPtrTy Sema::ActOnUsingDeclaration(Scope *S,
+                                            AccessSpecifier AS,
                                             SourceLocation UsingLoc,
                                             const CXXScopeSpec &SS,
                                             SourceLocation IdentLoc,
@@ -2112,8 +2113,10 @@
   
   NamedDecl *UD = BuildUsingDeclaration(UsingLoc, SS, IdentLoc, 
                                         Name, AttrList, IsTypeName);
-  if (UD)
+  if (UD) {
     PushOnScopeChains(UD, S);
+    UD->setAccess(AS);
+  }
   
   return DeclPtrTy::make(UD);
 }





More information about the cfe-commits mailing list