[cfe-commits] r59589 - in /cfe/trunk/lib/Sema: Sema.cpp Sema.h SemaChecking.cpp SemaDecl.cpp SemaDeclCXX.cpp SemaDeclObjC.cpp SemaExpr.cpp SemaExprCXX.cpp SemaInit.cpp SemaStmt.cpp SemaType.cpp

Chris Lattner sabre at nondot.org
Tue Nov 18 21:27:51 PST 2008


Author: lattner
Date: Tue Nov 18 23:27:50 2008
New Revision: 59589

URL: http://llvm.org/viewvc/llvm-project?rev=59589&view=rev
Log:
remove one more old-style Diag method.

Modified:
    cfe/trunk/lib/Sema/Sema.cpp
    cfe/trunk/lib/Sema/Sema.h
    cfe/trunk/lib/Sema/SemaChecking.cpp
    cfe/trunk/lib/Sema/SemaDecl.cpp
    cfe/trunk/lib/Sema/SemaDeclCXX.cpp
    cfe/trunk/lib/Sema/SemaDeclObjC.cpp
    cfe/trunk/lib/Sema/SemaExpr.cpp
    cfe/trunk/lib/Sema/SemaExprCXX.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=59589&r1=59588&r2=59589&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/Sema.cpp (original)
+++ cfe/trunk/lib/Sema/Sema.cpp Tue Nov 18 23:27:50 2008
@@ -137,8 +137,8 @@
     QualType BaseType =
       cast<PointerType>(TypeTy.getUnqualifiedType())->getPointeeType();
     if (ExprBaseType.getAddressSpace() != BaseType.getAddressSpace()) {
-      Diag(Expr->getExprLoc(), diag::err_implicit_pointer_address_space_cast,
-           Expr->getSourceRange());
+      Diag(Expr->getExprLoc(), diag::err_implicit_pointer_address_space_cast)
+        << Expr->getSourceRange();
     }
   }
   
@@ -184,11 +184,6 @@
   return true;
 }
 
-bool Sema::Diag(SourceLocation Loc, unsigned DiagID, const SourceRange& Range) {
-  PP.getDiagnostics().Report(PP.getFullLoc(Loc), DiagID) << Range;
-  return true;
-}
-
 bool Sema::Diag(SourceLocation Loc, unsigned DiagID, const std::string &Msg,
                 const SourceRange& Range) {
   PP.getDiagnostics().Report(PP.getFullLoc(Loc), DiagID) << Msg << Range;

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

==============================================================================
--- cfe/trunk/lib/Sema/Sema.h (original)
+++ cfe/trunk/lib/Sema/Sema.h Tue Nov 18 23:27:50 2008
@@ -244,7 +244,6 @@
             const std::string &Msg2);
 
   /// More expressive diagnostic helpers for expressions (say that 6 times:-)
-  bool Diag(SourceLocation Loc, unsigned DiagID, const SourceRange& R1);
   bool Diag(SourceLocation Loc, unsigned DiagID, const std::string &Msg,
             const SourceRange& R1);
   

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

==============================================================================
--- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
+++ cfe/trunk/lib/Sema/SemaChecking.cpp Tue Nov 18 23:27:50 2008
@@ -414,8 +414,8 @@
 
   // CHECK: printf-like function is called with no format string.  
   if (format_idx >= TheCall->getNumArgs()) {
-    Diag(TheCall->getRParenLoc(), diag::warn_printf_missing_format_string, 
-         Fn->getSourceRange());
+    Diag(TheCall->getRParenLoc(), diag::warn_printf_missing_format_string)
+      << Fn->getSourceRange();
     return;
   }
   
@@ -466,16 +466,16 @@
           return;
     
     Diag(TheCall->getArg(format_idx)->getLocStart(), 
-         diag::warn_printf_not_string_constant,
-         OrigFormatExpr->getSourceRange());
+         diag::warn_printf_not_string_constant)
+      << OrigFormatExpr->getSourceRange();
     return;
   }
 
   // CHECK: is the format string a wide literal?
   if (FExpr->isWide()) {
     Diag(FExpr->getLocStart(),
-         diag::warn_printf_format_string_is_wide_literal,
-         OrigFormatExpr->getSourceRange());
+         diag::warn_printf_format_string_is_wide_literal)
+      << OrigFormatExpr->getSourceRange();
     return;
   }
 
