[PATCH] D18575: [clang-tidy] New checker to replace deprecated throw() specifications
Etienne Bergeron via cfe-commits
cfe-commits at lists.llvm.org
Thu May 12 12:55:42 PDT 2016
etienneb added a subscriber: etienneb.
etienneb added a comment.
drive by
================
Comment at: clang-tidy/modernize/UseNoexceptCheck.cpp:40
@@ +39,3 @@
+ unsigned &Len) {
+ SourceManager &SM = *Result.SourceManager;
+ const ASTContext &Context = *Result.Context;
----------------
nit: const
================
Comment at: clang-tidy/modernize/UseNoexceptCheck.cpp:97
@@ +96,3 @@
+void UseNoexceptCheck::check(const MatchFinder::MatchResult &Result) {
+ auto FuncDecl = Result.Nodes.getNodeAs<FunctionDecl>("functionDecl");
+ if (!FuncDecl)
----------------
nit: const auto FuncDecl*
================
Comment at: clang-tidy/modernize/UseNoexceptCheck.cpp:114
@@ +113,3 @@
+ "specification '%1'; use '%2' instead")
+ << FuncDecl->getNameInfo().getAsString()
+ << StringRef(
----------------
I'm not sure, but I think you can replace
FuncDecl->getNameInfo().getAsString() by FuncDecl.
IIRC, there is a automatic conversion for the name.
================
Comment at: clang-tidy/modernize/UseNoexceptCheck.cpp:120
@@ +119,3 @@
+ << FixItHint::CreateReplacement(
+ CharSourceRange::getTokenRange(FileMoveRange.getBegin(),
+ FileMoveRange.getEnd()),
----------------
FileMoveRange is a CharSourceRange, so why to you need to do getTokenRange?
```
CharSourceRange FileMoveRange;
```
================
Comment at: clang-tidy/utils/LexerUtils.cpp:38
@@ -37,1 +37,3 @@
+SmallVector<Token, 16> ParseTokens(const ASTContext &Context,
+ const SourceManager &Sources,
----------------
I like having lexer functions lifted out.
But 'ParseTokens' doesn't reflect that it stop when reaching a semicolon or a brace.
```
if (Tok.is(tok::semi) || Tok.is(tok::l_brace))
```
================
Comment at: test/clang-tidy/modernize-use-noexcept.cpp:4
@@ +3,3 @@
+
+class A{};
+class B{};
----------------
nits: space after A and B
class A {};
http://reviews.llvm.org/D18575
More information about the cfe-commits
mailing list