From: Benjamin Kramer Date: Thu, 8 Apr 2010 15:54:07 +0000 (+0000) Subject: CIndex: move extractUSRSuffix out of extern "C" and simplify it. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cfb51b6d465d39aa00ea71d99bd8814b79fe4516;p=clang CIndex: move extractUSRSuffix out of extern "C" and simplify it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100773 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/tools/CIndex/CIndexUSRs.cpp b/tools/CIndex/CIndexUSRs.cpp index 379320c31c..e90d965a1c 100644 --- a/tools/CIndex/CIndexUSRs.cpp +++ b/tools/CIndex/CIndexUSRs.cpp @@ -259,6 +259,10 @@ void USRGenerator::GenObjCProtocol(llvm::StringRef prot) { // 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 @@ CXString clang_getCursorUSR(CXCursor C) { 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));