[cfe-commits] r100773 - /cfe/trunk/tools/CIndex/CIndexUSRs.cpp

Benjamin Kramer benny.kra at googlemail.com
Thu Apr 8 08:54:07 PDT 2010


Author: d0k
Date: Thu Apr  8 10:54:07 2010
New Revision: 100773

URL: http://llvm.org/viewvc/llvm-project?rev=100773&view=rev
Log:
CIndex: move extractUSRSuffix out of extern "C" and simplify it.

Modified:
    cfe/trunk/tools/CIndex/CIndexUSRs.cpp

Modified: cfe/trunk/tools/CIndex/CIndexUSRs.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/CIndex/CIndexUSRs.cpp?rev=100773&r1=100772&r2=100773&view=diff
==============================================================================
--- cfe/trunk/tools/CIndex/CIndexUSRs.cpp (original)
+++ cfe/trunk/tools/CIndex/CIndexUSRs.cpp Thu Apr  8 10:54:07 2010
@@ -259,6 +259,10 @@
 // API hooks.
 //===----------------------------------------------------------------------===//
 
+static inline llvm::StringRef extractUSRSuffix(llvm::StringRef s) {
+  return s.startswith("c:") ? s.substr(2) : "";
+}
+
 extern "C" {
 
 CXString clang_getCursorUSR(CXCursor C) {
@@ -276,12 +280,6 @@
   return createCXString(SUG.str(), true);
 }
 
-static inline llvm::StringRef extractUSRSuffix(llvm::StringRef s) {
-  if (!(s.size() >= 2 && s[0] == 'c' && s[1] == ':'))
-    return "";
-  return s.substr(2);
-}
-  
 CXString clang_constructUSR_ObjCIvar(const char *name, CXString classUSR) {
   StringUSRGenerator SUG;
   SUG << extractUSRSuffix(clang_getCString(classUSR));





More information about the cfe-commits mailing list