ymandel marked an inline comment as done.
ymandel added a comment.

Thanks for the review!



================
Comment at: clang-tools-extra/clang-tidy/utils/TransformerClangTidyCheck.cpp:33
+    StringRef Name, ClangTidyContext *Context)
+    : ClangTidyCheck(Name, Context), Rule(MakeRule(getLangOpts(), Options)) {
+  assert(llvm::all_of(Rule.Cases, [](const RewriteRule::Case &C) {
----------------
gribozavr wrote:
> Can we dispatch to the other constructor?
I think not, but please correct me if I'm wrong (and clearly I should add a 
comment explaining this): in order to get meaningful results from `getLangOpts` 
and `Options`, we need the `ClangTidyCheck()` constructor to have been called. 
If we were to dispatch, it would look like:
```
 : TransformerClangTidyCheck(MakeRule(getLangOpts(), Options), Name, Context) {}
```

which, if I understand correctly, means that `MakeRule` will access that data 
_before_ the check object is properly initialized.

That said, I can factor out the assertion into a method to avoid the 
redundancy.  WDYT?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63288/new/

https://reviews.llvm.org/D63288



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to