@@ -2134,6 +2134,7 @@ void CompilerInvocation::setLangDefaults(LangOptions &Opts, InputKind IK,
2134
2134
Opts.C99 = Std.isC99 ();
2135
2135
Opts.C11 = Std.isC11 ();
2136
2136
Opts.C17 = Std.isC17 ();
2137
+ Opts.C2x = Std.isC2x ();
2137
2138
Opts.CPlusPlus = Std.isCPlusPlus ();
2138
2139
Opts.CPlusPlus11 = Std.isCPlusPlus11 ();
2139
2140
Opts.CPlusPlus14 = Std.isCPlusPlus14 ();
@@ -2200,6 +2201,9 @@ void CompilerInvocation::setLangDefaults(LangOptions &Opts, InputKind IK,
2200
2201
Opts.AlignedAllocation = Opts.CPlusPlus17 ;
2201
2202
2202
2203
Opts.DollarIdents = !Opts.AsmPreprocessor ;
2204
+
2205
+ // Enable [[]] attributes in C++11 and C2x by default.
2206
+ Opts.DoubleSquareBracketAttributes = Opts.CPlusPlus11 || Opts.C2x ;
2203
2207
}
2204
2208
2205
2209
// / Attempt to parse a visibility value out of the given argument.
@@ -2605,10 +2609,10 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
2605
2609
Opts.BlocksRuntimeOptional = Args.hasArg (OPT_fblocks_runtime_optional);
2606
2610
Opts.Coroutines = Opts.CPlusPlus2a || Args.hasArg (OPT_fcoroutines_ts);
2607
2611
2608
- // Enable [[]] attributes in C++11 by default.
2609
2612
Opts.DoubleSquareBracketAttributes =
2610
2613
Args.hasFlag (OPT_fdouble_square_bracket_attributes,
2611
- OPT_fno_double_square_bracket_attributes, Opts.CPlusPlus11 );
2614
+ OPT_fno_double_square_bracket_attributes,
2615
+ Opts.DoubleSquareBracketAttributes );
2612
2616
2613
2617
Opts.CPlusPlusModules = Opts.CPlusPlus2a ;
2614
2618
Opts.ModulesTS = Args.hasArg (OPT_fmodules_ts);
0 commit comments