Re: r284284 - Reinstate r284008 reverted in r284081, with two fixes:

2016-10-15 Thread Vassil Vassilev via cfe-commits

Thanks!

When calling makeMergedDefinitionVisible shouldn't we get the template 
instantiation pattern?

On 14/10/16 23:41, Richard Smith via cfe-commits wrote:

Author: rsmith
Date: Fri Oct 14 16:41:24 2016
New Revision: 284284

URL: http://llvm.org/viewvc/llvm-project?rev=284284=rev
Log:
Reinstate r284008 reverted in r284081, with two fixes:

1) Merge and demote variable definitions when we find a redefinition in
MergeVarDecls, not only when we find one in AddInitializerToDecl (we only reach
the second case if it's the addition of the initializer itself that converts an
existing declaration into a definition).

2) When rebuilding a redeclaration chain for a variable, if we merge two
definitions together, mark the definitions as merged so the retained definition
is made visible whenever the demoted definition would have been.

Original commit message (from r283882):

[modules] PR28752: Do not instantiate variable declarations which are not 
visible.

Original patch by Vassil Vassilev! Changes listed above are mine.

Added:
 cfe/trunk/test/Modules/Inputs/PR28752/
   - copied from r284080, cfe/trunk/test/Modules/Inputs/PR28752/
 cfe/trunk/test/Modules/pr28752.cpp
   - copied, changed from r284080, cfe/trunk/test/Modules/pr28752.cpp
Modified:
 cfe/trunk/include/clang/AST/Decl.h
 cfe/trunk/include/clang/Sema/Sema.h
 cfe/trunk/lib/AST/Decl.cpp
 cfe/trunk/lib/Sema/SemaDecl.cpp
 cfe/trunk/lib/Sema/SemaTemplate.cpp
 cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
 cfe/trunk/lib/Sema/SemaType.cpp
 cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
 cfe/trunk/lib/Serialization/ASTWriterDecl.cpp
 cfe/trunk/test/Modules/Inputs/PR28752/Subdir1/b.h
 cfe/trunk/test/Modules/Inputs/PR28752/Subdir1/c.h

Modified: cfe/trunk/include/clang/AST/Decl.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Decl.h?rev=284284=284283=284284=diff
==
--- cfe/trunk/include/clang/AST/Decl.h (original)
+++ cfe/trunk/include/clang/AST/Decl.h Fri Oct 14 16:41:24 2016
@@ -865,6 +865,11 @@ protected:
  
  unsigned : NumVarDeclBits;
  
+// FIXME: We need something similar to CXXRecordDecl::DefinitionData.

+/// \brief Whether this variable is a definition which was demoted due to
+/// module merge.
+unsigned IsThisDeclarationADemotedDefinition : 1;
+
  /// \brief Whether this variable is the exception variable in a C++ catch
  /// or an Objective-C @catch statement.
  unsigned ExceptionVar : 1;
@@ -1198,12 +1203,28 @@ public:
InitializationStyle getInitStyle() const {
  return static_cast(VarDeclBits.InitStyle);
}
-
/// \brief Whether the initializer is a direct-initializer (list or call).
bool isDirectInit() const {
  return getInitStyle() != CInit;
}
  
+  /// \brief If this definition should pretend to be a declaration.

+  bool isThisDeclarationADemotedDefinition() const {
+return isa(this) ? false :
+  NonParmVarDeclBits.IsThisDeclarationADemotedDefinition;
+  }
+
+  /// \brief This is a definition which should be demoted to a declaration.
+  ///
+  /// In some cases (mostly module merging) we can end up with two visible
+  /// definitions one of which needs to be demoted to a declaration to keep
+  /// the AST invariants.
+  void demoteThisDefinitionToDeclaration() {
+assert (isThisDeclarationADefinition() && "Not a definition!");
+assert (!isa(this) && "Cannot demote ParmVarDecls!");
+NonParmVarDeclBits.IsThisDeclarationADemotedDefinition = 1;
+  }
+
/// \brief Determine whether this variable is the exception variable in a
/// C++ catch statememt or an Objective-C \@catch statement.
bool isExceptionVariable() const {
@@ -1302,6 +1323,10 @@ public:
  NonParmVarDeclBits.PreviousDeclInSameBlockScope = Same;
}
  
+  /// \brief Retrieve the variable declaration from which this variable could

