From 6bcedd51e193e3770e9d5c81fd4f65fa3002fb72 Mon Sep 17 00:00:00 2001 From: Bruno Ricci Date: Tue, 13 Nov 2018 20:23:11 +0000 Subject: [PATCH] [AST][NFC] Order the bit-field classes of Stmt like in StmtNodes.td Reorder the bit-field classes and the members of the anonymous union so that they both match the order in StmtNodes.td. There is already a fair amount of them, and this is not going to improve. Therefore lets try to keep some order here. Strictly NFC. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@346793 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/AST/Stmt.h | 143 ++++++++++++++++++++++----------------- 1 file changed, 80 insertions(+), 63 deletions(-) diff --git a/include/clang/AST/Stmt.h b/include/clang/AST/Stmt.h index 02d09b0450..c288a079fa 100644 --- a/include/clang/AST/Stmt.h +++ b/include/clang/AST/Stmt.h @@ -332,12 +332,20 @@ protected: SourceLocation Loc; }; - class CharacterLiteralBitfields { - friend class CharacterLiteral; + class DeclRefExprBitfields { + friend class ASTStmtReader; // deserialization + friend class DeclRefExpr; unsigned : NumExprBits; - unsigned Kind : 3; + unsigned HasQualifier : 1; + unsigned HasTemplateKWAndArgsInfo : 1; + unsigned HasFoundDecl : 1; + unsigned HadMultipleCandidates : 1; + unsigned RefersToEnclosingVariableOrCapture : 1; + + /// The location of the declaration name itself. + SourceLocation Loc; }; enum APFloatSemantics { @@ -358,6 +366,14 @@ protected: unsigned IsExact : 1; }; + class CharacterLiteralBitfields { + friend class CharacterLiteral; + + unsigned : NumExprBits; + + unsigned Kind : 3; + }; + class UnaryExprOrTypeTraitExprBitfields { friend class UnaryExprOrTypeTraitExpr; @@ -367,20 +383,12 @@ protected: unsigned IsType : 1; // true if operand is a type, false if an expression. }; - class DeclRefExprBitfields { - friend class ASTStmtReader; // deserialization - friend class DeclRefExpr; + class CallExprBitfields { + friend class CallExpr; unsigned : NumExprBits; - unsigned HasQualifier : 1; - unsigned HasTemplateKWAndArgsInfo : 1; - unsigned HasFoundDecl : 1; - unsigned HadMultipleCandidates : 1; - unsigned RefersToEnclosingVariableOrCapture : 1; - - /// The location of the declaration name itself. - SourceLocation Loc; + unsigned NumPreArgs : 1; }; class CastExprBitfields { @@ -394,24 +402,14 @@ protected: unsigned BasePathIsEmpty : 1; }; - class CallExprBitfields { - friend class CallExpr; - - unsigned : NumExprBits; - - unsigned NumPreArgs : 1; - }; - - class ExprWithCleanupsBitfields { - friend class ASTStmtReader; // deserialization - friend class ExprWithCleanups; + class InitListExprBitfields { + friend class InitListExpr; unsigned : NumExprBits; - // When false, it must not have side effects. - unsigned CleanupsHaveSideEffects : 1; - - unsigned NumObjects : 32 - 1 - NumExprBits; + /// Whether this initializer list originally had a GNU array-range + /// designator in it. This is a temporary marker used by CodeGen. + unsigned HadArrayRangeDesignator : 1; }; class PseudoObjectExprBitfields { @@ -426,33 +424,7 @@ protected: unsigned ResultIndex : 32 - 8 - NumExprBits; }; - class OpaqueValueExprBitfields { - friend class OpaqueValueExpr; - - unsigned : NumExprBits; - - /// The OVE is a unique semantic reference to its source expressio if this - /// bit is set to true. - unsigned IsUnique : 1; - }; - - class ObjCIndirectCopyRestoreExprBitfields { - friend class ObjCIndirectCopyRestoreExpr; - - unsigned : NumExprBits; - - unsigned ShouldCopy : 1; - }; - - class InitListExprBitfields { - friend class InitListExpr; - - unsigned : NumExprBits; - - /// Whether this initializer list originally had a GNU array-range - /// designator in it. This is a temporary marker used by CodeGen. - unsigned HadArrayRangeDesignator : 1; - }; + //===--- C++ Expression bitfields classes ---===// class TypeTraitExprBitfields { friend class ASTStmtReader; @@ -472,6 +444,20 @@ protected: unsigned NumArgs : 32 - 8 - 1 - NumExprBits; }; + class ExprWithCleanupsBitfields { + friend class ASTStmtReader; // deserialization + friend class ExprWithCleanups; + + unsigned : NumExprBits; + + // When false, it must not have side effects. + unsigned CleanupsHaveSideEffects : 1; + + unsigned NumObjects : 32 - 1 - NumExprBits; + }; + + //===--- C++ Coroutines TS bitfields classes ---===// + class CoawaitExprBitfields { friend class CoawaitExpr; @@ -480,7 +466,30 @@ protected: unsigned IsImplicit : 1; }; + //===--- Obj-C Expression bitfields classes ---===// + + class ObjCIndirectCopyRestoreExprBitfields { + friend class ObjCIndirectCopyRestoreExpr; + + unsigned : NumExprBits; + + unsigned ShouldCopy : 1; + }; + + //===--- Clang Extensions bitfields classes ---===// + + class OpaqueValueExprBitfields { + friend class OpaqueValueExpr; + + unsigned : NumExprBits; + + /// The OVE is a unique semantic reference to its source expressio if this + /// bit is set to true. + unsigned IsUnique : 1; + }; + union { + // Same order as in StmtNodes.td. // Statements StmtBitfields StmtBits; NullStmtBitfields NullStmtBits; @@ -501,19 +510,27 @@ protected: // Expressions ExprBitfields ExprBits; PredefinedExprBitfields PredefinedExprBits; - CharacterLiteralBitfields CharacterLiteralBits; + DeclRefExprBitfields DeclRefExprBits; FloatingLiteralBitfields FloatingLiteralBits; + CharacterLiteralBitfields CharacterLiteralBits; UnaryExprOrTypeTraitExprBitfields UnaryExprOrTypeTraitExprBits; - DeclRefExprBitfields DeclRefExprBits; - CastExprBitfields CastExprBits; CallExprBitfields CallExprBits; - ExprWithCleanupsBitfields ExprWithCleanupsBits; - PseudoObjectExprBitfields PseudoObjectExprBits; - OpaqueValueExprBitfields OpaqueValueExprBits; - ObjCIndirectCopyRestoreExprBitfields ObjCIndirectCopyRestoreExprBits; + CastExprBitfields CastExprBits; InitListExprBitfields InitListExprBits; + PseudoObjectExprBitfields PseudoObjectExprBits; + + // C++ Expressions TypeTraitExprBitfields TypeTraitExprBits; + ExprWithCleanupsBitfields ExprWithCleanupsBits; + + // C++ Coroutines TS expressions CoawaitExprBitfields CoawaitBits; + + // Obj-C Expressions + ObjCIndirectCopyRestoreExprBitfields ObjCIndirectCopyRestoreExprBits; + + // Clang Extensions + OpaqueValueExprBitfields OpaqueValueExprBits; }; public: -- 2.40.0