@@ -486,8 +486,8 @@
   const unsigned StrLen = FExpr->getByteLength();
   
   if (StrLen == 0) {
-    Diag(FExpr->getLocStart(), diag::warn_printf_empty_format_string,
-         OrigFormatExpr->getSourceRange());
+    Diag(FExpr->getLocStart(), diag::warn_printf_empty_format_string)
+      << OrigFormatExpr->getSourceRange();
     return;
   }
 
@@ -526,8 +526,8 @@
       // The string returned by getStrData() is not null-terminated,
       // so the presence of a null character is likely an error.
       Diag(PP.AdvanceToTokenCharacter(FExpr->getLocStart(), StrIdx+1),
-           diag::warn_printf_format_string_contains_null_char,
-           OrigFormatExpr->getSourceRange());
+           diag::warn_printf_format_string_contains_null_char)
+        <<  OrigFormatExpr->getSourceRange();
       return;
     }
     
@@ -551,11 +551,11 @@
         Loc = PP.AdvanceToTokenCharacter(Loc, StrIdx+1);
 
         if (Str[StrIdx-1] == '.')
-          Diag(Loc, diag::warn_printf_asterisk_precision_missing_arg,
-               OrigFormatExpr->getSourceRange());
+          Diag(Loc, diag::warn_printf_asterisk_precision_missing_arg)
+            << OrigFormatExpr->getSourceRange();
         else
-          Diag(Loc, diag::warn_printf_asterisk_width_missing_arg,
-               OrigFormatExpr->getSourceRange());
+          Diag(Loc, diag::warn_printf_asterisk_width_missing_arg)
+            << OrigFormatExpr->getSourceRange();
         
         // Don't do any more checking.  We'll just emit spurious errors.
         return;
@@ -571,11 +571,11 @@
         PP.AdvanceToTokenCharacter(FExpr->getLocStart(), StrIdx+1);
       
       if (Str[StrIdx-1] == '.')
-        Diag(Loc, diag::warn_printf_asterisk_precision_wrong_type,
-             E->getType().getAsString(), E->getSourceRange());
+        Diag(Loc, diag::warn_printf_asterisk_precision_wrong_type)
+          << E->getType().getAsString() << E->getSourceRange();
       else
-        Diag(Loc, diag::warn_printf_asterisk_width_wrong_type,
-             E->getType().getAsString(), E->getSourceRange());
+        Diag(Loc, diag::warn_printf_asterisk_width_wrong_type)
+          << E->getType().getAsString() << E->getSourceRange();
       
       break;
     }
@@ -618,7 +618,7 @@
       SourceLocation Loc = PP.AdvanceToTokenCharacter(FExpr->getLocStart(),
                                                       LastConversionIdx+1);
                                    
-      Diag(Loc, diag::warn_printf_write_back, OrigFormatExpr->getSourceRange());
+      Diag(Loc, diag::warn_printf_write_back)<<OrigFormatExpr->getSourceRange();
       break;
     }
              
@@ -690,15 +690,15 @@
       SourceLocation Loc = PP.AdvanceToTokenCharacter(FExpr->getLocStart(),
                                                       LastConversionIdx);
                                    
-      Diag(Loc, diag::warn_printf_insufficient_data_args,
-           OrigFormatExpr->getSourceRange());
+      Diag(Loc, diag::warn_printf_insufficient_data_args)
+        << OrigFormatExpr->getSourceRange();
     }
     // CHECK: Does the number of data arguments exceed the number of
     //        format conversions in the format string?
     else if (numConversions < numDataArgs)
       Diag(TheCall->getArg(format_idx+numConversions+1)->getLocStart(),
-           diag::warn_printf_too_many_data_args,
-           OrigFormatExpr->getSourceRange());
+           diag::warn_printf_too_many_data_args)
+        << OrigFormatExpr->getSourceRange();
   }
 }
 
@@ -726,16 +726,16 @@
       RetValExp = IcExpr->getSubExpr();
 
     if (BlockExpr *C = dyn_cast_or_null<BlockExpr>(RetValExp))
-      Diag(C->getLocStart(), diag::err_ret_local_block,
-           C->getSourceRange());
+      Diag(C->getLocStart(), diag::err_ret_local_block)
+        << C->getSourceRange();
   }
   // Perform checking for stack values returned by reference.
   else if (lhsType->isReferenceType()) {
     // Check for a reference to the stack
     if (DeclRefExpr *DR = EvalVal(RetValExp))
-      Diag(DR->getLocStart(), diag::warn_ret_stack_ref,
-           DR->getDecl()->getIdentifier()->getName(),
-           RetValExp->getSourceRange());
+      Diag(DR->getLocStart(), diag::warn_ret_stack_ref)
+        << DR->getDecl()->getIdentifier()->getName()
+        << RetValExp->getSourceRange();
   }
 }
 

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