+  /// be instantiated, if it is an instantiation (rather than a non-template).
+  VarDecl *getTemplateInstantiationPattern() const;
+
/// \brief If this variable is an instantiated static data member of a
/// class template specialization, returns the templated static data member
/// from which it was instantiated.

Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=284284=284283=284284=diff
==
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Fri Oct 14 16:41:24 2016
@@ -2286,6 +2286,7 @@ public:
void MergeVarDecl(VarDecl *New, LookupResult );
void MergeVarDeclTypes(VarDecl *New, VarDecl *Old, bool MergeTypeWithOld);
void MergeVarDeclExceptionSpecs(VarDecl *New, VarDecl *Old);
+  bool checkVarDeclRedefinition(VarDecl *OldDefn, VarDecl *NewDefn);
bool MergeCXXFunctionDecl(FunctionDecl 

[PATCH] D25641: [Driver] Use VFS to perform all distribution checks

2016-10-15 Thread Michał Górny via cfe-commits
mgorny created this revision.
mgorny added reviewers: bruno, rafael, bkramer.
mgorny added subscribers: cfe-commits, bruno.

Use the VFS provided by D.getVFS() for all distribution checks,
including those performing read of the release file. Requested
by @bruno on https://reviews.llvm.org/D24954.


https://reviews.llvm.org/D25641

Files:
  lib/Driver/ToolChains.cpp


Index: lib/Driver/ToolChains.cpp
===
--- lib/Driver/ToolChains.cpp
+++ lib/Driver/ToolChains.cpp
@@ -3844,7 +3844,7 @@
 
 static Distro DetectDistro(const Driver , llvm::Triple::ArchType Arch) {
   llvm::ErrorOr File =
-  llvm::MemoryBuffer::getFile("/etc/lsb-release");
+  D.getVFS().getBufferForFile("/etc/lsb-release");
   if (File) {
 StringRef Data = File.get()->getBuffer();
 SmallVector Lines;
@@ -3876,7 +3876,7 @@
   return Version;
   }
 
-  File = llvm::MemoryBuffer::getFile("/etc/redhat-release");
+  File = D.getVFS().getBufferForFile("/etc/redhat-release");
   if (File) {
 StringRef Data = File.get()->getBuffer();
 if (Data.startswith("Fedora release"))
@@ -3894,7 +3894,7 @@
 return UnknownDistro;
   }
 
-  File = llvm::MemoryBuffer::getFile("/etc/debian_version");
+  File = D.getVFS().getBufferForFile("/etc/debian_version");
   if (File) {
 StringRef Data = File.get()->getBuffer();
 if (Data[0] == '5')


Index: lib/Driver/ToolChains.cpp
===
--- lib/Driver/ToolChains.cpp
+++ lib/Driver/ToolChains.cpp
@@ -3844,7 +3844,7 @@
 
 static Distro DetectDistro(const Driver , llvm::Triple::ArchType Arch) {
   llvm::ErrorOr File =
-  llvm::MemoryBuffer::getFile("/etc/lsb-release");
+  D.getVFS().getBufferForFile("/etc/lsb-release");
   if (File) {
 StringRef Data = File.get()->getBuffer();
 SmallVector Lines;
@@ -3876,7 +3876,7 @@
   return Version;
   }
 
-  File = llvm::MemoryBuffer::getFile("/etc/redhat-release");
+  File = D.getVFS().getBufferForFile("/etc/redhat-release");
   if (File) {
 StringRef Data = File.get()->getBuffer();
 if (Data.startswith("Fedora release"))
@@ -3894,7 +3894,7 @@
 return UnknownDistro;
   }
 
-  File = llvm::MemoryBuffer::getFile("/etc/debian_version");
+  File = D.getVFS().getBufferForFile("/etc/debian_version");
   if (File) {
 StringRef Data = File.get()->getBuffer();
 if (Data[0] == '5')
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [libcxx] r284214 - XFAIL aligned allocation tests for older Clang versions

2016-10-15 Thread Eric Fiselier via cfe-commits
Hi Nico,

Are these tests still broken for you?

/Eric

On Fri, Oct 14, 2016 at 3:21 PM, Eric Fiselier  wrote:

> Hi Nico,
>
> Could you give me more information about the compiler your using?
>
> /Eric
>
> On Fri, Oct 14, 2016 at 1:21 PM, Nico Weber  wrote:
>
>> This is breaking tests for me:
>>
>> Unexpected Passing Tests (4):
>> libc++ :: std/language.support/support.d
>> ynamic/new.delete/new.delete.array/new_align_val_t.pass.cpp
>> libc++ :: std/language.support/support.d
>> ynamic/new.delete/new.delete.array/new_align_val_t_nothrow.pass.cpp
>> libc++ :: std/language.support/support.d
>> ynamic/new.delete/new.delete.single/new_align_val_t.pass.cpp
>> libc++ :: std/language.support/support.d
>> ynamic/new.delete/new.delete.single/new_align_val_t_nothrow.pass.cpp
>>
>> Am I holding something wrong, or are these XFAILs wrong?
>>
>> On Fri, Oct 14, 2016 at 4:47 AM, Eric Fiselier via cfe-commits <
>> cfe-commits@lists.llvm.org> wrote:
>>
>>> Author: ericwf
>>> Date: Fri Oct 14 03:47:09 2016
>>> New Revision: 284214
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=284214=rev
>>> Log:
>>> XFAIL aligned allocation tests for older Clang versions
>>>
>>> Modified:
>>> libcxx/trunk/test/libcxx/test/config.py
>>> libcxx/trunk/test/std/language.support/support.dynamic/new.d
>>> elete/new.delete.array/new_align_val_t.pass.cpp
>>> libcxx/trunk/test/std/language.support/support.dynamic/new.d
>>> elete/new.delete.array/new_align_val_t_nothrow.pass.cpp
>>> libcxx/trunk/test/std/language.support/support.dynamic/new.d
>>> elete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp
>>> libcxx/trunk/test/std/language.support/support.dynamic/new.d
>>> elete/new.delete.array/new_align_val_t_replace.pass.cpp
>>> libcxx/trunk/test/std/language.support/support.dynamic/new.d
>>> elete/new.delete.single/new_align_val_t.pass.cpp
>>> libcxx/trunk/test/std/language.support/support.dynamic/new.d
>>> elete/new.delete.single/new_align_val_t_nothrow.pass.cpp
>>> libcxx/trunk/test/std/language.support/support.dynamic/new.d
>>> elete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp
>>> libcxx/trunk/test/std/language.support/support.dynamic/new.d
>>> elete/new.delete.single/new_align_val_t_replace.pass.cpp
>>>
>>> Modified: libcxx/trunk/test/libcxx/test/config.py
>>> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx
>>> /test/config.py?rev=284214=284213=284214=diff
>>> 
>>> ==
>>> --- libcxx/trunk/test/libcxx/test/config.py (original)
>>> +++ libcxx/trunk/test/libcxx/test/config.py Fri Oct 14 03:47:09 2016
>>> @@ -315,6 +315,10 @@ class Configuration(object):
>>>
>>>  if self.cxx.hasCompileFlag('-faligned-allocation'):
>>>  self.config.available_features.add('-faligned-allocation')
>>> +else:
>>> +# FIXME remove this once more than just clang-4.0 support
>>> +# C++17 aligned allocation.
>>> +self.config.available_features.add('no-aligned-allocation')
>>>
>>>  if self.get_lit_bool('has_libatomic', False):
>>>  self.config.available_features.add('libatomic')
>>>
>>> Modified: libcxx/trunk/test/std/language.support/support.dynamic/new.d
>>> elete/new.delete.array/new_align_val_t.pass.cpp
>>> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/la
>>> nguage.support/support.dynamic/new.delete/new.delete.array/n
>>> ew_align_val_t.pass.cpp?rev=284214=284213=284214=diff
>>> 
>>> ==
>>> --- libcxx/trunk/test/std/language.support/support.dynamic/new.d
>>> elete/new.delete.array/new_align_val_t.pass.cpp (original)
>>> +++ libcxx/trunk/test/std/language.support/support.dynamic/new.d
>>> elete/new.delete.array/new_align_val_t.pass.cpp Fri Oct 14 03:47:09 2016
>>> @@ -9,11 +9,13 @@
>>>
>>>  // UNSUPPORTED: c++98, c++03, c++11, c++14
>>>
>>> -// test operator new
>>> -
>>>  // asan and msan will not call the new handler.
>>>  // UNSUPPORTED: sanitizer-new-delete
>>>
>>> +// XFAIL: no-aligned-allocation
>>> +
>>> +// test operator new
>>> +
>>>  #include 
>>>  #include 
>>>  #include 
>>>
>>> Modified: libcxx/trunk/test/std/language.support/support.dynamic/new.d
>>> elete/new.delete.array/new_align_val_t_nothrow.pass.cpp
>>> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/la
>>> nguage.support/support.dynamic/new.delete/new.delete.array/n
>>> ew_align_val_t_nothrow.pass.cpp?rev=284214=284213=284214=diff
>>> 
>>> ==
>>> --- libcxx/trunk/test/std/language.support/support.dynamic/new.d
>>> elete/new.delete.array/new_align_val_t_nothrow.pass.cpp (original)
>>> +++ libcxx/trunk/test/std/language.support/support.dynamic/new.d
>>> elete/new.delete.array/new_align_val_t_nothrow.pass.cpp Fri Oct 14
>>> 03:47:09 

[PATCH] D25153: preprocessor supports `-dI` flag

2016-10-15 Thread Steve O'Brien via cfe-commits
elsteveogrande added a comment.

Ping


https://reviews.llvm.org/D25153



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


[libcxx] r284310 - Implement LWG2664 and update its status

2016-10-15 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Sat Oct 15 16:29:44 2016
New Revision: 284310

URL: http://llvm.org/viewvc/llvm-project?rev=284310=rev
Log:
Implement LWG2664 and update its status

Added:
libcxx/trunk/test/libcxx/experimental/filesystem/class.path/path.member/

libcxx/trunk/test/libcxx/experimental/filesystem/class.path/path.member/path.append.pass.cpp
Modified:
libcxx/trunk/include/experimental/filesystem
libcxx/trunk/www/upcoming_meeting.html

Modified: libcxx/trunk/include/experimental/filesystem
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/experimental/filesystem?rev=284310=284309=284310=diff
==
--- libcxx/trunk/include/experimental/filesystem (original)
+++ libcxx/trunk/include/experimental/filesystem Sat Oct 15 16:29:44 2016
@@ -759,6 +759,8 @@ private:
 public:
 // appends
 path& operator/=(const path& __p) {
+_LIBCPP_ASSERT(!__p.has_root_name(),
+  "cannot append to a path with a root name");
 __append_sep_if_needed(__p.empty() ? char{} : __p.__pn_[0]);
 __pn_ += __p.native();
 return *this;

Added: 
libcxx/trunk/test/libcxx/experimental/filesystem/class.path/path.member/path.append.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/experimental/filesystem/class.path/path.member/path.append.pass.cpp?rev=284310=auto
==
--- 
libcxx/trunk/test/libcxx/experimental/filesystem/class.path/path.member/path.append.pass.cpp
 (added)
+++ 
libcxx/trunk/test/libcxx/experimental/filesystem/class.path/path.member/path.append.pass.cpp
 Sat Oct 15 16:29:44 2016
@@ -0,0 +1,70 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// UNSUPPORTED: c++98, c++03
+
+// 
+
+// class path
+
+// path& operator/=(path const&)
+// path operator/(path const&, path const&)
+
+
+#define _LIBCPP_DEBUG 0
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : (void)::AssertCount++)
+int AssertCount = 0;
+
+#include 
+#include 
+#include 
+#include 
+
+#include "test_macros.h"
+#include "test_iterators.h"
+#include "count_new.hpp"
+#include "filesystem_test_helper.hpp"
+
+namespace fs = std::experimental::filesystem;
+
+int main()
+{
+  using namespace fs;
+  {
+path lhs("//foo");
+path rhs("/bar");
+assert(AssertCount == 0);
+lhs /= rhs;
+assert(AssertCount == 0);
+  }
+  {
+path lhs("//foo");
+path rhs("/bar");
+assert(AssertCount == 0);
+(void)(lhs / rhs);
+assert(AssertCount == 0);
+  }
+  {
+path lhs("//foo");
+path rhs("//bar");
+assert(AssertCount == 0);
+lhs /= rhs;
+assert(AssertCount == 1);
+AssertCount = 0;
+  }
+  {
+path lhs("//foo");
+path rhs("//bar");
+assert(AssertCount == 0);
+(void)(lhs / rhs);
+assert(AssertCount == 1);
+  }
+  // FIXME The same error is not diagnosed for the append(Source) and
+  // append(It, It) overloads.
+}

Modified: libcxx/trunk/www/upcoming_meeting.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/upcoming_meeting.html?rev=284310=284309=284310=diff
==
--- libcxx/trunk/www/upcoming_meeting.html (original)
+++ libcxx/trunk/www/upcoming_meeting.html Sat Oct 15 16:29:44 2016
@@ -88,7 +88,7 @@
 http://wg21.link/LWG2589;>2589match_results can't satisfy 
the requirements of a containerIssaquahNothing to do
 http://wg21.link/LWG2591;>2591std::function's member 
template target() should not lead to undefined 
behaviourIssaquah
 http://wg21.link/LWG2598;>2598addressof 
works on temporariesIssaquahPatch ready
-http://wg21.link/LWG2664;>2664operator/ 
(and other append) semantics not useful if argument has 
rootIssaquah
+http://wg21.link/LWG2664;>2664operator/ 
(and other append) semantics not useful if argument has 
rootIssaquahNothing to do
 http://wg21.link/LWG2665;>2665remove_filename() post 
condition is incorrectIssaquah
 http://wg21.link/LWG2672;>2672Should 
is_empty use error_code in its 
specification?Issaquah
 http://wg21.link/LWG2678;>2678std::filesystem enum classes 
overspecifiedIssaquahNothing to do
@@ -166,7 +166,7 @@
 2589 - This is just wording cleanup. 
 2591 - I suspect that this is just better specification of the 
existing structure. Probably need more tests for this.
 2598 - Patch and tests ready
-2664 - File System; Eric?
+2664 - No change needed. _LIBCPP_DEBUG mode tests the new 
requirements.
 2665 - File System; Eric?
 2672 - File System; Eric?
 2678 - File System; Eric?



[PATCH] D25153: preprocessor supports `-dI` flag

2016-10-15 Thread Steve O'Brien via cfe-commits
elsteveogrande added a comment.

Thank you!  I tried with`arc land` but got a 403...


https://reviews.llvm.org/D25153



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


[libcxx] r284314 - Implement LWG 2672.

2016-10-15 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Sat Oct 15 18:05:04 2016
New Revision: 284314

URL: http://llvm.org/viewvc/llvm-project?rev=284314=rev
Log:
Implement LWG 2672.

Modified:
libcxx/trunk/src/experimental/filesystem/operations.cpp

libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_empty/is_empty.pass.cpp
libcxx/trunk/www/upcoming_meeting.html

Modified: libcxx/trunk/src/experimental/filesystem/operations.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/experimental/filesystem/operations.cpp?rev=284314=284313=284314=diff
==
--- libcxx/trunk/src/experimental/filesystem/operations.cpp (original)
+++ libcxx/trunk/src/experimental/filesystem/operations.cpp Sat Oct 15 18:05:04 
2016
@@ -472,13 +472,25 @@ bool __fs_is_empty(const path& p, std::e
 std::error_code m_ec;
 struct ::stat pst;
 auto st = detail::posix_stat(p, pst, _ec);
-if (is_directory(st))
-return directory_iterator(p) == directory_iterator{};
+if (m_ec) {
+set_or_throw(m_ec, ec, "is_empty", p);
+return false;
+}
+else if (!is_directory(st) && !is_regular_file(st)) {
+m_ec = make_error_code(errc::not_supported);
+set_or_throw(m_ec, ec, "is_empty");
+return false;
+}
+else if (is_directory(st)) {
+auto it = ec ? directory_iterator(p, *ec) : directory_iterator(p);
+if (ec && *ec)
+return false;
+return it == directory_iterator{};
+}
 else if (is_regular_file(st))
 return static_cast(pst.st_size) == 0;
-// else
-set_or_throw(m_ec, ec, "is_empty", p);
-return false;
+
+_LIBCPP_UNREACHABLE();
 }
 
 

Modified: 
libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_empty/is_empty.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_empty/is_empty.pass.cpp?rev=284314=284313=284314=diff
==
--- 
libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_empty/is_empty.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_empty/is_empty.pass.cpp
 Sat Oct 15 18:05:04 2016
@@ -77,4 +77,33 @@ TEST_CASE(test_is_empty_fails)
 TEST_CHECK_THROW(filesystem_error, is_empty(dir2));
 }
 
+TEST_CASE(test_directory_access_denied)
+{
+scoped_test_env env;
+const path dir = env.create_dir("dir");
+const path file1 = env.create_file("dir/file", 42);
+permissions(dir, perms::none);
+
+std::error_code ec = GetTestEC();
+TEST_CHECK(is_empty(dir, ec) == false);
+TEST_CHECK(ec);
+TEST_CHECK(ec != GetTestEC());
+
+TEST_CHECK_THROW(filesystem_error, is_empty(dir));
+}
+
+
+TEST_CASE(test_fifo_fails)
+{
+scoped_test_env env;
+const path fifo = env.create_fifo("fifo");
+
+std::error_code ec = GetTestEC();
+TEST_CHECK(is_empty(fifo, ec) == false);
+TEST_CHECK(ec);
+TEST_CHECK(ec != GetTestEC());
+
+TEST_CHECK_THROW(filesystem_error, is_empty(fifo));
+}
+
 TEST_SUITE_END()

Modified: libcxx/trunk/www/upcoming_meeting.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/upcoming_meeting.html?rev=284314=284313=284314=diff
==
--- libcxx/trunk/www/upcoming_meeting.html (original)
+++ libcxx/trunk/www/upcoming_meeting.html Sat Oct 15 18:05:04 2016
@@ -90,7 +90,7 @@
 http://wg21.link/LWG2598;>2598addressof 
works on temporariesIssaquahPatch ready
 http://wg21.link/LWG2664;>2664operator/ 
(and other append) semantics not useful if argument has 
rootIssaquahNothing to do
 http://wg21.link/LWG2665;>2665remove_filename() post 
condition is incorrectIssaquahSee Below
-http://wg21.link/LWG2672;>2672Should 
is_empty use error_code in its 
specification?Issaquah
+http://wg21.link/LWG2672;>2672Should 
is_empty use error_code in its specification?IssaquahWe 
already do this
 http://wg21.link/LWG2678;>2678std::filesystem enum classes 
overspecifiedIssaquahNothing to do
 http://wg21.link/LWG2679;>2679Inconsistent Use of Effects 
and Equivalent ToIssaquahNothing to do
 http://wg21.link/LWG2680;>2680Add 
"Equivalent to" to filesystemIssaquah
@@ -168,7 +168,7 @@
 2598 - Patch and tests ready
 2664 - No change needed. _LIBCPP_DEBUG mode tests the new 
requirements.
 2665 - PR is incorrect as-is. We implement a modified version
-2672 - File System; Eric?
+2672 - Patch and tests in tree. 
 2678 - File System; Eric?
 2679 - This is just wording cleanup. 
 2680 - File System; Eric?


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


r284317 - Revert "[analyzer] Re-apply r283093 "Add extra notes to ObjCDeallocChecker""

2016-10-15 Thread Devin Coughlin via cfe-commits
Author: dcoughlin
Date: Sat Oct 15 19:30:08 2016
New Revision: 284317

URL: http://llvm.org/viewvc/llvm-project?rev=284317=rev
Log:
Revert "[analyzer] Re-apply r283093 "Add extra notes to ObjCDeallocChecker""

Revert:
r283662: [analyzer] Re-apply r283093 "Add extra notes to ObjCDeallocChecker"
r283660: [analyzer] Fix build error after r283660 - remove constexpr strings.

It was causing an internal build bot to fail. It looks like in some cases
adding an extra note can cause scan-build plist output to drop a diagnostic
altogether.

Modified:
cfe/trunk/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp
cfe/trunk/test/Analysis/DeallocMissingRelease.m
cfe/trunk/test/Analysis/PR2978.m
cfe/trunk/test/Analysis/properties.m

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp?rev=284317=284316=284317=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp Sat Oct 15 
19:30:08 2016
@@ -108,10 +108,6 @@ class ObjCDeallocChecker
   std::unique_ptr ExtraReleaseBugType;
   std::unique_ptr MistakenDeallocBugType;
 
-  // FIXME: constexpr initialization isn't supported by MSVC2013.
-  static const char *const MsgDeclared;
-  static const char *const MsgSynthesized;
-
 public:
   ObjCDeallocChecker();
 
@@ -133,9 +129,6 @@ public:
   void checkEndFunction(CheckerContext ) const;
 
 private:
-  void addNoteForDecl(std::unique_ptr , StringRef Msg,
-   const Decl *D) const;
-
   void diagnoseMissingReleases(CheckerContext ) const;
 
   bool diagnoseExtraRelease(SymbolRef ReleasedValue, const ObjCMethodCall ,
@@ -187,11 +180,6 @@ private:
 
 typedef llvm::ImmutableSet SymbolSet;
 
-const char *const ObjCDeallocChecker::MsgDeclared =
-"Property is declared here";
-const char *const ObjCDeallocChecker::MsgSynthesized =
-"Property is synthesized here";
-
 /// Maps from the symbol for a class instance to the set of
 /// symbols remaining that must be released in -dealloc.
 REGISTER_MAP_WITH_PROGRAMSTATE(UnreleasedIvarMap, SymbolRef, SymbolSet)
@@ -503,18 +491,6 @@ ProgramStateRef ObjCDeallocChecker::chec
   return State;
 }
 
-/// Add an extra note piece describing a declaration that is important
-/// for understanding the bug report.
-void ObjCDeallocChecker::addNoteForDecl(std::unique_ptr ,
- StringRef Msg,
- const Decl *D) const {
-  ASTContext  = D->getASTContext();
-  SourceManager  = ACtx.getSourceManager();
-  PathDiagnosticLocation Pos = PathDiagnosticLocation::createBegin(D, SM);
-  if (Pos.isValid() && Pos.asLocation().isValid())
-BR->addNote(Msg, Pos, D->getSourceRange());
-}
-
 /// Report any unreleased instance variables for the current instance being
 /// dealloced.
 void ObjCDeallocChecker::diagnoseMissingReleases(CheckerContext ) const {
@@ -612,9 +588,6 @@ void ObjCDeallocChecker::diagnoseMissing
 std::unique_ptr BR(
 new BugReport(*MissingReleaseBugType, OS.str(), ErrNode));
 
-addNoteForDecl(BR, MsgDeclared, PropDecl);
-addNoteForDecl(BR, MsgSynthesized, PropImpl);
-
 C.emitReport(std::move(BR));
   }
 
@@ -718,12 +691,11 @@ bool ObjCDeallocChecker::diagnoseExtraRe
  );
 
   const ObjCImplDecl *Container = 
getContainingObjCImpl(C.getLocationContext());
-  const ObjCIvarDecl *IvarDecl = PropImpl->getPropertyIvarDecl();
-  OS << "The '" << *IvarDecl << "' ivar in '" << *Container;
+  OS << "The '" << *PropImpl->getPropertyIvarDecl()
+ << "' ivar in '" << *Container;
 
-  bool ReleasedByCIFilterDealloc = isReleasedByCIFilterDealloc(PropImpl);
 
-  if (ReleasedByCIFilterDealloc) {
+  if (isReleasedByCIFilterDealloc(PropImpl)) {
 OS << "' will be released by '-[CIFilter dealloc]' but also released here";
   } else {
 OS << "' was synthesized for ";
@@ -740,10 +712,6 @@ bool ObjCDeallocChecker::diagnoseExtraRe
   new BugReport(*ExtraReleaseBugType, OS.str(), ErrNode));
   BR->addRange(M.getOriginExpr()->getSourceRange());
 
-  addNoteForDecl(BR, MsgDeclared, PropDecl);
-  if (!ReleasedByCIFilterDealloc)
-addNoteForDecl(BR, MsgSynthesized, PropImpl);
-
   C.emitReport(std::move(BR));
 
   return true;

Modified: cfe/trunk/test/Analysis/DeallocMissingRelease.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/DeallocMissingRelease.m?rev=284317=284316=284317=diff
==
--- cfe/trunk/test/Analysis/DeallocMissingRelease.m (original)
+++ cfe/trunk/test/Analysis/DeallocMissingRelease.m Sat Oct 15 19:30:08 2016
@@ -81,9 +81,6 @@
 
 @interface MyPropertyClass1 : NSObject
 @property (copy) NSObject *ivar;
-#if NON_ARC
-// expected-note@-2 {{Property is declared here}}

[libcxx] r284316 - Implement LWG 2681 and 2682

2016-10-15 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Sat Oct 15 19:29:22 2016
New Revision: 284316

URL: http://llvm.org/viewvc/llvm-project?rev=284316=rev
Log:
Implement LWG 2681 and 2682

Modified:
libcxx/trunk/src/experimental/filesystem/operations.cpp

libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy/copy.pass.cpp
libcxx/trunk/www/upcoming_meeting.html

Modified: libcxx/trunk/src/experimental/filesystem/operations.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/experimental/filesystem/operations.cpp?rev=284316=284315=284316=diff
==
--- libcxx/trunk/src/experimental/filesystem/operations.cpp (original)
+++ libcxx/trunk/src/experimental/filesystem/operations.cpp Sat Oct 15 19:29:22 
2016
@@ -236,6 +236,9 @@ void __copy(const path& from, const path
 }
 return;
 }
+else if (is_directory(f) && bool(copy_options::create_symlinks & options)) 
{
+return set_or_throw(make_error_code(errc::is_a_directory), ec, "copy");
+}
 else if (is_directory(f) && (bool(copy_options::recursive & options) ||
  copy_options::none == options)) {
 

Modified: 
libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy/copy.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy/copy.pass.cpp?rev=284316=284315=284316=diff
==
--- 
libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy/copy.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy/copy.pass.cpp
 Sat Oct 15 19:29:22 2016
@@ -257,6 +257,47 @@ TEST_CASE(from_is_directory)
 }
 }
 
+TEST_CASE(test_copy_symlinks_to_symlink_dir)
+{
+scoped_test_env env;
+const path file1 = env.create_file("file1", 42);
+const path file2 = env.create_file("file2", 101);
+const path file2_sym = env.create_symlink(file2, "file2_sym");
+const path dir = env.create_dir("dir");
+const path dir_sym = env.create_symlink(dir, "dir_sym");
+{
+std::error_code ec = GetTestEC();
+fs::copy(file1, dir_sym, copy_options::copy_symlinks, ec);
+TEST_CHECK(!ec);
+const path dest = env.make_env_path("dir/file1");
+TEST_CHECK(exists(dest));
+TEST_CHECK(!is_symlink(dest));
+TEST_CHECK(file_size(dest) == 42);
+}
+}
+
+
+TEST_CASE(test_dir_create_symlink)
+{
+scoped_test_env env;
+const path dir = env.create_dir("dir1");
+const path dest = env.make_env_path("dne");
+{
+std::error_code ec = GetTestEC();
+fs::copy(dir, dest, copy_options::create_symlinks, ec);
+TEST_CHECK(ec == std::make_error_code(std::errc::is_a_directory));
+TEST_CHECK(!exists(dest));
+TEST_CHECK(!is_symlink(dest));
+}
+{
+std::error_code ec = GetTestEC();
+fs::copy(dir, dest, 
copy_options::create_symlinks|copy_options::recursive, ec);
+TEST_CHECK(ec == std::make_error_code(std::errc::is_a_directory));
+TEST_CHECK(!exists(dest));
+TEST_CHECK(!is_symlink(dest));
+}
+}
+
 TEST_CASE(test_otherwise_no_effects_clause)
 {
 scoped_test_env env;

Modified: libcxx/trunk/www/upcoming_meeting.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/upcoming_meeting.html?rev=284316=284315=284316=diff
==
--- libcxx/trunk/www/upcoming_meeting.html (original)
+++ libcxx/trunk/www/upcoming_meeting.html Sat Oct 15 19:29:22 2016
@@ -94,8 +94,8 @@
 http://wg21.link/LWG2678;>2678std::filesystem enum classes 
overspecifiedIssaquahNothing to do
 http://wg21.link/LWG2679;>2679Inconsistent Use of Effects 
and Equivalent ToIssaquahNothing to do
 http://wg21.link/LWG2680;>2680Add 
"Equivalent to" to filesystemIssaquahNothing to do
-http://wg21.link/LWG2681;>2681filesystem::copy() cannot copy 
symlinksIssaquah
-http://wg21.link/LWG2682;>2682filesystem::copy() won't 
create a symlink to a directoryIssaquah
+http://wg21.link/LWG2681;>2681filesystem::copy() cannot copy 
symlinksIssaquahWe already do this
+http://wg21.link/LWG2682;>2682filesystem::copy() won't 
create a symlink to a directoryIssaquahImplemented in 
trunk
 http://wg21.link/LWG2686;>2686Why is 
std::hash specialized for error_code, but not 
error_condition?IssaquahPatch ready
 http://wg21.link/LWG2694;>2694Application of LWG 436 
accidentally deleted definition of "facet"IssaquahNothing to 
do
 http://wg21.link/LWG2696;>2696Interaction between 
make_shared and enable_shared_from_this is 
underspecifiedIssaquah
@@ -172,8 +172,8 @@
 2678 - File System; Eric?
 2679 - This is just wording cleanup. 
 2680 - This is just wording cleanup. 
-2681 - File System; Eric?
-2682 - File System; Eric?
+2681 - LGTM 
+2682 - 

[libcxx] r284323 - Update status for std::optional LWG issues and fix an optional SFINAE bug

2016-10-15 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Sat Oct 15 22:21:35 2016
New Revision: 284323

URL: http://llvm.org/viewvc/llvm-project?rev=284323=rev
Log:
Update status for std::optional LWG issues and fix an optional SFINAE bug

Modified:
libcxx/trunk/include/experimental/optional
libcxx/trunk/include/optional

libcxx/trunk/test/std/experimental/optional/optional.object/optional.object.observe/op_arrow_const.pass.cpp

libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.assign/assign_value.pass.cpp
libcxx/trunk/www/upcoming_meeting.html

Modified: libcxx/trunk/include/experimental/optional
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/experimental/optional?rev=284323=284322=284323=diff
==
--- libcxx/trunk/include/experimental/optional (original)
+++ libcxx/trunk/include/experimental/optional Sat Oct 15 22:21:35 2016
@@ -487,7 +487,11 @@ public:
 operator->() const
 {
 _LIBCPP_ASSERT(this->__engaged_, "optional operator-> called for 
disengaged value");
+#ifndef _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF
+return _VSTD::addressof(this->__val_);
+#else
 return __operator_arrow(__has_operator_addressof{});
+#endif
 }
 
 _LIBCPP_INLINE_VISIBILITY

Modified: libcxx/trunk/include/optional
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/optional?rev=284323=284322=284323=diff
==
--- libcxx/trunk/include/optional (original)
+++ libcxx/trunk/include/optional Sat Oct 15 22:21:35 2016
@@ -681,12 +681,14 @@ public:
 // LWG2756
 template  &&
-  !(is_same_v<_Up, value_type> && 
is_scalar_v) &&
-  is_constructible_v &&
-  is_assignable_v
-  >
+  <__lazy_and<
+  integral_constant, optional> &&
+  !(is_same_v<_Up, value_type> && 
is_scalar_v)
+  >,
+  is_constructible,
+  is_assignable
+  >::value>
  >
 _LIBCPP_INLINE_VISIBILITY
 optional&

Modified: 
libcxx/trunk/test/std/experimental/optional/optional.object/optional.object.observe/op_arrow_const.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/optional/optional.object/optional.object.observe/op_arrow_const.pass.cpp?rev=284323=284322=284323=diff
==
--- 
libcxx/trunk/test/std/experimental/optional/optional.object/optional.object.observe/op_arrow_const.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/experimental/optional/optional.object/optional.object.observe/op_arrow_const.pass.cpp
 Sat Oct 15 22:21:35 2016
@@ -51,6 +51,9 @@ int main()
 {
 constexpr optional opt(Z{});
 assert(opt->test() == 1);
+#ifndef _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF
+static_assert(opt->test() == 1, "");
+#endif
 }
 #ifdef _LIBCPP_DEBUG
 {

Modified: 
libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.assign/assign_value.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.assign/assign_value.pass.cpp?rev=284323=284322=284323=diff
==
--- 
libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.assign/assign_value.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.assign/assign_value.pass.cpp
 Sat Oct 15 22:21:35 2016
@@ -48,6 +48,16 @@ struct MismatchType {
   MismatchType& operator=(char*) = delete;
 };
 
+struct FromOptionalType {
+  using Opt = std::optional;
+  FromOptionalType() = default;
+  FromOptionalType(FromOptionalType const&) = delete;
+  template 
+  constexpr FromOptionalType(Opt&) { Dummy::BARK; }
+  template 
+  constexpr FromOptionalType& operator=(Opt&) { Dummy::BARK; return *this; }
+};
+
 void test_sfinae() {
 using I = TestTypes::TestType;
 using E = ExplicitTestTypes::TestType;
@@ -68,6 +78,8 @@ void test_sfinae() {
 assert_assignable();
 assert_assignable();
 assert_assignable();
+// Type constructible from optional
+assert_assignable();
 }
 
 void test_with_test_type()

Modified: libcxx/trunk/www/upcoming_meeting.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/upcoming_meeting.html?rev=284323=284322=284323=diff
==
--- 

[PATCH] D25595: [libcxx] Support std::regex_constants::match_not_null

2016-10-15 Thread Marshall Clow via cfe-commits
mclow.lists added a comment.

I like the fix. :-)

However, I think that the test, rather than going in a bug specific file 
(pr21597.pass.cpp), should be added to the existing tests - where it should 
have been in the first place.  (If this test had been there in the first place, 
we would have realized that this feature didn't work)

Also, putting the test in as 
`test/std/re/re.const/re.matchflag/match_not_null.pass.cpp` might cause someone 
to look at the contents of that directory and say "Crap! We're missing tests 
for `match_not_bow`, `match_not_eow`, `match_any`, `match_continuous` and 
`match_prev_avail` as well" (and probably others).


https://reviews.llvm.org/D25595



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


[PATCH] D25642: [clang-tidy] Use ignoreImplicit in cert-err58-cpp check

2016-10-15 Thread Aaron Ballman via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

In what is surely a record response time for code reviews on a weekend, this 
LGTM. :-D


https://reviews.llvm.org/D25642



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


[libcxx] r284309 - Update the status of issues

2016-10-15 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Sat Oct 15 15:58:51 2016
New Revision: 284309

URL: http://llvm.org/viewvc/llvm-project?rev=284309=rev
Log:
Update the status of issues

Modified:
libcxx/trunk/www/upcoming_meeting.html

Modified: libcxx/trunk/www/upcoming_meeting.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/upcoming_meeting.html?rev=284309=284308=284309=diff
==
--- libcxx/trunk/www/upcoming_meeting.html (original)
+++ libcxx/trunk/www/upcoming_meeting.html Sat Oct 15 15:58:51 2016
@@ -76,7 +76,7 @@
 http://wg21.link/LWG2534;>2534Constrain 
rvalue stream operatorsIssaquah
 http://wg21.link/LWG2536;>2536What 
should complex.h do?IssaquahWe already do 
this
 http://wg21.link/LWG2540;>2540unordered_multimap::insert 
hint iteratorIssaquahWe already do this
-http://wg21.link/LWG2543;>2543LWG 2148 
(hash support for enum types) seems 
under-specifiedIssaquah
+http://wg21.link/LWG2543;>2543LWG 2148 
(hash support for enum types) seems under-specifiedIssaquahWe 
already do this
 http://wg21.link/LWG2544;>2544istreambuf_iterator(basic_streambuf* s) effects unclear when s is 0IssaquahWe already do 
this
 http://wg21.link/LWG2556;>2556Wide 
contract for future::share()IssaquahPatch ready
 http://wg21.link/LWG2562;>2562Consistent 
total ordering of pointers by comparison 
functorsIssaquah
@@ -91,7 +91,7 @@
 http://wg21.link/LWG2664;>2664operator/ 
(and other append) semantics not useful if argument has 
rootIssaquah
 http://wg21.link/LWG2665;>2665remove_filename() post 
condition is incorrectIssaquah
 http://wg21.link/LWG2672;>2672Should 
is_empty use error_code in its 
specification?Issaquah
-http://wg21.link/LWG2678;>2678std::filesystem enum classes 
overspecifiedIssaquah
+http://wg21.link/LWG2678;>2678std::filesystem enum classes 
overspecifiedIssaquahNothing to do
 http://wg21.link/LWG2679;>2679Inconsistent Use of Effects 
and Equivalent ToIssaquahNothing to do
 http://wg21.link/LWG2680;>2680Add 
"Equivalent to" to filesystemIssaquah
 http://wg21.link/LWG2681;>2681filesystem::copy() cannot copy 
symlinksIssaquah


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


[PATCH] D25153: preprocessor supports `-dI` flag

2016-10-15 Thread Richard Smith via cfe-commits
rsmith accepted this revision.
rsmith added a comment.
This revision is now accepted and ready to land.

Thanks for your patience, this looks great to me. Do you need someone to commit 
this for you?


https://reviews.llvm.org/D25153



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


[PATCH] D25647: [clang-tidy] Don't use a SmallSetVector of an enum.

2016-10-15 Thread Justin Lebar via cfe-commits
jlebar created this revision.
jlebar added a reviewer: timshen.
jlebar added a subscriber: cfe-commits.
Herald added a subscriber: nemanjai.

This doesn't work after converting SmallSetVector to use DenseSet.

Instead we can just use a SmallVector.


https://reviews.llvm.org/D25647

Files:
  clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.cpp
  clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.h


Index: 
clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.h
===
--- clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.h
+++ clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.h
@@ -31,7 +31,7 @@
   void check(const ast_matchers::MatchFinder::MatchResult ) override;
   void onEndOfTranslationUnit() override;
 
-  enum class SpecialMemberFunctionKind {
+  enum class SpecialMemberFunctionKind : uint8_t {
 Destructor,
 CopyConstructor,
 CopyAssignment,
@@ -43,9 +43,9 @@
 
   using ClassDefiningSpecialMembersMap =
   llvm::DenseMap>;
+ llvm::SmallVector>;
 
-private:
+ private:
   ClassDefiningSpecialMembersMap ClassWithSpecialMembers;
 };
 
Index: 
clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.cpp
===
--- 
clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.cpp
+++ 
clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.cpp
@@ -97,8 +97,11 @@
   {"move-assign", SpecialMemberFunctionKind::MoveAssignment}};
 
   for (const auto  : Matchers)
-if (Result.Nodes.getNodeAs(KV.first))
-  ClassWithSpecialMembers[ID].insert(KV.second);
+if (Result.Nodes.getNodeAs(KV.first)) {
+  SpecialMemberFunctionKind Kind = KV.second;
+  auto  = ClassWithSpecialMembers[ID];
+  if (find(Members, Kind) == Members.end()) Members.push_back(Kind);
+}
 }
 
 void SpecialMemberFunctionsCheck::onEndOfTranslationUnit() {
@@ -125,7 +128,7 @@
 std::back_inserter(UndefinedSpecialMembers));
 
 diag(C.first.first, "class '%0' defines %1 but does not define %2")
-<< C.first.second << join(DefinedSpecialMembers.getArrayRef(), " and ")
+<< C.first.second << join(DefinedSpecialMembers, " and ")
 << join(UndefinedSpecialMembers, " or ");
   }
 }


Index: clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.h
===
--- clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.h
+++ clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.h
@@ -31,7 +31,7 @@
   void check(const ast_matchers::MatchFinder::MatchResult ) override;
   void onEndOfTranslationUnit() override;
 
-  enum class SpecialMemberFunctionKind {
+  enum class SpecialMemberFunctionKind : uint8_t {
 Destructor,
 CopyConstructor,
 CopyAssignment,
@@ -43,9 +43,9 @@
 
   using ClassDefiningSpecialMembersMap =
   llvm::DenseMap>;
+ llvm::SmallVector>;
 
-private:
+ private:
   ClassDefiningSpecialMembersMap ClassWithSpecialMembers;
 };
 
Index: clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.cpp
===
--- clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.cpp
+++ clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.cpp
@@ -97,8 +97,11 @@
   {"move-assign", SpecialMemberFunctionKind::MoveAssignment}};
 
   for (const auto  : Matchers)
-if (Result.Nodes.getNodeAs(KV.first))
-  ClassWithSpecialMembers[ID].insert(KV.second);
+if (Result.Nodes.getNodeAs(KV.first)) {
+  SpecialMemberFunctionKind Kind = KV.second;
+  auto  = ClassWithSpecialMembers[ID];
+  if (find(Members, Kind) == Members.end()) Members.push_back(Kind);
+}
 }
 
 void SpecialMemberFunctionsCheck::onEndOfTranslationUnit() {
@@ -125,7 +128,7 @@
 std::back_inserter(UndefinedSpecialMembers));
 
 diag(C.first.first, "class '%0' defines %1 but does not define %2")
-<< C.first.second << join(DefinedSpecialMembers.getArrayRef(), " and ")
+<< C.first.second << join(DefinedSpecialMembers, " and ")
 << join(UndefinedSpecialMembers, " or ");
   }
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r284315 - Mark LWG 2680 as done

2016-10-15 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Sat Oct 15 18:12:30 2016
New Revision: 284315

URL: http://llvm.org/viewvc/llvm-project?rev=284315=rev
Log:
Mark LWG 2680 as done

Modified:
libcxx/trunk/www/upcoming_meeting.html

Modified: libcxx/trunk/www/upcoming_meeting.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/upcoming_meeting.html?rev=284315=284314=284315=diff
==
--- libcxx/trunk/www/upcoming_meeting.html (original)
+++ libcxx/trunk/www/upcoming_meeting.html Sat Oct 15 18:12:30 2016
@@ -93,7 +93,7 @@
 http://wg21.link/LWG2672;>2672Should 
is_empty use error_code in its specification?IssaquahWe 
already do this
 http://wg21.link/LWG2678;>2678std::filesystem enum classes 
overspecifiedIssaquahNothing to do
 http://wg21.link/LWG2679;>2679Inconsistent Use of Effects 
and Equivalent ToIssaquahNothing to do
-http://wg21.link/LWG2680;>2680Add 
"Equivalent to" to filesystemIssaquah
+http://wg21.link/LWG2680;>2680Add 
"Equivalent to" to filesystemIssaquahNothing to do
 http://wg21.link/LWG2681;>2681filesystem::copy() cannot copy 
symlinksIssaquah
 http://wg21.link/LWG2682;>2682filesystem::copy() won't 
create a symlink to a directoryIssaquah
 http://wg21.link/LWG2686;>2686Why is 
std::hash specialized for error_code, but not 
error_condition?IssaquahPatch ready
@@ -171,7 +171,7 @@
 2672 - Patch and tests in tree. 
 2678 - File System; Eric?
 2679 - This is just wording cleanup. 
-2680 - File System; Eric?
+2680 - This is just wording cleanup. 
 2681 - File System; Eric?
 2682 - File System; Eric?
 2686 - Patch and tests ready


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


[libcxx] r284318 - Implement LWG 2712 and update other issues status

2016-10-15 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Sat Oct 15 19:47:59 2016
New Revision: 284318

URL: http://llvm.org/viewvc/llvm-project?rev=284318=rev
Log:
Implement LWG 2712 and update other issues status

Modified:
libcxx/trunk/src/experimental/filesystem/operations.cpp

libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp
libcxx/trunk/www/upcoming_meeting.html

Modified: libcxx/trunk/src/experimental/filesystem/operations.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/experimental/filesystem/operations.cpp?rev=284318=284317=284318=diff
==
--- libcxx/trunk/src/experimental/filesystem/operations.cpp (original)
+++ libcxx/trunk/src/experimental/filesystem/operations.cpp Sat Oct 15 19:47:59 
2016
@@ -282,6 +282,10 @@ bool __copy_file(const path& from, const
 }
 
 const bool to_exists = exists(to_st);
+if (to_exists && !is_regular_file(to_st)) {
+set_or_throw(make_error_code(errc::not_supported), ec, "copy_file", 
from, to);
+return false;
+}
 if (to_exists && bool(copy_options::skip_existing & options)) {
 return false;
 }
@@ -302,6 +306,8 @@ bool __copy_file(const path& from, const
 set_or_throw(make_error_code(errc::file_exists), ec, "copy", from, to);
 return false;
 }
+
+_LIBCPP_UNREACHABLE();
 }
 
 void __copy_symlink(const path& existing_symlink, const path& new_symlink,

Modified: 
libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp?rev=284318=284317=284318=diff
==
--- 
libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp
 Sat Oct 15 19:47:59 2016
@@ -153,12 +153,36 @@ TEST_CASE(copy_dir_test)
 scoped_test_env env;
 const path file = env.create_file("file1", 42);
 const path dest = env.create_dir("dir1");
-std::error_code ec;
+std::error_code ec = GetTestEC();
 TEST_CHECK(fs::copy_file(file, dest, ec) == false);
 TEST_CHECK(ec);
-ec.clear();
+TEST_CHECK(ec != GetTestEC());
+ec = GetTestEC();
 TEST_CHECK(fs::copy_file(dest, file, ec) == false);
 TEST_CHECK(ec);
+TEST_CHECK(ec != GetTestEC());
+}
+
+TEST_CASE(non_regular_file_test)
+{
+scoped_test_env env;
+const path fifo = env.create_fifo("fifo");
+const path dest = env.make_env_path("dest");
+const path file = env.create_file("file", 42);
+{
+std::error_code ec = GetTestEC();
+TEST_REQUIRE(fs::copy_file(fifo, dest, ec) == false);
+TEST_CHECK(ec);
+TEST_CHECK(ec != GetTestEC());
+TEST_CHECK(!exists(dest));
+}
+{
+std::error_code ec = GetTestEC();
+TEST_REQUIRE(fs::copy_file(file, fifo, 
copy_options::overwrite_existing, ec) == false);
+TEST_CHECK(ec);
+TEST_CHECK(ec != GetTestEC());
+TEST_CHECK(is_fifo(fifo));
+}
 }
 
 TEST_SUITE_END()

