[clang] 1503db8 - [clang][NFC] Refactor bit-fields in `RawComment`

Vlad Serebrennikov via cfe-commits cfe-commits at lists.llvm.org
Sun Feb 11 05:29:34 PST 2024


Author: Vlad Serebrennikov
Date: 2024-02-11T16:29:17+03:00
New Revision: 1503db86d65ee2bcc8ec1c2a5a4d00dea02aae0d

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

LOG: [clang][NFC] Refactor bit-fields in `RawComment`

Make them all of the same `unsigned` type, which brings `sizeof(RawComment)` down from 12 to 4 when compiling Clang for Microsoft ABI.

Added: 
    

Modified: 
    clang/include/clang/AST/RawCommentList.h

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/AST/RawCommentList.h b/clang/include/clang/AST/RawCommentList.h
index 53aae24fa7bbc1..3e4567b546a71d 100644
--- a/clang/include/clang/AST/RawCommentList.h
+++ b/clang/include/clang/AST/RawCommentList.h
@@ -175,17 +175,22 @@ class RawComment {
   mutable StringRef RawText;
   mutable const char *BriefText = nullptr;
 
-  mutable bool RawTextValid : 1;   ///< True if RawText is valid
-  mutable bool BriefTextValid : 1; ///< True if BriefText is valid
+  LLVM_PREFERRED_TYPE(bool)
+  mutable unsigned RawTextValid : 1;
+  LLVM_PREFERRED_TYPE(bool)
+  mutable unsigned BriefTextValid : 1;
 
   LLVM_PREFERRED_TYPE(CommentKind)
   unsigned Kind : 3;
 
   /// True if comment is attached to a declaration in ASTContext.
-  bool IsAttached : 1;
+  LLVM_PREFERRED_TYPE(bool)
+  unsigned IsAttached : 1;
 
-  bool IsTrailingComment : 1;
-  bool IsAlmostTrailingComment : 1;
+  LLVM_PREFERRED_TYPE(bool)
+  unsigned IsTrailingComment : 1;
+  LLVM_PREFERRED_TYPE(bool)
+  unsigned IsAlmostTrailingComment : 1;
 
   /// Constructor for AST deserialization.
   RawComment(SourceRange SR, CommentKind K, bool IsTrailingComment,


        


More information about the cfe-commits mailing list