]> granicus.if.org Git - clang/commitdiff
[Bash-autocompletion] Add support for -std=
authorYuka Takahashi <yukatkh@gmail.com>
Tue, 29 Aug 2017 02:01:56 +0000 (02:01 +0000)
committerYuka Takahashi <yukatkh@gmail.com>
Tue, 29 Aug 2017 02:01:56 +0000 (02:01 +0000)
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311971 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Driver/Options.td
test/Driver/autocomplete.c

index 88b7680e4f7341ed36aac732e0d547f7265d3088..d80e9d6c454fd69f2e4772213ab2d4d33ddc14f3 100644 (file)
@@ -2270,7 +2270,14 @@ def static_libstdcxx : Flag<["-"], "static-libstdc++">;
 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">;
index 06e700f1ac887aa772561be61b9281576077792f..bfa37328d59ed899f4c2220e98d9c7a5d8bd5520 100644 (file)
@@ -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