==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Tue Nov 18 23:27:50 2008
@@ -640,8 +640,8 @@
     // FIXME: Avoid truncation for 64-bit length strings.
     if (strLiteral->getByteLength() > (unsigned)CAT->getSize().getZExtValue())
       Diag(strLiteral->getSourceRange().getBegin(),
-           diag::warn_initializer_string_for_char_array_too_long,
-           strLiteral->getSourceRange());
+           diag::warn_initializer_string_for_char_array_too_long)
+        << strLiteral->getSourceRange();
   }
   // Set type from "char *" to "constant array of char".
   strLiteral->setType(DeclT);
@@ -670,9 +670,8 @@
   // C99 6.7.8p3: The type of the entity to be initialized shall be an array
   // of unknown size ("[]") or an object type that is not a variable array type.
   if (const VariableArrayType *VAT = Context.getAsVariableArrayType(DeclType))
-    return Diag(InitLoc, 
-                diag::err_variable_object_no_init, 
-                VAT->getSizeExpr()->getSourceRange());
+    return Diag(InitLoc,  diag::err_variable_object_no_init)
+      << VAT->getSizeExpr()->getSourceRange();
   
   InitListExpr *InitList = dyn_cast<InitListExpr>(Init);
   if (!InitList) {
@@ -724,9 +723,8 @@
 
     // C99 6.7.8p16.
     if (DeclType->isArrayType())
-      return Diag(Init->getLocStart(),
-                  diag::err_array_init_list_required, 
-                  Init->getSourceRange());
+      return Diag(Init->getLocStart(), diag::err_array_init_list_required)
+        << Init->getSourceRange();
 
     return CheckSingleInitializer(Init, DeclType);
   } else if (getLangOptions().CPlusPlus) {
@@ -741,10 +739,8 @@
     if (const RecordType *ClassRec = DeclType->getAsRecordType()) {
       const CXXRecordDecl *ClassDecl = cast<CXXRecordDecl>(ClassRec->getDecl());
       if (!ClassDecl->isAggregate())
-        return Diag(InitLoc,
-                    diag::err_init_non_aggr_init_list,
-                    DeclType.getAsString(),
-                    Init->getSourceRange());
+        return Diag(InitLoc, diag::err_init_non_aggr_init_list)
+           << DeclType.getAsString() << Init->getSourceRange();
     }
   }
 
@@ -1228,8 +1224,8 @@
 }
 
 void Sema::InitializerElementNotConstant(const Expr *Init) {
-  Diag(Init->getExprLoc(),
-       diag::err_init_element_not_constant, Init->getSourceRange());
+  Diag(Init->getExprLoc(), diag::err_init_element_not_constant)
+    << Init->getSourceRange();
 }
 
 bool Sema::CheckAddressConstantExpressionLValue(const Expr* Init) {
@@ -1633,8 +1629,8 @@
     // emit a warning that this is a GNU extension.
     if (FalseSide && !FalseSide->isEvaluatable(Context))
       Diag(Init->getExprLoc(), 
-           diag::ext_typecheck_expression_not_constant_but_accepted,
-           FalseSide->getSourceRange());
+           diag::ext_typecheck_expression_not_constant_but_accepted)
+        << FalseSide->getSourceRange();
     return false;
   }
   }
@@ -2673,7 +2669,7 @@
   // than a variably modified type.
   if (T->isVariablyModifiedType()) {
     // FIXME: This diagnostic needs work
-    Diag(Loc, diag::err_typecheck_illegal_vla, Loc);
+    Diag(Loc, diag::err_typecheck_illegal_vla) << SourceRange(Loc);
     InvalidDecl = true;
   }
   

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

==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Tue Nov 18 23:27:50 2008
@@ -1370,8 +1370,8 @@
   }
 
   if (NumExprs > 1) {
-    Diag(CommaLocs[0], diag::err_builtin_direct_init_more_than_one_arg,
-         SourceRange(VDecl->getLocation(), RParenLoc));
+    Diag(CommaLocs[0], diag::err_builtin_direct_init_more_than_one_arg)
+      << SourceRange(VDecl->getLocation(), RParenLoc);
     RealDecl->setInvalidDecl();
     return;
   }

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

