[PATCH] D59555: [analyzer] Add yaml parser to GenericTaintChecker

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 6 21:27:20 PDT 2019


NoQ added a comment.

In D59555#1514602 <https://reviews.llvm.org/D59555#1514602>, @NoQ wrote:

> I'm still in doubts on how to connect your work with the `CallDescription` effort. I'll think more about that.


I guess i'll just make a yaml reader for `CallDescription`s as soon as the interface settles down a bit, and then propose you to switch to using it.



================
Comment at: lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp:804-805
+  auto *Checker = mgr.registerChecker<GenericTaintChecker>();
+  StringRef ConfigFile =
+      mgr.getAnalyzerOptions().getCheckerStringOption(Checker, "Config", "");
+  llvm::Optional<TaintConfig> Config =
----------------
I think i'll softly advocate for a more centralized format that doesn't require every checker to implement an option for just that purpose.

Will you be happy with a global analyzer flag, eg. `-analyzer-config api-yaml=/home/foo/analyzer.yaml` and then:
```lang=yaml
Checker:
    Name: alpha.security.taint.TaintPropagation
    Config:
        Propagations:
        ...
```
with possibly multiple checkers in the same file? I guess we can change it later if you don't mind breaking flag compatibility.


================
Comment at: lib/StaticAnalyzer/Checkers/Yaml.h:16-17
+  if (std::error_code ec = Buffer.getError()) {
+    llvm::errs() << "Error when getting TaintPropagation's config file '"
+                 << ConfigFile << "': " << ec.message() << '\n';
+    return {};
----------------
I believe we should emit a compile error-like diagnostic here. One of the good things about compile errors would be that GUIs like scan-build would notify their users about compile errors in a friendly manner, while dumps to `llvm::errs()` will be completely ignored.


Repository:
  rC Clang

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

https://reviews.llvm.org/D59555





More information about the cfe-commits mailing list