[PATCH] D20693: [clang-tidy] New checker to replace dynamic exception specifications

Alexander Kornienko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 24 07:34:19 PST 2017


alexfh requested changes to this revision.
alexfh added inline comments.
This revision now requires changes to proceed.


================
Comment at: clang-tidy/modernize/UseNoexceptCheck.cpp:20-33
+static StringRef
+makeDynamicExceptionString(const SourceManager &SM,
+                           const CharSourceRange &FileMoveRange) {
+  if (FileMoveRange.isInvalid())
+    return StringRef("");
+
+  std::pair<FileID, unsigned> BeginInfo =
----------------
`Lexer::getSourceText` should do the same thing, I guess.


================
Comment at: clang-tidy/modernize/UseNoexceptCheck.cpp:99
+                  .IgnoreParens()
+                  .template castAs<FunctionProtoTypeLoc>()
+                  .getExceptionSpecRange();
----------------
Does it actually need `template ` to compile?


================
Comment at: clang-tidy/modernize/UseNoexceptCheck.cpp:103
+  CharSourceRange CRange = Lexer::makeFileCharRange(
+      CharSourceRange(Range, true), *Result.SourceManager,
+      Result.Context->getLangOpts());
----------------
`CharSourceRange::getTokenRange(Range)` is easier to understand.


================
Comment at: test/clang-tidy/modernize-use-noexcept.cpp:87
+#endif
+  ;
----------------
Please add a test with templates and multiple instantiations, e.g.:

  template<typename T>
  void qqq() noexcept {}
  void www() { qqq<int>(); qqq<double>(); }

Same for member functions.


https://reviews.llvm.org/D20693





More information about the cfe-commits mailing list