r346801 - [AST] Revert r346793 and r346781
Bruno Ricci via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 13 13:33:23 PST 2018
Author: brunoricci
Date: Tue Nov 13 13:33:22 2018
New Revision: 346801
URL: http://llvm.org/viewvc/llvm-project?rev=346801&view=rev
Log:
[AST] Revert r346793 and r346781
This somehow breaks the msan bots. Revert while I figure it out.
Modified:
cfe/trunk/include/clang/AST/Expr.h
cfe/trunk/include/clang/AST/Stmt.h
cfe/trunk/lib/AST/Expr.cpp
Modified: cfe/trunk/include/clang/AST/Expr.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Expr.h?rev=346801&r1=346800&r2=346801&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Expr.h (original)
+++ cfe/trunk/include/clang/AST/Expr.h Tue Nov 13 13:33:22 2018
@@ -1876,27 +1876,27 @@ private:
unsigned Opc : 5;
unsigned CanOverflow : 1;
SourceLocation Loc;
- Stmt *Operand;
-
+ Stmt *Val;
public:
- UnaryOperator(Expr *Operand, Opcode Opc, QualType Ty, ExprValueKind VK,
- ExprObjectKind OK, SourceLocation Loc, bool CanOverflow)
- : Expr(UnaryOperatorClass, Ty, VK, OK,
- Operand->isTypeDependent() || Ty->isDependentType(),
- Operand->isValueDependent(),
- (Operand->isInstantiationDependent() ||
- Ty->isInstantiationDependentType()),
- Operand->containsUnexpandedParameterPack()),
- Opc(Opc), CanOverflow(CanOverflow), Loc(Loc), Operand(Operand) {}
+ UnaryOperator(Expr *input, Opcode opc, QualType type, ExprValueKind VK,
+ ExprObjectKind OK, SourceLocation l, bool CanOverflow)
+ : Expr(UnaryOperatorClass, type, VK, OK,
+ input->isTypeDependent() || type->isDependentType(),
+ input->isValueDependent(),
+ (input->isInstantiationDependent() ||
+ type->isInstantiationDependentType()),
+ input->containsUnexpandedParameterPack()),
+ Opc(opc), CanOverflow(CanOverflow), Loc(l), Val(input) {}
/// Build an empty unary operator.
- explicit UnaryOperator(EmptyShell Empty) : Expr(UnaryOperatorClass, Empty) {}
+ explicit UnaryOperator(EmptyShell Empty)
+ : Expr(UnaryOperatorClass, Empty), Opc(UO_AddrOf) { }
Opcode getOpcode() const { return static_cast<Opcode>(Opc); }
void setOpcode(Opcode O) { Opc = O; }
- Expr *getSubExpr() const { return cast<Expr>(Operand); }
- void setSubExpr(Expr *E) { Operand = E; }
+ Expr *getSubExpr() const { return cast<Expr>(Val); }
+ void setSubExpr(Expr *E) { Val = E; }
/// getOperatorLoc - Return the location of the operator.
SourceLocation getOperatorLoc() const { return Loc; }
@@ -1912,41 +1912,45 @@ public:
void setCanOverflow(bool C) { CanOverflow = C; }
/// isPostfix - Return true if this is a postfix operation, like x++.
- static bool isPostfix(Opcode Opc) {
- return Opc == UO_PostInc || Opc == UO_PostDec;
+ static bool isPostfix(Opcode Op) {
+ return Op == UO_PostInc || Op == UO_PostDec;
}
/// isPrefix - Return true if this is a prefix operation, like --x.
- static bool isPrefix(Opcode Opc) {
- return Opc == UO_PreInc || Opc == UO_PreDec;
+ static bool isPrefix(Opcode Op) {
+ return Op == UO_PreInc || Op == UO_PreDec;
}
bool isPrefix() const { return isPrefix(getOpcode()); }
bool isPostfix() const { return isPostfix(getOpcode()); }
- static bool isIncrementOp(Opcode Opc) {
- return Opc == UO_PreInc || Opc == UO_PostInc;
+ static bool isIncrementOp(Opcode Op) {
+ return Op == UO_PreInc || Op == UO_PostInc;
+ }
+ bool isIncrementOp() const {
+ return isIncrementOp(getOpcode());
}
- bool isIncrementOp() const { return isIncrementOp(getOpcode()); }
- static bool isDecrementOp(Opcode Opc) {
- return Opc == UO_PreDec || Opc == UO_PostDec;
+ static bool isDecrementOp(Opcode Op) {
+ return Op == UO_PreDec || Op == UO_PostDec;
+ }
+ bool isDecrementOp() const {
+ return isDecrementOp(getOpcode());
}
- bool isDecrementOp() const { return isDecrementOp(getOpcode()); }
- static bool isIncrementDecrementOp(Opcode Opc) { return Opc <= UO_PreDec; }
+ static bool isIncrementDecrementOp(Opcode Op) { return Op <= UO_PreDec; }
bool isIncrementDecrementOp() const {
return isIncrementDecrementOp(getOpcode());
}
- static bool isArithmeticOp(Opcode Opc) {
- return Opc >= UO_Plus && Opc <= UO_LNot;
+ static bool isArithmeticOp(Opcode Op) {
+ return Op >= UO_Plus && Op <= UO_LNot;
}
bool isArithmeticOp() const { return isArithmeticOp(getOpcode()); }
/// getOpcodeStr - Turn an Opcode enum value into the punctuation char it
/// corresponds to, e.g. "sizeof" or "[pre]++"
- static StringRef getOpcodeStr(Opcode Opc);
+ static StringRef getOpcodeStr(Opcode Op);
/// Retrieve the unary opcode that corresponds to the given
/// overloaded operator.
@@ -1957,21 +1961,21 @@ public:
static OverloadedOperatorKind getOverloadedOperator(Opcode Opc);
SourceLocation getBeginLoc() const LLVM_READONLY {
- return isPostfix() ? Operand->getBeginLoc() : getOperatorLoc();
+ return isPostfix() ? Val->getBeginLoc() : Loc;
}
SourceLocation getEndLoc() const LLVM_READONLY {
- return isPostfix() ? getOperatorLoc() : Operand->getEndLoc();
+ return isPostfix() ? Loc : Val->getEndLoc();
}
- SourceLocation getExprLoc() const { return getOperatorLoc(); }
+ SourceLocation getExprLoc() const LLVM_READONLY { return Loc; }
static bool classof(const Stmt *T) {
return T->getStmtClass() == UnaryOperatorClass;
}
// Iterators
- child_range children() { return child_range(&Operand, &Operand + 1); }
+ child_range children() { return child_range(&Val, &Val+1); }
const_child_range children() const {
- return const_child_range(&Operand, &Operand + 1);
+ return const_child_range(&Val, &Val + 1);
}
};
Modified: cfe/trunk/include/clang/AST/Stmt.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Stmt.h?rev=346801&r1=346800&r2=346801&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Stmt.h (original)
+++ cfe/trunk/include/clang/AST/Stmt.h Tue Nov 13 13:33:22 2018
@@ -332,20 +332,12 @@ protected:
SourceLocation Loc;
};
- class DeclRefExprBitfields {
- friend class ASTStmtReader; // deserialization
- friend class DeclRefExpr;
+ class CharacterLiteralBitfields {
+ friend class CharacterLiteral;
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 Kind : 3;
};
enum APFloatSemantics {
@@ -366,14 +358,6 @@ protected:
unsigned IsExact : 1;
};
- class CharacterLiteralBitfields {
- friend class CharacterLiteral;
-
- unsigned : NumExprBits;
-
- unsigned Kind : 3;
- };
-
class UnaryExprOrTypeTraitExprBitfields {
friend class UnaryExprOrTypeTraitExpr;
@@ -383,12 +367,20 @@ protected:
unsigned IsType : 1; // true if operand is a type, false if an expression.
};
- class CallExprBitfields {
- friend class CallExpr;
+ class DeclRefExprBitfields {
+ friend class ASTStmtReader; // deserialization
+ friend class DeclRefExpr;
unsigned : NumExprBits;
- unsigned NumPreArgs : 1;
+ unsigned HasQualifier : 1;
+ unsigned HasTemplateKWAndArgsInfo : 1;
+ unsigned HasFoundDecl : 1;
+ unsigned HadMultipleCandidates : 1;
+ unsigned RefersToEnclosingVariableOrCapture : 1;
+
+ /// The location of the declaration name itself.
+ SourceLocation Loc;
};
class CastExprBitfields {
@@ -402,14 +394,24 @@ protected:
unsigned BasePathIsEmpty : 1;
};
- class InitListExprBitfields {
- friend class InitListExpr;
+ class CallExprBitfields {
+ friend class CallExpr;
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;
+ unsigned NumPreArgs : 1;
+ };
+
+ 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;
};
class PseudoObjectExprBitfields {
@@ -424,7 +426,33 @@ protected:
unsigned ResultIndex : 32 - 8 - NumExprBits;
};
- //===--- C++ Expression 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;
+ };
+
+ 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;
+ };
class TypeTraitExprBitfields {
friend class ASTStmtReader;
@@ -444,20 +472,6 @@ 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;
@@ -466,30 +480,7 @@ 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;
@@ -510,27 +501,19 @@ protected:
// Expressions
ExprBitfields ExprBits;
PredefinedExprBitfields PredefinedExprBits;
- DeclRefExprBitfields DeclRefExprBits;
- FloatingLiteralBitfields FloatingLiteralBits;
CharacterLiteralBitfields CharacterLiteralBits;
+ FloatingLiteralBitfields FloatingLiteralBits;
UnaryExprOrTypeTraitExprBitfields UnaryExprOrTypeTraitExprBits;
- CallExprBitfields CallExprBits;
+ DeclRefExprBitfields DeclRefExprBits;
CastExprBitfields CastExprBits;
- InitListExprBitfields InitListExprBits;
+ CallExprBitfields CallExprBits;
+ ExprWithCleanupsBitfields ExprWithCleanupsBits;
PseudoObjectExprBitfields PseudoObjectExprBits;
-
- // C++ Expressions
+ OpaqueValueExprBitfields OpaqueValueExprBits;
+ ObjCIndirectCopyRestoreExprBitfields ObjCIndirectCopyRestoreExprBits;
+ InitListExprBitfields InitListExprBits;
TypeTraitExprBitfields TypeTraitExprBits;
- ExprWithCleanupsBitfields ExprWithCleanupsBits;
-
- // C++ Coroutines TS expressions
CoawaitExprBitfields CoawaitBits;
-
- // Obj-C Expressions
- ObjCIndirectCopyRestoreExprBitfields ObjCIndirectCopyRestoreExprBits;
-
- // Clang Extensions
- OpaqueValueExprBitfields OpaqueValueExprBits;
};
public:
Modified: cfe/trunk/lib/AST/Expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Expr.cpp?rev=346801&r1=346800&r2=346801&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Expr.cpp (original)
+++ cfe/trunk/lib/AST/Expr.cpp Tue Nov 13 13:33:22 2018
@@ -1174,8 +1174,8 @@ StringLiteral::getLocationOfByte(unsigne
/// getOpcodeStr - Turn an Opcode enum value into the punctuation char it
/// corresponds to, e.g. "sizeof" or "[pre]++".
-StringRef UnaryOperator::getOpcodeStr(Opcode Opc) {
- switch (Opc) {
+StringRef UnaryOperator::getOpcodeStr(Opcode Op) {
+ switch (Op) {
#define UNARY_OPERATION(Name, Spelling) case UO_##Name: return Spelling;
#include "clang/AST/OperationKinds.def"
}
More information about the cfe-commits
mailing list