[llvm-commits] [llvm] r143982 - /llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp

Eric Christopher echristo at apple.com
Mon Nov 7 10:53:23 PST 2011


Author: echristo
Date: Mon Nov  7 12:53:23 2011
New Revision: 143982

URL: http://llvm.org/viewvc/llvm-project?rev=143982&view=rev
Log:
Use StringRef::startswith to do some string comparisons.

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=143982&r1=143981&r2=143982&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Mon Nov  7 12:53:23 2011
@@ -525,20 +525,17 @@
 }
 
 static bool isObjCClass(StringRef Name) {
-  if (Name == "") return false;
-  return Name[0] == '+' || Name[0] == '-';
+  return Name.startswith("+") || Name.startswith("-");
 }
 
 static bool hasObjCCategory(StringRef Name) {
-  if (Name[0] != '+' && Name[0] != '-')
-    return false;
+  if (!isObjCClass(Name)) return false;
 
   size_t pos = Name.find(')');
   if (pos != std::string::npos) {
     if (Name[pos+1] != ' ') return false;
     return true;
   }
-
   return false;
 }
 





More information about the llvm-commits mailing list