llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Ian Li (ianayl) <details> <summary>Changes</summary> Further review of this PR would be appreciated! Admittedly I am not the most familiar with this part of the code. But to the best of my knowledge, this could potentially be a problem. This was first pointed out by a Coverity static analysis scan: Success/failure results from `CompilerInstance::createTarget` in `CompilerInstanceWithContext::initialize` is currently being discarded. AFAICT, `initialize` should have failed if `CompilerInstance::createTarget` failed, as I noticed that calls in `CompilerInstanceWithContext::computeDependencies` (which is ran right after `initialize`) contains function calls (i.e. `CI.loadModule`) that make references to `CompilerInstance::getTarget`: `getTarget` then tries to obtain a reference to the very `TargetInfo` instance that the earlier `CompilerInstance::createTarget` call failed to create. AFAIK `createTarget` doesn't actually seem to fail currently, but I haven't been able to find a good reason as for why success/failure from `CompilerInstance::createTarget` should be ignored even if it failed. But please let me know if I am not seeing something here! --- Full diff: https://github.com/llvm/llvm-project/pull/211607.diff 1 Files Affected: - (modified) clang/lib/Tooling/DependencyScanningTool.cpp (+1-3) ``````````diff diff --git a/clang/lib/Tooling/DependencyScanningTool.cpp b/clang/lib/Tooling/DependencyScanningTool.cpp index b435e42af28b4..4072244f33fc3 100644 --- a/clang/lib/Tooling/DependencyScanningTool.cpp +++ b/clang/lib/Tooling/DependencyScanningTool.cpp @@ -500,9 +500,7 @@ bool CompilerInstanceWithContext::initialize( // once here, and the information is reused for all computeDependencies calls. // We do not need to call createTarget explicitly if we go through // CompilerInstance::ExecuteAction to perform scanning. - CI.createTarget(); - - return true; + return CI.createTarget(); } bool CompilerInstanceWithContext::computeDependencies( `````````` </details> https://github.com/llvm/llvm-project/pull/211607 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
