From: Justin Bogner Date: Thu, 22 May 2014 06:04:59 +0000 (+0000) Subject: Frontend: Propagate ASTReaderListener API in ChainedASTReaderListener X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1787f2e94d28c5520c13830cf283f986f848c41c;p=clang 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209394 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Serialization/ASTReader.cpp b/lib/Serialization/ASTReader.cpp index 4de9919c88..143a7386ff 100644 --- a/lib/Serialization/ASTReader.cpp +++ b/lib/Serialization/ASTReader.cpp @@ -135,8 +135,14 @@ void ChainedASTReaderListener::visitModuleFile(StringRef Filename) { 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; } //===----------------------------------------------------------------------===//