@@ -2250,18 +2250,30 @@ lldb::TypeSystemSP SwiftASTContext::CreateInstance(
2250
2250
target_triple.str ().c_str ());
2251
2251
computed_triple = target_triple;
2252
2252
} else {
2253
+ // Underspecified means that one or more of vendor, os, or os
2254
+ // version (Darwin only) is missing.
2253
2255
LOG_PRINTF (GetLog (LLDBLog::Types), " Underspecified target triple %s." ,
2254
2256
target_triple.str ().c_str ());
2255
2257
PlatformSP platform_sp (target.GetPlatform ());
2256
- if (platform_sp && !target_triple.hasEnvironment ()) {
2258
+ // Try to fill in the platform OS version. Don't do this when an
2259
+ // environment is present, since there might be some ambiguity
2260
+ // about the plaform (e.g., ios-macabi runs on the macOS, but
2261
+ // uses iOS version numbers).
2262
+ if (platform_sp &&
2263
+ target_triple.getEnvironment () != llvm::Triple::UnknownEnvironment) {
2257
2264
llvm::VersionTuple version =
2258
2265
platform_sp->GetOSVersion (target.GetProcessSP ().get ());
2259
- std::string buffer;
2260
- llvm::raw_string_ostream (buffer)
2261
- << target_triple.getArchName () << ' -'
2262
- << target_triple.getVendorName () << ' -'
2263
- << llvm::Triple::getOSTypeName (target_triple.getOS ())
2264
- << version.getAsString ();
2266
+ llvm::SmallString<32 > buffer;
2267
+ {
2268
+ llvm::raw_svector_ostream os (buffer);
2269
+ os << target_triple.getArchName () << ' -' ;
2270
+ os << target_triple.getVendorName () << ' -' ;
2271
+ os << llvm::Triple::getOSTypeName (target_triple.getOS ());
2272
+ os << version.getAsString ();
2273
+ StringRef env = target_triple.getEnvironmentName ();
2274
+ if (!env.empty ())
2275
+ os << ' -' << env;
2276
+ }
2265
2277
computed_triple = llvm::Triple (buffer);
2266
2278
} else {
2267
2279
computed_triple = get_executable_triple ();
0 commit comments