==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Tue Nov 18 23:27:50 2008
@@ -831,11 +831,11 @@
   }
   if (issueWarning && (MethList.Method && MethList.Next)) {
     Diag(R.getBegin(), diag::warn_multiple_method_decl, Sel.getName(), R);
-    Diag(MethList.Method->getLocStart(), diag::warn_using_decl, 
-         MethList.Method->getSourceRange());
+    Diag(MethList.Method->getLocStart(), diag::warn_using_decl)
+      << MethList.Method->getSourceRange();
     for (ObjCMethodList *Next = MethList.Next; Next; Next = Next->Next)
-      Diag(Next->Method->getLocStart(), diag::warn_also_found_decl, 
-           Next->Method->getSourceRange());
+      Diag(Next->Method->getLocStart(), diag::warn_also_found_decl)
+        << Next->Method->getSourceRange();
   }
   return MethList.Method;
 }

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

==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Tue Nov 18 23:27:50 2008
@@ -1421,11 +1421,11 @@
   // The following || allows only one side to be void (a GCC-ism).
   if (lexT->isVoidType() || rexT->isVoidType()) {
     if (!lexT->isVoidType())
-      Diag(rex->getLocStart(), diag::ext_typecheck_cond_one_void, 
-           rex->getSourceRange());
+      Diag(rex->getLocStart(), diag::ext_typecheck_cond_one_void)
+        << rex->getSourceRange();
     if (!rexT->isVoidType())
-      Diag(lex->getLocStart(), diag::ext_typecheck_cond_one_void,
-           lex->getSourceRange());
+      Diag(lex->getLocStart(), diag::ext_typecheck_cond_one_void)
+        << lex->getSourceRange();
     ImpCastExprToType(lex, Context.VoidTy);
     ImpCastExprToType(rex, Context.VoidTy);
     return Context.VoidTy;
@@ -2387,9 +2387,9 @@
   }
 
   if (NeedType)
-    S.Diag(Loc, Diag, E->getType().getAsString(), E->getSourceRange());
+    S.Diag(Loc, Diag) << E->getType().getAsString() << E->getSourceRange();
   else
-    S.Diag(Loc, Diag, E->getSourceRange());
+    S.Diag(Loc, Diag) << E->getSourceRange();
   return true;
 }
 
@@ -2464,21 +2464,21 @@
   // C99 6.5.2.4p1: We allow complex as a GCC extension.
   if (const PointerType *pt = resType->getAsPointerType()) {
     if (pt->getPointeeType()->isVoidType()) {
-      Diag(OpLoc, diag::ext_gnu_void_ptr, op->getSourceRange());
+      Diag(OpLoc, diag::ext_gnu_void_ptr) << op->getSourceRange();
     } else if (!pt->getPointeeType()->isObjectType()) {
       // C99 6.5.2.4p2, 6.5.6p2
-      Diag(OpLoc, diag::err_typecheck_arithmetic_incomplete_type,
-           resType.getAsString(), op->getSourceRange());
+      Diag(OpLoc, diag::err_typecheck_arithmetic_incomplete_type)
+        << resType.getAsString() << op->getSourceRange();
       return QualType();
     }
   } else if (!resType->isRealType()) {
     if (resType->isComplexType()) 
       // C99 does not support ++/-- on complex types.
-      Diag(OpLoc, diag::ext_integer_increment_complex,
-           resType.getAsString(), op->getSourceRange());
+      Diag(OpLoc, diag::ext_integer_increment_complex)
+        << resType.getAsString() << op->getSourceRange();
     else {
-      Diag(OpLoc, diag::err_typecheck_illegal_increment_decrement,
-           resType.getAsString(), op->getSourceRange());
+      Diag(OpLoc, diag::err_typecheck_illegal_increment_decrement)
+        << resType.getAsString() << op->getSourceRange();
       return QualType();
     }
   }
