r250977 - Fix a couple places where InsertText was being called with a pointer and size when it really expects a StringRef and a normally optional bool argument.
Craig Topper via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 21 20:13:10 PDT 2015
Author: ctopper
Date: Wed Oct 21 22:13:10 2015
New Revision: 250977
URL: http://llvm.org/viewvc/llvm-project?rev=250977&view=rev
Log:
Fix a couple places where InsertText was being called with a pointer and size when it really expects a StringRef and a normally optional bool argument.
The pointer was being implicitly converted to a StringRef and the size was being passed into the bool. Since the bool has a default value normally, no one noticed that the wrong number of arguments was given.
Modified:
cfe/trunk/lib/Frontend/Rewrite/RewriteModernObjC.cpp
cfe/trunk/lib/Frontend/Rewrite/RewriteObjC.cpp
Modified: cfe/trunk/lib/Frontend/Rewrite/RewriteModernObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/Rewrite/RewriteModernObjC.cpp?rev=250977&r1=250976&r2=250977&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/Rewrite/RewriteModernObjC.cpp (original)
+++ cfe/trunk/lib/Frontend/Rewrite/RewriteModernObjC.cpp Wed Oct 21 22:13:10 2015
@@ -4843,7 +4843,7 @@ void RewriteModernObjC::RewriteImplicitC
std::string Str = "(";
Str += TypeString;
Str += ")";
- InsertText(IC->getSubExpr()->getLocStart(), &Str[0], Str.size());
+ InsertText(IC->getSubExpr()->getLocStart(), Str);
return;
}
@@ -5622,7 +5622,7 @@ Stmt *RewriteModernObjC::RewriteFunction
// FIXME: Missing definition of
// InsertText(clang::SourceLocation, char const*, unsigned int).
- // InsertText(startLoc, messString.c_str(), messString.size());
+ // InsertText(startLoc, messString);
// Tried this, but it didn't work either...
// ReplaceText(startLoc, 0, messString.c_str(), messString.size());
#endif
@@ -5748,7 +5748,7 @@ Stmt *RewriteModernObjC::RewriteFunction
const std::string &Str = Buf.str();
printf("CAST = %s\n", &Str[0]);
- InsertText(ICE->getSubExpr()->getLocStart(), &Str[0], Str.size());
+ InsertText(ICE->getSubExpr()->getLocStart(), Str);
delete S;
return Replacement;
}
Modified: cfe/trunk/lib/Frontend/Rewrite/RewriteObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/Rewrite/RewriteObjC.cpp?rev=250977&r1=250976&r2=250977&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/Rewrite/RewriteObjC.cpp (original)
+++ cfe/trunk/lib/Frontend/Rewrite/RewriteObjC.cpp Wed Oct 21 22:13:10 2015
@@ -4664,7 +4664,7 @@ Stmt *RewriteObjC::RewriteFunctionBodyOr
// FIXME: Missing definition of
// InsertText(clang::SourceLocation, char const*, unsigned int).
- // InsertText(startLoc, messString.c_str(), messString.size());
+ // InsertText(startLoc, messString);
// Tried this, but it didn't work either...
// ReplaceText(startLoc, 0, messString.c_str(), messString.size());
#endif
@@ -4779,7 +4779,7 @@ Stmt *RewriteObjC::RewriteFunctionBodyOr
const std::string &Str = Buf.str();
printf("CAST = %s\n", &Str[0]);
- InsertText(ICE->getSubExpr()->getLocStart(), &Str[0], Str.size());
+ InsertText(ICE->getSubExpr()->getLocStart(), Str);
delete S;
return Replacement;
}
More information about the cfe-commits
mailing list