Remove GCC checks

Clang is always used now, so we can remove all the GCC checks. Removing
GCC-specific configuration will happen in the next CL.

Test: m
Change-Id: I4835ecf6062159315d0dfb07b098e60bff033a8a
diff --git a/cc/binary.go b/cc/binary.go
index 07d503b..5fa501e 100644
--- a/cc/binary.go
+++ b/cc/binary.go
@@ -302,8 +302,7 @@
 	if binary.stripper.needsStrip(ctx) {
 		// b/80093681, GNU strip/objcopy bug.
 		// Use llvm-{strip,objcopy} when clang lld is used.
-		builderFlags.stripUseLlvmStrip =
-			flags.Clang && binary.baseLinker.useClangLld(ctx)
+		builderFlags.stripUseLlvmStrip = binary.baseLinker.useClangLld(ctx)
 		strippedOutputFile := outputFile
 		outputFile = android.PathForModuleOut(ctx, "unstripped", fileName)
 		binary.stripper.strip(ctx, outputFile, strippedOutputFile, builderFlags)
diff --git a/cc/builder.go b/cc/builder.go
index d1bc23f..d16efd0 100644
--- a/cc/builder.go
+++ b/cc/builder.go
@@ -242,7 +242,6 @@
 	aidlFlags       string
 	rsFlags         string
 	toolchain       config.Toolchain
-	clang           bool
 	tidy            bool
 	coverage        bool
 	sAbiDump        bool
@@ -290,7 +289,7 @@
 
 	objFiles := make(android.Paths, len(srcFiles))
 	var tidyFiles android.Paths
-	if flags.tidy && flags.clang {
+	if flags.tidy {
 		tidyFiles = make(android.Paths, 0, len(srcFiles))
 	}
 	var coverageFiles android.Paths
@@ -333,19 +332,14 @@
 	}, " ")
 
 	var sAbiDumpFiles android.Paths
-	if flags.sAbiDump && flags.clang {
+	if flags.sAbiDump {
 		sAbiDumpFiles = make(android.Paths, 0, len(srcFiles))
 	}
 
-	if flags.clang {
-		cflags += " ${config.NoOverrideClangGlobalCflags}"
-		toolingCflags += " ${config.NoOverrideClangGlobalCflags}"
-		cppflags += " ${config.NoOverrideClangGlobalCflags}"
-		toolingCppflags += " ${config.NoOverrideClangGlobalCflags}"
-	} else {
-		cflags += " ${config.NoOverrideGlobalCflags}"
-		cppflags += " ${config.NoOverrideGlobalCflags}"
-	}
+	cflags += " ${config.NoOverrideClangGlobalCflags}"
+	toolingCflags += " ${config.NoOverrideClangGlobalCflags}"
+	cppflags += " ${config.NoOverrideClangGlobalCflags}"
+	toolingCppflags += " ${config.NoOverrideClangGlobalCflags}"
 
 	for i, srcFile := range srcFiles {
 		objFile := android.ObjPathWithExt(ctx, subdir, srcFile, "o")
@@ -385,23 +379,23 @@
 		var moduleCflags string
 		var moduleToolingCflags string
 		var ccCmd string
-		tidy := flags.tidy && flags.clang
+		tidy := flags.tidy
 		coverage := flags.coverage
-		dump := flags.sAbiDump && flags.clang
+		dump := flags.sAbiDump
 
 		switch srcFile.Ext() {
 		case ".S", ".s":
-			ccCmd = "gcc"
+			ccCmd = "clang"
 			moduleCflags = asflags
 			tidy = false
 			coverage = false
 			dump = false
 		case ".c":
-			ccCmd = "gcc"
+			ccCmd = "clang"
 			moduleCflags = cflags
 			moduleToolingCflags = toolingCflags
 		case ".cpp", ".cc", ".mm":
-			ccCmd = "g++"
+			ccCmd = "clang++"
 			moduleCflags = cppflags
 			moduleToolingCflags = toolingCppflags
 		default:
@@ -409,24 +403,9 @@
 			continue
 		}
 
-		if flags.clang {
-			switch ccCmd {
-			case "gcc":
-				ccCmd = "clang"
-			case "g++":
-				ccCmd = "clang++"
-			default:
-				panic("unrecoginzied ccCmd")
-			}
-		}
-
 		ccDesc := ccCmd
 
-		if flags.clang {
-			ccCmd = "${config.ClangBin}/" + ccCmd
-		} else {
-			ccCmd = gccCmd(flags.toolchain, ccCmd)
-		}
+		ccCmd = "${config.ClangBin}/" + ccCmd
 
 		var implicitOutputs android.WritablePaths
 		if coverage {
@@ -611,12 +590,7 @@
 	objFiles, sharedLibs, staticLibs, lateStaticLibs, wholeStaticLibs, deps android.Paths,
 	crtBegin, crtEnd android.OptionalPath, groupLate bool, flags builderFlags, outputFile android.WritablePath) {
 
-	var ldCmd string
-	if flags.clang {
-		ldCmd = "${config.ClangBin}/clang++"
-	} else {
-		ldCmd = gccCmd(flags.toolchain, "g++")
-	}
+	ldCmd := "${config.ClangBin}/clang++"
 
 	var libFlagsList []string
 
@@ -777,12 +751,7 @@
 func TransformObjsToObj(ctx android.ModuleContext, objFiles android.Paths,
 	flags builderFlags, outputFile android.WritablePath) {
 
-	var ldCmd string
-	if flags.clang {
-		ldCmd = "${config.ClangBin}/clang++"
-	} else {
-		ldCmd = gccCmd(flags.toolchain, "g++")
-	}
+	ldCmd := "${config.ClangBin}/clang++"
 
 	ctx.Build(pctx, android.BuildParams{
 		Rule:        partialLd,
diff --git a/cc/cc.go b/cc/cc.go
index 640c552..5f3baea 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -136,7 +136,6 @@
 	SystemIncludeFlags []string
 
 	Toolchain config.Toolchain
-	Clang     bool
 	Tidy      bool
 	Coverage  bool
 	SAbiDump  bool
@@ -165,9 +164,6 @@
 	// Deprecated. true is the default, false is invalid.
 	Clang *bool `android:"arch_variant"`
 
-	// Some internals still need GCC (toolchain_library)
-	Gcc bool `blueprint:"mutated"`
-
 	// Minimum sdk version supported when compiling against the ndk
 	Sdk_version *string
 
@@ -220,7 +216,6 @@
 type ModuleContextIntf interface {
 	static() bool
 	staticBinary() bool
-	clang() bool
 	toolchain() config.Toolchain
 	useSdk() bool
 	sdkVersion() string
@@ -513,10 +508,6 @@
 	ctx BaseModuleContext
 }
 
-func (ctx *moduleContextImpl) clang() bool {
-	return ctx.mod.clang(ctx.ctx)
-}
-
 func (ctx *moduleContextImpl) toolchain() config.Toolchain {
 	return ctx.mod.toolchain(ctx.ctx)
 }
@@ -733,9 +724,12 @@
 		return
 	}
 
+	if c.Properties.Clang != nil && *c.Properties.Clang == false {
+		ctx.PropertyErrorf("clang", "false (GCC) is no longer supported")
+	}
+
 	flags := Flags{
 		Toolchain: c.toolchain(ctx),
-		Clang:     c.clang(ctx),
 	}
 	if c.compiler != nil {
 		flags = c.compiler.compilerFlags(ctx, flags, deps)
@@ -1099,14 +1093,6 @@
 	}
 }
 
-func (c *Module) clang(ctx BaseModuleContext) bool {
-	if c.Properties.Clang != nil && *c.Properties.Clang == false {
-		ctx.PropertyErrorf("clang", "false (GCC) is no longer supported")
-	}
-
-	return !c.Properties.Gcc
-}
-
 // Whether a module can link to another module, taking into
 // account NDK linking.
 func checkLinkType(ctx android.ModuleContext, from *Module, to *Module, tag dependencyTag) {
diff --git a/cc/cmakelists.go b/cc/cmakelists.go
index 699f5c0..7b4f89b 100644
--- a/cc/cmakelists.go
+++ b/cc/cmakelists.go
@@ -18,7 +18,6 @@
 	"fmt"
 
 	"android/soong/android"
-	"android/soong/cc/config"
 	"os"
 	"path"
 	"path/filepath"
@@ -150,18 +149,10 @@
 	f.WriteString(fmt.Sprintf("project(%s)\n", ccModule.ModuleBase.Name()))
 	f.WriteString(fmt.Sprintf("set(ANDROID_ROOT %s)\n\n", getAndroidSrcRootDirectory(ctx)))
 
-	if ccModule.flags.Clang {
-		pathToCC, _ := evalVariable(ctx, "${config.ClangBin}/")
-		f.WriteString(fmt.Sprintf("set(CMAKE_C_COMPILER \"%s%s\")\n", buildCMakePath(pathToCC), "clang"))
-		f.WriteString(fmt.Sprintf("set(CMAKE_CXX_COMPILER \"%s%s\")\n", buildCMakePath(pathToCC), "clang++"))
-	} else {
-		toolchain := config.FindToolchain(ccModule.Os(), ccModule.Arch())
-		root, _ := evalVariable(ctx, toolchain.GccRoot())
-		triple, _ := evalVariable(ctx, toolchain.GccTriple())
-		pathToCC := filepath.Join(root, "bin", triple+"-")
-		f.WriteString(fmt.Sprintf("set(CMAKE_C_COMPILER \"%s%s\")\n", buildCMakePath(pathToCC), "gcc"))
-		f.WriteString(fmt.Sprintf("set(CMAKE_CXX_COMPILER \"%s%s\")\n", buildCMakePath(pathToCC), "g++"))
-	}
+	pathToCC, _ := evalVariable(ctx, "${config.ClangBin}/")
+	f.WriteString(fmt.Sprintf("set(CMAKE_C_COMPILER \"%s%s\")\n", buildCMakePath(pathToCC), "clang"))
+	f.WriteString(fmt.Sprintf("set(CMAKE_CXX_COMPILER \"%s%s\")\n", buildCMakePath(pathToCC), "clang++"))
+
 	// Add all sources to the project.
 	f.WriteString("list(APPEND\n")
 	f.WriteString("     SOURCE_FILES\n")
diff --git a/cc/compiler.go b/cc/compiler.go
index 5ef9e4e..68d8593 100644
--- a/cc/compiler.go
+++ b/cc/compiler.go
@@ -340,10 +340,7 @@
 	if flags.RequiredInstructionSet != "" {
 		instructionSet = flags.RequiredInstructionSet
 	}
-	instructionSetFlags, err := tc.InstructionSetFlags(instructionSet)
-	if flags.Clang {
-		instructionSetFlags, err = tc.ClangInstructionSetFlags(instructionSet)
-	}
+	instructionSetFlags, err := tc.ClangInstructionSetFlags(instructionSet)
 	if err != nil {
 		ctx.ModuleErrorf("%s", err)
 	}
@@ -353,24 +350,22 @@
 	// TODO: debug
 	flags.CFlags = append(flags.CFlags, esc(compiler.Properties.Release.Cflags)...)
 
-	if flags.Clang {
-		CheckBadCompilerFlags(ctx, "clang_cflags", compiler.Properties.Clang_cflags)
-		CheckBadCompilerFlags(ctx, "clang_asflags", compiler.Properties.Clang_asflags)
+	CheckBadCompilerFlags(ctx, "clang_cflags", compiler.Properties.Clang_cflags)
+	CheckBadCompilerFlags(ctx, "clang_asflags", compiler.Properties.Clang_asflags)
 
-		flags.CFlags = config.ClangFilterUnknownCflags(flags.CFlags)
-		flags.CFlags = append(flags.CFlags, esc(compiler.Properties.Clang_cflags)...)
-		flags.AsFlags = append(flags.AsFlags, esc(compiler.Properties.Clang_asflags)...)
-		flags.CppFlags = config.ClangFilterUnknownCflags(flags.CppFlags)
-		flags.ConlyFlags = config.ClangFilterUnknownCflags(flags.ConlyFlags)
-		flags.LdFlags = config.ClangFilterUnknownCflags(flags.LdFlags)
+	flags.CFlags = config.ClangFilterUnknownCflags(flags.CFlags)
+	flags.CFlags = append(flags.CFlags, esc(compiler.Properties.Clang_cflags)...)
+	flags.AsFlags = append(flags.AsFlags, esc(compiler.Properties.Clang_asflags)...)
+	flags.CppFlags = config.ClangFilterUnknownCflags(flags.CppFlags)
+	flags.ConlyFlags = config.ClangFilterUnknownCflags(flags.ConlyFlags)
+	flags.LdFlags = config.ClangFilterUnknownCflags(flags.LdFlags)
 
-		target := "-target " + tc.ClangTriple()
-		gccPrefix := "-B" + config.ToolPath(tc)
+	target := "-target " + tc.ClangTriple()
+	gccPrefix := "-B" + config.ToolPath(tc)
 
-		flags.CFlags = append(flags.CFlags, target, gccPrefix)
-		flags.AsFlags = append(flags.AsFlags, target, gccPrefix)
-		flags.LdFlags = append(flags.LdFlags, target, gccPrefix)
-	}
+	flags.CFlags = append(flags.CFlags, target, gccPrefix)
+	flags.AsFlags = append(flags.AsFlags, target, gccPrefix)
+	flags.LdFlags = append(flags.LdFlags, target, gccPrefix)
 
 	hod := "Host"
 	if ctx.Os().Class == android.Device {
@@ -381,25 +376,15 @@
 	flags.ConlyFlags = append([]string{"${config.CommonGlobalConlyflags}"}, flags.ConlyFlags...)
 	flags.CppFlags = append([]string{fmt.Sprintf("${config.%sGlobalCppflags}", hod)}, flags.CppFlags...)
 
-	if flags.Clang {
-		flags.AsFlags = append(flags.AsFlags, tc.ClangAsflags())
-		flags.CppFlags = append([]string{"${config.CommonClangGlobalCppflags}"}, flags.CppFlags...)
-		flags.GlobalFlags = append(flags.GlobalFlags,
-			tc.ClangCflags(),
-			"${config.CommonClangGlobalCflags}",
-			fmt.Sprintf("${config.%sClangGlobalCflags}", hod))
-	} else {
-		flags.CppFlags = append([]string{"${config.CommonGlobalCppflags}"}, flags.CppFlags...)
-		flags.GlobalFlags = append(flags.GlobalFlags,
-			tc.Cflags(),
-			"${config.CommonGlobalCflags}",
-			fmt.Sprintf("${config.%sGlobalCflags}", hod))
-	}
+	flags.AsFlags = append(flags.AsFlags, tc.ClangAsflags())
+	flags.CppFlags = append([]string{"${config.CommonClangGlobalCppflags}"}, flags.CppFlags...)
+	flags.GlobalFlags = append(flags.GlobalFlags,
+		tc.ClangCflags(),
+		"${config.CommonClangGlobalCflags}",
+		fmt.Sprintf("${config.%sClangGlobalCflags}", hod))
 
-	if flags.Clang {
-		if strings.HasPrefix(android.PathForModuleSrc(ctx).String(), "external/") {
-			flags.GlobalFlags = append([]string{"${config.ClangExternalCflags}"}, flags.GlobalFlags...)
-		}
+	if strings.HasPrefix(android.PathForModuleSrc(ctx).String(), "external/") {
+		flags.GlobalFlags = append([]string{"${config.ClangExternalCflags}"}, flags.GlobalFlags...)
 	}
 
 	if ctx.Device() {
@@ -412,19 +397,11 @@
 
 	flags.AsFlags = append(flags.AsFlags, "-D__ASSEMBLY__")
 
-	if flags.Clang {
-		flags.CppFlags = append(flags.CppFlags, tc.ClangCppflags())
-	} else {
-		flags.CppFlags = append(flags.CppFlags, tc.Cppflags())
-	}
+	flags.CppFlags = append(flags.CppFlags, tc.ClangCppflags())
 
 	flags.YasmFlags = append(flags.YasmFlags, tc.YasmFlags())
 
-	if flags.Clang {
-		flags.GlobalFlags = append(flags.GlobalFlags, tc.ToolchainClangCflags())
-	} else {
-		flags.GlobalFlags = append(flags.GlobalFlags, tc.ToolchainCflags())
-	}
+	flags.GlobalFlags = append(flags.GlobalFlags, tc.ToolchainClangCflags())
 
 	cStd := config.CStdVersion
 	if String(compiler.Properties.C_std) == "experimental" {
diff --git a/cc/config/arm_device.go b/cc/config/arm_device.go
index c1c2c7b..8dee2c8 100644
--- a/cc/config/arm_device.go
+++ b/cc/config/arm_device.go
@@ -348,17 +348,6 @@
 	return "${config.ArmIncludeFlags}"
 }
 
-func (t *toolchainArm) InstructionSetFlags(isa string) (string, error) {
-	switch isa {
-	case "arm":
-		return "${config.ArmArmCflags}", nil
-	case "thumb", "":
-		return "${config.ArmThumbCflags}", nil
-	default:
-		return t.toolchainBase.InstructionSetFlags(isa)
-	}
-}
-
 func (t *toolchainArm) ClangTriple() string {
 	// http://b/72619014 work around llvm LTO bug.
 	return "armv7a-linux-androideabi"
diff --git a/cc/config/global.go b/cc/config/global.go
index ad63c97..8a3d545 100644
--- a/cc/config/global.go
+++ b/cc/config/global.go
@@ -146,19 +146,13 @@
 		commonGlobalCflags = append(commonGlobalCflags, "-fdebug-prefix-map=/proc/self/cwd=")
 	}
 
-	pctx.StaticVariable("CommonGlobalCflags", strings.Join(commonGlobalCflags, " "))
 	pctx.StaticVariable("CommonGlobalConlyflags", strings.Join(commonGlobalConlyflags, " "))
-	pctx.StaticVariable("DeviceGlobalCflags", strings.Join(deviceGlobalCflags, " "))
 	pctx.StaticVariable("DeviceGlobalCppflags", strings.Join(deviceGlobalCppflags, " "))
 	pctx.StaticVariable("DeviceGlobalLdflags", strings.Join(deviceGlobalLdflags, " "))
 	pctx.StaticVariable("DeviceGlobalLldflags", strings.Join(deviceGlobalLldflags, " "))
-	pctx.StaticVariable("HostGlobalCflags", strings.Join(hostGlobalCflags, " "))
 	pctx.StaticVariable("HostGlobalCppflags", strings.Join(hostGlobalCppflags, " "))
 	pctx.StaticVariable("HostGlobalLdflags", strings.Join(hostGlobalLdflags, " "))
 	pctx.StaticVariable("HostGlobalLldflags", strings.Join(hostGlobalLldflags, " "))
-	pctx.StaticVariable("NoOverrideGlobalCflags", strings.Join(noOverrideGlobalCflags, " "))
-
-	pctx.StaticVariable("CommonGlobalCppflags", strings.Join(commonGlobalCppflags, " "))
 
 	pctx.StaticVariable("CommonClangGlobalCflags",
 		strings.Join(append(ClangFilterUnknownCflags(commonGlobalCflags), "${ClangExtraCflags}"), " "))
diff --git a/cc/config/toolchain.go b/cc/config/toolchain.go
index 930b18f..0b9f4ed 100644
--- a/cc/config/toolchain.go
+++ b/cc/config/toolchain.go
@@ -49,13 +49,7 @@
 	GccVersion() string
 	ToolPath() string
 
-	ToolchainCflags() string
-	ToolchainLdflags() string
-	Cflags() string
-	Cppflags() string
-	Ldflags() string
 	IncludeFlags() string
-	InstructionSetFlags(string) (string, error)
 
 	ClangTriple() string
 	ToolchainClangCflags() string
@@ -101,13 +95,6 @@
 	return triple
 }
 
-func (toolchainBase) InstructionSetFlags(s string) (string, error) {
-	if s != "" {
-		return "", fmt.Errorf("instruction_set: %s is not a supported instruction set", s)
-	}
-	return "", nil
-}
-
 func (toolchainBase) ClangInstructionSetFlags(s string) (string, error) {
 	if s != "" {
 		return "", fmt.Errorf("instruction_set: %s is not a supported instruction set", s)
@@ -115,14 +102,6 @@
 	return "", nil
 }
 
-func (toolchainBase) ToolchainCflags() string {
-	return ""
-}
-
-func (toolchainBase) ToolchainLdflags() string {
-	return ""
-}
-
 func (toolchainBase) ToolchainClangCflags() string {
 	return ""
 }
diff --git a/cc/library.go b/cc/library.go
index 4f9b5b2..9eb3f47 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -274,11 +274,6 @@
 
 	if library.shared() {
 		libName := library.getLibName(ctx)
-		// GCC for Android assumes that -shared means -Bsymbolic, use -Wl,-shared instead
-		sharedFlag := "-Wl,-shared"
-		if flags.Clang || ctx.Host() {
-			sharedFlag = "-shared"
-		}
 		var f []string
 		if ctx.toolchain().Bionic() {
 			f = append(f,
@@ -300,7 +295,7 @@
 			}
 		} else {
 			f = append(f,
-				sharedFlag,
+				"-shared",
 				"-Wl,-soname,"+libName+flags.Toolchain.ShlibSuffix())
 		}
 
@@ -558,8 +553,7 @@
 	if library.stripper.needsStrip(ctx) {
 		// b/80093681, GNU strip/objcopy bug.
 		// Use llvm-{strip,objcopy} when clang lld is used.
-		builderFlags.stripUseLlvmStrip =
-			flags.Clang && library.baseLinker.useClangLld(ctx)
+		builderFlags.stripUseLlvmStrip = library.baseLinker.useClangLld(ctx)
 		strippedOutputFile := outputFile
 		outputFile = android.PathForModuleOut(ctx, "unstripped", fileName)
 		library.stripper.strip(ctx, outputFile, strippedOutputFile, builderFlags)
diff --git a/cc/linker.go b/cc/linker.go
index 9911b16..e3f1ff1 100644
--- a/cc/linker.go
+++ b/cc/linker.go
@@ -293,7 +293,7 @@
 		hod = "Device"
 	}
 
-	if flags.Clang && linker.useClangLld(ctx) {
+	if linker.useClangLld(ctx) {
 		flags.LdFlags = append(flags.LdFlags, fmt.Sprintf("${config.%sGlobalLldflags}", hod))
 		if !BoolDefault(linker.MoreProperties.Pack_relocations, true) {
 			flags.LdFlags = append(flags.LdFlags, "-Wl,--pack-dyn-relocs=none")
@@ -310,12 +310,10 @@
 		flags.LdFlags = append(flags.LdFlags, "-Wl,--no-undefined")
 	}
 
-	if flags.Clang && linker.useClangLld(ctx) {
+	if linker.useClangLld(ctx) {
 		flags.LdFlags = append(flags.LdFlags, toolchain.ClangLldflags())
-	} else if flags.Clang {
-		flags.LdFlags = append(flags.LdFlags, toolchain.ClangLdflags())
 	} else {
-		flags.LdFlags = append(flags.LdFlags, toolchain.Ldflags())
+		flags.LdFlags = append(flags.LdFlags, toolchain.ClangLdflags())
 	}
 
 	if !ctx.toolchain().Bionic() {
@@ -362,11 +360,7 @@
 		flags.LdFlags = append(flags.LdFlags, "-Wl,--hash-style=both")
 	}
 
-	if flags.Clang {
-		flags.LdFlags = append(flags.LdFlags, toolchain.ToolchainClangLdflags())
-	} else {
-		flags.LdFlags = append(flags.LdFlags, toolchain.ToolchainLdflags())
-	}
+	flags.LdFlags = append(flags.LdFlags, toolchain.ToolchainClangLdflags())
 
 	if Bool(linker.Properties.Group_static_libs) {
 		flags.GroupStaticLibs = true
diff --git a/cc/object.go b/cc/object.go
index 2577195..0010621 100644
--- a/cc/object.go
+++ b/cc/object.go
@@ -64,11 +64,7 @@
 }
 
 func (*objectLinker) linkerFlags(ctx ModuleContext, flags Flags) Flags {
-	if flags.Clang {
-		flags.LdFlags = append(flags.LdFlags, ctx.toolchain().ToolchainClangLdflags())
-	} else {
-		flags.LdFlags = append(flags.LdFlags, ctx.toolchain().ToolchainLdflags())
-	}
+	flags.LdFlags = append(flags.LdFlags, ctx.toolchain().ToolchainClangLdflags())
 
 	return flags
 }
diff --git a/cc/sanitize.go b/cc/sanitize.go
index b2fc63f..5dcaf76 100644
--- a/cc/sanitize.go
+++ b/cc/sanitize.go
@@ -164,17 +164,15 @@
 	var globalSanitizers []string
 	var globalSanitizersDiag []string
 
-	if ctx.clang() {
-		if ctx.Host() {
-			if !ctx.Windows() {
-				globalSanitizers = ctx.Config().SanitizeHost()
-			}
-		} else {
-			arches := ctx.Config().SanitizeDeviceArch()
-			if len(arches) == 0 || inList(ctx.Arch().ArchType.Name, arches) {
-				globalSanitizers = ctx.Config().SanitizeDevice()
-				globalSanitizersDiag = ctx.Config().SanitizeDeviceDiag()
-			}
+	if ctx.Host() {
+		if !ctx.Windows() {
+			globalSanitizers = ctx.Config().SanitizeHost()
+		}
+	} else {
+		arches := ctx.Config().SanitizeDeviceArch()
+		if len(arches) == 0 || inList(ctx.Arch().ArchType.Name, arches) {
+			globalSanitizers = ctx.Config().SanitizeDevice()
+			globalSanitizersDiag = ctx.Config().SanitizeDeviceDiag()
 		}
 	}
 
@@ -369,10 +367,6 @@
 		return flags
 	}
 
-	if !ctx.clang() {
-		ctx.ModuleErrorf("Use of sanitizers requires clang")
-	}
-
 	var sanitizers []string
 	var diagSanitizers []string
 
diff --git a/cc/tidy.go b/cc/tidy.go
index 0a6b413..ddb445a 100644
--- a/cc/tidy.go
+++ b/cc/tidy.go
@@ -62,11 +62,6 @@
 		return flags
 	}
 
-	// Clang-tidy requires clang
-	if !flags.Clang {
-		return flags
-	}
-
 	flags.Tidy = true
 
 	// Add global WITH_TIDY_FLAGS and local tidy_flags.
diff --git a/cc/toolchain_library.go b/cc/toolchain_library.go
index 742d1c1..5811b01 100644
--- a/cc/toolchain_library.go
+++ b/cc/toolchain_library.go
@@ -56,7 +56,6 @@
 	}
 	module.compiler = toolchainLibrary
 	module.linker = toolchainLibrary
-	module.Properties.Gcc = true
 	module.stl = nil
 	module.sanitize = nil
 	module.installer = nil
diff --git a/cc/util.go b/cc/util.go
index bab4d32..1412d54 100644
--- a/cc/util.go
+++ b/cc/util.go
@@ -78,7 +78,6 @@
 		sAbiFlags:       strings.Join(in.SAbiFlags, " "),
 		yasmFlags:       strings.Join(in.YasmFlags, " "),
 		toolchain:       in.Toolchain,
-		clang:           in.Clang,
 		coverage:        in.Coverage,
 		tidy:            in.Tidy,
 		sAbiDump:        in.SAbiDump,