Partager via


ClangCompile task

Wraps the Microsoft C++ compiler tool, clang.exe.

Parameters

The following table describes the parameters of the ClangCompile task.

Parameter Description
AdditionalIncludeDirectories Optional string[] parameter.

Specifies one or more directories to add to the include path; separate with semi-colons if more than one.

Use -I[path].
AdditionalOptions Optional string parameter.
BufferSecurityCheck Optional string parameter.

The Security Check helps detect stack-buffer over-runs, a common attempted attack upon a program's security.

Use fstack-protector.
BuildingInIde Optional bool parameter.
CLanguageStandard Optional string parameter.

Determines the C language standard.

Use std=[value] with value of c89, c99, c11, gnu99, or gnu11.
ClangVersion Optional string parameter.
CompileAs Optional string parameter.

Select compile language option for .c and .cpp files. Default will detect based on .c or .cpp extention.

Use -x c, -x c++.
CppLanguageStandard Optional string parameter.

Determines the C++ language standard.

Use std=[value] with value of c++98, c++11, c++1y, gnu++98, gnu++11, or gnu++1y.
DataLevelLinking Optional bool parameter.

Enables linker optimizations to remove unused data by emitting each data item in a separate section.
DebugInformationFormat Optional string parameter.

Specifies the type of debugging information generated by the compiler.

None, produces no debugging information, so compilation may be faster (use g0).
FullDebug, generate DWARF2 debug information (use g2 -gdwarf-2).
LineNumber, generate Line Number information only (use gline-tables-only).
EnableNeonCodegen Optional bool parameter.

Enables code generation for NEON floating point hardware. This is applicable for arm architecture only.
ExceptionHandling Optional string parameter.

Specifies the model of exception handling to be used by the compiler.

Disabled, disable exception handling (use fno-exceptions).
Enabled, enable exception handling (use fexceptions).
UnwindTables, generates any needed static data, but does not affect the code generated (use funwind-tables).
FloatABI Optional string parameter.

Selection option to choose the floating point ABI.

soft, causes compiler to generate output containing library calls for floating-point operations (use mfloat-abi=soft).
softfp, allows the generation of code using hardware floating-point instructions, but still uses the soft-float calling conventions (use mfloat-abi=softfp).
hard, allows generation of floating-point instructions and uses FPU-specific calling conventions (use mfloat-abi=hard).
ForcedIncludeFiles Optional string[] parameter.

One or more forced include files.

Use -include [name].
FunctionLevelLinking Optional bool parameter.

Allows the compiler to package individual functions in the form of packaged functions (COMDATs). Required for edit and continue to work.

Use ffunction-sections.
GccToolChain Optional string parameter.

Folder path to Gcc Tool Chain.
GNUMode Optional bool parameter.

MSCompatibility Optional bool parameter.

Enable full Microsoft C++ compatibility.
MSCompatibilityVersion Optional string parameter.

Dot-separated value representing the Microsoft compiler version number to report in _MSC_VER (0 = don't define it (default)).
MSExtensions Optional bool parameter.

Accept some non-standard constructs supported by the Microsoft compiler.
MSCompilerVersion Optional string parameter.

Microsoft compiler version number to report in _MSC_VER (0 = don't define it (default)).
MSVCErrorReport Optional bool parameter.

Report errors which Visual Studio can use to parse for file and line information.
ObjectFileName Optional string parameter.

Specifies a name to override the default object file name; can be file or directory name.

Use /Fo[name].
OmitFramePointers Optional bool parameter.

Suppresses creation of frame pointers on the call stack.
Optimization Optional string parameter.

Specifies the optimization level for the application.

Custom, custom optimization.
Disabled, disable optimization (use O0).
MinSize, optimize for size (use Os).
MaxSpeed, optimize for speed (use O2).
Full, expensive optimizations (use O3).
PositionIndependentCode Optional bool parameter.

Generate Position Independent Code (PIC) for use in a shared library.
PrecompiledHeader Optional string parameter.

Enables creation or use of a precompiled header during the build.
PrecompiledHeaderFile Optional string parameter.

Specifies header file name to use for precompiled header file. This file will be also added to Forced Include Files during build.
PrecompiledHeaderOutputFileDirectory Optional string parameter.

Specifies the directory for the generated precompiled header. This directory will be also added to Additional Include Directories during build.
PrecompiledHeaderCompileAs Optional string parameter.

Select compile language option for precompiled header file.

Use -x c-header, -x c++-header.
PreprocessorDefinitions Optional string[] parameter.

Defines a preprocessing symbols for your source file.

Use -D.
RuntimeLibrary Optional string parameter.

Specify runtime library for linking.

Use MSVC /MT, /MTd, /MD, /MDd switches.

MultiThreaded, causes your application to use the multithread, static version of the run-time library.
MultiThreadedDebug, defines _DEBUG and _MT. This option also causes the compiler to place the library name LIBCMTD.lib into the .obj file so that the linker will use LIBCMTD.lib to resolve external symbols.
MultiThreadedDLL, causes your application to use the multithread- and DLL-specific version of the run-time library. Defines _MT and _DLL and causes the compiler to place the library name MSVCRT.lib into the .obj file.
MultiThreadedDebugDLL, defines _DEBUG, _MT, and _DLL and causes your application to use the debug multithread- and DLL-specific version of the run-time library. It also causes the compiler to place the library name MSVCRTD.lib into the .obj file.
RuntimeTypeInfo Optional bool parameter.

Adds code for checking C++ object types at run time (runtime type information).

Use frtti, fno-rtti.
ShowIncludes Optional bool parameter.

Generates a list of include files with compiler output.

Use -H.
Sources Required ITaskItem[] parameter.
StrictAliasing Optional bool parameter.

Assume the strictest aliasing rules. An object of one type will never be assumed to reside at the same address as an object of a different type.
Sysroot Optional string parameter.

Folder path to the root directory for headers and libraries.
TargetArch Optional string parameter.

Target Architecture.
ThumbMode Optional string parameter.

Generate code that executes for thumb microarchitecture. This is applicable for arm architecture only.

Thumb, generate Thumb code (use mthumb).
ARM, generate Arm code (use marm).
Disabled, option not applicable for chosen platform.
TrackerLogDirectory Optional string parameter.

Tracker Log Directory.
TreatWarningAsError Optional bool parameter.

Treats all compiler warnings as errors.

For a new project, it may be best to use /WX in all compilations; resolving all warnings will ensure the fewest possible hard-to-find code defects.
UndefinePreprocessorDefinitions Optional string[] parameter.

Specifies one or more preprocessor undefines.

Use -U [macro].
UndefineAllPreprocessorDefinitions Optional bool parameter.

Undefine all previously defined preprocessor values.

Use -undef.
UseMultiToolTask Optional bool parameter.

Multi-processor Compilation.
UseShortEnums Optional bool parameter.

Enum type uses only as many bytes required by input set of possible values.
Verbose Optional bool parameter.

Show commands to run and use verbose output.
WarningLevel Optional string parameter.

Select how strict you want the compiler to be about code errors. Other flags should be added directly to Additional Options (se /w, /Weverything).

TurnOffAllWarnings, disables all compiler warnings (use w).
EnableAllWarnings, enables all warnings, including those disabled by default (use Wall).

See also

Task reference