[flang-commits] [flang] [flang] Get ProvenanceRange from CharBlock starting with expanded macro (PR #77791)

Peter Klausler via flang-commits flang-commits at lists.llvm.org
Thu Jan 11 08:52:04 PST 2024


================
@@ -465,7 +473,16 @@ std::optional<ProvenanceRange> CookedSource::GetProvenanceRange(
   if (first.start() <= last.start()) {
     return {ProvenanceRange{first.start(), last.start() - first.start() + 1}};
   } else {
-    return std::nullopt;
+    // cookedRange may start (resp. end) in a macro expansion while it does not
+    // end (resp. start) in this macro expansion. Attempt to build a range
+    // over the replaced source.
+    Provenance firstStart = allSources.GetReplacedProvenance(first.start());
----------------
klausler wrote:

braces please

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


More information about the flang-commits mailing list