================
@@ -16638,19 +16638,30 @@ ExprResult Sema::BuildBuiltinOffsetOf(SourceLocation 
BuiltinLoc,
   QualType CurrentType = ArgTy;
   SmallVector<OffsetOfNode, 4> Comps;
   SmallVector<Expr*, 4> Exprs;
-  for (const OffsetOfComponent &OC : Components) {
-    if (OC.isBrackets) {
+  // Source-range helpers for a designator. The leading field has no '.', so
+  // its range collapses to the field-name location.
+  auto LocStart = [](const Designator &D) {
+    if (D.isFieldDesignator())
+      return D.getDotLoc().isValid() ? D.getDotLoc() : D.getFieldLoc();
+    return D.getLBracketLoc();
+  };
+  auto LocEnd = [](const Designator &D) {
+    return D.isFieldDesignator() ? D.getFieldLoc() : D.getRBracketLoc();
+  };
----------------
schuay wrote:

Done

https://github.com/llvm/llvm-project/pull/199097
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to