Skip to content

Conversation

jansvoboda11
Copy link
Contributor

This PR uses the VFS to check .model files in the Clang static analyzer to match the compiler's behavior for other input files.

@llvmbot llvmbot added clang Clang issues not falling into any other category clang:static analyzer labels Sep 26, 2025
@llvmbot
Copy link
Member

llvmbot commented Sep 26, 2025

@llvm/pr-subscribers-clang

@llvm/pr-subscribers-clang-static-analyzer-1

Author: Jan Svoboda (jansvoboda11)

Changes

This PR uses the VFS to check .model files in the Clang static analyzer to match the compiler's behavior for other input files.


Full diff: https://github.com/llvm/llvm-project/pull/160950.diff

1 Files Affected:

  • (modified) clang/lib/StaticAnalyzer/Frontend/ModelInjector.cpp (+1-1)
diff --git a/clang/lib/StaticAnalyzer/Frontend/ModelInjector.cpp b/clang/lib/StaticAnalyzer/Frontend/ModelInjector.cpp
index be74ff2cd4799..5301f88057203 100644
--- a/clang/lib/StaticAnalyzer/Frontend/ModelInjector.cpp
+++ b/clang/lib/StaticAnalyzer/Frontend/ModelInjector.cpp
@@ -65,7 +65,7 @@ void ModelInjector::onBodySynthesis(const NamedDecl *D) {
   else
     fileName = llvm::StringRef(D->getName().str() + ".model");
 
-  if (!llvm::sys::fs::exists(fileName.str())) {
+  if (!CI.getVirtualFileSystem().exists(fileName)) {
     Bodies[D->getName()] = nullptr;
     return;
   }

@jansvoboda11 jansvoboda11 merged commit 34ebdaf into llvm:main Sep 26, 2025
12 checks passed
@jansvoboda11 jansvoboda11 deleted the vfs-model-injector branch September 26, 2025 21:53
mahesh-attarde pushed a commit to mahesh-attarde/llvm-project that referenced this pull request Oct 3, 2025
This PR uses the VFS to check `.model` files in the Clang static
analyzer to match the compiler's behavior for other input files.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang:static analyzer clang Clang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants