1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

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 <malaperle@gmail.com>
This commit is contained in:
Marc-Andre Laperle 2020-09-15 23:45:43 -04:00 committed by Marc-André Laperle
parent ae3159f809
commit 6a3e138431
3 changed files with 43 additions and 0 deletions

View file

@ -14,3 +14,4 @@ config.debug=Debug
config.release=Release
MSVCOutputParser.name = MSVC Build Output Parser
ClangCLBuiltinSpecsDetector.name = Clang-cl Built-in Compiler Settings

View file

@ -762,4 +762,16 @@
prefer-non-shared="true">
</provider>
</extension>
<extension
point="org.eclipse.cdt.core.LanguageSettingsProvider">
<provider
class="org.eclipse.cdt.internal.msw.build.core.ClangClBuiltinSpecsDetector"
id="org.eclipse.cdt.msw.build.core.ClangCLBuiltinSpecsDetector"
name="%ClangCLBuiltinSpecsDetector.name"
parameter="${COMMAND} ${FLAGS} -E /clang:-P -v /clang:-dD &quot;${INPUTS}&quot;"
prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
</extension>
</plugin>

View file

@ -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;
}
}