Modified: libcxx/trunk/www/upcoming_meeting.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/upcoming_meeting.html?rev=284318=284317=284318=diff
==
--- libcxx/trunk/www/upcoming_meeting.html (original)
+++ libcxx/trunk/www/upcoming_meeting.html Sat Oct 15 19:47:59 2016
@@ -100,10 +100,10 @@
 http://wg21.link/LWG2694;>2694Application of LWG 436 
accidentally deleted definition of "facet"IssaquahNothing to 
do
 http://wg21.link/LWG2696;>2696Interaction between 
make_shared and enable_shared_from_this is 
underspecifiedIssaquah
 http://wg21.link/LWG2699;>2699Missing 
restriction in [numeric.requirements]Issaquah
-http://wg21.link/LWG2712;>2712copy_file(from, to, ...) has a 
number of unspecified error conditionsIssaquah
-http://wg21.link/LWG2722;>2722equivalent 
incorrectly specifies throws clauseIssaquah
+http://wg21.link/LWG2712;>2712copy_file(from, to, ...) has a 
number of unspecified error conditionsIssaquahImplemented in 
trunk
+http://wg21.link/LWG2722;>2722equivalent 
incorrectly specifies throws clauseIssaquahWe already do 
this
 http://wg21.link/LWG2729;>2729Missing 
