[cfe-commits] r67820 - in /cfe/trunk: clang.xcodeproj/project.pbxproj lib/Sema/SemaAccess.cpp lib/Sema/SemaDeclCXX.cpp

Anders Carlsson andersca at mac.com
Thu Mar 26 21:54:36 PDT 2009


Author: andersca
Date: Thu Mar 26 23:54:36 2009
New Revision: 67820

URL: http://llvm.org/viewvc/llvm-project?rev=67820&view=rev
Log:
Move Sema::SetMemberAccessSpecifier to SemaAccess.cpp

Modified:
    cfe/trunk/clang.xcodeproj/project.pbxproj
    cfe/trunk/lib/Sema/SemaAccess.cpp
    cfe/trunk/lib/Sema/SemaDeclCXX.cpp

Modified: cfe/trunk/clang.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/clang.xcodeproj/project.pbxproj?rev=67820&r1=67819&r2=67820&view=diff

==============================================================================
--- cfe/trunk/clang.xcodeproj/project.pbxproj (original)
+++ cfe/trunk/clang.xcodeproj/project.pbxproj Thu Mar 26 23:54:36 2009
@@ -329,7 +329,7 @@
 		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>"; };

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

==============================================================================
--- cfe/trunk/lib/Sema/SemaAccess.cpp (original)
+++ cfe/trunk/lib/Sema/SemaAccess.cpp Thu Mar 26 23:54:36 2009
@@ -10,3 +10,30 @@
 // 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;
+}

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

==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Thu Mar 26 23:54:36 2009
@@ -2538,28 +2538,3 @@
   }
   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;
-}
-





More information about the cfe-commits mailing list