[PATCH] D18238: [clang-tidy] Fix clang-tidy crashes when using -fdelayed-template-parsing.
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 17 07:01:57 PDT 2016
aaron.ballman added a subscriber: aaron.ballman.
================
Comment at: cppcoreguidelines/ProTypeMemberInitCheck.cpp:183
@@ +182,3 @@
+ // Skip delayed template instantiation declarations.
+ const auto *Body = Ctor->getBody();
+ if (!Body)
----------------
Please do not use auto here since the type isn't spelled out in the initializer. (The line directly above it also should not be using auto either.)
================
Comment at: modernize/RedundantVoidArgCheck.cpp:108
@@ -107,3 +107,3 @@
SourceLocation End;
- if (Function->hasBody())
- End = Function->getBody()->getLocStart().getLocWithOffset(-1);
+ const auto *Body = Function->getBody();
+ if (Body)
----------------
Don't use auto here either.
================
Comment at: modernize/RedundantVoidArgCheck.cpp:109
@@ +108,3 @@
+ const auto *Body = Function->getBody();
+ if (Body)
+ End = Body->getLocStart().getLocWithOffset(-1);
----------------
You could get rid of the if and else and just use it directly in removeVoidArgumentTokens().
```
removeVoidArgumentTokens(Result, SourceRange(Start, Body ? Body->getLocStart().getLocWithOffset(-1) : Function-getLocEnd()), "function definition");
```
http://reviews.llvm.org/D18238
More information about the cfe-commits
mailing list