2017-08-02 15:20:27 +08:00
|
|
|
// Test for the --autocompletion flag, which is an API used for shell
|
|
|
|
// autocompletion. You may have to update tests in this file when you
|
|
|
|
// add/modify flags, change HelpTexts or the values of some flags.
|
|
|
|
|
2017-09-05 20:41:00 +08:00
|
|
|
// Some corner cases.
|
|
|
|
// Just test that this doesn't crash:
|
2018-03-05 16:54:20 +08:00
|
|
|
// RUN: %clang --autocomplete=
|
2017-09-05 20:41:00 +08:00
|
|
|
// RUN: %clang --autocomplete=,
|
|
|
|
// RUN: %clang --autocomplete==
|
|
|
|
// RUN: %clang --autocomplete=,,
|
|
|
|
// RUN: %clang --autocomplete=-
|
|
|
|
|
2017-05-24 02:39:08 +08:00
|
|
|
// RUN: %clang --autocomplete=-fsyn | FileCheck %s -check-prefix=FSYN
|
|
|
|
// FSYN: -fsyntax-only
|
2018-03-05 16:54:20 +08:00
|
|
|
// RUN: %clang --autocomplete=-std | FileCheck %s -check-prefix=STD
|
2017-07-26 21:36:58 +08:00
|
|
|
// STD: -std= Language standard to compile for
|
2017-06-22 00:50:38 +08:00
|
|
|
// RUN: %clang --autocomplete=foo | FileCheck %s -check-prefix=FOO
|
|
|
|
// FOO-NOT: foo
|
2017-06-21 00:31:31 +08:00
|
|
|
// RUN: %clang --autocomplete=-stdlib=,l | FileCheck %s -check-prefix=STDLIB
|
2017-07-26 21:36:58 +08:00
|
|
|
// STDLIB: libc++
|
|
|
|
// STDLIB-NEXT: libstdc++
|
2018-03-05 16:54:20 +08:00
|
|
|
// RUN: %clang --autocomplete=-stdlib= | FileCheck %s -check-prefix=STDLIBALL
|
2017-07-26 21:36:58 +08:00
|
|
|
// STDLIBALL: libc++
|
|
|
|
// STDLIBALL-NEXT: libstdc++
|
|
|
|
// STDLIBALL-NEXT: platform
|
2017-06-21 00:31:31 +08:00
|
|
|
// RUN: %clang --autocomplete=-meabi,d | FileCheck %s -check-prefix=MEABI
|
|
|
|
// MEABI: default
|
2018-10-24 20:43:25 +08:00
|
|
|
// RUN: %clang --autocomplete=-meabi, | FileCheck %s -check-prefix=MEABIALL
|
2018-03-05 16:54:20 +08:00
|
|
|
// RUN: %clang --autocomplete=-meabi | FileCheck %s -check-prefix=MEABIALL
|
2017-07-26 21:36:58 +08:00
|
|
|
// MEABIALL: 4
|
|
|
|
// MEABIALL-NEXT: 5
|
|
|
|
// MEABIALL-NEXT: default
|
|
|
|
// MEABIALL-NEXT: gnu
|
2017-06-21 00:31:31 +08:00
|
|
|
// RUN: %clang --autocomplete=-cl-std=,CL2 | FileCheck %s -check-prefix=CLSTD
|
|
|
|
// CLSTD: CL2.0
|
2018-03-05 16:54:20 +08:00
|
|
|
// RUN: %clang --autocomplete=-cl-std= | FileCheck %s -check-prefix=CLSTDALL
|
2019-07-25 19:04:29 +08:00
|
|
|
|
|
|
|
// CLSTDALL: cl
|
2017-07-26 21:36:58 +08:00
|
|
|
// CLSTDALL-NEXT: CL
|
2020-11-11 21:45:58 +08:00
|
|
|
// CLSTDALL-NEXT: cl1.0
|
|
|
|
// CLSTDALL-NEXT: CL1.0
|
2017-07-26 21:36:58 +08:00
|
|
|
// CLSTDALL-NEXT: cl1.1
|
|
|
|
// CLSTDALL-NEXT: CL1.1
|
|
|
|
// CLSTDALL-NEXT: cl1.2
|
|
|
|
// CLSTDALL-NEXT: CL1.2
|
|
|
|
// CLSTDALL-NEXT: cl2.0
|
|
|
|
// CLSTDALL-NEXT: CL2.0
|
2020-10-09 22:13:39 +08:00
|
|
|
// CLSTDALL-NEXT: cl3.0
|
|
|
|
// CLSTDALL-NEXT: CL3.0
|
2019-07-25 19:04:29 +08:00
|
|
|
// CLSTDALL-NEXT: clc++
|
|
|
|
// CLSTDALL-NEXT: CLC++
|
2017-06-21 00:31:31 +08:00
|
|
|
// RUN: %clang --autocomplete=-fno-sanitize-coverage=,f | FileCheck %s -check-prefix=FNOSANICOVER
|
|
|
|
// FNOSANICOVER: func
|
2018-03-05 16:54:20 +08:00
|
|
|
// RUN: %clang --autocomplete=-fno-sanitize-coverage= | FileCheck %s -check-prefix=FNOSANICOVERALL
|
2017-07-26 21:36:58 +08:00
|
|
|
// FNOSANICOVERALL: 8bit-counters
|
|
|
|
// FNOSANICOVERALL-NEXT: bb
|
|
|
|
// FNOSANICOVERALL-NEXT: edge
|
|
|
|
// FNOSANICOVERALL-NEXT: func
|
|
|
|
// FNOSANICOVERALL-NEXT: indirect-calls
|
|
|
|
// FNOSANICOVERALL-NEXT: inline-8bit-counters
|
2020-04-09 17:33:36 +08:00
|
|
|
// FNOSANICOVERALL-NEXT: inline-bool-flag
|
2017-07-26 21:36:58 +08:00
|
|
|
// FNOSANICOVERALL-NEXT: no-prune
|
|
|
|
// FNOSANICOVERALL-NEXT: trace-bb
|
|
|
|
// FNOSANICOVERALL-NEXT: trace-cmp
|
|
|
|
// FNOSANICOVERALL-NEXT: trace-div
|
|
|
|
// FNOSANICOVERALL-NEXT: trace-gep
|
|
|
|
// FNOSANICOVERALL-NEXT: trace-pc
|
|
|
|
// FNOSANICOVERALL-NEXT: trace-pc-guard
|
2018-03-05 16:54:20 +08:00
|
|
|
// RUN: %clang --autocomplete=-ffp-contract= | FileCheck %s -check-prefix=FFPALL
|
2017-07-26 21:36:58 +08:00
|
|
|
// FFPALL: fast
|
[HIP] Fix regressions due to fp contract change
Recently HIP toolchain made a change to use clang instead of opt/llc to do compilation
(https://reviews.llvm.org/D81861). The intention is to make HIP toolchain canonical like
other toolchains.
However, this change introduced an unintentional change regarding backend fp fuse
option, which caused regressions in some HIP applications.
Basically before the change, HIP toolchain used clang to generate bitcode, then use
opt/llc to optimize bitcode and generate ISA. As such, the amdgpu backend takes
the default fp fuse mode which is 'Standard'. This mode respect contract flag of
fmul/fadd instructions and do not fuse fmul/fadd instructions without contract flag.
However, after the change, HIP toolchain now use clang to generate IR, do optimization,
and generate ISA as one process. Now amdgpu backend fp fuse option is determined
by -ffp-contract option, which is 'fast' by default. And this -ffp-contract=fast language option
is translated to 'Fast' fp fuse option in backend. Suddenly backend starts to fuse fmul/fadd
instructions without contract flag.
This causes wrong result for some device library functions, e.g. tan(-1e20), which should
return 0.8446, now returns -0.933. What is worse is that since backend with 'Fast' fp fuse
option does not respect contract flag, there is no way to use #pragma clang fp contract
directive to enforce fp contract requirements.
This patch fixes the regression by introducing a new value 'fast-honor-pragmas' for -ffp-contract
and use it for HIP by default. 'fast-honor-pragmas' is equivalent to 'fast' in frontend but
let the backend to use 'Standard' fp fuse option. 'fast-honor-pragmas' is useful since 'Fast'
fp fuse option in backend does not honor contract flag, it is of little use to HIP
applications since all code with #pragma STDC FP_CONTRACT or any IR from a
source compiled with -ffp-contract=on is broken.
Differential Revision: https://reviews.llvm.org/D90174
2020-10-24 04:24:48 +08:00
|
|
|
// FFPALL-NEXT: fast-honor-pragmas
|
2017-07-26 21:36:58 +08:00
|
|
|
// FFPALL-NEXT: off
|
|
|
|
// FFPALL-NEXT: on
|
2018-03-05 16:54:20 +08:00
|
|
|
// RUN: %clang --autocomplete=-flto= | FileCheck %s -check-prefix=FLTOALL
|
2017-07-26 21:36:58 +08:00
|
|
|
// FLTOALL: full
|
|
|
|
// FLTOALL-NEXT: thin
|
2018-03-05 16:54:20 +08:00
|
|
|
// RUN: %clang --autocomplete=-fveclib= | FileCheck %s -check-prefix=FVECLIBALL
|
2017-07-26 21:36:58 +08:00
|
|
|
// FVECLIBALL: Accelerate
|
2021-05-16 19:03:36 +08:00
|
|
|
// FVECLIBALL-NEXT: Darwin_libsystem_m
|
2020-10-23 04:00:34 +08:00
|
|
|
// FVECLIBALL-NEXT: libmvec
|
2019-06-05 09:57:57 +08:00
|
|
|
// FVECLIBALL-NEXT: MASSV
|
2017-07-26 21:36:58 +08:00
|
|
|
// FVECLIBALL-NEXT: none
|
|
|
|
// FVECLIBALL-NEXT: SVML
|
2018-03-05 16:54:20 +08:00
|
|
|
// RUN: %clang --autocomplete=-fshow-overloads= | FileCheck %s -check-prefix=FSOVERALL
|
2017-07-26 21:36:58 +08:00
|
|
|
// FSOVERALL: all
|
|
|
|
// FSOVERALL-NEXT: best
|
2018-03-05 16:54:20 +08:00
|
|
|
// RUN: %clang --autocomplete=-fvisibility= | FileCheck %s -check-prefix=FVISIBILITYALL
|
2017-07-26 21:36:58 +08:00
|
|
|
// FVISIBILITYALL: default
|
|
|
|
// FVISIBILITYALL-NEXT: hidden
|
2018-03-05 16:54:20 +08:00
|
|
|
// RUN: %clang --autocomplete=-mfloat-abi= | FileCheck %s -check-prefix=MFLOATABIALL
|
2017-07-26 21:36:58 +08:00
|
|
|
// MFLOATABIALL: hard
|
|
|
|
// MFLOATABIALL-NEXT: soft
|
|
|
|
// MFLOATABIALL-NEXT: softfp
|
2018-03-05 16:54:20 +08:00
|
|
|
// RUN: %clang --autocomplete=-mthread-model | FileCheck %s -check-prefix=MTHREADMODELALL
|
2017-07-26 21:36:58 +08:00
|
|
|
// MTHREADMODELALL: posix
|
|
|
|
// MTHREADMODELALL-NEXT: single
|
2018-03-05 16:54:20 +08:00
|
|
|
// RUN: %clang --autocomplete=-mrelocation-model | FileCheck %s -check-prefix=MRELOCMODELALL
|
2017-07-26 21:36:58 +08:00
|
|
|
// MRELOCMODELALL: dynamic-no-pic
|
|
|
|
// MRELOCMODELALL-NEXT: pic
|
|
|
|
// MRELOCMODELALL-NEXT: ropi
|
|
|
|
// MRELOCMODELALL-NEXT: ropi-rwpi
|
|
|
|
// MRELOCMODELALL-NEXT: rwpi
|
|
|
|
// MRELOCMODELALL-NEXT: static
|
2017-07-16 23:07:20 +08:00
|
|
|
// RUN: %clang --autocomplete=-Wma | FileCheck %s -check-prefix=WARNING
|
2017-07-26 21:36:58 +08:00
|
|
|
// WARNING: -Wmacro-redefined
|
|
|
|
// WARNING-NEXT: -Wmain
|
|
|
|
// WARNING-NEXT: -Wmain-return-type
|
|
|
|
// WARNING-NEXT: -Wmalformed-warning-check
|
|
|
|
// WARNING-NEXT: -Wmany-braces-around-scalar-init
|
2019-10-09 21:22:38 +08:00
|
|
|
// WARNING-NEXT: -Wmax-tokens
|
2017-07-26 21:36:58 +08:00
|
|
|
// WARNING-NEXT: -Wmax-unsigned-zero
|
2017-07-22 20:35:15 +08:00
|
|
|
// RUN: %clang --autocomplete=-Wno-invalid-pp- | FileCheck %s -check-prefix=NOWARNING
|
|
|
|
// NOWARNING: -Wno-invalid-pp-token
|
2018-03-05 16:54:20 +08:00
|
|
|
// RUN: %clang --autocomplete=-analyzer-checker | FileCheck %s -check-prefix=ANALYZER
|
2017-08-29 08:09:31 +08:00
|
|
|
// ANALYZER: unix.Malloc
|
2018-03-05 16:54:20 +08:00
|
|
|
// RUN: %clang --autocomplete=-std= | FileCheck %s -check-prefix=STDVAL
|
2017-08-29 10:01:56 +08:00
|
|
|
// STDVAL: c99
|
2018-03-05 16:54:20 +08:00
|
|
|
//
|
|
|
|
// Clang shouldn't autocomplete CC1 options unless -cc1 or -Xclang were provided
|
|
|
|
// RUN: %clang --autocomplete=-mrelocation-mode | FileCheck %s -check-prefix=MRELOCMODEL_CLANG
|
|
|
|
// MRELOCMODEL_CLANG-NOT: -mrelocation-model
|
|
|
|
// RUN: %clang --autocomplete=-Xclang,-mrelocation-mode | FileCheck %s -check-prefix=MRELOCMODEL_CC1
|
|
|
|
// RUN: %clang --autocomplete=-cc1,-mrelocation-mode | FileCheck %s -check-prefix=MRELOCMODEL_CC1
|
|
|
|
// MRELOCMODEL_CC1: -mrelocation-model
|
|
|
|
// Make sure it ignores passed flags unlesss they are -Xclang or -cc1
|
|
|
|
// RUN: %clang --autocomplete=foo,bar,,-fsyn | FileCheck %s -check-prefix=FSYN-CORON
|
|
|
|
// FSYN-CORON: -fsyntax-only
|
|
|
|
// Check if they can autocomplete values with coron
|
|
|
|
// RUN: %clang --autocomplete=foo,bar,,,-fno-sanitize-coverage=,f | FileCheck %s -check-prefix=FNOSANICOVER-CORON
|
|
|
|
// FNOSANICOVER-CORON: func
|
2018-10-24 16:24:16 +08:00
|
|
|
|
|
|
|
// Clang should return empty string when no value completion was found, which will fall back to file autocompletion
|
|
|
|
// RUN: %clang --autocomplete=-fmodule-file= | FileCheck %s -check-prefix=MODULE_FILE_EQUAL
|
|
|
|
// MODULE_FILE_EQUAL-NOT: -fmodule-file=
|
|
|
|
// RUN: %clang --autocomplete=-fmodule-file | FileCheck %s -check-prefix=MODULE_FILE
|
|
|
|
// MODULE_FILE: -fmodule-file=
|
2018-10-24 20:43:25 +08:00
|
|
|
|
|
|
|
// RUN: %clang --autocomplete=-Qunused-arguments, | FileCheck %s -check-prefix=QUNUSED_COMMA
|
|
|
|
// QUNUSED_COMMA-NOT: -Qunused-arguments
|
|
|
|
// RUN: %clang --autocomplete=-Qunused-arguments | FileCheck %s -check-prefix=QUNUSED
|
|
|
|
// QUNUSED: -Qunused-arguments
|