clang  8.0.0svn
CommonArgs.h
Go to the documentation of this file.
1 //===--- CommonArgs.h - Args handling for multiple toolchains ---*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_COMMONARGS_H
11 #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_COMMONARGS_H
12 
13 #include "InputInfo.h"
14 #include "clang/Driver/Driver.h"
15 #include "clang/Driver/Tool.h"
16 #include "clang/Driver/ToolChain.h"
17 #include "llvm/Support/CodeGen.h"
18 
19 namespace clang {
20 namespace driver {
21 namespace tools {
22 
23 void addPathIfExists(const Driver &D, const Twine &Path,
24  ToolChain::path_list &Paths);
25 
26 void AddLinkerInputs(const ToolChain &TC, const InputInfoList &Inputs,
27  const llvm::opt::ArgList &Args,
28  llvm::opt::ArgStringList &CmdArgs, const JobAction &JA);
29 
30 void claimNoWarnArgs(const llvm::opt::ArgList &Args);
31 
32 bool addSanitizerRuntimes(const ToolChain &TC, const llvm::opt::ArgList &Args,
33  llvm::opt::ArgStringList &CmdArgs);
34 
35 void addSanitizerPathLibArgs(const ToolChain &TC,
36  const llvm::opt::ArgList &Args,
37  llvm::opt::ArgStringList &CmdArgs);
38 
39 void linkSanitizerRuntimeDeps(const ToolChain &TC,
40  llvm::opt::ArgStringList &CmdArgs);
41 
42 bool addXRayRuntime(const ToolChain &TC, const llvm::opt::ArgList &Args,
43  llvm::opt::ArgStringList &CmdArgs);
44 
45 void linkXRayRuntimeDeps(const ToolChain &TC,
46  llvm::opt::ArgStringList &CmdArgs);
47 
48 void AddRunTimeLibs(const ToolChain &TC, const Driver &D,
49  llvm::opt::ArgStringList &CmdArgs,
50  const llvm::opt::ArgList &Args);
51 
52 void AddOpenMPLinkerScript(const ToolChain &TC, Compilation &C,
53  const InputInfo &Output,
54  const InputInfoList &Inputs,
55  const llvm::opt::ArgList &Args,
56  llvm::opt::ArgStringList &CmdArgs,
57  const JobAction &JA);
58 
59 void AddHIPLinkerScript(const ToolChain &TC, Compilation &C,
60  const InputInfo &Output, const InputInfoList &Inputs,
61  const llvm::opt::ArgList &Args,
62  llvm::opt::ArgStringList &CmdArgs, const JobAction &JA,
63  const Tool &T);
64 
65 const char *SplitDebugName(const llvm::opt::ArgList &Args,
66  const InputInfo &Output);
67 
68 void SplitDebugInfo(const ToolChain &TC, Compilation &C, const Tool &T,
69  const JobAction &JA, const llvm::opt::ArgList &Args,
70  const InputInfo &Output, const char *OutFile);
71 
72 void AddGoldPlugin(const ToolChain &ToolChain, const llvm::opt::ArgList &Args,
73  llvm::opt::ArgStringList &CmdArgs, const InputInfo &Output,
74  const InputInfo &Input, bool IsThinLTO);
75 
76 std::tuple<llvm::Reloc::Model, unsigned, bool>
77 ParsePICArgs(const ToolChain &ToolChain, const llvm::opt::ArgList &Args);
78 
79 unsigned ParseFunctionAlignment(const ToolChain &TC,
80  const llvm::opt::ArgList &Args);
81 
82 void AddAssemblerKPIC(const ToolChain &ToolChain,
83  const llvm::opt::ArgList &Args,
84  llvm::opt::ArgStringList &CmdArgs);
85 
86 void addArchSpecificRPath(const ToolChain &TC, const llvm::opt::ArgList &Args,
87  llvm::opt::ArgStringList &CmdArgs);
88 /// Returns true, if an OpenMP runtime has been added.
89 bool addOpenMPRuntime(llvm::opt::ArgStringList &CmdArgs, const ToolChain &TC,
90  const llvm::opt::ArgList &Args,
91  bool IsOffloadingHost = false, bool GompNeedsRT = false);
92 
93 llvm::opt::Arg *getLastProfileUseArg(const llvm::opt::ArgList &Args);
94 llvm::opt::Arg *getLastProfileSampleUseArg(const llvm::opt::ArgList &Args);
95 
96 bool isObjCAutoRefCount(const llvm::opt::ArgList &Args);
97 
98 unsigned getLTOParallelism(const llvm::opt::ArgList &Args, const Driver &D);
99 
100 bool areOptimizationsEnabled(const llvm::opt::ArgList &Args);
101 
102 bool isUseSeparateSections(const llvm::Triple &Triple);
103 
104 void addDirectoryList(const llvm::opt::ArgList &Args,
105  llvm::opt::ArgStringList &CmdArgs, const char *ArgName,
106  const char *EnvVar);
107 
108 void AddTargetFeature(const llvm::opt::ArgList &Args,
109  std::vector<StringRef> &Features,
110  llvm::opt::OptSpecifier OnOpt,
111  llvm::opt::OptSpecifier OffOpt, StringRef FeatureName);
112 
113 std::string getCPUName(const llvm::opt::ArgList &Args, const llvm::Triple &T,
114  bool FromAs = false);
115 
116 void handleTargetFeaturesGroup(const llvm::opt::ArgList &Args,
117  std::vector<StringRef> &Features,
118  llvm::opt::OptSpecifier Group);
119 
120 /// Handles the -save-stats option and returns the filename to save statistics
121 /// to.
122 SmallString<128> getStatsFileName(const llvm::opt::ArgList &Args,
123  const InputInfo &Output,
124  const InputInfo &Input, const Driver &D);
125 } // end namespace tools
126 } // end namespace driver
127 } // end namespace clang
128 
129 #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_COMMONARGS_H
void handleTargetFeaturesGroup(const llvm::opt::ArgList &Args, std::vector< StringRef > &Features, llvm::opt::OptSpecifier Group)
SmallVector< std::string, 16 > path_list
Definition: ToolChain.h:90
bool addXRayRuntime(const ToolChain &TC, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
const char * SplitDebugName(const llvm::opt::ArgList &Args, const InputInfo &Output)
bool isUseSeparateSections(const llvm::Triple &Triple)
Definition: CommonArgs.cpp:372
void AddRunTimeLibs(const ToolChain &TC, const Driver &D, llvm::opt::ArgStringList &CmdArgs, const llvm::opt::ArgList &Args)
void AddHIPLinkerScript(const ToolChain &TC, Compilation &C, const InputInfo &Output, const InputInfoList &Inputs, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs, const JobAction &JA, const Tool &T)
void AddTargetFeature(const llvm::opt::ArgList &Args, std::vector< StringRef > &Features, llvm::opt::OptSpecifier OnOpt, llvm::opt::OptSpecifier OffOpt, StringRef FeatureName)
std::string getCPUName(const llvm::opt::ArgList &Args, const llvm::Triple &T, bool FromAs=false)
void linkSanitizerRuntimeDeps(const ToolChain &TC, llvm::opt::ArgStringList &CmdArgs)
void addSanitizerPathLibArgs(const ToolChain &TC, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
void AddGoldPlugin(const ToolChain &ToolChain, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs, const InputInfo &Output, const InputInfo &Input, bool IsThinLTO)
bool addSanitizerRuntimes(const ToolChain &TC, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
void addArchSpecificRPath(const ToolChain &TC, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
bool addOpenMPRuntime(llvm::opt::ArgStringList &CmdArgs, const ToolChain &TC, const llvm::opt::ArgList &Args, bool IsOffloadingHost=false, bool GompNeedsRT=false)
Returns true, if an OpenMP runtime has been added.
void AddOpenMPLinkerScript(const ToolChain &TC, Compilation &C, const InputInfo &Output, const InputInfoList &Inputs, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs, const JobAction &JA)
void addDirectoryList(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs, const char *ArgName, const char *EnvVar)
void linkXRayRuntimeDeps(const ToolChain &TC, llvm::opt::ArgStringList &CmdArgs)
SmallString< 128 > getStatsFileName(const llvm::opt::ArgList &Args, const InputInfo &Output, const InputInfo &Input, const Driver &D)
Handles the -save-stats option and returns the filename to save statistics to.
std::tuple< llvm::Reloc::Model, unsigned, bool > ParsePICArgs(const ToolChain &ToolChain, const llvm::opt::ArgList &Args)
bool isObjCAutoRefCount(const llvm::opt::ArgList &Args)
unsigned ParseFunctionAlignment(const ToolChain &TC, const llvm::opt::ArgList &Args)
void AddAssemblerKPIC(const ToolChain &ToolChain, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
llvm::opt::Arg * getLastProfileSampleUseArg(const llvm::opt::ArgList &Args)
llvm::opt::Arg * getLastProfileUseArg(const llvm::opt::ArgList &Args)
void SplitDebugInfo(const ToolChain &TC, Compilation &C, const Tool &T, const JobAction &JA, const llvm::opt::ArgList &Args, const InputInfo &Output, const char *OutFile)
SmallVector< InputInfo, 4 > InputInfoList
Definition: Tool.h:29
Dataflow Directional Tag Classes.
void AddLinkerInputs(const ToolChain &TC, const InputInfoList &Inputs, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs, const JobAction &JA)
unsigned getLTOParallelism(const llvm::opt::ArgList &Args, const Driver &D)
bool areOptimizationsEnabled(const llvm::opt::ArgList &Args)
void claimNoWarnArgs(const llvm::opt::ArgList &Args)
void addPathIfExists(const Driver &D, const Twine &Path, ToolChain::path_list &Paths)
Definition: CommonArgs.cpp:62