SFINAE on std::pair::operator=Issaquah
-http://wg21.link/LWG2732;>2732Questionable specification of 
path::operator/= and path::appendIssaquah
+http://wg21.link/LWG2732;>2732Questionable specification of 
path::operator/= and path::appendIssaquahNothing to 
do
 http://wg21.link/LWG2733;>2733[fund.ts.v2] gcd / lcm and 
boolIssaquah
 http://wg21.link/LWG2735;>2735std::abs(short), 
std::abs(signed char) and others should 

[libcxx] r284319 - Update notes for LWG 2678

2016-10-15 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Sat Oct 15 19:49:33 2016
New Revision: 284319

URL: http://llvm.org/viewvc/llvm-project?rev=284319=rev
Log:
Update notes for LWG 2678

Modified:
libcxx/trunk/www/upcoming_meeting.html

Modified: libcxx/trunk/www/upcoming_meeting.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/upcoming_meeting.html?rev=284319=284318=284319=diff
==
--- libcxx/trunk/www/upcoming_meeting.html (original)
+++ libcxx/trunk/www/upcoming_meeting.html Sat Oct 15 19:49:33 2016
@@ -169,7 +169,7 @@
 2664 - No change needed. _LIBCPP_DEBUG mode tests the new 
requirements.
 2665 - PR is incorrect as-is. We implement a modified version
 2672 - Patch and tests in tree. 
