[clang] 6330653 - [unittest] Fix FrontendTests CanGenerateCC1CommandLineFlag when LLVM_DEFAULT_TARGET_TRIPLE is not normalized after D79796

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 24 16:19:07 PDT 2020


Author: Fangrui Song
Date: 2020-06-24T16:18:58-07:00
New Revision: 6330653547f492646c92553738dab6a99d7d9710

URL: https://github.com/llvm/llvm-project/commit/6330653547f492646c92553738dab6a99d7d9710
DIFF: https://github.com/llvm/llvm-project/commit/6330653547f492646c92553738dab6a99d7d9710.diff

LOG: [unittest] Fix FrontendTests CanGenerateCC1CommandLineFlag when LLVM_DEFAULT_TARGET_TRIPLE is not normalized after D79796

`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`

Added: 
    

Modified: 
    clang/unittests/Frontend/CompilerInvocationTest.cpp

Removed: 
    


################################################################################
diff  --git a/clang/unittests/Frontend/CompilerInvocationTest.cpp b/clang/unittests/Frontend/CompilerInvocationTest.cpp
index ed82d678462f..9cce66e41872 100644
--- a/clang/unittests/Frontend/CompilerInvocationTest.cpp
+++ b/clang/unittests/Frontend/CompilerInvocationTest.cpp
@@ -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;


        


More information about the cfe-commits mailing list