[clang] [clang-tools-extra] [clang] Make deprecations of some `FileManager` APIs formal (PR #110014)

Jan Svoboda via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 25 10:24:33 PDT 2024


================
@@ -1925,8 +1921,8 @@ ModuleLoadResult CompilerInstance::findOrCompileModuleAndReadAST(
     M = HS.lookupModule(ModuleName, ImportLoc, true, !IsInclusionDirective);
 
     // Check whether M refers to the file in the prebuilt module path.
-    if (M && M->getASTFile())
-      if (auto ModuleFile = FileMgr->getFile(ModuleFilename))
+    if (M && M->getASTFile() && M->getASTFile())
----------------
jansvoboda11 wrote:

Good catch. I was playing around with squashing this into a single `if` statement like so:

```c++
    // Check whether M refers to the file in the prebuilt module path.
    if (M && M->getASTFile() &&
        *M->getASTFile() == FileMgr->getOptionalFileRef(ModuleFilename))
      return M;
```

but didn't like how it wraps.

https://github.com/llvm/llvm-project/pull/110014


More information about the cfe-commits mailing list