alexfh requested changes to this revision.
alexfh added inline comments.
This revision now requires changes to proceed.
================
Comment at: clang-tidy/modernize/UseAutoCheck.cpp:33
+
+bool IsNotSpace(const char& C) {
+ return !std::isspace(static_cast<unsigned char>(C));
----------------
Why `const char&` and not just `char`? Moreover, these two functions can be
replaced with lambdas. See below.
================
Comment at: clang-tidy/modernize/UseAutoCheck.cpp:445-449
+size_t UseAutoCheck::GetTypeNameLength(const SourceRange &SR,
+ const ASTContext &Context) {
+ const StringRef S = tooling::fixit::getText(SR, Context);
+ return std::count_if(S.begin(), S.end(), SpacePredicate);
+}
----------------
```
static size_t GetTypeNameLength(const TypeLoc &Loc, const ASTContext &Context,
bool IgnoreStars) {
const StringRef S = tooling::fixit::getText(Loc.getSourceRange(), Context);
if (IgnoreStars)
return llvm::count_if(S, [] (char C) { return std::isspace(C) || C == '*';
});
return llvm::count_if(S, [] (char C) { return std::isspace(C); });
}
```
================
Comment at: clang-tidy/modernize/UseAutoCheck.h:31
StringRef Message);
+ size_t GetTypeNameLength(const SourceRange &SR, const ASTContext &Context);
----------------
I'd make this a static function and remove the `SpacePredicate` field as well.
See the comment below.
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D45927
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits