зеркало из https://github.com/microsoft/clang-1.git
Change StmtNodes.def to StmtNodes.td in anticipation of a rewrite of attributes
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103072 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
28a43a4361
Коммит
9d90d62e16
|
@ -203,13 +203,13 @@ public:
|
|||
|
||||
/// \brief Returns whether this expression refers to a vector element.
|
||||
bool refersToVectorElement() const;
|
||||
|
||||
|
||||
/// isKnownToHaveBooleanValue - Return true if this is an integer expression
|
||||
/// that is known to return 0 or 1. This happens for _Bool/bool expressions
|
||||
/// but also int expressions which are produced by things like comparisons in
|
||||
/// C.
|
||||
bool isKnownToHaveBooleanValue() const;
|
||||
|
||||
|
||||
/// isIntegerConstantExpr - Return true if this expression is a valid integer
|
||||
/// constant expression, and, if so, return its value in Result. If not a
|
||||
/// valid i-c-e, return false and fill in Loc (if specified) with the location
|
||||
|
@ -223,7 +223,7 @@ public:
|
|||
}
|
||||
/// isConstantInitializer - Returns true if this expression is a constant
|
||||
/// initializer, which can be emitted at compile-time.
|
||||
bool isConstantInitializer(ASTContext &Ctx) const;
|
||||
bool isConstantInitializer(ASTContext &Ctx) const;
|
||||
|
||||
/// EvalResult is a struct with detailed info about an evaluated expression.
|
||||
struct EvalResult {
|
||||
|
@ -269,11 +269,11 @@ public:
|
|||
bool isEvaluatable(ASTContext &Ctx) const;
|
||||
|
||||
/// HasSideEffects - This routine returns true for all those expressions
|
||||
/// which must be evaluated each time and must not be optimization away
|
||||
/// which must be evaluated each time and must not be optimization away
|
||||
/// or evaluated at compile time. Example is a function call, volatile
|
||||
/// variable read.
|
||||
bool HasSideEffects(ASTContext &Ctx) const;
|
||||
|
||||
|
||||
/// EvaluateAsInt - Call Evaluate and return the folded integer. This
|
||||
/// must be called on an expression that constant folds to an integer.
|
||||
llvm::APSInt EvaluateAsInt(ASTContext &Ctx) const;
|
||||
|
@ -291,16 +291,16 @@ public:
|
|||
enum NullPointerConstantValueDependence {
|
||||
/// \brief Specifies that the expression should never be value-dependent.
|
||||
NPC_NeverValueDependent = 0,
|
||||
|
||||
|
||||
/// \brief Specifies that a value-dependent expression of integral or
|
||||
/// dependent type should be considered a null pointer constant.
|
||||
NPC_ValueDependentIsNull,
|
||||
|
||||
|
||||
/// \brief Specifies that a value-dependent expression should be considered
|
||||
/// to never be a null pointer constant.
|
||||
NPC_ValueDependentIsNotNull
|
||||
};
|
||||
|
||||
|
||||
/// isNullPointerConstant - C99 6.3.2.3p3 - Return true if this is either an
|
||||
/// integer constant expression with the value zero, or if this is one that is
|
||||
/// cast to void*.
|
||||
|
@ -329,12 +329,12 @@ public:
|
|||
/// \brief Determine whether this expression is a default function argument.
|
||||
///
|
||||
/// Default arguments are implicitly generated in the abstract syntax tree
|
||||
/// by semantic analysis for function calls, object constructions, etc. in
|
||||
/// by semantic analysis for function calls, object constructions, etc. in
|
||||
/// C++. Default arguments are represented by \c CXXDefaultArgExpr nodes;
|
||||
/// this routine also looks through any implicit casts to determine whether
|
||||
/// the expression is a default argument.
|
||||
bool isDefaultArgument() const;
|
||||
|
||||
|
||||
/// \brief Determine whether this expression directly creates a
|
||||
/// temporary object (of class type).
|
||||
bool isTemporaryObject() const { return getTemporaryObject() != 0; }
|
||||
|
@ -374,7 +374,7 @@ public:
|
|||
struct NameQualifier {
|
||||
/// \brief The nested name specifier.
|
||||
NestedNameSpecifier *NNS;
|
||||
|
||||
|
||||
/// \brief The source range covered by the nested name specifier.
|
||||
SourceRange Range;
|
||||
};
|
||||
|
@ -384,20 +384,20 @@ struct NameQualifier {
|
|||
struct ExplicitTemplateArgumentList {
|
||||
/// \brief The source location of the left angle bracket ('<');
|
||||
SourceLocation LAngleLoc;
|
||||
|
||||
|
||||
/// \brief The source location of the right angle bracket ('>');
|
||||
SourceLocation RAngleLoc;
|
||||
|
||||
|
||||
/// \brief The number of template arguments in TemplateArgs.
|
||||
/// The actual template arguments (if any) are stored after the
|
||||
/// ExplicitTemplateArgumentList structure.
|
||||
unsigned NumTemplateArgs;
|
||||
|
||||
|
||||
/// \brief Retrieve the template arguments
|
||||
TemplateArgumentLoc *getTemplateArgs() {
|
||||
return reinterpret_cast<TemplateArgumentLoc *> (this + 1);
|
||||
}
|
||||
|
||||
|
||||
/// \brief Retrieve the template arguments
|
||||
const TemplateArgumentLoc *getTemplateArgs() const {
|
||||
return reinterpret_cast<const TemplateArgumentLoc *> (this + 1);
|
||||
|
@ -407,25 +407,25 @@ struct ExplicitTemplateArgumentList {
|
|||
void copyInto(TemplateArgumentListInfo &List) const;
|
||||
static std::size_t sizeFor(const TemplateArgumentListInfo &List);
|
||||
};
|
||||
|
||||
|
||||
/// DeclRefExpr - [C99 6.5.1p2] - A reference to a declared variable, function,
|
||||
/// enum, etc.
|
||||
class DeclRefExpr : public Expr {
|
||||
enum {
|
||||
// Flag on DecoratedD that specifies when this declaration reference
|
||||
// Flag on DecoratedD that specifies when this declaration reference
|
||||
// expression has a C++ nested-name-specifier.
|
||||
HasQualifierFlag = 0x01,
|
||||
// Flag on DecoratedD that specifies when this declaration reference
|
||||
// Flag on DecoratedD that specifies when this declaration reference
|
||||
// expression has an explicit C++ template argument list.
|
||||
HasExplicitTemplateArgumentListFlag = 0x02
|
||||
};
|
||||
|
||||
// DecoratedD - The declaration that we are referencing, plus two bits to
|
||||
|
||||
// DecoratedD - The declaration that we are referencing, plus two bits to
|
||||
// indicate whether (1) the declaration's name was explicitly qualified and
|
||||
// (2) the declaration's name was followed by an explicit template
|
||||
// (2) the declaration's name was followed by an explicit template
|
||||
// argument list.
|
||||
llvm::PointerIntPair<ValueDecl *, 2> DecoratedD;
|
||||
|
||||
|
||||
// Loc - The location of the declaration name itself.
|
||||
SourceLocation Loc;
|
||||
|
||||
|
@ -433,39 +433,39 @@ class DeclRefExpr : public Expr {
|
|||
NameQualifier *getNameQualifier() {
|
||||
if ((DecoratedD.getInt() & HasQualifierFlag) == 0)
|
||||
return 0;
|
||||
|
||||
|
||||
return reinterpret_cast<NameQualifier *> (this + 1);
|
||||
}
|
||||
|
||||
|
||||
/// \brief Retrieve the qualifier that preceded the member name, if any.
|
||||
const NameQualifier *getNameQualifier() const {
|
||||
return const_cast<DeclRefExpr *>(this)->getNameQualifier();
|
||||
}
|
||||
|
||||
|
||||
/// \brief Retrieve the explicit template argument list that followed the
|
||||
/// member template name, if any.
|
||||
ExplicitTemplateArgumentList *getExplicitTemplateArgumentList() {
|
||||
if ((DecoratedD.getInt() & HasExplicitTemplateArgumentListFlag) == 0)
|
||||
return 0;
|
||||
|
||||
|
||||
if ((DecoratedD.getInt() & HasQualifierFlag) == 0)
|
||||
return reinterpret_cast<ExplicitTemplateArgumentList *>(this + 1);
|
||||
|
||||
|
||||
return reinterpret_cast<ExplicitTemplateArgumentList *>(
|
||||
getNameQualifier() + 1);
|
||||
}
|
||||
|
||||
|
||||
/// \brief Retrieve the explicit template argument list that followed the
|
||||
/// member template name, if any.
|
||||
const ExplicitTemplateArgumentList *getExplicitTemplateArgumentList() const {
|
||||
return const_cast<DeclRefExpr *>(this)->getExplicitTemplateArgumentList();
|
||||
}
|
||||
|
||||
|
||||
DeclRefExpr(NestedNameSpecifier *Qualifier, SourceRange QualifierRange,
|
||||
ValueDecl *D, SourceLocation NameLoc,
|
||||
const TemplateArgumentListInfo *TemplateArgs,
|
||||
QualType T);
|
||||
|
||||
|
||||
protected:
|
||||
/// \brief Computes the type- and value-dependence flags for this
|
||||
/// declaration reference expression.
|
||||
|
@ -493,7 +493,7 @@ public:
|
|||
SourceLocation NameLoc,
|
||||
QualType T,
|
||||
const TemplateArgumentListInfo *TemplateArgs = 0);
|
||||
|
||||
|
||||
ValueDecl *getDecl() { return DecoratedD.getPointer(); }
|
||||
const ValueDecl *getDecl() const { return DecoratedD.getPointer(); }
|
||||
void setDecl(ValueDecl *NewD) { DecoratedD.setPointer(NewD); }
|
||||
|
@ -505,26 +505,26 @@ public:
|
|||
/// \brief Determine whether this declaration reference was preceded by a
|
||||
/// C++ nested-name-specifier, e.g., \c N::foo.
|
||||
bool hasQualifier() const { return DecoratedD.getInt() & HasQualifierFlag; }
|
||||
|
||||
|
||||
/// \brief If the name was qualified, retrieves the source range of
|
||||
/// the nested-name-specifier that precedes the name. Otherwise,
|
||||
/// returns an empty source range.
|
||||
SourceRange getQualifierRange() const {
|
||||
if (!hasQualifier())
|
||||
return SourceRange();
|
||||
|
||||
|
||||
return getNameQualifier()->Range;
|
||||
}
|
||||
|
||||
/// \brief If the name was qualified, retrieves the nested-name-specifier
|
||||
|
||||
/// \brief If the name was qualified, retrieves the nested-name-specifier
|
||||
/// that precedes the name. Otherwise, returns NULL.
|
||||
NestedNameSpecifier *getQualifier() const {
|
||||
if (!hasQualifier())
|
||||
return 0;
|
||||
|
||||
|
||||
return getNameQualifier()->NNS;
|
||||
}
|
||||
|
||||
|
||||
/// \brief Determines whether this member expression actually had a C++
|
||||
/// template argument list explicitly specified, e.g., x.f<int>.
|
||||
bool hasExplicitTemplateArgumentList() const {
|
||||
|
@ -537,43 +537,43 @@ public:
|
|||
if (hasExplicitTemplateArgumentList())
|
||||
getExplicitTemplateArgumentList()->copyInto(List);
|
||||
}
|
||||
|
||||
|
||||
/// \brief Retrieve the location of the left angle bracket following the
|
||||
/// member name ('<'), if any.
|
||||
SourceLocation getLAngleLoc() const {
|
||||
if (!hasExplicitTemplateArgumentList())
|
||||
return SourceLocation();
|
||||
|
||||
|
||||
return getExplicitTemplateArgumentList()->LAngleLoc;
|
||||
}
|
||||
|
||||
|
||||
/// \brief Retrieve the template arguments provided as part of this
|
||||
/// template-id.
|
||||
const TemplateArgumentLoc *getTemplateArgs() const {
|
||||
if (!hasExplicitTemplateArgumentList())
|
||||
return 0;
|
||||
|
||||
|
||||
return getExplicitTemplateArgumentList()->getTemplateArgs();
|
||||
}
|
||||
|
||||
|
||||
/// \brief Retrieve the number of template arguments provided as part of this
|
||||
/// template-id.
|
||||
unsigned getNumTemplateArgs() const {
|
||||
if (!hasExplicitTemplateArgumentList())
|
||||
return 0;
|
||||
|
||||
|
||||
return getExplicitTemplateArgumentList()->NumTemplateArgs;
|
||||
}
|
||||
|
||||
|
||||
/// \brief Retrieve the location of the right angle bracket following the
|
||||
/// template arguments ('>').
|
||||
SourceLocation getRAngleLoc() const {
|
||||
if (!hasExplicitTemplateArgumentList())
|
||||
return SourceLocation();
|
||||
|
||||
|
||||
return getExplicitTemplateArgumentList()->RAngleLoc;
|
||||
}
|
||||
|
||||
|
||||
static bool classof(const Stmt *T) {
|
||||
return T->getStmtClass() == DeclRefExprClass;
|
||||
}
|
||||
|
@ -601,7 +601,7 @@ private:
|
|||
IdentType Type;
|
||||
public:
|
||||
PredefinedExpr(SourceLocation l, QualType type, IdentType IT)
|
||||
: Expr(PredefinedExprClass, type, type->isDependentType(),
|
||||
: Expr(PredefinedExprClass, type, type->isDependentType(),
|
||||
type->isDependentType()), Loc(l), Type(IT) {}
|
||||
|
||||
/// \brief Construct an empty predefined expression.
|
||||
|
@ -1008,14 +1008,14 @@ public:
|
|||
/// @code
|
||||
/// struct S {
|
||||
/// float f;
|
||||
/// double d;
|
||||
/// double d;
|
||||
/// };
|
||||
/// struct T {
|
||||
/// int i;
|
||||
/// struct S s[10];
|
||||
/// };
|
||||
/// @endcode
|
||||
/// we can represent and evaluate the expression @c offsetof(struct T, s[2].d).
|
||||
/// we can represent and evaluate the expression @c offsetof(struct T, s[2].d).
|
||||
|
||||
class OffsetOfExpr : public Expr {
|
||||
public:
|
||||
|
@ -1037,48 +1037,48 @@ public:
|
|||
|
||||
private:
|
||||
enum { MaskBits = 2, Mask = 0x03 };
|
||||
|
||||
|
||||
/// \brief The source range that covers this part of the designator.
|
||||
SourceRange Range;
|
||||
|
||||
|
||||
/// \brief The data describing the designator, which comes in three
|
||||
/// different forms, depending on the lower two bits.
|
||||
/// - An unsigned index into the array of Expr*'s stored after this node
|
||||
/// - An unsigned index into the array of Expr*'s stored after this node
|
||||
/// in memory, for [constant-expression] designators.
|
||||
/// - A FieldDecl*, for references to a known field.
|
||||
/// - An IdentifierInfo*, for references to a field with a given name
|
||||
/// when the class type is dependent.
|
||||
/// - A CXXBaseSpecifier*, for references that look at a field in a
|
||||
/// - A CXXBaseSpecifier*, for references that look at a field in a
|
||||
/// base class.
|
||||
uintptr_t Data;
|
||||
|
||||
|
||||
public:
|
||||
/// \brief Create an offsetof node that refers to an array element.
|
||||
OffsetOfNode(SourceLocation LBracketLoc, unsigned Index,
|
||||
OffsetOfNode(SourceLocation LBracketLoc, unsigned Index,
|
||||
SourceLocation RBracketLoc)
|
||||
: Range(LBracketLoc, RBracketLoc), Data((Index << 2) | Array) { }
|
||||
|
||||
|
||||
/// \brief Create an offsetof node that refers to a field.
|
||||
OffsetOfNode(SourceLocation DotLoc, FieldDecl *Field,
|
||||
OffsetOfNode(SourceLocation DotLoc, FieldDecl *Field,
|
||||
SourceLocation NameLoc)
|
||||
: Range(DotLoc.isValid()? DotLoc : NameLoc, NameLoc),
|
||||
: Range(DotLoc.isValid()? DotLoc : NameLoc, NameLoc),
|
||||
Data(reinterpret_cast<uintptr_t>(Field) | OffsetOfNode::Field) { }
|
||||
|
||||
|
||||
/// \brief Create an offsetof node that refers to an identifier.
|
||||
OffsetOfNode(SourceLocation DotLoc, IdentifierInfo *Name,
|
||||
SourceLocation NameLoc)
|
||||
: Range(DotLoc.isValid()? DotLoc : NameLoc, NameLoc),
|
||||
: Range(DotLoc.isValid()? DotLoc : NameLoc, NameLoc),
|
||||
Data(reinterpret_cast<uintptr_t>(Name) | Identifier) { }
|
||||
|
||||
/// \brief Create an offsetof node that refers into a C++ base class.
|
||||
explicit OffsetOfNode(const CXXBaseSpecifier *Base)
|
||||
: Range(), Data(reinterpret_cast<uintptr_t>(Base) | OffsetOfNode::Base) {}
|
||||
|
||||
|
||||
/// \brief Determine what kind of offsetof node this is.
|
||||
Kind getKind() const {
|
||||
Kind getKind() const {
|
||||
return static_cast<Kind>(Data & Mask);
|
||||
}
|
||||
|
||||
|
||||
/// \brief For an array element node, returns the index into the array
|
||||
/// of expressions.
|
||||
unsigned getArrayExprIndex() const {
|
||||
|
@ -1091,28 +1091,28 @@ public:
|
|||
assert(getKind() == Field);
|
||||
return reinterpret_cast<FieldDecl *>(Data & ~(uintptr_t)Mask);
|
||||
}
|
||||
|
||||
|
||||
/// \brief For a field or identifier offsetof node, returns the name of
|
||||
/// the field.
|
||||
IdentifierInfo *getFieldName() const;
|
||||
|
||||
|
||||
/// \brief For a base class node, returns the base specifier.
|
||||
CXXBaseSpecifier *getBase() const {
|
||||
assert(getKind() == Base);
|
||||
return reinterpret_cast<CXXBaseSpecifier *>(Data & ~(uintptr_t)Mask);
|
||||
return reinterpret_cast<CXXBaseSpecifier *>(Data & ~(uintptr_t)Mask);
|
||||
}
|
||||
|
||||
|
||||
/// \brief Retrieve the source range that covers this offsetof node.
|
||||
///
|
||||
/// For an array element node, the source range contains the locations of
|
||||
/// the square brackets. For a field or identifier node, the source range
|
||||
/// contains the location of the period (if there is one) and the
|
||||
/// contains the location of the period (if there is one) and the
|
||||
/// identifier.
|
||||
SourceRange getRange() const { return Range; }
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
|
||||
SourceLocation OperatorLoc, RParenLoc;
|
||||
// Base type;
|
||||
TypeSourceInfo *TSInfo;
|
||||
|
@ -1120,26 +1120,26 @@ private:
|
|||
unsigned NumComps;
|
||||
// Number of sub-expressions (i.e. array subscript expressions).
|
||||
unsigned NumExprs;
|
||||
|
||||
OffsetOfExpr(ASTContext &C, QualType type,
|
||||
|
||||
OffsetOfExpr(ASTContext &C, QualType type,
|
||||
SourceLocation OperatorLoc, TypeSourceInfo *tsi,
|
||||
OffsetOfNode* compsPtr, unsigned numComps,
|
||||
OffsetOfNode* compsPtr, unsigned numComps,
|
||||
Expr** exprsPtr, unsigned numExprs,
|
||||
SourceLocation RParenLoc);
|
||||
|
||||
explicit OffsetOfExpr(unsigned numComps, unsigned numExprs)
|
||||
: Expr(OffsetOfExprClass, EmptyShell()),
|
||||
TSInfo(0), NumComps(numComps), NumExprs(numExprs) {}
|
||||
TSInfo(0), NumComps(numComps), NumExprs(numExprs) {}
|
||||
|
||||
public:
|
||||
|
||||
static OffsetOfExpr *Create(ASTContext &C, QualType type,
|
||||
SourceLocation OperatorLoc, TypeSourceInfo *tsi,
|
||||
OffsetOfNode* compsPtr, unsigned numComps,
|
||||
|
||||
static OffsetOfExpr *Create(ASTContext &C, QualType type,
|
||||
SourceLocation OperatorLoc, TypeSourceInfo *tsi,
|
||||
OffsetOfNode* compsPtr, unsigned numComps,
|
||||
Expr** exprsPtr, unsigned numExprs,
|
||||
SourceLocation RParenLoc);
|
||||
|
||||
static OffsetOfExpr *CreateEmpty(ASTContext &C,
|
||||
static OffsetOfExpr *CreateEmpty(ASTContext &C,
|
||||
unsigned NumComps, unsigned NumExprs);
|
||||
|
||||
/// getOperatorLoc - Return the location of the operator.
|
||||
|
@ -1149,14 +1149,14 @@ public:
|
|||
/// \brief Return the location of the right parentheses.
|
||||
SourceLocation getRParenLoc() const { return RParenLoc; }
|
||||
void setRParenLoc(SourceLocation R) { RParenLoc = R; }
|
||||
|
||||
|
||||
TypeSourceInfo *getTypeSourceInfo() const {
|
||||
return TSInfo;
|
||||
}
|
||||
void setTypeSourceInfo(TypeSourceInfo *tsi) {
|
||||
TSInfo = tsi;
|
||||
}
|
||||
|
||||
|
||||
const OffsetOfNode &getComponent(unsigned Idx) {
|
||||
assert(Idx < NumComps && "Subscript out of range");
|
||||
return reinterpret_cast<OffsetOfNode *> (this + 1)[Idx];
|
||||
|
@ -1166,7 +1166,7 @@ public:
|
|||
assert(Idx < NumComps && "Subscript out of range");
|
||||
reinterpret_cast<OffsetOfNode *> (this + 1)[Idx] = ON;
|
||||
}
|
||||
|
||||
|
||||
unsigned getNumComponents() const {
|
||||
return NumComps;
|
||||
}
|
||||
|
@ -1182,7 +1182,7 @@ public:
|
|||
reinterpret_cast<Expr **>(
|
||||
reinterpret_cast<OffsetOfNode *>(this+1) + NumComps)[Idx] = E;
|
||||
}
|
||||
|
||||
|
||||
unsigned getNumExpressions() const {
|
||||
return NumExprs;
|
||||
}
|
||||
|
@ -1468,13 +1468,10 @@ public:
|
|||
}
|
||||
|
||||
static bool classof(const Stmt *T) {
|
||||
return T->getStmtClass() == CallExprClass ||
|
||||
T->getStmtClass() == CXXOperatorCallExprClass ||
|
||||
T->getStmtClass() == CXXMemberCallExprClass;
|
||||
return T->getStmtClass() >= firstCallExprConstant &&
|
||||
T->getStmtClass() <= lastCallExprConstant;
|
||||
}
|
||||
static bool classof(const CallExpr *) { return true; }
|
||||
static bool classof(const CXXOperatorCallExpr *) { return true; }
|
||||
static bool classof(const CXXMemberCallExpr *) { return true; }
|
||||
|
||||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
|
@ -1621,7 +1618,7 @@ public:
|
|||
if (hasExplicitTemplateArgumentList())
|
||||
getExplicitTemplateArgumentList()->copyInto(List);
|
||||
}
|
||||
|
||||
|
||||
/// \brief Retrieve the location of the left angle bracket following the
|
||||
/// member name ('<'), if any.
|
||||
SourceLocation getLAngleLoc() const {
|
||||
|
@ -1800,47 +1797,47 @@ public:
|
|||
/// CK_DerivedToBaseMemberPointer - Member pointer in derived class to
|
||||
/// member pointer in base class.
|
||||
CK_DerivedToBaseMemberPointer,
|
||||
|
||||
|
||||
/// CK_UserDefinedConversion - Conversion using a user defined type
|
||||
/// conversion function.
|
||||
CK_UserDefinedConversion,
|
||||
|
||||
/// CK_ConstructorConversion - Conversion by constructor
|
||||
CK_ConstructorConversion,
|
||||
|
||||
|
||||
/// CK_IntegralToPointer - Integral to pointer
|
||||
CK_IntegralToPointer,
|
||||
|
||||
|
||||
/// CK_PointerToIntegral - Pointer to integral
|
||||
CK_PointerToIntegral,
|
||||
|
||||
|
||||
/// CK_ToVoid - Cast to void.
|
||||
CK_ToVoid,
|
||||
|
||||
|
||||
/// CK_VectorSplat - Casting from an integer/floating type to an extended
|
||||
/// vector type with the same element type as the src type. Splats the
|
||||
/// vector type with the same element type as the src type. Splats the
|
||||
/// src expression into the destination expression.
|
||||
CK_VectorSplat,
|
||||
|
||||
|
||||
/// CK_IntegralCast - Casting between integral types of different size.
|
||||
CK_IntegralCast,
|
||||
|
||||
/// CK_IntegralToFloating - Integral to floating point.
|
||||
CK_IntegralToFloating,
|
||||
|
||||
|
||||
/// CK_FloatingToIntegral - Floating point to integral.
|
||||
CK_FloatingToIntegral,
|
||||
|
||||
|
||||
/// CK_FloatingCast - Casting between floating types of different size.
|
||||
CK_FloatingCast,
|
||||
|
||||
|
||||
/// CK_MemberPointerToBoolean - Member pointer to boolean
|
||||
CK_MemberPointerToBoolean,
|
||||
|
||||
/// CK_AnyPointerToObjCPointerCast - Casting any pointer to objective-c
|
||||
/// CK_AnyPointerToObjCPointerCast - Casting any pointer to objective-c
|
||||
/// pointer
|
||||
CK_AnyPointerToObjCPointerCast,
|
||||
/// CK_AnyPointerToBlockPointerCast - Casting any pointer to block
|
||||
/// CK_AnyPointerToBlockPointerCast - Casting any pointer to block
|
||||
/// pointer
|
||||
CK_AnyPointerToBlockPointerCast
|
||||
|
||||
|
@ -1933,14 +1930,8 @@ public:
|
|||
const CXXBaseSpecifierArray& getBasePath() const { return BasePath; }
|
||||
|
||||
static bool classof(const Stmt *T) {
|
||||
StmtClass SC = T->getStmtClass();
|
||||
if (SC >= CXXStaticCastExprClass && SC <= CXXFunctionalCastExprClass)
|
||||
return true;
|
||||
|
||||
if (SC >= ImplicitCastExprClass && SC <= CStyleCastExprClass)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
return T->getStmtClass() >= firstCastExprConstant &&
|
||||
T->getStmtClass() <= lastCastExprConstant;
|
||||
}
|
||||
static bool classof(const CastExpr *) { return true; }
|
||||
|
||||
|
@ -1970,9 +1961,9 @@ class ImplicitCastExpr : public CastExpr {
|
|||
bool LvalueCast;
|
||||
|
||||
public:
|
||||
ImplicitCastExpr(QualType ty, CastKind kind, Expr *op,
|
||||
ImplicitCastExpr(QualType ty, CastKind kind, Expr *op,
|
||||
CXXBaseSpecifierArray BasePath, bool Lvalue)
|
||||
: CastExpr(ImplicitCastExprClass, ty, kind, op, BasePath),
|
||||
: CastExpr(ImplicitCastExprClass, ty, kind, op, BasePath),
|
||||
LvalueCast(Lvalue) { }
|
||||
|
||||
/// \brief Construct an empty implicit cast.
|
||||
|
@ -2037,13 +2028,8 @@ public:
|
|||
QualType getTypeAsWritten() const { return TInfo->getType(); }
|
||||
|
||||
static bool classof(const Stmt *T) {
|
||||
StmtClass SC = T->getStmtClass();
|
||||
if (SC >= CStyleCastExprClass && SC <= CStyleCastExprClass)
|
||||
return true;
|
||||
if (SC >= CXXStaticCastExprClass && SC <= CXXFunctionalCastExprClass)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
return T->getStmtClass() >= firstExplicitCastExprConstant &&
|
||||
T->getStmtClass() <= lastExplicitCastExprConstant;
|
||||
}
|
||||
static bool classof(const ExplicitCastExpr *) { return true; }
|
||||
};
|
||||
|
@ -2198,8 +2184,8 @@ public:
|
|||
bool isShiftAssignOp() const { return Opc == ShlAssign || Opc == ShrAssign; }
|
||||
|
||||
static bool classof(const Stmt *S) {
|
||||
return S->getStmtClass() == BinaryOperatorClass ||
|
||||
S->getStmtClass() == CompoundAssignOperatorClass;
|
||||
return S->getStmtClass() >= firstBinaryOperatorConstant &&
|
||||
S->getStmtClass() <= lastBinaryOperatorConstant;
|
||||
}
|
||||
static bool classof(const BinaryOperator *) { return true; }
|
||||
|
||||
|
@ -2880,7 +2866,7 @@ protected:
|
|||
virtual void DoDestroy(ASTContext &C);
|
||||
|
||||
void DestroyDesignators(ASTContext &C);
|
||||
|
||||
|
||||
public:
|
||||
/// A field designator, e.g., ".x".
|
||||
struct FieldDesignator {
|
||||
|
@ -3048,7 +3034,7 @@ public:
|
|||
|
||||
Designator *getDesignator(unsigned Idx) { return &designators_begin()[Idx]; }
|
||||
|
||||
void setDesignators(ASTContext &C, const Designator *Desigs,
|
||||
void setDesignators(ASTContext &C, const Designator *Desigs,
|
||||
unsigned NumDesigs);
|
||||
|
||||
Expr *getArrayIndex(const Designator& D);
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
LEVEL = ../../../../..
|
||||
BUILT_SOURCES = StmtNodes.inc
|
||||
|
||||
TABLEGEN_INC_FILES_COMMON = 1
|
||||
|
||||
include $(LEVEL)/Makefile.common
|
||||
|
||||
INPUT_TDS = $(PROJ_SRC_DIR)/StmtNodes.td
|
||||
|
||||
$(ObjDir)/StmtNodes.inc.tmp : StmtNodes.td $(TBLGEN) $(ObjDir)/.dir
|
||||
$(Echo) "Building Clang statement node tables with tblgen"
|
||||
$(Verb) $(TableGen) -gen-clang-stmt-nodes -o $(call SYSPATH, $@) $<
|
||||
|
|
@ -99,11 +99,24 @@ public:
|
|||
NoStmtClass = 0,
|
||||
#define STMT(CLASS, PARENT) CLASS##Class,
|
||||
#define FIRST_STMT(CLASS) firstStmtConstant = CLASS##Class,
|
||||
#define LAST_STMT(CLASS) lastStmtConstant = CLASS##Class,
|
||||
// LAST_STMT will always come last
|
||||
#define LAST_STMT(CLASS) lastStmtConstant = CLASS##Class
|
||||
#define FIRST_EXPR(CLASS) firstExprConstant = CLASS##Class,
|
||||
#define LAST_EXPR(CLASS) lastExprConstant = CLASS##Class
|
||||
#define ABSTRACT_EXPR(CLASS, PARENT)
|
||||
#include "clang/AST/StmtNodes.def"
|
||||
#define LAST_EXPR(CLASS) lastExprConstant = CLASS##Class,
|
||||
#define FIRST_CALLEXPR(CLASS) firstCallExprConstant = CLASS##Class,
|
||||
#define LAST_CALLEXPR(CLASS) lastCallExprConstant = CLASS##Class,
|
||||
#define FIRST_CASTEXPR(CLASS) firstCastExprConstant = CLASS##Class,
|
||||
#define LAST_CASTEXPR(CLASS) lastCastExprConstant = CLASS##Class,
|
||||
#define FIRST_EXPLICITCASTEXPR(CLASS) firstExplicitCastExprConstant = \
|
||||
CLASS##Class,
|
||||
#define LAST_EXPLICITCASTEXPR(CLASS) lastExplicitCastExprConstant = \
|
||||
CLASS##Class,
|
||||
#define FIRST_BINARYOPERATOR(CLASS) firstBinaryOperatorConstant = \
|
||||
CLASS##Class,
|
||||
#define LAST_BINARYOPERATOR(CLASS) lastBinaryOperatorConstant = \
|
||||
CLASS##Class,
|
||||
#define ABSTRACT(STMT)
|
||||
#include "clang/AST/StmtNodes.inc"
|
||||
};
|
||||
private:
|
||||
/// \brief The statement class.
|
||||
|
@ -198,9 +211,9 @@ public:
|
|||
return this;
|
||||
}
|
||||
|
||||
StmtClass getStmtClass() const {
|
||||
StmtClass getStmtClass() const {
|
||||
assert(RefCount >= 1 && "Referencing already-destroyed statement!");
|
||||
return (StmtClass)sClass;
|
||||
return (StmtClass)sClass;
|
||||
}
|
||||
const char *getStmtClassName() const;
|
||||
|
||||
|
@ -620,10 +633,10 @@ class IfStmt : public Stmt {
|
|||
|
||||
/// \brief If non-NULL, the declaration in the "if" statement.
|
||||
VarDecl *Var;
|
||||
|
||||
|
||||
SourceLocation IfLoc;
|
||||
SourceLocation ElseLoc;
|
||||
|
||||
|
||||
public:
|
||||
IfStmt(SourceLocation IL, VarDecl *var, Expr *cond, Stmt *then,
|
||||
SourceLocation EL = SourceLocation(), Stmt *elsev = 0)
|
||||
|
@ -646,7 +659,7 @@ public:
|
|||
/// \endcode
|
||||
VarDecl *getConditionVariable() const { return Var; }
|
||||
void setConditionVariable(VarDecl *V) { Var = V; }
|
||||
|
||||
|
||||
const Expr *getCond() const { return reinterpret_cast<Expr*>(SubExprs[COND]);}
|
||||
void setCond(Expr *E) { SubExprs[COND] = reinterpret_cast<Stmt *>(E); }
|
||||
const Stmt *getThen() const { return SubExprs[THEN]; }
|
||||
|
@ -698,8 +711,8 @@ protected:
|
|||
virtual void DoDestroy(ASTContext &Ctx);
|
||||
|
||||
public:
|
||||
SwitchStmt(VarDecl *Var, Expr *cond)
|
||||
: Stmt(SwitchStmtClass), Var(Var), FirstCase(0)
|
||||
SwitchStmt(VarDecl *Var, Expr *cond)
|
||||
: Stmt(SwitchStmtClass), Var(Var), FirstCase(0)
|
||||
{
|
||||
SubExprs[COND] = reinterpret_cast<Stmt*>(cond);
|
||||
SubExprs[BODY] = NULL;
|
||||
|
@ -772,7 +785,7 @@ class WhileStmt : public Stmt {
|
|||
SourceLocation WhileLoc;
|
||||
public:
|
||||
WhileStmt(VarDecl *Var, Expr *cond, Stmt *body, SourceLocation WL)
|
||||
: Stmt(WhileStmtClass), Var(Var)
|
||||
: Stmt(WhileStmtClass), Var(Var)
|
||||
{
|
||||
SubExprs[COND] = reinterpret_cast<Stmt*>(cond);
|
||||
SubExprs[BODY] = body;
|
||||
|
@ -814,7 +827,7 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
|
||||
protected:
|
||||
virtual void DoDestroy(ASTContext &Ctx);
|
||||
};
|
||||
|
@ -880,10 +893,10 @@ class ForStmt : public Stmt {
|
|||
SourceLocation LParenLoc, RParenLoc;
|
||||
|
||||
public:
|
||||
ForStmt(Stmt *Init, Expr *Cond, VarDecl *condVar, Expr *Inc, Stmt *Body,
|
||||
ForStmt(Stmt *Init, Expr *Cond, VarDecl *condVar, Expr *Inc, Stmt *Body,
|
||||
SourceLocation FL, SourceLocation LP, SourceLocation RP)
|
||||
: Stmt(ForStmtClass), CondVar(condVar), ForLoc(FL), LParenLoc(LP),
|
||||
RParenLoc(RP)
|
||||
: Stmt(ForStmtClass), CondVar(condVar), ForLoc(FL), LParenLoc(LP),
|
||||
RParenLoc(RP)
|
||||
{
|
||||
SubExprs[INIT] = Init;
|
||||
SubExprs[COND] = reinterpret_cast<Stmt*>(Cond);
|
||||
|
@ -895,7 +908,7 @@ public:
|
|||
explicit ForStmt(EmptyShell Empty) : Stmt(ForStmtClass, Empty) { }
|
||||
|
||||
Stmt *getInit() { return SubExprs[INIT]; }
|
||||
|
||||
|
||||
/// \brief Retrieve the variable declared in this "for" statement, if any.
|
||||
///
|
||||
/// In the following example, "y" is the condition variable.
|
||||
|
@ -906,7 +919,7 @@ public:
|
|||
/// \endcode
|
||||
VarDecl *getConditionVariable() const { return CondVar; }
|
||||
void setConditionVariable(VarDecl *V) { CondVar = V; }
|
||||
|
||||
|
||||
Expr *getCond() { return reinterpret_cast<Expr*>(SubExprs[COND]); }
|
||||
Expr *getInc() { return reinterpret_cast<Expr*>(SubExprs[INC]); }
|
||||
Stmt *getBody() { return SubExprs[BODY]; }
|
||||
|
@ -939,7 +952,7 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
|
||||
protected:
|
||||
virtual void DoDestroy(ASTContext &Ctx);
|
||||
};
|
||||
|
@ -1131,16 +1144,16 @@ class AsmStmt : public Stmt {
|
|||
|
||||
protected:
|
||||
virtual void DoDestroy(ASTContext &Ctx);
|
||||
|
||||
|
||||
public:
|
||||
AsmStmt(ASTContext &C, SourceLocation asmloc, bool issimple, bool isvolatile,
|
||||
AsmStmt(ASTContext &C, SourceLocation asmloc, bool issimple, bool isvolatile,
|
||||
bool msasm, unsigned numoutputs, unsigned numinputs,
|
||||
IdentifierInfo **names, StringLiteral **constraints,
|
||||
Expr **exprs, StringLiteral *asmstr, unsigned numclobbers,
|
||||
StringLiteral **clobbers, SourceLocation rparenloc);
|
||||
|
||||
/// \brief Build an empty inline-assembly statement.
|
||||
explicit AsmStmt(EmptyShell Empty) : Stmt(AsmStmtClass, Empty),
|
||||
explicit AsmStmt(EmptyShell Empty) : Stmt(AsmStmtClass, Empty),
|
||||
Names(0), Constraints(0), Exprs(0), Clobbers(0) { }
|
||||
|
||||
SourceLocation getAsmLoc() const { return AsmLoc; }
|
||||
|
@ -1222,7 +1235,7 @@ public:
|
|||
llvm::StringRef getOutputName(unsigned i) const {
|
||||
if (IdentifierInfo *II = getOutputIdentifier(i))
|
||||
return II->getName();
|
||||
|
||||
|
||||
return llvm::StringRef();
|
||||
}
|
||||
|
||||
|
@ -1292,7 +1305,7 @@ public:
|
|||
StringLiteral **Constraints,
|
||||
Stmt **Exprs,
|
||||
unsigned NumOutputs,
|
||||
unsigned NumInputs,
|
||||
unsigned NumInputs,
|
||||
StringLiteral **Clobbers,
|
||||
unsigned NumClobbers);
|
||||
|
||||
|
|
|
@ -1,165 +0,0 @@
|
|||
//===-- StmtNodes.def - Metadata about Stmt AST nodes -----------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file defines the AST Node info database.
|
||||
//
|
||||
//===---------------------------------------------------------------------===//
|
||||
|
||||
#ifndef FIRST_STMT
|
||||
#define FIRST_STMT(CLASS)
|
||||
#define LAST_STMT(CLASS)
|
||||
#endif
|
||||
|
||||
#ifndef FIRST_EXPR
|
||||
#define FIRST_EXPR(CLASS)
|
||||
#define LAST_EXPR(CLASS)
|
||||
#endif
|
||||
|
||||
#ifndef EXPR
|
||||
# define EXPR(Type, Base) STMT(Type, Base)
|
||||
#endif
|
||||
|
||||
#ifndef ABSTRACT_EXPR
|
||||
# define ABSTRACT_EXPR(Type, Base) EXPR(Type, Base)
|
||||
#endif
|
||||
|
||||
// Normal Statements.
|
||||
STMT(NullStmt , Stmt)
|
||||
FIRST_STMT(NullStmt)
|
||||
STMT(CompoundStmt , Stmt)
|
||||
STMT(CaseStmt , SwitchCase)
|
||||
STMT(DefaultStmt , SwitchCase)
|
||||
STMT(LabelStmt , Stmt)
|
||||
STMT(IfStmt , Stmt)
|
||||
STMT(SwitchStmt , Stmt)
|
||||
STMT(WhileStmt , Stmt)
|
||||
STMT(DoStmt , Stmt)
|
||||
STMT(ForStmt , Stmt)
|
||||
STMT(GotoStmt , Stmt)
|
||||
STMT(IndirectGotoStmt, Stmt)
|
||||
STMT(ContinueStmt , Stmt)
|
||||
STMT(BreakStmt , Stmt)
|
||||
STMT(ReturnStmt , Stmt)
|
||||
STMT(DeclStmt , Stmt)
|
||||
STMT(SwitchCase , Stmt)
|
||||
|
||||
// GNU Stmt Extensions
|
||||
STMT(AsmStmt , Stmt)
|
||||
|
||||
// Obj-C statements
|
||||
STMT(ObjCAtTryStmt , Stmt)
|
||||
STMT(ObjCAtCatchStmt , Stmt)
|
||||
STMT(ObjCAtFinallyStmt , Stmt)
|
||||
STMT(ObjCAtThrowStmt , Stmt)
|
||||
STMT(ObjCAtSynchronizedStmt , Stmt)
|
||||
// Obj-C2 statements
|
||||
STMT(ObjCForCollectionStmt, Stmt)
|
||||
|
||||
// C++ statements
|
||||
STMT(CXXCatchStmt, Stmt)
|
||||
STMT(CXXTryStmt , Stmt)
|
||||
|
||||
LAST_STMT(CXXTryStmt)
|
||||
|
||||
// Expressions.
|
||||
ABSTRACT_EXPR(Expr , Stmt)
|
||||
EXPR(PredefinedExpr , Expr)
|
||||
EXPR(DeclRefExpr , Expr)
|
||||
EXPR(IntegerLiteral , Expr)
|
||||
EXPR(FloatingLiteral , Expr)
|
||||
EXPR(ImaginaryLiteral , Expr)
|
||||
EXPR(StringLiteral , Expr)
|
||||
EXPR(CharacterLiteral , Expr)
|
||||
EXPR(ParenExpr , Expr)
|
||||
EXPR(UnaryOperator , Expr)
|
||||
EXPR(OffsetOfExpr , Expr)
|
||||
EXPR(SizeOfAlignOfExpr , Expr)
|
||||
EXPR(ArraySubscriptExpr , Expr)
|
||||
EXPR(CallExpr , Expr)
|
||||
EXPR(MemberExpr , Expr)
|
||||
ABSTRACT_EXPR(CastExpr , Expr)
|
||||
EXPR(BinaryOperator , Expr)
|
||||
EXPR(CompoundAssignOperator, BinaryOperator)
|
||||
EXPR(ConditionalOperator , Expr)
|
||||
EXPR(ImplicitCastExpr , CastExpr)
|
||||
ABSTRACT_EXPR(ExplicitCastExpr, CastExpr)
|
||||
EXPR(CStyleCastExpr , ExplicitCastExpr)
|
||||
EXPR(CompoundLiteralExpr , Expr)
|
||||
EXPR(ExtVectorElementExpr , Expr)
|
||||
EXPR(InitListExpr , Expr)
|
||||
EXPR(DesignatedInitExpr , Expr)
|
||||
EXPR(ImplicitValueInitExpr , Expr)
|
||||
EXPR(ParenListExpr , Expr)
|
||||
EXPR(VAArgExpr , Expr)
|
||||
|
||||
// GNU Extensions.
|
||||
EXPR(AddrLabelExpr , Expr)
|
||||
EXPR(StmtExpr , Expr)
|
||||
EXPR(TypesCompatibleExpr , Expr)
|
||||
EXPR(ChooseExpr , Expr)
|
||||
EXPR(GNUNullExpr , Expr)
|
||||
|
||||
// C++ Expressions.
|
||||
EXPR(CXXOperatorCallExpr , CallExpr)
|
||||
EXPR(CXXMemberCallExpr , CallExpr)
|
||||
ABSTRACT_EXPR(CXXNamedCastExpr , ExplicitCastExpr)
|
||||
EXPR(CXXStaticCastExpr , CXXNamedCastExpr)
|
||||
EXPR(CXXDynamicCastExpr , CXXNamedCastExpr)
|
||||
EXPR(CXXReinterpretCastExpr , CXXNamedCastExpr)
|
||||
EXPR(CXXConstCastExpr , CXXNamedCastExpr)
|
||||
EXPR(CXXFunctionalCastExpr , ExplicitCastExpr)
|
||||
EXPR(CXXTypeidExpr , Expr)
|
||||
EXPR(CXXBoolLiteralExpr , Expr)
|
||||
EXPR(CXXNullPtrLiteralExpr , Expr)
|
||||
EXPR(CXXThisExpr , Expr)
|
||||
EXPR(CXXThrowExpr , Expr)
|
||||
EXPR(CXXDefaultArgExpr , Expr)
|
||||
EXPR(CXXZeroInitValueExpr , Expr)
|
||||
EXPR(CXXNewExpr , Expr)
|
||||
EXPR(CXXDeleteExpr , Expr)
|
||||
EXPR(CXXPseudoDestructorExpr, Expr)
|
||||
EXPR(UnresolvedLookupExpr , Expr)
|
||||
EXPR(UnaryTypeTraitExpr , Expr)
|
||||
EXPR(DependentScopeDeclRefExpr , Expr)
|
||||
EXPR(CXXConstructExpr , Expr)
|
||||
EXPR(CXXBindTemporaryExpr , Expr)
|
||||
EXPR(CXXBindReferenceExpr , Expr)
|
||||
EXPR(CXXExprWithTemporaries , Expr)
|
||||
EXPR(CXXTemporaryObjectExpr , CXXConstructExpr)
|
||||
EXPR(CXXUnresolvedConstructExpr, Expr)
|
||||
EXPR(CXXDependentScopeMemberExpr, Expr)
|
||||
EXPR(UnresolvedMemberExpr , Expr)
|
||||
|
||||
// Obj-C Expressions.
|
||||
EXPR(ObjCStringLiteral , Expr)
|
||||
EXPR(ObjCEncodeExpr , Expr)
|
||||
EXPR(ObjCMessageExpr , Expr)
|
||||
EXPR(ObjCSelectorExpr , Expr)
|
||||
EXPR(ObjCProtocolExpr , Expr)
|
||||
EXPR(ObjCIvarRefExpr , Expr)
|
||||
EXPR(ObjCPropertyRefExpr , Expr)
|
||||
EXPR(ObjCImplicitSetterGetterRefExpr , Expr)
|
||||
EXPR(ObjCSuperExpr , Expr)
|
||||
EXPR(ObjCIsaExpr , Expr)
|
||||
|
||||
// Clang Extensions.
|
||||
EXPR(ShuffleVectorExpr , Expr)
|
||||
EXPR(BlockExpr , Expr)
|
||||
EXPR(BlockDeclRefExpr , Expr)
|
||||
|
||||
FIRST_EXPR(PredefinedExpr)
|
||||
LAST_EXPR(BlockDeclRefExpr)
|
||||
|
||||
#undef ABSTRACT_EXPR
|
||||
#undef EXPR
|
||||
#undef STMT
|
||||
#undef FIRST_STMT
|
||||
#undef LAST_STMT
|
||||
#undef FIRST_EXPR
|
||||
#undef LAST_EXPR
|
|
@ -0,0 +1,127 @@
|
|||
class Stmt<bit abstract = 0> {
|
||||
bit Abstract = abstract;
|
||||
}
|
||||
|
||||
class DStmt<Stmt base, bit abstract = 0> : Stmt<abstract> {
|
||||
Stmt Base = base;
|
||||
}
|
||||
|
||||
// Statements
|
||||
def NullStmt : Stmt;
|
||||
def CompoundStmt : Stmt;
|
||||
def LabelStmt : Stmt;
|
||||
def IfStmt : Stmt;
|
||||
def SwitchStmt : Stmt;
|
||||
def WhileStmt : Stmt;
|
||||
def DoStmt : Stmt;
|
||||
def ForStmt : Stmt;
|
||||
def GotoStmt : Stmt;
|
||||
def IndirectGotoStmt : Stmt;
|
||||
def ContinueStmt : Stmt;
|
||||
def BreakStmt : Stmt;
|
||||
def ReturnStmt : Stmt;
|
||||
def DeclStmt : Stmt;
|
||||
def SwitchCase : Stmt;
|
||||
def CaseStmt : DStmt<SwitchCase>;
|
||||
def DefaultStmt : DStmt<SwitchCase>;
|
||||
|
||||
// GNU Extensions
|
||||
def AsmStmt : Stmt;
|
||||
|
||||
// Obj-C statements
|
||||
def ObjCAtTryStmt : Stmt;
|
||||
def ObjCAtCatchStmt : Stmt;
|
||||
def ObjCAtFinallyStmt : Stmt;
|
||||
def ObjCAtThrowStmt : Stmt;
|
||||
def ObjCAtSynchronizedStmt : Stmt;
|
||||
def ObjCForCollectionStmt : Stmt;
|
||||
|
||||
// C++ statments
|
||||
def CXXCatchStmt : Stmt;
|
||||
def CXXTryStmt : Stmt;
|
||||
|
||||
// Expressions
|
||||
def Expr : Stmt<1>;
|
||||
def PredefinedExpr : DStmt<Expr>;
|
||||
def DeclRefExpr : DStmt<Expr>;
|
||||
def IntegerLiteral : DStmt<Expr>;
|
||||
def FloatingLiteral : DStmt<Expr>;
|
||||
def ImaginaryLiteral : DStmt<Expr>;
|
||||
def StringLiteral : DStmt<Expr>;
|
||||
def CharacterLiteral : DStmt<Expr>;
|
||||
def ParenExpr : DStmt<Expr>;
|
||||
def UnaryOperator : DStmt<Expr>;
|
||||
def OffsetOfExpr : DStmt<Expr>;
|
||||
def SizeOfAlignOfExpr : DStmt<Expr>;
|
||||
def ArraySubscriptExpr : DStmt<Expr>;
|
||||
def CallExpr : DStmt<Expr>;
|
||||
def MemberExpr : DStmt<Expr>;
|
||||
def CastExpr : DStmt<Expr, 1>;
|
||||
def BinaryOperator : DStmt<Expr>;
|
||||
def CompoundAssignOperator : DStmt<BinaryOperator>;
|
||||
def ConditionalOperator : DStmt<Expr>;
|
||||
def ImplicitCastExpr : DStmt<CastExpr>;
|
||||
def ExplicitCastExpr : DStmt<CastExpr, 1>;
|
||||
def CStyleCastExpr : DStmt<ExplicitCastExpr>;
|
||||
def CompoundLiteralExpr : DStmt<Expr>;
|
||||
def ExtVectorElementExpr : DStmt<Expr>;
|
||||
def InitListExpr : DStmt<Expr>;
|
||||
def DesignatedInitExpr : DStmt<Expr>;
|
||||
def ImplicitValueInitExpr : DStmt<Expr>;
|
||||
def ParenListExpr : DStmt<Expr>;
|
||||
def VAArgExpr : DStmt<Expr>;
|
||||
|
||||
// GNU Extensions.
|
||||
def AddrLabelExpr : DStmt<Expr>;
|
||||
def StmtExpr : DStmt<Expr>;
|
||||
def TypesCompatibleExpr : DStmt<Expr>;
|
||||
def ChooseExpr : DStmt<Expr>;
|
||||
def GNUNullExpr : DStmt<Expr>;
|
||||
|
||||
// C++ Expressions.
|
||||
def CXXOperatorCallExpr : DStmt<CallExpr>;
|
||||
def CXXMemberCallExpr : DStmt<CallExpr>;
|
||||
def CXXNamedCastExpr : DStmt<ExplicitCastExpr, 1>;
|
||||
def CXXStaticCastExpr : DStmt<CXXNamedCastExpr>;
|
||||
def CXXDynamicCastExpr : DStmt<CXXNamedCastExpr>;
|
||||
def CXXReinterpretCastExpr : DStmt<CXXNamedCastExpr>;
|
||||
def CXXConstCastExpr : DStmt<CXXNamedCastExpr>;
|
||||
def CXXFunctionalCastExpr : DStmt<ExplicitCastExpr>;
|
||||
def CXXTypeidExpr : DStmt<Expr>;
|
||||
def CXXBoolLiteralExpr : DStmt<Expr>;
|
||||
def CXXNullPtrLiteralExpr : DStmt<Expr>;
|
||||
def CXXThisExpr : DStmt<Expr>;
|
||||
def CXXThrowExpr : DStmt<Expr>;
|
||||
def CXXDefaultArgExpr : DStmt<Expr>;
|
||||
def CXXZeroInitValueExpr : DStmt<Expr>;
|
||||
def CXXNewExpr : DStmt<Expr>;
|
||||
def CXXDeleteExpr : DStmt<Expr>;
|
||||
def CXXPseudoDestructorExpr : DStmt<Expr>;
|
||||
def UnresolvedLookupExpr : DStmt<Expr>;
|
||||
def UnaryTypeTraitExpr : DStmt<Expr>;
|
||||
def DependentScopeDeclRefExpr : DStmt<Expr>;
|
||||
def CXXConstructExpr : DStmt<Expr>;
|
||||
def CXXBindTemporaryExpr : DStmt<Expr>;
|
||||
def CXXBindReferenceExpr : DStmt<Expr>;
|
||||
def CXXExprWithTemporaries : DStmt<Expr>;
|
||||
def CXXTemporaryObjectExpr : DStmt<CXXConstructExpr>;
|
||||
def CXXUnresolvedConstructExpr : DStmt<Expr>;
|
||||
def CXXDependentScopeMemberExpr : DStmt<Expr>;
|
||||
def UnresolvedMemberExpr : DStmt<Expr>;
|
||||
|
||||
// Obj-C Expressions.
|
||||
def ObjCStringLiteral : DStmt<Expr>;
|
||||
def ObjCEncodeExpr : DStmt<Expr>;
|
||||
def ObjCMessageExpr : DStmt<Expr>;
|
||||
def ObjCSelectorExpr : DStmt<Expr>;
|
||||
def ObjCProtocolExpr : DStmt<Expr>;
|
||||
def ObjCIvarRefExpr : DStmt<Expr>;
|
||||
def ObjCPropertyRefExpr : DStmt<Expr>;
|
||||
def ObjCImplicitSetterGetterRefExpr : DStmt<Expr>;
|
||||
def ObjCSuperExpr : DStmt<Expr>;
|
||||
def ObjCIsaExpr : DStmt<Expr>;
|
||||
|
||||
// Clang Extensions.
|
||||
def ShuffleVectorExpr : DStmt<Expr>;
|
||||
def BlockExpr : DStmt<Expr>;
|
||||
def BlockDeclRefExpr : DStmt<Expr>;
|
|
@ -105,10 +105,10 @@ public:
|
|||
// Top switch stmt: dispatch to VisitFooStmt for each FooStmt.
|
||||
switch (S->getStmtClass()) {
|
||||
default: assert(0 && "Unknown stmt kind!");
|
||||
#define ABSTRACT_EXPR(CLASS, PARENT)
|
||||
#define ABSTRACT(STMT)
|
||||
#define STMT(CLASS, PARENT) \
|
||||
case Stmt::CLASS ## Class: DISPATCH(CLASS, CLASS);
|
||||
#include "clang/AST/StmtNodes.def"
|
||||
#include "clang/AST/StmtNodes.inc"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -116,7 +116,7 @@ public:
|
|||
// back on VisitExpr or whatever else is the superclass.
|
||||
#define STMT(CLASS, PARENT) \
|
||||
RetTy Visit ## CLASS(CLASS *S) { DISPATCH(PARENT, PARENT); }
|
||||
#include "clang/AST/StmtNodes.def"
|
||||
#include "clang/AST/StmtNodes.inc"
|
||||
|
||||
// If the implementation doesn't implement binary operator methods, fall back
|
||||
// on VisitBinaryOperator.
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
add_subdirectory(AST)
|
||||
add_subdirectory(Basic)
|
||||
add_subdirectory(Driver)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
LEVEL = ../../../..
|
||||
DIRS := Basic Driver
|
||||
DIRS := AST Basic Driver
|
||||
|
||||
include $(LEVEL)/Makefile.common
|
||||
|
||||
|
|
160
lib/AST/Expr.cpp
160
lib/AST/Expr.cpp
|
@ -34,12 +34,12 @@ using namespace clang;
|
|||
bool Expr::isKnownToHaveBooleanValue() const {
|
||||
// If this value has _Bool type, it is obvious 0/1.
|
||||
if (getType()->isBooleanType()) return true;
|
||||
// If this is a non-scalar-integer type, we don't care enough to try.
|
||||
// If this is a non-scalar-integer type, we don't care enough to try.
|
||||
if (!getType()->isIntegralType()) return false;
|
||||
|
||||
|
||||
if (const ParenExpr *PE = dyn_cast<ParenExpr>(this))
|
||||
return PE->getSubExpr()->isKnownToHaveBooleanValue();
|
||||
|
||||
|
||||
if (const UnaryOperator *UO = dyn_cast<UnaryOperator>(this)) {
|
||||
switch (UO->getOpcode()) {
|
||||
case UnaryOperator::Plus:
|
||||
|
@ -49,10 +49,10 @@ bool Expr::isKnownToHaveBooleanValue() const {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (const CastExpr *CE = dyn_cast<CastExpr>(this))
|
||||
return CE->getSubExpr()->isKnownToHaveBooleanValue();
|
||||
|
||||
|
||||
if (const BinaryOperator *BO = dyn_cast<BinaryOperator>(this)) {
|
||||
switch (BO->getOpcode()) {
|
||||
default: return false;
|
||||
|
@ -65,24 +65,24 @@ bool Expr::isKnownToHaveBooleanValue() const {
|
|||
case BinaryOperator::LAnd: // AND operator.
|
||||
case BinaryOperator::LOr: // Logical OR operator.
|
||||
return true;
|
||||
|
||||
|
||||
case BinaryOperator::And: // Bitwise AND operator.
|
||||
case BinaryOperator::Xor: // Bitwise XOR operator.
|
||||
case BinaryOperator::Or: // Bitwise OR operator.
|
||||
// Handle things like (x==2)|(y==12).
|
||||
return BO->getLHS()->isKnownToHaveBooleanValue() &&
|
||||
BO->getRHS()->isKnownToHaveBooleanValue();
|
||||
|
||||
|
||||
case BinaryOperator::Comma:
|
||||
case BinaryOperator::Assign:
|
||||
return BO->getRHS()->isKnownToHaveBooleanValue();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (const ConditionalOperator *CO = dyn_cast<ConditionalOperator>(this))
|
||||
return CO->getTrueExpr()->isKnownToHaveBooleanValue() &&
|
||||
CO->getFalseExpr()->isKnownToHaveBooleanValue();
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -118,13 +118,13 @@ std::size_t ExplicitTemplateArgumentList::sizeFor(
|
|||
void DeclRefExpr::computeDependence() {
|
||||
TypeDependent = false;
|
||||
ValueDependent = false;
|
||||
|
||||
|
||||
NamedDecl *D = getDecl();
|
||||
|
||||
// (TD) C++ [temp.dep.expr]p3:
|
||||
// An id-expression is type-dependent if it contains:
|
||||
//
|
||||
// and
|
||||
// and
|
||||
//
|
||||
// (VD) C++ [temp.dep.constexpr]p2:
|
||||
// An identifier is value-dependent if it is:
|
||||
|
@ -136,16 +136,16 @@ void DeclRefExpr::computeDependence() {
|
|||
ValueDependent = true;
|
||||
}
|
||||
// (TD) - a conversion-function-id that specifies a dependent type
|
||||
else if (D->getDeclName().getNameKind()
|
||||
else if (D->getDeclName().getNameKind()
|
||||
== DeclarationName::CXXConversionFunctionName &&
|
||||
D->getDeclName().getCXXNameType()->isDependentType()) {
|
||||
TypeDependent = true;
|
||||
ValueDependent = true;
|
||||
}
|
||||
// (TD) - a template-id that is dependent,
|
||||
else if (hasExplicitTemplateArgumentList() &&
|
||||
else if (hasExplicitTemplateArgumentList() &&
|
||||
TemplateSpecializationType::anyDependentTemplateArguments(
|
||||
getTemplateArgs(),
|
||||
getTemplateArgs(),
|
||||
getNumTemplateArgs())) {
|
||||
TypeDependent = true;
|
||||
ValueDependent = true;
|
||||
|
@ -168,7 +168,7 @@ void DeclRefExpr::computeDependence() {
|
|||
// (handled by DependentScopeDeclRefExpr)
|
||||
}
|
||||
|
||||
DeclRefExpr::DeclRefExpr(NestedNameSpecifier *Qualifier,
|
||||
DeclRefExpr::DeclRefExpr(NestedNameSpecifier *Qualifier,
|
||||
SourceRange QualifierRange,
|
||||
ValueDecl *D, SourceLocation NameLoc,
|
||||
const TemplateArgumentListInfo *TemplateArgs,
|
||||
|
@ -183,7 +183,7 @@ DeclRefExpr::DeclRefExpr(NestedNameSpecifier *Qualifier,
|
|||
NQ->NNS = Qualifier;
|
||||
NQ->Range = QualifierRange;
|
||||
}
|
||||
|
||||
|
||||
if (TemplateArgs)
|
||||
getExplicitTemplateArgumentList()->initializeFrom(*TemplateArgs);
|
||||
|
||||
|
@ -200,10 +200,10 @@ DeclRefExpr *DeclRefExpr::Create(ASTContext &Context,
|
|||
std::size_t Size = sizeof(DeclRefExpr);
|
||||
if (Qualifier != 0)
|
||||
Size += sizeof(NameQualifier);
|
||||
|
||||
|
||||
if (TemplateArgs)
|
||||
Size += ExplicitTemplateArgumentList::sizeFor(*TemplateArgs);
|
||||
|
||||
|
||||
void *Mem = Context.Allocate(Size, llvm::alignof<DeclRefExpr>());
|
||||
return new (Mem) DeclRefExpr(Qualifier, QualifierRange, D, NameLoc,
|
||||
TemplateArgs, T);
|
||||
|
@ -212,7 +212,7 @@ DeclRefExpr *DeclRefExpr::Create(ASTContext &Context,
|
|||
SourceRange DeclRefExpr::getSourceRange() const {
|
||||
// FIXME: Does not handle multi-token names well, e.g., operator[].
|
||||
SourceRange R(Loc);
|
||||
|
||||
|
||||
if (hasQualifier())
|
||||
R.setBegin(getQualifierRange().getBegin());
|
||||
if (hasExplicitTemplateArgumentList())
|
||||
|
@ -549,14 +549,14 @@ QualType CallExpr::getCallReturnType() const {
|
|||
return FnType->getResultType();
|
||||
}
|
||||
|
||||
OffsetOfExpr *OffsetOfExpr::Create(ASTContext &C, QualType type,
|
||||
OffsetOfExpr *OffsetOfExpr::Create(ASTContext &C, QualType type,
|
||||
SourceLocation OperatorLoc,
|
||||
TypeSourceInfo *tsi,
|
||||
OffsetOfNode* compsPtr, unsigned numComps,
|
||||
TypeSourceInfo *tsi,
|
||||
OffsetOfNode* compsPtr, unsigned numComps,
|
||||
Expr** exprsPtr, unsigned numExprs,
|
||||
SourceLocation RParenLoc) {
|
||||
void *Mem = C.Allocate(sizeof(OffsetOfExpr) +
|
||||
sizeof(OffsetOfNode) * numComps +
|
||||
sizeof(OffsetOfNode) * numComps +
|
||||
sizeof(Expr*) * numExprs);
|
||||
|
||||
return new (Mem) OffsetOfExpr(C, type, OperatorLoc, tsi, compsPtr, numComps,
|
||||
|
@ -571,22 +571,22 @@ OffsetOfExpr *OffsetOfExpr::CreateEmpty(ASTContext &C,
|
|||
return new (Mem) OffsetOfExpr(numComps, numExprs);
|
||||
}
|
||||
|
||||
OffsetOfExpr::OffsetOfExpr(ASTContext &C, QualType type,
|
||||
OffsetOfExpr::OffsetOfExpr(ASTContext &C, QualType type,
|
||||
SourceLocation OperatorLoc, TypeSourceInfo *tsi,
|
||||
OffsetOfNode* compsPtr, unsigned numComps,
|
||||
OffsetOfNode* compsPtr, unsigned numComps,
|
||||
Expr** exprsPtr, unsigned numExprs,
|
||||
SourceLocation RParenLoc)
|
||||
: Expr(OffsetOfExprClass, type, /*TypeDependent=*/false,
|
||||
: Expr(OffsetOfExprClass, type, /*TypeDependent=*/false,
|
||||
/*ValueDependent=*/tsi->getType()->isDependentType() ||
|
||||
hasAnyTypeDependentArguments(exprsPtr, numExprs) ||
|
||||
hasAnyValueDependentArguments(exprsPtr, numExprs)),
|
||||
OperatorLoc(OperatorLoc), RParenLoc(RParenLoc), TSInfo(tsi),
|
||||
NumComps(numComps), NumExprs(numExprs)
|
||||
OperatorLoc(OperatorLoc), RParenLoc(RParenLoc), TSInfo(tsi),
|
||||
NumComps(numComps), NumExprs(numExprs)
|
||||
{
|
||||
for(unsigned i = 0; i < numComps; ++i) {
|
||||
setComponent(i, compsPtr[i]);
|
||||
}
|
||||
|
||||
|
||||
for(unsigned i = 0; i < numExprs; ++i) {
|
||||
setIndexExpr(i, exprsPtr[i]);
|
||||
}
|
||||
|
@ -596,7 +596,7 @@ IdentifierInfo *OffsetOfExpr::OffsetOfNode::getFieldName() const {
|
|||
assert(getKind() == Field || getKind() == Identifier);
|
||||
if (getKind() == Field)
|
||||
return getField()->getIdentifier();
|
||||
|
||||
|
||||
return reinterpret_cast<IdentifierInfo *> (Data & ~(uintptr_t)Mask);
|
||||
}
|
||||
|
||||
|
@ -714,22 +714,22 @@ Expr *CastExpr::getSubExprAsWritten() {
|
|||
CastExpr *E = this;
|
||||
do {
|
||||
SubExpr = E->getSubExpr();
|
||||
|
||||
|
||||
// Skip any temporary bindings; they're implicit.
|
||||
if (CXXBindTemporaryExpr *Binder = dyn_cast<CXXBindTemporaryExpr>(SubExpr))
|
||||
SubExpr = Binder->getSubExpr();
|
||||
|
||||
|
||||
// Conversions by constructor and conversion functions have a
|
||||
// subexpression describing the call; strip it off.
|
||||
if (E->getCastKind() == CastExpr::CK_ConstructorConversion)
|
||||
SubExpr = cast<CXXConstructExpr>(SubExpr)->getArg(0);
|
||||
else if (E->getCastKind() == CastExpr::CK_UserDefinedConversion)
|
||||
SubExpr = cast<CXXMemberCallExpr>(SubExpr)->getImplicitObjectArgument();
|
||||
|
||||
|
||||
// If the subexpression we're left with is an implicit cast, look
|
||||
// through that, too.
|
||||
} while ((E = dyn_cast<ImplicitCastExpr>(SubExpr)));
|
||||
|
||||
} while ((E = dyn_cast<ImplicitCastExpr>(SubExpr)));
|
||||
|
||||
return SubExpr;
|
||||
}
|
||||
|
||||
|
@ -842,15 +842,15 @@ InitListExpr::InitListExpr(ASTContext &C, SourceLocation lbraceloc,
|
|||
: Expr(InitListExprClass, QualType(), false, false),
|
||||
InitExprs(C, numInits),
|
||||
LBraceLoc(lbraceloc), RBraceLoc(rbraceloc), SyntacticForm(0),
|
||||
UnionFieldInit(0), HadArrayRangeDesignator(false)
|
||||
{
|
||||
UnionFieldInit(0), HadArrayRangeDesignator(false)
|
||||
{
|
||||
for (unsigned I = 0; I != numInits; ++I) {
|
||||
if (initExprs[I]->isTypeDependent())
|
||||
TypeDependent = true;
|
||||
if (initExprs[I]->isValueDependent())
|
||||
ValueDependent = true;
|
||||
}
|
||||
|
||||
|
||||
InitExprs.insert(C, InitExprs.end(), initExprs, initExprs+numInits);
|
||||
}
|
||||
|
||||
|
@ -1091,7 +1091,7 @@ bool Expr::isUnusedResultAWarning(SourceLocation &Loc, SourceRange &R1,
|
|||
if (getType()->isVoidType())
|
||||
return false;
|
||||
const CastExpr *CE = cast<CastExpr>(this);
|
||||
|
||||
|
||||
// If this is a cast to void or a constructor conversion, check the operand.
|
||||
// Otherwise, the result of the cast is unused.
|
||||
if (CE->getCastKind() == CastExpr::CK_ToVoid ||
|
||||
|
@ -1234,7 +1234,7 @@ Expr::isLvalueResult Expr::isLvalueInternal(ASTContext &Ctx) const {
|
|||
// Not an lvalue.
|
||||
return LV_InvalidExpression;
|
||||
}
|
||||
|
||||
|
||||
// C99 6.5.2.3p4
|
||||
if (m->isArrow())
|
||||
return LV_Valid;
|
||||
|
@ -1242,8 +1242,8 @@ Expr::isLvalueResult Expr::isLvalueInternal(ASTContext &Ctx) const {
|
|||
if (BaseExp->getStmtClass() == ObjCPropertyRefExprClass ||
|
||||
BaseExp->getStmtClass() == ObjCImplicitSetterGetterRefExprClass)
|
||||
return LV_SubObjCPropertySetting;
|
||||
return
|
||||
BaseExp->isLvalue(Ctx);
|
||||
return
|
||||
BaseExp->isLvalue(Ctx);
|
||||
}
|
||||
case UnaryOperatorClass:
|
||||
if (cast<UnaryOperator>(this)->getOpcode() == UnaryOperator::Deref)
|
||||
|
@ -1280,13 +1280,13 @@ Expr::isLvalueResult Expr::isLvalueInternal(ASTContext &Ctx) const {
|
|||
return BinOp->getRHS()->isLvalue(Ctx);
|
||||
|
||||
// C++ [expr.mptr.oper]p6
|
||||
// The result of a .* expression is an lvalue only if its first operand is
|
||||
// an lvalue and its second operand is a pointer to data member.
|
||||
// The result of a .* expression is an lvalue only if its first operand is
|
||||
// an lvalue and its second operand is a pointer to data member.
|
||||
if (BinOp->getOpcode() == BinaryOperator::PtrMemD &&
|
||||
!BinOp->getType()->isFunctionType())
|
||||
return BinOp->getLHS()->isLvalue(Ctx);
|
||||
|
||||
// The result of an ->* expression is an lvalue only if its second operand
|
||||
// The result of an ->* expression is an lvalue only if its second operand
|
||||
// is a pointer to data member.
|
||||
if (BinOp->getOpcode() == BinaryOperator::PtrMemI &&
|
||||
!BinOp->getType()->isFunctionType()) {
|
||||
|
@ -1294,7 +1294,7 @@ Expr::isLvalueResult Expr::isLvalueInternal(ASTContext &Ctx) const {
|
|||
if (Ty->isMemberPointerType() && !Ty->isMemberFunctionPointerType())
|
||||
return LV_Valid;
|
||||
}
|
||||
|
||||
|
||||
if (!BinOp->isAssignmentOp())
|
||||
return LV_InvalidExpression;
|
||||
|
||||
|
@ -1365,7 +1365,7 @@ Expr::isLvalueResult Expr::isLvalueInternal(ASTContext &Ctx) const {
|
|||
|
||||
// If this is a conversion to a class temporary, make a note of
|
||||
// that.
|
||||
if (Ctx.getLangOptions().CPlusPlus &&
|
||||
if (Ctx.getLangOptions().CPlusPlus &&
|
||||
cast<ExplicitCastExpr>(this)->getTypeAsWritten()->isRecordType())
|
||||
return LV_ClassTemporary;
|
||||
|
||||
|
@ -1594,7 +1594,7 @@ bool Expr::isDefaultArgument() const {
|
|||
const Expr *E = this;
|
||||
while (const ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(E))
|
||||
E = ICE->getSubExprAsWritten();
|
||||
|
||||
|
||||
return isa<CXXDefaultArgExpr>(E);
|
||||
}
|
||||
|
||||
|
@ -1617,7 +1617,7 @@ static const Expr *skipTemporaryBindingsAndNoOpCasts(const Expr *E) {
|
|||
else
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return E;
|
||||
}
|
||||
|
||||
|
@ -1745,13 +1745,13 @@ bool Expr::isConstantInitializer(ASTContext &Ctx) const {
|
|||
// cast-to-union extension.
|
||||
if (getType()->isRecordType())
|
||||
return cast<CastExpr>(this)->getSubExpr()->isConstantInitializer(Ctx);
|
||||
|
||||
|
||||
// Integer->integer casts can be handled here, which is important for
|
||||
// things like (int)(&&x-&&y). Scary but true.
|
||||
if (getType()->isIntegerType() &&
|
||||
cast<CastExpr>(this)->getSubExpr()->getType()->isIntegerType())
|
||||
return cast<CastExpr>(this)->getSubExpr()->isConstantInitializer(Ctx);
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
return isEvaluatable(Ctx);
|
||||
|
@ -1810,7 +1810,7 @@ static ICEDiag CheckICE(const Expr* E, ASTContext &Ctx) {
|
|||
switch (E->getStmtClass()) {
|
||||
#define STMT(Node, Base) case Expr::Node##Class:
|
||||
#define EXPR(Node, Base)
|
||||
#include "clang/AST/StmtNodes.def"
|
||||
#include "clang/AST/StmtNodes.inc"
|
||||
case Expr::PredefinedExprClass:
|
||||
case Expr::FloatingLiteralClass:
|
||||
case Expr::ImaginaryLiteralClass:
|
||||
|
@ -1902,7 +1902,7 @@ static ICEDiag CheckICE(const Expr* E, ASTContext &Ctx) {
|
|||
Qualifiers Quals = Ctx.getCanonicalType(Dcl->getType()).getQualifiers();
|
||||
if (Quals.hasVolatile() || !Quals.hasConst())
|
||||
return ICEDiag(2, cast<DeclRefExpr>(E)->getLocation());
|
||||
|
||||
|
||||
// Look for a declaration of this variable that has an initializer.
|
||||
const VarDecl *ID = 0;
|
||||
const Expr *Init = Dcl->getAnyInitializer(ID);
|
||||
|
@ -2146,10 +2146,10 @@ bool Expr::isNullPointerConstant(ASTContext &Ctx,
|
|||
case NPC_NeverValueDependent:
|
||||
assert(false && "Unexpected value dependent expression!");
|
||||
// If the unthinkable happens, fall through to the safest alternative.
|
||||
|
||||
|
||||
case NPC_ValueDependentIsNull:
|
||||
return isTypeDependent() || getType()->isIntegralType();
|
||||
|
||||
|
||||
case NPC_ValueDependentIsNotNull:
|
||||
return false;
|
||||
}
|
||||
|
@ -2188,7 +2188,7 @@ bool Expr::isNullPointerConstant(ASTContext &Ctx,
|
|||
return true;
|
||||
|
||||
// This expression must be an integer type.
|
||||
if (!getType()->isIntegerType() ||
|
||||
if (!getType()->isIntegerType() ||
|
||||
(Ctx.getLangOptions().CPlusPlus && getType()->isEnumeralType()))
|
||||
return false;
|
||||
|
||||
|
@ -2222,14 +2222,14 @@ FieldDecl *Expr::getBitField() {
|
|||
|
||||
bool Expr::refersToVectorElement() const {
|
||||
const Expr *E = this->IgnoreParens();
|
||||
|
||||
|
||||
while (const ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(E)) {
|
||||
if (ICE->isLvalueCast() && ICE->getCastKind() == CastExpr::CK_NoOp)
|
||||
E = ICE->getSubExpr()->IgnoreParens();
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (const ArraySubscriptExpr *ASE = dyn_cast<ArraySubscriptExpr>(E))
|
||||
return ASE->getBase()->getType()->isVectorType();
|
||||
|
||||
|
@ -2307,7 +2307,7 @@ ObjCMessageExpr::ObjCMessageExpr(QualType T,
|
|||
SourceLocation SuperLoc,
|
||||
bool IsInstanceSuper,
|
||||
QualType SuperType,
|
||||
Selector Sel,
|
||||
Selector Sel,
|
||||
ObjCMethodDecl *Method,
|
||||
Expr **Args, unsigned NumArgs,
|
||||
SourceLocation RBracLoc)
|
||||
|
@ -2317,7 +2317,7 @@ ObjCMessageExpr::ObjCMessageExpr(QualType T,
|
|||
HasMethod(Method != 0), SuperLoc(SuperLoc),
|
||||
SelectorOrMethod(reinterpret_cast<uintptr_t>(Method? Method
|
||||
: Sel.getAsOpaquePtr())),
|
||||
LBracLoc(LBracLoc), RBracLoc(RBracLoc)
|
||||
LBracLoc(LBracLoc), RBracLoc(RBracLoc)
|
||||
{
|
||||
setReceiverPointer(SuperType.getAsOpaquePtr());
|
||||
if (NumArgs)
|
||||
|
@ -2327,17 +2327,17 @@ ObjCMessageExpr::ObjCMessageExpr(QualType T,
|
|||
ObjCMessageExpr::ObjCMessageExpr(QualType T,
|
||||
SourceLocation LBracLoc,
|
||||
TypeSourceInfo *Receiver,
|
||||
Selector Sel,
|
||||
Selector Sel,
|
||||
ObjCMethodDecl *Method,
|
||||
Expr **Args, unsigned NumArgs,
|
||||
SourceLocation RBracLoc)
|
||||
: Expr(ObjCMessageExprClass, T, T->isDependentType(),
|
||||
(T->isDependentType() ||
|
||||
(T->isDependentType() ||
|
||||
hasAnyValueDependentArguments(Args, NumArgs))),
|
||||
NumArgs(NumArgs), Kind(Class), HasMethod(Method != 0),
|
||||
SelectorOrMethod(reinterpret_cast<uintptr_t>(Method? Method
|
||||
: Sel.getAsOpaquePtr())),
|
||||
LBracLoc(LBracLoc), RBracLoc(RBracLoc)
|
||||
LBracLoc(LBracLoc), RBracLoc(RBracLoc)
|
||||
{
|
||||
setReceiverPointer(Receiver);
|
||||
if (NumArgs)
|
||||
|
@ -2347,17 +2347,17 @@ ObjCMessageExpr::ObjCMessageExpr(QualType T,
|
|||
ObjCMessageExpr::ObjCMessageExpr(QualType T,
|
||||
SourceLocation LBracLoc,
|
||||
Expr *Receiver,
|
||||
Selector Sel,
|
||||
Selector Sel,
|
||||
ObjCMethodDecl *Method,
|
||||
Expr **Args, unsigned NumArgs,
|
||||
SourceLocation RBracLoc)
|
||||
: Expr(ObjCMessageExprClass, T, Receiver->isTypeDependent(),
|
||||
(Receiver->isTypeDependent() ||
|
||||
(Receiver->isTypeDependent() ||
|
||||
hasAnyValueDependentArguments(Args, NumArgs))),
|
||||
NumArgs(NumArgs), Kind(Instance), HasMethod(Method != 0),
|
||||
SelectorOrMethod(reinterpret_cast<uintptr_t>(Method? Method
|
||||
: Sel.getAsOpaquePtr())),
|
||||
LBracLoc(LBracLoc), RBracLoc(RBracLoc)
|
||||
LBracLoc(LBracLoc), RBracLoc(RBracLoc)
|
||||
{
|
||||
setReceiverPointer(Receiver);
|
||||
if (NumArgs)
|
||||
|
@ -2369,59 +2369,59 @@ ObjCMessageExpr *ObjCMessageExpr::Create(ASTContext &Context, QualType T,
|
|||
SourceLocation SuperLoc,
|
||||
bool IsInstanceSuper,
|
||||
QualType SuperType,
|
||||
Selector Sel,
|
||||
Selector Sel,
|
||||
ObjCMethodDecl *Method,
|
||||
Expr **Args, unsigned NumArgs,
|
||||
SourceLocation RBracLoc) {
|
||||
unsigned Size = sizeof(ObjCMessageExpr) + sizeof(void *) +
|
||||
unsigned Size = sizeof(ObjCMessageExpr) + sizeof(void *) +
|
||||
NumArgs * sizeof(Expr *);
|
||||
void *Mem = Context.Allocate(Size, llvm::AlignOf<ObjCMessageExpr>::Alignment);
|
||||
return new (Mem) ObjCMessageExpr(T, LBracLoc, SuperLoc, IsInstanceSuper,
|
||||
SuperType, Sel, Method, Args, NumArgs,
|
||||
SuperType, Sel, Method, Args, NumArgs,
|
||||
RBracLoc);
|
||||
}
|
||||
|
||||
ObjCMessageExpr *ObjCMessageExpr::Create(ASTContext &Context, QualType T,
|
||||
SourceLocation LBracLoc,
|
||||
TypeSourceInfo *Receiver,
|
||||
Selector Sel,
|
||||
Selector Sel,
|
||||
ObjCMethodDecl *Method,
|
||||
Expr **Args, unsigned NumArgs,
|
||||
SourceLocation RBracLoc) {
|
||||
unsigned Size = sizeof(ObjCMessageExpr) + sizeof(void *) +
|
||||
unsigned Size = sizeof(ObjCMessageExpr) + sizeof(void *) +
|
||||
NumArgs * sizeof(Expr *);
|
||||
void *Mem = Context.Allocate(Size, llvm::AlignOf<ObjCMessageExpr>::Alignment);
|
||||
return new (Mem) ObjCMessageExpr(T, LBracLoc, Receiver, Sel, Method, Args,
|
||||
return new (Mem) ObjCMessageExpr(T, LBracLoc, Receiver, Sel, Method, Args,
|
||||
NumArgs, RBracLoc);
|
||||
}
|
||||
|
||||
ObjCMessageExpr *ObjCMessageExpr::Create(ASTContext &Context, QualType T,
|
||||
SourceLocation LBracLoc,
|
||||
Expr *Receiver,
|
||||
Selector Sel,
|
||||
Selector Sel,
|
||||
ObjCMethodDecl *Method,
|
||||
Expr **Args, unsigned NumArgs,
|
||||
SourceLocation RBracLoc) {
|
||||
unsigned Size = sizeof(ObjCMessageExpr) + sizeof(void *) +
|
||||
unsigned Size = sizeof(ObjCMessageExpr) + sizeof(void *) +
|
||||
NumArgs * sizeof(Expr *);
|
||||
void *Mem = Context.Allocate(Size, llvm::AlignOf<ObjCMessageExpr>::Alignment);
|
||||
return new (Mem) ObjCMessageExpr(T, LBracLoc, Receiver, Sel, Method, Args,
|
||||
return new (Mem) ObjCMessageExpr(T, LBracLoc, Receiver, Sel, Method, Args,
|
||||
NumArgs, RBracLoc);
|
||||
}
|
||||
|
||||
ObjCMessageExpr *ObjCMessageExpr::CreateEmpty(ASTContext &Context,
|
||||
ObjCMessageExpr *ObjCMessageExpr::CreateEmpty(ASTContext &Context,
|
||||
unsigned NumArgs) {
|
||||
unsigned Size = sizeof(ObjCMessageExpr) + sizeof(void *) +
|
||||
unsigned Size = sizeof(ObjCMessageExpr) + sizeof(void *) +
|
||||
NumArgs * sizeof(Expr *);
|
||||
void *Mem = Context.Allocate(Size, llvm::AlignOf<ObjCMessageExpr>::Alignment);
|
||||
return new (Mem) ObjCMessageExpr(EmptyShell(), NumArgs);
|
||||
}
|
||||
|
||||
|
||||
Selector ObjCMessageExpr::getSelector() const {
|
||||
if (HasMethod)
|
||||
return reinterpret_cast<const ObjCMethodDecl *>(SelectorOrMethod)
|
||||
->getSelector();
|
||||
return Selector(SelectorOrMethod);
|
||||
return Selector(SelectorOrMethod);
|
||||
}
|
||||
|
||||
ObjCInterfaceDecl *ObjCMessageExpr::getReceiverInterface() const {
|
||||
|
@ -2500,7 +2500,7 @@ IdentifierInfo *DesignatedInitExpr::Designator::getFieldName() {
|
|||
return getField()->getIdentifier();
|
||||
}
|
||||
|
||||
DesignatedInitExpr::DesignatedInitExpr(ASTContext &C, QualType Ty,
|
||||
DesignatedInitExpr::DesignatedInitExpr(ASTContext &C, QualType Ty,
|
||||
unsigned NumDesignators,
|
||||
const Designator *Designators,
|
||||
SourceLocation EqualOrColonLoc,
|
||||
|
|
|
@ -27,7 +27,7 @@ static struct StmtClassNameTable {
|
|||
const char *Name;
|
||||
unsigned Counter;
|
||||
unsigned Size;
|
||||
} StmtClassInfo[Stmt::lastExprConstant+1];
|
||||
} StmtClassInfo[Stmt::lastStmtConstant+1];
|
||||
|
||||
static StmtClassNameTable &getStmtInfoTableEntry(Stmt::StmtClass E) {
|
||||
static bool Initialized = false;
|
||||
|
@ -36,11 +36,11 @@ static StmtClassNameTable &getStmtInfoTableEntry(Stmt::StmtClass E) {
|
|||
|
||||
// Intialize the table on the first use.
|
||||
Initialized = true;
|
||||
#define ABSTRACT_EXPR(CLASS, PARENT)
|
||||
#define ABSTRACT(STMT)
|
||||
#define STMT(CLASS, PARENT) \
|
||||
StmtClassInfo[(unsigned)Stmt::CLASS##Class].Name = #CLASS; \
|
||||
StmtClassInfo[(unsigned)Stmt::CLASS##Class].Size = sizeof(CLASS);
|
||||
#include "clang/AST/StmtNodes.def"
|
||||
#include "clang/AST/StmtNodes.inc"
|
||||
|
||||
return StmtClassInfo[E];
|
||||
}
|
||||
|
@ -55,13 +55,13 @@ void Stmt::PrintStats() {
|
|||
|
||||
unsigned sum = 0;
|
||||
fprintf(stderr, "*** Stmt/Expr Stats:\n");
|
||||
for (int i = 0; i != Stmt::lastExprConstant+1; i++) {
|
||||
for (int i = 0; i != Stmt::lastStmtConstant+1; i++) {
|
||||
if (StmtClassInfo[i].Name == 0) continue;
|
||||
sum += StmtClassInfo[i].Counter;
|
||||
}
|
||||
fprintf(stderr, " %d stmts/exprs total.\n", sum);
|
||||
sum = 0;
|
||||
for (int i = 0; i != Stmt::lastExprConstant+1; i++) {
|
||||
for (int i = 0; i != Stmt::lastStmtConstant+1; i++) {
|
||||
if (StmtClassInfo[i].Name == 0) continue;
|
||||
if (StmtClassInfo[i].Counter == 0) continue;
|
||||
fprintf(stderr, " %d %s, %d each (%d bytes)\n",
|
||||
|
@ -164,7 +164,7 @@ void AsmStmt::setOutputsAndInputsAndClobbers(ASTContext &C,
|
|||
StringLiteral **Constraints,
|
||||
Stmt **Exprs,
|
||||
unsigned NumOutputs,
|
||||
unsigned NumInputs,
|
||||
unsigned NumInputs,
|
||||
StringLiteral **Clobbers,
|
||||
unsigned NumClobbers) {
|
||||
this->NumOutputs = NumOutputs;
|
||||
|
@ -172,19 +172,19 @@ void AsmStmt::setOutputsAndInputsAndClobbers(ASTContext &C,
|
|||
this->NumClobbers = NumClobbers;
|
||||
|
||||
unsigned NumExprs = NumOutputs + NumInputs;
|
||||
|
||||
|
||||
C.Deallocate(this->Names);
|
||||
this->Names = new (C) IdentifierInfo*[NumExprs];
|
||||
std::copy(Names, Names + NumExprs, this->Names);
|
||||
|
||||
|
||||
C.Deallocate(this->Exprs);
|
||||
this->Exprs = new (C) Stmt*[NumExprs];
|
||||
std::copy(Exprs, Exprs + NumExprs, this->Exprs);
|
||||
|
||||
|
||||
C.Deallocate(this->Constraints);
|
||||
this->Constraints = new (C) StringLiteral*[NumExprs];
|
||||
std::copy(Constraints, Constraints + NumExprs, this->Constraints);
|
||||
|
||||
|
||||
C.Deallocate(this->Clobbers);
|
||||
this->Clobbers = new (C) StringLiteral*[NumClobbers];
|
||||
std::copy(Clobbers, Clobbers + NumClobbers, this->Clobbers);
|
||||
|
@ -242,7 +242,7 @@ unsigned AsmStmt::AnalyzeAsmString(llvm::SmallVectorImpl<AsmStringPiece>&Pieces,
|
|||
std::string CurStringPiece;
|
||||
|
||||
bool HasVariants = !C.Target.hasNoAsmVariants();
|
||||
|
||||
|
||||
while (1) {
|
||||
// Done with the string?
|
||||
if (CurPtr == StrEnd) {
|
||||
|
@ -263,7 +263,7 @@ unsigned AsmStmt::AnalyzeAsmString(llvm::SmallVectorImpl<AsmStringPiece>&Pieces,
|
|||
CurStringPiece += CurChar;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// Escaped "%" character in asm string.
|
||||
if (CurPtr == StrEnd) {
|
||||
// % at end of string is invalid (no escape).
|
||||
|
@ -356,8 +356,8 @@ QualType CXXCatchStmt::getCaughtType() const {
|
|||
// Constructors
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
AsmStmt::AsmStmt(ASTContext &C, SourceLocation asmloc, bool issimple,
|
||||
bool isvolatile, bool msasm,
|
||||
AsmStmt::AsmStmt(ASTContext &C, SourceLocation asmloc, bool issimple,
|
||||
bool isvolatile, bool msasm,
|
||||
unsigned numoutputs, unsigned numinputs,
|
||||
IdentifierInfo **names, StringLiteral **constraints,
|
||||
Expr **exprs, StringLiteral *asmstr, unsigned numclobbers,
|
||||
|
@ -367,7 +367,7 @@ AsmStmt::AsmStmt(ASTContext &C, SourceLocation asmloc, bool issimple,
|
|||
, NumOutputs(numoutputs), NumInputs(numinputs), NumClobbers(numclobbers) {
|
||||
|
||||
unsigned NumExprs = NumOutputs +NumInputs;
|
||||
|
||||
|
||||
Names = new (C) IdentifierInfo*[NumExprs];
|
||||
std::copy(names, names + NumExprs, Names);
|
||||
|
||||
|
@ -402,31 +402,31 @@ ObjCAtTryStmt::ObjCAtTryStmt(SourceLocation atTryLoc, Stmt *atTryStmt,
|
|||
Stmts[0] = atTryStmt;
|
||||
for (unsigned I = 0; I != NumCatchStmts; ++I)
|
||||
Stmts[I + 1] = CatchStmts[I];
|
||||
|
||||
|
||||
if (HasFinally)
|
||||
Stmts[NumCatchStmts + 1] = atFinallyStmt;
|
||||
}
|
||||
|
||||
ObjCAtTryStmt *ObjCAtTryStmt::Create(ASTContext &Context,
|
||||
SourceLocation atTryLoc,
|
||||
ObjCAtTryStmt *ObjCAtTryStmt::Create(ASTContext &Context,
|
||||
SourceLocation atTryLoc,
|
||||
Stmt *atTryStmt,
|
||||
Stmt **CatchStmts,
|
||||
Stmt **CatchStmts,
|
||||
unsigned NumCatchStmts,
|
||||
Stmt *atFinallyStmt) {
|
||||
unsigned Size = sizeof(ObjCAtTryStmt) +
|
||||
unsigned Size = sizeof(ObjCAtTryStmt) +
|
||||
(1 + NumCatchStmts + (atFinallyStmt != 0)) * sizeof(Stmt *);
|
||||
void *Mem = Context.Allocate(Size, llvm::alignof<ObjCAtTryStmt>());
|
||||
return new (Mem) ObjCAtTryStmt(atTryLoc, atTryStmt, CatchStmts, NumCatchStmts,
|
||||
atFinallyStmt);
|
||||
}
|
||||
|
||||
ObjCAtTryStmt *ObjCAtTryStmt::CreateEmpty(ASTContext &Context,
|
||||
ObjCAtTryStmt *ObjCAtTryStmt::CreateEmpty(ASTContext &Context,
|
||||
unsigned NumCatchStmts,
|
||||
bool HasFinally) {
|
||||
unsigned Size = sizeof(ObjCAtTryStmt) +
|
||||
unsigned Size = sizeof(ObjCAtTryStmt) +
|
||||
(1 + NumCatchStmts + HasFinally) * sizeof(Stmt *);
|
||||
void *Mem = Context.Allocate(Size, llvm::alignof<ObjCAtTryStmt>());
|
||||
return new (Mem) ObjCAtTryStmt(EmptyShell(), NumCatchStmts, HasFinally);
|
||||
return new (Mem) ObjCAtTryStmt(EmptyShell(), NumCatchStmts, HasFinally);
|
||||
}
|
||||
|
||||
SourceRange ObjCAtTryStmt::getSourceRange() const {
|
||||
|
@ -437,12 +437,12 @@ SourceRange ObjCAtTryStmt::getSourceRange() const {
|
|||
EndLoc = getCatchStmt(NumCatchStmts - 1)->getLocEnd();
|
||||
else
|
||||
EndLoc = getTryBody()->getLocEnd();
|
||||
|
||||
|
||||
return SourceRange(AtTryLoc, EndLoc);
|
||||
}
|
||||
|
||||
CXXTryStmt *CXXTryStmt::Create(ASTContext &C, SourceLocation tryLoc,
|
||||
Stmt *tryBlock, Stmt **handlers,
|
||||
Stmt *tryBlock, Stmt **handlers,
|
||||
unsigned numHandlers) {
|
||||
std::size_t Size = sizeof(CXXTryStmt);
|
||||
Size += ((numHandlers + 1) * sizeof(Stmt));
|
||||
|
@ -474,7 +474,7 @@ static void BranchDestroy(ASTContext &C, Stmt *S, Stmt **SubExprs,
|
|||
// the expressions referenced by the condition variable.
|
||||
for (Stmt **I = SubExprs, **E = SubExprs + NumExprs; I != E; ++I)
|
||||
if (Stmt *Child = *I) Child->Destroy(C);
|
||||
|
||||
|
||||
S->~Stmt();
|
||||
C.Deallocate((void *) S);
|
||||
}
|
||||
|
@ -517,7 +517,7 @@ void SwitchStmt::DoDestroy(ASTContext &C) {
|
|||
SC->Destroy(C);
|
||||
SC = Next;
|
||||
}
|
||||
|
||||
|
||||
BranchDestroy(C, this, SubExprs, END_EXPR);
|
||||
}
|
||||
|
||||
|
@ -527,12 +527,12 @@ void WhileStmt::DoDestroy(ASTContext &C) {
|
|||
|
||||
void AsmStmt::DoDestroy(ASTContext &C) {
|
||||
DestroyChildren(C);
|
||||
|
||||
|
||||
C.Deallocate(Names);
|
||||
C.Deallocate(Constraints);
|
||||
C.Deallocate(Exprs);
|
||||
C.Deallocate(Clobbers);
|
||||
|
||||
|
||||
this->~AsmStmt();
|
||||
C.Deallocate((void *)this);
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ namespace {
|
|||
void VisitStmt(Stmt *Node);
|
||||
#define STMT(CLASS, PARENT) \
|
||||
void Visit##CLASS(CLASS *Node);
|
||||
#include "clang/AST/StmtNodes.def"
|
||||
#include "clang/AST/StmtNodes.inc"
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -477,7 +477,7 @@ void StmtPrinter::VisitDeclRefExpr(DeclRefExpr *Node) {
|
|||
OS << TemplateSpecializationType::PrintTemplateArgumentList(
|
||||
Node->getTemplateArgs(),
|
||||
Node->getNumTemplateArgs(),
|
||||
Policy);
|
||||
Policy);
|
||||
}
|
||||
|
||||
void StmtPrinter::VisitDependentScopeDeclRefExpr(
|
||||
|
@ -727,12 +727,12 @@ void StmtPrinter::VisitOffsetOfExpr(OffsetOfExpr *Node) {
|
|||
IdentifierInfo *Id = ON.getFieldName();
|
||||
if (!Id)
|
||||
continue;
|
||||
|
||||
|
||||
if (PrintedSomething)
|
||||
OS << ".";
|
||||
else
|
||||
PrintedSomething = true;
|
||||
OS << Id->getName();
|
||||
OS << Id->getName();
|
||||
}
|
||||
OS << ")";
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace {
|
|||
void VisitStmt(Stmt *S);
|
||||
|
||||
#define STMT(Node, Base) void Visit##Node(Node *S);
|
||||
#include "clang/AST/StmtNodes.def"
|
||||
#include "clang/AST/StmtNodes.inc"
|
||||
|
||||
/// \brief Visit a declaration that is referenced within an expression
|
||||
/// or statement.
|
||||
|
@ -279,13 +279,13 @@ void StmtProfiler::VisitOffsetOfExpr(OffsetOfExpr *S) {
|
|||
case OffsetOfExpr::OffsetOfNode::Identifier:
|
||||
ID.AddPointer(ON.getFieldName());
|
||||
break;
|
||||
|
||||
|
||||
case OffsetOfExpr::OffsetOfNode::Base:
|
||||
// These nodes are implicit, and therefore don't need profiling.
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
VisitExpr(S);
|
||||
}
|
||||
|
||||
|
@ -740,7 +740,7 @@ void StmtProfiler::VisitTemplateArgument(const TemplateArgument &Arg) {
|
|||
case TemplateArgument::Template:
|
||||
VisitTemplateName(Arg.getAsTemplate());
|
||||
break;
|
||||
|
||||
|
||||
case TemplateArgument::Declaration:
|
||||
VisitDecl(Arg.getAsDecl());
|
||||
break;
|
||||
|
|
|
@ -178,7 +178,7 @@ private:
|
|||
|
||||
void mangleTemplateArgs(TemplateName Template,
|
||||
const TemplateArgument *TemplateArgs,
|
||||
unsigned NumTemplateArgs);
|
||||
unsigned NumTemplateArgs);
|
||||
void mangleTemplateArgs(const TemplateParameterList &PL,
|
||||
const TemplateArgument *TemplateArgs,
|
||||
unsigned NumTemplateArgs);
|
||||
|
@ -439,7 +439,7 @@ void CXXNameMangler::mangleUnscopedTemplateName(TemplateName Template) {
|
|||
// ::= <substitution>
|
||||
if (TemplateDecl *TD = Template.getAsTemplateDecl())
|
||||
return mangleUnscopedTemplateName(TD);
|
||||
|
||||
|
||||
if (mangleSubstitution(Template))
|
||||
return;
|
||||
|
||||
|
@ -454,7 +454,7 @@ void CXXNameMangler::mangleUnscopedTemplateName(TemplateName Template) {
|
|||
Diags.Report(FullSourceLoc(), DiagID);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
mangleSourceName(Dependent->getIdentifier());
|
||||
addSubstitution(Template);
|
||||
}
|
||||
|
@ -506,7 +506,7 @@ void CXXNameMangler::mangleUnresolvedScope(NestedNameSpecifier *Qualifier) {
|
|||
dyn_cast<TemplateSpecializationType>(QTy)) {
|
||||
if (!mangleSubstitution(QualType(TST, 0))) {
|
||||
mangleTemplatePrefix(TST->getTemplateName());
|
||||
|
||||
|
||||
// FIXME: GCC does not appear to mangle the template arguments when
|
||||
// the template in question is a dependent template name. Should we
|
||||
// emulate that badness?
|
||||
|
@ -781,14 +781,14 @@ void CXXNameMangler::mangleTemplatePrefix(TemplateName Template) {
|
|||
|
||||
if (QualifiedTemplateName *Qualified = Template.getAsQualifiedTemplateName())
|
||||
mangleUnresolvedScope(Qualified->getQualifier());
|
||||
|
||||
|
||||
if (OverloadedTemplateStorage *Overloaded
|
||||
= Template.getAsOverloadedTemplate()) {
|
||||
mangleUnqualifiedName(0, (*Overloaded->begin())->getDeclName(),
|
||||
mangleUnqualifiedName(0, (*Overloaded->begin())->getDeclName(),
|
||||
UnknownArity);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
DependentTemplateName *Dependent = Template.getAsDependentTemplateName();
|
||||
assert(Dependent && "Unknown template name kind?");
|
||||
mangleUnresolvedScope(Dependent->getQualifier());
|
||||
|
@ -1224,9 +1224,9 @@ void CXXNameMangler::mangleType(const TemplateSpecializationType *T) {
|
|||
} else {
|
||||
if (mangleSubstitution(QualType(T, 0)))
|
||||
return;
|
||||
|
||||
|
||||
mangleTemplatePrefix(T->getTemplateName());
|
||||
|
||||
|
||||
// FIXME: GCC does not appear to mangle the template arguments when
|
||||
// the template in question is a dependent template name. Should we
|
||||
// emulate that badness?
|
||||
|
@ -1245,16 +1245,16 @@ void CXXNameMangler::mangleType(const DependentNameType *T) {
|
|||
const TemplateSpecializationType *TST = T->getTemplateId();
|
||||
if (!mangleSubstitution(QualType(TST, 0))) {
|
||||
mangleTemplatePrefix(TST->getTemplateName());
|
||||
|
||||
|
||||
// FIXME: GCC does not appear to mangle the template arguments when
|
||||
// the template in question is a dependent template name. Should we
|
||||
// emulate that badness?
|
||||
mangleTemplateArgs(TST->getTemplateName(), TST->getArgs(),
|
||||
TST->getNumArgs());
|
||||
TST->getNumArgs());
|
||||
addSubstitution(QualType(TST, 0));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Out << 'E';
|
||||
}
|
||||
|
||||
|
@ -1369,7 +1369,7 @@ void CXXNameMangler::mangleExpression(const Expr *E) {
|
|||
#define EXPR(Type, Base)
|
||||
#define STMT(Type, Base) \
|
||||
case Expr::Type##Class:
|
||||
#include "clang/AST/StmtNodes.def"
|
||||
#include "clang/AST/StmtNodes.inc"
|
||||
llvm_unreachable("unexpected statement kind");
|
||||
break;
|
||||
|
||||
|
@ -1668,7 +1668,7 @@ void CXXNameMangler::mangleTemplateArgs(TemplateName Template,
|
|||
if (TemplateDecl *TD = Template.getAsTemplateDecl())
|
||||
return mangleTemplateArgs(*TD->getTemplateParameters(), TemplateArgs,
|
||||
NumTemplateArgs);
|
||||
|
||||
|
||||
// <template-args> ::= I <template-arg>+ E
|
||||
Out << 'I';
|
||||
for (unsigned i = 0; i != NumTemplateArgs; ++i)
|
||||
|
@ -1791,7 +1791,7 @@ bool CXXNameMangler::mangleSubstitution(QualType T) {
|
|||
bool CXXNameMangler::mangleSubstitution(TemplateName Template) {
|
||||
if (TemplateDecl *TD = Template.getAsTemplateDecl())
|
||||
return mangleSubstitution(TD);
|
||||
|
||||
|
||||
Template = Context.getASTContext().getCanonicalTemplateName(Template);
|
||||
return mangleSubstitution(
|
||||
reinterpret_cast<uintptr_t>(Template.getAsVoidPointer()));
|
||||
|
@ -1978,7 +1978,7 @@ void CXXNameMangler::addSubstitution(QualType T) {
|
|||
void CXXNameMangler::addSubstitution(TemplateName Template) {
|
||||
if (TemplateDecl *TD = Template.getAsTemplateDecl())
|
||||
return addSubstitution(TD);
|
||||
|
||||
|
||||
Template = Context.getASTContext().getCanonicalTemplateName(Template);
|
||||
addSubstitution(reinterpret_cast<uintptr_t>(Template.getAsVoidPointer()));
|
||||
}
|
||||
|
@ -2036,38 +2036,38 @@ void MangleContext::mangleThunk(const CXXMethodDecl *MD,
|
|||
// # base is the nominal target function of thunk
|
||||
// # first call-offset is 'this' adjustment
|
||||
// # second call-offset is result adjustment
|
||||
|
||||
|
||||
assert(!isa<CXXDestructorDecl>(MD) &&
|
||||
"Use mangleCXXDtor for destructor decls!");
|
||||
|
||||
|
||||
CXXNameMangler Mangler(*this, Res);
|
||||
Mangler.getStream() << "_ZT";
|
||||
if (!Thunk.Return.isEmpty())
|
||||
Mangler.getStream() << 'c';
|
||||
|
||||
|
||||
// Mangle the 'this' pointer adjustment.
|
||||
Mangler.mangleCallOffset(Thunk.This.NonVirtual, Thunk.This.VCallOffsetOffset);
|
||||
|
||||
|
||||
// Mangle the return pointer adjustment if there is one.
|
||||
if (!Thunk.Return.isEmpty())
|
||||
Mangler.mangleCallOffset(Thunk.Return.NonVirtual,
|
||||
Thunk.Return.VBaseOffsetOffset);
|
||||
|
||||
|
||||
Mangler.mangleFunctionEncoding(MD);
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
MangleContext::mangleCXXDtorThunk(const CXXDestructorDecl *DD, CXXDtorType Type,
|
||||
const ThisAdjustment &ThisAdjustment,
|
||||
llvm::SmallVectorImpl<char> &Res) {
|
||||
// <special-name> ::= T <call-offset> <base encoding>
|
||||
// # base is the nominal target function of thunk
|
||||
|
||||
|
||||
CXXNameMangler Mangler(*this, Res, DD, Type);
|
||||
Mangler.getStream() << "_ZT";
|
||||
|
||||
// Mangle the 'this' pointer adjustment.
|
||||
Mangler.mangleCallOffset(ThisAdjustment.NonVirtual,
|
||||
Mangler.mangleCallOffset(ThisAdjustment.NonVirtual,
|
||||
ThisAdjustment.VCallOffsetOffset);
|
||||
|
||||
Mangler.mangleFunctionEncoding(DD);
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Загрузка…
Ссылка в новой задаче