[PATCH] D30547: [clang-tidy] Forwarding reference overload in constructors

2017-03-23 Thread András Leitereg via Phabricator via cfe-commits
leanil marked 3 inline comments as done.
leanil added inline comments.



Comment at: clang-tidy/misc/ForwardingReferenceOverloadCheck.cpp:125-126
+}
+diag(Ctor->getLocation(), "function %0 can hide copy and move 
constructors")
+<< Ctor;
+  }

aaron.ballman wrote:
> xazax.hun wrote:
> > aaron.ballman wrote:
> > > xazax.hun wrote:
> > > > aaron.ballman wrote:
> > > > > aaron.ballman wrote:
> > > > > > leanil wrote:
> > > > > > > aaron.ballman wrote:
> > > > > > > > I think a better diagnostic might be: "constructor accepting a 
> > > > > > > > universal reference hides the %select{copy|move|both the copy 
> > > > > > > > and move}0 %select{constructor{|s}1"
> > > > > > > > 
> > > > > > > > And then provide a note ("%select{copy|move}0 constructor 
> > > > > > > > declared here") that points to the offending copy and/or move 
> > > > > > > > constructor.
> > > > > > > Without checking actual constructor calls, I would have to make 
> > > > > > > notes on every (non disabled) copy / move constructor, any time I 
> > > > > > > produce a warning. And as the warning already states where the 
> > > > > > > problem lies, the notes would only help people find the copy and 
> > > > > > > move constructors. Do you think that's necessary? 
> > > > > > The warning states where the forwarding reference constructor is, 
> > > > > > but it doesn't state where the conflicting constructors are. When 
> > > > > > we issue diagnostics like that, we generally use notes so that the 
> > > > > > user can see all of the locations involved -- the user may want to 
> > > > > > get rid of the other constructors, or they may want to get rid of 
> > > > > > the forwarding reference constructor. Also, saying "can hide" 
> > > > > > implies that it isn't hiding anything at all, just that it's 
> > > > > > possible to do so. Tightening up the wording and showing all of the 
> > > > > > locations involved solves both problems.
> > > > > This isn't quite complete. It's still an ambiguous statement to say 
> > > > > "it can hide"; it does hide these constructors, and we even know 
> > > > > which ones. Emit the notes before you emit the main diagnostic and 
> > > > > you can use the `%select` suggested originally to be specific in the 
> > > > > diagnostic.
> > > > We can not say for sure without looking at a concrete call whether a 
> > > > constructor is "hidden" or not. It is always determined during the 
> > > > overload resolution.
> > > > 
> > > > This check does not consider the calls, because that way it would 
> > > > always miss the possible misuses if libraries. 
> > > I can see the logic in that. I guess I'm thinking of it the same way we 
> > > use the phrase "hidden" when describing code like:
> > > ```
> > > struct Base {
> > >   virtual void f(int);
> > > };
> > > 
> > > struct Derived : Base {
> > >   void f(double);
> > > };
> > > 
> > > ```
> > > We claim Derived::f() hides Base::f() without considering the callers.
> > I see. In that case maybe we should come up with a less confusing term like 
> > hijacking overload? The constructors are still part of the overload set, so 
> > no hiding as in the standard's nomenclature happens here, but the overload 
> > resolution is not doing what the user would expect in these cases. 
> I'm also fine going back to being somewhat more wishy-washy in our phrasing 
> (can hide).
> 
> What do you think about using the %select to specify what can be hidden, 
> rather than always talking about copy and move constructors (one of which may 
> not even be present in the user's source)?
I think the (assumed) use of a compiler generated copy or move is similarly 
problematic as in the case of a user defined one, so I would keep mentioning 
both.


Repository:
  rL LLVM

https://reviews.llvm.org/D30547



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D30547: [clang-tidy] Forwarding reference overload in constructors

2017-03-23 Thread András Leitereg via Phabricator via cfe-commits
leanil updated this revision to Diff 92765.
leanil added a comment.

Simplify the note generation and correct the documentation.


Repository:
  rL LLVM

https://reviews.llvm.org/D30547

Files:
  clang-tidy/misc/CMakeLists.txt
  clang-tidy/misc/ForwardingReferenceOverloadCheck.cpp
  clang-tidy/misc/ForwardingReferenceOverloadCheck.h
  clang-tidy/misc/MiscTidyModule.cpp
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/misc-forwarding-reference-overload.rst
  test/clang-tidy/misc-forwarding-reference-overload.cpp

Index: test/clang-tidy/misc-forwarding-reference-overload.cpp
===
--- /dev/null
+++ test/clang-tidy/misc-forwarding-reference-overload.cpp
@@ -0,0 +1,105 @@
+// RUN: %check_clang_tidy %s misc-forwarding-reference-overload %t
+
+namespace std {
+template 
+struct enable_if {};
+
+template 
+struct enable_if { typedef T type; };
+
+template 
+using enable_if_t = typename enable_if::type;
+
+template 
+struct enable_if_nice { typedef T type; };
+}
+
+namespace foo {
+template 
+struct enable_if { typedef T type; };
+}
+
+template 
+constexpr bool just_true = true;
+
+class Person {
+public:
+  template 
+  Person(T &);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: constructor accepting a forwarding reference can hide copy and move constructors [misc-forwarding-reference-overload]
+
+  template 
+  Person(T &, int i = 5, ...);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: constructor accepting a forwarding reference can hide copy and move constructors [misc-forwarding-reference-overload]
+
+  template ::type>
+  Person(T &);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: constructor accepting a forwarding reference can hide copy and move constructors [misc-forwarding-reference-overload]
+
+  template 
+  Person(T &, typename foo::enable_if::type i = 5, ...);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: constructor accepting a forwarding reference can hide copy and move constructors [misc-forwarding-reference-overload]
+
+  Person(const Person ) {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: note: copy constructor declared here
+
+  Person(Person ) {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: note: copy constructor declared here
+
+  Person(Person &) {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: note: move constructor declared here
+};
+
+template 
+class Person2 {
+public:
+  // Two parameters without default value, can't act as copy / move constructor.
+  template 
+  Person2(T &, V &, int i = 5, ...);
+
+  // Guarded with enable_if.
+  template 
+  Person2(T &, int i = 5, std::enable_if_t a = 5, ...);
+
+  // Guarded with enable_if.
+  template ::type &>
+  Person2(T &);
+
+  // Guarded with enable_if.
+  template 
+  Person2(T &, typename std::enable_if::type **a = nullptr);
+
+  // Guarded with enable_if.
+  template > *&&>
+  Person2(T &, double d = 0.0);
+
+  // Not a forwarding reference parameter.
+  template 
+  Person2(const T &);
+
+  // Not a forwarding reference parameter.
+  Person2(int &);
+
+  // Two parameters without default value, can't act as copy / move constructor.
+  template 
+  Person2(T &, int x);
+
+  // Not a forwarding reference parameter.
+  template 
+  Person2(U &);
+};
+
+// Copy and move constructors are both disabled.
+class Person3 {
+public:
+  template 
+  Person3(T &);
+
+  template 
+  Person3(T &, int I = 5, ...);
+
+  Person3(const Person3 ) = delete;
+
+private:
+  Person3(Person3 &);
+};
Index: docs/clang-tidy/checks/misc-forwarding-reference-overload.rst
===
--- /dev/null
+++ docs/clang-tidy/checks/misc-forwarding-reference-overload.rst
@@ -0,0 +1,52 @@
+.. title:: clang-tidy - misc-forwarding-reference-overload
+
+misc-forwarding-reference-overload
+==
+
+The check looks for perfect forwarding constructors that can hide copy or move
+constructors. If a non const lvalue reference is passed to the constructor, the 
+forwarding reference parameter will be a better match than the const reference
+parameter of the copy constructor, so the perfect forwarding constructor will be
+called, which can be confusing.
+For detailed description of this issue see: Scott Meyers, Effective Modern C++,
+Item 26.
+
+Consider the following example:
+
+  .. code-block:: c++
+  
+class Person {
+public:
+  // C1: perfect forwarding ctor
+  template
+  explicit Person(T&& n) {}
+
+  // C2: perfect forwarding ctor with parameter default value
+  template
+  explicit Person(T&& n, int x = 1) {}
+  
+  // C3: perfect forwarding ctor guarded with enable_if
+  template,void>>
+  explicit Person(T&& n) {}
+  
+  // (possibly compiler generated) copy ctor
+  Person(const Person& rhs); 
+};
+
+The check warns for constructors C1 and C2, because those can hide copy and move

[PATCH] D30388: [XRay] Add -fxray-{always, never}-instrument= flags to clang

2017-03-23 Thread Dean Michael Berris via Phabricator via cfe-commits
dberris added a comment.

In https://reviews.llvm.org/D30388#707719, @rnk wrote:

> I think you need some driver logic to make sure the xray lists show up in .d 
> files so that modifications to them trigger rebuilds in most build systems. 
> See the SanitizerArgs.cpp driver logic for this.


Good catch -- yes, added.

Also took the opportunity to refactor the flag logic out into its own class 
(similar to how we do it with the sanitizers).




Comment at: include/clang/Basic/XRayFunctionFilter.h:1
+//===--- XRayFunctionFilter.h - XRay automatic-attribution --*- C++ 
-*-===//
+//

rnk wrote:
> Do you think XRayLists.h might be a better name for this header? It's 
> analagous to SanitizerBlacklist.h, but it's not a "black" list.
Good idea -- although the names of the type defined doesn't have any 
resemblance to the lists. I suppose that's fine too.



Comment at: lib/Basic/XRayFunctionFilter.cpp:21
+: AlwaysInstrument(
+  llvm::SpecialCaseList::createOrDie(AlwaysInstrumentPaths)),
+  
NeverInstrument(llvm::SpecialCaseList::createOrDie(NeverInstrumentPaths)),

rnk wrote:
> Hm, phab ate my comment about this. I don't think we should use this API in 
> clang. Instead, we should use the `::create(...)` version and issue a 
> diagnostic similar to err_drv_malformed_sanitizer_blacklist from the caller 
> of this function.
That's fair -- although I am just looking at what SanitizerLists already does. 
I've added the validation of the flags though at the driver level to ensure 
that we don't initialise this in a manner that's not valid.


https://reviews.llvm.org/D30388



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D30388: [XRay] Add -fxray-{always, never}-instrument= flags to clang

2017-03-23 Thread Dean Michael Berris via Phabricator via cfe-commits
dberris updated this revision to Diff 92766.
dberris marked 2 inline comments as done.
dberris added a comment.

- fixup: address reviewer comments


https://reviews.llvm.org/D30388

Files:
  include/clang/AST/ASTContext.h
  include/clang/Basic/LangOptions.def
  include/clang/Basic/LangOptions.h
  include/clang/Basic/XRayLists.h
  include/clang/Driver/Options.td
  include/clang/Driver/ToolChain.h
  include/clang/Driver/XRayArgs.h
  lib/AST/ASTContext.cpp
  lib/Basic/CMakeLists.txt
  lib/Basic/LangOptions.cpp
  lib/Basic/XRayLists.cpp
  lib/CodeGen/CodeGenFunction.cpp
  lib/CodeGen/CodeGenModule.cpp
  lib/CodeGen/CodeGenModule.h
  lib/Driver/CMakeLists.txt
  lib/Driver/ToolChain.cpp
  lib/Driver/ToolChains/Clang.cpp
  lib/Driver/XRayArgs.cpp
  lib/Frontend/CompilerInvocation.cpp
  test/CodeGen/xray-always-instrument.cpp

Index: test/CodeGen/xray-always-instrument.cpp
===
--- /dev/null
+++ test/CodeGen/xray-always-instrument.cpp
@@ -0,0 +1,15 @@
+// RUN: echo "fun:*foo*" > %t.always-instrument
+// RUN: echo "src:*xray-always-instrument.cpp" >> %t.always-instrument
+// RUN: %clang_cc1 -fxray-instrument -x c++ -std=c++11 -fxray-always-instrument=%t.always-instrument -emit-llvm -o - %s -triple x86_64-unknown-linux-gnu | FileCheck %s
+
+void foo() {}
+
+[[clang::xray_never_instrument]] void bar() {}
+
+void baz() {}
+
+// CHECK: define void @_Z3foov() #[[ALWAYSATTR:[0-9]+]] {
+// CHECK: define void @_Z3barv() #[[NEVERATTR:[0-9]+]] {
+// CHECK: define void @_Z3bazv() #[[ALWAYSATTR:[0-9]+]] {
+// CHECK: attributes #[[ALWAYSATTR]] = {{.*}} "function-instrument"="xray-always" {{.*}}
+// CHECK: attributes #[[NEVERATTR]] = {{.*}} "function-instrument"="xray-never" {{.*}}
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -2300,6 +2300,14 @@
   Opts.SanitizeAddressFieldPadding =
   getLastArgIntValue(Args, OPT_fsanitize_address_field_padding, 0, Diags);
   Opts.SanitizerBlacklistFiles = Args.getAllArgValues(OPT_fsanitize_blacklist);
+
+  // -fxray-{always,never}-instrument= filenames.
+  Opts.XRayInstrument =
+  Args.hasFlag(OPT_fxray_instrument, OPT_fnoxray_instrument, false);
+  Opts.XRayAlwaysInstrumentFiles =
+  Args.getAllArgValues(OPT_fxray_always_instrument);
+  Opts.XRayNeverInstrumentFiles =
+  Args.getAllArgValues(OPT_fxray_never_instrument);
 }
 
 static void ParsePreprocessorArgs(PreprocessorOptions , ArgList ,
Index: lib/Driver/XRayArgs.cpp
===
--- /dev/null
+++ lib/Driver/XRayArgs.cpp
@@ -0,0 +1,113 @@
+//===--- XRayArgs.cpp - Arguments for XRay ===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+#include "clang/Driver/XRayArgs.h"
+#include "ToolChains/CommonArgs.h"
+#include "clang/Driver/Driver.h"
+#include "clang/Driver/DriverDiagnostic.h"
+#include "clang/Driver/Options.h"
+#include "clang/Driver/ToolChain.h"
+#include "llvm/ADT/StringExtras.h"
+#include "llvm/ADT/StringSwitch.h"
+#include "llvm/Support/FileSystem.h"
+#include "llvm/Support/Path.h"
+#include "llvm/Support/SpecialCaseList.h"
+
+using namespace clang;
+using namespace clang::driver;
+using namespace llvm::opt;
+
+namespace {
+constexpr char XRayInstrumentOption[] = "-fxray-instrument";
+constexpr char XRayInstructionThresholdOption[] =
+"-fxray-instruction-threshold=";
+constexpr char XRayAlwaysInstrumentOption[] = "-fxray-always-instrument=";
+constexpr char XRayNeverInstrumentOption[] = "-fxray-never-instrument=";
+} // namespace
+
+XRayArgs::XRayArgs(const ToolChain , const ArgList ) {
+  const Driver  = TC.getDriver();
+  const llvm::Triple  = TC.getTriple();
+  if (Args.hasFlag(options::OPT_fxray_instrument,
+   options::OPT_fnoxray_instrument, false)) {
+if (Triple.getOS() == llvm::Triple::Linux)
+  switch (Triple.getArch()) {
+  case llvm::Triple::x86_64:
+  case llvm::Triple::arm:
+  case llvm::Triple::aarch64:
+  case llvm::Triple::ppc64le:
+  case llvm::Triple::mips:
+  case llvm::Triple::mipsel:
+  case llvm::Triple::mips64:
+  case llvm::Triple::mips64el:
+break;
+  default:
+D.Diag(diag::err_drv_clang_unsupported)
+<< (std::string(XRayInstrumentOption) + " on " + Triple.str());
+  }
+else
+  D.Diag(diag::err_drv_clang_unsupported)
+  << (std::string(XRayInstrumentOption) + " on non-Linux target OS");
+XRayInstrument = true;
+if (const Arg *A =
+Args.getLastArg(options::OPT_fxray_instruction_threshold_,
+

[libcxx] r298582 - Silence a couple of 'unused variable' warnings in c++03 tests. No functional change

2017-03-23 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Thu Mar 23 01:25:26 2017
New Revision: 298582

URL: http://llvm.org/viewvc/llvm-project?rev=298582=rev
Log:
Silence a couple of 'unused variable' warnings in c++03 tests. No functional 
change

Modified:

libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/auto_ptr.pass.cpp

libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp

Modified: 
libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/auto_ptr.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/auto_ptr.pass.cpp?rev=298582=298581=298582=diff
==
--- 
libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/auto_ptr.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/auto_ptr.pass.cpp
 Thu Mar 23 01:25:26 2017
@@ -86,6 +86,7 @@ int main()
 // Without rvalue references, ptr got copied into
 // the shared_ptr destructor and the copy was
 // destroyed during unwinding.
+(void) raw_ptr; // silence 'unused variable' warning
 assert(A::count == 0);
 assert(B::count == 0);
 #endif

Modified: 
libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp?rev=298582=298581=298582=diff
==
--- 
libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp
 Thu Mar 23 01:25:26 2017
@@ -80,6 +80,7 @@ int main()
 assert(B::count == 1);
 assert(ptr.get() == raw_ptr);
 #else
+(void) raw_ptr; // silence 'unused variable' warning
 assert(A::count == 0);
 assert(B::count == 0);
 assert(ptr.get() == 0);


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r298581 - Worked around GCC bug 56480. Explicit specialization in a different namespace.

2017-03-23 Thread Michael Park via cfe-commits
Author: mpark
Date: Thu Mar 23 01:21:24 2017
New Revision: 298581

URL: http://llvm.org/viewvc/llvm-project?rev=298581=rev
Log:
Worked around GCC bug 56480. Explicit specialization in a different namespace.

Summary: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56480

Reviewers: EricWF

Reviewed By: EricWF

Differential Revision: https://reviews.llvm.org/D31273

Modified:
libcxx/trunk/test/std/utilities/optional/optional.hash/hash.pass.cpp
libcxx/trunk/test/std/utilities/variant/variant.hash/hash.pass.cpp

Modified: libcxx/trunk/test/std/utilities/optional/optional.hash/hash.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/optional/optional.hash/hash.pass.cpp?rev=298581=298580=298581=diff
==
--- libcxx/trunk/test/std/utilities/optional/optional.hash/hash.pass.cpp 
(original)
+++ libcxx/trunk/test/std/utilities/optional/optional.hash/hash.pass.cpp Thu 
Mar 23 01:21:24 2017
@@ -22,11 +22,15 @@
 struct A {};
 struct B {};
 
+namespace std {
+
 template <>
-struct std::hash {
+struct hash {
   size_t operator()(B const&) { return 0; }
 };
 
+}
+
 int main()
 {
 using std::optional;

Modified: libcxx/trunk/test/std/utilities/variant/variant.hash/hash.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/variant/variant.hash/hash.pass.cpp?rev=298581=298580=298581=diff
==
--- libcxx/trunk/test/std/utilities/variant/variant.hash/hash.pass.cpp 
(original)
+++ libcxx/trunk/test/std/utilities/variant/variant.hash/hash.pass.cpp Thu Mar 
23 01:21:24 2017
@@ -125,13 +125,17 @@ void test_hash_variant_duplicate_element
 struct A {};
 struct B {};
 
+namespace std {
+
 template <>
-struct std::hash {
+struct hash {
   size_t operator()(B const&) const {
 return 0;
   }
 };
 
+}
+
 void test_hash_variant_enabled() {
   {
 test_hash_enabled_for_type();


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r298580 - Can't test for noexcept on C++03; std::hash isn't available until C++17

2017-03-23 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Thu Mar 23 01:20:18 2017
New Revision: 298580

URL: http://llvm.org/viewvc/llvm-project?rev=298580=rev
Log:
Can't test for noexcept on C++03; std::hash isn't available until 
C++17

Modified:
libcxx/trunk/include/functional
libcxx/trunk/test/std/utilities/function.objects/unord.hash/pointer.pass.cpp
libcxx/trunk/test/support/test_macros.h

Modified: libcxx/trunk/include/functional
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/functional?rev=298580=298579=298580=diff
==
--- libcxx/trunk/include/functional (original)
+++ libcxx/trunk/include/functional Thu Mar 23 01:20:18 2017
@@ -470,6 +470,7 @@ template <> struct hash;
 template <> struct hash;
 
 template struct hash;
+template <> struct hash;  // C++17
 
 }  // std
 

Modified: 
libcxx/trunk/test/std/utilities/function.objects/unord.hash/pointer.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/function.objects/unord.hash/pointer.pass.cpp?rev=298580=298579=298580=diff
==
--- 
libcxx/trunk/test/std/utilities/function.objects/unord.hash/pointer.pass.cpp 
(original)
+++ 
libcxx/trunk/test/std/utilities/function.objects/unord.hash/pointer.pass.cpp 
Thu Mar 23 01:20:18 2017
@@ -41,13 +41,16 @@ test()
 assert(h() != h());
 }
 
+// can't hash nullptr_t until c++17
 void test_nullptr()
 {
+#if TEST_STD_VER > 14
 typedef std::nullptr_t T;
 typedef std::hash H;
 static_assert((std::is_same::value), "" );
 static_assert((std::is_same::value), 
"" );
 ASSERT_NOEXCEPT(H()(T()));
+#endif
 }
 
 int main()

Modified: libcxx/trunk/test/support/test_macros.h
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/test_macros.h?rev=298580=298579=298580=diff
==
--- libcxx/trunk/test/support/test_macros.h (original)
+++ libcxx/trunk/test/support/test_macros.h Thu Mar 23 01:20:18 2017
@@ -150,11 +150,16 @@
 #define TEST_NORETURN [[noreturn]]
 #endif
 
+#if TEST_STD_VER < 11
+#define ASSERT_NOEXCEPT(...)
+#define ASSERT_NOT_NOEXCEPT(...)
+#else
 #define ASSERT_NOEXCEPT(...) \
 static_assert(noexcept(__VA_ARGS__), "Operation must be noexcept")
 
 #define ASSERT_NOT_NOEXCEPT(...) \
 static_assert(!noexcept(__VA_ARGS__), "Operation must NOT be noexcept")
+#endif
 
 /* Macros for testing libc++ specific behavior and extensions */
 #if defined(_LIBCPP_VERSION)


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


<    1   2