Skip to content

[flang][driver] support -dumpversion and -dumpmachine #68896

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions clang/include/clang/Driver/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -1375,9 +1375,13 @@ def dsym_dir : JoinedOrSeparate<["-"], "dsym-dir">,
def dumpdir : Separate<["-"], "dumpdir">, Visibility<[ClangOption, CC1Option]>,
MetaVarName<"<dumppfx>">,
HelpText<"Use <dumpfpx> as a prefix to form auxiliary and dump file names">;
def dumpmachine : Flag<["-"], "dumpmachine">;
def dumpmachine : Flag<["-"], "dumpmachine">,
Visibility<[ClangOption, FlangOption]>,
HelpText<"Display the compiler's target processor">;
def dumpversion : Flag<["-"], "dumpversion">,
Visibility<[ClangOption, FlangOption]>,
HelpText<"Display the version of the compiler">;
def dumpspecs : Flag<["-"], "dumpspecs">, Flags<[Unsupported]>;
def dumpversion : Flag<["-"], "dumpversion">;
def dylib__file : Separate<["-"], "dylib_file">;
def dylinker__install__name : JoinedOrSeparate<["-"], "dylinker_install_name">;
def dylinker : Flag<["-"], "dylinker">;
Expand Down
2 changes: 2 additions & 0 deletions flang/test/Driver/driver-help-hidden.f90
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
! CHECK-NEXT: -ccc-print-phases Dump list of actions to perform
! CHECK-NEXT: -cpp Enable predefined and command line preprocessor macros
! CHECK-NEXT: -c Only run preprocess, compile, and assemble steps
! CHECK-NEXT: -dumpmachine Display the compiler's target processor
! CHECK-NEXT: -dumpversion Display the version of the compiler
! CHECK-NEXT: -D <macro>=<value> Define <macro> to <value> (or 1 if <value> omitted)
! CHECK-NEXT: -emit-llvm Use the LLVM representation for assembler and object files
! CHECK-NEXT: -E Only run the preprocessor
Expand Down
2 changes: 2 additions & 0 deletions flang/test/Driver/driver-help.f90
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
! HELP-NEXT: -### Print (but do not run) the commands to run for this compilation
! HELP-NEXT: -cpp Enable predefined and command line preprocessor macros
! HELP-NEXT: -c Only run preprocess, compile, and assemble steps
! HELP-NEXT: -dumpmachine Display the compiler's target processor
! HELP-NEXT: -dumpversion Display the version of the compiler
! HELP-NEXT: -D <macro>=<value> Define <macro> to <value> (or 1 if <value> omitted)
! HELP-NEXT: -emit-llvm Use the LLVM representation for assembler and object files
! HELP-NEXT: -E Only run the preprocessor
Expand Down
8 changes: 8 additions & 0 deletions flang/test/Driver/dumpmachine.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
! Test that -dumpmachine prints the target triple.

! Note: Debian GCC may omit "unknown-".
! RUN: %flang --target=x86_64-linux-gnu -dumpmachine | FileCheck %s --check-prefix=X86_64
! X86_64: x86_64-unknown-linux-gnu

! RUN: %flang --target=xxx-pc-freebsd -dumpmachine | FileCheck %s --check-prefix=FREEBSD
! FREEBSD: xxx-pc-freebsd
2 changes: 2 additions & 0 deletions flang/test/Driver/immediate-options.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
! RUN: %flang -dumpversion | FileCheck %s -check-prefix=DUMPVERSION
! DUMPVERSION: {{[0-9]+\.[0-9.]+}}