[unittest] Fix FrontendTests CanGenerateCC1CommandLineFlag when LLVM_DEFAULT_TARGET_T...
authorFangrui Song <maskray@google.com>
Wed, 24 Jun 2020 23:18:28 +0000 (16:18 -0700)
committerFangrui Song <maskray@google.com>
Wed, 24 Jun 2020 23:18:58 +0000 (16:18 -0700)
`TargetOpts->Triple` is initialized as llvm::sys::getDefaultTargetTriple() which may not be normalized.
If LLVM_DEFAULT_TARGET_TRIPLE is powerpc64le-linux-gnu, we should check
check `-triple powerpc64le-linux-gnu`, instead of (normalized) `-triple powerpc64le-unknown-linux-gnu`

clang/unittests/Frontend/CompilerInvocationTest.cpp

index ed82d67..9cce66e 100644 (file)
@@ -78,8 +78,7 @@ TEST_F(CC1CommandLineGenerationTest,
 
 TEST_F(CC1CommandLineGenerationTest,
        CanGenerateCC1CommandLineSeparateRequiredAbsent) {
-  const std::string DefaultTriple =
-      llvm::Triple::normalize(llvm::sys::getDefaultTargetTriple());
+  const std::string DefaultTriple = llvm::sys::getDefaultTargetTriple();
   const char *Args[] = {"clang", "-xc++", "-"};
 
   CompilerInvocation CInvok;