[PECOFF] Add /manifestdependency command line option.

llvm-svn: 193201
This commit is contained in:
Rui Ueyama 2013-10-22 21:39:04 +00:00
parent d53ffa0a70
commit 9041c3bd5b
4 changed files with 24 additions and 1 deletions

View File

@ -169,6 +169,11 @@ public:
void setManifestUiAccess(std::string val) { _manifestUiAccess = val; }
const std::string &getManifestUiAccess() const { return _manifestUiAccess; }
void setManifestDependency(std::string val) { _manifestDependency = val; }
const std::string &getManifestDependency() const {
return _manifestDependency;
}
void setImageType(ImageType type) { _imageType = type; }
ImageType getImageType() const { return _imageType; }
@ -233,6 +238,7 @@ private:
int _manifestId;
std::string _manifestLevel;
std::string _manifestUiAccess;
std::string _manifestDependency;
ImageType _imageType;
// The set to store /nodefaultlib arguments.

View File

@ -500,6 +500,14 @@ WinLinkDriver::parse(int argc, const char *argv[], PECOFFLinkingContext &ctx,
ctx.setManifestOutputPath(ctx.allocateString(inputArg->getValue()));
break;
case OPT_manifestdependency:
// /manifestdependency:<string> option. Note that the argument will be
// embedded to the manifest XML file with no error check, for link.exe
// compatibility. We do not gurantete that the resulting XML file is
// valid.
ctx.setManifestDependency(ctx.allocateString(inputArg->getValue()));
break;
case OPT_failifmismatch:
if (handleFailIfMismatchOption(inputArg->getValue(), failIfMismatchMap,
diagnostics))

View File

@ -35,6 +35,8 @@ def manifest : F<"manifest">;
def manifest_colon : P<"manifest", "Create manifest file">;
def manifestuac : P<"manifestuac", "User access control">;
def manifestfile : P<"manifestfile", "Manifest file path">;
def manifestdependency : P<"manifestdependency",
"Attributes for <dependency> in manifest file">;
// We cannot use multiclass P because class name "incl" is different
// from its command line option name. We do this because "include" is

View File

@ -62,6 +62,7 @@ TEST_F(WinLinkParserTest, Basic) {
EXPECT_TRUE(_context.getDynamicBaseEnabled());
EXPECT_TRUE(_context.getCreateManifest());
EXPECT_EQ("a.exe.manifest", _context.getManifestOutputPath());
EXPECT_EQ("", _context.getManifestDependency());
EXPECT_FALSE(_context.getEmbedManifest());
EXPECT_EQ(1, _context.getManifestId());
EXPECT_EQ("'asInvoker'", _context.getManifestLevel());
@ -373,7 +374,7 @@ TEST_F(WinLinkParserTest, FailIfMismatch_Mismatch) {
}
//
// Tests for /manifest, /manifestuac, and /manifestfile.
// Tests for /manifest, /manifestuac, /manifestfile, and /manifestdependency.
//
TEST_F(WinLinkParserTest, Manifest_Default) {
EXPECT_TRUE(parse("link.exe", "/manifest", "a.out", nullptr));
@ -434,6 +435,12 @@ TEST_F(WinLinkParserTest, Manifestfile) {
EXPECT_EQ("bar.manifest", _context.getManifestOutputPath());
}
TEST_F(WinLinkParserTest, Manifestdependency) {
EXPECT_TRUE(parse("link.exe", "/manifestdependency:foo bar", "a.out",
nullptr));
EXPECT_EQ("foo bar", _context.getManifestDependency());
}
//
// Test for command line flags that are ignored.
//