[Serialization] Serialize the SDK path and -Xcc arguments for an app.

...so that the debugger has the best possible chance of being able to load
the app properly.

We don't do this for frameworks today because we don't want to leak this
information into the public module; once we have a distinction between
"the module that ships with the framework" and "the module that goes into
the debug info" we can do this for frameworks as well.

Part of rdar://problem/17670778

Swift SVN r25204
This commit is contained in:
Jordan Rose
2015-02-11 23:07:48 +00:00
parent b6a247cf06
commit de8a05b293
10 changed files with 200 additions and 28 deletions

View File

@@ -137,6 +137,33 @@ public:
ModuleStatus status = ModuleStatus::Malformed;
};
/// A collection of options that can be used to set up a new AST context
/// before it has been created.
///
/// Note that this is intended to be a transient data structure; as such,
/// <strong>none of the string values added to it are copied</strong>.
///
/// \sa validateSerializedAST()
class ExtendedValidationInfo {
SmallVector<StringRef, 4> ClangImporterOpts;
StringRef SDKPath;
public:
ExtendedValidationInfo() = default;
StringRef getSDKPath() const { return SDKPath; }
void setSDKPath(StringRef path) {
assert(SDKPath.empty());
SDKPath = path;
}
ArrayRef<StringRef> getClangImporterOptions() const {
return ClangImporterOpts;
}
void addClangImporterOption(StringRef option) {
ClangImporterOpts.push_back(option);
}
};
/// Returns info about the serialized AST in the given data.
///
/// If the returned status is anything but ModuleStatus::Valid, the
@@ -147,7 +174,15 @@ public:
///
/// Note that this does not actually try to load the module or validate any
/// of its dependencies; it only checks that it /can/ be loaded.
static ValidationInfo validateSerializedAST(StringRef data);
///
/// \param data A buffer containing the serialized AST. Result information
/// refers directly into this buffer.
/// \param[out] extendedInfo If present, will be populated with additional
/// compilation options serialized into the AST at build time that may be
/// necessary to load it properly.
static ValidationInfo
validateSerializedAST(StringRef data,
ExtendedValidationInfo *extendedInfo = nullptr);
virtual void verifyAllModules() override;
};