[PATCH] D27621: [clang-tidy] check to find declarations declaring more than one name

Alex Lorenz via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 12 07:48:48 PST 2016


arphaman added inline comments.


================
Comment at: clang-tidy/readability/OneNamePerDeclarationCheck.cpp:133
+    VariableLocation.setBegin(tidy::utils::lexer::findLocationAfterToken(
+        VariableLocation.getEnd(), Tokens, *Result.Context));
+  }
----------------
If you use `ArrayRef` in `findLocationAfterToken` then you won't need to create a `std::vector` here as you should be able to pass in a constant array `{tok::semi, tok::comma}`


================
Comment at: clang-tidy/utils/LexerUtils.h:32
+SourceLocation findLocationAfterToken(SourceLocation Loc,
+                                      const std::vector<tok::TokenKind> &Tokens,
+                                      ASTContext &Context);
----------------
You can use `ArrayRef<tok::TokenKind>` here.


https://reviews.llvm.org/D27621





More information about the cfe-commits mailing list