[PATCH] D78126: [analyzer][NFC] Don't allow dependency checkers to emit diagnostics

Gabor Marton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 15 05:59:22 PDT 2020


martong added inline comments.


================
Comment at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h:153
+#undef CHECKER_DEPENDENCY
+#undef GET_CHECKER_DEPENDENCIES
+  }
----------------
Szelethus wrote:
> Szelethus wrote:
> > balazske wrote:
> > > Probably too much of assert here (but it works)? (There is not a way to get the dependency data "dynamically", like //"Checker->isDependentOn(OtherChecker)"//?)
> > Wow, you're totally correct, I didn't even consider that. Indeed, this doesn't work with plugins (or checkers from unit tests), but it should be doable, since `CheckerManager` owns `CheckerRegistry` (D75360). This is kind of ironic, considering how much I tend to block patches based on this :^)
> Oh, to actually answer your question. The checker dependency information is stored in `CheckerRegistry` in this small struct:
> ```lang=cpp
>   struct CheckerInfo {
>     enum class StateFromCmdLine {
>       // This checker wasn't explicitly enabled or disabled.
>       State_Unspecified,
>       // This checker was explicitly disabled.
>       State_Disabled,
>       // This checker was explicitly enabled.
>       State_Enabled
>     };
> 
>     InitializationFunction Initialize = nullptr;
>     ShouldRegisterFunction ShouldRegister = nullptr;
>     StringRef FullName;
>     StringRef Desc;
>     StringRef DocumentationUri;
>     CmdLineOptionList CmdLineOptions;
>     bool IsHidden = false;
>     StateFromCmdLine State = StateFromCmdLine::State_Unspecified;
> 
>     ConstCheckerInfoList Dependencies;
>     //...
>   };
> ```
> So the nice solution should make this info a bit more visible.
I have no serious bad feelings with the macro solution, but if you can come  up with a better structure then that would be so cool! :)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78126





More information about the cfe-commits mailing list