llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

Missing options in `clang -help` and `flang-new -help`

Open banach-space opened this issue 2 years ago • 8 comments

Clang's driver library doesn't print -fsyntax-only or -O{0|1|2|3} options when using the -help option. This can be reproduced with clang as well as flang-new (which is built in terms of clangDriver):

$ clang  -help | grep syntax
  -objcmt-migrate-property-dot-syntax
                          Enable migration of setter/getter messages to property-dot syntax
$

(-fsyntax-only is missing). I suspect that this might affect other options too. Printing happens via OptTable::printHelp, but I don't see any obvious issues with that method.

This isn't that noticeable in Clang as clang -help | wc -l gives me ~1200. But for flang-new this is ~50. Checked with 333f98b4b688.

Thanks, -Andrzej

banach-space avatar Aug 09 '22 18:08 banach-space

@llvm/issue-subscribers-good-first-issue

llvmbot avatar Aug 09 '22 18:08 llvmbot

@llvm/issue-subscribers-clang-driver

llvmbot avatar Aug 09 '22 18:08 llvmbot

@llvm/issue-subscribers-flang-driver

llvmbot avatar Aug 09 '22 18:08 llvmbot

Clang has a --help-hidden flag which prints a few more options, but still no -fsyntax-only. It has no HelpText text in https://github.com/llvm/llvm-project/blob/b83d0d46c0b197c36c671493a3339d8d7a8bcd6a/clang/include/clang/Driver/Options.td#L2797

Meinersbur avatar Aug 09 '22 18:08 Meinersbur

It has no HelpText text

Ah, that's the badger! No help text, no output in clang/flang-new -help: https://github.com/llvm/llvm-project/blob/e5e93b6130bde96d7e14851e218c5bf055f8a834/llvm/lib/Option/OptTable.cpp#L670-L674

Well spotted @Meinersbur ! So one just needs to add some basic description.

banach-space avatar Aug 10 '22 10:08 banach-space

Hi, I would like to try myself in solving this issue.

alexiprof avatar Aug 12 '22 16:08 alexiprof

I have attached a patch with a fix here https://reviews.llvm.org/D131808

alexiprof avatar Aug 12 '22 21:08 alexiprof

ping, reviewers.

alexiprof avatar Aug 16 '22 13:08 alexiprof