@@ -2595,8 +2595,8 @@
   if (lval != Expr::LV_Valid) { // C99 6.5.3.2p1
     if (!dcl || !isa<FunctionDecl>(dcl)) {// allow function designators
       // FIXME: emit more specific diag...
-      Diag(OpLoc, diag::err_typecheck_invalid_lvalue_addrof, 
-           op->getSourceRange());
+      Diag(OpLoc, diag::err_typecheck_invalid_lvalue_addrof)
+        << op->getSourceRange();
       return QualType();
     }
   } else if (MemberExpr *MemExpr = dyn_cast<MemberExpr>(op)) { // C99 6.5.3.2p1
@@ -3069,8 +3069,8 @@
   // offsetof with non-identifier designators (e.g. "offsetof(x, a.b[c])") are a
   // GCC extension, diagnose them.
   if (NumComponents != 1)
-    Diag(BuiltinLoc, diag::ext_offsetof_extended_field_designator,
-         SourceRange(CompPtr[1].LocStart, CompPtr[NumComponents-1].LocEnd));
+    Diag(BuiltinLoc, diag::ext_offsetof_extended_field_designator)
+      << SourceRange(CompPtr[1].LocStart, CompPtr[NumComponents-1].LocEnd);
   
   for (unsigned i = 0; i != NumComponents; ++i) {
     const OffsetOfComponent &OC = CompPtr[i];
@@ -3088,8 +3088,8 @@
       // C99 6.5.2.1p1
       Expr *Idx = static_cast<Expr*>(OC.U.E);
       if (!Idx->getType()->isIntegerType())
-        return Diag(Idx->getLocStart(), diag::err_typecheck_subscript,
-                    Idx->getSourceRange());
+        return Diag(Idx->getLocStart(), diag::err_typecheck_subscript)
+          << Idx->getSourceRange();
       
       Res = new ArraySubscriptExpr(Res, Idx, AT->getElementType(), OC.LocEnd);
       continue;
@@ -3147,8 +3147,8 @@
   llvm::APSInt condEval(32);
   SourceLocation ExpLoc;
   if (!CondExpr->isIntegerConstantExpr(condEval, Context, &ExpLoc))
-    return Diag(ExpLoc, diag::err_typecheck_choose_expr_requires_constant,
-                 CondExpr->getSourceRange());
+    return Diag(ExpLoc, diag::err_typecheck_choose_expr_requires_constant)
+      << CondExpr->getSourceRange();
 
   // If the condition is > zero, then the AST type is the same as the LSHExpr.
   QualType resType = condEval.getZExtValue() ? LHSExpr->getType() : 
@@ -3277,8 +3277,8 @@
                                          SourceLocation RParenLoc) {
   // __builtin_overload requires at least 2 arguments
   if (NumArgs < 2)
-    return Diag(RParenLoc, diag::err_typecheck_call_too_few_args,
-                SourceRange(BuiltinLoc, RParenLoc));
+    return Diag(RParenLoc, diag::err_typecheck_call_too_few_args)
+      << SourceRange(BuiltinLoc, RParenLoc);
 
   // The first argument is required to be a constant expression.  It tells us
   // the number of arguments to pass to each of the functions to be overloaded.
@@ -3287,18 +3287,18 @@
   llvm::APSInt constEval(32);
   SourceLocation ExpLoc;
   if (!NParamsExpr->isIntegerConstantExpr(constEval, Context, &ExpLoc))
-    return Diag(ExpLoc, diag::err_overload_expr_requires_non_zero_constant,
-                NParamsExpr->getSourceRange());
+    return Diag(ExpLoc, diag::err_overload_expr_requires_non_zero_constant)
+      << NParamsExpr->getSourceRange();
   
   // Verify that the number of parameters is > 0
   unsigned NumParams = constEval.getZExtValue();
   if (NumParams == 0)
-    return Diag(ExpLoc, diag::err_overload_expr_requires_non_zero_constant,
-                NParamsExpr->getSourceRange());
+    return Diag(ExpLoc, diag::err_overload_expr_requires_non_zero_constant)
+      << NParamsExpr->getSourceRange();
   // Verify that we have at least 1 + NumParams arguments to the builtin.
   if ((NumParams + 1) > NumArgs)
-    return Diag(RParenLoc, diag::err_typecheck_call_too_few_args,
-                SourceRange(BuiltinLoc, RParenLoc));
+    return Diag(RParenLoc, diag::err_typecheck_call_too_few_args)
+      << SourceRange(BuiltinLoc, RParenLoc);
 
   // Figure out the return type, by matching the args to one of the functions
   // listed after the parameters.
@@ -3315,16 +3315,16 @@
     // parameters, and the number of parameters must match the value passed to
     // the builtin.
     if (!FnType || (FnType->getNumArgs() != NumParams))
-      return Diag(Fn->getExprLoc(), diag::err_overload_incorrect_fntype, 
-                  Fn->getSourceRange());
+      return Diag(Fn->getExprLoc(), diag::err_overload_incorrect_fntype)
+        << Fn->getSourceRange();
 
     // Scan the parameter list for the FunctionType, checking the QualType of
     // each parameter against the QualTypes of the arguments to the builtin.
     // If they match, return a new OverloadExpr.
     if (ExprsMatchFnType(Args+1, FnType, Context)) {
       if (OE)
-        return Diag(Fn->getExprLoc(), diag::err_overload_multiple_match,
-                    OE->getFn()->getSourceRange());
+        return Diag(Fn->getExprLoc(), diag::err_overload_multiple_match)
+          << OE->getFn()->getSourceRange();
       // Remember our match, and continue processing the remaining arguments
       // to catch any errors.
       OE = new OverloadExpr(Args, NumArgs, i, 

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

==============================================================================
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Tue Nov 18 23:27:50 2008
@@ -156,8 +156,8 @@
   // be a class with a suitably declared constructor.
   //
   if (NumExprs > 1)
-    return Diag(CommaLocs[0], diag::err_builtin_func_cast_more_than_one_arg,
-                FullRange);
+    return Diag(CommaLocs[0], diag::err_builtin_func_cast_more_than_one_arg)
+      << FullRange;
 
   assert(NumExprs == 0 && "Expected 0 expressions");
 
@@ -167,10 +167,10 @@
   // rvalue of the specified type, which is value-initialized.
   //
   if (Ty->isArrayType())
-    return Diag(TyBeginLoc, diag::err_value_init_for_array_type, FullRange);
+    return Diag(TyBeginLoc, diag::err_value_init_for_array_type) << FullRange;
   if (Ty->isIncompleteType() && !Ty->isVoidType())
-    return Diag(TyBeginLoc, diag::err_invalid_incomplete_type_use,
-                Ty.getAsString(), FullRange);
+    return Diag(TyBeginLoc, diag::err_invalid_incomplete_type_use) 
+      << Ty.getAsString() << FullRange;
 
   return new CXXZeroInitValueExpr(Ty, TyBeginLoc, RParenLoc);
 }
@@ -199,11 +199,11 @@
   if (Ty->isFunctionType()) { // The declarator shall not specify a function...
     // We exit without creating a CXXConditionDeclExpr because a FunctionDecl
     // would be created and CXXConditionDeclExpr wants a VarDecl.
-    return Diag(StartLoc, diag::err_invalid_use_of_function_type,
-                SourceRange(StartLoc, EqualLoc));
+    return Diag(StartLoc, diag::err_invalid_use_of_function_type)
+      << SourceRange(StartLoc, EqualLoc);
   } else if (Ty->isArrayType()) { // ...or an array.
-    Diag(StartLoc, diag::err_invalid_use_of_array_type,
-         SourceRange(StartLoc, EqualLoc));
+    Diag(StartLoc, diag::err_invalid_use_of_array_type)
+      << SourceRange(StartLoc, EqualLoc);
   } else if (const RecordType *RT = Ty->getAsRecordType()) {
     RecordDecl *RD = RT->getDecl();
     // The type-specifier-seq shall not declare a new class...

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

==============================================================================
--- cfe/trunk/lib/Sema/SemaInit.cpp (original)
+++ cfe/trunk/lib/Sema/SemaInit.cpp Tue Nov 18 23:27:50 2008
@@ -110,20 +110,20 @@
         SemaRef->IsStringLiteralInit(IList->getInit(Index), T)) {
       // Special-case
       SemaRef->Diag(IList->getInit(Index)->getLocStart(),
-                    diag::err_excess_initializers_in_char_array_initializer,
-                    IList->getInit(Index)->getSourceRange());
+                    diag::err_excess_initializers_in_char_array_initializer)
+        << IList->getInit(Index)->getSourceRange();
       hadError = true; 
     } else if (!T->isIncompleteType()) {
       // Don't warn for incomplete types, since we'll get an error elsewhere
       SemaRef->Diag(IList->getInit(Index)->getLocStart(), 
-                    diag::warn_excess_initializers, 
-                    IList->getInit(Index)->getSourceRange());
+                    diag::warn_excess_initializers)
+        << IList->getInit(Index)->getSourceRange();
     }
   }
 
   if (T->isScalarType())
