[cfe-commits] r80182 - in /cfe/trunk/lib/Sema: Sema.h SemaCXXCast.cpp SemaCXXScopeSpec.cpp SemaDecl.cpp SemaDeclCXX.cpp SemaExpr.cpp SemaExprCXX.cpp SemaOverload.cpp SemaType.cpp

Anders Carlsson andersca at mac.com
Wed Aug 26 16:45:07 PDT 2009


Author: andersca
Date: Wed Aug 26 18:45:07 2009
New Revision: 80182

URL: http://llvm.org/viewvc/llvm-project?rev=80182&view=rev
Log:
Bye-bye old RequireCompleteType.

Modified:
    cfe/trunk/lib/Sema/Sema.h
    cfe/trunk/lib/Sema/SemaCXXCast.cpp
    cfe/trunk/lib/Sema/SemaCXXScopeSpec.cpp
    cfe/trunk/lib/Sema/SemaDecl.cpp
    cfe/trunk/lib/Sema/SemaDeclCXX.cpp
    cfe/trunk/lib/Sema/SemaExpr.cpp
    cfe/trunk/lib/Sema/SemaExprCXX.cpp
    cfe/trunk/lib/Sema/SemaOverload.cpp
    cfe/trunk/lib/Sema/SemaType.cpp

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

==============================================================================
--- cfe/trunk/lib/Sema/Sema.h (original)
+++ cfe/trunk/lib/Sema/Sema.h Wed Aug 26 18:45:07 2009
@@ -483,8 +483,6 @@
 
   virtual TypeResult ActOnTypeName(Scope *S, Declarator &D);
 
-  bool RequireCompleteType(SourceLocation Loc, QualType T, unsigned diag,
-                           SourceRange Range1 = SourceRange());
   bool RequireCompleteType(SourceLocation Loc, QualType T,
                            const PartialDiagnostic &PD);
   

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

==============================================================================
--- cfe/trunk/lib/Sema/SemaCXXCast.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCXXCast.cpp Wed Aug 26 18:45:07 2009
@@ -15,6 +15,7 @@
 #include "SemaInherit.h"
 #include "clang/AST/ExprCXX.h"
 #include "clang/AST/ASTContext.h"
+#include "clang/Basic/PartialDiagnostic.h"
 #include "llvm/ADT/SmallVector.h"
 #include <set>
 using namespace clang;
@@ -227,8 +228,8 @@
     assert(DestPointer && "Reference to void is not possible");
   } else if (DestRecord) {
     if (Self.RequireCompleteType(OpRange.getBegin(), DestPointee,
-                                    diag::err_bad_dynamic_cast_incomplete,
-                                    DestRange))
+                                 PDiag(diag::err_bad_dynamic_cast_incomplete)
+                                   << DestRange))
       return;
   } else {
     Self.Diag(OpRange.getBegin(), diag::err_bad_dynamic_cast_not_class)
@@ -265,8 +266,8 @@
   const RecordType *SrcRecord = SrcPointee->getAs<RecordType>();
   if (SrcRecord) {
     if (Self.RequireCompleteType(OpRange.getBegin(), SrcPointee,
-                                    diag::err_bad_dynamic_cast_incomplete,
-                                    SrcExpr->getSourceRange()))
+                                 PDiag(diag::err_bad_dynamic_cast_incomplete)
+                                   << SrcExpr->getSourceRange()))
       return;
   } else {
     Self.Diag(OpRange.getBegin(), diag::err_bad_dynamic_cast_not_class)

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

==============================================================================
--- cfe/trunk/lib/Sema/SemaCXXScopeSpec.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCXXScopeSpec.cpp Wed Aug 26 18:45:07 2009
@@ -16,6 +16,7 @@
 #include "clang/AST/DeclTemplate.h"
 #include "clang/AST/ExprCXX.h"
 #include "clang/AST/NestedNameSpecifier.h"
+#include "clang/Basic/PartialDiagnostic.h"
 #include "clang/Parse/DeclSpec.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/Support/raw_ostream.h"
@@ -229,8 +230,8 @@
     // The type must be complete.
     return RequireCompleteType(SS.getRange().getBegin(),
                                Context.getTypeDeclType(Tag),
-                               diag::err_incomplete_nested_name_spec,
-                               SS.getRange());
+                               PDiag(diag::err_incomplete_nested_name_spec)
+                                 << SS.getRange());
   }
 
   return false;

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

==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Wed Aug 26 18:45:07 2009
@@ -23,8 +23,9 @@
 #include "clang/AST/StmtCXX.h"
 #include "clang/AST/StmtObjC.h"
 #include "clang/Parse/DeclSpec.h"
-#include "clang/Basic/TargetInfo.h"
+#include "clang/Basic/PartialDiagnostic.h"
 #include "clang/Basic/SourceManager.h"
+#include "clang/Basic/TargetInfo.h"
 // FIXME: layering (ideally, Sema shouldn't be dependent on Lex API's)
 #include "clang/Lex/Preprocessor.h"
 #include "clang/Lex/HeaderSearch.h" 

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

==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Wed Aug 26 18:45:07 2009
@@ -18,6 +18,7 @@
 #include "clang/AST/DeclVisitor.h"
 #include "clang/AST/TypeOrdering.h"
 #include "clang/AST/StmtVisitor.h"
+#include "clang/Basic/PartialDiagnostic.h"
 #include "clang/Lex/Preprocessor.h"
 #include "clang/Parse/DeclSpec.h"
 #include "llvm/ADT/STLExtras.h"
@@ -390,8 +391,9 @@
   // C++ [class.derived]p2:
   //   The class-name in a base-specifier shall not be an incompletely
   //   defined class.
-  if (RequireCompleteType(BaseLoc, BaseType, diag::err_incomplete_base_class,
-                          SpecifierRange))
+  if (RequireCompleteType(BaseLoc, BaseType, 
+                          PDiag(diag::err_incomplete_base_class)
+                            << SpecifierRange))
     return 0;
 
   // If the base class is polymorphic or isn't empty, the new one is/isn't, too.

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

==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Wed Aug 26 18:45:07 2009
@@ -1347,8 +1347,8 @@
   
   if (RequireCompleteType(OpLoc, exprType,
                           isSizeof ? diag::err_sizeof_incomplete_type : 
-                          diag::err_alignof_incomplete_type,
-                          ExprRange))
+                          PDiag(diag::err_alignof_incomplete_type)
+                            << ExprRange))
     return true;
   
   // Reject sizeof(interface) and sizeof(interface<proto>) in 64-bit mode.
@@ -1799,8 +1799,9 @@
   }
   
   if (!ResultType->isDependentType() &&
-      RequireCompleteType(LLoc, ResultType, diag::err_subscript_incomplete_type,
-                          BaseExpr->getSourceRange()))
+      RequireCompleteType(LLoc, ResultType, 
+                          PDiag(diag::err_subscript_incomplete_type)
+                            << BaseExpr->getSourceRange()))
     return ExprError();
   
   // Diagnose bad cases where we step over interface counts.
@@ -2047,8 +2048,8 @@
   if (const RecordType *RTy = BaseType->getAs<RecordType>()) {
     RecordDecl *RDecl = RTy->getDecl();
     if (RequireCompleteType(OpLoc, BaseType,
-                               diag::err_typecheck_incomplete_tag,
-                               BaseExpr->getSourceRange()))
+                            PDiag(diag::err_typecheck_incomplete_tag)
+                              << BaseExpr->getSourceRange()))
       return ExprError();
 
     DeclContext *DC = RDecl;
@@ -2564,8 +2565,8 @@
 
       if (RequireCompleteType(Arg->getSourceRange().getBegin(),
                               ProtoArgType,
-                              diag::err_call_incomplete_argument,
-                              Arg->getSourceRange()))
+                              PDiag(diag::err_call_incomplete_argument)
+                                << Arg->getSourceRange()))
         return true;
 
       // Pass the argument.
@@ -2801,8 +2802,8 @@
   if (!FuncT->getResultType()->isVoidType() &&
       RequireCompleteType(Fn->getSourceRange().getBegin(),
                           FuncT->getResultType(),
-                          diag::err_call_incomplete_return,
-                          TheCall->getSourceRange()))
+                          PDiag(diag::err_call_incomplete_return)
+                            << TheCall->getSourceRange()))
     return ExprError();
 
   // We know the result type of the call, set it.
@@ -2835,8 +2836,8 @@
       DefaultArgumentPromotion(Arg);
       if (RequireCompleteType(Arg->getSourceRange().getBegin(),
                               Arg->getType(),
-                              diag::err_call_incomplete_argument,
-                              Arg->getSourceRange()))
+                              PDiag(diag::err_call_incomplete_argument)
+                                << Arg->getSourceRange()))
         return ExprError();
       TheCall->setArg(i, Arg);
     }
