diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-12-12 07:57:52 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-12-12 07:57:52 +0000 |
commit | 06d33699f11277a494c1118a0d25a83dab3bbd4c (patch) | |
tree | 61713de316eceb857586102887dd1930308fae8e /lib/Sema/Sema.h | |
parent | a63d40f85c4621f5ad2362e0d00879933625404b (diff) |
When certain diagnostics involving run-time behavior would be emitted
in a potentially potentially evaluated context, queue those
diagnostics and only emit them if the context ends up being
potentially evaluated. This completes the fix for PR5761.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91213 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/Sema.h')
-rw-r--r-- | lib/Sema/Sema.h | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h index baf9c23da5..ada8aa157a 100644 --- a/lib/Sema/Sema.h +++ b/lib/Sema/Sema.h @@ -339,6 +339,10 @@ public: typedef std::vector<std::pair<SourceLocation, Decl *> > PotentiallyReferencedDecls; + /// \brief A set of diagnostics that may be emitted. + typedef std::vector<std::pair<SourceLocation, PartialDiagnostic> > + PotentiallyEmittedDiagnostics; + /// \brief Data structure used to record current or nested /// expression evaluation contexts. struct ExpressionEvaluationContextRecord { @@ -358,10 +362,14 @@ public: /// evaluated. PotentiallyReferencedDecls *PotentiallyReferenced; + /// \brief The set of diagnostics to emit should this potentially + /// potentially-evaluated context become evaluated. + PotentiallyEmittedDiagnostics *PotentiallyDiagnosed; + ExpressionEvaluationContextRecord(ExpressionEvaluationContext Context, unsigned NumTemporaries) : Context(Context), NumTemporaries(NumTemporaries), - PotentiallyReferenced(0) { } + PotentiallyReferenced(0), PotentiallyDiagnosed(0) { } void addReferencedDecl(SourceLocation Loc, Decl *Decl) { if (!PotentiallyReferenced) @@ -369,9 +377,17 @@ public: PotentiallyReferenced->push_back(std::make_pair(Loc, Decl)); } + void addDiagnostic(SourceLocation Loc, const PartialDiagnostic &PD) { + if (!PotentiallyDiagnosed) + PotentiallyDiagnosed = new PotentiallyEmittedDiagnostics; + PotentiallyDiagnosed->push_back(std::make_pair(Loc, PD)); + } + void Destroy() { delete PotentiallyReferenced; + delete PotentiallyDiagnosed; PotentiallyReferenced = 0; + PotentiallyDiagnosed = 0; } }; |