r209394 - Frontend: Propagate ASTReaderListener API in ChainedASTReaderListener
Justin Bogner
mail at justinbogner.com
Wed May 21 23:04:59 PDT 2014
Author: bogner
Date: Thu May 22 01:04:59 2014
New Revision: 209394
URL: http://llvm.org/viewvc/llvm-project?rev=209394&view=rev
Log:
Frontend: Propagate ASTReaderListener API in ChainedASTReaderListener
ASTReaderListener's documentation states that visitInputFile will be
called based on the return values of needsInputFileVisitation and
needsSystemInputFileVisitation, but ChainedASTReaderListener may call
these methods on a child listener based on the values returned by the
other child.
Even worse, the calls to visitInputFile may be short-circuited due to
the use of the boolean or, so the calls to visit may not occur at all
for the second listener.
This updates ChainedASTReaderListener::visitInputFile to propagate the
ASTReaderListener behaviour to both children.
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=209394&r1=209393&r2=209394&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReader.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReader.cpp Thu May 22 01:04:59 2014
@@ -135,8 +135,14 @@ void ChainedASTReaderListener::visitModu
bool ChainedASTReaderListener::visitInputFile(StringRef Filename,
bool isSystem,
bool isOverridden) {
- return First->visitInputFile(Filename, isSystem, isOverridden) ||
- Second->visitInputFile(Filename, isSystem, isOverridden);
+ bool Continue = false;
+ if (First->needsInputFileVisitation() &&
+ (!isSystem || First->needsSystemInputFileVisitation()))
+ Continue |= First->visitInputFile(Filename, isSystem, isOverridden);
+ if (Second->needsInputFileVisitation() &&
+ (!isSystem || Second->needsSystemInputFileVisitation()))
+ Continue |= Second->visitInputFile(Filename, isSystem, isOverridden);
+ return Continue;
}
//===----------------------------------------------------------------------===//
More information about the cfe-commits
mailing list