Index: lib/Basic/Targets.cpp =================================================================== --- lib/Basic/Targets.cpp +++ lib/Basic/Targets.cpp @@ -383,7 +383,7 @@ DefineStd(Builder, "linux", Opts); Builder.defineMacro("__gnu_linux__"); Builder.defineMacro("__ELF__"); - if (Triple.getEnvironment() == llvm::Triple::Android) { + if (Triple.isAndroid()) { Builder.defineMacro("__ANDROID__", "1"); unsigned Maj, Min, Rev; Triple.getEnvironmentVersion(Maj, Min, Rev); Index: lib/Driver/SanitizerArgs.cpp =================================================================== --- lib/Driver/SanitizerArgs.cpp +++ lib/Driver/SanitizerArgs.cpp @@ -495,10 +495,8 @@ if (AllAddedKinds & Address) { AsanSharedRuntime = - Args.hasArg(options::OPT_shared_libasan) || - (TC.getTriple().getEnvironment() == llvm::Triple::Android); - AsanZeroBaseShadow = - (TC.getTriple().getEnvironment() == llvm::Triple::Android); + Args.hasArg(options::OPT_shared_libasan) || TC.getTriple().isAndroid(); + AsanZeroBaseShadow = TC.getTriple().isAndroid(); if (Arg *A = Args.getLastArg(options::OPT_fsanitize_address_field_padding)) { StringRef S = A->getValue(); Index: lib/Driver/ToolChain.cpp =================================================================== --- lib/Driver/ToolChain.cpp +++ lib/Driver/ToolChain.cpp @@ -284,8 +284,7 @@ std::string ToolChain::getCompilerRT(const ArgList &Args, StringRef Component, bool Shared) const { const llvm::Triple &TT = getTriple(); - const char *Env = - (TT.getEnvironment() == llvm::Triple::Android) ? "-android" : ""; + const char *Env = TT.isAndroid() ? "-android" : ""; bool IsITANMSVCWindows = TT.isWindowsMSVCEnvironment() || TT.isWindowsItaniumEnvironment(); Index: lib/Driver/ToolChains.cpp =================================================================== --- lib/Driver/ToolChains.cpp +++ lib/Driver/ToolChains.cpp @@ -1823,7 +1823,7 @@ addMultilibFlag(isMipsEL(TargetArch), "EL", Flags); addMultilibFlag(!isMipsEL(TargetArch), "EB", Flags); - if (TargetTriple.getEnvironment() == llvm::Triple::Android) { + if (TargetTriple.isAndroid()) { // Select Android toolchain. It's the only choice in that case. if (AndroidMipsMultilibs.select(Flags, Result.SelectedMultilib)) { Result.Multilibs = AndroidMipsMultilibs; @@ -2174,8 +2174,7 @@ getTriple().getArch() == llvm::Triple::aarch64 || getTriple().getArch() == llvm::Triple::aarch64_be || (getTriple().getOS() == llvm::Triple::Linux && - (!V.isOlderThan(4, 7, 0) || - getTriple().getEnvironment() == llvm::Triple::Android)) || + (!V.isOlderThan(4, 7, 0) || getTriple().isAndroid())) || getTriple().getOS() == llvm::Triple::NaCl; if (DriverArgs.hasFlag(options::OPT_fuse_init_array, @@ -3329,7 +3328,7 @@ if (Arch == llvm::Triple::arm || Arch == llvm::Triple::thumb) ExtraOpts.push_back("-X"); - const bool IsAndroid = Triple.getEnvironment() == llvm::Triple::Android; + const bool IsAndroid = Triple.isAndroid(); const bool IsMips = isMipsArch(Arch); if (IsMips && !SysRoot.empty()) Index: lib/Driver/Tools.cpp =================================================================== --- lib/Driver/Tools.cpp +++ lib/Driver/Tools.cpp @@ -989,7 +989,7 @@ CmdArgs.push_back("-aarch64-fix-cortex-a53-835769=1"); else CmdArgs.push_back("-aarch64-fix-cortex-a53-835769=0"); - } else if (Triple.getEnvironment() == llvm::Triple::Android) { + } else if (Triple.isAndroid()) { // Enabled A53 errata (835769) workaround by default on android CmdArgs.push_back("-backend-option"); CmdArgs.push_back("-aarch64-fix-cortex-a53-835769=1"); @@ -1022,7 +1022,7 @@ } // MIPS64r6 is the default for Android MIPS64 (mips64el-linux-android). - if (Triple.getEnvironment() == llvm::Triple::Android) + if (Triple.isAndroid()) DefMips64CPU = "mips64r6"; // MIPS3 is the default for mips64*-unknown-openbsd. @@ -1527,7 +1527,7 @@ return "btver2"; // On Android use targets compatible with gcc - if (Triple.getEnvironment() == llvm::Triple::Android) + if (Triple.isAndroid()) return Is64Bit ? "x86-64" : "i686"; // Everything else goes to x86-64 in 64-bit mode. @@ -1824,7 +1824,7 @@ const llvm::Triple::ArchType ArchType = Triple.getArch(); // Add features to be compatible with gcc for Android. - if (Triple.getEnvironment() == llvm::Triple::Android) { + if (Triple.isAndroid()) { if (ArchType == llvm::Triple::x86_64) { Features.push_back("+sse4.2"); Features.push_back("+popcnt"); @@ -2593,8 +2593,7 @@ } // Collect static runtimes. - if (Args.hasArg(options::OPT_shared) || - (TC.getTriple().getEnvironment() == llvm::Triple::Android)) { + if (Args.hasArg(options::OPT_shared) || TC.getTriple().isAndroid()) { // Don't link static runtimes into DSOs or if compiling for Android. return; } @@ -3042,7 +3041,7 @@ Args.hasArg(options::OPT_mkernel, options::OPT_fapple_kext); // Android-specific defaults for PIC/PIE - if (ToolChain.getTriple().getEnvironment() == llvm::Triple::Android) { + if (ToolChain.getTriple().isAndroid()) { switch (ToolChain.getArch()) { case llvm::Triple::arm: case llvm::Triple::armeb: @@ -4241,7 +4240,7 @@ Args.AddLastArg(CmdArgs, options::OPT_fno_operator_names); // Emulated TLS is enabled by default on Android, and can be enabled manually // with -femulated-tls. - bool EmulatedTLSDefault = Triple.getEnvironment() == llvm::Triple::Android; + bool EmulatedTLSDefault = Triple.isAndroid(); if (Args.hasFlag(options::OPT_femulated_tls, options::OPT_fno_emulated_tls, EmulatedTLSDefault)) CmdArgs.push_back("-femulated-tls"); @@ -8170,7 +8169,7 @@ static void AddLibgcc(const llvm::Triple &Triple, const Driver &D, ArgStringList &CmdArgs, const ArgList &Args) { - bool isAndroid = Triple.getEnvironment() == llvm::Triple::Android; + bool isAndroid = Triple.isAndroid(); bool isCygMing = Triple.isOSCygMing(); bool StaticLibgcc = Args.hasArg(options::OPT_static_libgcc) || Args.hasArg(options::OPT_static); @@ -8206,7 +8205,7 @@ const toolchains::Linux &ToolChain) { const llvm::Triple::ArchType Arch = ToolChain.getArch(); - if (ToolChain.getTriple().getEnvironment() == llvm::Triple::Android) { + if (ToolChain.getTriple().isAndroid()) { if (ToolChain.getTriple().isArch64Bit()) return "/system/bin/linker64"; else @@ -8354,8 +8353,7 @@ llvm::Triple Triple = llvm::Triple(TripleStr); const llvm::Triple::ArchType Arch = ToolChain.getArch(); - const bool isAndroid = - ToolChain.getTriple().getEnvironment() == llvm::Triple::Android; + const bool isAndroid = ToolChain.getTriple().isAndroid(); const bool IsPIE = !Args.hasArg(options::OPT_shared) && !Args.hasArg(options::OPT_static) && (Args.hasArg(options::OPT_pie) || ToolChain.isPIEDefault());