From 2ea402541fa1bd2aa9942abf7b281ef01f9a10ff Mon Sep 17 00:00:00 2001 From: Eric Christopher Date: Mon, 7 Nov 2011 18:53:23 +0000 Subject: [PATCH] Use StringRef::startswith to do some string comparisons. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143982 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index d3414d7be55..39d0d1c96bb 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -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; }