]> granicus.if.org Git - clang/commitdiff
Integrated some of Chris's comments; check for an empty string in InsertStrXXX()
authorTed Kremenek <kremenek@apple.com>
Wed, 19 Mar 2008 08:00:50 +0000 (08:00 +0000)
committerTed Kremenek <kremenek@apple.com>
Wed, 19 Mar 2008 08:00:50 +0000 (08:00 +0000)
before descending into the bowels of the Rewriter.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48541 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Rewrite/Rewriter.h

index e8a367d42b0cdad3b06f541b097d46d032079609..d4cba6af0abb751b59a3a3ab626ae977c3a085a3 100644 (file)
@@ -184,11 +184,11 @@ public:
   }
   
   bool InsertStrBefore(SourceLocation Loc, const std::string& S) {
-    return InsertTextBefore(Loc, S.c_str(), S.size());
+    return S.empty() ? false : InsertTextBefore(Loc, S.c_str(), S.size());
   }
 
   bool InsertStrAfter(SourceLocation Loc, const std::string& S) {
-    return InsertTextAfter(Loc, S.c_str(), S.size());
+    return S.empty() ? false : InsertTextAfter(Loc, S.c_str(), S.size());
   }