[llvm-branch-commits] [cfe-branch] r309438 - Merging r309113:

Hans Wennborg via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Jul 28 14:31:07 PDT 2017


Author: hans
Date: Fri Jul 28 14:31:07 2017
New Revision: 309438

URL: http://llvm.org/viewvc/llvm-project?rev=309438&view=rev
Log:
Merging r309113:
------------------------------------------------------------------------
r309113 | yamaguchi | 2017-07-26 06:36:58 -0700 (Wed, 26 Jul 2017) | 19 lines

[Bash-autocompletion] Show HelpText with possible flags

Summary:
`clang --autocomplete=-std` will show
```
-std:   Language standard to compile for
-std=   Language standard to compile for
-stdlib=        C++ standard library to use
```
after this change.

However, showing HelpText with completion in bash seems super tricky, so
this feature will be used in other shells (fish, zsh...).

Reviewers: v.g.vassilev, teemperor, ruiu

Subscribers: cfe-commits, hiraditya

Differential Revision: https://reviews.llvm.org/D35759
------------------------------------------------------------------------

Modified:
    cfe/branches/release_50/   (props changed)
    cfe/branches/release_50/lib/Driver/Driver.cpp
    cfe/branches/release_50/test/Driver/autocomplete.c
    cfe/branches/release_50/utils/bash-autocomplete.sh

Propchange: cfe/branches/release_50/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Jul 28 14:31:07 2017
@@ -1,4 +1,4 @@
 /cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:308455,308824,308897,309058,309112,309226,309327
+/cfe/trunk:308455,308824,308897,309058,309112-309113,309226,309327
 /cfe/trunk/test:170344
 /cfe/trunk/test/SemaTemplate:126920

Modified: cfe/branches/release_50/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_50/lib/Driver/Driver.cpp?rev=309438&r1=309437&r2=309438&view=diff
==============================================================================
--- cfe/branches/release_50/lib/Driver/Driver.cpp (original)
+++ cfe/branches/release_50/lib/Driver/Driver.cpp Fri Jul 28 14:31:07 2017
@@ -1294,7 +1294,7 @@ bool Driver::HandleImmediateArgs(const C
     std::sort(SuggestedCompletions.begin(), SuggestedCompletions.end(),
               [](StringRef A, StringRef B) { return A.compare_lower(B) < 0; });
 
-    llvm::outs() << llvm::join(SuggestedCompletions, " ") << '\n';
+    llvm::outs() << llvm::join(SuggestedCompletions, "\n") << '\n';
     return false;
   }
 

Modified: cfe/branches/release_50/test/Driver/autocomplete.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_50/test/Driver/autocomplete.c?rev=309438&r1=309437&r2=309438&view=diff
==============================================================================
--- cfe/branches/release_50/test/Driver/autocomplete.c (original)
+++ cfe/branches/release_50/test/Driver/autocomplete.c Fri Jul 28 14:31:07 2017
@@ -1,46 +1,91 @@
 // RUN: %clang --autocomplete=-fsyn | FileCheck %s -check-prefix=FSYN
 // FSYN: -fsyntax-only
-// RUN: %clang --autocomplete=-s | FileCheck %s -check-prefix=STD
-// STD: -std={{.*}}-stdlib=
+// RUN: %clang --autocomplete=-std= | FileCheck %s -check-prefix=STD
+// STD: -std= Language standard to compile for
 // RUN: %clang --autocomplete=foo | FileCheck %s -check-prefix=FOO
 // FOO-NOT: foo
 // RUN: %clang --autocomplete=-stdlib=,l | FileCheck %s -check-prefix=STDLIB
-// STDLIB: libc++ libstdc++
+// STDLIB: libc++
+// STDLIB-NEXT: libstdc++
 // RUN: %clang --autocomplete=-stdlib=, | FileCheck %s -check-prefix=STDLIBALL
-// STDLIBALL: libc++ libstdc++ platform
+// STDLIBALL: libc++
+// STDLIBALL-NEXT: libstdc++
+// STDLIBALL-NEXT: platform
 // RUN: %clang --autocomplete=-meabi,d | FileCheck %s -check-prefix=MEABI
 // MEABI: default
 // RUN: %clang --autocomplete=-meabi, | FileCheck %s -check-prefix=MEABIALL
-// MEABIALL: 4 5 default gnu
+// MEABIALL: 4
+// MEABIALL-NEXT: 5
+// MEABIALL-NEXT: default
+// MEABIALL-NEXT: gnu
 // RUN: %clang --autocomplete=-cl-std=,CL2 | FileCheck %s -check-prefix=CLSTD
 // CLSTD: CL2.0
 // RUN: %clang --autocomplete=-cl-std=, | FileCheck %s -check-prefix=CLSTDALL
-// CLSTDALL: cl CL cl1.1 CL1.1 cl1.2 CL1.2 cl2.0 CL2.0
+// CLSTDALL: cl
+// CLSTDALL-NEXT: CL
+// CLSTDALL-NEXT: cl1.1
+// CLSTDALL-NEXT: CL1.1
+// CLSTDALL-NEXT: cl1.2
+// CLSTDALL-NEXT: CL1.2
+// CLSTDALL-NEXT: cl2.0
+// CLSTDALL-NEXT: CL2.0
 // RUN: %clang --autocomplete=-fno-sanitize-coverage=,f | FileCheck %s -check-prefix=FNOSANICOVER
 // FNOSANICOVER: func
 // RUN: %clang --autocomplete=-fno-sanitize-coverage=, | FileCheck %s -check-prefix=FNOSANICOVERALL
