[lld] r193201 - [PECOFF] Add /manifestdependency command line option.

Rui Ueyama ruiu at google.com
Tue Oct 22 14:39:05 PDT 2013


Author: ruiu
Date: Tue Oct 22 16:39:04 2013
New Revision: 193201

URL: http://llvm.org/viewvc/llvm-project?rev=193201&view=rev
Log:
[PECOFF] Add /manifestdependency command line option.

Modified:
    lld/trunk/include/lld/ReaderWriter/PECOFFLinkingContext.h
    lld/trunk/lib/Driver/WinLinkDriver.cpp
    lld/trunk/lib/Driver/WinLinkOptions.td
    lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp

Modified: lld/trunk/include/lld/ReaderWriter/PECOFFLinkingContext.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/ReaderWriter/PECOFFLinkingContext.h?rev=193201&r1=193200&r2=193201&view=diff
==============================================================================
--- lld/trunk/include/lld/ReaderWriter/PECOFFLinkingContext.h (original)
+++ lld/trunk/include/lld/ReaderWriter/PECOFFLinkingContext.h Tue Oct 22 16:39:04 2013
@@ -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.

Modified: lld/trunk/lib/Driver/WinLinkDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/WinLinkDriver.cpp?rev=193201&r1=193200&r2=193201&view=diff
==============================================================================
--- lld/trunk/lib/Driver/WinLinkDriver.cpp (original)
+++ lld/trunk/lib/Driver/WinLinkDriver.cpp Tue Oct 22 16:39:04 2013
@@ -500,6 +500,14 @@ WinLinkDriver::parse(int argc, const cha
       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))

Modified: lld/trunk/lib/Driver/WinLinkOptions.td
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/WinLinkOptions.td?rev=193201&r1=193200&r2=193201&view=diff
==============================================================================
--- lld/trunk/lib/Driver/WinLinkOptions.td (original)
+++ lld/trunk/lib/Driver/WinLinkOptions.td Tue Oct 22 16:39:04 2013
@@ -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

Modified: lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp?rev=193201&r1=193200&r2=193201&view=diff
==============================================================================
--- lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp (original)
+++ lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp Tue Oct 22 16:39:04 2013
@@ -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
 }
 
 //
-// 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.
 //





More information about the llvm-commits mailing list