-2678 - File System; Eric?
+2678 - No change needed. Mostly wording cleanup. 
 2679 - This is just wording cleanup. 
 2680 - This is just wording cleanup. 
 2681 - LGTM 


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


[libcxx] r284322 - Update issue status for LWG 2744

2016-10-15 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Sat Oct 15 21:51:50 2016
New Revision: 284322

URL: http://llvm.org/viewvc/llvm-project?rev=284322=rev
Log:
Update issue status for LWG 2744

Added:

libcxx/trunk/test/libcxx/utilities/utility/utility.inplace/__is_inplace_tag.pass.cpp
Removed:

libcxx/trunk/test/libcxx/utilities/utility/utility.inplace/__is_inplace_type.pass.cpp
Modified:
libcxx/trunk/include/any
libcxx/trunk/include/utility
libcxx/trunk/test/std/utilities/any/any.class/any.assign/copy.pass.cpp
libcxx/trunk/test/std/utilities/any/any.class/any.assign/value.pass.cpp
libcxx/trunk/test/std/utilities/any/any.class/any.cons/value.pass.cpp
libcxx/trunk/test/std/utilities/any/any.class/any.modifiers/reset.pass.cpp
libcxx/trunk/test/support/any_helpers.h
libcxx/trunk/www/upcoming_meeting.html

Modified: libcxx/trunk/include/any
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/any?rev=284322=284321=284322=diff
==
--- libcxx/trunk/include/any (original)
+++ libcxx/trunk/include/any Sat Oct 15 21:51:50 2016
@@ -200,7 +200,7 @@ public:
 , class _Tp = decay_t<_ValueType>
 , class = enable_if_t<
 !is_same<_Tp, any>::value &&
-!__is_inplace_type<_ValueType>::value &&
+!__is_inplace_type_tag<_ValueType>::value &&
 is_copy_constructible<_Tp>::value>
 >
   _LIBCPP_INLINE_VISIBILITY
@@ -241,15 +241,12 @@ public:
 return *this;
   }
 
-  // TODO: Should this be constrained to disallow in_place types like the
-  // ValueType constructor?
   template <
   class _ValueType
 , class _Tp = decay_t<_ValueType>
 , class = enable_if_t<
   !is_same<_Tp, any>::value
-  && is_copy_constructible<_Tp>::value
-  && !__is_inplace_type<_ValueType>::value>
+  && is_copy_constructible<_Tp>::value>
 >
   _LIBCPP_INLINE_VISIBILITY
   any & operator=(_ValueType && __rhs);

Modified: libcxx/trunk/include/utility
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/utility?rev=284322=284321=284322=diff
==
--- libcxx/trunk/include/utility (original)
+++ libcxx/trunk/include/utility Sat Oct 15 21:51:50 2016
@@ -928,10 +928,20 @@ inline in_place_tag in_place(__in_place_
 return in_place_tag(__in_place_tag{});
 }
 
