[PATCH] D45839: [analyzer] Add support for WebKit "unified sources".

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 23 14:31:36 PDT 2018


NoQ added inline comments.


================
Comment at: include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h:144
+    // includes the full path.
+    if (SM.getFilename(IL).contains("UnifiedSource")) {
+      StringRef Name = SM.getFilename(SL);
----------------
probinson wrote:
> george.karpenkov wrote:
> > NoQ wrote:
> > > george.karpenkov wrote:
> > > > Is this `if` really necessary? This logic has too much overfitting, and it seems that if someone decides to include `.cc` files, we should analyze them in any case, right? We also would prefer to not stop working if webkit decides on using a different naming for those.
> > > This is indeed an act of overfitting. But also there are very few reasons to include a non-header file, and all of them are pretty exotic. I'm not sure we want to analyze these files in all cases. So i want to play safe until we gather more data.
> > I would still say that just analyzing included c++ files is a lesser evil.
> Agreed.  WebKit is not the only project that does this kind of thing.
The question is, are all such projects in fact interested in having the analyzer analyze the respective code?

For instance, if the included code is autogenerated by an external tool, users are probably not interested in finding bugs in such code because they will be unable to fix them.

Are you interested in providing a list of examples of projects that do this kind of thing, explain why are they doing it, and whether they will be interested in having warnings in included files?


https://reviews.llvm.org/D45839





More information about the cfe-commits mailing list