llvm.org GIT mirror llvm / b52cb5e
Support: correct Windows normalisation If the environment is unknown and no object file is provided, then assume an "MSVC" environment, otherwise, set the environment to the object file format. In the case that we have a known environment but a non-native file format for Windows (COFF) which is used for MCJIT, then append the custom file format to the triple as an additional component. This fixes the MCJIT tests on Windows. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205130 91177308-0d34-0410-b5e6-96231b3b80d8 Saleem Abdulrasool 6 years ago
2 changed file(s) with 23 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
433433 if (Components.size() > 3)
434434 Environment = parseEnvironment(Components[3]);
435435 ObjectFormatType ObjectFormat = UnknownObjectFormat;
436 if (Components.size() > 4)
437 ObjectFormat = parseFormat(Components[4]);
436438
437439 // Note which components are already in their final position. These will not
438440 // be moved.
543545 if (OS == Triple::Win32) {
544546 Components.resize(4);
545547 Components[2] = "windows";
546 if (Environment == UnknownEnvironment && ObjectFormat == UnknownObjectFormat)
547 Components[3] = "msvc";
548 if (Environment == UnknownEnvironment) {
549 if (ObjectFormat == UnknownObjectFormat)
550 Components[3] = "msvc";
551 else
552 Components[3] = getObjectFormatTypeName(ObjectFormat);
553 } else if (ObjectFormat != UnknownObjectFormat &&
554 ObjectFormat != Triple::COFF) {
555 Components.resize(5);
556 Components[4] = getObjectFormatTypeName(ObjectFormat);
557 }
548558 } else if (OS == Triple::MinGW32) {
549559 Components.resize(4);
550560 Components[2] = "windows";
512512
513513 EXPECT_EQ(Triple::COFF, Triple("i686--win32").getObjectFormat());
514514
515 EXPECT_EQ(Triple::ELF, Triple("i686-pc-windows-msvc-elf").getObjectFormat());
516
517 {
518 Triple Normalized(Triple::normalize("i686-pc-windows-msvc-elf"));
519 EXPECT_EQ(Triple::ELF, Normalized.getObjectFormat());
520 }
521
515522 Triple T = Triple("");
516523 T.setObjectFormat(Triple::ELF);
517524 EXPECT_EQ(Triple::ELF, T.getObjectFormat());
545552 EXPECT_EQ("x86_64--windows-macho", Triple::normalize("x86_64-win32-macho"));
546553
547554 EXPECT_EQ("i686-pc-windows-itanium", Triple::normalize("i686-pc-windows-itanium"));
548 }
549 }
555
556 EXPECT_EQ("i686-pc-windows-msvc", Triple::normalize("i686-pc-windows-msvc"));
557 }
558 }