summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/TreeTransform.h
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-11-18 06:31:45 +0000
committerJohn McCall <rjmccall@apple.com>2010-11-18 06:31:45 +0000
commit7decc9e4ea6c56ffce14d25f542f5eda3eeba97a (patch)
tree534c07409e36400c14c13c70f78f8aec207b99cc /clang/lib/Sema/TreeTransform.h
parente5a1e8ae12781d504c7541ed0aa97a29360dacd6 (diff)
downloadbcm5719-llvm-7decc9e4ea6c56ffce14d25f542f5eda3eeba97a.tar.gz
bcm5719-llvm-7decc9e4ea6c56ffce14d25f542f5eda3eeba97a.zip
Calculate the value kind of an expression when it's created and
store it on the expression node. Also store an "object kind", which distinguishes ordinary "addressed" l-values (like variable references and pointer dereferences) and bitfield, @property, and vector-component l-values. Currently we're not using these for much, but I aim to switch pretty much everything calculating l-valueness over to them. For now they shouldn't necessarily be trusted. llvm-svn: 119685
Diffstat (limited to 'clang/lib/Sema/TreeTransform.h')
-rw-r--r--clang/lib/Sema/TreeTransform.h54
1 files changed, 32 insertions, 22 deletions
diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h
index bae703daa30..807346c4c57 100644
--- a/clang/lib/Sema/TreeTransform.h
+++ b/clang/lib/Sema/TreeTransform.h
@@ -1142,26 +1142,32 @@ public:
/// By default, performs semantic analysis to build the new expression.
/// Subclasses may override this routine to provide different behavior.
ExprResult RebuildMemberExpr(Expr *Base, SourceLocation OpLoc,
- bool isArrow,
- NestedNameSpecifier *Qualifier,
- SourceRange QualifierRange,
- const DeclarationNameInfo &MemberNameInfo,
- ValueDecl *Member,
- NamedDecl *FoundDecl,
+ bool isArrow,
+ NestedNameSpecifier *Qualifier,
+ SourceRange QualifierRange,
+ const DeclarationNameInfo &MemberNameInfo,
+ ValueDecl *Member,
+ NamedDecl *FoundDecl,
const TemplateArgumentListInfo *ExplicitTemplateArgs,
- NamedDecl *FirstQualifierInScope) {
+ NamedDecl *FirstQualifierInScope) {
if (!Member->getDeclName()) {
- // We have a reference to an unnamed field.
+ // We have a reference to an unnamed field. This is always the
+ // base of an anonymous struct/union member access, i.e. the
+ // field is always of record type.
assert(!Qualifier && "Can't have an unnamed field with a qualifier!");
+ assert(Member->getType()->isRecordType() &&
+ "unnamed member not of record type?");
if (getSema().PerformObjectMemberConversion(Base, Qualifier,
FoundDecl, Member))
return ExprError();
+ ExprValueKind VK = isArrow ? VK_LValue : Base->getValueKind();
MemberExpr *ME =
new (getSema().Context) MemberExpr(Base, isArrow,
Member, MemberNameInfo,
- cast<FieldDecl>(Member)->getType());
+ cast<FieldDecl>(Member)->getType(),
+ VK, OK_Ordinary);
return getSema().Owned(ME);
}
@@ -1903,18 +1909,21 @@ public:
// perform semantic analysis again.
if (Super)
return Owned(
- new (getSema().Context) ObjCImplicitSetterGetterRefExpr(Getter, T,
- Setter,
- NameLoc,
- SuperLoc,
- SuperTy));
+ new (getSema().Context) ObjCImplicitSetterGetterRefExpr(Getter, T,
+ VK_LValue,
+ OK_Ordinary,
+ Setter,
+ NameLoc,
+ SuperLoc,
+ SuperTy));
else
return Owned(
- new (getSema().Context) ObjCImplicitSetterGetterRefExpr(
- Getter, T,
- Setter,
- NameLoc,
- Base));
+ new (getSema().Context) ObjCImplicitSetterGetterRefExpr(Getter, T,
+ VK_LValue,
+ OK_Ordinary,
+ Setter,
+ NameLoc,
+ Base));
}
/// \brief Build a new Objective-C "isa" expression.
@@ -1948,8 +1957,8 @@ public:
/// By default, performs semantic analysis to build the new expression.
/// Subclasses may override this routine to provide different behavior.
ExprResult RebuildShuffleVectorExpr(SourceLocation BuiltinLoc,
- MultiExprArg SubExprs,
- SourceLocation RParenLoc) {
+ MultiExprArg SubExprs,
+ SourceLocation RParenLoc) {
// Find the declaration for __builtin_shufflevector
const IdentifierInfo &Name
= SemaRef.Context.Idents.get("__builtin_shufflevector");
@@ -1961,7 +1970,7 @@ public:
FunctionDecl *Builtin = cast<FunctionDecl>(*Lookup.first);
Expr *Callee
= new (SemaRef.Context) DeclRefExpr(Builtin, Builtin->getType(),
- BuiltinLoc);
+ VK_LValue, BuiltinLoc);
SemaRef.UsualUnaryConversions(Callee);
// Build the CallExpr
@@ -1970,6 +1979,7 @@ public:
CallExpr *TheCall = new (SemaRef.Context) CallExpr(SemaRef.Context, Callee,
Subs, NumSubExprs,
Builtin->getCallResultType(),
+ Expr::getValueKindForType(Builtin->getResultType()),
RParenLoc);
ExprResult OwnedCall(SemaRef.Owned(TheCall));
OpenPOWER on IntegriCloud