gribozavr added inline comments.
================
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) {
----------------
ymandel wrote:
> 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?
You're right. I don't think it is necessary to factor out the assertion -- up
to you.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D63288/new/
https://reviews.llvm.org/D63288
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits