================
@@ -663,10 +663,15 @@ SourceManager::createExpansionLocImpl(const ExpansionInfo 
&Info,
     return SourceLocation::getMacroLoc(LoadedOffset);
   }
   LocalSLocEntryTable.push_back(SLocEntry::get(NextLocalOffset, Info));
-  // FIXME: Produce a proper diagnostic for this case.
-  assert(NextLocalOffset + Length + 1 > NextLocalOffset &&
-         NextLocalOffset + Length + 1 <= CurrentLoadedOffset &&
-         "Ran out of source locations!");
+  if (NextLocalOffset + Length + 1 <= NextLocalOffset ||
+      NextLocalOffset + Length + 1 > CurrentLoadedOffset) {
+    Diag.Report(Info.getSpellingLoc(), diag::err_expansions_too_large);
+    // FIXME: call `noteSLocAddressSpaceUsage` to report details to users.
----------------
sam-mccall wrote:

hm, this makes the diag *significantly* less useful.

I suppose this change is still better than the status quo, but any idea what 
causes it?

If it's the new LocalSLocEntryTable entry (which seems plausible), it seems you 
could just move the check above it?

https://github.com/llvm/llvm-project/pull/69908
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to