njames93 marked 3 inline comments as done. njames93 added inline comments.
================ Comment at: clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp:149-151 + auto CaseOptionName = (Name + "Case").str(); + auto CaseValue = Options.get(CaseOptionName, ""); + auto const caseOptional = fromString(CaseValue); ---------------- aaron.ballman wrote: > Some `auto`s that don't have the type spelled out (also, a top-level `const` > that can be dropped). Copying from what was already there. ================ Comment at: clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp:154 + llvm::errs() << "warning: Invalid case style '" << CaseValue + << "' for readability-identifier-naming." << CaseOptionName; + constexpr StringRef AcceptibleNames[] = { ---------------- aaron.ballman wrote: > njames93 wrote: > > Unsure about hardcoding the check-name as it could be ran under an alias. > > However there is no way for a ClangTidyCheck to get the name its ran as. > > `ClangTidyCheck::CheckName` is `private`, maybe a protected getter would be > > wise. > I agree that we should not hardcode the name of the check. I actually wonder > if a better approach here is to call `Context->diag()` to generate an actual > diagnostic? A few issues with that approach, firstly the `ClangTidyCheck` doesn't expose the `ClangTidyContext` to any derived classes. the other issue is it requires a `SourceLocation` to emit a diagnostic, Passing an invalid `SourceLocation` effectively suppresses any output, likewise any other `SourceLocation` will just confuse users. I have got another implementation in the works that creates new methods in `ClangTidyCheck::OptionsView` that takes a mapping from `StringRef` to `Enum` and uses that for reading (and writing) enums from the configuration. This has access to the `CheckName` and can distinguish if the enum was read from local or global and adjust accordingly. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D76606/new/ https://reviews.llvm.org/D76606 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits