diff options
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r-- | clang/lib/Sema/Sema.h | 4 | ||||
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 48 | ||||
-rw-r--r-- | clang/lib/Sema/SemaDeclCXX.cpp | 19 | ||||
-rw-r--r-- | clang/lib/Sema/SemaDeclObjC.cpp | 8 | ||||
-rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 34 | ||||
-rw-r--r-- | clang/lib/Sema/SemaExprCXX.cpp | 10 | ||||
-rw-r--r-- | clang/lib/Sema/SemaExprObjC.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Sema/SemaOverload.cpp | 22 |
8 files changed, 73 insertions, 74 deletions
diff --git a/clang/lib/Sema/Sema.h b/clang/lib/Sema/Sema.h index 1b37051a7b9..4d0340bba39 100644 --- a/clang/lib/Sema/Sema.h +++ b/clang/lib/Sema/Sema.h @@ -776,7 +776,7 @@ public: PerformInitializationByConstructor(QualType ClassType, Expr **Args, unsigned NumArgs, SourceLocation Loc, SourceRange Range, - std::string InitEntity, + DeclarationName InitEntity, InitializationKind Kind); /// ActOnCXXNamedCast - Parse {dynamic,static,reinterpret,const}_cast's. @@ -1262,7 +1262,7 @@ public: /// type checking declaration initializers (C99 6.7.8) friend class InitListChecker; bool CheckInitializerTypes(Expr *&simpleInit_or_initList, QualType &declType, - SourceLocation InitLoc, std::string InitEntity); + SourceLocation InitLoc,DeclarationName InitEntity); bool CheckSingleInitializer(Expr *&simpleInit, QualType declType); bool CheckForConstantInitializer(Expr *e, QualType t); bool CheckArithmeticConstantExpression(const Expr* e); diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 8ffafadd3e9..4f71f068c5c 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -492,7 +492,7 @@ Sema::MergeFunctionDecl(FunctionDecl *New, Decl *OldD, bool &Redeclaration) { // TODO: CHECK FOR CONFLICTS, multiple decls with same name in one scope. // TODO: This is totally simplistic. It should handle merging functions // together etc, merging extern int X; int X; ... - Diag(New->getLocation(), diag::err_conflicting_types) << New->getName(); + Diag(New->getLocation(), diag::err_conflicting_types) << New->getDeclName(); Diag(Old->getLocation(), PrevDiag); return New; } @@ -576,14 +576,14 @@ VarDecl *Sema::MergeVarDecl(VarDecl *New, Decl *OldD) { if (New->getStorageClass() == VarDecl::Static && (Old->getStorageClass() == VarDecl::None || Old->getStorageClass() == VarDecl::Extern)) { - Diag(New->getLocation(), diag::err_static_non_static) << New->getName(); + Diag(New->getLocation(), diag::err_static_non_static) << New->getDeclName(); Diag(Old->getLocation(), diag::note_previous_definition); return New; } // C99 6.2.2p4: Check if we have a non-static decl followed by a static. if (New->getStorageClass() != VarDecl::Static && Old->getStorageClass() == VarDecl::Static) { - Diag(New->getLocation(), diag::err_non_static_static) << New->getName(); + Diag(New->getLocation(), diag::err_non_static_static) << New->getDeclName(); Diag(Old->getLocation(), diag::note_previous_definition); return New; } @@ -611,7 +611,7 @@ bool Sema::CheckParmsForFunctionDef(FunctionDecl *FD) { if (Param->getType()->isIncompleteType() && !Param->isInvalidDecl()) { Diag(Param->getLocation(), diag::err_typecheck_decl_incomplete_type) - << Param->getType().getAsString(); + << Param->getType(); Param->setInvalidDecl(); HasInvalidParm = true; } @@ -676,9 +676,9 @@ StringLiteral *Sema::IsStringLiteralInit(Expr *Init, QualType DeclType) { bool Sema::CheckInitializerTypes(Expr *&Init, QualType &DeclType, SourceLocation InitLoc, - std::string InitEntity) { + DeclarationName InitEntity) { // C++ [dcl.init.ref]p1: - // A variable declared to be a T&, that is “reference to type T” + // A variable declared to be a T&, that is "reference to type T" // (8.3.2), shall be initialized by an object, or function, of // type T or by an object that can be converted into a T. if (DeclType->isReferenceType()) @@ -734,7 +734,7 @@ bool Sema::CheckInitializerTypes(Expr *&Init, QualType &DeclType, return false; return Diag(InitLoc, diag::err_typecheck_convert_incompatible) - << DeclType.getAsString() << InitEntity << "initializing" + << DeclType << InitEntity << "initializing" << Init->getSourceRange(); } @@ -859,7 +859,7 @@ Sema::ActOnDeclarator(Scope *S, Declarator &D, DeclTy *lastDecl) { Diag(L, diag::err_invalid_declarator_in_function) << Name << R; } else { Diag(L, diag::err_invalid_declarator_scope) - << Name.getAsString() << cast<NamedDecl>(DC)->getName() << R; + << Name << cast<NamedDecl>(DC)->getDeclName() << R; } } } @@ -1761,7 +1761,7 @@ void Sema::AddInitializerToDecl(DeclTy *dcl, ExprTy *init) { VDecl->setInvalidDecl(); } else if (!VDecl->isInvalidDecl()) { if (CheckInitializerTypes(Init, DclT, VDecl->getLocation(), - VDecl->getName())) + VDecl->getDeclName())) VDecl->setInvalidDecl(); // C++ 3.6.2p2, allow dynamic initialization of static initializers. @@ -1775,7 +1775,7 @@ void Sema::AddInitializerToDecl(DeclTy *dcl, ExprTy *init) { Diag(VDecl->getLocation(), diag::warn_extern_init); if (!VDecl->isInvalidDecl()) if (CheckInitializerTypes(Init, DclT, VDecl->getLocation(), - VDecl->getName())) + VDecl->getDeclName())) VDecl->setInvalidDecl(); // C++ 3.6.2p2, allow dynamic initialization of static initializers. @@ -1815,7 +1815,8 @@ void Sema::ActOnUninitializedDecl(DeclTy *dcl) { // specifier is explicitly used. if (Type->isReferenceType() && Var->getStorageClass() != VarDecl::Extern) { Diag(Var->getLocation(), diag::err_reference_var_requires_init) - << Var->getName() << SourceRange(Var->getLocation(), Var->getLocation()); + << Var->getDeclName() + << SourceRange(Var->getLocation(), Var->getLocation()); Var->setInvalidDecl(); return; } @@ -1837,7 +1838,7 @@ void Sema::ActOnUninitializedDecl(DeclTy *dcl) { Var->getLocation(), SourceRange(Var->getLocation(), Var->getLocation()), - Var->getName(), + Var->getDeclName(), IK_Default); if (!Constructor) Var->setInvalidDecl(); @@ -1918,8 +1919,7 @@ Sema::DeclTy *Sema::FinalizeDeclaratorGroup(Scope *S, DeclTy *group) { if (IDecl->isBlockVarDecl() && IDecl->getStorageClass() != VarDecl::Extern) { if (T->isIncompleteType() && !IDecl->isInvalidDecl()) { - Diag(IDecl->getLocation(), diag::err_typecheck_decl_incomplete_type) - << T.getAsString(); + Diag(IDecl->getLocation(), diag::err_typecheck_decl_incomplete_type)<<T; IDecl->setInvalidDecl(); } } @@ -1936,8 +1936,7 @@ Sema::DeclTy *Sema::FinalizeDeclaratorGroup(Scope *S, DeclTy *group) { // C99 6.9.2p3: If the declaration of an identifier for an object is // a tentative definition and has internal linkage (C99 6.2.2p3), the // declared type shall not be an incomplete type. - Diag(IDecl->getLocation(), diag::err_typecheck_decl_incomplete_type) - << T.getAsString(); + Diag(IDecl->getLocation(), diag::err_typecheck_decl_incomplete_type)<<T; IDecl->setInvalidDecl(); } } @@ -2716,7 +2715,7 @@ void Sema::ActOnFields(Scope* S, // We discover this when we complete the outer S. Reject and ignore the // outer S. Diag(DefRecord->getLocation(), diag::err_nested_redefinition) - << DefRecord->getKindName(); + << DefRecord->getDeclName(); Diag(RecLoc, diag::note_previous_definition); Record->setInvalidDecl(); return; @@ -2741,7 +2740,7 @@ void Sema::ActOnFields(Scope* S, // C99 6.7.2.1p2 - A field may not be a function type. if (FDTy->isFunctionType()) { Diag(FD->getLocation(), diag::err_field_declared_as_function) - << FD->getName(); + << FD->getDeclName(); FD->setInvalidDecl(); EnclosingDecl->setInvalidDecl(); continue; @@ -2749,7 +2748,7 @@ void Sema::ActOnFields(Scope* S, // C99 6.7.2.1p2 - A field may not be an incomplete type except... if (FDTy->isIncompleteType()) { if (!Record) { // Incomplete ivar type is always an error. - Diag(FD->getLocation(), diag::err_field_incomplete) << FD->getName(); + Diag(FD->getLocation(), diag::err_field_incomplete) <<FD->getDeclName(); FD->setInvalidDecl(); EnclosingDecl->setInvalidDecl(); continue; @@ -2757,14 +2756,14 @@ void Sema::ActOnFields(Scope* S, if (i != NumFields-1 || // ... that the last member ... !Record->isStruct() || // ... of a structure ... !FDTy->isArrayType()) { //... may have incomplete array type. - Diag(FD->getLocation(), diag::err_field_incomplete) << FD->getName(); + Diag(FD->getLocation(), diag::err_field_incomplete) <<FD->getDeclName(); FD->setInvalidDecl(); EnclosingDecl->setInvalidDecl(); continue; } if (NumNamedMembers < 1) { //... must have more than named member ... Diag(FD->getLocation(), diag::err_flexible_array_empty_struct) - << FD->getName(); + << FD->getDeclName(); FD->setInvalidDecl(); EnclosingDecl->setInvalidDecl(); continue; @@ -2786,7 +2785,7 @@ void Sema::ActOnFields(Scope* S, // structures. if (i != NumFields-1) { Diag(FD->getLocation(), diag::err_variable_sized_type_in_struct) - << FD->getName(); + << FD->getDeclName(); FD->setInvalidDecl(); EnclosingDecl->setInvalidDecl(); continue; @@ -2794,7 +2793,7 @@ void Sema::ActOnFields(Scope* S, // We support flexible arrays at the end of structs in other structs // as an extension. Diag(FD->getLocation(), diag::ext_flexible_array_in_struct) - << FD->getName(); + << FD->getDeclName(); if (Record) Record->setHasFlexibleArrayMember(true); } @@ -2942,7 +2941,8 @@ void Sema::ActOnEnumBody(SourceLocation EnumLoc, DeclTy *EnumDeclX, // enum e0 { // E0 = sizeof(enum e0 { E1 }) // }; - Diag(Enum->getLocation(), diag::err_nested_redefinition) << Enum->getName(); + Diag(Enum->getLocation(), diag::err_nested_redefinition) + << Enum->getDeclName(); Diag(EnumLoc, diag::note_previous_definition); Enum->setInvalidDecl(); return; diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index d9f3bc652e8..b99f2e0dc12 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -938,7 +938,7 @@ bool Sema::CheckDestructorDeclarator(Declarator &D, QualType &R, TypeDecl *DeclaratorTypeD = (TypeDecl *)D.getDeclaratorIdType(); if (const TypedefDecl *TypedefD = dyn_cast<TypedefDecl>(DeclaratorTypeD)) { Diag(D.getIdentifierLoc(), diag::err_destructor_typedef_name) - << TypedefD->getName(); + << TypedefD->getDeclName(); isInvalid = true; } @@ -1352,7 +1352,7 @@ void Sema::AddCXXDirectInitializerToDecl(DeclTy *Dcl, SourceLocation LParenLoc, VDecl->getLocation(), SourceRange(VDecl->getLocation(), RParenLoc), - VDecl->getName(), + VDecl->getDeclName(), IK_Direct); if (!Constructor) { RealDecl->setInvalidDecl(); @@ -1400,7 +1400,7 @@ CXXConstructorDecl * Sema::PerformInitializationByConstructor(QualType ClassType, Expr **Args, unsigned NumArgs, SourceLocation Loc, SourceRange Range, - std::string InitEntity, + DeclarationName InitEntity, InitializationKind Kind) { const RecordType *ClassRec = ClassType->getAsRecordType(); assert(ClassRec && "Can only initialize a class type here"); @@ -1810,8 +1810,7 @@ bool Sema::CheckOverloadedOperatorDeclaration(FunctionDecl *FnDecl) { if (CXXMethodDecl *MethodDecl = dyn_cast<CXXMethodDecl>(FnDecl)) { if (MethodDecl->isStatic()) return Diag(FnDecl->getLocation(), - diag::err_operator_overload_static) - << FnDecl->getName(); + diag::err_operator_overload_static) << FnDecl->getDeclName(); } else { bool ClassOrEnumParam = false; for (FunctionDecl::param_iterator Param = FnDecl->param_begin(), @@ -1827,7 +1826,7 @@ bool Sema::CheckOverloadedOperatorDeclaration(FunctionDecl *FnDecl) { if (!ClassOrEnumParam) return Diag(FnDecl->getLocation(), diag::err_operator_overload_needs_class_or_enum) - << FnDecl->getName(); + << FnDecl->getDeclName(); } // C++ [over.oper]p8: @@ -1842,7 +1841,7 @@ bool Sema::CheckOverloadedOperatorDeclaration(FunctionDecl *FnDecl) { if (Expr *DefArg = (*Param)->getDefaultArg()) return Diag((*Param)->getLocation(), diag::err_operator_overload_default_arg) - << FnDecl->getName() << DefArg->getSourceRange(); + << FnDecl->getDeclName() << DefArg->getSourceRange(); } } @@ -1880,21 +1879,21 @@ bool Sema::CheckOverloadedOperatorDeclaration(FunctionDecl *FnDecl) { } return Diag(FnDecl->getLocation(), diag::err_operator_overload_must_be) - << FnDecl->getName() << NumParams << ErrorKind; + << FnDecl->getDeclName() << NumParams << ErrorKind; } // Overloaded operators other than operator() cannot be variadic. if (Op != OO_Call && FnDecl->getType()->getAsFunctionTypeProto()->isVariadic()) { return Diag(FnDecl->getLocation(), diag::err_operator_overload_variadic) - << FnDecl->getName(); + << FnDecl->getDeclName(); } // Some operators must be non-static member functions. if (MustBeMemberOperator && !isa<CXXMethodDecl>(FnDecl)) { return Diag(FnDecl->getLocation(), diag::err_operator_overload_must_be_member) - << FnDecl->getName(); + << FnDecl->getDeclName(); } // C++ [over.inc]p1: diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp index 9141cb5b9e5..4d4c82be699 100644 --- a/clang/lib/Sema/SemaDeclObjC.cpp +++ b/clang/lib/Sema/SemaDeclObjC.cpp @@ -75,7 +75,7 @@ ActOnStartClassInterface(SourceLocation AtInterfaceLoc, if (IDecl) { // Class already seen. Is it a forward declaration? if (!IDecl->isForwardDecl()) { - Diag(AtInterfaceLoc, diag::err_duplicate_class_def) << IDecl->getName(); + Diag(AtInterfaceLoc, diag::err_duplicate_class_def)<<IDecl->getDeclName(); Diag(IDecl->getLocation(), diag::note_previous_definition); // Return the previous class interface. @@ -1264,7 +1264,7 @@ Sema::DeclTy *Sema::ActOnPropertyImplDecl(SourceLocation AtLoc, // Look for this property declaration in the @implementation's @interface property = IDecl->FindPropertyDeclaration(PropertyId); if (!property) { - Diag(PropertyLoc, diag::error_bad_property_decl) << IDecl->getName(); + Diag(PropertyLoc, diag::error_bad_property_decl) << IDecl->getDeclName(); return 0; } } @@ -1289,7 +1289,7 @@ Sema::DeclTy *Sema::ActOnPropertyImplDecl(SourceLocation AtLoc, property = Category->FindPropertyDeclaration(PropertyId); if (!property) { Diag(PropertyLoc, diag::error_bad_category_property_decl) - << Category->getName(); + << Category->getDeclName(); return 0; } } @@ -1316,7 +1316,7 @@ Sema::DeclTy *Sema::ActOnPropertyImplDecl(SourceLocation AtLoc, if (PropType != IvarType) { if (CheckAssignmentConstraints(PropType, IvarType) != Compatible) { Diag(PropertyLoc, diag::error_property_ivar_type) - << property->getName() << Ivar->getName(); + << property->getDeclName() << Ivar->getDeclName(); return 0; } } diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index fd726511fd6..f81c2b877ce 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -431,11 +431,11 @@ Sema::ExprResult Sema::ActOnDeclarationNameExpr(Scope *S, SourceLocation Loc, if (MD->isStatic()) // "invalid use of member 'x' in static member function" return Diag(Loc, diag::err_invalid_member_use_in_static_method) - << FD->getName(); + << FD->getDeclName(); if (cast<CXXRecordDecl>(MD->getParent()) != FD->getParent()) // "invalid use of nonstatic data member 'x'" return Diag(Loc, diag::err_invalid_non_static_member_use) - << FD->getName(); + << FD->getDeclName(); if (FD->isInvalidDecl()) return true; @@ -445,14 +445,15 @@ Sema::ExprResult Sema::ActOnDeclarationNameExpr(Scope *S, SourceLocation Loc, FD->getType().getWithAdditionalQualifiers(MD->getTypeQualifiers()),Loc); } - return Diag(Loc, diag::err_invalid_non_static_member_use) << FD->getName(); + return Diag(Loc, diag::err_invalid_non_static_member_use) + << FD->getDeclName(); } if (isa<TypedefDecl>(D)) - return Diag(Loc, diag::err_unexpected_typedef) << Name.getAsString(); + return Diag(Loc, diag::err_unexpected_typedef) << Name; if (isa<ObjCInterfaceDecl>(D)) - return Diag(Loc, diag::err_unexpected_interface) << Name.getAsString(); + return Diag(Loc, diag::err_unexpected_interface) << Name; if (isa<NamespaceDecl>(D)) - return Diag(Loc, diag::err_unexpected_namespace) << Name.getAsString(); + return Diag(Loc, diag::err_unexpected_namespace) << Name; // Make the DeclRefExpr or BlockDeclRefExpr for the decl. if (OverloadedFunctionDecl *Ovl = dyn_cast<OverloadedFunctionDecl>(D)) @@ -462,7 +463,7 @@ Sema::ExprResult Sema::ActOnDeclarationNameExpr(Scope *S, SourceLocation Loc, // check if referencing an identifier with __attribute__((deprecated)). if (VD->getAttr<DeprecatedAttr>()) - Diag(Loc, diag::warn_deprecated) << VD->getName(); + Diag(Loc, diag::warn_deprecated) << VD->getDeclName(); // Only create DeclRefExpr's for valid Decl's. if (VD->isInvalidDecl()) @@ -1135,7 +1136,7 @@ ActOnMemberReferenceExpr(ExprTy *Base, SourceLocation OpLoc, RecordDecl *RDecl = RTy->getDecl(); if (RTy->isIncompleteType()) return Diag(OpLoc, diag::err_typecheck_incomplete_tag) - << RDecl->getName() << BaseExpr->getSourceRange(); + << RDecl->getDeclName() << BaseExpr->getSourceRange(); // The record definition is complete, now make sure the member is valid. FieldDecl *MemberDecl = RDecl->getMember(&Member); if (!MemberDecl) @@ -1164,7 +1165,7 @@ ActOnMemberReferenceExpr(ExprTy *Base, SourceLocation OpLoc, return new ObjCIvarRefExpr(IV, IV->getType(), MemberLoc, BaseExpr, OpKind == tok::arrow); return Diag(MemberLoc, diag::err_typecheck_member_reference_ivar) - << IFTy->getDecl()->getName() << &Member + << IFTy->getDecl()->getDeclName() << &Member << BaseExpr->getSourceRange(); } @@ -1315,14 +1316,14 @@ ActOnCallExpr(ExprTy *fn, SourceLocation LParenLoc, case OR_No_Viable_Function: Diag(Fn->getSourceRange().getBegin(), diag::err_ovl_no_viable_function_in_call) - << Ovl->getName() << (unsigned)CandidateSet.size() + << Ovl->getDeclName() << (unsigned)CandidateSet.size() << Fn->getSourceRange(); PrintOverloadCandidates(CandidateSet, /*OnlyViable=*/false); return true; case OR_Ambiguous: Diag(Fn->getSourceRange().getBegin(), diag::err_ovl_ambiguous_call) - << Ovl->getName() << Fn->getSourceRange(); + << Ovl->getDeclName() << Fn->getSourceRange(); PrintOverloadCandidates(CandidateSet, /*OnlyViable=*/true); return true; } @@ -1451,12 +1452,12 @@ ActOnCompoundLiteral(SourceLocation LParenLoc, TypeTy *Ty, << SourceRange(LParenLoc, literalExpr->getSourceRange().getEnd()); } else if (literalType->isIncompleteType()) { return Diag(LParenLoc, diag::err_typecheck_decl_incomplete_type) - << literalType.getAsString() + << literalType << SourceRange(LParenLoc, literalExpr->getSourceRange().getEnd()); } if (CheckInitializerTypes(literalExpr, literalType, LParenLoc, - "temporary")) + DeclarationName())) return true; bool isFileScope = !getCurFunctionDecl() && !getCurMethodDecl(); @@ -2399,8 +2400,7 @@ QualType Sema::CheckCompareOperands(Expr *&lex, Expr *&rex, SourceLocation Loc, } else { if ((lType->isObjCQualifiedIdType() && rType->isObjCQualifiedIdType())) { Diag(Loc, diag::warn_incompatible_qualified_id_operands) - << lType.getAsString() << rType.getAsString() - << lex->getSourceRange() << rex->getSourceRange(); + << lType << rType << lex->getSourceRange() << rex->getSourceRange(); ImpCastExprToType(rex, lType); return ResultTy; } @@ -3696,7 +3696,7 @@ bool Sema::DiagnoseAssignmentResult(AssignConvertType ConvTy, break; } - Diag(Loc, DiagKind) << DstType.getAsString() << SrcType.getAsString() - << Flavor << SrcExpr->getSourceRange(); + Diag(Loc, DiagKind) << DstType << SrcType << Flavor + << SrcExpr->getSourceRange(); return isInvalid; } diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp index 80b5f200340..f5f05f243cf 100644 --- a/clang/lib/Sema/SemaExprCXX.cpp +++ b/clang/lib/Sema/SemaExprCXX.cpp @@ -189,9 +189,8 @@ Sema::ActOnCXXNew(SourceLocation StartLoc, bool UseGlobal, QualType CheckType = AllocType; // To leverage the existing parser as much as possible, array types are // parsed as VLAs. Unwrap for checking. - if (const VariableArrayType *VLA = Context.getAsVariableArrayType(AllocType)){ + if (const VariableArrayType *VLA = Context.getAsVariableArrayType(AllocType)) CheckType = VLA->getElementType(); - } // Validate the type, and unwrap an array if any. if (CheckAllocatedType(CheckType, StartLoc, SourceRange(TyStart, TyEnd))) @@ -240,13 +239,13 @@ Sema::ActOnCXXNew(SourceLocation StartLoc, bool UseGlobal, // 2) Otherwise, the object is direct-initialized. CXXConstructorDecl *Constructor = 0; Expr **ConsArgs = (Expr**)ConstructorArgs; - if (CheckType->isRecordType()) { + if (const RecordType *RT = CheckType->getAsRecordType()) { // FIXME: This is incorrect for when there is an empty initializer and // no user-defined constructor. Must zero-initialize, not default-construct. Constructor = PerformInitializationByConstructor( CheckType, ConsArgs, NumConsArgs, TyStart, SourceRange(TyStart, ConstructorRParen), - CheckType.getAsString(), + RT->getDecl()->getDeclName(), NumConsArgs != 0 ? IK_Direct : IK_Default); if (!Constructor) return true; @@ -262,8 +261,9 @@ Sema::ActOnCXXNew(SourceLocation StartLoc, bool UseGlobal, // Object is value-initialized. Do nothing. } else if (NumConsArgs == 1) { // Object is direct-initialized. + // FIXME: WHAT DeclarationName do we pass in here? if (CheckInitializerTypes(ConsArgs[0], CheckType, StartLoc, - CheckType.getAsString())) + DeclarationName() /*CheckType.getAsString()*/)) return true; } else { Diag(StartLoc, diag::err_builtin_direct_init_more_than_one_arg) diff --git a/clang/lib/Sema/SemaExprObjC.cpp b/clang/lib/Sema/SemaExprObjC.cpp index 2225d6758f7..094f3ec4609 100644 --- a/clang/lib/Sema/SemaExprObjC.cpp +++ b/clang/lib/Sema/SemaExprObjC.cpp @@ -193,7 +193,7 @@ Sema::ExprResult Sema::ActOnClassMessage( ClassDecl = getCurMethodDecl()->getClassInterface()->getSuperClass(); if (!ClassDecl) return Diag(lbrac, diag::error_no_super_class) - << getCurMethodDecl()->getClassInterface()->getName(); + << getCurMethodDecl()->getClassInterface()->getDeclName(); if (getCurMethodDecl()->isInstance()) { QualType superTy = Context.getObjCInterfaceType(ClassDecl); superTy = Context.getPointerType(superTy); diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp index 3c2c0ab489f..976b4f78a9d 100644 --- a/clang/lib/Sema/SemaOverload.cpp +++ b/clang/lib/Sema/SemaOverload.cpp @@ -210,7 +210,7 @@ void UserDefinedConversionSequence::DebugPrint() const { Before.DebugPrint(); fprintf(stderr, " -> "); } - fprintf(stderr, "'%s'", ConversionFunction->getName().c_str()); + fprintf(stderr, "'%s'", ConversionFunction->getNameAsString().c_str()); if (After.First || After.Second || After.Third) { fprintf(stderr, " -> "); After.DebugPrint(); @@ -1401,17 +1401,17 @@ bool Sema::PerformCopyInitialization(Expr *&From, QualType ToType, return DiagnoseAssignmentResult(ConvTy, From->getLocStart(), ToType, FromType, From, Flavor); - } else if (ToType->isReferenceType()) { - return CheckReferenceInit(From, ToType); - } else { - if (PerformImplicitConversion(From, ToType)) - return Diag(From->getSourceRange().getBegin(), - diag::err_typecheck_convert_incompatible) - << ToType.getAsString() << From->getType().getAsString() - << Flavor << From->getSourceRange(); - else - return false; } + + if (ToType->isReferenceType()) + return CheckReferenceInit(From, ToType); + + if (!PerformImplicitConversion(From, ToType)) + return false; + + return Diag(From->getSourceRange().getBegin(), + diag::err_typecheck_convert_incompatible) + << ToType << From->getType() << Flavor << From->getSourceRange(); } /// TryObjectArgumentInitialization - Try to initialize the object |