Replace string GNU Triples with llvm::Triple in computeDataLayout(). NFC.
[oota-llvm.git] / lib / Target / AArch64 / AArch64TargetMachine.cpp
index 2b5625dc09e38946de47e517ea669d2d6f52c9c5..f0ee66496763cc1de1deca132ac7046df86d2a00 100644 (file)
@@ -115,9 +115,8 @@ static std::unique_ptr<TargetLoweringObjectFile> createTLOF(const Triple &TT) {
 }
 
 // Helper function to build a DataLayout string
-static std::string computeDataLayout(StringRef TT, bool LittleEndian) {
-  Triple Triple(TT);
-  if (Triple.isOSBinFormatMachO())
+static std::string computeDataLayout(const Triple &TT, bool LittleEndian) {
+  if (TT.isOSBinFormatMachO())
     return "e-m:o-i64:64-i128:128-n32:64-S128";
   if (LittleEndian)
     return "e-m:e-i64:64-i128:128-n32:64-S128";
@@ -134,8 +133,8 @@ AArch64TargetMachine::AArch64TargetMachine(const Target &T, StringRef TT,
                                            bool LittleEndian)
     // This nested ternary is horrible, but DL needs to be properly
     // initialized before TLInfo is constructed.
-    : LLVMTargetMachine(T, computeDataLayout(TT, LittleEndian), TT, CPU, FS,
-                        Options, RM, CM, OL),
+    : LLVMTargetMachine(T, computeDataLayout(Triple(TT), LittleEndian), TT, CPU,
+                        FS, Options, RM, CM, OL),
       TLOF(createTLOF(Triple(getTargetTriple()))),
       isLittle(LittleEndian) {
   initAsmInfo();