[cfe-commits] r173182 - in /cfe/trunk: include/clang/Sema/Sema.h lib/Sema/SemaExprObjC.cpp

Fariborz Jahanian fjahanian at apple.com
Tue Jan 22 11:05:17 PST 2013


Author: fjahanian
Date: Tue Jan 22 13:05:17 2013
New Revision: 173182

URL: http://llvm.org/viewvc/llvm-project?rev=173182&view=rev
Log:
Small code change to improve performance
in my last patch, suggested by Argyrios.

Modified:
    cfe/trunk/include/clang/Sema/Sema.h
    cfe/trunk/lib/Sema/SemaExprObjC.cpp

Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=173182&r1=173181&r2=173182&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Tue Jan 22 13:05:17 2013
@@ -575,6 +575,9 @@
   /// \brief id<NSCopying> type.
   QualType QIDNSCopying;
 
+  /// \brief will hold 'respondsToSelector:'
+  Selector RespondsToSelectorSel;
+  
   /// A flag to remember whether the implicit forms of operator new and delete
   /// have been declared.
   bool GlobalNewDeleteDeclared;

Modified: cfe/trunk/lib/Sema/SemaExprObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprObjC.cpp?rev=173182&r1=173181&r2=173182&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprObjC.cpp Tue Jan 22 13:05:17 2013
@@ -2485,8 +2485,12 @@
                                       MultiExprArg Args) {
   if (!Receiver)
     return ExprError();
-  IdentifierInfo *SelectorId = &Context.Idents.get("respondsToSelector");
-  if (Sel == Context.Selectors.getUnarySelector(SelectorId))
+  
+  if (RespondsToSelectorSel.isNull()) {
+    IdentifierInfo *SelectorId = &Context.Idents.get("respondsToSelector");
+    RespondsToSelectorSel = Context.Selectors.getUnarySelector(SelectorId);
+  }
+  if (Sel == RespondsToSelectorSel)
     RemoveSelectorFromWarningCache(*this, Args[0]);
     
   return BuildInstanceMessage(Receiver, Receiver->getType(),





More information about the cfe-commits mailing list