]> granicus.if.org Git - clang/commitdiff
Fix a typo with -fno-double-square-bracket-attributes and add a test to demonstrate...
authorAaron Ballman <aaron@aaronballman.com>
Sat, 21 Oct 2017 20:28:58 +0000 (20:28 +0000)
committerAaron Ballman <aaron@aaronballman.com>
Sat, 21 Oct 2017 20:28:58 +0000 (20:28 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316275 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Driver/Options.td
lib/Driver/ToolChains/Clang.cpp
test/SemaCXX/attr-cxx-disabled.cpp [new file with mode: 0644]

index 526b72f792c0eb913f320f9b0f7cc47e29393f30..9f6152140883f032aba27aa1e20fa0120cc5101f 100644 (file)
@@ -613,8 +613,8 @@ def fasynchronous_unwind_tables : Flag<["-"], "fasynchronous-unwind-tables">, Gr
 def fdouble_square_bracket_attributes : Flag<[ "-" ], "fdouble-square-bracket-attributes">,
   Group<f_Group>, Flags<[DriverOption, CC1Option]>,
   HelpText<"Enable '[[]]' attributes in all C and C++ language modes">;
-def fno_double_square_bracket_attributes : Flag<[ "-" ], "fno-fdouble-square-bracket-attributes">,
-  Group<f_Group>, Flags<[DriverOption]>,
+def fno_double_square_bracket_attributes : Flag<[ "-" ], "fno-double-square-bracket-attributes">,
+  Group<f_Group>, Flags<[DriverOption, CC1Option]>,
   HelpText<"Disable '[[]]' attributes in all C and C++ language modes">;
 
 def fautolink : Flag <["-"], "fautolink">, Group<f_Group>;
index 8e5f3b95735b993f817cb8fd3cc4d80db0a97945..adaf39abc5fd6ebdf064c250bf3bf7d99f4594a9 100644 (file)
@@ -4010,6 +4010,9 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
     CmdArgs.push_back("-fcoroutines-ts");
   }
 
+  Args.AddLastArg(CmdArgs, options::OPT_fdouble_square_bracket_attributes,
+                  options::OPT_fno_double_square_bracket_attributes);
+
   bool HaveModules = false;
   RenderModulesOptions(C, D, Args, Input, Output, CmdArgs, HaveModules);
 
diff --git a/test/SemaCXX/attr-cxx-disabled.cpp b/test/SemaCXX/attr-cxx-disabled.cpp
new file mode 100644 (file)
index 0000000..a1a7533
--- /dev/null
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -fsyntax-only -fno-double-square-bracket-attributes -verify -pedantic -std=c++11 -DERRORS %s
+// RUN: %clang_cc1 -fsyntax-only -fdouble-square-bracket-attributes -verify -pedantic -std=c++11 %s
+
+struct [[]] S {};
+
+#ifdef ERRORS
+// expected-error@-3 {{declaration of anonymous struct must be a definition}}
+// expected-warning@-4 {{declaration does not declare anything}}
+#else
+// expected-no-diagnostics
+#endif
+