-    SemaRef->Diag(IList->getLocStart(), diag::warn_braces_around_scalar_init, 
-                  IList->getSourceRange());
+    SemaRef->Diag(IList->getLocStart(), diag::warn_braces_around_scalar_init)
+      << IList->getSourceRange();
 }
 
 void InitListChecker::CheckListElementTypes(InitListExpr *IList,
@@ -185,8 +185,8 @@
     Expr* expr = IList->getInit(Index);
     if (isa<InitListExpr>(expr)) {
       SemaRef->Diag(IList->getLocStart(),
-                    diag::err_many_braces_around_scalar_init, 
-                    IList->getSourceRange());
+                    diag::err_many_braces_around_scalar_init)
+        << IList->getSourceRange();
       hadError = true;
       ++Index;
       return;
@@ -199,9 +199,8 @@
       IList->setInit(Index, expr);
     ++Index;
   } else {
-    SemaRef->Diag(IList->getLocStart(),
-                  diag::err_empty_scalar_initializer, 
-                  IList->getSourceRange());
+    SemaRef->Diag(IList->getLocStart(), diag::err_empty_scalar_initializer)
+      << IList->getSourceRange();
     hadError = true;
     return;
   }
@@ -240,8 +239,8 @@
     // earlier, but I don't know where clang accepts VLAs (gcc accepts
     // them in all sorts of strange places).
     SemaRef->Diag(VAT->getSizeExpr()->getLocStart(),
-                  diag::err_variable_object_no_init,
-                  VAT->getSizeExpr()->getSourceRange());
+                  diag::err_variable_object_no_init)
+      << VAT->getSizeExpr()->getSourceRange();
     hadError = true;
     return;
   }

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

