Skip to content

Commit 0e71a8c

Browse files
committed
Merge pull request #512 from klickverbot/help-cleanup
-help output cleanup
2 parents 90d0f6c + 7ca329e commit 0e71a8c

File tree

3 files changed

+61
-5
lines changed

3 files changed

+61
-5
lines changed

driver/cl_options.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ cl::list<std::string> fileList(
2828
cl::Positional, cl::desc("files"));
2929

3030
cl::list<std::string> runargs("run",
31-
cl::desc("program args..."),
31+
cl::desc("Runs the resulting program, passing the remaining arguments to it"),
3232
cl::Positional,
3333
cl::PositionalEatsArgs);
3434

@@ -165,11 +165,11 @@ cl::opt<std::string> ddocFile("Df",
165165

166166
// Json options
167167
static cl::opt<bool, true> doJson("X",
168-
cl::desc("generate JSON file"),
168+
cl::desc("Generate JSON file"),
169169
cl::location(global.params.doXGeneration));
170170

171171
cl::opt<std::string> jsonFile("Xf",
172-
cl::desc("write JSON file to <filename>"),
172+
cl::desc("Write JSON file to <filename>"),
173173
cl::value_desc("filename"),
174174
cl::Prefix);
175175

@@ -206,7 +206,7 @@ static cl::list<std::string, StringsAdapter> stringImportPaths("J",
206206
cl::Prefix);
207207

208208
static cl::opt<bool, true> addMain("main",
209-
cl::desc("add empty main() (e.g. for unittesting)"),
209+
cl::desc("Add empty main() (e.g. for unittesting)"),
210210
cl::ZeroOrMore,
211211
cl::location(global.params.addMain));
212212

driver/main.cpp

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,59 @@ static void initFromString(char*& dest, const cl::opt<std::string>& src) {
141141
}
142142
}
143143

144+
145+
#if LDC_LLVM_VER >= 303
146+
static void hide(llvm::StringMap<cl::Option *>& map, const char* name) {
147+
// Check if option exists first for resilience against LLVM changes
148+
// between versions.
149+
if (map.count(name))
150+
map[name]->setHiddenFlag(cl::Hidden);
151+
}
152+
153+
/// Removes command line options exposed from within LLVM that are unlikely
154+
/// to be useful for end users from the -help output.
155+
static void hideLLVMOptions() {
156+
llvm::StringMap<cl::Option *> map;
157+
cl::getRegisteredOptions(map);
158+
hide(map, "bounds-checking-single-trap");
159+
hide(map, "disable-spill-fusing");
160+
hide(map, "enable-correct-eh-support");
161+
hide(map, "enable-load-pre");
162+
hide(map, "enable-objc-arc-opts");
163+
hide(map, "enable-tbaa");
164+
hide(map, "fatal-assembler-warnings");
165+
hide(map, "internalize-public-api-file");
166+
hide(map, "internalize-public-api-list");
167+
hide(map, "join-liveintervals");
168+
hide(map, "limit-float-precision");
169+
hide(map, "mc-x86-disable-arith-relaxation");
170+
hide(map, "pre-RA-sched");
171+
hide(map, "print-after-all");
172+
hide(map, "print-before-all");
173+
hide(map, "print-machineinstrs");
174+
hide(map, "profile-estimator-loop-weight");
175+
hide(map, "profile-estimator-loop-weight");
176+
hide(map, "profile-file");
177+
hide(map, "profile-info-file");
178+
hide(map, "profile-verifier-noassert");
179+
hide(map, "regalloc");
180+
hide(map, "shrink-wrap");
181+
hide(map, "spiller");
182+
hide(map, "stats");
183+
hide(map, "strip-debug");
184+
hide(map, "struct-path-tbaa");
185+
hide(map, "time-passes");
186+
hide(map, "unit-at-a-time");
187+
hide(map, "verify-dom-info");
188+
hide(map, "verify-loop-info");
189+
hide(map, "verify-regalloc");
190+
hide(map, "verify-region-info");
191+
hide(map, "verify-scev");
192+
hide(map, "x86-early-ifcvt");
193+
hide(map, "x86-use-vzeroupper");
194+
}
195+
#endif
196+
144197
int main(int argc, char **argv);
145198

146199
/// Parses switches from the command line, any response files and the global
@@ -195,6 +248,9 @@ static void parseCommandLine(int argc, char **argv, Strings &sourceFiles, bool &
195248

196249
// Handle fixed-up arguments!
197250
cl::SetVersionPrinter(&printVersion);
251+
#if LDC_LLVM_VER >= 303
252+
hideLLVMOptions();
253+
#endif
198254
cl::ParseCommandLineOptions(final_args.size(), const_cast<char**>(&final_args[0]),
199255
"LDC - the LLVM D compiler\n"
200256
#if LDC_LLVM_VER < 302

gen/logger.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ namespace Logger
5050
static std::string indent_str;
5151

5252
llvm::cl::opt<bool> _enabled("vv",
53-
llvm::cl::desc("Very verbose"),
53+
llvm::cl::desc("Print front-end/glue code debug log"),
5454
llvm::cl::ZeroOrMore);
5555

5656
void indent()

0 commit comments

Comments
 (0)