-
Notifications
You must be signed in to change notification settings - Fork 351
[clang][scan-deps] Add option to disable caching stat failures #11728
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: next
Are you sure you want to change the base?
Conversation
While the source code isn't supposed to change during a build, in some environments it does. This adds an option that disables caching of stat failures, meaning that source files can be added to the build during scanning. This adds a `-no-cache-negative-stats` option to clang-scan-deps to enable this behavior. There are no tests for clang-scan-deps as there's no reliable way to do so from it. A unit test has been added that modifies the filesystem between scans to test it. Internally this uses an environment variable. `CLANG_SCAN_CACHE_NEGATIVE_STATS`: If this is set or set to 1 negative stat caching is enabled. If it's 0 then it's disabled. Negative stat caching is disabled by default.
|
@swift-ci please test |
|
@swift-ci please test llvm |
| static ScanningOptimizations OptimizeArgs; | ||
| static std::string ModuleFilesDir; | ||
| static bool EagerLoadModules; | ||
| static bool CacheNegativeStats = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default value here is always overwritten in ParseArgs().
|
|
||
| EagerLoadModules = Args.hasArg(OPT_eager_load_pcm); | ||
|
|
||
| CacheNegativeStats = !Args.hasArg(OPT_no_cache_negative_stats); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This means clang-scan-deps has a different default to other clients, why is that?
| CASOptions(), nullptr, nullptr, nullptr, ScanningOptimizations::Default, | ||
| /*EagerLoadModules=*/false, | ||
| /*TraceVFS=*/false, llvm::sys::toTimeT(std::chrono::system_clock::now()), | ||
| true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add /*CacheNegativeStats=*/ label here other places the service gets constructed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it set to true here? I'd think we'd want to match the default behavior of the libclang API.
While the source code isn't supposed to change during a build, in some environments it does. This adds an option that disables caching of stat failures, meaning that source files can be added to the build during scanning.
This adds a
-no-cache-negative-statsoption to clang-scan-deps to enable this behavior. There are no tests for clang-scan-deps as there's no reliable way to do so from it. A unit test has been added that modifies the filesystem between scans to test it.Internally this uses an environment variable.
CLANG_SCAN_CACHE_NEGATIVE_STATS: If this is set or set to 1 negative stat caching is enabled. If it's 0 then it's disabled.Negative stat caching is disabled by default.