aboutsummaryrefslogtreecommitdiff
path: root/lib/Frontend
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-10-18 20:26:27 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-10-18 20:26:27 +0000
commit5ffe14ca96bd662de7820f6875d3f04789a640c1 (patch)
tree4271b9ef7cd5fea724ecaa5f2259c0cdd60f9b38 /lib/Frontend
parente013d685c6689ac7ae103ee88acf573422d1ed6a (diff)
Move misc clients to IdentifierInfo StringRef API.
- strcmp -> == - OS.write(II->getName() ...) -> OS << II->getNameStr() - Avoid std::string concatenation - Use getNameStr().str() when an std::string is really needed. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84437 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend')
-rw-r--r--lib/Frontend/PrintPreprocessedOutput.cpp4
-rw-r--r--lib/Frontend/RewriteMacros.cpp8
-rw-r--r--lib/Frontend/RewriteObjC.cpp4
3 files changed, 8 insertions, 8 deletions
diff --git a/lib/Frontend/PrintPreprocessedOutput.cpp b/lib/Frontend/PrintPreprocessedOutput.cpp
index 492b31a0ec..3883228224 100644
--- a/lib/Frontend/PrintPreprocessedOutput.cpp
+++ b/lib/Frontend/PrintPreprocessedOutput.cpp
@@ -399,7 +399,7 @@ static void PrintPreprocessedTokens(Preprocessor &PP, Token &Tok,
}
if (IdentifierInfo *II = Tok.getIdentifierInfo()) {
- OS.write(II->getName(), II->getLength());
+ OS << II->getNameStr();
} else if (Tok.isLiteral() && !Tok.needsCleaning() &&
Tok.getLiteralData()) {
OS.write(Tok.getLiteralData(), Tok.getLength());
@@ -434,7 +434,7 @@ namespace {
struct SortMacrosByID {
typedef std::pair<IdentifierInfo*, MacroInfo*> id_macro_pair;
bool operator()(const id_macro_pair &LHS, const id_macro_pair &RHS) const {
- return strcmp(LHS.first->getName(), RHS.first->getName()) < 0;
+ return LHS.first->getNameStr() < RHS.first->getNameStr();
}
};
}
diff --git a/lib/Frontend/RewriteMacros.cpp b/lib/Frontend/RewriteMacros.cpp
index d92f5c78e6..846d4767fa 100644
--- a/lib/Frontend/RewriteMacros.cpp
+++ b/lib/Frontend/RewriteMacros.cpp
@@ -128,13 +128,13 @@ void clang::RewriteMacrosInInput(Preprocessor &PP, llvm::raw_ostream *OS) {
// comment the line out.
if (RawTokens[CurRawTok].is(tok::identifier)) {
const IdentifierInfo *II = RawTokens[CurRawTok].getIdentifierInfo();
- if (!strcmp(II->getName(), "warning")) {
+ if (II->getNameStr() == "warning") {
// Comment out #warning.
RB.InsertTextAfter(SM.getFileOffset(RawTok.getLocation()), "//");
- } else if (!strcmp(II->getName(), "pragma") &&
+ } else if (II->getNameStr() == "pragma" &&
RawTokens[CurRawTok+1].is(tok::identifier) &&
- !strcmp(RawTokens[CurRawTok+1].getIdentifierInfo()->getName(),
- "mark")){
+ (RawTokens[CurRawTok+1].getIdentifierInfo()->getNameStr() ==
+ "mark")) {
// Comment out #pragma mark.
RB.InsertTextAfter(SM.getFileOffset(RawTok.getLocation()), "//");
}
diff --git a/lib/Frontend/RewriteObjC.cpp b/lib/Frontend/RewriteObjC.cpp
index bd3031aabe..f3ce9cda9f 100644
--- a/lib/Frontend/RewriteObjC.cpp
+++ b/lib/Frontend/RewriteObjC.cpp
@@ -675,7 +675,7 @@ static std::string getIvarAccessString(ObjCInterfaceDecl *ClassDecl,
S = "((struct ";
S += ClassDecl->getIdentifier()->getName();
S += "_IMPL *)self)->";
- S += OID->getNameAsCString();
+ S += OID->getName();
return S;
}
@@ -2265,7 +2265,7 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjCMessageExpr *Exp) {
if (clsName) { // class message.
// FIXME: We need to fix Sema (and the AST for ObjCMessageExpr) to handle
// the 'super' idiom within a class method.
- if (!strcmp(clsName->getName(), "super")) {
+ if (clsName->getNameStr() == "super") {
MsgSendFlavor = MsgSendSuperFunctionDecl;
if (MsgSendStretFlavor)
MsgSendStretFlavor = MsgSendSuperStretFunctionDecl;