From: Chris Lattner Date: Thu, 20 Nov 2008 06:13:02 +0000 (+0000) Subject: remove another old Diag method. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5dc266abe0e8de69788ba67e38047a919f4bc383;p=clang remove another old Diag method. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59713 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp index 063399aee7..a72d15dbe8 100644 --- a/lib/Sema/Sema.cpp +++ b/lib/Sema/Sema.cpp @@ -167,12 +167,6 @@ bool Sema::Diag(SourceLocation Loc, unsigned DiagID, const std::string &Msg) { return true; } -bool Sema::Diag(SourceLocation Loc, unsigned DiagID, const std::string &Msg1, - const std::string &Msg2) { - PP.getDiagnostics().Report(PP.getFullLoc(Loc), DiagID) << Msg1 << Msg2; - return true; -} - const LangOptions &Sema::getLangOptions() const { return PP.getLangOptions(); } diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h index 5f3d466174..e386929726 100644 --- a/lib/Sema/Sema.h +++ b/lib/Sema/Sema.h @@ -229,8 +229,6 @@ public: /// The primitive diagnostic helpers. DiagnosticInfo Diag(SourceLocation Loc, unsigned DiagID); bool Diag(SourceLocation Loc, unsigned DiagID, const std::string &Msg); - bool Diag(SourceLocation Loc, unsigned DiagID, const std::string &Msg1, - const std::string &Msg2); virtual void DeleteExpr(ExprTy *E); virtual void DeleteStmt(StmtTy *S); diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index ad656a351a..9126e5c024 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -324,8 +324,8 @@ TypedefDecl *Sema::MergeTypeDefDecl(TypedefDecl *New, Decl *OldD) { // Verify the old decl was also a typedef. TypedefDecl *Old = dyn_cast(OldD); if (!Old) { - Diag(New->getLocation(), diag::err_redefinition_different_kind, - New->getName()); + Diag(New->getLocation(), diag::err_redefinition_different_kind) + << New->getName(); Diag(OldD->getLocation(), diag::err_previous_definition); return New; } @@ -335,9 +335,9 @@ TypedefDecl *Sema::MergeTypeDefDecl(TypedefDecl *New, Decl *OldD) { if (Old->getUnderlyingType() != New->getUnderlyingType() && Context.getCanonicalType(Old->getUnderlyingType()) != Context.getCanonicalType(New->getUnderlyingType())) { - Diag(New->getLocation(), diag::err_redefinition_different_typedef, - New->getUnderlyingType().getAsString(), - Old->getUnderlyingType().getAsString()); + Diag(New->getLocation(), diag::err_redefinition_different_typedef) + << New->getUnderlyingType().getAsString() + << Old->getUnderlyingType().getAsString(); Diag(Old->getLocation(), diag::err_previous_definition); return Old; } @@ -357,7 +357,7 @@ TypedefDecl *Sema::MergeTypeDefDecl(TypedefDecl *New, Decl *OldD) { return New; } - Diag(New->getLocation(), diag::err_redefinition, New->getName()); + Diag(New->getLocation(), diag::err_redefinition) << New->getName(); Diag(Old->getLocation(), diag::err_previous_definition); return New; } @@ -410,8 +410,8 @@ Sema::MergeFunctionDecl(FunctionDecl *New, Decl *OldD, bool &Redeclaration) { // Verify the old decl was also a function. FunctionDecl *Old = dyn_cast(OldD); if (!Old) { - Diag(New->getLocation(), diag::err_redefinition_different_kind, - New->getName()); + Diag(New->getLocation(), diag::err_redefinition_different_kind) + << New->getName(); Diag(OldD->getLocation(), diag::err_previous_definition); return New; } @@ -485,7 +485,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->getName(); Diag(Old->getLocation(), PrevDiag); return New; } diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index 743f6a8d1d..edecab1d4c 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -1211,15 +1211,14 @@ Sema::DeclTy *Sema::ActOnConversionDeclarator(CXXConversionDecl *Conversion) { if (ConvType->isRecordType()) { ConvType = Context.getCanonicalType(ConvType).getUnqualifiedType(); if (ConvType == ClassType) - Diag(Conversion->getLocation(), diag::warn_conv_to_self_not_used, - ClassType.getAsString()); + Diag(Conversion->getLocation(), diag::warn_conv_to_self_not_used) + << ClassType.getAsString(); else if (IsDerivedFrom(ClassType, ConvType)) - Diag(Conversion->getLocation(), diag::warn_conv_to_base_not_used, - ClassType.getAsString(), - ConvType.getAsString()); + Diag(Conversion->getLocation(), diag::warn_conv_to_base_not_used) + << ClassType.getAsString() << ConvType.getAsString(); } else if (ConvType->isVoidType()) { - Diag(Conversion->getLocation(), diag::warn_conv_to_void_not_used, - ClassType.getAsString(), ConvType.getAsString()); + Diag(Conversion->getLocation(), diag::warn_conv_to_void_not_used) + << ClassType.getAsString() << ConvType.getAsString(); } ClassDecl->addConversionFunction(Context, Conversion); @@ -1271,8 +1270,8 @@ Sema::DeclTy *Sema::ActOnStartNamespaceDef(Scope *NamespcScope, // name to return the original namespace decl during a name lookup. } else { // This is an invalid name redefinition. - Diag(Namespc->getLocation(), diag::err_redefinition_different_kind, - Namespc->getName()); + Diag(Namespc->getLocation(), diag::err_redefinition_different_kind) + << Namespc->getName(); Diag(PrevDecl->getLocation(), diag::err_previous_definition); Namespc->setInvalidDecl(); // Continue on to push Namespc as current DeclContext and return it. @@ -1442,7 +1441,7 @@ Sema::PerformInitializationByConstructor(QualType ClassType, case OR_No_Viable_Function: if (CandidateSet.empty()) - Diag(Loc, diag::err_ovl_no_viable_function_in_init) << InitEntity, Range; + Diag(Loc, diag::err_ovl_no_viable_function_in_init) << InitEntity <getLocation(), diag::error_duplicate_method_decl, - Method->getSelector().getName()); + Diag(Method->getLocation(), diag::error_duplicate_method_decl) + << Method->getSelector().getName(); Diag(PrevMethod->getLocation(), diag::err_previous_declaration); } else { insMethods.push_back(Method); @@ -921,8 +921,8 @@ void Sema::ActOnAtEnd(SourceLocation AtEndLoc, DeclTy *classDecl, : false; if (isInterfaceDeclKind && PrevMethod && !match || checkIdenticalMethods && match) { - Diag(Method->getLocation(), diag::error_duplicate_method_decl, - Method->getSelector().getName()); + Diag(Method->getLocation(), diag::error_duplicate_method_decl) + << Method->getSelector().getName(); Diag(PrevMethod->getLocation(), diag::err_previous_declaration); } else { clsMethods.push_back(Method); @@ -1114,8 +1114,8 @@ Sema::DeclTy *Sema::ActOnMethodDeclaration( } if (PrevMethod) { // You can never have two method definitions with the same name. - Diag(ObjCMethod->getLocation(), diag::error_duplicate_method_decl, - ObjCMethod->getSelector().getName()); + Diag(ObjCMethod->getLocation(), diag::error_duplicate_method_decl) + << ObjCMethod->getSelector().getName(); Diag(PrevMethod->getLocation(), diag::err_previous_declaration); } return ObjCMethod; @@ -1129,36 +1129,36 @@ void Sema::CheckObjCPropertyAttributes(QualType PropertyTy, // readonly and readwrite conflict. if ((Attributes & ObjCDeclSpec::DQ_PR_readonly) && (Attributes & ObjCDeclSpec::DQ_PR_readwrite)) { - Diag(Loc, diag::err_objc_property_attr_mutually_exclusive, - "readonly", "readwrite"); - Attributes ^= ObjCDeclSpec::DQ_PR_readonly; + Diag(Loc, diag::err_objc_property_attr_mutually_exclusive) + << "readonly" << "readwrite"; + Attributes &= ~ObjCDeclSpec::DQ_PR_readonly; } // Check for copy or retain on non-object types. if ((Attributes & (ObjCDeclSpec::DQ_PR_copy | ObjCDeclSpec::DQ_PR_retain)) && !Context.isObjCObjectPointerType(PropertyTy)) { - Diag(Loc, diag::err_objc_property_requires_object, - Attributes & ObjCDeclSpec::DQ_PR_copy ? "copy" : "retain"); + Diag(Loc, diag::err_objc_property_requires_object) + << (Attributes & ObjCDeclSpec::DQ_PR_copy ? "copy" : "retain"); Attributes &= ~(ObjCDeclSpec::DQ_PR_copy | ObjCDeclSpec::DQ_PR_retain); } // Check for more than one of { assign, copy, retain }. if (Attributes & ObjCDeclSpec::DQ_PR_assign) { if (Attributes & ObjCDeclSpec::DQ_PR_copy) { - Diag(Loc, diag::err_objc_property_attr_mutually_exclusive, - "assign", "copy"); - Attributes ^= ObjCDeclSpec::DQ_PR_copy; + Diag(Loc, diag::err_objc_property_attr_mutually_exclusive) + << "assign" << "copy"; + Attributes &= ~ObjCDeclSpec::DQ_PR_copy; } if (Attributes & ObjCDeclSpec::DQ_PR_retain) { - Diag(Loc, diag::err_objc_property_attr_mutually_exclusive, - "assign", "retain"); - Attributes ^= ObjCDeclSpec::DQ_PR_retain; + Diag(Loc, diag::err_objc_property_attr_mutually_exclusive) + << "assign" << "retain"; + Attributes &= ~ObjCDeclSpec::DQ_PR_retain; } } else if (Attributes & ObjCDeclSpec::DQ_PR_copy) { if (Attributes & ObjCDeclSpec::DQ_PR_retain) { - Diag(Loc, diag::err_objc_property_attr_mutually_exclusive, - "copy", "retain"); - Attributes ^= ObjCDeclSpec::DQ_PR_retain; + Diag(Loc, diag::err_objc_property_attr_mutually_exclusive) + << "copy" << "retain"; + Attributes &= ~ObjCDeclSpec::DQ_PR_retain; } } @@ -1266,7 +1266,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->getName(); return 0; } } @@ -1290,8 +1290,8 @@ Sema::DeclTy *Sema::ActOnPropertyImplDecl(SourceLocation AtLoc, // Look for this property declaration in @implementation's category property = Category->FindPropertyDeclaration(PropertyId); if (!property) { - Diag(PropertyLoc, diag::error_bad_category_property_decl, - Category->getName()); + Diag(PropertyLoc, diag::error_bad_category_property_decl) + << Category->getName(); return 0; } } @@ -1317,8 +1317,8 @@ Sema::DeclTy *Sema::ActOnPropertyImplDecl(SourceLocation AtLoc, // Check that type of property and its ivar are type compatible. if (PropType != IvarType) { if (CheckAssignmentConstraints(PropType, IvarType) != Compatible) { - Diag(PropertyLoc, diag::error_property_ivar_type, property->getName(), - Ivar->getName()); + Diag(PropertyLoc, diag::error_property_ivar_type) + << property->getName() << Ivar->getName(); return 0; } }