[lld] r193171 - [PECOFF] Fix /manifestuac handling.
Rui Ueyama
ruiu at google.com
Tue Oct 22 10:42:42 PDT 2013
Author: ruiu
Date: Tue Oct 22 12:42:42 2013
New Revision: 193171
URL: http://llvm.org/viewvc/llvm-project?rev=193171&view=rev
Log:
[PECOFF] Fix /manifestuac handling.
uiAccess argument's type is not really boolean. It's string.
Modified:
lld/trunk/include/lld/ReaderWriter/PECOFFLinkingContext.h
lld/trunk/lib/Driver/WinLinkDriver.cpp
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=193171&r1=193170&r2=193171&view=diff
==============================================================================
--- lld/trunk/include/lld/ReaderWriter/PECOFFLinkingContext.h (original)
+++ lld/trunk/include/lld/ReaderWriter/PECOFFLinkingContext.h Tue Oct 22 12:42:42 2013
@@ -39,7 +39,7 @@ public:
_swapRunFromNet(false), _baseRelocationEnabled(true),
_terminalServerAware(true), _dynamicBaseEnabled(true),
_createManifest(true), _embedManifest(false), _manifestId(1),
- _manifestLevel("'asInvoker'"), _manifestUiAccess(false),
+ _manifestLevel("'asInvoker'"), _manifestUiAccess("'false'"),
_imageType(ImageType::IMAGE_EXE) {
setDeadStripping(true);
}
@@ -161,8 +161,8 @@ public:
void setManifestLevel(std::string val) { _manifestLevel = std::move(val); }
const std::string &getManifestLevel() const { return _manifestLevel; }
- void setManifestUiAccess(bool val) { _manifestUiAccess = val; }
- bool getManifestUiAccess() const { return _manifestUiAccess; }
+ void setManifestUiAccess(std::string val) { _manifestUiAccess = val; }
+ const std::string &getManifestUiAccess() const { return _manifestUiAccess; }
void setImageType(ImageType type) { _imageType = type; }
ImageType getImageType() const { return _imageType; }
@@ -226,7 +226,7 @@ private:
bool _embedManifest;
int _manifestId;
std::string _manifestLevel;
- bool _manifestUiAccess;
+ std::string _manifestUiAccess;
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=193171&r1=193170&r2=193171&view=diff
==============================================================================
--- lld/trunk/lib/Driver/WinLinkDriver.cpp (original)
+++ lld/trunk/lib/Driver/WinLinkDriver.cpp Tue Oct 22 12:42:42 2013
@@ -167,7 +167,7 @@ bool parseManifest(StringRef option, boo
// so the values given via the command line must be valid as XML attributes.
// This may sound a bit odd, but that's how link.exe works, so we will follow.
bool parseManifestUac(StringRef option, llvm::Optional<std::string> &level,
- llvm::Optional<bool> &uiAccess) {
+ llvm::Optional<std::string> &uiAccess) {
for (;;) {
option = option.ltrim();
if (option.empty())
@@ -179,14 +179,11 @@ bool parseManifestUac(StringRef option,
level = value.str();
continue;
}
- if (option.startswith("uiAccess=true")) {
- option = option.substr(strlen("uiAccess=true"));
- uiAccess = true;
- continue;
- }
- if (option.startswith("uiAccess=false")) {
- option = option.substr(strlen("uiAccess=false"));
- uiAccess = false;
+ if (option.startswith("uiAccess=")) {
+ option = option.substr(strlen("uiAccess="));
+ StringRef value;
+ llvm::tie(value, option) = option.split(" ");
+ uiAccess = value.str();
continue;
}
return false;
@@ -472,7 +469,7 @@ WinLinkDriver::parse(int argc, const cha
case OPT_manifestuac: {
// Parse /manifestuac.
llvm::Optional<std::string> privilegeLevel;
- llvm::Optional<bool> uiAccess;
+ llvm::Optional<std::string> uiAccess;
if (!parseManifestUac(inputArg->getValue(), privilegeLevel, uiAccess)) {
diagnostics << "Unknown argument for /manifestuac: "
<< inputArg->getValue() << "\n";
Modified: lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp?rev=193171&r1=193170&r2=193171&view=diff
==============================================================================
--- lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp (original)
+++ lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp Tue Oct 22 12:42:42 2013
@@ -64,7 +64,7 @@ TEST_F(WinLinkParserTest, Basic) {
EXPECT_FALSE(_context.getEmbedManifest());
EXPECT_EQ(1, _context.getManifestId());
EXPECT_EQ("'asInvoker'", _context.getManifestLevel());
- EXPECT_EQ(false, _context.getManifestUiAccess());
+ EXPECT_EQ("'false'", _context.getManifestUiAccess());
EXPECT_TRUE(_context.deadStrip());
EXPECT_FALSE(_context.logInputFiles());
}
@@ -380,7 +380,7 @@ TEST_F(WinLinkParserTest, Manifest_Defau
EXPECT_FALSE(_context.getEmbedManifest());
EXPECT_EQ(1, _context.getManifestId());
EXPECT_EQ("'asInvoker'", _context.getManifestLevel());
- EXPECT_EQ(false, _context.getManifestUiAccess());
+ EXPECT_EQ("'false'", _context.getManifestUiAccess());
}
TEST_F(WinLinkParserTest, Manifest_No) {
@@ -394,7 +394,7 @@ TEST_F(WinLinkParserTest, Manifest_Embed
EXPECT_TRUE(_context.getEmbedManifest());
EXPECT_EQ(1, _context.getManifestId());
EXPECT_EQ("'asInvoker'", _context.getManifestLevel());
- EXPECT_EQ(false, _context.getManifestUiAccess());
+ EXPECT_EQ("'false'", _context.getManifestUiAccess());
}
TEST_F(WinLinkParserTest, Manifest_Embed_ID42) {
@@ -403,28 +403,28 @@ TEST_F(WinLinkParserTest, Manifest_Embed
EXPECT_TRUE(_context.getEmbedManifest());
EXPECT_EQ(42, _context.getManifestId());
EXPECT_EQ("'asInvoker'", _context.getManifestLevel());
- EXPECT_EQ(false, _context.getManifestUiAccess());
+ EXPECT_EQ("'false'", _context.getManifestUiAccess());
}
TEST_F(WinLinkParserTest, Manifestuac_Level) {
EXPECT_TRUE(parse("link.exe", "/manifestuac:level='requireAdministrator'",
"a.out", nullptr));
EXPECT_EQ("'requireAdministrator'", _context.getManifestLevel());
- EXPECT_EQ(false, _context.getManifestUiAccess());
+ EXPECT_EQ("'false'", _context.getManifestUiAccess());
}
TEST_F(WinLinkParserTest, Manifestuac_UiAccess) {
- EXPECT_TRUE(parse("link.exe", "/manifestuac:uiAccess=true", "a.out", nullptr));
+ EXPECT_TRUE(parse("link.exe", "/manifestuac:uiAccess='true'", "a.out", nullptr));
EXPECT_EQ("'asInvoker'", _context.getManifestLevel());
- EXPECT_EQ(true, _context.getManifestUiAccess());
+ EXPECT_EQ("'true'", _context.getManifestUiAccess());
}
TEST_F(WinLinkParserTest, Manifestuac_LevelAndUiAccess) {
EXPECT_TRUE(parse("link.exe",
- "/manifestuac:level='requireAdministrator' uiAccess=true",
+ "/manifestuac:level='requireAdministrator' uiAccess='true'",
"a.out", nullptr));
EXPECT_EQ("'requireAdministrator'", _context.getManifestLevel());
- EXPECT_EQ(true, _context.getManifestUiAccess());
+ EXPECT_EQ("'true'", _context.getManifestUiAccess());
}
//
More information about the llvm-commits
mailing list