-templatestruct __is_inplace_type : false_type {};
-template <>struct __is_inplace_type : true_type {};
-templatestruct __is_inplace_type> : 
true_type {};
-template  struct __is_inplace_type> : 
true_type {};
+templatestruct __is_inplace_tag_imp : false_type {};
+template <>struct 
__is_inplace_tag_imp : true_type {};
+templatestruct 
__is_inplace_tag_imp)> : true_type {};
+template  struct 
__is_inplace_tag_imp)> : true_type {};
+
+template 
+using __is_inplace_tag = __is_inplace_tag_imp>>;
+
+template  struct __is_inplace_type_tag_imp : false_type {};
+template  struct 
__is_inplace_type_tag_imp)> : true_type 
{};
+
+template 
+using __is_inplace_type_tag = 
__is_inplace_type_tag_imp>>;
+
 
 #endif // _LIBCPP_STD_VER > 14
 

Added: 
libcxx/trunk/test/libcxx/utilities/utility/utility.inplace/__is_inplace_tag.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/utilities/utility/utility.inplace/__is_inplace_tag.pass.cpp?rev=284322=auto
==
--- 
libcxx/trunk/test/libcxx/utilities/utility/utility.inplace/__is_inplace_tag.pass.cpp
 (added)
+++ 
libcxx/trunk/test/libcxx/utilities/utility/utility.inplace/__is_inplace_tag.pass.cpp
 Sat Oct 15 21:51:50 2016
@@ -0,0 +1,36 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// 
+
+// template 
+// struct __is_inplace_tag;
+
+#include 
+#include 
+
+template >
+void do_test() {
+static_assert(std::__is_inplace_tag::value == Expect, "");
+static_assert(std::__is_inplace_tag::value == Expect, "");
+static_assert(std::__is_inplace_tag::value == Expect, 
"");
+static_assert(std::__is_inplace_tag::value == Expect, "");
+}
+
+int main() {
+do_test();
+do_test();
+do_test>();
+do_test();
+do_test

[PATCH] D25491: [libcxx] Use C++14 when building libc++ with musl

2016-10-15 Thread Hal Finkel via cfe-commits
hfinkel added a comment.

In https://reviews.llvm.org/D25491#571003, @phosek wrote:

> Ping, do you have any other comments?


Fine by me. Please wait for an okay by @EricWF .


Repository:
  rL LLVM

https://reviews.llvm.org/D25491



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


[libcxx] r284313 - Implement modified LWG 2665

2016-10-15 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Sat Oct 15 17:37:42 2016
New Revision: 284313

URL: http://llvm.org/viewvc/llvm-project?rev=284313=rev
Log:
Implement modified LWG 2665

Modified:
libcxx/trunk/include/experimental/filesystem
libcxx/trunk/src/experimental/filesystem/path.cpp

libcxx/trunk/test/std/experimental/filesystem/class.path/path.member/path.modifiers/remove_filename.pass.cpp
libcxx/trunk/www/upcoming_meeting.html

Modified: libcxx/trunk/include/experimental/filesystem
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/experimental/filesystem?rev=284313=284312=284313=diff
==
--- libcxx/trunk/include/experimental/filesystem (original)
+++ libcxx/trunk/include/experimental/filesystem Sat Oct 15 17:37:42 2016
@@ -863,7 +863,15 @@ public:
 }
 
 path& make_preferred() { return *this; }
-path& remove_filename() { return *this = parent_path(); }
+
+_LIBCPP_INLINE_VISIBILITY
+path& remove_filename() {
+  if (__pn_.size() == __root_path_raw().size())
+clear();
+  else
+__pn_ = __parent_path();
+  return *this;
+}
 
 path& replace_filename(const path& __replacement) {
 remove_filename();
@@ -925,6 +933,7 @@ private:
 _LIBCPP_FUNC_VIS int __compare(__string_view) const;
 _LIBCPP_FUNC_VIS __string_view __root_name() const;
 _LIBCPP_FUNC_VIS __string_view __root_directory() const;
+_LIBCPP_FUNC_VIS __string_view __root_path_raw() const;
 _LIBCPP_FUNC_VIS __string_view __relative_path() const;
 _LIBCPP_FUNC_VIS __string_view __parent_path() const;
 _LIBCPP_FUNC_VIS __string_view __filename() const;
@@ -953,7 +962,7 @@ public:
 
 _LIBCPP_INLINE_VISIBILITY bool has_root_name()  const { return 
!__root_name().empty(); }
 _LIBCPP_INLINE_VISIBILITY bool has_root_directory() const { return 
!__root_directory().empty(); }
-_LIBCPP_INLINE_VISIBILITY bool has_root_path()  const { return 
!(__root_name().empty() && __root_directory().empty()); }
+_LIBCPP_INLINE_VISIBILITY bool has_root_path()  const { return 
!__root_path_raw().empty(); }
 _LIBCPP_INLINE_VISIBILITY bool has_relative_path()  const { return 
!__relative_path().empty(); }
 _LIBCPP_INLINE_VISIBILITY bool has_parent_path()const { return 
!__parent_path().empty(); }
 _LIBCPP_INLINE_VISIBILITY bool has_filename()   const { return 
!__filename().empty(); }

Modified: libcxx/trunk/src/experimental/filesystem/path.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/experimental/filesystem/path.cpp?rev=284313=284312=284313=diff
==
--- libcxx/trunk/src/experimental/filesystem/path.cpp (original)
+++ libcxx/trunk/src/experimental/filesystem/path.cpp Sat Oct 15 17:37:42 2016
@@ -277,6 +277,16 @@ string_view_t path::__root_directory() c
 return parser::extract_preferred(__pn_, start_i);
 }
 
+string_view_t path::__root_path_raw() const
+{
+size_t e = parser::root_directory_end(__pn_);
+if (!parser::good(e))
+  e = parser::root_name_end(__pn_);
+if (parser::good(e))
+  return string_view_t{__pn_}.substr(0, e + 1);
+return {};
+}
+
 string_view_t path::__relative_path() const
 {
 if (empty()) {

Modified: 
libcxx/trunk/test/std/experimental/filesystem/class.path/path.member/path.modifiers/remove_filename.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/filesystem/class.path/path.member/path.modifiers/remove_filename.pass.cpp?rev=284313=284312=284313=diff
==
--- 
libcxx/trunk/test/std/experimental/filesystem/class.path/path.member/path.modifiers/remove_filename.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/experimental/filesystem/class.path/path.member/path.modifiers/remove_filename.pass.cpp
 Sat Oct 15 17:37:42 2016
@@ -35,16 +35,24 @@ const RemoveFilenameTestcase TestCases[]
   {
   {"", ""}
 , {"/", ""}
+, {"//", ""}
+, {"///", ""}
 , {"\\", ""}
 , {".", ""}
 , {"..", ""}
 , {"/foo", "/"}
+, {"//foo", ""}
+, {"//foo/", ""}
+, {"//foo///", ""}
+, {"///foo", "/"}
+, {"///foo/", "///foo"}
 , {"/foo/", "/foo"}
 , {"/foo/.", "/foo"}
 , {"/foo/..", "/foo"}
 , {"/foo/", "/foo"}
 , {"/foo", "/"}
 , {"/foo//\\/", "/foo//\\"}
+, {"///foo", "/"}
 , {"file.txt", ""}
 , {"bar/../baz/./file.txt", "bar/../baz/."}
   };

Modified: libcxx/trunk/www/upcoming_meeting.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/upcoming_meeting.html?rev=284313=284312=284313=diff
==
--- libcxx/trunk/www/upcoming_meeting.html (original)
+++ libcxx/trunk/www/upcoming_meeting.html Sat Oct 15 17:37:42 2016
@@ -89,7 +89,7 @@
 

[libcxx] r284321 - Update issue status for LWG 2768 and 2769

2016-10-15 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Sat Oct 15 20:43:43 2016
New Revision: 284321

URL: http://llvm.org/viewvc/llvm-project?rev=284321=rev
Log:
Update issue status for LWG 2768 and 2769

Added:

libcxx/trunk/test/std/utilities/any/any.nonmembers/any.cast/any_cast_request_invalid_value_category.fail.cpp
Removed:

libcxx/trunk/test/std/utilities/any/any.nonmembers/any.cast/rvalue_any_cast_request_lvalue.fail.cpp
Modified:
libcxx/trunk/include/any

libcxx/trunk/test/std/utilities/any/any.nonmembers/any.cast/const_correctness.fail.cpp

libcxx/trunk/test/std/utilities/any/any.nonmembers/any.cast/not_copy_constructible.fail.cpp
libcxx/trunk/www/upcoming_meeting.html

Modified: libcxx/trunk/include/any
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/any?rev=284321=284320=284321=diff
==
--- libcxx/trunk/include/any (original)
+++ libcxx/trunk/include/any Sat Oct 15 20:43:43 2016
@@ -579,7 +579,8 @@ _ValueType any_cast(any const & __v)
 {
 using _RawValueType = __uncvref_t<_ValueType>;
 static_assert(is_constructible<_ValueType, _RawValueType const &>::value,
-  "ValueType is required to be a reference or a 
CopyConstructible type");
+  "ValueType is required to be a const lvalue reference "
+  "or a CopyConstructible type");
 auto __tmp = _VSTD::any_cast>(&__v);
 if (__tmp == nullptr)
 __throw_bad_any_cast();
@@ -592,7 +593,8 @@ _ValueType any_cast(any & __v)
 {
 using _RawValueType = __uncvref_t<_ValueType>;
 static_assert(is_constructible<_ValueType, _RawValueType &>::value,
-  "ValueType is required to be a reference or a 
CopyConstructible type");
+  "ValueType is required to be an lvalue reference "
+  "or a CopyConstructible type");
 auto __tmp = _VSTD::any_cast<_RawValueType>(&__v);
 if (__tmp == nullptr)
 __throw_bad_any_cast();
@@ -605,7 +607,8 @@ _ValueType any_cast(any && __v)
 {
 using _RawValueType = __uncvref_t<_ValueType>;
 static_assert(is_constructible<_ValueType, _RawValueType>::value,
-  "ValueType is required to be an rvalue reference or a 
CopyConstructible type");
+  "ValueType is required to be an rvalue reference "
+  "or a CopyConstructible type");
 auto __tmp = _VSTD::any_cast<_RawValueType>(&__v);
 if (__tmp == nullptr)
 __throw_bad_any_cast();

Added: 
libcxx/trunk/test/std/utilities/any/any.nonmembers/any.cast/any_cast_request_invalid_value_category.fail.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/any/any.nonmembers/any.cast/any_cast_request_invalid_value_category.fail.cpp?rev=284321=auto
==
--- 
libcxx/trunk/test/std/utilities/any/any.nonmembers/any.cast/any_cast_request_invalid_value_category.fail.cpp
 (added)
+++ 
libcxx/trunk/test/std/utilities/any/any.nonmembers/any.cast/any_cast_request_invalid_value_category.fail.cpp
 Sat Oct 15 20:43:43 2016
@@ -0,0 +1,66 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// 
+
+// template 
+// ValueType any_cast(any &&);
+
+// Try and use the rvalue any_cast to cast to an lvalue reference
+
+#include 
+
+struct TestType {};
+using std::any;
+using std::any_cast;
+
+void test_const_lvalue_cast_request_non_const_lvalue()
+{
+const any a;
+// expected-error@any:* {{static_assert failed "ValueType is required to 
be a const lvalue reference or a CopyConstructible type"}}
+// expected-error@any:* {{binding value of type 'const TestType' to 
reference to type 'TestType' drops 'const' qualifier}}
+any_cast(a); // expected-note {{requested here}}
+
+const any a2(42);
+// expected-error@any:* {{static_assert failed "ValueType is required to 
be a const lvalue reference or a CopyConstructible type"}}
+// expected-error@any:* {{binding value of type 'const int' to reference 
to type 'int' drops 'const' qualifier}}
+any_cast(a2); // expected-note {{requested here}}
+}
+
+void test_lvalue_any_cast_request_rvalue()
+{
+any a;
+// expected-error@any:* {{static_assert failed "ValueType is required to 
be an lvalue reference or a CopyConstructible type"}}
+any_cast(a); // expected-note {{requested here}}
+
+any a2(42);
+// expected-error@any:* {{static_assert failed "ValueType is required to 
be an lvalue reference or a CopyConstructible type"}}
+any_cast(a2); // expected-note {{requested 

[libcxx] r284324 - Update LWG 2767 and add test case

2016-10-15 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Sat Oct 15 22:45:06 2016
New Revision: 284324

URL: http://llvm.org/viewvc/llvm-project?rev=284324=rev
Log:
Update LWG 2767 and add test case

Modified:
libcxx/trunk/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp
libcxx/trunk/www/upcoming_meeting.html

Modified: 
libcxx/trunk/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp?rev=284324=284323=284324=diff
==
--- 
libcxx/trunk/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp 
(original)
+++ 
libcxx/trunk/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp 
Sat Oct 15 22:45:06 2016
@@ -580,6 +580,19 @@ void call_operator_noexcept_test()
 }
 }
 
