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

Ben Langmuir via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 1 15:01:26 PDT 2023


benlangmuir 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 \
----------------
This looks suspicious; what's going on here?


================
Comment at: clang/tools/libclang/CXFile.h:1
+//===----------------------------------------------------------------------===//
+//
----------------
Missing filename and C++ language tag from header comment.


================
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)
----------------
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.  


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