]> granicus.if.org Git - clang/commitdiff
remove another old Diag method.
authorChris Lattner <sabre@nondot.org>
Thu, 20 Nov 2008 06:13:02 +0000 (06:13 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 20 Nov 2008 06:13:02 +0000 (06:13 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59713 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/Sema.cpp
lib/Sema/Sema.h
lib/Sema/SemaDecl.cpp
lib/Sema/SemaDeclCXX.cpp
lib/Sema/SemaDeclObjC.cpp

index 063399aee762d88c71c70a5e08b3f7a46139c85b..a72d15dbe80b672608395e42f869002b83153931 100644 (file)
@@ -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();
 }
index 5f3d466174264c1525325307e2fab3f1e1aa901b..e386929726e45951321e0ede5edbc1df0b2e61be 100644 (file)
@@ -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);
index ad656a351a37e83d31f3628362d90f85afa756f0..9126e5c02466eece9206047fbbb7514697682611 100644 (file)
@@ -324,8 +324,8 @@ TypedefDecl *Sema::MergeTypeDefDecl(TypedefDecl *New, Decl *OldD) {
   // Verify the old decl was also a typedef.
   TypedefDecl *Old = dyn_cast<TypedefDecl>(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<FunctionDecl>(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;
 }
index 743f6a8d1df3a2cdbc7234248c6e6088b5478393..edecab1d4c7ac52fa2356125ad9e4866f7688506 100644 (file)
@@ -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) << InitEntityRange;
+      Diag(Loc, diag::err_ovl_no_viable_function_in_init) << InitEntity <<Range;
     else {
       Diag(Loc, diag::err_ovl_no_viable_function_in_init_with_cands)
         << InitEntity << Range;
index 7c54962f40977ef3e6062933cef1a89979bb0800..bac483153cc8b5a51c152c02eceb8b338194e0c9 100644 (file)
@@ -904,8 +904,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 {
         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;
       }
     }