[cfe-commits] r66992 - in /cfe/trunk: include/clang/Basic/IdentifierTable.h lib/Sema/SemaDeclObjC.cpp

Ted Kremenek kremenek at apple.com
Fri Mar 13 17:20:08 PDT 2009


Author: kremenek
Date: Fri Mar 13 19:20:08 2009
New Revision: 66992

URL: http://llvm.org/viewvc/llvm-project?rev=66992&view=rev
Log:
Make Selector::getIdentifierInfo() private. I took a first attempt at this last
week in:

http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20090302/013580.html

That patch caused the output of the diagnostics to change. Since
'DeclarationName' can already reason about Selectors and the Diagnostics logic
reasons about DeclarationName, there is no additional code needed to get the
diagnostics working by making Selector::getIdentifierInfo() private.

Modified:
    cfe/trunk/include/clang/Basic/IdentifierTable.h
    cfe/trunk/lib/Sema/SemaDeclObjC.cpp

Modified: cfe/trunk/include/clang/Basic/IdentifierTable.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/IdentifierTable.h?rev=66992&r1=66991&r2=66992&view=diff

==============================================================================
--- cfe/trunk/include/clang/Basic/IdentifierTable.h (original)
+++ cfe/trunk/include/clang/Basic/IdentifierTable.h Fri Mar 13 19:20:08 2009
@@ -337,6 +337,8 @@
 /// selectors that take no arguments and selectors that take 1 argument, which 
 /// accounts for 78% of all selectors in Cocoa.h.
 class Selector {
+  friend class DiagnosticInfo;
+  
   enum IdentifierInfoFlag {
     // MultiKeywordSelector = 0.
     ZeroArg  = 0x1,
@@ -356,13 +358,6 @@
     assert((InfoPtr & ArgFlags) == 0 &&"Insufficiently aligned IdentifierInfo");
   }
   Selector(uintptr_t V) : InfoPtr(V) {}
-public:
-  friend class SelectorTable; // only the SelectorTable can create these
-  friend class DeclarationName; // and the AST's DeclarationName.
-
-  /// The default ctor should only be used when creating data structures that
-  ///  will contain selectors.
-  Selector() : InfoPtr(0) {}
   
   IdentifierInfo *getAsIdentifierInfo() const {
     if (getIdentifierInfoFlag())
@@ -372,6 +367,15 @@
   unsigned getIdentifierInfoFlag() const {
     return InfoPtr & ArgFlags;
   }
+
+public:
+  friend class SelectorTable; // only the SelectorTable can create these
+  friend class DeclarationName; // and the AST's DeclarationName.
+
+  /// The default ctor should only be used when creating data structures that
+  ///  will contain selectors.
+  Selector() : InfoPtr(0) {}
+
   /// operator==/!= - Indicate whether the specified selectors are identical.
   bool operator==(Selector RHS) const {
     return InfoPtr == RHS.InfoPtr;

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

==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Fri Mar 13 19:20:08 2009
@@ -1137,7 +1137,7 @@
     Diag(property->getLocation(), 
          diag::err_accessor_property_type_mismatch) 
       << property->getDeclName()
-      << GetterMethod->getSelector().getAsIdentifierInfo();
+      << GetterMethod->getSelector();
     Diag(GetterMethod->getLocation(), diag::note_declared_at);
   }
   
@@ -1150,7 +1150,7 @@
       Diag(property->getLocation(), 
            diag::err_accessor_property_type_mismatch) 
         << property->getDeclName()
-        << SetterMethod->getSelector().getAsIdentifierInfo();
+        << SetterMethod->getSelector();
       Diag(SetterMethod->getLocation(), diag::note_declared_at);
     }
   }





More information about the cfe-commits mailing list