From e6c2e948c882e8b62ace92343c01a79d40df495e Mon Sep 17 00:00:00 2001 From: Yuka Takahashi Date: Tue, 29 Aug 2017 02:01:56 +0000 Subject: [PATCH] [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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311971 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Driver/Options.td | 9 ++++++++- test/Driver/autocomplete.c | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/include/clang/Driver/Options.td b/include/clang/Driver/Options.td index 88b7680e4f..d80e9d6c45 100644 --- a/include/clang/Driver/Options.td +++ b/include/clang/Driver/Options.td @@ -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, HelpText<"Language standard to compile for">; + 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">; diff --git a/test/Driver/autocomplete.c b/test/Driver/autocomplete.c index 06e700f1ac..bfa37328d5 100644 --- a/test/Driver/autocomplete.c +++ b/test/Driver/autocomplete.c @@ -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 -- 2.40.0