//===-- driver/cl_options.h - LDC command line options ----------*- C++ -*-===// // // LDC – the LLVM D compiler // // This file is distributed under the BSD-style LDC license. See the LICENSE // file for details. // //===----------------------------------------------------------------------===// // // Defines the LDC command line options as handled using the LLVM command // line parsing library. // //===----------------------------------------------------------------------===// #pragma once #include "driver/cl_helpers.h" #include "driver/cl_options-llvm.h" #include "driver/targetmachine.h" #include "llvm/ADT/SmallVector.h" #include "llvm/Support/CodeGen.h" #include "llvm/Support/CommandLine.h" #include #include namespace llvm { class FastMathFlags; class TargetMachine; } namespace opts { namespace cl = llvm::cl; /// Stores the commandline arguments list, including the ones specified by the /// config and response files. extern llvm::SmallVector allArguments; extern cl::OptionCategory linkingCategory; /* Mostly generated with the following command: egrep -e '^(cl::|#if|#e)' gen/cl_options.cpp \ | sed -re 's/^(cl::.*)\(.*$/ extern \1;/' */ extern cl::list fileList; extern cl::list runargs; extern cl::opt invokedByLDMD; extern cl::opt compileOnly; extern cl::opt emitDwarfDebugInfo; extern cl::opt noAsm; extern cl::opt dontWriteObj; extern cl::opt objectFile; extern cl::opt objectDir; extern cl::opt soname; extern cl::opt output_bc; extern cl::opt output_ll; extern cl::opt output_mlir; extern cl::opt output_s; extern cl::opt output_o; extern cl::opt ddocDir; extern cl::opt ddocFile; extern cl::opt jsonFile; extern cl::list jsonFields; extern cl::opt hdrDir; extern cl::opt hdrFile; extern cl::opt hdrKeepAllBodies; extern cl::opt cxxHdrDir; extern cl::opt cxxHdrFile; extern cl::opt mixinFile; extern cl::list versions; extern cl::list transitions; extern cl::list previews; extern cl::list reverts; extern cl::opt moduleDeps; extern cl::opt makeDeps; extern cl::opt cacheDir; extern cl::list linkerSwitches; extern cl::list ccSwitches; extern cl::list cppSwitches; extern cl::list includeModulePatterns; extern cl::opt m32bits; extern cl::opt m64bits; extern cl::opt mTargetTriple; extern cl::opt mABI; extern FloatABI::Type floatABI; extern cl::opt disableLinkerStripDead; enum class SymbolVisibility { default_, hidden, public_ }; extern cl::opt symbolVisibility; extern cl::opt dllimport; extern cl::opt noPLT; extern cl::opt useDIP25; extern cl::opt useDIP1000; // Math options extern bool fFastMath; extern llvm::FastMathFlags defaultFMF; void setDefaultMathOptions(llvm::TargetOptions &targetOptions); extern cl::opt fNoDiscardValueNames; extern cl::opt fNullPointerIsValid; extern cl::opt fNoExceptions; extern cl::opt fNoModuleInfo; extern cl::opt fNoRTTI; extern cl::opt fSplitStack; // Arguments to -d-debug extern std::vector debugArgs; // Arguments to -run void createClashingOptions(); void hideLLVMOptions(); enum class CoverageIncrement { _default, atomic, nonatomic, boolean }; extern cl::opt coverageIncrement; // Compilation time tracing options extern cl::opt fTimeTrace; extern cl::opt fTimeTraceFile; extern cl::opt fTimeTraceGranularity; // LTO options enum LTOKind { LTO_None, LTO_Full, LTO_Thin, }; extern cl::opt ltoMode; inline bool isUsingLTO() { return ltoMode != LTO_None; } inline bool isUsingThinLTO() { return ltoMode == LTO_Thin; } extern cl::opt ltoFatObjects; extern cl::opt saveOptimizationRecord; extern cl::opt fWarnStackSize; #if LDC_LLVM_SUPPORTED_TARGET_SPIRV || LDC_LLVM_SUPPORTED_TARGET_NVPTX extern cl::list dcomputeTargets; extern cl::opt dcomputeFilePrefix; #endif #if defined(LDC_DYNAMIC_COMPILE) extern cl::opt enableDynamicCompile; extern cl::opt dynamicCompileTlsWorkaround; #else constexpr bool enableDynamicCompile = false; #endif }