brintos

brintos / llvm-project-archived public Read only

0
0
Text · 6.2 KiB · 4983b71 Raw
152 lines · c
1// Test for the --autocompletion flag, which is an API used for shell2// autocompletion. You may have to update tests in this file when you3// add/modify flags, change HelpTexts or the values of some flags.4 5// Some corner cases.6// Just test that this doesn't crash:7// RUN: %clang --autocomplete=8// RUN: %clang --autocomplete=,9// RUN: %clang --autocomplete==10// RUN: %clang --autocomplete=,,11// RUN: %clang --autocomplete=-12 13// RUN: %clang --autocomplete=-fsyn | FileCheck %s -check-prefix=FSYN14// FSYN: -fsyntax-only15// RUN: %clang --autocomplete=-std | FileCheck %s -check-prefix=STD16// STD: -std= Language standard to compile for17// RUN: %clang --autocomplete=foo | FileCheck %s -check-prefix=FOO18// FOO-NOT: foo19// RUN: %clang --autocomplete=-stdlib=,l | FileCheck %s -check-prefix=STDLIB20// STDLIB: libc++21// STDLIB-NEXT: libstdc++22// RUN: %clang --autocomplete=-stdlib= | FileCheck %s -check-prefix=STDLIBALL23// STDLIBALL: libc++24// STDLIBALL-NEXT: libstdc++25// STDLIBALL-NEXT: platform26// RUN: %clang --autocomplete=-meabi,d | FileCheck %s -check-prefix=MEABI27// MEABI: default28// RUN: %clang --autocomplete=-meabi, | FileCheck %s -check-prefix=MEABIALL29// RUN: %clang --autocomplete=-meabi | FileCheck %s -check-prefix=MEABIALL30// MEABIALL: 431// MEABIALL-NEXT: 532// MEABIALL-NEXT: default33// MEABIALL-NEXT: gnu34// RUN: %clang --autocomplete=-cl-std=,CL2 | FileCheck %s -check-prefix=CLSTD35// CLSTD: CL2.036// RUN: %clang --autocomplete=-cl-std= | FileCheck %s -check-prefix=CLSTDALL37 38// CLSTDALL: cl39// CLSTDALL-NEXT: CL40// CLSTDALL-NEXT: cl1.041// CLSTDALL-NEXT: CL1.042// CLSTDALL-NEXT: cl1.143// CLSTDALL-NEXT: CL1.144// CLSTDALL-NEXT: cl1.245// CLSTDALL-NEXT: CL1.246// CLSTDALL-NEXT: cl2.047// CLSTDALL-NEXT: CL2.048// CLSTDALL-NEXT: cl3.049// CLSTDALL-NEXT: CL3.050// CLSTDALL-NEXT: clc++51// CLSTDALL-NEXT: CLC++52// CLSTDALL-NEXT: clc++1.053// CLSTDALL-NEXT: CLC++1.054// CLSTDALL-NEXT: clc++202155// CLSTDALL-NEXT: CLC++202156// RUN: %clang --autocomplete=-fno-sanitize-coverage=,f | FileCheck %s -check-prefix=FNOSANICOVER57// FNOSANICOVER: func58// RUN: %clang --autocomplete=-fno-sanitize-coverage= | FileCheck %s -check-prefix=FNOSANICOVERALL59// FNOSANICOVERALL: 8bit-counters60// FNOSANICOVERALL-NEXT: bb61// FNOSANICOVERALL-NEXT: edge62// FNOSANICOVERALL-NEXT: func63// FNOSANICOVERALL-NEXT: indirect-calls64// FNOSANICOVERALL-NEXT: inline-8bit-counters65// FNOSANICOVERALL-NEXT: inline-bool-flag66// FNOSANICOVERALL-NEXT: no-prune67// FNOSANICOVERALL-NEXT: trace-bb68// FNOSANICOVERALL-NEXT: trace-cmp69// FNOSANICOVERALL-NEXT: trace-div70// FNOSANICOVERALL-NEXT: trace-gep71// FNOSANICOVERALL-NEXT: trace-pc72// FNOSANICOVERALL-NEXT: trace-pc-guard73// RUN: %clang --autocomplete=-ffp-contract= | FileCheck %s -check-prefix=FFPALL74// FFPALL: fast75// FFPALL-NEXT: fast-honor-pragmas 76// FFPALL-NEXT: off77// FFPALL-NEXT: on78// RUN: %clang --autocomplete=-flto= | FileCheck %s -check-prefix=FLTOALL79// FLTOALL: full80// FLTOALL-NEXT: thin81// RUN: %clang --autocomplete=-fveclib= | FileCheck %s -check-prefix=FVECLIBALL82// FVECLIBALL: Accelerate83// FVECLIBALL-NEXT: AMDLIBM84// FVECLIBALL-NEXT: ArmPL85// FVECLIBALL-NEXT: Darwin_libsystem_m86// FVECLIBALL-NEXT: libmvec87// FVECLIBALL-NEXT: MASSV88// FVECLIBALL-NEXT: none89// FVECLIBALL-NEXT: SLEEF90// FVECLIBALL-NEXT: SVML91// RUN: %clang --autocomplete=-fshow-overloads= | FileCheck %s -check-prefix=FSOVERALL92// FSOVERALL: all93// FSOVERALL-NEXT: best94// RUN: %clang --autocomplete=-fvisibility= | FileCheck %s -check-prefix=FVISIBILITYALL95// FVISIBILITYALL: default96// FVISIBILITYALL-NEXT: hidden97// RUN: %clang --autocomplete=-mfloat-abi= | FileCheck %s -check-prefix=MFLOATABIALL98// MFLOATABIALL: hard99// MFLOATABIALL-NEXT: soft100// MFLOATABIALL-NEXT: softfp101// RUN: %clang --autocomplete=-mthread-model | FileCheck %s -check-prefix=MTHREADMODELALL102// MTHREADMODELALL: posix103// MTHREADMODELALL-NEXT: single104// RUN: %clang --autocomplete=-mrelocation-model | FileCheck %s -check-prefix=MRELOCMODELALL105// MRELOCMODELALL: dynamic-no-pic106// MRELOCMODELALL-NEXT: pic107// MRELOCMODELALL-NEXT: ropi108// MRELOCMODELALL-NEXT: ropi-rwpi109// MRELOCMODELALL-NEXT: rwpi110// MRELOCMODELALL-NEXT: static111// RUN: %clang --autocomplete=-Wma | FileCheck %s -check-prefix=WARNING112// WARNING: -Wmacro-redefined113// WARNING-NEXT: -Wmain114// WARNING-NEXT: -Wmain-attached-to-named-module115// WARNING-NEXT: -Wmain-return-type116// WARNING-NEXT: -Wmalformed-warning-check117// WARNING-NEXT: -Wmany-braces-around-scalar-init118// WARNING-NEXT: -Wmath-errno-enabled-with-veclib119// WARNING-NEXT: -Wmathematical-notation-identifier-extension120// WARNING-NEXT: -Wmax-tokens121// WARNING-NEXT: -Wmax-unsigned-zero122// RUN: %clang --autocomplete=-Wno-invalid-pp- | FileCheck %s -check-prefix=NOWARNING123// NOWARNING: -Wno-invalid-pp-token124// RUN: %clang --autocomplete=-analyzer-checker | FileCheck %s -check-prefix=ANALYZER125// ANALYZER: unix.Malloc126// RUN: %clang --autocomplete=-std= | FileCheck %s -check-prefix=STDVAL127// STDVAL: c99128//129// Clang shouldn't autocomplete CC1 options unless -cc1 or -Xclang were provided130// RUN: %clang --autocomplete=-mrelocation-mode | FileCheck %s -check-prefix=MRELOCMODEL_CLANG131// MRELOCMODEL_CLANG-NOT: -mrelocation-model132// RUN: %clang --autocomplete=-Xclang,-mrelocation-mode | FileCheck %s -check-prefix=MRELOCMODEL_CC1133// RUN: %clang --autocomplete=-cc1,-mrelocation-mode | FileCheck %s -check-prefix=MRELOCMODEL_CC1134// MRELOCMODEL_CC1: -mrelocation-model135// Make sure it ignores passed flags unlesss they are -Xclang or -cc1136// RUN: %clang --autocomplete=foo,bar,,-fsyn | FileCheck %s -check-prefix=FSYN-CORON137// FSYN-CORON: -fsyntax-only138// Check if they can autocomplete values with coron139// RUN: %clang --autocomplete=foo,bar,,,-fno-sanitize-coverage=,f | FileCheck %s -check-prefix=FNOSANICOVER-CORON140// FNOSANICOVER-CORON: func141 142// Clang should return empty string when no value completion was found, which will fall back to file autocompletion143// RUN: %clang --autocomplete=-fmodule-file= | FileCheck %s -check-prefix=MODULE_FILE_EQUAL144// MODULE_FILE_EQUAL-NOT: -fmodule-file=145// RUN: %clang --autocomplete=-fmodule-file | FileCheck %s -check-prefix=MODULE_FILE146// MODULE_FILE: -fmodule-file=147 148// RUN: %clang --autocomplete=-Qunused-arguments, | FileCheck %s -check-prefix=QUNUSED_COMMA149// QUNUSED_COMMA-NOT: -Qunused-arguments150// RUN: %clang --autocomplete=-Qunused-arguments | FileCheck %s -check-prefix=QUNUSED151// QUNUSED: -Qunused-arguments152