]> granicus.if.org Git - clang/commitdiff
Move Sema::SetMemberAccessSpecifier to SemaAccess.cpp
authorAnders Carlsson <andersca@mac.com>
Fri, 27 Mar 2009 04:54:36 +0000 (04:54 +0000)
committerAnders Carlsson <andersca@mac.com>
Fri, 27 Mar 2009 04:54:36 +0000 (04:54 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67820 91177308-0d34-0410-b5e6-96231b3b80d8

clang.xcodeproj/project.pbxproj
lib/Sema/SemaAccess.cpp
lib/Sema/SemaDeclCXX.cpp

index dcdb7d917e95c4555ccc45f358667a296d2bdc68..4c8ab17ba6eee1059d63cc8503997a9ea06a2368 100644 (file)
                1A7019EE0F79BC1100FEC4D1 /* DiagnosticLexKinds.td */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DiagnosticLexKinds.td; sourceTree = "<group>"; };
                1A7019EF0F79BC1100FEC4D1 /* DiagnosticParseKinds.td */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DiagnosticParseKinds.td; sourceTree = "<group>"; };
                1A701A250F79CE1C00FEC4D1 /* DiagnosticSemaKinds.td */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DiagnosticSemaKinds.td; sourceTree = "<group>"; };
-               1A701B630F7C8FE400FEC4D1 /* SemaAccess.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SemaAccess.cpp; path = lib/Sema/SemaAccess.cpp; sourceTree = "<group>"; };
+               1A701B630F7C8FE400FEC4D1 /* SemaAccess.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = SemaAccess.cpp; path = lib/Sema/SemaAccess.cpp; sourceTree = "<group>"; tabWidth = 2; };
                1A72BEAC0D641E9400B085E9 /* Attr.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.c.h; name = Attr.h; path = clang/AST/Attr.h; sourceTree = "<group>"; tabWidth = 2; };
                1A7342470C7B57D500122F56 /* CGObjC.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = CGObjC.cpp; path = lib/CodeGen/CGObjC.cpp; sourceTree = "<group>"; tabWidth = 2; };
                1A869A6E0BA2164C008DA07A /* LiteralSupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LiteralSupport.h; sourceTree = "<group>"; };
index 7d58ea7d64f0359799a48046ae541d24fb916e2f..2ac9a539f3e9a5a2a02f4d76b3c91b12d987276c 100644 (file)
 // This file provides Sema routines for C++ access control semantics.
 //
 //===----------------------------------------------------------------------===//
+
+#include "Sema.h"
+using namespace clang;
+
+bool Sema::SetMemberAccessSpecifier(NamedDecl *MemberDecl, 
+                                    NamedDecl *PrevMemberDecl,
+                                    AccessSpecifier LexicalAS) {
+  if (!PrevMemberDecl) {
+    // Use the lexical access specifier.
+    MemberDecl->setAccess(LexicalAS);
+    return false;
+  }
+  
+  // C++ [class.access.spec]p3: When a member is redeclared its access
+  // specifier must be same as its initial declaration.
+  if (LexicalAS != AS_none && LexicalAS != PrevMemberDecl->getAccess()) {
+    Diag(MemberDecl->getLocation(), 
+         diag::err_class_redeclared_with_different_access) 
+      << MemberDecl << LexicalAS;
+    Diag(PrevMemberDecl->getLocation(), diag::note_previous_access_declaration)
+      << PrevMemberDecl << PrevMemberDecl->getAccess();
+    return true;
+  }
+  
+  MemberDecl->setAccess(PrevMemberDecl->getAccess());
+  return false;
+}
index f22686020e44c40b5f5516e6bc7400522f8337c2..90983040b5b4b7ab4c3144ac82a2ebd4c22480c8 100644 (file)
@@ -2538,28 +2538,3 @@ void Sema::SetDeclDeleted(DeclTy *dcl, SourceLocation DelLoc) {
   }
   Fn->setDeleted();
 }
-
-bool Sema::SetMemberAccessSpecifier(NamedDecl *MemberDecl, 
-                                    NamedDecl *PrevMemberDecl,
-                                    AccessSpecifier LexicalAS) {
-  if (!PrevMemberDecl) {
-    // Use the lexical access specifier.
-    MemberDecl->setAccess(LexicalAS);
-    return false;
-  }
-  
-  // C++ [class.access.spec]p3: When a member is redeclared its access
-  // specifier must be same as its initial declaration.
-  if (LexicalAS != AS_none && LexicalAS != PrevMemberDecl->getAccess()) {
-    Diag(MemberDecl->getLocation(), 
-         diag::err_class_redeclared_with_different_access) 
-      << MemberDecl << LexicalAS;
-    Diag(PrevMemberDecl->getLocation(), diag::note_previous_access_declaration)
-      << PrevMemberDecl << PrevMemberDecl->getAccess();
-    return true;
-  }
-  
-  MemberDecl->setAccess(PrevMemberDecl->getAccess());
-  return false;
-}
-