+void test_lwg2767() {
+// See http://wg21.link/LWG2767
+struct Abstract { virtual void f() const = 0; };
+struct Derived : public Abstract { void f() const {} };
+struct F { bool operator()(Abstract&&) { return false; } };
+{
+Derived d;
+Abstract  = d;
+bool b = std::not_fn(F{})(std::move(a));
+assert(b);
+}
+}
+
 int main()
 {
 constructor_tests();
@@ -589,4 +602,5 @@ int main()
 call_operator_sfinae_test(); // somewhat of an extension
 call_operator_forwarding_test();
 call_operator_noexcept_test();
+test_lwg2767();
 }

Modified: libcxx/trunk/www/upcoming_meeting.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/upcoming_meeting.html?rev=284324=284323=284324=diff
==
--- libcxx/trunk/www/upcoming_meeting.html (original)
+++ libcxx/trunk/www/upcoming_meeting.html Sat Oct 15 22:45:06 2016
@@ -126,7 +126,7 @@
 http://wg21.link/LWG2759;>2759gcd / lcm 
and bool for the WPIssaquahPatch ready
 http://wg21.link/LWG2760;>2760non-const 
basic_string::data should not invalidate 
iteratorsIssaquahNothing to do
 http://wg21.link/LWG2765;>2765Did LWG 
1123 go too far?Issaquah
-http://wg21.link/LWG2767;>2767not_fn 
call_wrapper can form invalid typesIssaquah
+http://wg21.link/LWG2767;>2767not_fn 
call_wrapper can form invalid typesIssaquahWe already do 
this
 http://wg21.link/LWG2768;>2768any_cast 
and move semanticsIssaquahResolved by LWG 2769
  http://wg21.link/LWG2769;>2769Redundant 
const in the return type of any_cast(const 
any&)IssaquahImplemented in trunk
 http://wg21.link/LWG2771;>2771Broken 
Effects of some basic_string::compare functions in terms of 
basic_string_viewIssaquahWe already do this
@@ -204,7 +204,7 @@
 2759 - Patch and tests ready
 2760 - This is just wording cleanup; no code or test changes needed.
 2765 - is this just wording cleanup? I don't think this actually 
requires code changes. 
-2767 - 
+2767 - The test case on the issue is incorrect. See not_fn.pass.cpp for 
the correct test case. 
 2768 - std::any: There is no PR for this issue. It is resolved by 
LWG 2769. 
 2769 - std::any: The PR looks good except that
remove_reference_tremove_cv_tT should read


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


[libcxx] r284326 - Update LWG 2754 status

2016-10-15 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Sat Oct 15 22:52:48 2016
New Revision: 284326

URL: http://llvm.org/viewvc/llvm-project?rev=284326=rev
Log:
Update LWG 2754 status

Modified:
libcxx/trunk/www/upcoming_meeting.html

Modified: libcxx/trunk/www/upcoming_meeting.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/upcoming_meeting.html?rev=284326=284325=284326=diff
==
--- libcxx/trunk/www/upcoming_meeting.html (original)
+++ libcxx/trunk/www/upcoming_meeting.html Sat Oct 15 22:52:48 2016
@@ -119,7 +119,7 @@
 http://wg21.link/LWG2750;>2750[fund.ts.v2] LWG 2451 
conversion constructor constraintIssaquah
 http://wg21.link/LWG2752;>2752"Throws:" 
clauses of async and packaged_task are 
unimplementableIssaquah
 http://wg21.link/LWG2753;>2753Optional's 
constructors and assignments need constraintsIssaquahWe 
already do this
-http://wg21.link/LWG2754;>2754The 
in_place constructors and emplace functions added by P0032R3 don't require 
CopyConstructibleIssaquah
+http://wg21.link/LWG2754;>2754The 
in_place constructors and emplace functions added by P0032R3 don't require 
CopyConstructibleIssaquahWe already do this
 http://wg21.link/LWG2755;>2755§[string.view.io] uses 
non-existent basic_string_view::to_string functionIssaquahWe 
already do this
 http://wg21.link/LWG2756;>2756C++ WP 
optional should 'forward' T's implicit 
conversionsIssaquahImplemented in trunk
 http://wg21.link/LWG2758;>2758std::string{}.assign("ABCDE", 
0, 1) is ambiguousWe already do this
@@ -197,7 +197,7 @@
 2750 - std::optional for LFTS -- should be considered for C++17
 2752 - 
 2753 - std::optional: LGTM. 
-2754 - 
+2754 - std::any: LGTM. 
 2755 - Both string and string_view call a common routine for output; so no 
code changes needed.
 2756 - std::optional: Very large change. It is fully implemented 
and tested. 
 2758 - We already do this. 


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


[libcxx] r284325 - Fix use of non-constexpr C++14 addressof

2016-10-15 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Sat Oct 15 22:49:18 2016
New Revision: 284325

URL: http://llvm.org/viewvc/llvm-project?rev=284325=rev
Log:
Fix use of non-constexpr C++14 addressof

Modified:
libcxx/trunk/include/experimental/optional

Modified: libcxx/trunk/include/experimental/optional
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/experimental/optional?rev=284325=284324=284325=diff
==
--- libcxx/trunk/include/experimental/optional (original)
+++ libcxx/trunk/include/experimental/optional Sat Oct 15 22:49:18 2016
@@ -488,7 +488,7 @@ public:
 {
 _LIBCPP_ASSERT(this->__engaged_, "optional operator-> called for 
disengaged value");
 #ifndef _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF
-return _VSTD::addressof(this->__val_);
+return __builtin_addressof(this->__val_);
 #else
 return __operator_arrow(__has_operator_addressof{});
 #endif


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


[PATCH] D24339: [clang-tidy] Add check 'readability-redundant-member-init'

2016-10-15 Thread Malcolm Parsons via cfe-commits
malcolm.parsons updated this revision to Diff 74769.
malcolm.parsons added a comment.

Use ignoringImplicit


https://reviews.llvm.org/D24339

Files:
  clang-tidy/readability/CMakeLists.txt
  clang-tidy/readability/ReadabilityTidyModule.cpp
  clang-tidy/readability/RedundantMemberInitCheck.cpp
  clang-tidy/readability/RedundantMemberInitCheck.h
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/readability-redundant-member-init.rst
  test/clang-tidy/readability-redundant-member-init.cpp

Index: test/clang-tidy/readability-redundant-member-init.cpp
===
--- /dev/null
+++ test/clang-tidy/readability-redundant-member-init.cpp
@@ -0,0 +1,181 @@
+// RUN: %check_clang_tidy %s readability-redundant-member-init %t
+
+struct S {
+  S() = default;
+  S(int i) : i(i) {}
+  int i = 1;
+};
+
+struct T {
+  T(int i = 1) : i(i) {}
+  int i;
+};
+
+struct U {
+  int i;
+};
+
+union V {
+  int i;
+  double f;
+};
+
+// Initializer calls default constructor
+struct F1 {
+  F1() : f() {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: initializer for member 'f' is redundant
+  // CHECK-FIXES: F1()  {}
+  S f;
+};
+
+// Initializer calls default constructor with default argument
+struct F2 {
+  F2() : f() {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: initializer for member 'f' is redundant
+  // CHECK-FIXES: F2()  {}
+  T f;
+};
+
+// Multiple redundant initializers for same constructor
+struct F3 {
+  F3() : f(), g(1), h() {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: initializer for member 'f' is redundant
+  // CHECK-MESSAGES: :[[@LINE-2]]:21: warning: initializer for member 'h' is redundant
+  // CHECK-FIXES: F3() :  g(1) {}
+  S f, g, h;
+};
+
+// Templated class independent type
+template 
+struct F4 {
+  F4() : f() {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: initializer for member 'f' is redundant
+  // CHECK-FIXES: F4()  {}
+  S f;
+};
+F4 f4i;
+F4 f4s;
+
+// Base class
+struct F5 : S {
+  F5() : S() {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: initializer for base class 'S' is redundant
+  // CHECK-FIXES: F5()  {}
+};
+
+// Constructor call requires cleanup
+struct Cleanup {
+  ~Cleanup() {}
+};
+
+struct UsesCleanup {
+  UsesCleanup(const Cleanup  = Cleanup()) {}
+};
+
+struct F6 {
+  F6() : uc() {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: initializer for member 'uc' is redundant
+  // CHECK-FIXES: F6()  {}
+  UsesCleanup uc;
+};
+
+// Multiple inheritance
+struct F7 : S, T {
+  F7() : S(), T() {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: initializer for base class 'S' is redundant
+  // CHECK-MESSAGES: :[[@LINE-2]]:15: warning: initializer for base class 'T' is redundant
+  // CHECK-FIXES: F7()  {}
+};
+
+// Initializer not written
+struct NF1 {
+  NF1() {}
+  S f;
+};
+
+// Initializer doesn't call default constructor
+struct NF2 {
+  NF2() : f(1) {}
+  S f;
+};
+
+// Initializer calls default constructor without using default argument
+struct NF3 {
+  NF3() : f(1) {}
+  T f;
+};
+
+// Initializer calls default constructor without using default argument
+struct NF4 {
+  NF4() : f(2) {}
+  T f;
+};
+
+// Initializer is zero-initialization
+struct NF5 {
+  NF5() : i() {}
+  int i;
+};
+
+// Initializer is direct-initialization
+struct NF6 {
+  NF6() : i(1) {}
+  int i;
+};
+
+// Initializer is aggregate initialization of struct
+struct NF7 {
+  NF7() : f{} {}
+  U f;
+};
+
+// Initializer is zero-initialization of struct
+struct NF7b {
+  NF7b() : f() {}
+  U f;
+};
+
+// Initializer is aggregate initialization of array
+struct NF8 {
+  NF8() : f{} {}
+  int f[2];
+};
+
+struct NF9 {
+  NF9() : f{} {}
+  S f[2];
+};
+
+// Initializing member of union
+union NF10 {
+  NF10() : s() {}
+  int i;
+  S s;
+};
+
+// Templated class dependent type
+template 
+struct NF11 {
+  NF11() : f() {}
+  V f;
+};
+NF11 nf11i;
+NF11 nf11s;
+
+// Delegating constructor
+class NF12 {
+  NF12() = default;
+  NF12(int) : NF12() {}
+};
+
+// Const member
+struct NF13 {
+  NF13() : f() {}
+  const S f;
+};
+
+// Union member
+struct NF14 {
+  NF14() : f() {}
+  V f;
+};
Index: docs/clang-tidy/checks/readability-redundant-member-init.rst
===
--- /dev/null
+++ docs/clang-tidy/checks/readability-redundant-member-init.rst
@@ -0,0 +1,20 @@
+.. title:: clang-tidy - readability-redundant-member-init
+
+readability-redundant-member-init
+=
+
+Finds member initializations that are unnecessary because the same default
+constructor would be called if they were not present.
+
+Example:
+
+.. code-block:: c++
+
+  // Explicitly initializing the member s is unnecessary.
+  class Foo {
+  public:
+Foo() : s() {}
+
+  private:
+std::string s;
+  };
Index: docs/clang-tidy/checks/list.rst
===
--- docs/clang-tidy/checks/list.rst
+++ docs/clang-tidy/checks/list.rst

[PATCH] D25642: [clang-tidy] Use ignoreImplicit in cert-err58-cpp check

2016-10-15 Thread Malcolm Parsons via cfe-commits
malcolm.parsons created this revision.
malcolm.parsons added a reviewer: aaron.ballman.
malcolm.parsons added a subscriber: cfe-commits.

Fix a false negative in cert-err58-cpp check when calling a constructor
creates objects that require cleanup.


https://reviews.llvm.org/D25642

Files:
  clang-tidy/cert/StaticObjectExceptionCheck.cpp
  test/clang-tidy/cert-static-object-exception.cpp

Index: test/clang-tidy/cert-static-object-exception.cpp
===
--- test/clang-tidy/cert-static-object-exception.cpp
+++ test/clang-tidy/cert-static-object-exception.cpp
@@ -16,6 +16,15 @@
   explicit V(const char *) {} // Can throw
 };
 
+struct Cleanup
+{
+  ~Cleanup() {}
+};
+
+struct W {
+  W(Cleanup c = {}) noexcept(false);
+};
+
 
 S s;
 // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: construction of 's' with static storage duration may throw an exception that cannot be caught [cert-err58-cpp]
@@ -27,30 +36,38 @@
 V v("v");
 // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: construction of 'v' with static storage duration may throw an exception that cannot be caught
 // CHECK-MESSAGES: 16:12: note: possibly throwing constructor declared here
+W w;
+// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: construction of 'w' with static storage duration may throw an exception that cannot be caught
+// CHECK-MESSAGES: 25:3: note: possibly throwing constructor declared here
 
 thread_local S s3;
 // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: construction of 's3' with thread_local storage duration may throw an exception that cannot be caught
 thread_local T t3; // ok
 thread_local U u3;
 // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: construction of 'u3' with thread_local storage duration may throw an exception that cannot be caught
 thread_local V v3("v");
 // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: construction of 'v3' with thread_local storage duration may throw an exception that cannot be caught
+thread_local W w3;
+// CHECK-MESSAGES: :[[@LINE-1]]:16: warning: construction of 'w3' with thread_local storage duration may throw an exception that cannot be caught
 
-void f(S s1, T t1, U u1, V v1) { // ok, ok, ok, ok
+void f(S s1, T t1, U u1, V v1, W w1) { // ok, ok, ok, ok, ok
   S s2; // ok
   T t2; // ok
   U u2; // ok
   V v2("v"); // ok
+  W w2; // ok
 
   thread_local S s3; // ok
   thread_local T t3; // ok
   thread_local U u3; // ok
   thread_local V v3("v"); // ok
+  thread_local W w3; // ok
 
   static S s4; // ok
   static T t4; // ok
   static U u4; // ok
   static V v4("v"); // ok
+  static W w4; // ok
 }
 
 namespace {
@@ -64,14 +81,19 @@
 V v("v");
 // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: construction of 'v' with static storage duration may throw an exception that cannot be caught
 // CHECK-MESSAGES: 16:12: note: possibly throwing constructor declared here
+W w;
+// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: construction of 'w' with static storage duration may throw an exception that cannot be caught
+// CHECK-MESSAGES: 25:3: note: possibly throwing constructor declared here
 
 thread_local S s3;
 // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: construction of 's3' with thread_local storage duration may throw an exception that cannot be caught
 thread_local T t3; // ok
 thread_local U u3;
 // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: construction of 'u3' with thread_local storage duration may throw an exception that cannot be caught
 thread_local V v3("v");
 // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: construction of 'v3' with thread_local storage duration may throw an exception that cannot be caught
+thread_local W w3;
+// CHECK-MESSAGES: :[[@LINE-1]]:16: warning: construction of 'w3' with thread_local storage duration may throw an exception that cannot be caught
 };
 
 class Statics {
@@ -85,22 +107,28 @@
   static V v;
   // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: construction of 'v' with static storage duration may throw an exception that cannot be caught
   // CHECK-MESSAGES: 16:12: note: possibly throwing constructor declared here
+  static W w;
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: construction of 'w' with static storage duration may throw an exception that cannot be caught
+  // CHECK-MESSAGES: 25:3: note: possibly throwing constructor declared here
 
   void f(S s, T t, U u, V v) {
 S s2;  // ok
 T t2;  // ok
 U u2;  // ok
 V v2("v"); // ok
+W w2;  // ok
 
 thread_local S s3;  // ok
 thread_local T t3;  // ok
 thread_local U u3;  // ok
 thread_local V v3("v"); // ok
+thread_local W w3;  // ok
 
 static S s4;  // ok
 static T t4;  // ok
 static U u4;  // ok
 static V v4("v"); // ok
+static W w4;  // ok
   }
 };
 
@@ -114,3 +142,6 @@
 V Statics::v("v");
 // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: construction of 'v' with static storage duration may throw an exception that cannot be caught
 // CHECK-MESSAGES: 16:12: note: possibly throwing 

Re: r284284 - Reinstate r284008 reverted in r284081, with two fixes:

2016-10-15 Thread Vassil Vassilev via cfe-commits
It seems that we are still missing a piece, because this broke the 
libstdc++ selfhost: 
http://lab.llvm.org:8011/builders/clang-x86_64-linux-selfhost-modules-2/builds/5891


On 14/10/16 23:41, Richard Smith via cfe-commits wrote:

Author: rsmith
Date: Fri Oct 14 16:41:24 2016
New Revision: 284284

URL: http://llvm.org/viewvc/llvm-project?rev=284284=rev
Log:
Reinstate r284008 reverted in r284081, with two fixes:

1) Merge and demote variable definitions when we find a redefinition in
MergeVarDecls, not only when we find one in AddInitializerToDecl (we only reach
the second case if it's the addition of the initializer itself that converts an
existing declaration into a definition).

2) When rebuilding a redeclaration chain for a variable, if we merge two
definitions together, mark the definitions as merged so the retained definition
is made visible whenever the demoted definition would have been.

Original commit message (from r283882):

[modules] PR28752: Do not instantiate variable declarations which are not 
visible.

Original patch by Vassil Vassilev! Changes listed above are mine.

Added:
 cfe/trunk/test/Modules/Inputs/PR28752/
   - copied from r284080, cfe/trunk/test/Modules/Inputs/PR28752/
 cfe/trunk/test/Modules/pr28752.cpp
   - copied, changed from r284080, cfe/trunk/test/Modules/pr28752.cpp
Modified:
 cfe/trunk/include/clang/AST/Decl.h
 cfe/trunk/include/clang/Sema/Sema.h
 cfe/trunk/lib/AST/Decl.cpp
 cfe/trunk/lib/Sema/SemaDecl.cpp
 cfe/trunk/lib/Sema/SemaTemplate.cpp
 cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
 cfe/trunk/lib/Sema/SemaType.cpp
 cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
 cfe/trunk/lib/Serialization/ASTWriterDecl.cpp
 cfe/trunk/test/Modules/Inputs/PR28752/Subdir1/b.h
 cfe/trunk/test/Modules/Inputs/PR28752/Subdir1/c.h

Modified: cfe/trunk/include/clang/AST/Decl.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Decl.h?rev=284284=284283=284284=diff
==
--- cfe/trunk/include/clang/AST/Decl.h (original)
+++ cfe/trunk/include/clang/AST/Decl.h Fri Oct 14 16:41:24 2016
@@ -865,6 +865,11 @@ protected:
  
  unsigned : NumVarDeclBits;
  
+// FIXME: We need something similar to CXXRecordDecl::DefinitionData.

+/// \brief Whether this variable is a definition which was demoted due to
+/// module merge.
+unsigned IsThisDeclarationADemotedDefinition : 1;
+
  /// \brief Whether this variable is the exception variable in a C++ catch
  /// or an Objective-C @catch statement.
  unsigned ExceptionVar : 1;
@@ -1198,12 +1203,28 @@ public:
InitializationStyle getInitStyle() const {
  return static_cast(VarDeclBits.InitStyle);
}
-
/// \brief Whether the initializer is a direct-initializer (list or call).
bool isDirectInit() const {
  return getInitStyle() != CInit;
}
  
+  /// \brief If this definition should pretend to be a declaration.

+  bool isThisDeclarationADemotedDefinition() const {
+return isa(this) ? false :
+  NonParmVarDeclBits.IsThisDeclarationADemotedDefinition;
+  }
+
+  /// \brief This is a definition which should be demoted to a declaration.
+  ///
+  /// In some cases (mostly module merging) we can end up with two visible
+  /// definitions one of which needs to be demoted to a declaration to keep
+  /// the AST invariants.
+  void demoteThisDefinitionToDeclaration() {
+assert (isThisDeclarationADefinition() && "Not a definition!");
+assert (!isa(this) && "Cannot demote ParmVarDecls!");
+NonParmVarDeclBits.IsThisDeclarationADemotedDefinition = 1;
+  }
+
/// \brief Determine whether this variable is the exception variable in a
/// C++ catch statememt or an Objective-C \@catch statement.
bool isExceptionVariable() const {
@@ -1302,6 +1323,10 @@ public:
  NonParmVarDeclBits.PreviousDeclInSameBlockScope = Same;
}
  
+  /// \brief Retrieve the variable declaration from which this variable could

+  /// be instantiated, if it is an instantiation (rather than a non-template).
+  VarDecl *getTemplateInstantiationPattern() const;
+
/// \brief If this variable is an instantiated static data member of a
/// class template specialization, returns the templated static data member
/// from which it was instantiated.

Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=284284=284283=284284=diff
==
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Fri Oct 14 16:41:24 2016
@@ -2286,6 +2286,7 @@ public:
void MergeVarDecl(VarDecl *New, LookupResult );
void MergeVarDeclTypes(VarDecl *New, VarDecl *Old, bool MergeTypeWithOld);
void MergeVarDeclExceptionSpecs(VarDecl *New, VarDecl *Old);
+  bool checkVarDeclRedefinition(VarDecl 

[PATCH] D24991: Inline hot functions in libcxx shared_ptr implementation.

2016-10-15 Thread Aditya Kumar via cfe-commits
hiraditya added a comment.

Marshall suggests using macro as we discussed offline. For some reason the 
reply does not appear here: 
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20161010/173780.html


Repository:
  rL LLVM

https://reviews.llvm.org/D24991



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