================
Comment at: clang-tidy/readability/RedundantVoidArg.cpp:148
@@ +147,3 @@
+ std::string DeclText = getText(Result, Start, BeforeBody);
+ removeVoidArgumentTokens(Result, Start, DeclText, "function definition");
+ } else {
----------------
You can also pass std::string to an llvm::StringRef. In the llvm codebase it is
a rule of thumb to use StringRef instead of const std::string&.
================
Comment at: clang-tidy/readability/RedundantVoidArg.cpp:158
@@ +157,3 @@
+ const std::string &DeclText, StringRef GrammarLocation) {
+ clang::Lexer PrototypeLexer(StartLoc, Result.Context->getLangOpts(),
+ DeclText.data(), DeclText.data(),
----------------
It is possible to create a lexer without creating an std::string. You can check
an example in: http://reviews.llvm.org/D7375 (look for getBuffer and
getCharacterData). Of course, this way you have to make sure to end lexing
after the interested position is left, but you avoid the heap allocation.
http://reviews.llvm.org/D7639
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits