Use StringRef::startswith to do some string comparisons.
authorEric Christopher <echristo@apple.com>
Mon, 7 Nov 2011 18:53:23 +0000 (18:53 +0000)
committerEric Christopher <echristo@apple.com>
Mon, 7 Nov 2011 18:53:23 +0000 (18:53 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143982 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/AsmPrinter/DwarfDebug.cpp

index d3414d7be55b4499b805c66efa823fe157975601..39d0d1c96bbb0416aab994e8deb8b8f4bff0c975 100644 (file)
@@ -525,20 +525,17 @@ CompileUnit *DwarfDebug::constructCompileUnit(const MDNode *N) {
 }
 
 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;
 }