================
@@ -3115,7 +3115,19 @@ class FieldDecl : public DeclaratorDecl, public 
Mergeable<FieldDecl> {
 
   /// Returns the index of this field within its record,
   /// as appropriate for passing to ASTRecordLayout::getFieldOffset.
-  unsigned getFieldIndex() const;
+  unsigned getFieldIndex() const {
+    const FieldDecl *C = getCanonicalDecl();
+    if (C->CachedFieldIndex == 0)
+      C->setCachedFieldIndex();
+    assert(C->CachedFieldIndex);
----------------
bricknerb wrote:

Consider being consistent around comparing the index to zero explicitly or not 
(you do it explicitly on line 3120 and implicitly on line 3122).

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

Reply via email to