diff options
| author | Hans Wennborg <hans@hanshq.net> | 2018-06-13 14:29:26 +0000 |
|---|---|---|
| committer | Hans Wennborg <hans@hanshq.net> | 2018-06-13 14:29:26 +0000 |
| commit | 12ba9ec929c31977d6295cb89e0dbaf3d326a1af (patch) | |
| tree | fdfe4ac13c8fca98139e163d012e53823caa1525 /llvm/unittests/Support | |
| parent | b391f2430378cd4d1bba41d04e6f60d890748f20 (diff) | |
| download | bcm5719-llvm-12ba9ec929c31977d6295cb89e0dbaf3d326a1af.tar.gz bcm5719-llvm-12ba9ec929c31977d6295cb89e0dbaf3d326a1af.zip | |
Do not enforce absolute path argv0 in windows
Even if we support no-canonical-prefix on
clang-cl(https://reviews.llvm.org/D47480), argv0 becomes absolute path
in clang-cl and that embeds absolute path in /showIncludes.
This patch removes such full path normalization from InitLLVM on
windows, and that removes absolute path from clang-cl output
(obj/stdout/stderr) when debug flag is disabled.
Patch by Takuto Ikuta!
Differential Revision https://reviews.llvm.org/D47578
llvm-svn: 334602
Diffstat (limited to 'llvm/unittests/Support')
| -rw-r--r-- | llvm/unittests/Support/CommandLineTest.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/llvm/unittests/Support/CommandLineTest.cpp b/llvm/unittests/Support/CommandLineTest.cpp index ba12c846a1f..a296912a305 100644 --- a/llvm/unittests/Support/CommandLineTest.cpp +++ b/llvm/unittests/Support/CommandLineTest.cpp @@ -13,6 +13,7 @@ #include "llvm/ADT/Triple.h" #include "llvm/Config/config.h" #include "llvm/Support/FileSystem.h" +#include "llvm/Support/InitLLVM.h" #include "llvm/Support/Path.h" #include "llvm/Support/Program.h" #include "llvm/Support/StringSaver.h" @@ -821,4 +822,22 @@ TEST(CommandLineTest, PositionalEatArgsError) { EXPECT_TRUE(Errs.empty()); } +#ifdef _WIN32 +TEST(CommandLineTest, GetCommandLineArguments) { + int argc = __argc; + char **argv = __argv; + + // GetCommandLineArguments is called in InitLLVM. + llvm::InitLLVM X(argc, argv); + + EXPECT_EQ(llvm::sys::path::is_absolute(argv[0]), + llvm::sys::path::is_absolute(__argv[0])); + + EXPECT_TRUE(llvm::sys::path::filename(argv[0]) + .equals_lower("supporttests.exe")) + << "Filename of test executable is " + << llvm::sys::path::filename(argv[0]); +} +#endif + } // anonymous namespace |

