r311971 - [Bash-autocompletion] Add support for -std=

Yuka Takahashi via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 28 19:01:57 PDT 2017


Author: yamaguchi
Date: Mon Aug 28 19:01:56 2017
New Revision: 311971

URL: http://llvm.org/viewvc/llvm-project?rev=311971&view=rev
Log:
[Bash-autocompletion] Add support for -std=

Summary:
Add support for autocompleting values of -std= by including
LangStandards.def. This patch relies on D36782, and is using two-stage
code generation.

Reviewers: v.g.vassilev, teemperor, ruiu

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D36820

Modified:
    cfe/trunk/include/clang/Driver/Options.td
    cfe/trunk/test/Driver/autocomplete.c

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=311971&r1=311970&r2=311971&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Mon Aug 28 19:01:56 2017
@@ -2270,7 +2270,14 @@ def static_libstdcxx : Flag<["-"], "stat
 def static : Flag<["-", "--"], "static">, Flags<[NoArgumentUnused]>;
 def std_default_EQ : Joined<["-"], "std-default=">;
 def std_EQ : Joined<["-", "--"], "std=">, Flags<[CC1Option]>,
-  Group<CompileOnly_Group>, HelpText<"Language standard to compile for">;
+  Group<CompileOnly_Group>, HelpText<"Language standard to compile for">,
+  ValuesCode<[{
+    const char *Values =
+    #define LANGSTANDARD(id, name, lang, desc, features) name ","
+    #define LANGSTANDARD_ALIAS(id, alias) alias ","
+    #include "clang/Frontend/LangStandards.def"
+    ;
+  }]>;
 def stdlib_EQ : Joined<["-", "--"], "stdlib=">, Flags<[CC1Option]>,
   HelpText<"C++ standard library to use">, Values<"libc++,libstdc++,platform">;
 def sub__library : JoinedOrSeparate<["-"], "sub_library">;

Modified: cfe/trunk/test/Driver/autocomplete.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/autocomplete.c?rev=311971&r1=311970&r2=311971&view=diff
==============================================================================
--- cfe/trunk/test/Driver/autocomplete.c (original)
+++ cfe/trunk/test/Driver/autocomplete.c Mon Aug 28 19:01:56 2017
@@ -95,3 +95,5 @@
 // NOWARNING: -Wno-invalid-pp-token
 // RUN: %clang --autocomplete=-analyzer-checker, | FileCheck %s -check-prefix=ANALYZER
 // ANALYZER: unix.Malloc
+// RUN: %clang --autocomplete=-std=, | FileCheck %s -check-prefix=STDVAL
+// STDVAL: c99




More information about the cfe-commits mailing list