diff options
author | Aaron Ballman <aaron@aaronballman.com> | 2019-05-14 12:09:55 +0000 |
---|---|---|
committer | Aaron Ballman <aaron@aaronballman.com> | 2019-05-14 12:09:55 +0000 |
commit | 05df5fccd515030158b5fee454ee72f2777247f1 (patch) | |
tree | 50b00f3beb73b225a116feea660be1f6404e6246 /lib/Frontend/CompilerInvocation.cpp | |
parent | 5db60c2ca8308919348af0c96f98d87a888d8d7c (diff) | |
download | clang-05df5fccd515030158b5fee454ee72f2777247f1.tar.gz |
Add a new language mode for C2x; enable [[attribute]] support by default in C2x.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360667 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/CompilerInvocation.cpp')
-rw-r--r-- | lib/Frontend/CompilerInvocation.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index c95c67af6a..e9137bb73c 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -2134,6 +2134,7 @@ void CompilerInvocation::setLangDefaults(LangOptions &Opts, InputKind IK, Opts.C99 = Std.isC99(); Opts.C11 = Std.isC11(); Opts.C17 = Std.isC17(); + Opts.C2x = Std.isC2x(); Opts.CPlusPlus = Std.isCPlusPlus(); Opts.CPlusPlus11 = Std.isCPlusPlus11(); Opts.CPlusPlus14 = Std.isCPlusPlus14(); @@ -2200,6 +2201,9 @@ void CompilerInvocation::setLangDefaults(LangOptions &Opts, InputKind IK, Opts.AlignedAllocation = Opts.CPlusPlus17; Opts.DollarIdents = !Opts.AsmPreprocessor; + + // Enable [[]] attributes in C++11 and C2x by default. + Opts.DoubleSquareBracketAttributes = Opts.CPlusPlus11 || Opts.C2x; } /// Attempt to parse a visibility value out of the given argument. @@ -2605,10 +2609,10 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK, Opts.BlocksRuntimeOptional = Args.hasArg(OPT_fblocks_runtime_optional); Opts.Coroutines = Opts.CPlusPlus2a || Args.hasArg(OPT_fcoroutines_ts); - // Enable [[]] attributes in C++11 by default. Opts.DoubleSquareBracketAttributes = Args.hasFlag(OPT_fdouble_square_bracket_attributes, - OPT_fno_double_square_bracket_attributes, Opts.CPlusPlus11); + OPT_fno_double_square_bracket_attributes, + Opts.DoubleSquareBracketAttributes); Opts.CPlusPlusModules = Opts.CPlusPlus2a; Opts.ModulesTS = Args.hasArg(OPT_fmodules_ts); |