]> granicus.if.org Git - clang/commitdiff
"This adds -fconcepts-ts as a cc1 option for enabling the
authorFaisal Vali <faisalv@yahoo.com>
Fri, 22 May 2015 01:11:10 +0000 (01:11 +0000)
committerFaisal Vali <faisalv@yahoo.com>
Fri, 22 May 2015 01:11:10 +0000 (01:11 +0000)
in-progress implementation of the Concepts TS. The recommended feature
test macro __cpp_experimental_concepts is set to 1 (as opposed to
201501) to indicate that the feature is enabled, but the
implementation is incomplete.

The link to the Concepts TS in cxx_status is updated to refer to the
PDTS (N4377). Additional changes related to __has_feature and
__has_extension are to follow in a later change.

Relevant tests include:

test/Lexer/cxx-features.cpp

The test file is updated with testing of the C++14 + Concepts TS mode.
The expected behaviour is the same as that of the C++14 modes except
for the case of __cpp_experimental_concepts."

- Hubert Tong.

Being committed for Hubert (as per his understanding with Richard Smith) as we start work on the concepts-ts following our preliminary strategy session earlier today.

The patch is tiny and seems quite standard.

Thanks Hubert!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@237982 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/LangOptions.def
include/clang/Driver/CC1Options.td
lib/Frontend/CompilerInvocation.cpp
lib/Frontend/InitPreprocessor.cpp
test/Lexer/cxx-features.cpp
www/cxx_status.html

index baabfe3a49f9bf96b97d2df70ccbcece21f8f684..95d3f0682abd5fb18089888ecc80738e040bc283 100644 (file)
@@ -167,6 +167,7 @@ LANGOPT(CUDADisableTargetCallChecks, 1, 0, "Disable checks for call targets (hos
 
 LANGOPT(AssumeSaneOperatorNew , 1, 1, "implicit __attribute__((malloc)) for C++'s new operators")
 LANGOPT(SizedDeallocation , 1, 0, "enable sized deallocation functions")
+LANGOPT(ConceptsTS , 1, 0, "enable C++ Extensions for Concepts")
 BENIGN_LANGOPT(ElideConstructors , 1, 1, "C++ copy constructor elision")
 BENIGN_LANGOPT(DumpRecordLayouts , 1, 0, "dumping the layout of IRgen'd records")
 BENIGN_LANGOPT(DumpRecordLayoutsSimple , 1, 0, "dumping the layout of IRgen'd records in a simple form")
index 9c1b561bca301dad9087d5a0de339e3df2a550e7..1622c41fe13a49a9165f1b585148930cdf2b3740 100644 (file)
@@ -365,6 +365,8 @@ def fmodules_local_submodule_visibility :
   Flag<["-"], "fmodules-local-submodule-visibility">,
   HelpText<"Enforce name visibility rules across submodules of the same "
            "top-level module.">;
+def fconcepts_ts : Flag<["-"], "fconcepts-ts">,
+  HelpText<"Enable C++ Extensions for Concepts.">;
 
 let Group = Action_Group in {
 
index 2ac34a6f6069a4e364b4b9fb33286c174483ce66..8d3d31228a704f72207193e224373b419b21f88d 100644 (file)
@@ -1537,6 +1537,7 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
   Opts.NoMathBuiltin = Args.hasArg(OPT_fno_math_builtin);
   Opts.AssumeSaneOperatorNew = !Args.hasArg(OPT_fno_assume_sane_operator_new);
   Opts.SizedDeallocation = Args.hasArg(OPT_fsized_deallocation);
+  Opts.ConceptsTS = Args.hasArg(OPT_fconcepts_ts);
   Opts.HeinousExtensions = Args.hasArg(OPT_fheinous_gnu_extensions);
   Opts.AccessControl = !Args.hasArg(OPT_fno_access_control);
   Opts.ElideConstructors = !Args.hasArg(OPT_fno_elide_constructors);
index 0d97709607a13af62e6b3cce2d08100338ded01b..dfc46f47cce32a5598f93bd3d0a6035260d64c36 100644 (file)
@@ -453,6 +453,8 @@ static void InitializeCPlusPlusFeatureTestMacros(const LangOptions &LangOpts,
   }
   if (LangOpts.SizedDeallocation)
     Builder.defineMacro("__cpp_sized_deallocation", "201309");
+  if (LangOpts.ConceptsTS)
+    Builder.defineMacro("__cpp_experimental_concepts", "1");
 }
 
 static void InitializePredefinedMacros(const TargetInfo &TI,
index d06090e73805a1e271a49dce8bc76c763d7ea54f..4ec4d55ac08882fed0e67e81c103c7cfb63efe18 100644 (file)
@@ -1,6 +1,7 @@
 // RUN: %clang_cc1 -std=c++98 -verify %s
 // RUN: %clang_cc1 -std=c++11 -verify %s
 // RUN: %clang_cc1 -std=c++1y -fsized-deallocation -verify %s
+// RUN: %clang_cc1 -std=c++1y -fsized-deallocation -fconcepts-ts -DCONCEPTS_TS=1 -verify %s
 
 // expected-no-diagnostics
 
 #if check(alias_templates, 0, 200704, 200704)
 #error "wrong value for __cpp_alias_templates"
 #endif
+
+#if check(experimental_concepts, 0, 0, CONCEPTS_TS)
+#error "wrong value for __cpp_experimental_concepts"
+#endif
index 5b53cba5fd307eacb9a003ceac8511c2b36ec40e..6585e6103f33a516c2958f89fca6cf8d430b9964 100644 (file)
@@ -631,7 +631,7 @@ Clang version they became available:</p>
     </tr>
     <tr>
       <td>[DRAFT TS] Concepts</td>
-      <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3929.pdf">N3929</a></td>
+      <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4377.pdf">N4377</a></td>
       <td class="none" align="center">No</td>
     </tr>
 </table>