From 66a002078453fd34727f121f747fd4961f48a776 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Tue, 6 Oct 2015 13:58:13 +0000 Subject: [PATCH] ToolingTests: Tweak getAnyTarget() to match "x86_64". Both "x86" and "x86-64" are incompatible to triple's arch. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@249403 91177308-0d34-0410-b5e6-96231b3b80d8 --- unittests/Tooling/ToolingTest.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/unittests/Tooling/ToolingTest.cpp b/unittests/Tooling/ToolingTest.cpp index 73d771f939..e479af828a 100644 --- a/unittests/Tooling/ToolingTest.cpp +++ b/unittests/Tooling/ToolingTest.cpp @@ -301,9 +301,11 @@ std::string getAnyTarget() { llvm::InitializeAllTargets(); for (const auto &Target : llvm::TargetRegistry::targets()) { std::string Error; - if (llvm::TargetRegistry::lookupTarget(Target.getName(), Error) == - &Target) { - return Target.getName(); + StringRef TargetName(Target.getName()); + if (TargetName == "x86-64") + TargetName = "x86_64"; + if (llvm::TargetRegistry::lookupTarget(TargetName, Error) == &Target) { + return TargetName; } } return ""; -- 2.40.0