[PATCH] D151938: [clang][index] NFCI: Make `CXFile` a `FileEntryRef`

Jan Svoboda via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 14 03:08:06 PDT 2023


jansvoboda11 added inline comments.


================
Comment at: clang/test/Modules/crash-vfs-umbrella-frameworks.m:13
 // RUN: env FORCE_CLANG_DIAGNOSTICS_CRASH= TMPDIR=%t TEMP=%t TMP=%t \
-// RUN: not %clang -nostdinc -fsyntax-only %s \
+// RUN: not --crash %clang -nostdinc -fsyntax-only %s \
 // RUN:     -F %/t/i/Frameworks -fmodules \
----------------
benlangmuir wrote:
> This looks suspicious; what's going on here?
Bad cherry-pick, removed.


================
Comment at: clang/tools/libclang/CXLoadedDiagnostic.cpp:279
   else {
-    LoadedLoc.file = const_cast<FileEntry *>(TopDiags->Files[FileID]);
+    LoadedLoc.file = cxfile::makeCXFile(TopDiags->Files.find(FileID)->second);
     if (!LoadedLoc.file)
----------------
benlangmuir wrote:
> Does this preserve behaviour in call cases? operator[] will construct nullptr if the key is missing, but the new code will crash dereferencing an invalid iterator.  
You're right, let's continue being defensive here.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151938/new/

https://reviews.llvm.org/D151938



More information about the cfe-commits mailing list