==============================================================================
--- cfe/trunk/lib/Sema/SemaStmt.cpp (original)
+++ cfe/trunk/lib/Sema/SemaStmt.cpp Tue Nov 18 23:27:50 2008
@@ -128,15 +128,15 @@
   SourceLocation ExpLoc;
   // C99 6.8.4.2p3: The expression shall be an integer constant.
   if (!LHSVal->isIntegerConstantExpr(Context, &ExpLoc)) {
-    Diag(ExpLoc, diag::err_case_label_not_integer_constant_expr,
-         LHSVal->getSourceRange());
+    Diag(ExpLoc, diag::err_case_label_not_integer_constant_expr)
+      << LHSVal->getSourceRange();
     return SubStmt;
   }
 
   // GCC extension: The expression shall be an integer constant.
   if (RHSVal && !RHSVal->isIntegerConstantExpr(Context, &ExpLoc)) {
-    Diag(ExpLoc, diag::err_case_label_not_integer_constant_expr,
-         RHSVal->getSourceRange());
+    Diag(ExpLoc, diag::err_case_label_not_integer_constant_expr)
+      << RHSVal->getSourceRange();
     RHSVal = 0;  // Recover by just forgetting about it.
   }
   
@@ -458,9 +458,9 @@
       
       // If the low value is bigger than the high value, the case is empty.
       if (CaseRanges[i].first > HiVal) {
-        Diag(CR->getLHS()->getLocStart(), diag::warn_case_empty_range,
-             SourceRange(CR->getLHS()->getLocStart(),
-                         CR->getRHS()->getLocEnd()));
+        Diag(CR->getLHS()->getLocStart(), diag::warn_case_empty_range)
+          << SourceRange(CR->getLHS()->getLocStart(),
+                         CR->getRHS()->getLocEnd());
         CaseRanges.erase(CaseRanges.begin()+i);
         --i, --e;
         continue;
@@ -625,21 +625,21 @@
       Expr::isLvalueResult lval = cast<Expr>(First)->isLvalue(Context);
       
       if (lval != Expr::LV_Valid)
-        return Diag(First->getLocStart(), diag::err_selector_element_not_lvalue,
-                    First->getSourceRange());
+        return Diag(First->getLocStart(), diag::err_selector_element_not_lvalue)
+          << First->getSourceRange();
 
       FirstType = static_cast<Expr*>(first)->getType();        
     }
     if (!Context.isObjCObjectPointerType(FirstType))
-        Diag(ForLoc, diag::err_selector_element_type,
-             FirstType.getAsString(), First->getSourceRange());          
+        Diag(ForLoc, diag::err_selector_element_type)
+          << FirstType.getAsString() << First->getSourceRange();
   }
   if (Second) {
     DefaultFunctionArrayConversion(Second);
     QualType SecondType = Second->getType();
     if (!Context.isObjCObjectPointerType(SecondType))
-      Diag(ForLoc, diag::err_collection_expr_type,
-           SecondType.getAsString(), Second->getSourceRange());
+      Diag(ForLoc, diag::err_collection_expr_type)
+        << SecondType.getAsString() << Second->getSourceRange();
   }
   return new ObjCForCollectionStmt(First, Second, Body, ForLoc, RParenLoc);
 }
