r203882 - [Modules] Make sure that the synthesized file "__inferred_module.map" doesn't show up as dependency of a module file.
Argyrios Kyrtzidis
akyrtzi at gmail.com
Thu Mar 13 19:26:31 PDT 2014
Author: akirtzidis
Date: Thu Mar 13 21:26:31 2014
New Revision: 203882
URL: http://llvm.org/viewvc/llvm-project?rev=203882&view=rev
Log:
[Modules] Make sure that the synthesized file "__inferred_module.map" doesn't show up as dependency of a module file.
Follow-up for rdar://15459210
Added:
cfe/trunk/test/Modules/dependency-gen-inferred-map.m
Modified:
cfe/trunk/include/clang/Serialization/ASTReader.h
cfe/trunk/lib/Frontend/DependencyFile.cpp
cfe/trunk/lib/Serialization/ASTReader.cpp
Modified: cfe/trunk/include/clang/Serialization/ASTReader.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTReader.h?rev=203882&r1=203881&r2=203882&view=diff
==============================================================================
--- cfe/trunk/include/clang/Serialization/ASTReader.h (original)
+++ cfe/trunk/include/clang/Serialization/ASTReader.h Thu Mar 13 21:26:31 2014
@@ -183,7 +183,10 @@ public:
/// system input files as well.
///
/// \returns true to continue receiving the next input file, false to stop.
- virtual bool visitInputFile(StringRef Filename, bool isSystem) { return true;}
+ virtual bool visitInputFile(StringRef Filename, bool isSystem,
+ bool isOverridden) {
+ return true;
+ }
};
/// \brief Simple wrapper class for chaining listeners.
@@ -214,7 +217,8 @@ public:
void ReadCounter(const serialization::ModuleFile &M, unsigned Value) override;
bool needsInputFileVisitation() override;
bool needsSystemInputFileVisitation() override;
- bool visitInputFile(StringRef Filename, bool isSystem) override;
+ bool visitInputFile(StringRef Filename, bool isSystem,
+ bool isOverridden) override;
};
/// \brief ASTReaderListener implementation to validate the information of
Modified: cfe/trunk/lib/Frontend/DependencyFile.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/DependencyFile.cpp?rev=203882&r1=203881&r2=203882&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/DependencyFile.cpp (original)
+++ cfe/trunk/lib/Frontend/DependencyFile.cpp Thu Mar 13 21:26:31 2014
@@ -79,7 +79,8 @@ public:
bool needsSystemInputFileVisitation() override {
return Parent.includeSystemHeaders();
}
- bool visitInputFile(StringRef Filename, bool isSystem) override;
+ bool visitInputFile(StringRef Filename, bool isSystem,
+ bool isOverridden) override;
};
}
@@ -258,8 +259,11 @@ void DFGImpl::OutputDependencyFile() {
}
bool DFGASTReaderListener::visitInputFile(llvm::StringRef Filename,
- bool IsSystem) {
+ bool IsSystem, bool IsOverridden) {
assert(!IsSystem || needsSystemInputFileVisitation());
+ if (IsOverridden)
+ return true;
+
Parent.AddFilename(Filename);
return true;
}
Modified: cfe/trunk/lib/Serialization/ASTReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=203882&r1=203881&r2=203882&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReader.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReader.cpp Thu Mar 13 21:26:31 2014
@@ -119,9 +119,10 @@ bool ChainedASTReaderListener::needsSyst
Second->needsSystemInputFileVisitation();
}
bool ChainedASTReaderListener::visitInputFile(StringRef Filename,
- bool isSystem) {
- return First->visitInputFile(Filename, isSystem) ||
- Second->visitInputFile(Filename, isSystem);
+ bool isSystem,
+ bool isOverridden) {
+ return First->visitInputFile(Filename, isSystem, isOverridden) ||
+ Second->visitInputFile(Filename, isSystem, isOverridden);
}
//===----------------------------------------------------------------------===//
@@ -2120,8 +2121,11 @@ ASTReader::ReadControlBlock(ModuleFile &
if (Listener && Listener->needsInputFileVisitation()) {
unsigned N = Listener->needsSystemInputFileVisitation() ? NumInputs
: NumUserInputs;
- for (unsigned I = 0; I < N; ++I)
- Listener->visitInputFile(getInputFileName(F, I+1), I >= NumUserInputs);
+ for (unsigned I = 0; I < N; ++I) {
+ bool IsSystem = I >= NumUserInputs;
+ InputFileInfo FI = readInputFileInfo(F, I+1);
+ Listener->visitInputFile(FI.Filename, IsSystem, FI.Overridden);
+ }
}
return Success;
@@ -3932,7 +3936,8 @@ bool ASTReader::readASTFileControlBlock(
bool shouldContinue = false;
switch ((InputFileRecordTypes)Cursor.readRecord(Code, Record, &Blob)) {
case INPUT_FILE:
- shouldContinue = Listener.visitInputFile(Blob, isSystemFile);
+ bool Overridden = static_cast<bool>(Record[3]);
+ shouldContinue = Listener.visitInputFile(Blob, isSystemFile, Overridden);
break;
}
if (!shouldContinue)
Added: cfe/trunk/test/Modules/dependency-gen-inferred-map.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/dependency-gen-inferred-map.m?rev=203882&view=auto
==============================================================================
--- cfe/trunk/test/Modules/dependency-gen-inferred-map.m (added)
+++ cfe/trunk/test/Modules/dependency-gen-inferred-map.m Thu Mar 13 21:26:31 2014
@@ -0,0 +1,8 @@
+// Test that the virtual file "__inferred_module.map" doesn't show up as dependency.
+
+// RUN: rm -rf %t-mcp
+// RUN: %clang_cc1 -isysroot %S/Inputs/System -triple x86_64-apple-darwin10 -dependency-file %t.d -MT %s.o -F %S/Inputs -fsyntax-only -fmodules -fmodules-cache-path=%t-mcp %s
+// RUN: FileCheck %s < %t.d
+// CHECK-NOT: __inferred_module
+
+ at import Module;
More information about the cfe-commits
mailing list