[clang] [Safe Buffers] Serialize unsafe_buffer_usage pragmas (PR #92031)

Artem Dergachev via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 12 19:23:24 PDT 2024


================
@@ -1911,6 +1911,20 @@ SourceManager::getDecomposedIncludedLoc(FileID FID) const {
   return DecompLoc;
 }
 
+FileID SourceManager::getFirstFIDOfLoadedAST(SourceLocation Loc) const {
+  assert(isLoadedSourceLocation(Loc) &&
+         "Must be a source location in a loaded PCH/Module file");
+
+  auto [FID, Ignore] = getDecomposedLoc(Loc);
+  const FileID *FirstFID =
+      llvm::lower_bound(LoadedSLocEntryAllocBegin, FID, std::greater<FileID>{});
----------------
haoNoQ wrote:

This is quite magical to me because I don't understand how FileIDs are assigned and in what order they show up in the `LoadedSLocEntryAllocBegin` list. But that's probably ok, this looks like completely normal `SourceManager` code to me.

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


More information about the cfe-commits mailing list