@@ -814,16 +814,16 @@
   // The parser verifies that there is a string literal here.
   if (AsmString->isWide())
     // FIXME: We currently leak memory here.
-    return Diag(AsmString->getLocStart(), diag::err_asm_wide_character,
-                AsmString->getSourceRange());
+    return Diag(AsmString->getLocStart(), diag::err_asm_wide_character)
+      << AsmString->getSourceRange();
   
   
   for (unsigned i = 0; i != NumOutputs; i++) {
     StringLiteral *Literal = Constraints[i];
     if (Literal->isWide())
       // FIXME: We currently leak memory here.
-      return Diag(Literal->getLocStart(), diag::err_asm_wide_character,
-                  Literal->getSourceRange());
+      return Diag(Literal->getLocStart(), diag::err_asm_wide_character)
+        << Literal->getSourceRange();
     
     std::string OutputConstraint(Literal->getStrData(), 
                                  Literal->getByteLength());
@@ -840,8 +840,8 @@
     if (Result != Expr::LV_Valid) {
       // FIXME: We currently leak memory here.
       return Diag(OutputExpr->getSubExpr()->getLocStart(), 
-                  diag::err_asm_invalid_lvalue_in_output,
-                  OutputExpr->getSubExpr()->getSourceRange());
+                  diag::err_asm_invalid_lvalue_in_output)
+        << OutputExpr->getSubExpr()->getSourceRange();
     }
   }
   
@@ -849,8 +849,8 @@
     StringLiteral *Literal = Constraints[i];
     if (Literal->isWide())
       // FIXME: We currently leak memory here.
-      return Diag(Literal->getLocStart(), diag::err_asm_wide_character,
-                  Literal->getSourceRange());
+      return Diag(Literal->getLocStart(), diag::err_asm_wide_character)
+        << Literal->getSourceRange();
     
     std::string InputConstraint(Literal->getStrData(), 
                                 Literal->getByteLength());
@@ -860,7 +860,7 @@
                                                 NumOutputs, info)) {
       // FIXME: We currently leak memory here.
       return Diag(Literal->getLocStart(),
-                  diag::err_asm_invalid_input_constraint, InputConstraint);
+                  diag::err_asm_invalid_input_constraint) << InputConstraint;
     }
     
     // Check that the input exprs aren't of type void.
@@ -880,8 +880,8 @@
     StringLiteral *Literal = Clobbers[i];
     if (Literal->isWide())
       // FIXME: We currently leak memory here.
-      return Diag(Literal->getLocStart(), diag::err_asm_wide_character,
-                  Literal->getSourceRange());
+      return Diag(Literal->getLocStart(), diag::err_asm_wide_character)
+        << Literal->getSourceRange();
     
     llvm::SmallString<16> Clobber(Literal->getStrData(), 
                                   Literal->getStrData() + 

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

==============================================================================
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Tue Nov 18 23:27:50 2008
@@ -405,14 +405,14 @@
         // have a value greater than zero.
         if (ConstVal.isSigned()) {
           if (ConstVal.isNegative()) {
-            Diag(ArraySize->getLocStart(), 
-                 diag::err_typecheck_negative_array_size,
-                 ArraySize->getSourceRange());
+            Diag(ArraySize->getLocStart(),
+                 diag::err_typecheck_negative_array_size)
+              << ArraySize->getSourceRange();
             D.setInvalidType(true);
           } else if (ConstVal == 0) {
             // GCC accepts zero sized static arrays.
-            Diag(ArraySize->getLocStart(), diag::ext_typecheck_zero_array_size,
-                 ArraySize->getSourceRange());
+            Diag(ArraySize->getLocStart(), diag::ext_typecheck_zero_array_size)
+              << ArraySize->getSourceRange();
           }
         } 
         T = Context.getConstantArrayType(T, ConstVal, ASM, ATI.TypeQuals);
@@ -663,8 +663,8 @@
   Expr *ASArgExpr = static_cast<Expr *>(Attr.getArg(0));
   llvm::APSInt addrSpace(32);
   if (!ASArgExpr->isIntegerConstantExpr(addrSpace, S.Context)) {
-    S.Diag(Attr.getLoc(), diag::err_attribute_address_space_not_int,
-           ASArgExpr->getSourceRange());
+    S.Diag(Attr.getLoc(), diag::err_attribute_address_space_not_int)
+      << ASArgExpr->getSourceRange();
     return;
   }
 





More information about the cfe-commits mailing list