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