JDevlieghere added a comment.
Some small stuff I noticed while reading through the code, I didn't check it in
much detail though.
================
Comment at: clang-tidy/readability/OneNamePerDeclarationCheck.cpp:43
+void OneNamePerDeclarationCheck::check(const MatchFinder::MatchResult &Result)
{
+ if (const auto *DeclStmt =
+ Result.Nodes.getNodeAs<clang::DeclStmt>("declstmt")) {
----------------
Early exit would reduce the level of indentation of the whole function.
================
Comment at: clang-tidy/readability/OneNamePerDeclarationCheck.cpp:47
+ // Single declarations and macros will be ignored
+ if (DeclStmt->isSingleDecl() == false &&
+ DeclStmt->getLocStart().isMacroID() == false) {
----------------
Same as previous comment.
================
Comment at: clang-tidy/readability/OneNamePerDeclarationCheck.cpp:55
+ getCurrentLineIndent(DeclStmt->getLocStart(), SM);
+ std::string UserWrittenType = getUserWrittenType(DeclStmt, SM);
+
----------------
I think this can be const as well.
================
Comment at: clang-tidy/readability/OneNamePerDeclarationCheck.cpp:116
+
+ std::string Appendee = Lexer::getSourceText(
+ CharSourceRange::getTokenRange(
----------------
const
================
Comment at: clang-tidy/readability/OneNamePerDeclarationCheck.cpp:159
+
+ if (auto FirstVar =
+ llvm::dyn_cast<const clang::DeclaratorDecl>(*FirstVarIt)) {
----------------
const auto
================
Comment at: clang-tidy/readability/OneNamePerDeclarationCheck.cpp:164
+ Type = FirstVar->getType();
+ } else if (auto FirstVar =
+ llvm::dyn_cast<const clang::TypedefDecl>(*FirstVarIt)) {
----------------
const auto
================
Comment at: clang-tidy/readability/OneNamePerDeclarationCheck.cpp:245
+ FileID FID = V.first;
+ unsigned StartOffs = V.second;
+
----------------
const
================
Comment at: clang-tidy/readability/OneNamePerDeclarationCheck.cpp:249
+
+ unsigned LineNo = SM.getLineNumber(FID, StartOffs) - 1;
+ const SrcMgr::ContentCache *Content =
----------------
const
Repository:
rL LLVM
https://reviews.llvm.org/D27621
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits