[cfe-commits] r59714 - in /cfe/trunk/lib/Sema: Sema.cpp Sema.h SemaDecl.cpp SemaDeclCXX.cpp SemaExpr.cpp SemaExprObjC.cpp SemaInit.cpp SemaStmt.cpp SemaType.cpp

Chris Lattner sabre at nondot.org
Wed Nov 19 22:38:19 PST 2008


Author: lattner
Date: Thu Nov 20 00:38:18 2008
New Revision: 59714

URL: http://llvm.org/viewvc/llvm-project?rev=59714&view=rev
Log:
remove the last old-fashioned Diag method.  Transition complete!

Modified:
    cfe/trunk/lib/Sema/Sema.cpp
    cfe/trunk/lib/Sema/Sema.h
    cfe/trunk/lib/Sema/SemaDecl.cpp
    cfe/trunk/lib/Sema/SemaDeclCXX.cpp
    cfe/trunk/lib/Sema/SemaExpr.cpp
    cfe/trunk/lib/Sema/SemaExprObjC.cpp
    cfe/trunk/lib/Sema/SemaInit.cpp
    cfe/trunk/lib/Sema/SemaStmt.cpp
    cfe/trunk/lib/Sema/SemaType.cpp

Modified: cfe/trunk/lib/Sema/Sema.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.cpp?rev=59714&r1=59713&r2=59714&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/Sema.cpp (original)
+++ cfe/trunk/lib/Sema/Sema.cpp Thu Nov 20 00:38:18 2008
@@ -162,11 +162,6 @@
                                     DiagID);
 }
 
-bool Sema::Diag(SourceLocation Loc, unsigned DiagID, const std::string &Msg) {
-  PP.getDiagnostics().Report(PP.getFullLoc(Loc), DiagID) << Msg;
-  return true;
-}
-
 const LangOptions &Sema::getLangOptions() const {
   return PP.getLangOptions();
 }

Modified: cfe/trunk/lib/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.h?rev=59714&r1=59713&r2=59714&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/Sema.h (original)
+++ cfe/trunk/lib/Sema/Sema.h Thu Nov 20 00:38:18 2008
@@ -23,7 +23,6 @@
 #include "llvm/ADT/DenseSet.h"
 #include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/ADT/OwningPtr.h"
-#include <string>
 #include <vector>
 
 namespace llvm {
@@ -228,7 +227,6 @@
   
   /// The primitive diagnostic helpers.
   DiagnosticInfo Diag(SourceLocation Loc, unsigned DiagID);
-  bool Diag(SourceLocation Loc, unsigned DiagID, const std::string &Msg);
 
   virtual void DeleteExpr(ExprTy *E);
   virtual void DeleteStmt(StmtTy *S);

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=59714&r1=59713&r2=59714&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Thu Nov 20 00:38:18 2008
@@ -530,7 +530,7 @@
           OldDecl->getStorageClass() != VarDecl::PrivateExtern &&
           VD->getStorageClass() != VarDecl::Extern &&
           VD->getStorageClass() != VarDecl::PrivateExtern) {
-        Diag(VD->getLocation(), diag::err_redefinition, VD->getName());
+        Diag(VD->getLocation(), diag::err_redefinition) << VD->getName();
         Diag(OldDecl->getLocation(), diag::err_previous_definition);
       }
     }
@@ -549,8 +549,8 @@
   // Verify the old decl was also a variable.
   VarDecl *Old = dyn_cast<VarDecl>(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;
   }
@@ -561,7 +561,7 @@
   QualType OldCType = Context.getCanonicalType(Old->getType());
   QualType NewCType = Context.getCanonicalType(New->getType());
   if (OldCType != NewCType && !Context.typesAreCompatible(OldCType, NewCType)) {
-    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;
   }
@@ -569,20 +569,20 @@
   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->getName();
     Diag(Old->getLocation(), diag::err_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->getName();
     Diag(Old->getLocation(), diag::err_previous_definition);
     return New;
   }
   // Variables with external linkage are analyzed in FinalizeDeclaratorGroup.
   if (New->getStorageClass() != VarDecl::Extern && !New->isFileVarDecl()) {
-    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;
@@ -603,8 +603,8 @@
     // that function shall not have incomplete type.
     if (Param->getType()->isIncompleteType() &&
         !Param->isInvalidDecl()) {
-      Diag(Param->getLocation(), diag::err_typecheck_decl_incomplete_type,
-           Param->getType().getAsString());
+      Diag(Param->getLocation(), diag::err_typecheck_decl_incomplete_type)
+        << Param->getType().getAsString();
       Param->setInvalidDecl();
       HasInvalidParm = true;
     }
@@ -900,8 +900,8 @@
       case DeclSpec::SCS_auto:        
       case DeclSpec::SCS_register:
       case DeclSpec::SCS_mutable:
-        Diag(D.getIdentifierLoc(), diag::err_typecheck_sclass_func,
-             R.getAsString());
+        Diag(D.getIdentifierLoc(), diag::err_typecheck_sclass_func)
+          << R.getAsString();
         InvalidDecl = true;
         break;
       case DeclSpec::SCS_unspecified: SC = FunctionDecl::None; break;
@@ -1163,8 +1163,8 @@
 
     IdentifierInfo *II = Name.getAsIdentifierInfo();
     if (!II) {
-      Diag(D.getIdentifierLoc(), diag::err_bad_variable_name,
-           Name.getAsString());
+      Diag(D.getIdentifierLoc(), diag::err_bad_variable_name)
+       << Name.getAsString();
       return 0;
     }
 
@@ -1180,8 +1180,8 @@
         // C99 6.9p2: The storage-class specifiers auto and register shall not
         // appear in the declaration specifiers in an external declaration.
         if (SC == VarDecl::Auto || SC == VarDecl::Register) {
-          Diag(D.getIdentifierLoc(), diag::err_typecheck_sclass_fscope,
-               R.getAsString());
+          Diag(D.getIdentifierLoc(), diag::err_typecheck_sclass_fscope)
+            << R.getAsString();
           InvalidDecl = true;
         }
       }
@@ -1864,10 +1864,9 @@
     if (getLangOptions().CPlusPlus &&
         Context.getCanonicalType(Type).isConstQualified() &&
         Var->getStorageClass() != VarDecl::Extern)
-      Diag(Var->getLocation(), 
-           diag::err_const_var_requires_init, 
-           Var->getName(), 
-           SourceRange(Var->getLocation(), Var->getLocation()));
+      Diag(Var->getLocation(),  diag::err_const_var_requires_init)
+        << Var->getName()
+        << SourceRange(Var->getLocation(), Var->getLocation());
 #endif
   }
 }
@@ -1913,8 +1912,8 @@
     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.getAsString();
         IDecl->setInvalidDecl();
       }
     }
@@ -1931,8 +1930,8 @@
         // 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.getAsString();
         IDecl->setInvalidDecl();
       }
     }
@@ -1982,8 +1981,8 @@
   IdentifierInfo *II = D.getIdentifier();
   if (Decl *PrevDecl = LookupDecl(II, Decl::IDNS_Ordinary, S)) {
     if (S->isDeclScope(PrevDecl)) {
-      Diag(D.getIdentifierLoc(), diag::err_param_redefinition,
-           dyn_cast<NamedDecl>(PrevDecl)->getName());
+      Diag(D.getIdentifierLoc(), diag::err_param_redefinition)
+        << cast<NamedDecl>(PrevDecl)->getName();
 
       // Recover by removing the name
       II = 0;
@@ -2071,8 +2070,7 @@
   // See if this is a redefinition.
   const FunctionDecl *Definition;
   if (FD->getBody(Definition)) {
-    Diag(FD->getLocation(), diag::err_redefinition, 
-         FD->getName());
+    Diag(FD->getLocation(), diag::err_redefinition) << FD->getName();
     Diag(Definition->getLocation(), diag::err_previous_definition);
   }
 
@@ -2113,7 +2111,7 @@
     if (I->second->getSubStmt() == 0) {
       LabelStmt *L = I->second;
       // Emit error.
-      Diag(L->getIdentLoc(), diag::err_undeclared_label_use, L->getName());
+      Diag(L->getIdentLoc(), diag::err_undeclared_label_use) << L->getName();
       
       // At this point, we have gotos that use the bogus label.  Stitch it into
       // the function body so that they aren't leaked and that the AST is well
@@ -2712,8 +2710,8 @@
       //     struct S { struct S {} X; };
       // We discover this when we complete the outer S.  Reject and ignore the
       // outer S.
-      Diag(DefRecord->getLocation(), diag::err_nested_redefinition,
-           DefRecord->getKindName());
+      Diag(DefRecord->getLocation(), diag::err_nested_redefinition)
+        << DefRecord->getKindName();
       Diag(RecLoc, diag::err_previous_definition);
       Record->setInvalidDecl();
       return;
@@ -2737,8 +2735,8 @@
       
     // 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());
+      Diag(FD->getLocation(), diag::err_field_declared_as_function)
+        << FD->getName();
       FD->setInvalidDecl();
       EnclosingDecl->setInvalidDecl();
       continue;
@@ -2746,7 +2744,7 @@
     // 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->getName();
         FD->setInvalidDecl();
         EnclosingDecl->setInvalidDecl();
         continue;
@@ -2754,14 +2752,14 @@
       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->getName();
         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());
+        Diag(FD->getLocation(), diag::err_flexible_array_empty_struct)
+          << FD->getName();
         FD->setInvalidDecl();
         EnclosingDecl->setInvalidDecl();
         continue;
@@ -2782,16 +2780,16 @@
           // it.  Note that GCC supports variable sized arrays in the middle of
           // structures.
           if (i != NumFields-1) {
-            Diag(FD->getLocation(), diag::err_variable_sized_type_in_struct,
-                 FD->getName());
+            Diag(FD->getLocation(), diag::err_variable_sized_type_in_struct)
+              << FD->getName();
             FD->setInvalidDecl();
             EnclosingDecl->setInvalidDecl();
             continue;
           }
           // 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());
+          Diag(FD->getLocation(), diag::ext_flexible_array_in_struct)
+            << FD->getName();
           if (Record)
             Record->setHasFlexibleArrayMember(true);
         }
@@ -2799,8 +2797,8 @@
     }
     /// A field cannot be an Objective-c object
     if (FDTy->isObjCInterfaceType()) {
-      Diag(FD->getLocation(), diag::err_statically_allocated_object,
-           FD->getName());
+      Diag(FD->getLocation(), diag::err_statically_allocated_object)
+        << FD->getName();
       FD->setInvalidDecl();
       EnclosingDecl->setInvalidDecl();
       continue;
@@ -2939,8 +2937,7 @@
     //   enum e0 {
     //     E0 = sizeof(enum e0 { E1 })
     //   };
-    Diag(Enum->getLocation(), diag::err_nested_redefinition,
-         Enum->getName());
+    Diag(Enum->getLocation(), diag::err_nested_redefinition) << Enum->getName();
     Diag(EnumLoc, diag::err_previous_definition);
     Enum->setInvalidDecl();
     return;
@@ -2973,8 +2970,8 @@
       V.trunc(IntWidth);
       V.extend(InitVal.getBitWidth());
       if (V != InitVal)
-        Diag(ECD->getLocation(), diag::ext_enum_value_not_int,
-             InitVal.toString(10));
+        Diag(ECD->getLocation(), diag::ext_enum_value_not_int)
+          << InitVal.toString(10);
     }
     
     // Keep track of the size of positive and negative values.
@@ -3176,8 +3173,8 @@
       // If a name was specified then failure indicates the name
       // wasn't found. Otherwise failure indicates the stack was
       // empty.
-      Diag(PragmaLoc, diag::warn_pragma_pack_pop_failed, 
-           Name ? "no record matching name" : "stack empty");
+      Diag(PragmaLoc, diag::warn_pragma_pack_pop_failed)
+        << (Name ? "no record matching name" : "stack empty");
 
       // FIXME: Warn about popping named records as MSVC does.
     } else {

Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=59714&r1=59713&r2=59714&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Thu Nov 20 00:38:18 2008
@@ -1814,8 +1814,8 @@
   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->getName();
   } else {
     bool ClassOrEnumParam = false;
     for (FunctionDecl::param_iterator Param = FnDecl->param_begin(),
@@ -1830,8 +1830,8 @@
 
     if (!ClassOrEnumParam)
       return Diag(FnDecl->getLocation(),
-                  diag::err_operator_overload_needs_class_or_enum,
-                  FnDecl->getName());
+                  diag::err_operator_overload_needs_class_or_enum)
+        << FnDecl->getName();
   }
 
   // C++ [over.oper]p8:
@@ -1898,16 +1898,15 @@
   // 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());
+    return Diag(FnDecl->getLocation(), diag::err_operator_overload_variadic)
+      << FnDecl->getName();
   }
 
   // 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());
+                diag::err_operator_overload_must_be_member)
+      << FnDecl->getName();
   }
 
   // C++ [over.inc]p1:
@@ -1932,8 +1931,8 @@
         DK = diag::err_operator_overload_post_inc_must_be_int;
       else
         DK = diag::err_operator_overload_post_dec_must_be_int;
-      return Diag(LastParam->getLocation(), DK,
-                  Context.getCanonicalType(LastParam->getType()).getAsString());
+      return Diag(LastParam->getLocation(), DK)
+        << Context.getCanonicalType(LastParam->getType()).getAsString();
     }
   }
 

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=59714&r1=59713&r2=59714&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Thu Nov 20 00:38:18 2008
@@ -1568,8 +1568,8 @@
 
   // first, check the condition.
   if (!condT->isScalarType()) { // C99 6.5.15p2
-    Diag(cond->getLocStart(), diag::err_typecheck_cond_expect_scalar, 
-         condT.getAsString());
+    Diag(cond->getLocStart(), diag::err_typecheck_cond_expect_scalar)
+      << condT.getAsString();
     return QualType();
   }
   

Modified: cfe/trunk/lib/Sema/SemaExprObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprObjC.cpp?rev=59714&r1=59713&r2=59714&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaExprObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprObjC.cpp Thu Nov 20 00:38:18 2008
@@ -190,8 +190,8 @@
       isSuper = true;
       ClassDecl = getCurMethodDecl()->getClassInterface()->getSuperClass();
       if (!ClassDecl)
-        return Diag(lbrac, diag::error_no_super_class,
-                    getCurMethodDecl()->getClassInterface()->getName());
+        return Diag(lbrac, diag::error_no_super_class)
+          << getCurMethodDecl()->getClassInterface()->getName();
       if (getCurMethodDecl()->isInstance()) {
         QualType superTy = Context.getObjCInterfaceType(ClassDecl);
         superTy = Context.getPointerType(superTy);
@@ -214,8 +214,8 @@
         return ActOnInstanceMessage(ReceiverExpr.Val, Sel, lbrac, rbrac,
                                     Args, NumArgs);
       }
-      return Diag(receiverLoc, diag::err_undeclared_var_use, 
-                  receiverName->getName());
+      return Diag(receiverLoc, diag::err_undeclared_var_use)
+        << receiverName->getName();
     }      
   } else
     ClassDecl = getObjCInterfaceDecl(receiverName);

Modified: cfe/trunk/lib/Sema/SemaInit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInit.cpp?rev=59714&r1=59713&r2=59714&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaInit.cpp (original)
+++ cfe/trunk/lib/Sema/SemaInit.cpp Thu Nov 20 00:38:18 2008
@@ -143,8 +143,8 @@
   } else if (DeclType->isVoidType() || DeclType->isFunctionType()) {
     // This type is invalid, issue a diagnostic.
     Index++;
-    SemaRef->Diag(IList->getLocStart(), diag::err_illegal_initializer_type,
-                  DeclType.getAsString());
+    SemaRef->Diag(IList->getLocStart(), diag::err_illegal_initializer_type)
+      << DeclType.getAsString();
     hadError = true;
   } else {
     // In C, all types are either scalars or aggregates, but

Modified: cfe/trunk/lib/Sema/SemaStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaStmt.cpp?rev=59714&r1=59713&r2=59714&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaStmt.cpp (original)
+++ cfe/trunk/lib/Sema/SemaStmt.cpp Thu Nov 20 00:38:18 2008
@@ -182,7 +182,7 @@
   // Otherwise, this label was either forward reference or multiply defined.  If
   // multiply defined, reject it now.
   if (LabelDecl->getSubStmt()) {
-    Diag(IdentLoc, diag::err_redefinition_of_label, LabelDecl->getName());
+    Diag(IdentLoc, diag::err_redefinition_of_label) << LabelDecl->getName();
     Diag(LabelDecl->getIdentLoc(), diag::err_previous_definition);
     return SubStmt;
   }
@@ -572,8 +572,9 @@
   
   if (!getLangOptions().CPlusPlus) {
     if (DeclStmt *DS = dyn_cast_or_null<DeclStmt>(First)) {
-      // C99 6.8.5p3: The declaration part of a 'for' statement shall only declare
-      // identifiers for objects having storage class 'auto' or 'register'.
+      // C99 6.8.5p3: The declaration part of a 'for' statement shall only
+      // declare identifiers for objects having storage class 'auto' or
+      // 'register'.
       for (DeclStmt::decl_iterator DI=DS->decl_begin(), DE=DS->decl_end();
            DI!=DE; ++DI) {
         VarDecl *VD = dyn_cast<VarDecl>(*DI);
@@ -616,8 +617,9 @@
       
       ScopedDecl *D = DS->getSolitaryDecl();
       FirstType = cast<ValueDecl>(D)->getType();
-      // C99 6.8.5p3: The declaration part of a 'for' statement shall only declare
-      // identifiers for objects having storage class 'auto' or 'register'.
+      // C99 6.8.5p3: The declaration part of a 'for' statement shall only
+      // declare identifiers for objects having storage class 'auto' or
+      // 'register'.
       VarDecl *VD = cast<VarDecl>(D);
       if (VD->isBlockVarDecl() && !VD->hasLocalStorage())
         return Diag(VD->getLocation(), diag::err_non_variable_decl_in_for);
@@ -836,7 +838,7 @@
     if (!Context.Target.validateOutputConstraint(OutputConstraint.c_str(),info))
       // FIXME: We currently leak memory here.
       return Diag(Literal->getLocStart(),
-                  diag::err_asm_invalid_output_constraint, OutputConstraint);
+                  diag::err_asm_invalid_output_constraint) << OutputConstraint;
     
     // Check that the output exprs are valid lvalues.
     ParenExpr *OutputExpr = cast<ParenExpr>(Exprs[i]);
@@ -894,7 +896,7 @@
     if (!Context.Target.isValidGCCRegisterName(Clobber.c_str()))
       // FIXME: We currently leak memory here.
       return Diag(Literal->getLocStart(),
-                  diag::err_asm_unknown_register_name, Clobber.c_str());
+                  diag::err_asm_unknown_register_name) << Clobber.c_str();
   }
   
   return new AsmStmt(AsmLoc, IsSimple, IsVolatile, NumOutputs, NumInputs, 

Modified: cfe/trunk/lib/Sema/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=59714&r1=59713&r2=59714&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Thu Nov 20 00:38:18 2008
@@ -46,14 +46,14 @@
     if (DS.getTypeSpecSign() == DeclSpec::TSS_unspecified)
       Result = Context.WCharTy;
     else if (DS.getTypeSpecSign() == DeclSpec::TSS_signed) {
-      Diag(DS.getTypeSpecSignLoc(), diag::ext_invalid_sign_spec,
-           DS.getSpecifierName(DS.getTypeSpecType()));
+      Diag(DS.getTypeSpecSignLoc(), diag::ext_invalid_sign_spec)
+        << DS.getSpecifierName(DS.getTypeSpecType());
       Result = Context.getSignedWCharType();
     } else {
       assert(DS.getTypeSpecSign() == DeclSpec::TSS_unsigned &&
         "Unknown TSS value");
-      Diag(DS.getTypeSpecSignLoc(), diag::ext_invalid_sign_spec,
-           DS.getSpecifierName(DS.getTypeSpecType()));
+      Diag(DS.getTypeSpecSignLoc(), diag::ext_invalid_sign_spec)
+        << DS.getSpecifierName(DS.getTypeSpecType());
       Result = Context.getUnsignedWCharType();
     }
     break;
@@ -430,8 +430,8 @@
       
       // C99 6.7.5.3p1: The return type may not be a function or array type.
       if (T->isArrayType() || T->isFunctionType()) {
-        Diag(DeclType.Loc, diag::err_func_returning_array_function,
-             T.getAsString());
+        Diag(DeclType.Loc, diag::err_func_returning_array_function)
+          << T.getAsString();
         T = Context.IntTy;
         D.setInvalidType(true);
       }
@@ -654,8 +654,7 @@
   
   // Check the attribute arguments.
   if (Attr.getNumArgs() != 1) {
-    S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments,
-           std::string("1"));
+    S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 1;
     return;
   }
   Expr *ASArgExpr = static_cast<Expr *>(Attr.getArg(0));





More information about the cfe-commits mailing list