[PATCH] D51949: [WIP][clang-tidy] initial ideas to isolate variable declarations

Jonas Toth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 13 10:43:17 PDT 2018


JonasToth added inline comments.


================
Comment at: clang-tidy/readability/IsolateDeclCheck.cpp:35
+namespace {
+SourceLocation findNextTerminator(SourceLocation Start, const SourceManager &SM,
+                                  const LangOptions &LangOpts) {
----------------
Remove duplication, make it a variadic template and use `Token.isOneOf(TemplateArgs...)`


================
Comment at: clang-tidy/readability/IsolateDeclCheck.cpp:74
+/// This function assumes, that \p DS only contains VarDecl elements.
+std::vector<SourceRange> DeclSlice(const DeclStmt *DS, const SourceManager &SM,
+                                   const LangOptions &LangOpts) {
----------------
Make this an `llvm::Expected<T>` and bail on all macro occurences or any other invalid sourcelocations.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D51949





More information about the cfe-commits mailing list