Author: Timm Baeder
Date: 2026-09-06T05:40:58+02:00
New Revision: bf085fa43725f4177f44b347aebeb69c96cb3800

URL: 
https://github.com/llvm/llvm-project/commit/bf085fa43725f4177f44b347aebeb69c96cb3800
DIFF: 
https://github.com/llvm/llvm-project/commit/bf085fa43725f4177f44b347aebeb69c96cb3800.diff

LOG: [clang][bytecode] Cache Is(Unnamed)BitFields bools in `Record::Field` 
(#221392)

We need to query those a lot and we can save them in the padding bytes
of `Record::Field`.

Added: 
    

Modified: 
    clang/lib/AST/ByteCode/Record.h

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/ByteCode/Record.h b/clang/lib/AST/ByteCode/Record.h
index 536bc319bde22..a32ac5d14bf81 100644
--- a/clang/lib/AST/ByteCode/Record.h
+++ b/clang/lib/AST/ByteCode/Record.h
@@ -29,16 +29,21 @@ class Record final {
     const FieldDecl *Decl;
     const Descriptor *Desc;
     unsigned Offset;
+    bool IsBitField;
+    bool IsUnnamedBitField;
 
-    bool isBitField() const { return Decl->isBitField(); }
-    bool isUnnamedBitField() const { return Decl->isUnnamedBitField(); }
+    bool isBitField() const { return IsBitField; }
+    bool isUnnamedBitField() const { return IsUnnamedBitField; }
     unsigned bitWidth() const {
       assert(isBitField());
       return Decl->getBitWidthValue();
     }
 
     Field(const FieldDecl *D, const Descriptor *Desc, unsigned Offset)
-        : Decl(D), Desc(Desc), Offset(Offset) {}
+        : Decl(D), Desc(Desc), Offset(Offset) {
+      IsBitField = Decl->isBitField();
+      IsUnnamedBitField = IsBitField && Decl->isUnnamedBitField();
+    }
   };
 
   /// Describes a base class.


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

Reply via email to