r229167 - [modules] Guard against recursively re-entering diagnosing ODR violations while
Richard Smith
richard-llvm at metafoo.co.uk
Fri Feb 13 14:43:51 PST 2015
Author: rsmith
Date: Fri Feb 13 16:43:51 2015
New Revision: 229167
URL: http://llvm.org/viewvc/llvm-project?rev=229167&view=rev
Log:
[modules] Guard against recursively re-entering diagnosing ODR violations while
in the middle of emitting an ODR violation diagnostic. I don't yet have a
reduced testcase for this issue, working on it...
Modified:
cfe/trunk/lib/Serialization/ASTReader.cpp
Modified: cfe/trunk/lib/Serialization/ASTReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=229167&r1=229166&r2=229167&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReader.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReader.cpp Fri Feb 13 16:43:51 2015
@@ -8475,6 +8475,10 @@ void ASTReader::diagnoseOdrViolations()
// completed. We only really need to mark FieldDecls as invalid here.
if (!isa<TagDecl>(D))
D->setInvalidDecl();
+
+ // Ensure we don't accidentally recursively enter deserialization while
+ // we're producing our diagnostic.
+ Deserializing RecursionGuard(this);
std::string CanonDefModule =
getOwningModuleNameForDiagnostic(cast<Decl>(CanonDef));
@@ -8496,6 +8500,13 @@ void ASTReader::diagnoseOdrViolations()
}
}
+ if (OdrMergeFailures.empty())
+ return;
+
+ // Ensure we don't accidentally recursively enter deserialization while
+ // we're producing our diagnostics.
+ Deserializing RecursionGuard(this);
+
// Issue any pending ODR-failure diagnostics.
for (auto &Merge : OdrMergeFailures) {
// If we've already pointed out a specific problem with this class, don't
More information about the cfe-commits
mailing list