Page MenuHomePhabricator

[analyzer] Add CTUImportCppThreshold for C++ files
ClosedPublic

Authored by martong on Jul 9 2020, 5:30 AM.

Details

Summary

The default CTUImportThreshold (8) seems to be too conservative with C projects.
We increase this value to 24 and we introduce another threshold for C++ source
files (defaulted to 8) because their AST is way more compilcated than C source
files.

Diff Detail

Event Timeline

martong created this revision.Jul 9 2020, 5:30 AM
gamesh411 accepted this revision.Jul 9 2020, 5:58 AM

It will be interesting to see how different C and C++ projects will prove in terms of AST complexity, and Decl-size, but I understand that for now, these two options are necessary to not penalize C project analysis because of C++ AST complexity.

This revision is now accepted and ready to land.Jul 9 2020, 5:58 AM
gamesh411 added inline comments.Jul 9 2020, 6:00 AM
clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.def
333

extra whitespace at the end

martong updated this revision to Diff 276722.Jul 9 2020, 6:02 AM
martong marked an inline comment as done.
  • Remove extra whitespace
This revision was automatically updated to reflect the committed changes.
Szelethus added inline comments.Jul 9 2020, 6:38 AM
clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.def
48–50

This reminds me of some options having different default values depending on -analyzer-config user-mode. I think that solution, and the one proposed in this patch is subpar, but the best solution, turning this entire thing into a TableGen file, would be a chore.

I don't like this solution toooo much, but I respect the urgency, and since we don't introduce a compatibility issue, I trust we can remove this if we decide to change to TableGen. Post-commit LGTM!