diff options
Diffstat (limited to 'lib/Sema')
-rw-r--r-- | lib/Sema/Sema.h | 3 | ||||
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 57 | ||||
-rw-r--r-- | lib/Sema/SemaOverload.cpp | 15 | ||||
-rw-r--r-- | lib/Sema/SemaTemplateInstantiate.cpp | 4 | ||||
-rw-r--r-- | lib/Sema/TreeTransform.h | 2 |
5 files changed, 11 insertions, 70 deletions
diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h index 472efc48cb..cff346b9df 100644 --- a/lib/Sema/Sema.h +++ b/lib/Sema/Sema.h @@ -1391,8 +1391,7 @@ public: bool IsAddressOfOperand); OwningExprResult BuildDeclRefExpr(NamedDecl *D, QualType Ty, - SourceLocation Loc, bool TypeDependent, - bool ValueDependent, + SourceLocation Loc, const CXXScopeSpec *SS = 0); VarDecl *BuildAnonymousStructUnionMemberPath(FieldDecl *Field, llvm::SmallVectorImpl<FieldDecl *> &Path); diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 42b49c5d0b..1506fbaf60 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -415,7 +415,6 @@ static bool ShouldSnapshotBlockValueReference(BlockSemaInfo *CurBlock, /// BuildDeclRefExpr - Build a DeclRefExpr. Sema::OwningExprResult Sema::BuildDeclRefExpr(NamedDecl *D, QualType Ty, SourceLocation Loc, - bool TypeDependent, bool ValueDependent, const CXXScopeSpec *SS) { assert(!isa<OverloadedFunctionDecl>(D)); @@ -445,8 +444,7 @@ Sema::BuildDeclRefExpr(NamedDecl *D, QualType Ty, SourceLocation Loc, return Owned(DeclRefExpr::Create(Context, SS? (NestedNameSpecifier *)SS->getScopeRep() : 0, SS? SS->getRange() : SourceRange(), - D, Loc, - Ty, TypeDependent, ValueDependent)); + D, Loc, Ty)); } /// getObjectForAnonymousRecordDecl - Retrieve the (unnamed) field or @@ -842,7 +840,7 @@ Sema::ActOnDeclarationNameExpr(Scope *S, SourceLocation Loc, QualType NoProtoType = T; if (const FunctionProtoType *Proto = T->getAs<FunctionProtoType>()) NoProtoType = Context.getFunctionNoProtoType(Proto->getResultType()); - return BuildDeclRefExpr(Func, NoProtoType, Loc, false, false, SS); + return BuildDeclRefExpr(Func, NoProtoType, Loc, SS); } } @@ -1139,56 +1137,7 @@ Sema::BuildDeclarationNameExpr(const CXXScopeSpec *SS, // If this reference is not in a block or if the referenced variable is // within the block, create a normal DeclRefExpr. - bool TypeDependent = false; - bool ValueDependent = false; - if (getLangOptions().CPlusPlus) { - // C++ [temp.dep.expr]p3: - // An id-expression is type-dependent if it contains: - // - an identifier that was declared with a dependent type, - if (VD->getType()->isDependentType()) - TypeDependent = true; - // - FIXME: a template-id that is dependent, - // - a conversion-function-id that specifies a dependent type, - else if (Name.getNameKind() == DeclarationName::CXXConversionFunctionName && - Name.getCXXNameType()->isDependentType()) - TypeDependent = true; - // - a nested-name-specifier that contains a class-name that - // names a dependent type. - else { - for (DeclContext *DC = D->getDeclContext(); DC; DC = DC->getParent()) { - // FIXME: could stop early at namespace scope. - if (DC->isRecord()) { - CXXRecordDecl *Record = cast<CXXRecordDecl>(DC); - if (Context.getTypeDeclType(Record)->isDependentType()) { - TypeDependent = true; - break; - } - } - } - } - - // C++ [temp.dep.constexpr]p2: - // - // An identifier is value-dependent if it is: - // - a name declared with a dependent type, - if (TypeDependent) - ValueDependent = true; - // - the name of a non-type template parameter, - else if (isa<NonTypeTemplateParmDecl>(VD)) - ValueDependent = true; - // - a constant with integral or enumeration type and is - // initialized with an expression that is value-dependent - else if (const VarDecl *Dcl = dyn_cast<VarDecl>(VD)) { - if (Context.getCanonicalType(Dcl->getType()).getCVRQualifiers() - == Qualifiers::Const && - Dcl->getInit()) { - ValueDependent = Dcl->getInit()->isValueDependent(); - } - } - } - - return BuildDeclRefExpr(VD, VD->getType().getNonReferenceType(), Loc, - TypeDependent, ValueDependent, SS); + return BuildDeclRefExpr(VD, VD->getType().getNonReferenceType(), Loc, SS); } Sema::OwningExprResult Sema::ActOnPredefinedExpr(SourceLocation Loc, diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp index 591144d81d..8a009e57f6 100644 --- a/lib/Sema/SemaOverload.cpp +++ b/lib/Sema/SemaOverload.cpp @@ -5647,11 +5647,9 @@ Expr *Sema::FixOverloadedFunctionReference(Expr *E, FunctionDecl *Fn) { DRE->getQualifierRange(), Fn, DRE->getLocation(), - (DRE->hasExplicitTemplateArgumentList() - ? &TemplateArgs : 0), Fn->getType(), - DRE->isTypeDependent(), - DRE->isValueDependent()); + (DRE->hasExplicitTemplateArgumentList() + ? &TemplateArgs : 0)); } if (UnresolvedLookupExpr *ULE = dyn_cast<UnresolvedLookupExpr>(E)) { @@ -5660,9 +5658,7 @@ Expr *Sema::FixOverloadedFunctionReference(Expr *E, FunctionDecl *Fn) { ULE->getQualifierRange(), Fn, ULE->getNameLoc(), - Fn->getType(), - Fn->getType()->isDependentType(), - false); + Fn->getType()); } @@ -5699,9 +5695,8 @@ Expr *Sema::FixOverloadedFunctionReference(Expr *E, FunctionDecl *Fn) { return DeclRefExpr::Create(Context, TID->getQualifier(), TID->getQualifierRange(), Fn, TID->getTemplateNameLoc(), - &TemplateArgs, - Fn->getType(), - /*FIXME?*/false, /*FIXME?*/false); + Fn->getType(), + &TemplateArgs); } assert(false && "Invalid reference to overloaded function"); diff --git a/lib/Sema/SemaTemplateInstantiate.cpp b/lib/Sema/SemaTemplateInstantiate.cpp index 3c5c239739..502c151f4e 100644 --- a/lib/Sema/SemaTemplateInstantiate.cpp +++ b/lib/Sema/SemaTemplateInstantiate.cpp @@ -790,7 +790,6 @@ TemplateInstantiator::TransformDeclRefExpr(DeclRefExpr *E, = SemaRef.BuildDeclRefExpr(VD, VD->getType().getNonReferenceType(), E->getLocation(), - /*FIXME:*/false, /*FIXME:*/false, &SS); if (RefExpr.isInvalid()) return SemaRef.ExprError(); @@ -802,8 +801,7 @@ TemplateInstantiator::TransformDeclRefExpr(DeclRefExpr *E, } return SemaRef.BuildDeclRefExpr(VD, VD->getType().getNonReferenceType(), - E->getLocation(), - /*FIXME:*/false, /*FIXME:*/false); + E->getLocation()); } assert(Arg.getKind() == TemplateArgument::Integral); diff --git a/lib/Sema/TreeTransform.h b/lib/Sema/TreeTransform.h index dcc0d184a1..ecac31a3e7 100644 --- a/lib/Sema/TreeTransform.h +++ b/lib/Sema/TreeTransform.h @@ -1643,7 +1643,7 @@ public: FunctionDecl *Builtin = cast<FunctionDecl>(*Lookup.first); Expr *Callee = new (SemaRef.Context) DeclRefExpr(Builtin, Builtin->getType(), - BuiltinLoc, false, false); + BuiltinLoc); SemaRef.UsualUnaryConversions(Callee); // Build the CallExpr |