[PATCH] D26206: Fix Clang-tidy readability-redundant-string-cstr warnings

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 1 11:57:32 PDT 2016


aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

Aside from some formatting nits, this LGTM. You should run the diff through clang-format before committing.



================
Comment at: lib/CodeGen/CGObjCGNU.cpp:2650
        llvm::Constant *TheClass =
-         TheModule.getGlobalVariable(("_OBJC_CLASS_" + iter->first).c_str(),
+         TheModule.getGlobalVariable("_OBJC_CLASS_" + iter->first,
             true);
----------------
Formatting.


================
Comment at: lib/CodeGen/TargetInfo.cpp:7460
   FieldEncoding(bool b, SmallStringEnc &e) : HasName(b), Enc(e.c_str()) {}
-  StringRef str() {return Enc.c_str();}
+  StringRef str() {return Enc;}
   bool operator<(const FieldEncoding &rhs) const {
----------------
Formatting (since you're touching it anyway).


================
Comment at: lib/Frontend/CompilerInvocation.cpp:1472
 
-    Opts.AddPath(Path.c_str(), Group, IsFramework,
+    Opts.AddPath(Path, Group, IsFramework,
                  /*IgnoreSysroot*/ true);
----------------
Formatting.


================
Comment at: lib/Frontend/Rewrite/RewriteObjC.cpp:5653
   RewriteObjCMethodsMetaData(InstanceMethods.begin(), InstanceMethods.end(),
-                             true, "CATEGORY_", FullCategoryName.c_str(),
+                             true, "CATEGORY_", FullCategoryName,
                              Result);
----------------
Formatting. Same below.


================
Comment at: unittests/AST/ASTImporterTest.cpp:75
   MFS->addFile(InputFileName, 0,
-               llvm::MemoryBuffer::getMemBuffer(FromCode.c_str()));
+               llvm::MemoryBuffer::getMemBuffer(FromCode));
 
----------------
Possibly formatting?


https://reviews.llvm.org/D26206





More information about the cfe-commits mailing list