[PATCH] Refactor: Move remove-cstr-calls from a standalone executable to a clang-tidy check

Richard legalize at xmission.com
Thu Feb 19 10:45:42 PST 2015


In http://reviews.llvm.org/D7318#125262, @mclow.lists wrote:

> I don't have a problem with making this a clang-tidy module, but it was (also) meant as an example of how to write a refactoring tool.


Do we now have enough examples of refactoring tools that the example motivation is no longer a concern?


================
Comment at: clang-tidy/misc/RemoveCStrCall.cpp:32
@@ +31,3 @@
+std::string getText(const SourceManager &SourceManager, const T &Node) {
+  SourceLocation StartSpellingLocation =
+      SourceManager.getSpellingLoc(Node.getLocStart());
----------------
alexfh wrote:
> I suspect that most of this method can be replaced to a call to clang::Lexer::getSourceText (and this method can return StringRef).
Diff in progress...

================
Comment at: clang-tidy/readability/RemoveCStrCall.h:10-11
@@ +9,4 @@
+
+#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_REMOVE_C_STR_CALL_H
+#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_REMOVE_C_STR_CALL_H
+
----------------
Oops, this still says misc

http://reviews.llvm.org/D7318

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list