diff options
author | Douglas Gregor <dgregor@apple.com> | 2012-04-10 20:43:46 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2012-04-10 20:43:46 +0000 |
commit | 69a30b838c723cb1850de55cfa48a402cfeeb6e0 (patch) | |
tree | 9862f828934ae9c63773d3a3e57963327ada10bf /include | |
parent | abf65ce5ddfb8db0d34280d30a91253930732f4f (diff) |
When we determine that an initialization sequence failed due to an
incomplete type, keep track of the actual type that was
incomplete. Otherwise, we might fail to produce a diagnostic. Fixes
PR12498.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154432 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/clang/Sema/Initialization.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/clang/Sema/Initialization.h b/include/clang/Sema/Initialization.h index 23cc4455db..4433843ff8 100644 --- a/include/clang/Sema/Initialization.h +++ b/include/clang/Sema/Initialization.h @@ -734,6 +734,9 @@ private: /// \brief The candidate set created when initialization failed. OverloadCandidateSet FailedCandidateSet; + /// \brief The incomplete type that caused a failure. + QualType FailedIncompleteType; + /// \brief Prints a follow-up note that highlights the location of /// the initialized entity, if it's remote. void PrintInitLocationNote(Sema &S, const InitializedEntity &Entity); @@ -949,6 +952,8 @@ public: void SetFailed(FailureKind Failure) { SequenceKind = FailedSequence; this->Failure = Failure; + assert((Failure != FK_Incomplete || !FailedIncompleteType.isNull()) && + "Incomplete type failure requires a type!"); } /// \brief Note that this initialization sequence failed due to failed @@ -967,6 +972,13 @@ public: return FailedOverloadResult; } + /// \brief Note that this initialization sequence failed due to an + /// incomplete type. + void setIncompleteTypeFailure(QualType IncompleteType) { + FailedIncompleteType = IncompleteType; + SetFailed(FK_Incomplete); + } + /// \brief Determine why initialization failed. FailureKind getFailureKind() const { assert(Failed() && "Not an initialization failure!"); |