r316275 - Fix a typo with -fno-double-square-bracket-attributes and add a test to demonstrate that it works as expected in C++11 mode. Additionally corrected the handling of -fdouble-square-bracket-attributes to be properly passed down to the cc1 option.

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Sat Oct 21 13:28:58 PDT 2017


Author: aaronballman
Date: Sat Oct 21 13:28:58 2017
New Revision: 316275

URL: http://llvm.org/viewvc/llvm-project?rev=316275&view=rev
Log:
Fix a typo with -fno-double-square-bracket-attributes and add a test to demonstrate that it works as expected in C++11 mode. Additionally corrected the handling of -fdouble-square-bracket-attributes to be properly passed down to the cc1 option.

Added:
    cfe/trunk/test/SemaCXX/attr-cxx-disabled.cpp
Modified:
    cfe/trunk/include/clang/Driver/Options.td
    cfe/trunk/lib/Driver/ToolChains/Clang.cpp

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=316275&r1=316274&r2=316275&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Sat Oct 21 13:28:58 2017
@@ -613,8 +613,8 @@ def fasynchronous_unwind_tables : Flag<[
 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>;

Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=316275&r1=316274&r2=316275&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Sat Oct 21 13:28:58 2017
@@ -4010,6 +4010,9 @@ void Clang::ConstructJob(Compilation &C,
     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);
 

Added: cfe/trunk/test/SemaCXX/attr-cxx-disabled.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/attr-cxx-disabled.cpp?rev=316275&view=auto
==============================================================================
--- cfe/trunk/test/SemaCXX/attr-cxx-disabled.cpp (added)
+++ cfe/trunk/test/SemaCXX/attr-cxx-disabled.cpp Sat Oct 21 13:28:58 2017
@@ -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 at -3 {{declaration of anonymous struct must be a definition}}
+// expected-warning at -4 {{declaration does not declare anything}}
+#else
+// expected-no-diagnostics
+#endif
+




More information about the cfe-commits mailing list