[serialization] Stop recording the full paths to input source files.

There were no clients and it leaks information about the developer's system.
After this commit, there should be no full paths present in framework modules.
(App modules may contain search paths for debugging reasons, as well as a
full or relative path to the bridging header.)

Swift SVN r24851
This commit is contained in:
Jordan Rose
2015-01-30 19:22:34 +00:00
parent 2ff77a9cd1
commit 478fdcf3ab
4 changed files with 2 additions and 34 deletions

View File

@@ -75,9 +75,6 @@ class ModuleFile : public LazyMemberLoader {
/// The data blob containing all of the module's identifiers.
StringRef IdentifierData;
/// Paths to the source files used to build this module.
SmallVector<StringRef, 4> SourcePaths;
public:
/// Represents another module that has been imported as a dependency.
class Dependency {
@@ -471,12 +468,6 @@ public:
return static_cast<ModuleStatus>(Bits.Status);
}
/// Returns paths to the source files that were used to build this module.
ArrayRef<StringRef> getInputSourcePaths() const {
assert(getStatus() == ModuleStatus::Valid);
return SourcePaths;
}
/// Returns the list of modules this module depends on.
ArrayRef<Dependency> getDependencies() const {
return Dependencies;

View File

@@ -51,7 +51,7 @@ const uint16_t VERSION_MAJOR = 0;
/// To ensure that two separate changes don't silently get merged into one
/// in source control, you should also update the comment to briefly
/// describe what change you made.
const uint16_t VERSION_MINOR = 169; // Last change: local type serialization
const uint16_t VERSION_MINOR = 170; // Last change: dropped SOURCE_FILE record.
using DeclID = Fixnum<31>;
using DeclIDField = BCFixed<31>;
@@ -391,8 +391,7 @@ namespace input_block {
// These IDs must \em not be renumbered or reordered without incrementing
// VERSION_MAJOR.
enum {
SOURCE_FILE = 1,
IMPORTED_MODULE,
IMPORTED_MODULE = 1,
LINK_LIBRARY,
IMPORTED_HEADER,
IMPORTED_HEADER_CONTENTS,
@@ -400,11 +399,6 @@ namespace input_block {
SEARCH_PATH
};
using SourceFileLayout = BCRecordLayout<
SOURCE_FILE, // ID
BCBlob // path
>;
using ImportedModuleLayout = BCRecordLayout<
IMPORTED_MODULE,
BCFixed<1>, // exported?

View File

@@ -704,10 +704,6 @@ ModuleFile::ModuleFile(
StringRef blobData;
unsigned kind = cursor.readRecord(next.ID, scratch, &blobData);
switch (kind) {
case input_block::SOURCE_FILE:
assert(scratch.empty());
SourcePaths.push_back(blobData);
break;
case input_block::IMPORTED_MODULE: {
bool exported, scoped;
input_block::ImportedModuleLayout::readRecord(scratch,

View File

@@ -398,7 +398,6 @@ void Serializer::writeBlockInfoBlock() {
BLOCK_RECORD(control_block, TARGET);
BLOCK(INPUT_BLOCK);
BLOCK_RECORD(input_block, SOURCE_FILE);
BLOCK_RECORD(input_block, IMPORTED_MODULE);
BLOCK_RECORD(input_block, LINK_LIBRARY);
BLOCK_RECORD(input_block, IMPORTED_HEADER);
@@ -589,7 +588,6 @@ static void flattenImportPath(const Module::ImportedModule &import,
void Serializer::writeInputBlock(const SerializationOptions &options) {
BCBlockRAII restoreBlock(Out, INPUT_BLOCK_ID, 4);
input_block::SourceFileLayout SourceFile(Out);
input_block::ImportedModuleLayout ImportedModule(Out);
input_block::LinkLibraryLayout LinkLibrary(Out);
input_block::ImportedHeaderLayout ImportedHeader(Out);
@@ -605,17 +603,6 @@ void Serializer::writeInputBlock(const SerializationOptions &options) {
SearchPath.emit(ScratchRecord, /*framework=*/true, path);
}
for (auto filename : options.InputFilenames) {
llvm::SmallString<128> path(filename);
std::error_code err;
err = llvm::sys::fs::make_absolute(path);
if (err)
continue;
SourceFile.emit(ScratchRecord, path);
}
// FIXME: Having to deal with private imports as a superset of public imports
// is inefficient.
SmallVector<Module::ImportedModule, 8> publicImports;