@@ -2882,8 +2883,9 @@
         << SourceRange(LParenLoc, literalExpr->getSourceRange().getEnd()));
   } else if (!literalType->isDependentType() &&
              RequireCompleteType(LParenLoc, literalType,
-                                 diag::err_typecheck_decl_incomplete_type,
-                SourceRange(LParenLoc, literalExpr->getSourceRange().getEnd())))
+                      PDiag(diag::err_typecheck_decl_incomplete_type)
+                        << SourceRange(LParenLoc, 
+                                       literalExpr->getSourceRange().getEnd())))
     return ExprError();
 
   if (CheckInitializerTypes(literalExpr, literalType, LParenLoc,
@@ -4626,8 +4628,8 @@
   case Expr::MLV_IncompleteType:
   case Expr::MLV_IncompleteVoidType:
     return S.RequireCompleteType(Loc, E->getType(),
-                      diag::err_typecheck_incomplete_type_not_modifiable_lvalue,
-                                    E->getSourceRange());
+                PDiag(diag::err_typecheck_incomplete_type_not_modifiable_lvalue)
+                  << E->getSourceRange());
   case Expr::MLV_DuplicateVectorComponents:
     Diag = diag::err_typecheck_duplicate_vector_components_not_mlvalue;
     break;

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

==============================================================================
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Wed Aug 26 18:45:07 2009
@@ -272,7 +272,8 @@
                           diag::err_value_init_for_array_type) << FullRange);
   if (!Ty->isDependentType() && !Ty->isVoidType() &&
       RequireCompleteType(TyBeginLoc, Ty,
-                          diag::err_invalid_incomplete_type_use, FullRange))
+                          PDiag(diag::err_invalid_incomplete_type_use)
+                            << FullRange))
     return ExprError();
 
   if (RequireNonAbstractType(TyBeginLoc, Ty,
@@ -486,8 +487,8 @@
       << AllocType << 1 << R;
   else if (!AllocType->isDependentType() &&
            RequireCompleteType(Loc, AllocType,
-                               diag::err_new_incomplete_type,
-                               R))
+                               PDiag(diag::err_new_incomplete_type)
+                                 << R))
     return true;
   else if (RequireNonAbstractType(Loc, AllocType,
                                   diag::err_allocation_of_abstract_type))
@@ -727,8 +728,8 @@
         << Type << Ex->getSourceRange());
     else if (!Pointee->isDependentType() &&
              RequireCompleteType(StartLoc, Pointee, 
-                                 diag::warn_delete_incomplete,
-                                 Ex->getSourceRange()))
+                                 PDiag(diag::warn_delete_incomplete)
+                                   << Ex->getSourceRange()))
       return ExprError();
 
     // FIXME: This should be shared with the code for finding the delete 

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

==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Wed Aug 26 18:45:07 2009
@@ -19,6 +19,7 @@
 #include "clang/AST/Expr.h"
 #include "clang/AST/ExprCXX.h"
 #include "clang/AST/TypeOrdering.h"
+#include "clang/Basic/PartialDiagnostic.h"
 #include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/Support/Compiler.h"
@@ -1392,8 +1393,9 @@
 
   if (!AllowConversionFunctions) {
     // Don't allow any conversion functions to enter the overload set.
-  } else if (RequireCompleteType(From->getLocStart(), From->getType(), 0, 
-                                 From->getSourceRange())) {
+  } else if (RequireCompleteType(From->getLocStart(), From->getType(), 
+                                 PDiag(0) 
+                                   << From->getSourceRange())) {
     // No conversion functions from incomplete types.
   } else if (const RecordType *FromRecordType 
                = From->getType()->getAs<RecordType>()) {

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

==============================================================================
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Wed Aug 26 18:45:07 2009
@@ -1751,31 +1751,11 @@
 ///
 /// @param T  The type that this routine is examining for completeness.
 ///
-/// @param diag The diagnostic value (e.g., 
-/// @c diag::err_typecheck_decl_incomplete_type) that will be used
-/// for the error message if @p T is incomplete. If 0, no diagnostic will be
-/// emitted.
-///
-/// @param Range1  An optional range in the source code that will be a
-/// part of the "incomplete type" error message.
-///
-/// @param Range2  An optional range in the source code that will be a
-/// part of the "incomplete type" error message.
-///
-/// @param PrintType If non-NULL, the type that should be printed
-/// instead of @p T. This parameter should be used when the type that
-/// we're checking for incompleteness isn't the type that should be
-/// displayed to the user, e.g., when T is a type and PrintType is a
-/// pointer to T.
+/// @param PD The partial diagnostic that will be printed out if T is not a 
+/// complete type.
 ///
 /// @returns @c true if @p T is incomplete and a diagnostic was emitted,
 /// @c false otherwise.
-bool Sema::RequireCompleteType(SourceLocation Loc, QualType T, unsigned diag,
-                               SourceRange Range1) {
-  return RequireCompleteType(Loc, T, 
-                             PDiag(diag) << Range1);
-}
-
 bool Sema::RequireCompleteType(SourceLocation Loc, QualType T,
                                const PartialDiagnostic &PD) {
   unsigned diag = PD.getDiagID();





More information about the cfe-commits mailing list