[PATCH] D117522: [clang-tidy] Add modernize-macro-to-enum check

Richard via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 18 15:48:04 PDT 2022


LegalizeAdulthood added a comment.

In D117522#3392122 <https://reviews.llvm.org/D117522#3392122>, @aaron.ballman wrote:

> In D117522#3390136 <https://reviews.llvm.org/D117522#3390136>, @LegalizeAdulthood wrote:
>
>> I think I've got all the changes incorporated, but I'm getting a test failure so I haven't uploaded a new diff.
>
> If you're able to post the output you're getting, I can try to help psychically debug it.

I finally figured it out!  I previously had written:

  void MacroToEnumCallbacks::warnMacroEnum(const EnumMacro &Macro) const {
    Check->diag(Macro.Directive->getLocation(),
                "macro '%0' defines an integral constant; prefer an enum instead")
        << Macro.Name.getIdentifierInfo()->getName();
  }

and you suggested that I could drop the `->getName()` as it had an insertion operator
for identifier info.  Well, that was true, but what I didn't realize is that this would add an
extra single quotes around the identifier, so my diagnostic output now had doubled-up
single quotes everywhere and I couldn't figure out what was doing this as I couldn't find
doubled up single quotes in my format string and I was suspecting the python script
was somehow treating single quotes special somewhere.

Once I accounted for this, everything passes, so I'll be uploading a new diff shortly.


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

https://reviews.llvm.org/D117522



More information about the cfe-commits mailing list