-// FNOSANICOVERALL: 8bit-counters bb edge func indirect-calls inline-8bit-counters no-prune trace-bb trace-cmp trace-div trace-gep trace-pc trace-pc-guard
+// FNOSANICOVERALL: 8bit-counters
+// FNOSANICOVERALL-NEXT: bb
+// FNOSANICOVERALL-NEXT: edge
+// FNOSANICOVERALL-NEXT: func
+// FNOSANICOVERALL-NEXT: indirect-calls
+// FNOSANICOVERALL-NEXT: inline-8bit-counters
+// 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
 // RUN: %clang --autocomplete=-ffp-contract=, | FileCheck %s -check-prefix=FFPALL
-// FFPALL: fast off on
+// FFPALL: fast
+// FFPALL-NEXT: off
+// FFPALL-NEXT: on
 // RUN: %clang --autocomplete=-flto=, | FileCheck %s -check-prefix=FLTOALL
-// FLTOALL: full thin
+// FLTOALL: full
+// FLTOALL-NEXT: thin
 // RUN: %clang --autocomplete=-fveclib=, | FileCheck %s -check-prefix=FVECLIBALL
-// FVECLIBALL: Accelerate none SVML
+// FVECLIBALL: Accelerate
+// FVECLIBALL-NEXT: none
+// FVECLIBALL-NEXT: SVML
 // RUN: %clang --autocomplete=-fshow-overloads=, | FileCheck %s -check-prefix=FSOVERALL
-// FSOVERALL: all best
+// FSOVERALL: all
+// FSOVERALL-NEXT: best
 // RUN: %clang --autocomplete=-fvisibility=, | FileCheck %s -check-prefix=FVISIBILITYALL
-// FVISIBILITYALL: default hidden
+// FVISIBILITYALL: default
+// FVISIBILITYALL-NEXT: hidden
 // RUN: %clang --autocomplete=-mfloat-abi=, | FileCheck %s -check-prefix=MFLOATABIALL
-// MFLOATABIALL: hard soft softfp
+// MFLOATABIALL: hard
+// MFLOATABIALL-NEXT: soft
+// MFLOATABIALL-NEXT: softfp
 // RUN: %clang --autocomplete=-mthread-model, | FileCheck %s -check-prefix=MTHREADMODELALL
-// MTHREADMODELALL: posix single
+// MTHREADMODELALL: posix
+// MTHREADMODELALL-NEXT: single
 // RUN: %clang --autocomplete=-mrelocation-model, | FileCheck %s -check-prefix=MRELOCMODELALL
-// MRELOCMODELALL: dynamic-no-pic pic ropi ropi-rwpi rwpi static
+// MRELOCMODELALL: dynamic-no-pic
+// MRELOCMODELALL-NEXT: pic
+// MRELOCMODELALL-NEXT: ropi
+// MRELOCMODELALL-NEXT: ropi-rwpi
+// MRELOCMODELALL-NEXT: rwpi
+// MRELOCMODELALL-NEXT: static
 // RUN: %clang --autocomplete=-mrelocation-mode | FileCheck %s -check-prefix=MRELOCMODEL_CLANG
 // MRELOCMODEL_CLANG-NOT: -mrelocation-model
 // RUN: %clang --autocomplete=#-mrelocation-mode | FileCheck %s -check-prefix=MRELOCMODEL_CC1
 // MRELOCMODEL_CC1: -mrelocation-model
 // RUN: %clang --autocomplete=-Wma | FileCheck %s -check-prefix=WARNING
-// WARNING: -Wmacro-redefined -Wmain -Wmain-return-type -Wmalformed-warning-check -Wmany-braces-around-scalar-init -Wmax-unsigned-zero
+// WARNING: -Wmacro-redefined
+// WARNING-NEXT: -Wmain
+// WARNING-NEXT: -Wmain-return-type
+// WARNING-NEXT: -Wmalformed-warning-check
+// WARNING-NEXT: -Wmany-braces-around-scalar-init
+// WARNING-NEXT: -Wmax-unsigned-zero
 // RUN: %clang --autocomplete=-Wno-invalid-pp- | FileCheck %s -check-prefix=NOWARNING
 // NOWARNING: -Wno-invalid-pp-token

Modified: cfe/branches/release_50/utils/bash-autocomplete.sh
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_50/utils/bash-autocomplete.sh?rev=309438&r1=309437&r2=309438&view=diff
==============================================================================
--- cfe/branches/release_50/utils/bash-autocomplete.sh (original)
+++ cfe/branches/release_50/utils/bash-autocomplete.sh Fri Jul 28 14:31:07 2017
@@ -57,7 +57,7 @@ _clang()
 
   # expand ~ to $HOME
   eval local path=${COMP_WORDS[0]}
-  flags=$( "$path" --autocomplete="$arg" 2>/dev/null )
+  flags=$( "$path" --autocomplete="$arg" 2>/dev/null | sed -e 's/\t.*//' )
   # If clang is old that it does not support --autocomplete,
   # fall back to the filename completion.
   if [[ "$?" != 0 ]]; then




More information about the llvm-branch-commits mailing list