diff options
author | Anders Carlsson <andersca@mac.com> | 2009-08-26 22:33:56 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2009-08-26 22:33:56 +0000 |
commit | 91a0cc913ecc5619b76d2e40742fd09725be8c56 (patch) | |
tree | f5f5103665ae2a3c9f22f874cc0a03005b65911b /lib/Sema/SemaType.cpp | |
parent | 022fb28d79829c40c9b3a3bdd400dcacea495e26 (diff) |
Add a RequireCompleteType variant that takes a PartialDiagnostic. The old RequireCompleteType now creates a PartialDiagnostic and calls the new function.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80165 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaType.cpp')
-rw-r--r-- | lib/Sema/SemaType.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp index 49946ac1c3..7775c25142 100644 --- a/lib/Sema/SemaType.cpp +++ b/lib/Sema/SemaType.cpp @@ -18,6 +18,7 @@ #include "clang/AST/DeclTemplate.h" #include "clang/AST/TypeLoc.h" #include "clang/AST/Expr.h" +#include "clang/Basic/PartialDiagnostic.h" #include "clang/Parse/DeclSpec.h" #include "llvm/ADT/SmallPtrSet.h" using namespace clang; @@ -1772,6 +1773,18 @@ void Sema::ProcessTypeAttributeList(QualType &Result, const AttributeList *AL) { bool Sema::RequireCompleteType(SourceLocation Loc, QualType T, unsigned diag, SourceRange Range1, SourceRange Range2, QualType PrintType) { + if (!PrintType.isNull()) + return RequireCompleteType(Loc, T, + PDiag(diag) << Range1 << Range2 << PrintType); + + return RequireCompleteType(Loc, T, + PDiag(diag) << Range1 << Range2); +} + +bool Sema::RequireCompleteType(SourceLocation Loc, QualType T, + const PartialDiagnostic &PD) { + unsigned diag = PD.getDiagID(); + // FIXME: Add this assertion to help us flush out problems with // checking for dependent types and type-dependent expressions. // @@ -1816,11 +1829,8 @@ bool Sema::RequireCompleteType(SourceLocation Loc, QualType T, unsigned diag, if (diag == 0) return true; - if (PrintType.isNull()) - PrintType = T; - // We have an incomplete type. Produce a diagnostic. - Diag(Loc, diag) << PrintType << Range1 << Range2; + Diag(Loc, PD) << T; // If the type was a forward declaration of a class/struct/union // type, produce |