From 6a3e138431f4330cea0dd23c3a6f81da422a587e Mon Sep 17 00:00:00 2001 From: Marc-Andre Laperle Date: Tue, 15 Sep 2020 23:45:43 -0400 Subject: [PATCH] Bug 567018 - Built-in language settings provider for Clang-cl It is the same as GCC built-in provider but with tweaked parameters to pass to Clang driver. It has to be enabled by hand since there is no toolchain associated with it for now. Change-Id: I5455d04725b2ee4709844d32ee32d355d120d807 Signed-off-by: Marc-Andre Laperle --- .../plugin.properties | 1 + windows/org.eclipse.cdt.msw.build/plugin.xml | 12 ++++++++ .../core/ClangClBuiltinSpecsDetector.java | 30 +++++++++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 windows/org.eclipse.cdt.msw.build/src/org/eclipse/cdt/internal/msw/build/core/ClangClBuiltinSpecsDetector.java diff --git a/windows/org.eclipse.cdt.msw.build/plugin.properties b/windows/org.eclipse.cdt.msw.build/plugin.properties index 272a006cae7..f4bbed266a6 100644 --- a/windows/org.eclipse.cdt.msw.build/plugin.properties +++ b/windows/org.eclipse.cdt.msw.build/plugin.properties @@ -14,3 +14,4 @@ config.debug=Debug config.release=Release MSVCOutputParser.name = MSVC Build Output Parser +ClangCLBuiltinSpecsDetector.name = Clang-cl Built-in Compiler Settings \ No newline at end of file diff --git a/windows/org.eclipse.cdt.msw.build/plugin.xml b/windows/org.eclipse.cdt.msw.build/plugin.xml index 1476eaa756e..c8e8d75b575 100644 --- a/windows/org.eclipse.cdt.msw.build/plugin.xml +++ b/windows/org.eclipse.cdt.msw.build/plugin.xml @@ -762,4 +762,16 @@ prefer-non-shared="true"> + + + + + + diff --git a/windows/org.eclipse.cdt.msw.build/src/org/eclipse/cdt/internal/msw/build/core/ClangClBuiltinSpecsDetector.java b/windows/org.eclipse.cdt.msw.build/src/org/eclipse/cdt/internal/msw/build/core/ClangClBuiltinSpecsDetector.java new file mode 100644 index 00000000000..da228061f6f --- /dev/null +++ b/windows/org.eclipse.cdt.msw.build/src/org/eclipse/cdt/internal/msw/build/core/ClangClBuiltinSpecsDetector.java @@ -0,0 +1,30 @@ +/******************************************************************************* + * Copyright (c) 2020 Marc-Andre Laperle. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + *******************************************************************************/ +package org.eclipse.cdt.internal.msw.build.core; + +import org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector; + +/** + * Language settings provider to detect built-in compiler settings for the Clang-cl compiler. + */ +public class ClangClBuiltinSpecsDetector extends GCCBuiltinSpecsDetector { + + // This ID is mostly used for the global provider case to get the compiler command from the toolchain + // which will be wrong here (cl instead of clang-cl), although less wrong than GCC. We would need a dedicated + // Clang-cl toolchain to make the global case work. + // But it will correctly display whether or not the associated toolchain (MSVC) is installed and supported, instead of checking GCC. + private static final String TOOLCHAIN_ID = "org.eclipse.cdt.msvc.toolchain.base"; //$NON-NLS-1$ + + @Override + public String getToolchainId() { + return TOOLCHAIN_ID; + } +}