[libcxx] r273078 - Fix 3 bugs in filesystem tests and implementation.

2016-06-17 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Jun 17 23:10:23 2016
New Revision: 273078

URL: http://llvm.org/viewvc/llvm-project?rev=273078=rev
Log:
Fix 3 bugs in filesystem tests and implementation.

This patch fixes the following bugs, all of which were discovered while
testing a 32 bit build on a 64 bit machine.

* path.itr/iterator.pass.cpp has undefined behavior.
  'path::iterator' stashes the value of the element inside the iterator.
  This violates the BiDirIterator requirements but is allowed for 
path::iterator.
  However this means that using reverse_iterator has undefined
  behavior because it assumes that 'Iter tmp = it; return *tmp' will not create
  a dangling reference. However it does, and this caused this particular test
  to fail.

* path.native.obs/string_alloc.pass.cpp tested the SSO with a long string.
  On 32 bit builds std::wstring only has the SSO for strings of size 2. The
  test was using a string of size 4.

* fs.op.space/space.pass.cpp had overflows while calculating the expected 
values.
  The fix here is to convert the statvfs data members to std::uintmax_t before
  multiplying them. The internal implementation already does this but the tests
  needed to do it as well.

Modified:

libcxx/trunk/test/std/experimental/filesystem/class.path/path.itr/iterator.pass.cpp

libcxx/trunk/test/std/experimental/filesystem/class.path/path.member/path.native.obs/string_alloc.pass.cpp

libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.space/space.pass.cpp
libcxx/trunk/test/support/filesystem_test_helper.hpp

Modified: 
libcxx/trunk/test/std/experimental/filesystem/class.path/path.itr/iterator.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/filesystem/class.path/path.itr/iterator.pass.cpp?rev=273078=273077=273078=diff
==
--- 
libcxx/trunk/test/std/experimental/filesystem/class.path/path.itr/iterator.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/experimental/filesystem/class.path/path.itr/iterator.pass.cpp
 Fri Jun 17 23:10:23 2016
@@ -24,8 +24,6 @@
 #include 
 #include 
 
-#include 
-
 #include "test_macros.h"
 #include "filesystem_test_helper.hpp"
 
@@ -37,30 +35,6 @@ std::reverse_iterator mkRev(It it) {
   return std::reverse_iterator(it);
 }
 
-
-template 
-bool checkCollectionsEqualVerbose(
-Iter1 start1, Iter1 const end1
-  , Iter2 start2, Iter2 const end2
-  )
-{
-while (start1 != end1 && start2 != end2) {
-  std::cout << "Got start1 = " << *start1 << "\n"
-<< "Got start2 = " << *start2 << "\n";
-if (*start1 != *start2) {
-return false;
-}
-++start1; ++start2;
-}
-  if (start1 != end1) {
-std::cout << "Got start1 = " << *start1 << " but expected end1\n";
-  }
-  if (start2 != end2) {
-std::cout << "Got start2 = " << *start2 << " but expected end2\n";
-  }
-return (start1 == end1 && start2 == end2);
-}
-
 void checkIteratorConcepts() {
   using namespace fs;
   using It = path::iterator;
@@ -112,16 +86,15 @@ void checkBeginEndBasic() {
 path p("//root_name//first_dirsecond_dir");
 const path expect[] = {"//root_name", "/", "first_dir", "second_dir"};
 assert(checkCollectionsEqual(p.begin(), p.end(), std::begin(expect), 
std::end(expect)));
-assert(checkCollectionsEqualVerbose(mkRev(p.end()), mkRev(p.begin()),
- mkRev(std::end(expect)),
- mkRev(std::begin(expect;
+assert(checkCollectionsEqualBackwards(p.begin(), p.end(), 
std::begin(expect), std::end(expect)));
+
   }
   {
 path p("foo/bar/baz///");
 const path expect[] = {"/", "foo", "bar", "baz", "."};
 assert(checkCollectionsEqual(p.begin(), p.end(), std::begin(expect), 
std::end(expect)));
-assert(checkCollectionsEqual(mkRev(p.end()), mkRev(p.begin()),
- mkRev(std::end(expect)), 
mkRev(std::begin(expect;
+assert(checkCollectionsEqualBackwards(p.begin(), p.end(), 
std::begin(expect), std::end(expect)));
+
   }
 
 }

Modified: 
libcxx/trunk/test/std/experimental/filesystem/class.path/path.member/path.native.obs/string_alloc.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/filesystem/class.path/path.member/path.native.obs/string_alloc.pass.cpp?rev=273078=273077=273078=diff
==
--- 
libcxx/trunk/test/std/experimental/filesystem/class.path/path.member/path.native.obs/string_alloc.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/experimental/filesystem/class.path/path.member/path.native.obs/string_alloc.pass.cpp
 Fri Jun 17 23:10:23 2016
@@ -30,7 +30,8 @@
 
 namespace fs = std::experimental::filesystem;
 
-MultiStringType shortString = MKSTR("abc");
+// the SSO is always triggered for strings of size 2.
+MultiStringType shortString = MKSTR("a");
 MultiStringType longString = 

Re: [PATCH] D21367: AMDGPU: Set amdgpu_kernel calling convention for OpenCL kernels.

2016-06-17 Thread Tom Stellard via cfe-commits
tstellarAMD added a comment.

Does this new patch fix the OpenCL regression?


http://reviews.llvm.org/D21367



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


[libcxx] r273076 - Enable building and using atomic shared_ptr for GCC.

2016-06-17 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Jun 17 21:12:53 2016
New Revision: 273076

URL: http://llvm.org/viewvc/llvm-project?rev=273076=rev
Log:
Enable building and using atomic shared_ptr for GCC.

Summary:
Currently the  implementation of [util.smartptr.shared.atomic] is provided only 
when using Clang, and not with GCC. This is a relic of not having a GCC 
implementation of , even though  isn't actually used in the 
implementation. This patch enables support for atomic shared_ptr functions when 
using GCC.

Note that this is not a header only change. Previously only Clang builds of 
libc++.so would provide the required symbols. There is no reason  for this 
restriction.
After this change both Clang and GCC builds should be binary compatible with 
each other WRT these symbols.


Reviewers: mclow.lists, rmaprath, EricWF

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D21407

Modified:
libcxx/trunk/include/memory
libcxx/trunk/src/memory.cpp

Modified: libcxx/trunk/include/memory
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/memory?rev=273076=273075=273076=diff
==
--- libcxx/trunk/include/memory (original)
+++ libcxx/trunk/include/memory Fri Jun 17 21:12:53 2016
@@ -5464,9 +5464,8 @@ inline _LIBCPP_INLINE_VISIBILITY
 basic_ostream<_CharT, _Traits>&
 operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Yp> const& __p);
 
-// TODO(EricWF): Enable this for both Clang and GCC. Currently it is only
-// enabled with clang.
-#if defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_NO_THREADS)
+
+#if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)
 
 class _LIBCPP_TYPE_VIS __sp_mut
 {
@@ -5595,7 +5594,7 @@ atomic_compare_exchange_weak_explicit(sh
 return atomic_compare_exchange_weak(__p, __v, __w);
 }
 
-#endif  // defined(_LIBCPP_HAS_C_ATOMIC_IMP) && 
!defined(_LIBCPP_HAS_NO_THREADS)
+#endif  // !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)
 
 //enum class
 struct _LIBCPP_TYPE_VIS pointer_safety

Modified: libcxx/trunk/src/memory.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/memory.cpp?rev=273076=273075=273076=diff
==
--- libcxx/trunk/src/memory.cpp (original)
+++ libcxx/trunk/src/memory.cpp Fri Jun 17 21:12:53 2016
@@ -124,7 +124,7 @@ __shared_weak_count::__get_deleter(const
 
 #endif  // _LIBCPP_NO_RTTI
 
-#if defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_NO_THREADS)
+#if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)
 
 static const std::size_t __sp_mut_count = 16;
 static __libcpp_mutex_t mut_back_imp[__sp_mut_count] =
@@ -177,7 +177,7 @@ __get_sp_mut(const void* p)
 return muts[hash()(p) & (__sp_mut_count-1)];
 }
 
-#endif // defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_NO_THREADS)
+#endif // !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)
 
 void
 declare_reachable(void*)


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


Re: r273016 - Driver: introduce and use `-isystem-after` for cross-windows

2016-06-17 Thread Saleem Abdulrasool via cfe-commits
On Fri, Jun 17, 2016 at 12:45 PM, Rafael EspĂ­ndola <
rafael.espind...@gmail.com> wrote:

> Looks like this broke a few bots:
>

Yeah, sorry about that.  It should all be cleared up by now (I had a couple
of follow ups to make the test more generic).


>
> http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/7311
>
> Cheers,
> Rafael
>
>
> On 17 June 2016 at 13:23, Saleem Abdulrasool via cfe-commits
>  wrote:
> > Author: compnerd
> > Date: Fri Jun 17 12:23:16 2016
> > New Revision: 273016
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=273016=rev
> > Log:
> > Driver: introduce and use `-isystem-after` for cross-windows
> >
> > This mirrors the many other -i*after options to insert a new system
> search
> > directory at the end of the search path.  This makes it possible to
> actually
> > inject a search path after the resource dir.  This option is similar in
> spirit
> > to the /imsvc option in the clang-cl driver.  This is needed to properly
> use the
> > driver for Windows targets where the clang headers wrap some of the
> system
> > headers.
> >
> > This concept is actually useful on other targets (e.g. Linux) and would
> be
> > really easy to support on the core toolchain.
> >
> > Modified:
> > cfe/trunk/include/clang/Driver/Options.td
> > cfe/trunk/lib/Driver/CrossWindowsToolChain.cpp
> > cfe/trunk/lib/Driver/Tools.cpp
> > cfe/trunk/test/Driver/windows-cross.c
> >
> > Modified: cfe/trunk/include/clang/Driver/Options.td
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=273016=273015=273016=diff
> >
> ==
> > --- cfe/trunk/include/clang/Driver/Options.td (original)
> > +++ cfe/trunk/include/clang/Driver/Options.td Fri Jun 17 12:23:16 2016
> > @@ -1277,6 +1277,9 @@ def isysroot : JoinedOrSeparate<["-"], "
> >  def isystem : JoinedOrSeparate<["-"], "isystem">, Group,
> >Flags<[CC1Option]>,
> >HelpText<"Add directory to SYSTEM include search path">,
> MetaVarName<"">;
> > +def isystem_after : JoinedOrSeparate<["-"], "isystem-after">,
> > +  Group, Flags<[DriverOption]>,
> MetaVarName<"">,
> > +  HelpText<"Add directory to end of the SYSTEM include search path">;
> >  def iwithprefixbefore : JoinedOrSeparate<["-"], "iwithprefixbefore">,
> Group,
> >HelpText<"Set directory to include search path with prefix">,
> MetaVarName<"">,
> >Flags<[CC1Option]>;
> >
> > Modified: cfe/trunk/lib/Driver/CrossWindowsToolChain.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/CrossWindowsToolChain.cpp?rev=273016=273015=273016=diff
> >
> ==
> > --- cfe/trunk/lib/Driver/CrossWindowsToolChain.cpp (original)
> > +++ cfe/trunk/lib/Driver/CrossWindowsToolChain.cpp Fri Jun 17 12:23:16
> 2016
> > @@ -62,6 +62,8 @@ AddClangSystemIncludeArgs(const llvm::op
> >  llvm::sys::path::append(ResourceDir, "include");
> >  addSystemInclude(DriverArgs, CC1Args, ResourceDir);
> >}
> > +  for (const auto  :
> DriverArgs.getAllArgValues(options::OPT_isystem_after))
> > +addSystemInclude(DriverArgs, CC1Args, P);
> >addExternCSystemInclude(DriverArgs, CC1Args, SysRoot +
> "/usr/include");
> >  }
> >
> >
> > Modified: cfe/trunk/lib/Driver/Tools.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=273016=273015=273016=diff
> >
> ==
> > --- cfe/trunk/lib/Driver/Tools.cpp (original)
> > +++ cfe/trunk/lib/Driver/Tools.cpp Fri Jun 17 12:23:16 2016
> > @@ -502,6 +502,13 @@ void Clang::AddPreprocessingOptions(Comp
> > <<
> A->getAsString(Args);
> >  }
> >}
> > +} else if (A->getOption().matches(options::OPT_isystem_after)) {
> > +  // Handling of paths which must come late.  These entries are
> handled by
> > +  // the toolchain itself after the resource dir is inserted in the
> right
> > +  // search order.
> > +  // Do not claim the argument so that the use of the argument does
> not
> > +  // silently go unnoticed on toolchains which do not honour the
> option.
> > +  continue;
> >  }
> >
> >  // Not translated, render as usual.
> >
> > Modified: cfe/trunk/test/Driver/windows-cross.c
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/windows-cross.c?rev=273016=273015=273016=diff
> >
> ==
> > --- cfe/trunk/test/Driver/windows-cross.c (original)
> > +++ cfe/trunk/test/Driver/windows-cross.c Fri Jun 17 12:23:16 2016
> > @@ -67,3 +67,10 @@
> >  // CHECK-SANITIZE-TSAN: error: unsupported argument 'tsan' to option
> 'fsanitize='
> >  // CHECK-SANITIZE-TSAN-NOT: "-fsanitize={{.*}}"
> >
> > +// RUN: %clang -### -target 

Re: [PATCH] D21407: Enable building and using atomic shared_ptr for GCC.

2016-06-17 Thread Eric Fiselier via cfe-commits
EricWF accepted this revision.
EricWF added a reviewer: EricWF.
EricWF added a comment.
This revision is now accepted and ready to land.

Accepting.


http://reviews.llvm.org/D21407



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


[libcxx] r273075 - Add additional tests in an attempt to diagnose ARM test failures.

2016-06-17 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Jun 17 21:11:48 2016
New Revision: 273075

URL: http://llvm.org/viewvc/llvm-project?rev=273075=rev
Log:
Add additional tests in an attempt to diagnose ARM test failures.

Currently 4 tests are failing on the ARM buildbot. To try and diagnose each
of the failures this patch does the following:

1) path.itr/iterator.pass.cpp
   * Temporarily print iteration sequence to see where its failing.

2) path.native.obs/string_alloc.pass.cpp
   * Remove test that ::new is not called when constructing a short string
 that requires a conversion. Since during the conversion global locale
 objects might be constructed.

3) fs.op.funcs/space.pass.cpp
   * Explicitly use uintmax_t in the implementation of space, hopefully
 preventing possible overflows.
   * Add additional tests that check for overflow is the calculation of the
 space_info values.
   * Add additional tests for the values returned from statfvs.

4) fs.op.funcs/last_write_time.pass.cpp
   * No changes made yet.

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

libcxx/trunk/test/std/experimental/filesystem/class.path/path.itr/iterator.pass.cpp

libcxx/trunk/test/std/experimental/filesystem/class.path/path.member/path.native.obs/string_alloc.pass.cpp

libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.space/space.pass.cpp

Modified: libcxx/trunk/src/experimental/filesystem/operations.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/experimental/filesystem/operations.cpp?rev=273075=273074=273075=diff
==
--- libcxx/trunk/src/experimental/filesystem/operations.cpp (original)
+++ libcxx/trunk/src/experimental/filesystem/operations.cpp Fri Jun 17 21:11:48 
2016
@@ -669,7 +669,7 @@ void __resize_file(const path& p, std::u
 
 space_info __space(const path& p, std::error_code *ec) {
 space_info si;
-struct statvfs m_svfs;
+struct statvfs m_svfs = {};
 if (::statvfs(p.c_str(), _svfs) == -1)  {
 set_or_throw(ec, "space", p);
 si.capacity = si.free = si.available =
@@ -678,7 +678,7 @@ space_info __space(const path& p, std::e
 }
 if (ec) ec->clear();
 // Multiply with overflow checking.
-auto do_mult = [&](std::uintmax_t& out, fsblkcnt_t other) {
+auto do_mult = [&](std::uintmax_t& out, std::uintmax_t other) {
   out = other * m_svfs.f_frsize;
   if (out / other != m_svfs.f_frsize || other == 0)
   out = static_cast(-1);

Modified: 
libcxx/trunk/test/std/experimental/filesystem/class.path/path.itr/iterator.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/filesystem/class.path/path.itr/iterator.pass.cpp?rev=273075=273074=273075=diff
==
--- 
libcxx/trunk/test/std/experimental/filesystem/class.path/path.itr/iterator.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/experimental/filesystem/class.path/path.itr/iterator.pass.cpp
 Fri Jun 17 21:11:48 2016
@@ -24,6 +24,8 @@
 #include 
 #include 
 
+#include 
+
 #include "test_macros.h"
 #include "filesystem_test_helper.hpp"
 
@@ -36,6 +38,29 @@ std::reverse_iterator mkRev(It it) {
 }
 
 
+template 
+bool checkCollectionsEqualVerbose(
+Iter1 start1, Iter1 const end1
+  , Iter2 start2, Iter2 const end2
+  )
+{
+while (start1 != end1 && start2 != end2) {
+  std::cout << "Got start1 = " << *start1 << "\n"
+<< "Got start2 = " << *start2 << "\n";
+if (*start1 != *start2) {
+return false;
+}
+++start1; ++start2;
+}
+  if (start1 != end1) {
+std::cout << "Got start1 = " << *start1 << " but expected end1\n";
+  }
+  if (start2 != end2) {
+std::cout << "Got start2 = " << *start2 << " but expected end2\n";
+  }
+return (start1 == end1 && start2 == end2);
+}
+
 void checkIteratorConcepts() {
   using namespace fs;
   using It = path::iterator;
@@ -87,14 +112,18 @@ void checkBeginEndBasic() {
 path p("//root_name//first_dirsecond_dir");
 const path expect[] = {"//root_name", "/", "first_dir", "second_dir"};
 assert(checkCollectionsEqual(p.begin(), p.end(), std::begin(expect), 
std::end(expect)));
-assert(checkCollectionsEqual(mkRev(p.end()), mkRev(p.begin()), 
mkRev(std::end(expect)), mkRev(std::begin(expect;
+assert(checkCollectionsEqualVerbose(mkRev(p.end()), mkRev(p.begin()),
+ mkRev(std::end(expect)),
+ mkRev(std::begin(expect;
   }
   {
 path p("foo/bar/baz///");
 const path expect[] = {"/", "foo", "bar", "baz", "."};
 assert(checkCollectionsEqual(p.begin(), p.end(), std::begin(expect), 
std::end(expect)));
-assert(checkCollectionsEqual(mkRev(p.end()), mkRev(p.begin()), 
mkRev(std::end(expect)), mkRev(std::begin(expect;
+assert(checkCollectionsEqual(mkRev(p.end()), mkRev(p.begin()),
+   

Re: [PATCH] D21453: Add support for attribute "overallocated"

2016-06-17 Thread Akira Hatanaka via cfe-commits
ahatanak added inline comments.


Comment at: include/clang/Basic/AttrDocs.td:2073-2079
@@ +2072,9 @@
+  let Content = [{
+Use ``overallocated`` to indicate a struct or union is over-allocated. For 
example,
+
+.. code-block:: c++
+
+struct S {
+  char a[4], char b[4];
+} __attribute__((overallocated));
+

I intended overallocated to mean there might be extra memory at the end of a 
struct or union regardless of whether or not the last member is an array. This 
seemed more useful than restricting it to structs with array members as was 
discussed in the cfe-dev thread. For example, Hal mentioned that we might have 
caught the bugs you fixed in r262891 had we used this attribute on 
over-allocated classes.

Does this sound reasonable to you or do you see any problem with this approach? 
Alternatively, we can use an attribute (variable_length_array or gcc's 
bnd_variable_size) that will be attached to the array, which is good enough for 
the use case we care about (we want __builtin_object_size to return an exact or 
a conservative value for struct sockaddr_un that was mentioned in the thread).


http://reviews.llvm.org/D21453



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


Re: [PATCH] D21453: Add support for attribute "overallocated"

2016-06-17 Thread Akira Hatanaka via cfe-commits
ahatanak updated this revision to Diff 61145.
ahatanak added a comment.

Fix a bug in tryEvaluateBuiltinObjectSize. If the pointer passed to 
__builtin_object_size doesn't point to an array, it should be able to compute 
the exact size of the subobject the pointer points to. Therefore, it should be 
able to tell the last call to __builtin_object_size in 
test/CodeGen/object-size.c should return 128.


http://reviews.llvm.org/D21453

Files:
  include/clang/Basic/Attr.td
  include/clang/Basic/AttrDocs.td
  lib/AST/ExprConstant.cpp
  lib/Sema/SemaDeclAttr.cpp
  test/CodeGen/object-size.c
  test/CodeGen/object-size.cpp

Index: test/CodeGen/object-size.cpp
===
--- test/CodeGen/object-size.cpp
+++ test/CodeGen/object-size.cpp
@@ -62,3 +62,29 @@
   // CHECK: store i32 16
   gi = __builtin_object_size(>bs[0].buf[0], 3);
 }
+
+struct S0 {
+  int a[16], b[16];
+} __attribute__((overallocated));
+
+struct S1 : S0 {
+};
+
+struct S2 : S1 {
+} __attribute__((overallocated));
+
+// CHECK-LABEL: define void @_Z5test3v()
+void test3() {
+  struct S0 *s0;
+  struct S1 *s1;
+  struct S2 *s2;
+
+  // CHECK: call i64 @llvm.objectsize.i64.p0i8(i8* %{{.*}}, i1 false)
+  gi = __builtin_object_size(s0->b, 1);
+
+  // CHECK: store i32 64, i32* @gi
+  gi = __builtin_object_size(s1->b, 1);
+
+  // CHECK: call i64 @llvm.objectsize.i64.p0i8(i8* %{{.*}}, i1 false)
+  gi = __builtin_object_size(s2->b, 1);
+}
Index: test/CodeGen/object-size.c
===
--- test/CodeGen/object-size.c
+++ test/CodeGen/object-size.c
@@ -517,3 +517,49 @@
   // CHECK: call i64 @llvm.objectsize.i64.p0i8(i8* %{{.*}}, i1 false)
   gi = __builtin_object_size([9].snd[0], 1);
 }
+
+union U0 {
+  int a[16], b[16];
+} __attribute__((overallocated));
+
+struct S0 {
+  int a[16], b[16];
+};
+
+struct S1 {
+  int a[16], b[16];
+} __attribute__((overallocated));
+
+struct S2 {
+  int a[16], b[16];
+  struct S1 s1;
+  struct S0 s0;
+} __attribute__((overallocated));
+
+// CHECK-LABEL: @test32
+void test32() {
+  union U0 *u0;
+  struct S1 *s1;
+  struct S2 *s2;
+
+  // CHECK: call i64 @llvm.objectsize.i64.p0i8(i8* %{{.*}}, i1 false)
+  gi = __builtin_object_size(u0->a, 1);
+
+  // CHECK: call i64 @llvm.objectsize.i64.p0i8(i8* %{{.*}}, i1 false)
+  gi = __builtin_object_size(u0->b, 1);
+
+  // CHECK: store i32 64, i32* @gi
+  gi = __builtin_object_size(s1->a, 1);
+
+  // CHECK: call i64 @llvm.objectsize.i64.p0i8(i8* %{{.*}}, i1 false)
+  gi = __builtin_object_size(s1->b, 1);
+
+  // CHECK: store i32 64, i32* @gi
+  gi = __builtin_object_size(s2->b, 1);
+
+  // CHECK: store i32 64, i32* @gi
+  gi = __builtin_object_size(s2->s1.b, 1);
+
+  // CHECK: store i32 128, i32* @gi
+  gi = __builtin_object_size(>s0, 1);
+}
Index: lib/Sema/SemaDeclAttr.cpp
===
--- lib/Sema/SemaDeclAttr.cpp
+++ lib/Sema/SemaDeclAttr.cpp
@@ -4929,6 +4929,12 @@
   }
 }
 
+static void handleOverAllocatedAttr(Sema , Decl *D, const AttributeList ) {
+  D->addAttr(::new (S.Context)
+ OverAllocatedAttr(Attr.getLoc(), S.Context,
+   Attr.getAttributeSpellingListIndex()));
+}
+
 static void handleAMDGPUNumVGPRAttr(Sema , Decl *D,
 const AttributeList ) {
   uint32_t NumRegs;
@@ -5394,6 +5400,9 @@
   case AttributeList::AT_X86ForceAlignArgPointer:
 handleX86ForceAlignArgPointerAttr(S, D, Attr);
 break;
+  case AttributeList::AT_OverAllocated:
+handleOverAllocatedAttr(S, D, Attr);
+break;
   case AttributeList::AT_DLLExport:
   case AttributeList::AT_DLLImport:
 handleDLLAttr(S, D, Attr);
Index: lib/AST/ExprConstant.cpp
===
--- lib/AST/ExprConstant.cpp
+++ lib/AST/ExprConstant.cpp
@@ -1049,7 +1049,12 @@
 APValue::LValueBase Base;
 CharUnits Offset;
 bool InvalidBase : 1;
-unsigned CallIndex : 31;
+
+// Indicates the enclosing struct is marked overallocated. This is used in
+// computation of __builtin_object_size.
+bool OverAllocated = 1;
+
+unsigned CallIndex : 30;
 SubobjectDesignator Designator;
 
 const APValue::LValueBase getLValueBase() const { return Base; }
@@ -1059,6 +1064,8 @@
 SubobjectDesignator () { return Designator; }
 const SubobjectDesignator () const { return Designator;}
 
+LValue() : OverAllocated(false) {}
+
 void moveInto(APValue ) const {
   if (Designator.Invalid)
 V = APValue(Base, Offset, APValue::NoLValuePath(), CallIndex);
@@ -4572,6 +4579,15 @@
   EvalOK = this->Visit(E->getBase());
   BaseTy = E->getBase()->getType();
 }
+
+// Check to see if the parent record is marked overallocated.
+const TagDecl *TD = BaseTy->getAsTagDecl();
+
+if (isa(TD))
+  TD = E->getBase()->getBestDynamicClassType();
+
+Result.OverAllocated = TD->hasAttr();
+
 if 

Re: [gentoo-musl] Re: Add support for musl-libc on Linux

2016-06-17 Thread Rafael EspĂ­ndola via cfe-commits
There are probably a few more places that need to be patched.

In particular, take a look at lib/Target/ARM. There are things like
computeTargetABI and isTargetHardFloat that probably need to be
updated (and tested).

CCing Peter for an arm opinion.

Cheers,
Rafael


On 17 June 2016 at 05:50, Lei Zhang  wrote:
> 2016-06-15 16:28 GMT+08:00 Lei Zhang :
>> Here's another patch including test cases for various non-x86 archs,
>> which should just work with my previous patches. ARM is left out
>> purposely since it involves extra complexity. I'll work on it later.
>
> Hi,
>
> Here are another two patches which add support for ARM, with some test
> cases included.
>
> They're a lot bigger than previous patches, and I'm not 100% sure if I
> missed anything. Any comments are utterly welcome :)
>
>
> Lei
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r273072 - Add checkpoints to string allocation test to help with debugging arm failures.

2016-06-17 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Jun 17 19:23:13 2016
New Revision: 273072

URL: http://llvm.org/viewvc/llvm-project?rev=273072=rev
Log:
Add checkpoints to string allocation test to help with debugging arm failures.

Modified:

libcxx/trunk/test/std/experimental/filesystem/class.path/path.member/path.native.obs/string_alloc.pass.cpp

Modified: 
libcxx/trunk/test/std/experimental/filesystem/class.path/path.member/path.native.obs/string_alloc.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/filesystem/class.path/path.member/path.native.obs/string_alloc.pass.cpp?rev=273072=273071=273072=diff
==
--- 
libcxx/trunk/test/std/experimental/filesystem/class.path/path.member/path.native.obs/string_alloc.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/experimental/filesystem/class.path/path.member/path.native.obs/string_alloc.pass.cpp
 Fri Jun 17 19:23:13 2016
@@ -27,6 +27,7 @@
 #include "count_new.hpp"
 #include "min_allocator.h"
 #include "filesystem_test_helper.hpp"
+#include "assert_checkpoint.h"
 
 namespace fs = std::experimental::filesystem;
 
@@ -43,8 +44,10 @@ void doShortStringTest(MultiStringType c
   const path p((const char*)MS);
   {
   DisableAllocationGuard g; // should not allocate
+  CHECKPOINT("short string default constructed allocator");
   Str s = p.string();
   assert(s == value);
+  CHECKPOINT("short string provided allocator");
   Str s2 = p.string(Alloc{});
   assert(s2 == value);
   }
@@ -59,7 +62,7 @@ void doLongStringTest(MultiStringType co
   const path p((const char*)MS);
   { // Default allocator
   using Alloc = std::allocator;
-  RequireAllocationGuard g; // should not allocate because
+  RequireAllocationGuard g;
   Str s = p.string();
   assert(s == value);
   Str s2 = p.string(Alloc{});
@@ -67,6 +70,7 @@ void doLongStringTest(MultiStringType co
   }
   using MAlloc = malloc_allocator;
   MAlloc::reset();
+  CHECKPOINT("Malloc allocator test - default construct");
   { // Other allocator - default construct
   using Traits = std::char_traits;
   using AStr = std::basic_string;
@@ -77,6 +81,7 @@ void doLongStringTest(MultiStringType co
   assert(MAlloc::outstanding_alloc() == 1);
   }
   MAlloc::reset();
+  CHECKPOINT("Malloc allocator test - provided copy");
   { // Other allocator - provided copy
   using Traits = std::char_traits;
   using AStr = std::basic_string;


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


[libcxx] r273070 - Fix bugs in recursive_directory_iterator::increment(ec) implementation and tests.

2016-06-17 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Jun 17 18:57:16 2016
New Revision: 273070

URL: http://llvm.org/viewvc/llvm-project?rev=273070=rev
Log:
Fix bugs in recursive_directory_iterator::increment(ec) implementation and 
tests.

r273060 didn't completely fix the issues in recursive_directory_iterator and
the tests. This patch follows up with more fixes

* Fix bug where recursive_directory_iterator::increment(ec) did not reset
  the error code if no failure occurred.

* Fix bad assertion in the recursive_directory_iterator::increment(ec) test
  that would only fire for certain iteration orders.

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

libcxx/trunk/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp

Modified: libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp?rev=273070=273069=273070=diff
==
--- libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp (original)
+++ libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp Fri Jun 17 
18:57:16 2016
@@ -179,13 +179,12 @@ recursive_directory_iterator::recursive_
 void recursive_directory_iterator::__pop(error_code* ec)
 {
 _LIBCPP_ASSERT(__imp_, "Popping the end iterator");
+if (ec) ec->clear();
 __imp_->__stack_.pop();
-if (__imp_->__stack_.size() == 0) {
+if (__imp_->__stack_.size() == 0)
 __imp_.reset();
-if (ec) ec->clear();
-} else {
+else
 __advance(ec);
-}
 }
 
 directory_options recursive_directory_iterator::options() const {
@@ -203,6 +202,7 @@ const directory_entry& recursive_directo
 recursive_directory_iterator&
 recursive_directory_iterator::__increment(error_code *ec)
 {
+if (ec) ec->clear();
 if (recursion_pending()) {
 if (__try_recursion(ec) || (ec && *ec))
 return *this;
@@ -213,22 +213,19 @@ recursive_directory_iterator::__incremen
 }
 
 void recursive_directory_iterator::__advance(error_code* ec) {
+// REQUIRES: ec must be cleared before calling this function.
 const directory_iterator end_it;
 auto& stack = __imp_->__stack_;
 std::error_code m_ec;
 while (stack.size() > 0) {
-if (stack.top().advance(m_ec)) {
-if (ec) ec->clear();
+if (stack.top().advance(m_ec))
 return;
-}
 if (m_ec) break;
 stack.pop();
 }
 __imp_.reset();
 if (m_ec)
 set_or_throw(m_ec, ec, "recursive_directory_iterator::operator++()");
-else if (ec)
-ec->clear();
 }
 
 bool recursive_directory_iterator::__try_recursion(error_code *ec) {

Modified: 
libcxx/trunk/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp?rev=273070=273069=273070=diff
==
--- 
libcxx/trunk/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp
 Fri Jun 17 18:57:16 2016
@@ -194,16 +194,24 @@ TEST_CASE(access_denied_on_recursion_tes
 recursive_directory_iterator it(startDir, SkipEPerm, ec);
 TEST_REQUIRE(!ec);
 TEST_REQUIRE(it != endIt);
-const path elem = *it;
-if (elem == permDeniedDir) {
-it.increment(ec);
-TEST_REQUIRE(!ec);
-TEST_REQUIRE(it != endIt);
-TEST_CHECK(*it == otherFile);
-} else if (elem == otherFile) {
-it.increment(ec);
-TEST_REQUIRE(!ec);
+
+bool seenOtherFile = false;
+if (*it == otherFile) {
+++it;
+seenOtherFile = true;
+TEST_REQUIRE (it != endIt);
+}
+TEST_REQUIRE(*it == permDeniedDir);
+
+ec = GetTestEC();
+it.increment(ec);
+TEST_REQUIRE(!ec);
+
+if (seenOtherFile) {
 TEST_CHECK(it == endIt);
+} else {
+TEST_CHECK(it != endIt);
+TEST_CHECK(*it == otherFile);
 }
 }
 // Test that construction resulting in a "EACCESS" error is not ignored


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


Re: [PATCH] D20964: [clang-tidy] Add modernize-use-emplace

2016-06-17 Thread Piotr Padlewski via cfe-commits
Prazek added a reviewer: sbenza.
Prazek added a comment.

You might be interested.


http://reviews.llvm.org/D20964



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


Re: [PATCH] D20964: [clang-tidy] Add modernize-use-emplace

2016-06-17 Thread Piotr Padlewski via cfe-commits
Prazek marked 8 inline comments as done.
Prazek added a comment.

http://reviews.llvm.org/D20964



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


Re: [PATCH] D20964: [clang-tidy] Add modernize-use-emplace

2016-06-17 Thread Piotr Padlewski via cfe-commits
Prazek updated the summary for this revision.
Prazek updated this revision to Diff 61143.

http://reviews.llvm.org/D20964

Files:
  clang-tidy/modernize/CMakeLists.txt
  clang-tidy/modernize/ModernizeTidyModule.cpp
  clang-tidy/modernize/UseEmplaceCheck.cpp
  clang-tidy/modernize/UseEmplaceCheck.h
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/modernize-use-emplace.rst
  test/clang-tidy/modernize-use-emplace.cpp

Index: test/clang-tidy/modernize-use-emplace.cpp
===
--- /dev/null
+++ test/clang-tidy/modernize-use-emplace.cpp
@@ -0,0 +1,287 @@
+// RUN: %check_clang_tidy %s modernize-use-emplace %t
+
+namespace std {
+template 
+class vector {
+public:
+  void push_back(const T &) {}
+  void push_back(T &&) {}
+
+  template 
+  void emplace_back(Args &&... args){};
+};
+template 
+class list {
+public:
+  void push_back(const T &) {}
+  void push_back(T &&) {}
+
+  template 
+  void emplace_back(Args &&... args){};
+};
+
+template 
+class deque {
+public:
+  void push_back(const T &) {}
+  void push_back(T &&) {}
+
+  template 
+  void emplace_back(Args &&... args){};
+};
+
+template 
+class pair {
+public:
+  pair() = default;
+  pair(const pair &) = default;
+  pair(pair &&) = default;
+
+  pair(const T1 &, const T2 &) {}
+  pair(T1 &&, T2 &&) {}
+
+  template 
+  pair(const pair ){};
+  template 
+  pair(pair &){};
+};
+
+template 
+pair make_pair(T1, T2) {
+  return pair();
+};
+
+template 
+class unique_ptr {
+public:
+  unique_ptr(T *) {}
+};
+} // namespace std
+
+void testInts() {
+  std::vector v;
+  v.push_back(42);
+  v.push_back(int(42));
+  v.push_back(int{42});
+  int z;
+  v.push_back(z);
+}
+
+struct S {
+  S(int a, int b = 41) {}
+  S() {}
+  void push_back(S);
+};
+
+struct Convertable {
+  operator S() { return S{}; }
+};
+
+struct Zoz {
+  Zoz(S s) {}
+};
+
+Zoz getZoz(S s) { return Zoz(s); }
+
+void test_S() {
+  std::vector v;
+
+  v.push_back(S(1, 2));
+  // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use emplace_back instead of push_back [modernize-use-emplace]
+  // CHECK-FIXES: v.emplace_back(1, 2);
+
+  v.push_back(S{1, 2});
+  // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use emplace_back
+  // CHECK-FIXES: v.emplace_back(1, 2);
+
+  v.push_back(S());
+  // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use emplace_back
+  // CHECK-FIXES: v.emplace_back();
+
+  v.push_back(S{});
+  // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use emplace_back
+  // CHECK-FIXES: v.emplace_back();
+
+  v.push_back(42);
+  // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use emplace_back
+  // CHECK-FIXES: v.emplace_back(42);
+
+  S temporary(42, 42);
+  temporary.push_back(temporary);
+  v.push_back(temporary);
+
+  v.push_back(Convertable());
+  v.push_back(Convertable{});
+  Convertable s;
+  v.push_back(s);
+}
+
+void test2() {
+  std::vector v;
+  v.push_back(Zoz(S(21, 37)));
+  // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use emplace_back
+  // CHECK-FIXES: v.emplace_back(S(21, 37));
+
+  v.push_back(getZoz(S(1, 2)));
+}
+
+void testPair() {
+  std::vector> v;
+  v.push_back(std::pair(1, 2));
+  // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use emplace_back
+  // CHECK-FIXES: v.emplace_back(1, 2);
+
+  std::vector> v2;
+  v2.push_back(std::pair(S(42, 42), Zoz(S(21, 37;
+  // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: use emplace_back
+  // CHECK-FIXES: v2.emplace_back(S(42, 42), Zoz(S(21, 37)));
+}
+
+void testSpaces() {
+  std::vector v;
+
+  // clang-format off
+
+  v.push_back(S(1, //arg1
+2 // arg2
+   ) // S
+  );
+  // CHECK-MESSAGES: :[[@LINE-4]]:5: warning: use emplace_back
+  // CHECK-FIXES: v.emplace_back(1, //arg1
+  // CHECK-FIXES:2 // arg2
+  // CHECK-FIXES:  // S
+  // CHECK-FIXES:);
+
+  v.push_back(S   (1, 2));
+  // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use emplace_back
+  // CHECK-FIXES: v.emplace_back(1, 2   );
+  v.push_back(S   {1, 2});
+  // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use emplace_back
+  // CHECK-FIXES: v.emplace_back(1, 2   );
+
+  v.push_back(  S {});
+  // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use emplace_back
+  // CHECK-FIXES: v.emplace_back(   );
+
+  // clang-format on
+}
+
+void testPointers() {
+  std::vector v;
+  v.push_back(new int(5));
+
+  std::vector v2;
+  v2.push_back(new int(42));
+  // This call can't be replaced with emplace_back.
+  // If emplacement will fail (not enough memory to add to vector)
+  // we will have leak of int because unique_ptr won't be constructed
+  // (and destructed) as in push_back case.
+
+  auto *ptr = new int;
+  v2.push_back(ptr);
+  // Same here
+}
+
+void testMakePair() {
+  std::vector> v;
+  // FIXME: add functionality to change calls of std::make_pair
+  v.push_back(std::make_pair(1, 2));
+
+ 

Re: [PATCH] D21459: Implement http://wg21.link/P0254R1: "Integrating std::string_view and std::string"

2016-06-17 Thread Marshall Clow via cfe-commits
mclow.lists added inline comments.


Comment at: 
test/std/strings/string.view/string.view.template/nothing_to_do.pass.cpp:10
@@ +9,3 @@
+
+#include 
+

This should be ``


http://reviews.llvm.org/D21459



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


[libcxx] r273068 - Work around GCC bug in tests. The bug has been fixed in GCC 6.0

2016-06-17 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Jun 17 18:30:40 2016
New Revision: 273068

URL: http://llvm.org/viewvc/llvm-project?rev=273068=rev
Log:
Work around GCC bug in tests. The bug has been fixed in GCC 6.0

Modified:

libcxx/trunk/test/std/experimental/filesystem/fs.enum/check_bitmask_types.hpp

Modified: 
libcxx/trunk/test/std/experimental/filesystem/fs.enum/check_bitmask_types.hpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/filesystem/fs.enum/check_bitmask_types.hpp?rev=273068=273067=273068=diff
==
--- 
libcxx/trunk/test/std/experimental/filesystem/fs.enum/check_bitmask_types.hpp 
(original)
+++ 
libcxx/trunk/test/std/experimental/filesystem/fs.enum/check_bitmask_types.hpp 
Fri Jun 17 18:30:40 2016
@@ -17,7 +17,7 @@ template (e); }
-  static constexpr UT unpromote(decltype(~UZero) promoted) { return 
static_cast(promoted); }
+  static constexpr UT unpromote(decltype((~UZero)) promoted) { return 
static_cast(promoted); }
   // We need two values that are non-zero and share at least one bit.
   static_assert(Val1 != Zero && Val2 != Zero, "");
   static_assert(Val1 != Val2, "");
@@ -31,7 +31,7 @@ struct check_bitmask_type {
   ASSERT_SAME_TYPE(EnumType, decltype(Val1 & Val2));
   ASSERT_SAME_TYPE(EnumType, decltype(Val1 | Val2));
   ASSERT_SAME_TYPE(EnumType, decltype(Val1 ^ Val2));
-  ASSERT_SAME_TYPE(EnumType, decltype(~Val1));
+  ASSERT_SAME_TYPE(EnumType, decltype((~Val1)));
   ASSERT_SAME_TYPE(EnumType&, decltype(ValRef &= Val2));
   ASSERT_SAME_TYPE(EnumType&, decltype(ValRef |= Val2));
   ASSERT_SAME_TYPE(EnumType&, decltype(ValRef ^= Val2));


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


[libcxx] r273065 - Fix initialization of test case array in C++11

2016-06-17 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Jun 17 17:36:47 2016
New Revision: 273065

URL: http://llvm.org/viewvc/llvm-project?rev=273065=rev
Log:
Fix initialization of test case array in C++11

Modified:

libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.canonical/canonical.pass.cpp

Modified: 
libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.canonical/canonical.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.canonical/canonical.pass.cpp?rev=273065=273064=273065=diff
==
--- 
libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.canonical/canonical.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.canonical/canonical.pass.cpp
 Fri Jun 17 17:36:47 2016
@@ -49,7 +49,9 @@ TEST_CASE(test_canonical)
 struct TestCase {
 path p;
 path expect;
-path base = StaticEnv::Root;
+path base;
+TestCase(path p1, path e, path b = StaticEnv::Root)
+: p(p1), expect(e), base(b) {}
 };
 const TestCase testCases[] = {
 { ".", Root, Root},


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


r273063 - [MS] Put member pointer representation flags in our debug info

2016-06-17 Thread Reid Kleckner via cfe-commits
Author: rnk
Date: Fri Jun 17 17:27:59 2016
New Revision: 273063

URL: http://llvm.org/viewvc/llvm-project?rev=273063=rev
Log:
[MS] Put member pointer representation flags in our debug info

Added:
cfe/trunk/test/CodeGenCXX/debug-info-ms-ptr-to-member.cpp
Modified:
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=273063=273062=273063=diff
==
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Fri Jun 17 17:27:59 2016
@@ -1172,6 +1172,7 @@ llvm::DISubprogram *CGDebugInfo::CreateC
   llvm::DIType *ContainingType = nullptr;
   unsigned Virtuality = 0;
   unsigned VIndex = 0;
+  unsigned Flags = 0;
 
   if (Method->isVirtual()) {
 if (Method->isPure())
@@ -1199,7 +1200,6 @@ llvm::DISubprogram *CGDebugInfo::CreateC
 ContainingType = RecordTy;
   }
 
-  unsigned Flags = 0;
   if (Method->isImplicit())
 Flags |= llvm::DINode::FlagArtificial;
   Flags |= getAccessFlag(Method->getAccess(), Method->getParent());
@@ -2049,12 +2049,35 @@ llvm::DIType *CGDebugInfo::CreateType(co
 
 llvm::DIType *CGDebugInfo::CreateType(const MemberPointerType *Ty,
   llvm::DIFile *U) {
-  uint64_t Size =
-  !Ty->isIncompleteType() ? CGM.getContext().getTypeSize(Ty) : 0;
+  unsigned Flags = 0;
+  uint64_t Size = 0;
+
+  if (!Ty->isIncompleteType()) {
+Size = CGM.getContext().getTypeSize(Ty);
+
+// Set the MS inheritance model. There is no flag for the unspecified 
model.
+if (CGM.getTarget().getCXXABI().isMicrosoft()) {
+  switch (Ty->getMostRecentCXXRecordDecl()->getMSInheritanceModel()) {
+  case MSInheritanceAttr::Keyword_single_inheritance:
+Flags |= llvm::DINode::FlagSingleInheritance;
+break;
+  case MSInheritanceAttr::Keyword_multiple_inheritance:
+Flags |= llvm::DINode::FlagMultipleInheritance;
+break;
+  case MSInheritanceAttr::Keyword_virtual_inheritance:
+Flags |= llvm::DINode::FlagVirtualInheritance;
+break;
+  case MSInheritanceAttr::Keyword_unspecified_inheritance:
+break;
+  }
+}
+  }
+
   llvm::DIType *ClassType = getOrCreateType(QualType(Ty->getClass(), 0), U);
   if (Ty->isMemberDataPointerType())
 return DBuilder.createMemberPointerType(
-getOrCreateType(Ty->getPointeeType(), U), ClassType, Size);
+getOrCreateType(Ty->getPointeeType(), U), ClassType, Size, /*Align=*/0,
+Flags);
 
   const FunctionProtoType *FPT =
   Ty->getPointeeType()->getAs();
@@ -2062,7 +2085,7 @@ llvm::DIType *CGDebugInfo::CreateType(co
   getOrCreateInstanceMethodType(CGM.getContext().getPointerType(QualType(
 Ty->getClass(), FPT->getTypeQuals())),
 FPT, U),
-  ClassType, Size);
+  ClassType, Size, /*Align=*/0, Flags);
 }
 
 llvm::DIType *CGDebugInfo::CreateType(const AtomicType *Ty, llvm::DIFile *U) {

Added: cfe/trunk/test/CodeGenCXX/debug-info-ms-ptr-to-member.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-ms-ptr-to-member.cpp?rev=273063=auto
==
--- cfe/trunk/test/CodeGenCXX/debug-info-ms-ptr-to-member.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/debug-info-ms-ptr-to-member.cpp Fri Jun 17 
17:27:59 2016
@@ -0,0 +1,52 @@
+// RUN: %clang_cc1 -triple x86_64-windows -debug-info-kind=limited -gcodeview 
%s -emit-llvm -o - | FileCheck %s
+
+// Test member pointer inheritance models.
+
+struct A { int a; };
+struct B { int b; };
+struct C : A, B { int c; };
+struct D : virtual C { int d; };
+struct E;
+int A::*pmd_a;
+int C::*pmd_b;
+int D::*pmd_c;
+int E::*pmd_d;
+void (A::*pmf_a)();
+void (C::*pmf_b)();
+void (D::*pmf_c)();
+void (E::*pmf_d)();
+
+// Test incomplete MPTs, which don't have inheritance models.
+
+struct Incomplete;
+int Incomplete::**ppmd;
+void (Incomplete::**ppmf)();
+
+// CHECK: distinct !DIGlobalVariable(name: "pmd_a", {{.*}} type: ![[pmd_a:[^, 
]*]], {{.*}})
+// CHECK: ![[pmd_a]] = !DIDerivedType(tag: DW_TAG_ptr_to_member_type, 
baseType: !{{.*}}, size: 32, flags: DIFlagSingleInheritance, {{.*}})
+// CHECK: distinct !DIGlobalVariable(name: "pmd_b", {{.*}} type: ![[pmd_b:[^, 
]*]], {{.*}})
+// CHECK: ![[pmd_b]] = !DIDerivedType(tag: DW_TAG_ptr_to_member_type, 
baseType: !{{.*}}, size: 32, flags: DIFlagMultipleInheritance, {{.*}})
+// CHECK: distinct !DIGlobalVariable(name: "pmd_c", {{.*}} type: ![[pmd_c:[^, 
]*]], {{.*}})
+// CHECK: ![[pmd_c]] = !DIDerivedType(tag: DW_TAG_ptr_to_member_type, 
baseType: !{{.*}}, size: 64, flags: DIFlagVirtualInheritance, {{.*}})
+// CHECK: distinct !DIGlobalVariable(name: "pmd_d", {{.*}} type: ![[pmd_d:[^, 
]*]], {{.*}})
+// CHECK: ![[pmd_d]] = !DIDerivedType(tag: 

[libcxx] r273060 - Fix bugs in recursive_directory_iterator implementation and tests.

2016-06-17 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Jun 17 17:22:37 2016
New Revision: 273060

URL: http://llvm.org/viewvc/llvm-project?rev=273060=rev
Log:
Fix bugs in recursive_directory_iterator implementation and tests.

There are two fixes in this patch:

* Fix bug where the constructor of recursive_directory_iterator did not reset
  the error code if no failure occurred.

* Fix tests were dependent on the iteration order of the test directories.

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

libcxx/trunk/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp

libcxx/trunk/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/recursion_pending.pass.cpp

Modified: libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp?rev=273060=273059=273060=diff
==
--- libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp (original)
+++ libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp Fri Jun 17 
17:22:37 2016
@@ -165,6 +165,7 @@ recursive_directory_iterator::recursive_
 directory_options opt, error_code *ec)
 : __imp_(nullptr), __rec_(true)
 {
+if (ec) ec->clear();
 std::error_code m_ec;
 __dir_stream new_s(p, opt, m_ec);
 if (m_ec) set_or_throw(m_ec, ec, "recursive_directory_iterator", p);
@@ -226,6 +227,8 @@ void recursive_directory_iterator::__adv
 __imp_.reset();
 if (m_ec)
 set_or_throw(m_ec, ec, "recursive_directory_iterator::operator++()");
+else if (ec)
+ec->clear();
 }
 
 bool recursive_directory_iterator::__try_recursion(error_code *ec) {

Modified: 
libcxx/trunk/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp?rev=273060=273059=273060=diff
==
--- 
libcxx/trunk/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp
 Fri Jun 17 17:22:37 2016
@@ -152,6 +152,7 @@ TEST_CASE(access_denied_on_recursion_tes
 const path startDir = testFiles[0];
 const path permDeniedDir = testFiles[1];
 const path otherFile = testFiles[3];
+auto SkipEPerm = directory_options::skip_permission_denied;
 
 // Change the permissions so we can no longer iterate
 permissions(permDeniedDir, perms::none);
@@ -161,44 +162,49 @@ TEST_CASE(access_denied_on_recursion_tes
 // Test that recursion resulting in a "EACCESS" error is not ignored
 // by default.
 {
-std::error_code ec;
+std::error_code ec = GetTestEC();
 recursive_directory_iterator it(startDir, ec);
+TEST_REQUIRE(ec != GetTestEC());
 TEST_REQUIRE(!ec);
+while (it != endIt && it->path() != permDeniedDir)
+++it;
 TEST_REQUIRE(it != endIt);
-const path elem = *it;
-TEST_REQUIRE(elem == permDeniedDir);
+TEST_REQUIRE(*it == permDeniedDir);
 
 it.increment(ec);
-TEST_REQUIRE(ec);
-TEST_REQUIRE(it == endIt);
+TEST_CHECK(ec);
+TEST_CHECK(it == endIt);
 }
 // Same as obove but test operator++().
 {
-std::error_code ec;
+std::error_code ec = GetTestEC();
 recursive_directory_iterator it(startDir, ec);
 TEST_REQUIRE(!ec);
+while (it != endIt && it->path() != permDeniedDir)
+++it;
 TEST_REQUIRE(it != endIt);
-const path elem = *it;
-TEST_REQUIRE(elem == permDeniedDir);
+TEST_REQUIRE(*it == permDeniedDir);
 
 TEST_REQUIRE_THROW(filesystem_error, ++it);
 }
 // Test that recursion resulting in a "EACCESS" error is ignored when the
 // correct options are given to the constructor.
 {
-std::error_code ec;
-recursive_directory_iterator it(
-startDir,directory_options::skip_permission_denied,
-ec);
+std::error_code ec = GetTestEC();
+recursive_directory_iterator it(startDir, SkipEPerm, ec);
 TEST_REQUIRE(!ec);
 TEST_REQUIRE(it != endIt);
 const path elem = *it;
-TEST_REQUIRE(elem == permDeniedDir);
-
-it.increment(ec);
-TEST_REQUIRE(!ec);
-TEST_REQUIRE(it != endIt);
-TEST_CHECK(*it == otherFile);
+if (elem == permDeniedDir) {
+it.increment(ec);
+TEST_REQUIRE(!ec);
+TEST_REQUIRE(it != endIt);
+TEST_CHECK(*it == otherFile);
+} else if (elem == otherFile) {
+

r273056 - [Coverage] Adopt llvm::coverage::encodeFilenamesAndRawMappings (NFC)

2016-06-17 Thread Vedant Kumar via cfe-commits
Author: vedantk
Date: Fri Jun 17 16:53:55 2016
New Revision: 273056

URL: http://llvm.org/viewvc/llvm-project?rev=273056=rev
Log:
[Coverage] Adopt llvm::coverage::encodeFilenamesAndRawMappings (NFC)

Use an llvm helper function to encode filenames and raw mappings.

Modified:
cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp

Modified: cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp?rev=273056=273055=273056=diff
==
--- cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp (original)
+++ cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp Fri Jun 17 16:53:55 2016
@@ -1008,35 +1008,27 @@ void CoverageMappingModuleGen::emit() {
 
   // Create the filenames and merge them with coverage mappings
   llvm::SmallVector FilenameStrs;
-  llvm::SmallVector FilenameRefs;
   FilenameStrs.resize(FileEntries.size());
-  FilenameRefs.resize(FileEntries.size());
   for (const auto  : FileEntries) {
 llvm::SmallString<256> Path(Entry.first->getName());
 llvm::sys::fs::make_absolute(Path);
 
 auto I = Entry.second;
 FilenameStrs[I] = std::string(Path.begin(), Path.end());
-FilenameRefs[I] = FilenameStrs[I];
   }
 
-  std::string FilenamesAndCoverageMappings;
-  llvm::raw_string_ostream OS(FilenamesAndCoverageMappings);
-  CoverageFilenamesSectionWriter(FilenameRefs).write(OS);
-  std::string RawCoverageMappings =
-  llvm::join(CoverageMappings.begin(), CoverageMappings.end(), "");
-  OS << RawCoverageMappings;
-  size_t CoverageMappingSize = RawCoverageMappings.size();
-  size_t FilenamesSize = OS.str().size() - CoverageMappingSize;
-  // Append extra zeroes if necessary to ensure that the size of the filenames
-  // and coverage mappings is a multiple of 8.
-  if (size_t Rem = OS.str().size() % 8) {
-CoverageMappingSize += 8 - Rem;
-for (size_t I = 0, S = 8 - Rem; I < S; ++I)
-  OS << '\0';
+  size_t FilenamesSize;
+  size_t CoverageMappingSize;
+  llvm::Expected CoverageDataOrErr = 
encodeFilenamesAndRawMappings(
+  FilenameStrs, CoverageMappings, FilenamesSize, CoverageMappingSize);
+  if (llvm::Error E = CoverageDataOrErr.takeError()) {
+llvm::handleAllErrors(std::move(E), [](llvm::ErrorInfoBase ) {
+  llvm::report_fatal_error(EI.message());
+});
   }
+  std::string CoverageData = std::move(CoverageDataOrErr.get());
   auto *FilenamesAndMappingsVal =
-  llvm::ConstantDataArray::getString(Ctx, OS.str(), false);
+  llvm::ConstantDataArray::getString(Ctx, CoverageData, false);
 
   // Create the deferred function records array
   auto RecordsTy =


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


[libcxx] r273054 - Get filesystem tests passing for single-threaded configurations.

2016-06-17 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Jun 17 16:44:26 2016
New Revision: 273054

URL: http://llvm.org/viewvc/llvm-project?rev=273054=rev
Log:
Get filesystem tests passing for single-threaded configurations.

Modified:

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

libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_symlink/copy_symlink.pass.cpp

libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp

libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory/create_directory.pass.cpp

libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory/create_directory_with_attributes.pass.cpp

libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp
libcxx/trunk/test/support/filesystem_test_helper.hpp

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=273054=273053=273054=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
 Fri Jun 17 16:44:26 2016
@@ -20,7 +20,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #include "test_macros.h"
@@ -109,10 +108,10 @@ TEST_CASE(copy_file)
 using Sec = std::chrono::seconds;
 const path older = env.create_file("older_file", 1);
 
-std::this_thread::sleep_for(Sec(2));
+SleepFor(Sec(2));
 const path from = env.create_file("update_from", 55);
 
-std::this_thread::sleep_for(Sec(2));
+SleepFor(Sec(2));
 const path newer = env.create_file("newer_file", 2);
 
 std::error_code ec;

Modified: 
libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_symlink/copy_symlink.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_symlink/copy_symlink.pass.cpp?rev=273054=273053=273054=diff
==
--- 
libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_symlink/copy_symlink.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_symlink/copy_symlink.pass.cpp
 Fri Jun 17 16:44:26 2016
@@ -17,8 +17,6 @@
 
 #include 
 #include 
-#include 
-#include 
 #include 
 
 #include "test_macros.h"

Modified: 
libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp?rev=273054=273053=273054=diff
==
--- 
libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp
 Fri Jun 17 16:44:26 2016
@@ -16,8 +16,6 @@
 
 #include 
 #include 
-#include 
-#include 
 #include 
 
 #include "test_macros.h"

Modified: 
libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory/create_directory.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory/create_directory.pass.cpp?rev=273054=273053=273054=diff
==
--- 
libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory/create_directory.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory/create_directory.pass.cpp
 Fri Jun 17 16:44:26 2016
@@ -18,8 +18,6 @@
 
 #include 
 #include 
-#include 
-#include 
 #include 
 
 #include "test_macros.h"

Modified: 
libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory/create_directory_with_attributes.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory/create_directory_with_attributes.pass.cpp?rev=273054=273053=273054=diff
==
--- 
libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory/create_directory_with_attributes.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory/create_directory_with_attributes.pass.cpp
 Fri Jun 17 16:44:26 2016
@@ -16,8 +16,6 @@

Re: [PATCH] D21122: CodeGen: Start emitting checked loads when both trapping CFI and -fwhole-program-vtables are enabled.

2016-06-17 Thread Evgeniy Stepanov via cfe-commits
eugenis accepted this revision.
eugenis added a comment.
This revision is now accepted and ready to land.

LGTM


http://reviews.llvm.org/D21122



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


[libcxx] r273051 - Update status of filesystem issues, and add tests for LWG issue 2683

2016-06-17 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Jun 17 16:24:11 2016
New Revision: 273051

URL: http://llvm.org/viewvc/llvm-project?rev=273051=rev
Log:
Update status of filesystem issues, and add tests for LWG issue 2683

Modified:

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

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=273051=273050=273051=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
 Fri Jun 17 16:24:11 2016
@@ -112,26 +112,26 @@ TEST_CASE(from_is_symlink)
 const path dne = env.make_env_path("dne");
 
 { // skip symlinks
-std::error_code ec;
+std::error_code ec = GetTestEC();
 fs::copy(symlink, dne, copy_options::skip_symlinks, ec);
 TEST_CHECK(!ec);
 TEST_CHECK(!exists(dne));
 }
 {
 const path dest = env.make_env_path("dest");
-std::error_code ec;
+std::error_code ec = GetTestEC();
 fs::copy(symlink, dest, copy_options::copy_symlinks, ec);
 TEST_CHECK(!ec);
 TEST_CHECK(exists(dest));
 TEST_CHECK(is_symlink(dest));
 }
 { // copy symlink but target exists
-std::error_code ec;
+std::error_code ec = GetTestEC();
 fs::copy(symlink, file, copy_options::copy_symlinks, ec);
 TEST_CHECK(ec);
 }
 { // create symlinks but target exists
-std::error_code ec;
+std::error_code ec = GetTestEC();
 fs::copy(symlink, file, copy_options::create_symlinks, ec);
 TEST_CHECK(ec);
 }
@@ -144,14 +144,14 @@ TEST_CASE(from_is_regular_file)
 const path dir = env.create_dir("dir");
 { // skip copy because of directory
 const path dest = env.make_env_path("dest1");
-std::error_code ec;
+std::error_code ec = GetTestEC();
 fs::copy(file, dest, CO::directories_only, ec);
 TEST_CHECK(!ec);
 TEST_CHECK(!exists(dest));
 }
 { // create symlink to file
 const path dest = env.make_env_path("sym");
-std::error_code ec;
+std::error_code ec = GetTestEC();
 fs::copy(file, dest, CO::create_symlinks, ec);
 TEST_CHECK(!ec);
 TEST_CHECK(is_symlink(dest));
@@ -160,7 +160,7 @@ TEST_CASE(from_is_regular_file)
 { // create hard link to file
 const path dest = env.make_env_path("hardlink");
 TEST_CHECK(hard_link_count(file) == 1);
-std::error_code ec;
+std::error_code ec = GetTestEC();
 fs::copy(file, dest, CO::create_hard_links, ec);
 TEST_CHECK(!ec);
 TEST_CHECK(exists(dest));
@@ -169,14 +169,14 @@ TEST_CASE(from_is_regular_file)
 { // is_directory(t)
 const path dest_dir = env.create_dir("dest_dir");
 const path expect_dest = dest_dir / file.filename();
-std::error_code ec;
+std::error_code ec = GetTestEC();
 fs::copy(file, dest_dir, ec);
 TEST_CHECK(!ec);
 TEST_CHECK(is_regular_file(expect_dest));
 }
 { // otherwise copy_file(from, to, ...)
 const path dest = env.make_env_path("file_copy");
-std::error_code ec;
+std::error_code ec = GetTestEC();
 fs::copy(file, dest, ec);
 TEST_CHECK(!ec);
 TEST_CHECK(is_regular_file(dest));
@@ -203,9 +203,9 @@ TEST_CASE(from_is_directory)
 env.create_file(dir / FI.filename, FI.size);
 env.create_file(nested_dir / FI.filename, FI.size);
 }
-{ // test for non-existant directory
+{ // test for non-existent directory
 const path dest = env.make_env_path("dest_dir1");
-std::error_code ec;
+std::error_code ec = GetTestEC();
 fs::copy(dir, dest, ec);
 TEST_REQUIRE(!ec);
 TEST_CHECK(is_directory(dest));
@@ -218,7 +218,7 @@ TEST_CASE(from_is_directory)
 }
 { // test for existing directory
 const path dest = env.create_dir("dest_dir2");
-std::error_code ec;
+std::error_code ec = GetTestEC();
 fs::copy(dir, dest, ec);
 TEST_REQUIRE(!ec);
 TEST_CHECK(is_directory(dest));
@@ -231,7 +231,7 @@ TEST_CASE(from_is_directory)
 }
 { // test recursive copy
 const path dest = env.make_env_path("dest_dir3");
-std::error_code ec;
+std::error_code ec = GetTestEC();
 fs::copy(dir, dest, CO::recursive, ec);
 TEST_REQUIRE(!ec);
 TEST_CHECK(is_directory(dest));

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

[libcxx] r273049 - Reorder permissions test so they are not dependent on the processes umask

2016-06-17 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Jun 17 16:00:27 2016
New Revision: 273049

URL: http://llvm.org/viewvc/llvm-project?rev=273049=rev
Log:
Reorder permissions test so they are not dependent on the processes umask

Modified:

libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.permissions/permissions.pass.cpp

Modified: 
libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.permissions/permissions.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.permissions/permissions.pass.cpp?rev=273049=273048=273049=diff
==
--- 
libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.permissions/permissions.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.permissions/permissions.pass.cpp
 Fri Jun 17 16:00:27 2016
@@ -89,20 +89,20 @@ TEST_CASE(basic_permissions_test)
   perms expected;
 } cases[] = {
 // test file
+{file, perms::none, perms::none},
 {file, perms::owner_all, perms::owner_all},
 {file, perms::group_all | AP, perms::owner_all | perms::group_all},
 {file, perms::group_all | RP, perms::owner_all},
-{file, perms::none, perms::none},
 // test directory
+{dir, perms::none, perms::none},
 {dir, perms::owner_all, perms::owner_all},
 {dir, perms::group_all | AP, perms::owner_all | perms::group_all},
 {dir, perms::group_all | RP, perms::owner_all},
-{dir, perms::none, perms::none},
 // test symlink with resolve symlinks on symlink
+{sym, perms::none | RS, perms::none},
 {sym, perms::owner_all | RS, perms::owner_all},
 {sym, perms::group_all | AP | RS, perms::owner_all | perms::group_all},
-{sym, perms::group_all | RP | RS, perms::owner_all},
-{sym, perms::none | RS, perms::none}
+{sym, perms::group_all | RP | RS, perms::owner_all}
 };
 for (auto const& TC : cases) {
 TEST_CHECK(status(TC.p).permissions() != TC.expected);


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


[libcxx] r273048 - Respect the processes umask in the create_directory test

2016-06-17 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Jun 17 15:54:25 2016
New Revision: 273048

URL: http://llvm.org/viewvc/llvm-project?rev=273048=rev
Log:
Respect the processes umask in the create_directory test

Modified:

libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory/create_directory.pass.cpp

Modified: 
libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory/create_directory.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory/create_directory.pass.cpp?rev=273048=273047=273048=diff
==
--- 
libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory/create_directory.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory/create_directory.pass.cpp
 Fri Jun 17 15:54:25 2016
@@ -26,9 +26,18 @@
 #include "rapid-cxx-test.hpp"
 #include "filesystem_test_helper.hpp"
 
+#include 
+#include 
+
 using namespace std::experimental::filesystem;
 namespace fs = std::experimental::filesystem;
 
+fs::perms read_umask() {
+mode_t old_mask = umask(0);
+umask(old_mask); // reset the mask to the old value.
+return static_cast(old_mask);
+}
+
 TEST_SUITE(filesystem_create_directory_test_suite)
 
 TEST_CASE(test_signatures)
@@ -68,15 +77,8 @@ TEST_CASE(create_directory_one_level)
 TEST_CHECK(is_directory(dir));
 
 auto st = status(dir);
-perms owner_perms = perms::owner_all;
-perms gperms = perms::group_all;
-perms other_perms = perms::others_read | perms::others_exec;
-#if defined(__APPLE__) || defined(__FreeBSD__)
-gperms = perms::group_read | perms::group_exec;
-#endif
-TEST_CHECK((st.permissions() & perms::owner_all) == owner_perms);
-TEST_CHECK((st.permissions() & perms::group_all) == gperms);
-TEST_CHECK((st.permissions() & perms::others_all) == other_perms);
+const perms expect_perms = perms::all & ~(read_umask());
+TEST_CHECK((st.permissions() & perms::all) == expect_perms);
 }
 
 TEST_CASE(create_directory_multi_level)


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


Re: [PATCH] D21317: [sanitizer] Allow sanitize coverage w/o sanitizers.

2016-06-17 Thread Evgeniy Stepanov via cfe-commits
eugenis closed this revision.
eugenis added a comment.

r272717


Repository:
  rL LLVM

http://reviews.llvm.org/D21317



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


[libclc] r273043 - nvptx: Drop feature defines.

2016-06-17 Thread Jan Vesely via cfe-commits
Author: jvesely
Date: Fri Jun 17 15:30:49 2016
New Revision: 273043

URL: http://llvm.org/viewvc/llvm-project?rev=273043=rev
Log:
nvptx: Drop feature defines.

This is now handled by clang

Signed-off-by: Jan Vesely 
Reviewed-by: Tom Stellard 

Modified:
libclc/trunk/configure.py

Modified: libclc/trunk/configure.py
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/configure.py?rev=273043=273042=273043=diff
==
--- libclc/trunk/configure.py (original)
+++ libclc/trunk/configure.py Fri Jun 17 15:30:49 2016
@@ -105,14 +105,12 @@ available_targets = {
   'amdgcn--amdhsa': { 'devices' :
   [{'gpu' : '', 'aliases' : ['bonaire', 'hawaii', 
'kabini', 'kaveri', 'mullins', 'carrizo', 'stoney', 'fiji', 'iceland', 'tonga'],
'defines' : {}} ]},
-  'nvptx--'   : { 'devices' : [{'gpu' : '', 'aliases' : [],
-'defines' : {'all' : ['cl_khr_fp64']}}]},
-  'nvptx64--' : { 'devices' : [{'gpu' : '', 'aliases' : [],
-'defines' : {'all' : ['cl_khr_fp64']}}]},
+  'nvptx--'   : { 'devices' : [{'gpu' : '', 'aliases' : [], 'defines' : {}} ]},
+  'nvptx64--' : { 'devices' : [{'gpu' : '', 'aliases' : [], 'defines' : {}} ]},
   'nvptx--nvidiacl'   : { 'devices' : [{'gpu' : '', 'aliases' : [],
-'defines' : {'all' : 
['cl_khr_fp64']}}]},
+'defines' : {}} ]},
   'nvptx64--nvidiacl' : { 'devices' : [{'gpu' : '', 'aliases' : [],
-'defines' : {'all' : 
['cl_khr_fp64']}}]},
+'defines' : {}} ]},
 }
 
 default_targets = ['nvptx--nvidiacl', 'nvptx64--nvidiacl', 'r600--', 
'amdgcn--', 'amdgcn--amdhsa']


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


[libclc] r273042 - 64 bit integers are legal in full profile without an extension

2016-06-17 Thread Jan Vesely via cfe-commits
Author: jvesely
Date: Fri Jun 17 15:30:41 2016
New Revision: 273042

URL: http://llvm.org/viewvc/llvm-project?rev=273042=rev
Log:
64 bit integers are legal in full profile without an extension

Signed-off-by: Jan Vesely 
Reviewed-by: Tom Stellard 

Modified:
libclc/trunk/configure.py
libclc/trunk/generic/lib/gen_convert.py

Modified: libclc/trunk/configure.py
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/configure.py?rev=273042=273041=273042=diff
==
--- libclc/trunk/configure.py (original)
+++ libclc/trunk/configure.py Fri Jun 17 15:30:41 2016
@@ -198,7 +198,6 @@ for target in targets:
  "-fno-builtin " \
  "-Dcl_clang_storage_class_specifiers " \
  "%s " \
- "-Dcles_khr_int64 " \
  "-D__CLC_INTERNAL " \
  "-emit-llvm" % (target, clang_cl_includes, device_defines)
 if device['gpu'] != '':

Modified: libclc/trunk/generic/lib/gen_convert.py
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/gen_convert.py?rev=273042=273041=273042=diff
==
--- libclc/trunk/generic/lib/gen_convert.py (original)
+++ libclc/trunk/generic/lib/gen_convert.py Fri Jun 17 15:30:41 2016
@@ -97,14 +97,12 @@ def conditional_guard(src, dst):
 int64_count = int64_count +1
   elif dst in float64_types:
 float64_count = float64_count + 1
-  if float64_count > 0 and int64_count > 0:
-print("#if defined(cl_khr_fp64) && defined(cles_khr_int64)")
-return True
-  elif float64_count > 0:
+  if float64_count > 0:
+#In embedded profile, if cl_khr_fp64 is supported cles_khr_int64 has to be
 print("#ifdef cl_khr_fp64")
 return True
   elif int64_count > 0:
-print("#ifdef cles_khr_int64")
+print("#if defined cles_khr_int64 || !defined(__EMBEDDED_PROFILE__)")
 return True
   return False
 
@@ -142,6 +140,15 @@ print("""/*  AUTOGENERATED FILE gene
 
 #ifdef cl_khr_fp64
 #pragma OPENCL EXTENSION cl_khr_fp64 : enable
+
+#if defined(__EMBEDDED_PROFILE__) && !defined(cles_khr_int64)
+#error Embedded profile that supports cl_khr_fp64 also has to support 
cles_khr_int64
+#endif
+
+#endif
+
+#ifdef cles_khr_int64
+#pragma OPENCL EXTENSION cles_khr_int64 : enable
 #endif
 
 """)


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


[libclc] r273044 - configure: Remove device specific defines

2016-06-17 Thread Jan Vesely via cfe-commits
Author: jvesely
Date: Fri Jun 17 15:30:50 2016
New Revision: 273044

URL: http://llvm.org/viewvc/llvm-project?rev=273044=rev
Log:
configure: Remove device specific defines

Signed-off-by: Jan Vesely 
Reviewed-by: Tom Stellard 

Modified:
libclc/trunk/configure.py

Modified: libclc/trunk/configure.py
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/configure.py?rev=273044=273043=273044=diff
==
--- libclc/trunk/configure.py (original)
+++ libclc/trunk/configure.py Fri Jun 17 15:30:50 2016
@@ -91,26 +91,18 @@ if not cxx_compiler:
 
 available_targets = {
   'r600--' : { 'devices' :
-   [{'gpu' : 'cedar',   'aliases' : ['palm', 'sumo', 'sumo2', 
'redwood', 'juniper'],
- 'defines' : {}},
-{'gpu' : 'cypress', 'aliases' : ['hemlock'],
- 'defines' : {}},
-{'gpu' : 'barts',   'aliases' : ['turks', 'caicos'],
- 'defines' : {}},
-{'gpu' : 'cayman',  'aliases' : ['aruba'],
- 'defines' : {}} ]},
+   [{'gpu' : 'cedar',   'aliases' : ['palm', 'sumo', 'sumo2', 
'redwood', 'juniper']},
+{'gpu' : 'cypress', 'aliases' : ['hemlock'] },
+{'gpu' : 'barts',   'aliases' : ['turks', 'caicos'] },
+{'gpu' : 'cayman',  'aliases' : ['aruba']} ]},
   'amdgcn--': { 'devices' :
-[{'gpu' : 'tahiti', 'aliases' : ['pitcairn', 'verde', 'oland', 
'hainan', 'bonaire', 'kabini', 'kaveri', 
'hawaii','mullins','tonga','carrizo','iceland','fiji','stoney'],
- 'defines' : {}} ]},
+[{'gpu' : 'tahiti', 'aliases' : ['pitcairn', 'verde', 'oland', 
'hainan', 'bonaire', 'kabini', 'kaveri', 
'hawaii','mullins','tonga','carrizo','iceland','fiji','stoney']} ]},
   'amdgcn--amdhsa': { 'devices' :
-  [{'gpu' : '', 'aliases' : ['bonaire', 'hawaii', 
'kabini', 'kaveri', 'mullins', 'carrizo', 'stoney', 'fiji', 'iceland', 'tonga'],
-   'defines' : {}} ]},
-  'nvptx--'   : { 'devices' : [{'gpu' : '', 'aliases' : [], 'defines' : {}} ]},
-  'nvptx64--' : { 'devices' : [{'gpu' : '', 'aliases' : [], 'defines' : {}} ]},
-  'nvptx--nvidiacl'   : { 'devices' : [{'gpu' : '', 'aliases' : [],
-'defines' : {}} ]},
-  'nvptx64--nvidiacl' : { 'devices' : [{'gpu' : '', 'aliases' : [],
-'defines' : {}} ]},
+  [{'gpu' : '', 'aliases' : ['bonaire', 'hawaii', 
'kabini', 'kaveri', 'mullins', 'carrizo', 'stoney', 'fiji', 'iceland', 
'tonga']} ]},
+  'nvptx--'   : { 'devices' : [{'gpu' : '', 'aliases' : []} ]},
+  'nvptx64--' : { 'devices' : [{'gpu' : '', 'aliases' : []} ]},
+  'nvptx--nvidiacl'   : { 'devices' : [{'gpu' : '', 'aliases' : []} ]},
+  'nvptx64--nvidiacl' : { 'devices' : [{'gpu' : '', 'aliases' : []} ]},
 }
 
 default_targets = ['nvptx--nvidiacl', 'nvptx64--nvidiacl', 'r600--', 
'amdgcn--', 'amdgcn--amdhsa']
@@ -188,16 +180,10 @@ for target in targets:
 
   for device in available_targets[target]['devices']:
 # The rule for building a .bc file for the specified architecture using 
clang.
-device_def_list = (device['defines']['all'] if 'all' in device['defines'] 
else []);
-if llvm_string_version in device['defines']:
-device_def_list += (device['defines'][llvm_string_version]);
-device_defines = ' '.join(["-D%s" % define for define in device_def_list])
 clang_bc_flags = "-target %s -I`dirname $in` %s " \
  "-fno-builtin " \
- "-Dcl_clang_storage_class_specifiers " \
- "%s " \
  "-D__CLC_INTERNAL " \
- "-emit-llvm" % (target, clang_cl_includes, device_defines)
+ "-emit-llvm" % (target, clang_cl_includes)
 if device['gpu'] != '':
   clang_bc_flags += ' -mcpu=' + device['gpu']
 clang_bc_rule = "CLANG_CL_BC_" + target + "_" + device['gpu']


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


Re: [PATCH] D21469: Add -mno-iamcu option

2016-06-17 Thread Eric Christopher via cfe-commits
echristo accepted this revision.
echristo added a comment.
This revision is now accepted and ready to land.

OK.

-eric


http://reviews.llvm.org/D21469



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


[libcxx] r273037 - Add missing space between >> in template declaration. Fixes C++03 build.

2016-06-17 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Jun 17 15:16:46 2016
New Revision: 273037

URL: http://llvm.org/viewvc/llvm-project?rev=273037=rev
Log:
Add missing space between >> in template declaration. Fixes C++03 build.

Modified:
libcxx/trunk/include/iomanip

Modified: libcxx/trunk/include/iomanip
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/iomanip?rev=273037=273036=273037=diff
==
--- libcxx/trunk/include/iomanip (original)
+++ libcxx/trunk/include/iomanip Fri Jun 17 15:16:46 2016
@@ -567,7 +567,7 @@ __quoted_input ( basic_istream<_CharT, _
 }
 
 
-template >
+template  >
 struct __quoted_output_proxy
 {
 _Iter  __first;


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


r273036 - test: support / and \ as directory separators

2016-06-17 Thread Saleem Abdulrasool via cfe-commits
Author: compnerd
Date: Fri Jun 17 14:59:01 2016
New Revision: 273036

URL: http://llvm.org/viewvc/llvm-project?rev=273036=rev
Log:
test: support / and \ as directory separators

Windows uses \ as the directory separator and this causes the tests to fail on
Windows.

Modified:
cfe/trunk/test/Driver/windows-cross.c

Modified: cfe/trunk/test/Driver/windows-cross.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/windows-cross.c?rev=273036=273035=273036=diff
==
--- cfe/trunk/test/Driver/windows-cross.c (original)
+++ cfe/trunk/test/Driver/windows-cross.c Fri Jun 17 14:59:01 2016
@@ -69,8 +69,8 @@
 
 // RUN: %clang -### -target armv7-windows-itanium -isystem-after "Windows 
Kits/10/Include/10.0.10586.0/ucrt" -isystem-after "Windows 
Kits/10/Include/10.0.10586.0/um" -isystem-after "Windows 
Kits/10/Include/10.0.10586.0/shared" -c %s -o /dev/null 2>&1 \
 // RUN: | FileCheck %s --check-prefix CHECK-ISYSTEM-AFTER
-// CHECK-ISYSTEM-AFTER: "-internal-isystem" "{{.*}}/clang/{{[\.0-9]+}}/include"
-// CHECK-ISYSTEM-AFTER: "-internal-isystem" "Windows 
Kits/10/Include/10.0.10586.0/ucrt"
-// CHECK-ISYSTEM-AFTER: "-internal-isystem" "Windows 
Kits/10/Include/10.0.10586.0/um"
-// CHECK-ISYSTEM-AFTER: "-internal-isystem" "Windows 
Kits/10/Include/10.0.10586.0/shared"
+// CHECK-ISYSTEM-AFTER: "-internal-isystem" 
"{{.*}}{{[/\\]}}clang{{[/\\]}}{{[\.0-9]+}}{{[/\\]}}include"
+// CHECK-ISYSTEM-AFTER: "-internal-isystem" "Windows 
Kits{{[/\\]}}10{{[/\\]}}Include{{[/\\]}}10.0.10586.0{{[/\\]}}ucrt"
+// CHECK-ISYSTEM-AFTER: "-internal-isystem" "Windows 
Kits{{[/\\]}}10{{[/\\]}}Include{{[/\\]}}10.0.10586.0{{[/\\]}}um"
+// CHECK-ISYSTEM-AFTER: "-internal-isystem" "Windows 
Kits{{[/\\]}}10{{[/\\]}}Include{{[/\\]}}10.0.10586.0{{[/\\]}}shared"
 


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


[libcxx] r273035 - Fix a couple of warnings present in the filesystem tests.

2016-06-17 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Jun 17 14:57:54 2016
New Revision: 273035

URL: http://llvm.org/viewvc/llvm-project?rev=273035=rev
Log:
Fix a couple of warnings present in the filesystem tests.

Modified:

libcxx/trunk/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/move_assign.pass.cpp

libcxx/trunk/test/std/experimental/filesystem/class.path/path.member/path.modifiers/replace_extension.pass.cpp

libcxx/trunk/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/move_assign.pass.cpp

Modified: 
libcxx/trunk/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/move_assign.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/move_assign.pass.cpp?rev=273035=273034=273035=diff
==
--- 
libcxx/trunk/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/move_assign.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/move_assign.pass.cpp
 Fri Jun 17 14:57:54 2016
@@ -24,6 +24,12 @@
 #include "rapid-cxx-test.hpp"
 #include "filesystem_test_helper.hpp"
 
+// The filesystem specification explicitly allows for self-move on
+// the directory iterators. Turn off this warning so we can test it.
+#if defined(__clang__)
+#pragma clang diagnostic ignored "-Wself-move"
+#endif
+
 using namespace std::experimental::filesystem;
 
 TEST_SUITE(directory_iterator_move_assign_tests)

Modified: 
libcxx/trunk/test/std/experimental/filesystem/class.path/path.member/path.modifiers/replace_extension.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/filesystem/class.path/path.member/path.modifiers/replace_extension.pass.cpp?rev=273035=273034=273035=diff
==
--- 
libcxx/trunk/test/std/experimental/filesystem/class.path/path.member/path.modifiers/replace_extension.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/experimental/filesystem/class.path/path.member/path.modifiers/replace_extension.pass.cpp
 Fri Jun 17 14:57:54 2016
@@ -47,10 +47,10 @@ const ReplaceExtensionTestcase TestCases
   };
 const ReplaceExtensionTestcase NoArgCases[] =
   {
-  {"", ""}
-, {"foo", "foo"}
-, {"foo.cpp", "foo"}
-, {"foo..cpp", "foo."}
+  {"", "", ""}
+, {"foo", "foo", ""}
+, {"foo.cpp", "foo", ""}
+, {"foo..cpp", "foo.", ""}
 };
 
 int main()

Modified: 
libcxx/trunk/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/move_assign.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/move_assign.pass.cpp?rev=273035=273034=273035=diff
==
--- 
libcxx/trunk/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/move_assign.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/move_assign.pass.cpp
 Fri Jun 17 14:57:54 2016
@@ -24,6 +24,12 @@
 #include "rapid-cxx-test.hpp"
 #include "filesystem_test_helper.hpp"
 
+// The filesystem specification explicitly allows for self-move on
+// the directory iterators. Turn off this warning so we can test it.
+#if defined(__clang__)
+#pragma clang diagnostic ignored "-Wself-move"
+#endif
+
 using namespace std::experimental::filesystem;
 
 TEST_SUITE(recursive_directory_iterator_move_assign_tests)


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


Re: [PATCH] D16948: [libcxx] Filesystem TS -- Complete

2016-06-17 Thread Eric Fiselier via cfe-commits
EricWF closed this revision.
EricWF added a comment.

Committed as r273034.


http://reviews.llvm.org/D16948



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


Re: r273016 - Driver: introduce and use `-isystem-after` for cross-windows

2016-06-17 Thread Rafael EspĂ­ndola via cfe-commits
Looks like this broke a few bots:

http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/7311

Cheers,
Rafael


On 17 June 2016 at 13:23, Saleem Abdulrasool via cfe-commits
 wrote:
> Author: compnerd
> Date: Fri Jun 17 12:23:16 2016
> New Revision: 273016
>
> URL: http://llvm.org/viewvc/llvm-project?rev=273016=rev
> Log:
> Driver: introduce and use `-isystem-after` for cross-windows
>
> This mirrors the many other -i*after options to insert a new system search
> directory at the end of the search path.  This makes it possible to actually
> inject a search path after the resource dir.  This option is similar in spirit
> to the /imsvc option in the clang-cl driver.  This is needed to properly use 
> the
> driver for Windows targets where the clang headers wrap some of the system
> headers.
>
> This concept is actually useful on other targets (e.g. Linux) and would be
> really easy to support on the core toolchain.
>
> Modified:
> cfe/trunk/include/clang/Driver/Options.td
> cfe/trunk/lib/Driver/CrossWindowsToolChain.cpp
> cfe/trunk/lib/Driver/Tools.cpp
> cfe/trunk/test/Driver/windows-cross.c
>
> Modified: cfe/trunk/include/clang/Driver/Options.td
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=273016=273015=273016=diff
> ==
> --- cfe/trunk/include/clang/Driver/Options.td (original)
> +++ cfe/trunk/include/clang/Driver/Options.td Fri Jun 17 12:23:16 2016
> @@ -1277,6 +1277,9 @@ def isysroot : JoinedOrSeparate<["-"], "
>  def isystem : JoinedOrSeparate<["-"], "isystem">, Group,
>Flags<[CC1Option]>,
>HelpText<"Add directory to SYSTEM include search path">, 
> MetaVarName<"">;
> +def isystem_after : JoinedOrSeparate<["-"], "isystem-after">,
> +  Group, Flags<[DriverOption]>, MetaVarName<"">,
> +  HelpText<"Add directory to end of the SYSTEM include search path">;
>  def iwithprefixbefore : JoinedOrSeparate<["-"], "iwithprefixbefore">, 
> Group,
>HelpText<"Set directory to include search path with prefix">, 
> MetaVarName<"">,
>Flags<[CC1Option]>;
>
> Modified: cfe/trunk/lib/Driver/CrossWindowsToolChain.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/CrossWindowsToolChain.cpp?rev=273016=273015=273016=diff
> ==
> --- cfe/trunk/lib/Driver/CrossWindowsToolChain.cpp (original)
> +++ cfe/trunk/lib/Driver/CrossWindowsToolChain.cpp Fri Jun 17 12:23:16 2016
> @@ -62,6 +62,8 @@ AddClangSystemIncludeArgs(const llvm::op
>  llvm::sys::path::append(ResourceDir, "include");
>  addSystemInclude(DriverArgs, CC1Args, ResourceDir);
>}
> +  for (const auto  : 
> DriverArgs.getAllArgValues(options::OPT_isystem_after))
> +addSystemInclude(DriverArgs, CC1Args, P);
>addExternCSystemInclude(DriverArgs, CC1Args, SysRoot + "/usr/include");
>  }
>
>
> Modified: cfe/trunk/lib/Driver/Tools.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=273016=273015=273016=diff
> ==
> --- cfe/trunk/lib/Driver/Tools.cpp (original)
> +++ cfe/trunk/lib/Driver/Tools.cpp Fri Jun 17 12:23:16 2016
> @@ -502,6 +502,13 @@ void Clang::AddPreprocessingOptions(Comp
> << 
> A->getAsString(Args);
>  }
>}
> +} else if (A->getOption().matches(options::OPT_isystem_after)) {
> +  // Handling of paths which must come late.  These entries are handled 
> by
> +  // the toolchain itself after the resource dir is inserted in the right
> +  // search order.
> +  // Do not claim the argument so that the use of the argument does not
> +  // silently go unnoticed on toolchains which do not honour the option.
> +  continue;
>  }
>
>  // Not translated, render as usual.
>
> Modified: cfe/trunk/test/Driver/windows-cross.c
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/windows-cross.c?rev=273016=273015=273016=diff
> ==
> --- cfe/trunk/test/Driver/windows-cross.c (original)
> +++ cfe/trunk/test/Driver/windows-cross.c Fri Jun 17 12:23:16 2016
> @@ -67,3 +67,10 @@
>  // CHECK-SANITIZE-TSAN: error: unsupported argument 'tsan' to option 
> 'fsanitize='
>  // CHECK-SANITIZE-TSAN-NOT: "-fsanitize={{.*}}"
>
> +// RUN: %clang -### -target armv7-windows-itanium -isystem-after "Windows 
> Kits/10/Include/10.0.10586.0/ucrt" -isystem-after "Windows 
> Kits/10/Include/10.0.10586.0/um" -isystem-after "Windows 
> Kits/10/Include/10.0.10586.0/shared" -c %s -o /dev/null 2>&1 \
> +// RUN: | FileCheck %s --check-prefix CHECK-ISYSTEM-AFTER
> +// CHECK-ISYSTEM-AFTER: "-internal-isystem" "{{.*}}/clang/3.9.0/include"
> +// CHECK-ISYSTEM-AFTER: "-internal-isystem" 

Re: [PATCH] D16948: [libcxx] Filesystem TS -- Complete

2016-06-17 Thread Eric Fiselier via cfe-commits
EricWF accepted this revision.
EricWF added a reviewer: EricWF.
EricWF added a comment.
This revision is now accepted and ready to land.

Accepting before committing. Speak now or forever hold your peace. (Or just 
speak post commit)


http://reviews.llvm.org/D16948



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


[Patch] Add a ENABLE_X86_RELAX_RELOCATIONS cmake option

2016-06-17 Thread Rafael EspĂ­ndola via cfe-commits
This corresponds to binutils' --enable-x86-relax-relocations.

Cheers,
Rafael
From 1d5920b88d06afe0575313f3b2fc327a5069e32c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rafael=20=C3=81vila=20de=20Esp=C3=ADndola?=
 
Date: Fri, 17 Jun 2016 15:33:29 -0400
Subject: [PATCH] Add a ENABLE_X86_RELAX_RELOCATIONS  cmake option.

This corresponds to binutils' --enable-x86-relax-relocations.
---
 CMakeLists.txt  | 3 +++
 include/clang/Config/config.h.cmake | 3 +++
 lib/Driver/Tools.cpp| 2 +-
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8516644..114d230 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -185,6 +185,9 @@ set(DEFAULT_SYSROOT "" CACHE PATH
 
 set(ENABLE_LINKER_BUILD_ID OFF CACHE BOOL "pass --build-id to ld")
 
+set(ENABLE_X86_RELAX_RELOCATIONS OFF CACHE BOOL
+"enable x86 relax relocations by default")
+
 set(CLANG_DEFAULT_CXX_STDLIB "" CACHE STRING
   "Default C++ stdlib to use (empty for architecture default, \"libstdc++\" or \"libc++\"")
 if (NOT(CLANG_DEFAULT_CXX_STDLIB STREQUAL "" OR
diff --git a/include/clang/Config/config.h.cmake b/include/clang/Config/config.h.cmake
index 09f5e4b..e5a1d0d 100644
--- a/include/clang/Config/config.h.cmake
+++ b/include/clang/Config/config.h.cmake
@@ -41,4 +41,7 @@
 /* pass --build-id to ld */
 #cmakedefine ENABLE_LINKER_BUILD_ID
 
+/* enable x86 relax relocations by default */
+#cmakedefine01 ENABLE_X86_RELAX_RELOCATIONS
+
 #endif
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index b911c17..6152291 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -2837,7 +2837,7 @@ static void CollectArgsForIntegratedAssembler(Compilation ,
   // options.
   bool CompressDebugSections = false;
 
-  bool UseRelaxRelocations = false;
+  bool UseRelaxRelocations = ENABLE_X86_RELAX_RELOCATIONS;
   const char *MipsTargetFeature = nullptr;
   for (const Arg *A :
Args.filtered(options::OPT_Wa_COMMA, options::OPT_Xassembler)) {
-- 
2.5.5

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


Re: [PATCH] D20389: NVPTX: Add supported CL features

2016-06-17 Thread Jan Vesely via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL273031: NVPTX: Add supported CL features (authored by 
jvesely).

Changed prior to commit:
  http://reviews.llvm.org/D20389?vs=60257=61119#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20389

Files:
  cfe/trunk/lib/Basic/Targets.cpp
  cfe/trunk/test/Misc/nvptx.languageOptsOpenCL.cl

Index: cfe/trunk/test/Misc/nvptx.languageOptsOpenCL.cl
===
--- cfe/trunk/test/Misc/nvptx.languageOptsOpenCL.cl
+++ cfe/trunk/test/Misc/nvptx.languageOptsOpenCL.cl
@@ -0,0 +1,211 @@
+// REQUIRES: nvptx-registered-target
+// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple nvptx-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple nvptx-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple nvptx-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL2.0 %s -verify -triple nvptx-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple nvptx-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES
+// RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple nvptx-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES
+// RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple nvptx-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES
+// RUN: %clang_cc1 -x cl -cl-std=CL2.0 %s -verify -triple nvptx-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES
+// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple nvptx64-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple nvptx64-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple nvptx64-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL2.0 %s -verify -triple nvptx64-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple nvptx64-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES
+// RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple nvptx64-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES
+// RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple nvptx64-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES
+// RUN: %clang_cc1 -x cl -cl-std=CL2.0 %s -verify -triple nvptx64-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES
+
+// Extensions in all versions
+#ifndef cl_clang_storage_class_specifiers
+#error "Missing cl_clang_storage_class_specifiers define"
+#endif
+#pragma OPENCL EXTENSION cl_clang_storage_class_specifiers: enable
+
+#ifdef cl_khr_fp16
+#error "Incorrect cl_khr_fp16 define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_fp16: enable
+// expected-warning@-1{{unsupported OpenCL extension 'cl_khr_fp16' - ignoring}}
+
+#ifdef cl_khr_int64_base_atomics
+#error "Incorrect cl_khr_int64_base_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_int64_base_atomics: enable
+// expected-warning@-1{{unsupported OpenCL extension 'cl_khr_int64_base_atomics' - ignoring}}
+
+#ifdef cl_khr_int64_extended_atomics
+#error "Incorrect cl_khr_int64_extended_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_int64_extended_atomics: enable
+// expected-warning@-1{{unsupported OpenCL extension 'cl_khr_int64_extended_atomics' - ignoring}}
+
+#ifndef cl_khr_gl_sharing
+#error "Missing cl_khr_gl_sharing define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_gl_sharing: enable
+
+#ifndef cl_khr_icd
+#error "Missing cl_khr_icd define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_icd: enable
+
+// Core features in CL 1.1
+
+#ifndef cl_khr_byte_addressable_store
+#error "Missing cl_khr_byte_addressable_store define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_byte_addressable_store: enable
+#if (__OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES
+// expected-warning@-2{{OpenCL extension 'cl_khr_byte_addressable_store' is core feature or supported optional core feature - ignoring}}
+#endif
+
+#ifndef cl_khr_global_int32_base_atomics
+#error "Missing cl_khr_global_int32_base_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_global_int32_base_atomics: enable
+#if (__OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES
+// expected-warning@-2{{OpenCL extension 'cl_khr_global_int32_base_atomics' is core feature or supported optional core feature - ignoring}}
+#endif
+
+#ifndef cl_khr_global_int32_extended_atomics
+#error "Missing cl_khr_global_int32_extended_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_global_int32_extended_atomics: enable
+#if (__OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES
+// expected-warning@-2{{OpenCL extension 'cl_khr_global_int32_extended_atomics' is core feature or supported optional core feature - ignoring}}
+#endif
+
+#ifndef cl_khr_local_int32_base_atomics
+#error "Missing cl_khr_local_int32_base_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_local_int32_base_atomics: enable
+#if (__OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES
+// expected-warning@-2{{OpenCL extension 

r273031 - NVPTX: Add supported CL features

2016-06-17 Thread Jan Vesely via cfe-commits
Author: jvesely
Date: Fri Jun 17 14:02:14 2016
New Revision: 273031

URL: http://llvm.org/viewvc/llvm-project?rev=273031=rev
Log:
NVPTX: Add supported CL features

Fixes libclc compilation broken by r269670

Reviewers: jholewinsky

Differential Revision: http://reviews.llvm.org/D20389

Added:
cfe/trunk/test/Misc/nvptx.languageOptsOpenCL.cl
Modified:
cfe/trunk/lib/Basic/Targets.cpp

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=273031=273030=273031=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Fri Jun 17 14:02:14 2016
@@ -1862,6 +1862,19 @@ public:
 
 return GPU != GK_NONE;
   }
+  void setSupportedOpenCLOpts() override {
+auto  = getSupportedOpenCLOpts();
+Opts.cl_clang_storage_class_specifiers = 1;
+Opts.cl_khr_gl_sharing = 1;
+Opts.cl_khr_icd = 1;
+
+Opts.cl_khr_fp64 = 1;
+Opts.cl_khr_byte_addressable_store = 1;
+Opts.cl_khr_global_int32_base_atomics = 1;
+Opts.cl_khr_global_int32_extended_atomics = 1;
+Opts.cl_khr_local_int32_base_atomics = 1;
+Opts.cl_khr_local_int32_extended_atomics = 1;
+  }
 };
 
 const Builtin::Info NVPTXTargetInfo::BuiltinInfo[] = {

Added: cfe/trunk/test/Misc/nvptx.languageOptsOpenCL.cl
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/nvptx.languageOptsOpenCL.cl?rev=273031=auto
==
--- cfe/trunk/test/Misc/nvptx.languageOptsOpenCL.cl (added)
+++ cfe/trunk/test/Misc/nvptx.languageOptsOpenCL.cl Fri Jun 17 14:02:14 2016
@@ -0,0 +1,211 @@
+// REQUIRES: nvptx-registered-target
+// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple nvptx-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple nvptx-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple nvptx-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL2.0 %s -verify -triple nvptx-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple nvptx-unknown-unknown 
-Wpedantic-core-features -DTEST_CORE_FEATURES
+// RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple 
nvptx-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES
+// RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple 
nvptx-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES
+// RUN: %clang_cc1 -x cl -cl-std=CL2.0 %s -verify -triple 
nvptx-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES
+// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple nvptx64-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple 
nvptx64-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple 
nvptx64-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL2.0 %s -verify -triple 
nvptx64-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple nvptx64-unknown-unknown 
-Wpedantic-core-features -DTEST_CORE_FEATURES
+// RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple 
nvptx64-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES
+// RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple 
nvptx64-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES
+// RUN: %clang_cc1 -x cl -cl-std=CL2.0 %s -verify -triple 
nvptx64-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES
+
+// Extensions in all versions
+#ifndef cl_clang_storage_class_specifiers
+#error "Missing cl_clang_storage_class_specifiers define"
+#endif
+#pragma OPENCL EXTENSION cl_clang_storage_class_specifiers: enable
+
+#ifdef cl_khr_fp16
+#error "Incorrect cl_khr_fp16 define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_fp16: enable
+// expected-warning@-1{{unsupported OpenCL extension 'cl_khr_fp16' - ignoring}}
+
+#ifdef cl_khr_int64_base_atomics
+#error "Incorrect cl_khr_int64_base_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_int64_base_atomics: enable
+// expected-warning@-1{{unsupported OpenCL extension 
'cl_khr_int64_base_atomics' - ignoring}}
+
+#ifdef cl_khr_int64_extended_atomics
+#error "Incorrect cl_khr_int64_extended_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_int64_extended_atomics: enable
+// expected-warning@-1{{unsupported OpenCL extension 
'cl_khr_int64_extended_atomics' - ignoring}}
+
+#ifndef cl_khr_gl_sharing
+#error "Missing cl_khr_gl_sharing define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_gl_sharing: enable
+
+#ifndef cl_khr_icd
+#error "Missing cl_khr_icd define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_icd: enable
+
+// Core features in CL 1.1
+
+#ifndef cl_khr_byte_addressable_store
+#error "Missing cl_khr_byte_addressable_store define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_byte_addressable_store: enable
+#if (__OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES
+// expected-warning@-2{{OpenCL extension 'cl_khr_byte_addressable_store' is 
core feature or supported optional core feature - 

Re: [PATCH] D21185: [clang-tidy] Add performance-emplace-into-containers

2016-06-17 Thread Samuel Benzaquen via cfe-commits
sbenza added a comment.

Missing the .rst file.
Did you use the check_clang_tidy.py script to create the template?



Comment at: clang-tidy/performance/EmplaceCheck.cpp:25
@@ +24,3 @@
+  cxxMemberCallExpr(
+  on(expr(hasType(cxxRecordDecl(hasName("std::vector"),
+  callee(functionDecl(hasName("push_back"))),

This change can potentially break exception guarantees of the code.
For example, push_back can throw before the object is constructed leaking the 
arguments.
We should at least say something about it in the docs.


Comment at: clang-tidy/performance/EmplaceCheck.cpp:26
@@ +25,3 @@
+  on(expr(hasType(cxxRecordDecl(hasName("std::vector"),
+  callee(functionDecl(hasName("push_back"))),
+  hasArgument(0, cxxConstructExpr().bind("construct_expr")))

Just say functionDecl(hasName("std::vector::push_back")) and you can remove the 
type check.


Comment at: clang-tidy/performance/EmplaceCheck.cpp:84
@@ +83,3 @@
+
+  StringRef ArgsStr = getAsString(SM, LO, ArgsR);
+  if (!ArgsStr.data())

It's usually preferable, and sometimes easier to write, to do erases instead of 
replacements.
For example, you could simply erase `X(`  and  `)`.
Something like `(Cons->getLogStart(), ArgsR.getBegin())` and `(Args.getEnd(), 
Args.getEnd())`


Comment at: clang-tidy/performance/EmplaceCheck.cpp:88
@@ +87,3 @@
+
+  SourceRange CalleeR = getPreciseTokenRange(SM, LO, CalleeStartLoc);
+  SourceRange ConstructR = Cons->getSourceRange();

What you want is `getTokenRange(Call->getCallee()->getSourceRange())`
No need to mess with the locations and offsets yourself.


Comment at: clang-tidy/performance/EmplaceCheck.h:18
@@ +17,3 @@
+namespace performance {
+
+class EmplaceCheck : public ClangTidyCheck {

Needs a comment


Comment at: clang-tidy/performance/EmplaceCheck.h:19
@@ +18,3 @@
+
+class EmplaceCheck : public ClangTidyCheck {
+public:

What's the scope?
Is it just vector::push_back/emplace_back?
Or is it going to be expanded to other map::insert, deque::push_front, etc.


Comment at: test/clang-tidy/performance-emplace-into-containers.cpp:26
@@ +25,3 @@
+  std::vector v1;
+
+  v1.push_back(X());

We have to make sure the arguments are compatible with perfect forwarding.
This means no brace init lists and no NULL.
Eg:

v.push_back(Y({}));  // {} can't be passed to perfect forwarding
v.push_back(Y(NULL));  // NULL can't be passed to perfect forwarding


Comment at: test/clang-tidy/performance-emplace-into-containers.cpp:28
@@ +27,3 @@
+  v1.push_back(X());
+  // CHECK-MESSAGES: [[@LINE-1]]:6: warning: Consider constructing {{.*}}
+  // CHECK-FIXES: v1.emplace_back()

At least one of the cases should match the whole exact message, to make sure it 
is correct.


Comment at: test/clang-tidy/performance-emplace-into-containers.cpp:42
@@ +41,3 @@
+  // CHECK-FIXES: v1/*a*/./*b*/emplace_back(/*c*//*d*/0,/*e*/0/*f*//*g*/)/*h*/ 
;
+
+  // Do not try to deal with initializer lists.

We should also test implicit conversions.
Eg:

v1.push_back(0);


Comment at: test/clang-tidy/performance-emplace-into-containers.cpp:46
@@ +45,3 @@
+
+  // Do not try to deal with functional casts. FIXME?
+  X x{0, 0};

Why not?


Comment at: test/clang-tidy/performance-emplace-into-containers.cpp:50
@@ +49,3 @@
+  v1.push_back(X(0));
+
+  // Do not try to deal with weird expansions.

We need tests for copy/move construction.
Eg:

v1.push_back(x);  // should not be changed
v1.push_back(FunctionThatReturnsX());  // should not be changed


http://reviews.llvm.org/D21185



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


Re: [PATCH] D20647: Add flag to add InlineHint attribute on implicitly inline functions

2016-06-17 Thread Paul Robinson via cfe-commits
probinson added a subscriber: probinson.
probinson added a comment.

I'm still bemused that Clang thinks of a defined-in-class method and a method 
marked with 'inline' as significantly different things.  But given that it 
does, a way to make them be treated the same will be nice.



Comment at: include/clang/Driver/Options.td:751
@@ -750,1 +750,3 @@
+def finline_implicit_hint: Flag<["-"], "finline-implicit-hint">, 
Group, Flags<[CC1Option]>;
+def fno_inline_implicit_hint: Flag<["-"], "fno-inline-implicit-hint">, 
Group, Flags<[CC1Option]>;
 def finline : Flag<["-"], "finline">, Group;

Seems like a HelpText would be appropriate here?


http://reviews.llvm.org/D20647



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


r273020 - [CodeGen] Use pointer-sized integers for ptrtoint sources

2016-06-17 Thread David Majnemer via cfe-commits
Author: majnemer
Date: Fri Jun 17 12:47:24 2016
New Revision: 273020

URL: http://llvm.org/viewvc/llvm-project?rev=273020=rev
Log:
[CodeGen] Use pointer-sized integers for ptrtoint sources

Given something like:
void *v = (void *)100;

We need to synthesize a ptrtoint operation from 100.  During constant
emission, we choose i64 as the type for our constant because it
guaranteed not to drop any bits from our CharUnits representation of the
value.  However, this is suboptimal for 32-bit targets: LLVM passes like
GlobalOpt will get confused by these sorts of casts resulting in
pessimization.

Instead, make sure the ptrtoint operand has a pointer-sized integer
type.

Modified:
cfe/trunk/lib/CodeGen/CGExprConstant.cpp
cfe/trunk/test/CodeGen/const-init.c

Modified: cfe/trunk/lib/CodeGen/CGExprConstant.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprConstant.cpp?rev=273020=273019=273020=diff
==
--- cfe/trunk/lib/CodeGen/CGExprConstant.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprConstant.cpp Fri Jun 17 12:47:24 2016
@@ -1314,8 +1314,14 @@ llvm::Constant *CodeGenModule::EmitConst
 
   // Convert to the appropriate type; this could be an lvalue for
   // an integer.
-  if (isa(DestTy))
+  if (isa(DestTy)) {
+// Convert the integer to a pointer-sized integer before converting it
+// to a pointer.
+C = llvm::ConstantExpr::getIntegerCast(
+C, getDataLayout().getIntPtrType(DestTy),
+/*isSigned=*/false);
 return llvm::ConstantExpr::getIntToPtr(C, DestTy);
+  }
 
   // If the types don't match this should only be a truncate.
   if (C->getType() != DestTy)

Modified: cfe/trunk/test/CodeGen/const-init.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/const-init.c?rev=273020=273019=273020=diff
==
--- cfe/trunk/test/CodeGen/const-init.c (original)
+++ cfe/trunk/test/CodeGen/const-init.c Fri Jun 17 12:47:24 2016
@@ -84,7 +84,7 @@ struct g13_s0 g13[] = {
{ (long) _tmp }
 };
 
-// CHECK: @g14 = global i8* inttoptr (i64 100 to i8*)
+// CHECK: @g14 = global i8* inttoptr (i32 100 to i8*)
 void *g14 = (void*) 100;
 
 // CHECK: @g15 = global i32 -1


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


r273018 - test: generalise the matching

2016-06-17 Thread Saleem Abdulrasool via cfe-commits
Author: compnerd
Date: Fri Jun 17 12:33:36 2016
New Revision: 273018

URL: http://llvm.org/viewvc/llvm-project?rev=273018=rev
Log:
test: generalise the matching

Use a regex for the clang version as that will change all the time.

Modified:
cfe/trunk/test/Driver/windows-cross.c

Modified: cfe/trunk/test/Driver/windows-cross.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/windows-cross.c?rev=273018=273017=273018=diff
==
--- cfe/trunk/test/Driver/windows-cross.c (original)
+++ cfe/trunk/test/Driver/windows-cross.c Fri Jun 17 12:33:36 2016
@@ -69,7 +69,7 @@
 
 // RUN: %clang -### -target armv7-windows-itanium -isystem-after "Windows 
Kits/10/Include/10.0.10586.0/ucrt" -isystem-after "Windows 
Kits/10/Include/10.0.10586.0/um" -isystem-after "Windows 
Kits/10/Include/10.0.10586.0/shared" -c %s -o /dev/null 2>&1 \
 // RUN: | FileCheck %s --check-prefix CHECK-ISYSTEM-AFTER
-// CHECK-ISYSTEM-AFTER: "-internal-isystem" "{{.*}}/clang/3.9.0/include"
+// CHECK-ISYSTEM-AFTER: "-internal-isystem" "{{.*}}/clang/{{[\.0-9]+}}/include"
 // CHECK-ISYSTEM-AFTER: "-internal-isystem" "Windows 
Kits/10/Include/10.0.10586.0/ucrt"
 // CHECK-ISYSTEM-AFTER: "-internal-isystem" "Windows 
Kits/10/Include/10.0.10586.0/um"
 // CHECK-ISYSTEM-AFTER: "-internal-isystem" "Windows 
Kits/10/Include/10.0.10586.0/shared"


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


Re: [PATCH] D19544: Pass for translating math intrinsics to math library calls.

2016-06-17 Thread Matt via cfe-commits
mmasten added a subscriber: cfe-commits.
mmasten updated this revision to Diff 61110.

http://reviews.llvm.org/D19544

Files:
  include/clang/Frontend/CodeGenOptions.def
  include/clang/Frontend/CodeGenOptions.h
  lib/CodeGen/BackendUtil.cpp
  lib/Frontend/CompilerInvocation.cpp

Index: lib/CodeGen/BackendUtil.cpp
===
--- lib/CodeGen/BackendUtil.cpp
+++ lib/CodeGen/BackendUtil.cpp
@@ -288,6 +288,9 @@
   case CodeGenOptions::Accelerate:
 
TLII->addVectorizableFunctionsFromVecLib(TargetLibraryInfoImpl::Accelerate);
 break;
+  case CodeGenOptions::SVML:
+TLII->addVectorizableFunctionsFromVecLib(TargetLibraryInfoImpl::SVML);
+break;
   default:
 break;
   }
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -452,6 +452,8 @@
 StringRef Name = A->getValue();
 if (Name == "Accelerate")
   Opts.setVecLib(CodeGenOptions::Accelerate);
+else if (Name == "SVML")
+  Opts.setVecLib(CodeGenOptions::SVML);
 else if (Name == "none")
   Opts.setVecLib(CodeGenOptions::NoLibrary);
 else
Index: include/clang/Frontend/CodeGenOptions.h
===
--- include/clang/Frontend/CodeGenOptions.h
+++ include/clang/Frontend/CodeGenOptions.h
@@ -50,8 +50,9 @@
   };
 
   enum VectorLibrary {
-NoLibrary, // Don't use any vector library.
-Accelerate // Use the Accelerate framework.
+NoLibrary,  // Don't use any vector library.
+Accelerate, // Use the Accelerate framework.
+SVML// Intel short vector math library.
   };
 
   enum ObjCDispatchMethodKind {
Index: include/clang/Frontend/CodeGenOptions.def
===
--- include/clang/Frontend/CodeGenOptions.def
+++ include/clang/Frontend/CodeGenOptions.def
@@ -221,7 +221,7 @@
 ENUM_CODEGENOPT(Inlining, InliningMethod, 2, NoInlining)
 
 // Vector functions library to use.
-ENUM_CODEGENOPT(VecLib, VectorLibrary, 1, NoLibrary)
+ENUM_CODEGENOPT(VecLib, VectorLibrary, 2, NoLibrary)
 
 /// The default TLS model to use.
 ENUM_CODEGENOPT(DefaultTLSModel, TLSModel, 2, GeneralDynamicTLSModel)


Index: lib/CodeGen/BackendUtil.cpp
===
--- lib/CodeGen/BackendUtil.cpp
+++ lib/CodeGen/BackendUtil.cpp
@@ -288,6 +288,9 @@
   case CodeGenOptions::Accelerate:
 TLII->addVectorizableFunctionsFromVecLib(TargetLibraryInfoImpl::Accelerate);
 break;
+  case CodeGenOptions::SVML:
+TLII->addVectorizableFunctionsFromVecLib(TargetLibraryInfoImpl::SVML);
+break;
   default:
 break;
   }
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -452,6 +452,8 @@
 StringRef Name = A->getValue();
 if (Name == "Accelerate")
   Opts.setVecLib(CodeGenOptions::Accelerate);
+else if (Name == "SVML")
+  Opts.setVecLib(CodeGenOptions::SVML);
 else if (Name == "none")
   Opts.setVecLib(CodeGenOptions::NoLibrary);
 else
Index: include/clang/Frontend/CodeGenOptions.h
===
--- include/clang/Frontend/CodeGenOptions.h
+++ include/clang/Frontend/CodeGenOptions.h
@@ -50,8 +50,9 @@
   };
 
   enum VectorLibrary {
-NoLibrary, // Don't use any vector library.
-Accelerate // Use the Accelerate framework.
+NoLibrary,  // Don't use any vector library.
+Accelerate, // Use the Accelerate framework.
+SVML// Intel short vector math library.
   };
 
   enum ObjCDispatchMethodKind {
Index: include/clang/Frontend/CodeGenOptions.def
===
--- include/clang/Frontend/CodeGenOptions.def
+++ include/clang/Frontend/CodeGenOptions.def
@@ -221,7 +221,7 @@
 ENUM_CODEGENOPT(Inlining, InliningMethod, 2, NoInlining)
 
 // Vector functions library to use.
-ENUM_CODEGENOPT(VecLib, VectorLibrary, 1, NoLibrary)
+ENUM_CODEGENOPT(VecLib, VectorLibrary, 2, NoLibrary)
 
 /// The default TLS model to use.
 ENUM_CODEGENOPT(DefaultTLSModel, TLSModel, 2, GeneralDynamicTLSModel)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D19544: Pass for translating math intrinsics to math library calls.

2016-06-17 Thread Matt via cfe-commits
mmasten updated this revision to Diff 6.

http://reviews.llvm.org/D19544

Files:
  include/llvm/Analysis/TargetLibraryInfo.h
  lib/Analysis/TargetLibraryInfo.cpp

Index: lib/Analysis/TargetLibraryInfo.cpp
===
--- lib/Analysis/TargetLibraryInfo.cpp
+++ lib/Analysis/TargetLibraryInfo.cpp
@@ -23,6 +23,8 @@
   "No vector functions library"),
clEnumValN(TargetLibraryInfoImpl::Accelerate, "Accelerate",
   "Accelerate framework"),
+   clEnumValN(TargetLibraryInfoImpl::SVML, "SVML",
+  "Intel SVML library"),
clEnumValEnd));
 
 const char *const TargetLibraryInfoImpl::StandardNames[LibFunc::NumLibFuncs] = {
@@ -1079,6 +1081,92 @@
 addVectorizableFunctions(VecFuncs);
 break;
   }
+  case SVML: {
+const VecDesc VecFuncs[] = {
+{"sin", "__svml_sin2", 2},
+{"sin", "__svml_sin4", 4},
+{"sin", "__svml_sin8", 8},
+{"sin", "__svml_sin16", 16},
+{"sin", "__svml_sin32", 32},
+{"sinf", "__svml_sinf2", 2},
+{"sinf", "__svml_sinf4", 4},
+{"sinf", "__svml_sinf8", 8},
+{"sinf", "__svml_sinf16", 16},
+{"sinf", "__svml_sinf32", 32},
+{"cos", "__svml_cos2", 2},
+{"cos", "__svml_cos4", 4},
+{"cos", "__svml_cos8", 8},
+{"cos", "__svml_cos16", 16},
+{"cos", "__svml_cos32", 32},
+{"cosf", "__svml_cosf2", 2},
+{"cosf", "__svml_cosf4", 4},
+{"cosf", "__svml_cosf8", 8},
+{"cosf", "__svml_cosf16", 16},
+{"cosf", "__svml_cosf32", 32},
+{"pow", "__svml_pow2", 2},
+{"pow", "__svml_pow4", 4},
+{"pow", "__svml_pow8", 8},
+{"pow", "__svml_pow16", 16},
+{"pow", "__svml_pow32", 32},
+{"powf", "__svml_powf2", 2},
+{"powf", "__svml_powf4", 4},
+{"powf", "__svml_powf8", 8},
+{"powf", "__svml_powf16", 16},
+{"powf", "__svml_powf32", 32},
+{"llvm.pow.f64", "__svml_pow2", 2},
+{"llvm.pow.f64", "__svml_pow4", 4},
+{"llvm.pow.f64", "__svml_pow8", 8},
+{"llvm.pow.f64", "__svml_pow16", 16},
+{"llvm.pow.f64", "__svml_pow32", 32},
+{"llvm.pow.f32", "__svml_powf2", 2},
+{"llvm.pow.f32", "__svml_powf4", 4},
+{"llvm.pow.f32", "__svml_powf8", 8},
+{"llvm.pow.f32", "__svml_powf16", 16},
+{"llvm.pow.f32", "__svml_powf32", 32},
+{"exp", "__svml_exp2", 2},
+{"exp", "__svml_exp4", 4},
+{"exp", "__svml_exp8", 8},
+{"exp", "__svml_exp16", 16},
+{"exp", "__svml_exp32", 32},
+{"expf", "__svml_expf2", 2},
+{"expf", "__svml_expf4", 4},
+{"expf", "__svml_expf8", 8},
+{"expf", "__svml_expf16", 16},
+{"expf", "__svml_expf32", 32},
+{"llvm.exp.f64", "__svml_exp2", 2},
+{"llvm.exp.f64", "__svml_exp4", 4},
+{"llvm.exp.f64", "__svml_exp8", 8},
+{"llvm.exp.f64", "__svml_exp16", 16},
+{"llvm.exp.f64", "__svml_exp32", 32},
+{"llvm.exp.f32", "__svml_expf2", 2},
+{"llvm.exp.f32", "__svml_expf4", 4},
+{"llvm.exp.f32", "__svml_expf8", 8},
+{"llvm.exp.f32", "__svml_expf16", 16},
+{"llvm.exp.f32", "__svml_expf32", 32},
+{"log", "__svml_log2", 2},
+{"log", "__svml_log4", 4},
+{"log", "__svml_log8", 8},
+{"log", "__svml_log16", 16},
+{"log", "__svml_log32", 32},
+{"logf", "__svml_logf2", 2},
+{"logf", "__svml_logf4", 4},
+{"logf", "__svml_logf8", 8},
+{"logf", "__svml_logf16", 16},
+{"logf", "__svml_logf32", 32},
+{"llvm.log.f64", "__svml_log2", 2},
+{"llvm.log.f64", "__svml_log4", 4},
+{"llvm.log.f64", "__svml_log8", 8},
+{"llvm.log.f64", "__svml_log16", 16},
+{"llvm.log.f64", "__svml_log32", 32},
+{"llvm.log.f32", "__svml_logf2", 2},
+{"llvm.log.f32", "__svml_logf4", 4},
+{"llvm.log.f32", "__svml_logf8", 8},
+{"llvm.log.f32", "__svml_logf16", 16},
+{"llvm.log.f32", "__svml_logf32", 32},
+};
+addVectorizableFunctions(VecFuncs);
+break;
+  }
   case NoLibrary:
 break;
   }
Index: include/llvm/Analysis/TargetLibraryInfo.h
===
--- include/llvm/Analysis/TargetLibraryInfo.h
+++ include/llvm/Analysis/TargetLibraryInfo.h
@@ -85,8 +85,9 @@
   /// addVectorizableFunctionsFromVecLib for filling up the tables of
   /// vectorizable functions.
   enum VectorLibrary {
-NoLibrary, // Don't use any vector library.
-Accelerate // Use Accelerate framework.
+NoLibrary,  // Don't use any vector library.
+Accelerate, // Use Accelerate framework.
+SVML// Intel short vector math library.
   };
 
   TargetLibraryInfoImpl();
___
cfe-commits 

r273016 - Driver: introduce and use `-isystem-after` for cross-windows

2016-06-17 Thread Saleem Abdulrasool via cfe-commits
Author: compnerd
Date: Fri Jun 17 12:23:16 2016
New Revision: 273016

URL: http://llvm.org/viewvc/llvm-project?rev=273016=rev
Log:
Driver: introduce and use `-isystem-after` for cross-windows

This mirrors the many other -i*after options to insert a new system search
directory at the end of the search path.  This makes it possible to actually
inject a search path after the resource dir.  This option is similar in spirit
to the /imsvc option in the clang-cl driver.  This is needed to properly use the
driver for Windows targets where the clang headers wrap some of the system
headers.

This concept is actually useful on other targets (e.g. Linux) and would be
really easy to support on the core toolchain.

Modified:
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/lib/Driver/CrossWindowsToolChain.cpp
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/windows-cross.c

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=273016=273015=273016=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Fri Jun 17 12:23:16 2016
@@ -1277,6 +1277,9 @@ def isysroot : JoinedOrSeparate<["-"], "
 def isystem : JoinedOrSeparate<["-"], "isystem">, Group,
   Flags<[CC1Option]>,
   HelpText<"Add directory to SYSTEM include search path">, 
MetaVarName<"">;
+def isystem_after : JoinedOrSeparate<["-"], "isystem-after">,
+  Group, Flags<[DriverOption]>, MetaVarName<"">,
+  HelpText<"Add directory to end of the SYSTEM include search path">;
 def iwithprefixbefore : JoinedOrSeparate<["-"], "iwithprefixbefore">, 
Group,
   HelpText<"Set directory to include search path with prefix">, 
MetaVarName<"">,
   Flags<[CC1Option]>;

Modified: cfe/trunk/lib/Driver/CrossWindowsToolChain.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/CrossWindowsToolChain.cpp?rev=273016=273015=273016=diff
==
--- cfe/trunk/lib/Driver/CrossWindowsToolChain.cpp (original)
+++ cfe/trunk/lib/Driver/CrossWindowsToolChain.cpp Fri Jun 17 12:23:16 2016
@@ -62,6 +62,8 @@ AddClangSystemIncludeArgs(const llvm::op
 llvm::sys::path::append(ResourceDir, "include");
 addSystemInclude(DriverArgs, CC1Args, ResourceDir);
   }
+  for (const auto  : DriverArgs.getAllArgValues(options::OPT_isystem_after))
+addSystemInclude(DriverArgs, CC1Args, P);
   addExternCSystemInclude(DriverArgs, CC1Args, SysRoot + "/usr/include");
 }
 

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=273016=273015=273016=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Fri Jun 17 12:23:16 2016
@@ -502,6 +502,13 @@ void Clang::AddPreprocessingOptions(Comp
<< A->getAsString(Args);
 }
   }
+} else if (A->getOption().matches(options::OPT_isystem_after)) {
+  // Handling of paths which must come late.  These entries are handled by
+  // the toolchain itself after the resource dir is inserted in the right
+  // search order.
+  // Do not claim the argument so that the use of the argument does not
+  // silently go unnoticed on toolchains which do not honour the option.
+  continue;
 }
 
 // Not translated, render as usual.

Modified: cfe/trunk/test/Driver/windows-cross.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/windows-cross.c?rev=273016=273015=273016=diff
==
--- cfe/trunk/test/Driver/windows-cross.c (original)
+++ cfe/trunk/test/Driver/windows-cross.c Fri Jun 17 12:23:16 2016
@@ -67,3 +67,10 @@
 // CHECK-SANITIZE-TSAN: error: unsupported argument 'tsan' to option 
'fsanitize='
 // CHECK-SANITIZE-TSAN-NOT: "-fsanitize={{.*}}"
 
+// RUN: %clang -### -target armv7-windows-itanium -isystem-after "Windows 
Kits/10/Include/10.0.10586.0/ucrt" -isystem-after "Windows 
Kits/10/Include/10.0.10586.0/um" -isystem-after "Windows 
Kits/10/Include/10.0.10586.0/shared" -c %s -o /dev/null 2>&1 \
+// RUN: | FileCheck %s --check-prefix CHECK-ISYSTEM-AFTER
+// CHECK-ISYSTEM-AFTER: "-internal-isystem" "{{.*}}/clang/3.9.0/include"
+// CHECK-ISYSTEM-AFTER: "-internal-isystem" "Windows 
Kits/10/Include/10.0.10586.0/ucrt"
+// CHECK-ISYSTEM-AFTER: "-internal-isystem" "Windows 
Kits/10/Include/10.0.10586.0/um"
+// CHECK-ISYSTEM-AFTER: "-internal-isystem" "Windows 
Kits/10/Include/10.0.10586.0/shared"
+


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


r273015 - [OpenCL] Allow -std={cl|CL}{|1.1|1.2|2.0} in driver

2016-06-17 Thread Yaxun Liu via cfe-commits
Author: yaxunl
Date: Fri Jun 17 12:19:28 2016
New Revision: 273015

URL: http://llvm.org/viewvc/llvm-project?rev=273015=rev
Log:
[OpenCL] Allow -std={cl|CL}{|1.1|1.2|2.0} in driver

Fix a regression which forbids using -std=cl|CL1.1|CL1.2|CL2.0 in driver.

Allow -std and -cl-std={cl|CL}{|1.1|1.2|2.0}.

Differential Revision: http://reviews.llvm.org/D20630

Added:
cfe/trunk/test/Driver/opencl.cl
Modified:
cfe/trunk/include/clang/Frontend/LangStandards.def
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/test/Frontend/stdlang.c

Modified: cfe/trunk/include/clang/Frontend/LangStandards.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/LangStandards.def?rev=273015=273014=273015=diff
==
--- cfe/trunk/include/clang/Frontend/LangStandards.def (original)
+++ cfe/trunk/include/clang/Frontend/LangStandards.def Fri Jun 17 12:19:28 2016
@@ -19,6 +19,14 @@
 /// \param FEATURES - The standard features as flags, these are enums from the
 /// clang::frontend namespace, which is assumed to be be available.
 
+/// LANGSTANDARD_ALIAS(IDENT, ALIAS)
+/// \param IDENT - The name of the standard as a C++ identifier.
+/// \param ALIAS - The alias of the standard.
+
+#ifndef LANGSTANDARD_ALIAS
+#define LANGSTANDARD_ALIAS(IDENT, ALIAS)
+#endif
+
 // C89-ish modes.
 LANGSTANDARD(c89, "c89",
  "ISO C 1990",
@@ -135,19 +143,26 @@ LANGSTANDARD(gnucxx1z, "gnu++1z",
 LANGSTANDARD(opencl, "cl",
  "OpenCL 1.0",
  LineComment | C99 | Digraphs | HexFloat)
-LANGSTANDARD(opencl11, "CL1.1",
+LANGSTANDARD(opencl11, "cl1.1",
  "OpenCL 1.1",
  LineComment | C99 | Digraphs | HexFloat)
-LANGSTANDARD(opencl12, "CL1.2",
+LANGSTANDARD(opencl12, "cl1.2",
  "OpenCL 1.2",
  LineComment | C99 | Digraphs | HexFloat)
-LANGSTANDARD(opencl20, "CL2.0",
+LANGSTANDARD(opencl20, "cl2.0",
  "OpenCL 2.0",
  LineComment | C99 | Digraphs | HexFloat)
 
+LANGSTANDARD_ALIAS(opencl, "CL")
+LANGSTANDARD_ALIAS(opencl11, "CL1.1")
+LANGSTANDARD_ALIAS(opencl12, "CL1.2")
+LANGSTANDARD_ALIAS(opencl20, "CL2.0")
+
 // CUDA
 LANGSTANDARD(cuda, "cuda",
  "NVIDIA CUDA(tm)",
  LineComment | CPlusPlus | Digraphs)
 
 #undef LANGSTANDARD
+#undef LANGSTANDARD_ALIAS
+

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=273015=273014=273015=diff
==
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Fri Jun 17 12:19:28 2016
@@ -1450,6 +1450,13 @@ static void ParseHeaderSearchArgs(Header
 Opts.AddVFSOverlayFile(A->getValue());
 }
 
+bool isOpenCL(LangStandard::Kind LangStd) {
+  return LangStd == LangStandard::lang_opencl
+|| LangStd == LangStandard::lang_opencl11
+|| LangStd == LangStandard::lang_opencl12
+|| LangStd == LangStandard::lang_opencl20;
+}
+
 void CompilerInvocation::setLangDefaults(LangOptions , InputKind IK,
  const llvm::Triple ,
  LangStandard::Kind LangStd) {
@@ -1517,7 +1524,7 @@ void CompilerInvocation::setLangDefaults
   Opts.ImplicitInt = Std.hasImplicitInt();
 
   // Set OpenCL Version.
-  Opts.OpenCL = LangStd == LangStandard::lang_opencl || IK == IK_OpenCL;
+  Opts.OpenCL = isOpenCL(LangStd) || IK == IK_OpenCL;
   if (LangStd == LangStandard::lang_opencl)
 Opts.OpenCLVersion = 100;
   else if (LangStd == LangStandard::lang_opencl11)
@@ -1589,6 +1596,8 @@ static void ParseLangArgs(LangOptions 
 LangStd = llvm::StringSwitch(A->getValue())
 #define LANGSTANDARD(id, name, desc, features) \
   .Case(name, LangStandard::lang_##id)
+#define LANGSTANDARD_ALIAS(id, alias) \
+  .Case(alias, LangStandard::lang_##id)
 #include "clang/Frontend/LangStandards.def"
   .Default(LangStandard::lang_unspecified);
 if (LangStd == LangStandard::lang_unspecified)
@@ -1616,8 +1625,9 @@ static void ParseLangArgs(LangOptions 
 << A->getAsString(Args) << "C++/ObjC++";
 break;
   case IK_OpenCL:
-Diags.Report(diag::err_drv_argument_not_allowed_with)
-  << A->getAsString(Args) << "OpenCL";
+if (!isOpenCL(LangStd))
+  Diags.Report(diag::err_drv_argument_not_allowed_with)
+<< A->getAsString(Args) << "OpenCL";
 break;
   case IK_CUDA:
   case IK_PreprocessedCuda:
@@ -1636,10 +1646,10 @@ static void ParseLangArgs(LangOptions 
   if (const Arg *A = Args.getLastArg(OPT_cl_std_EQ)) {
 LangStandard::Kind OpenCLLangStd
 = llvm::StringSwitch(A->getValue())
-.Case("CL", LangStandard::lang_opencl)
-.Case("CL1.1", LangStandard::lang_opencl11)
-.Case("CL1.2", LangStandard::lang_opencl12)
-

Re: [PATCH] D14727: [Driver] Adapt Linux::GCCVersion::Parse to match GCC 5 installations

2016-06-17 Thread Bryan Chan via cfe-commits
bryanpkc added a comment.

Thanks for the review! I have committed the patch.


http://reviews.llvm.org/D14727



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


r273012 - [Driver] Adapt Linux::GCCVersion::Parse to match GCC 5 installations

2016-06-17 Thread Bryan Chan via cfe-commits
Author: bryanpkc
Date: Fri Jun 17 11:47:14 2016
New Revision: 273012

URL: http://llvm.org/viewvc/llvm-project?rev=273012=rev
Log:
[Driver] Adapt Linux::GCCVersion::Parse to match GCC 5 installations

Summary:
Some GCC 5 installations store the libstdc++ includes and GCC-specific files in 
paths without 
the minor part of the version number, such as

  /usr/include/c++/5
  /usr/lib64/gcc/x86_64-suse-linux/5

Reviewers: cfe-commits, thiagomacieira, jroelofs

Subscribers: tinti, jroelofs

Differential Revision: http://reviews.llvm.org/D14727

Added:
cfe/trunk/test/Driver/Inputs/gcc_version_parsing5/
cfe/trunk/test/Driver/Inputs/gcc_version_parsing5/bin/
cfe/trunk/test/Driver/Inputs/gcc_version_parsing5/bin/.keep
cfe/trunk/test/Driver/Inputs/gcc_version_parsing5/lib/
cfe/trunk/test/Driver/Inputs/gcc_version_parsing5/lib/gcc/

cfe/trunk/test/Driver/Inputs/gcc_version_parsing5/lib/gcc/i386-unknown-linux/

cfe/trunk/test/Driver/Inputs/gcc_version_parsing5/lib/gcc/i386-unknown-linux/4.9.2/

cfe/trunk/test/Driver/Inputs/gcc_version_parsing5/lib/gcc/i386-unknown-linux/4.9.2/crtbegin.o

cfe/trunk/test/Driver/Inputs/gcc_version_parsing5/lib/gcc/i386-unknown-linux/5/

cfe/trunk/test/Driver/Inputs/gcc_version_parsing5/lib/gcc/i386-unknown-linux/5/crtbegin.o
Modified:
cfe/trunk/lib/Driver/ToolChains.cpp
cfe/trunk/test/Driver/linux-ld.c

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=273012=273011=273012=diff
==
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Fri Jun 17 11:47:14 2016
@@ -1298,6 +1298,8 @@ Generic_GCC::GCCVersion Linux::GCCVersio
   if (First.first.getAsInteger(10, GoodVersion.Major) || GoodVersion.Major < 0)
 return BadVersion;
   GoodVersion.MajorStr = First.first.str();
+  if (First.second.empty())
+return GoodVersion;
   if (Second.first.getAsInteger(10, GoodVersion.Minor) || GoodVersion.Minor < 
0)
 return BadVersion;
   GoodVersion.MinorStr = Second.first.str();
@@ -1305,6 +1307,7 @@ Generic_GCC::GCCVersion Linux::GCCVersio
   // First look for a number prefix and parse that if present. Otherwise just
   // stash the entire patch string in the suffix, and leave the number
   // unspecified. This covers versions strings such as:
+  //   5(handled above)
   //   4.4
   //   4.4.0
   //   4.4.x

Added: cfe/trunk/test/Driver/Inputs/gcc_version_parsing5/bin/.keep
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/gcc_version_parsing5/bin/.keep?rev=273012=auto
==
(empty)

Added: 
cfe/trunk/test/Driver/Inputs/gcc_version_parsing5/lib/gcc/i386-unknown-linux/4.9.2/crtbegin.o
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/gcc_version_parsing5/lib/gcc/i386-unknown-linux/4.9.2/crtbegin.o?rev=273012=auto
==
(empty)

Added: 
cfe/trunk/test/Driver/Inputs/gcc_version_parsing5/lib/gcc/i386-unknown-linux/5/crtbegin.o
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/gcc_version_parsing5/lib/gcc/i386-unknown-linux/5/crtbegin.o?rev=273012=auto
==
(empty)

Modified: cfe/trunk/test/Driver/linux-ld.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/linux-ld.c?rev=273012=273011=273012=diff
==
--- cfe/trunk/test/Driver/linux-ld.c (original)
+++ cfe/trunk/test/Driver/linux-ld.c Fri Jun 17 11:47:14 2016
@@ -388,6 +388,15 @@
 // CHECK-GCC-VERSION4: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
 // CHECK-GCC-VERSION4: 
"{{.*}}/Inputs/gcc_version_parsing4/bin/../lib/gcc/i386-unknown-linux/4.7.99{{/|}}crtbegin.o"
 // CHECK-GCC-VERSION4: 
"-L{{.*}}/Inputs/gcc_version_parsing4/bin/../lib/gcc/i386-unknown-linux/4.7.99"
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: --target=i386-unknown-linux -m32 \
+// RUN: -ccc-install-dir %S/Inputs/gcc_version_parsing5/bin \
+// RUN: --gcc-toolchain="" \
+// RUN: --sysroot=%S/Inputs/basic_linux_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-GCC-VERSION5 %s
+// CHECK-GCC-VERSION5: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-GCC-VERSION5: 
"{{.*}}/Inputs/gcc_version_parsing5/bin/../lib/gcc/i386-unknown-linux/5{{/|}}crtbegin.o"
+// CHECK-GCC-VERSION5: 
"-L{{.*}}/Inputs/gcc_version_parsing5/bin/../lib/gcc/i386-unknown-linux/5"
 //
 // Test a simulated installation of libc++ on Linux, both through sysroot and
 // the installation path of Clang.


___
cfe-commits mailing list
cfe-commits@lists.llvm.org

Re: [PATCH] D20964: [clang-tidy] Add modernize-use-emplace

2016-06-17 Thread Piotr Padlewski via cfe-commits
Prazek added inline comments.


Comment at: test/clang-tidy/modernize-use-emplace.cpp:2
@@ +1,3 @@
+// RUN: %check_clang_tidy %s modernize-use-emplace %t
+
+namespace std {

hokein wrote:
> Could you also add the following case in the test?
> ```
> vector v1;
> v1.push_back(1<<10);
> ```
> 
> Make sure the check won't change to `v1.emplace_back(1<<10)`. Since these two 
> statements have completely different semantic. The first one adds `1024` to 
> `v1` while the second one adds a vector with 1024 elements to `v1`.
I think you have made some mistake, because the code that you have showed 
doesn't compile.


http://reviews.llvm.org/D20964



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


r273008 - [codeview] Stop emitting fully qualified subprogram display names

2016-06-17 Thread Reid Kleckner via cfe-commits
Author: rnk
Date: Fri Jun 17 11:11:20 2016
New Revision: 273008

URL: http://llvm.org/viewvc/llvm-project?rev=273008=rev
Log:
[codeview] Stop emitting fully qualified subprogram display names

This effectively reverts r255744, and leaves the printing option tweaks.

We can add the name qualifiers easily in the backend.

Modified:
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
cfe/trunk/test/CodeGenCXX/debug-info-codeview-display-name.cpp

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=273008=273007=273008=diff
==
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Fri Jun 17 11:11:20 2016
@@ -184,30 +184,24 @@ StringRef CGDebugInfo::getFunctionName(c
   FunctionTemplateSpecializationInfo *Info =
   FD->getTemplateSpecializationInfo();
 
-  if (!Info && FII && !CGM.getCodeGenOpts().EmitCodeView)
+  if (!Info && FII)
 return FII->getName();
 
   // Otherwise construct human readable name for debug info.
   SmallString<128> NS;
   llvm::raw_svector_ostream OS(NS);
   PrintingPolicy Policy(CGM.getLangOpts());
+  Policy.MSVCFormatting = CGM.getCodeGenOpts().EmitCodeView;
 
-  if (CGM.getCodeGenOpts().EmitCodeView) {
-// Print a fully qualified name like MSVC would.
-Policy.MSVCFormatting = true;
-FD->printQualifiedName(OS, Policy);
-  } else {
-// Print the unqualified name with some template arguments. This is what
-// DWARF-based debuggers expect.
-FD->printName(OS);
-// Add any template specialization args.
-if (Info) {
-  const TemplateArgumentList *TArgs = Info->TemplateArguments;
-  const TemplateArgument *Args = TArgs->data();
-  unsigned NumArgs = TArgs->size();
-  TemplateSpecializationType::PrintTemplateArgumentList(OS, Args, NumArgs,
-Policy);
-}
+  // Print the unqualified name with some template arguments.
+  FD->printName(OS);
+  // Add any template specialization args.
+  if (Info) {
+const TemplateArgumentList *TArgs = Info->TemplateArguments;
+const TemplateArgument *Args = TArgs->data();
+unsigned NumArgs = TArgs->size();
+TemplateSpecializationType::PrintTemplateArgumentList(OS, Args, NumArgs,
+  Policy);
   }
 
   // Copy this name on the side and use its reference.

Modified: cfe/trunk/test/CodeGenCXX/debug-info-codeview-display-name.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-codeview-display-name.cpp?rev=273008=273007=273008=diff
==
--- cfe/trunk/test/CodeGenCXX/debug-info-codeview-display-name.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-codeview-display-name.cpp Fri Jun 17 
11:11:20 2016
@@ -6,9 +6,9 @@ void freefunc() { }
 
 namespace N {
   int b() { return 0; }
-// CHECK-DAG: "N::b"
+// CHECK-DAG: "b"
   namespace { void func() { } }
-// CHECK-DAG: "N::`anonymous namespace'::func
+// CHECK-DAG: "func"
 }
 
 void _c(void) {
@@ -19,19 +19,19 @@ void _c(void) {
 struct foo {
   int operator+(int);
   foo(){}
-// CHECK-DAG: "foo::foo"
+// CHECK-DAG: "foo"
 
   ~foo(){}
-// CHECK-DAG: "foo::~foo"
+// CHECK-DAG: "~foo"
 
   foo(int i){}
-// CHECK-DAG: "foo::foo"
+// CHECK-DAG: "foo"
 
   foo(char *q){}
-// CHECK-DAG: "foo::foo"
+// CHECK-DAG: "foo"
 
   static foo* static_method() { return 0; }
-// CHECK-DAG: "foo::static_method"
+// CHECK-DAG: "static_method"
 
 };
 
@@ -40,7 +40,7 @@ void use_foo() {
   foo::static_method();
 }
 
-// CHECK-DAG: "foo::operator+"
+// CHECK-DAG: "operator+"
 int foo::operator+(int a) { return a; }
 
 // PR17371
@@ -60,14 +60,14 @@ void OverloadedNewDelete::operator delet
 void OverloadedNewDelete::operator delete[](void *) { }
 int OverloadedNewDelete::operator+(int x) { return x; };
 
-// CHECK-DAG: "OverloadedNewDelete::operator new"
-// CHECK-DAG: "OverloadedNewDelete::operator new[]"
-// CHECK-DAG: "OverloadedNewDelete::operator delete"
-// CHECK-DAG: "OverloadedNewDelete::operator delete[]"
-// CHECK-DAG: "OverloadedNewDelete::operator+"
+// CHECK-DAG: "operator new"
+// CHECK-DAG: "operator new[]"
+// CHECK-DAG: "operator delete"
+// CHECK-DAG: "operator delete[]"
+// CHECK-DAG: "operator+"
 
-template 
+template 
 void fn_tmpl() {}
 
-template void fn_tmpl();
-// CHECK-DAG: "fn_tmpl"
+template void fn_tmpl();
+// CHECK-DAG: "fn_tmpl"


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


Re: [PATCH] D14727: [Driver] Adapt Linux::GCCVersion::Parse to match GCC 5 installations

2016-06-17 Thread Jonathan Roelofs via cfe-commits
jroelofs accepted this revision.
jroelofs added a comment.
This revision is now accepted and ready to land.

LGTM. Do you want me to commit it for you?


http://reviews.llvm.org/D14727



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


Re: [PATCH] D20647: Add flag to add InlineHint attribute on implicitly inline functions

2016-06-17 Thread Reid Kleckner via cfe-commits
rnk added a comment.

In http://reviews.llvm.org/D20647#460520, @Ilod wrote:

> I don't think weak linkage defines this.


Right, sorry, normal external linkage is the obvious case. I was hung up 
thinking about cases like this:

  volatile int x;
  template 
  struct A {
void f();
void g() { ++x; } // implicitly inline
  };
  template 
  void A::f() { ++x; } // not inline
  int main() {
A a;
a.f(); // not inlined with /Ob1
a.g(); // inlined with /Ob1
  }

In this code, A::g has weak linkage but is not inline. MSVC will not inline it 
with /Ob1.

Can you get the behavior you want by doing `if (!FD->isInlined()) 
Fn->addFnAttr(llvm::Attribute::NoInline);` instead? It seems nicer because we 
don't need to thread any options to the inliner, like you did in 
http://reviews.llvm.org/D20603.


http://reviews.llvm.org/D20647



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


Re: [PATCH] D20964: [clang-tidy] Add modernize-use-emplace

2016-06-17 Thread Haojian Wu via cfe-commits
hokein added a comment.

A few comments.



Comment at: clang-tidy/modernize/ModernizeTidyModule.cpp:59
@@ -57,2 +58,3 @@
 CheckFactories.registerCheck("modernize-use-nullptr");
+CheckFactories.registerCheck("modernize-use-emplace");
 CheckFactories.registerCheck("modernize-use-override");

Alphabetical order.


Comment at: clang-tidy/modernize/UseEmplaceCheck.cpp:37
@@ +36,3 @@
+  // We can't replace push_backs of smart pointer because
+  // if emplacement will fail (f.e. bad_alloc in vector) we will have leak of
+  // passed pointer because smart pointer won't be constructed

remove the `will` here? if emplacement fails, we will ...


Comment at: clang-tidy/modernize/UseEmplaceCheck.cpp:78
@@ +77,3 @@
+
+  // Range for constructor name and opening brace
+  auto ctorCallSourceRange = CharSourceRange::getCharRange(

missing `.` at the end of sentence.


Comment at: clang-tidy/modernize/UseEmplaceCheck.h:19
@@ +18,3 @@
+
+/// This check look for cases when inserting new element into std::vector but
+/// the element is constructed temporarily.

s/look/looks


Comment at: docs/clang-tidy/checks/modernize-use-emplace.rst:6
@@ +5,3 @@
+
+This check look for cases when inserting new element into an STL
+container, but the element is constructed temporarily.

s/look/looks


Comment at: test/clang-tidy/modernize-use-emplace.cpp:2
@@ +1,3 @@
+// RUN: %check_clang_tidy %s modernize-use-emplace %t
+
+namespace std {

Could you also add the following case in the test?
```
vector v1;
v1.push_back(1<<10);
```

Make sure the check won't change to `v1.emplace_back(1<<10)`. Since these two 
statements have completely different semantic. The first one adds `1024` to 
`v1` while the second one adds a vector with 1024 elements to `v1`.


Comment at: test/clang-tidy/modernize-use-emplace.cpp:94
@@ +93,3 @@
+  v.push_back(S{1, 2});
+  // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use emplace_back {{..}}
+  // CHECK-FIXES: v.emplace_back(1, 2);

I think you can remove the `{{..}}`.


http://reviews.llvm.org/D20964



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


Re: [PATCH] D21472: [clang-tidy] readability-identifier-naming - support for other case types

2016-06-17 Thread James Reynolds via cfe-commits
JamesReynolds added a comment.

I'm not 100% sure that my regexes are the best balance between readability and 
terseness - or that I've named the case types particularly well. If there are 
better ideas for either of those things I'm very happy to accept criticism!


http://reviews.llvm.org/D21472



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


[PATCH] D21472: [clang-tidy] readability-identifier-naming - support for other case types

2016-06-17 Thread James Reynolds via cfe-commits
JamesReynolds created this revision.
JamesReynolds added a reviewer: alexfh.
JamesReynolds added a subscriber: cfe-commits.

Added Stroustrup_Case and stroustrup_Back 
(http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#S-naming)

```
class Stroustrup_Case_Class_Name
{
  void private_Stroustrup_Back_Method_Name();
}
```

http://reviews.llvm.org/D21472

Files:
  clang-tidy/readability/IdentifierNamingCheck.cpp
  clang-tidy/readability/IdentifierNamingCheck.h
  test/clang-tidy/readability-identifier-naming.cpp

Index: test/clang-tidy/readability-identifier-naming.cpp
===
--- test/clang-tidy/readability-identifier-naming.cpp
+++ test/clang-tidy/readability-identifier-naming.cpp
@@ -59,10 +59,10 @@
 // RUN: {key: readability-identifier-naming.UsingCase, value: lower_case}, \
 // RUN: {key: readability-identifier-naming.ValueTemplateParameterCase, value: camelBack}, \
 // RUN: {key: readability-identifier-naming.VariableCase, value: lower_case}, \
-// RUN: {key: readability-identifier-naming.VirtualMethodCase, value: UPPER_CASE}, \
+// RUN: {key: readability-identifier-naming.VirtualMethodCase, value: Stroustrup_Case}, \
 // RUN: {key: readability-identifier-naming.VirtualMethodPrefix, value: 'v_'}, \
 // RUN: {key: readability-identifier-naming.MacroDefinitionCase, value: UPPER_CASE}, \
-// RUN: {key: readability-identifier-naming.TypeAliasCase, value: lower_case}, \
+// RUN: {key: readability-identifier-naming.TypeAliasCase, value: stroustrup_Back}, \
 // RUN: {key: readability-identifier-naming.TypeAliasSuffix, value: '_t'}, \
 // RUN: {key: readability-identifier-naming.IgnoreFailedSplit, value: 0} \
 // RUN:   ]}' -- -std=c++11 -fno-delayed-template-parsing \
@@ -261,7 +261,7 @@
 // CHECK-FIXES: {{^}}virtual ~AAbstractClass() = 0;{{$}}
 virtual void VIRTUAL_METHOD();
 // CHECK-MESSAGES: :[[@LINE-1]]:18: warning: invalid case style for virtual method 'VIRTUAL_METHOD'
-// CHECK-FIXES: {{^}}virtual void v_VIRTUAL_METHOD();{{$}}
+// CHECK-FIXES: {{^}}virtual void v_Virtual_Method();{{$}}
 void non_Virtual_METHOD() {}
 // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: invalid case style for private method 'non_Virtual_METHOD'
 // CHECK-FIXES: {{^}}void __non_Virtual_METHOD() {}{{$}}
@@ -316,12 +316,12 @@
 
 using my_struct_type = THIS___Structure;
 // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for type alias 'my_struct_type'
-// CHECK-FIXES: {{^}}using my_struct_type_t = this_structure;{{$}}
+// CHECK-FIXES: {{^}}using my_Struct_Type_t = this_structure;{{$}}
 
 template
 using SomeOtherTemplate = my_other_templated_class  <:: FOO_NS  ::my_class>;
 // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for type alias 'SomeOtherTemplate'
-// CHECK-FIXES: {{^}}using some_other_template_t = CMyOtherTemplatedClass  <:: foo_ns  ::CMyClass>;{{$}}
+// CHECK-FIXES: {{^}}using some_Other_Template_t = CMyOtherTemplatedClass  <:: foo_ns  ::CMyClass>;{{$}}
 
 static void static_Function() {
 // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: invalid case style for function 'static_Function'
Index: clang-tidy/readability/IdentifierNamingCheck.h
===
--- clang-tidy/readability/IdentifierNamingCheck.h
+++ clang-tidy/readability/IdentifierNamingCheck.h
@@ -48,6 +48,8 @@
 CT_CamelBack,
 CT_UpperCase,
 CT_CamelCase,
+CT_StroustrupCase,
+CT_StroustrupBack
   };
 
   struct NamingStyle {
Index: clang-tidy/readability/IdentifierNamingCheck.cpp
===
--- clang-tidy/readability/IdentifierNamingCheck.cpp
+++ clang-tidy/readability/IdentifierNamingCheck.cpp
@@ -163,6 +163,8 @@
 .Case("UPPER_CASE", CT_UpperCase)
 .Case("camelBack", CT_CamelBack)
 .Case("CamelCase", CT_CamelCase)
+.Case("Stroustrup_Case", CT_StroustrupCase)
+.Case("stroustrup_Back", CT_StroustrupBack)
 .Default(CT_AnyCase);
   };
 
@@ -189,6 +191,10 @@
   return "UPPER_CASE";
 case CT_CamelCase:
   return "CamelCase";
+case CT_StroustrupCase:
+  return "Stroustrup_Case";
+case CT_StroustrupBack:
+  return "stroustrup_Back";
 }
 
 llvm_unreachable("Unknown Case Type");
@@ -230,6 +236,8 @@
   llvm::Regex("^[a-z][a-zA-Z0-9]*$"),
   llvm::Regex("^[A-Z][A-Z0-9_]*$"),
   llvm::Regex("^[A-Z][a-zA-Z0-9]*$"),
+  llvm::Regex("^[A-Z]([a-z0-9]*(_[A-Z])?)*"),
+  llvm::Regex("^[a-z]([a-z0-9]*(_[A-Z])?)*"),
   };
 
   bool Matches = true;
@@ -319,6 +327,27 @@
   }
 }
 break;
+
+  case IdentifierNamingCheck::CT_StroustrupCase:
+for (auto const  : Words) {
+  if ( != ())
+Fixup += "_";
+  Fixup += Word.substr(0, 1).upper();
+  Fixup += Word.substr(1).lower();
+}
+break;
+
+  case IdentifierNamingCheck::CT_StroustrupBack:
+for (auto const  : 

Re: [PATCH] D21295: Add a negative TBAA test

2016-06-17 Thread James Molloy via cfe-commits
jmolloy added a comment.

Private reply:

fine by me but a clang person needs to a accept it.


http://reviews.llvm.org/D21295



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


r273003 - [X86][SSE4A] Use native IR for mask movntsd/movntss intrinsics.

2016-06-17 Thread Simon Pilgrim via cfe-commits
Author: rksimon
Date: Fri Jun 17 09:28:16 2016
New Revision: 273003

URL: http://llvm.org/viewvc/llvm-project?rev=273003=rev
Log:
[X86][SSE4A] Use native IR for mask movntsd/movntss intrinsics.

Depends on llvm side commit r273002.

Modified:
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/test/CodeGen/sse4a-builtins.c

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=273003=273002=273003=diff
==
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Fri Jun 17 09:28:16 2016
@@ -6848,6 +6848,26 @@ Value *CodeGenFunction::EmitX86BuiltinEx
 SI->setAlignment(1);
 return SI;
   }
+  case X86::BI__builtin_ia32_movntsd:
+  case X86::BI__builtin_ia32_movntss: {
+llvm::MDNode *Node = llvm::MDNode::get(
+getLLVMContext(), llvm::ConstantAsMetadata::get(Builder.getInt32(1)));
+
+// Extract the 0'th element of the source vector.
+Value *Scl = Builder.CreateExtractElement(Ops[1], (uint64_t)0, "extract");
+
+// Convert the type of the pointer to a pointer to the stored type.
+Value *BC = Builder.CreateBitCast(Ops[0],
+llvm::PointerType::getUnqual(Scl->getType()),
+  "cast");
+
+// Unaligned nontemporal store of the scalar value.
+StoreInst *SI = Builder.CreateDefaultAlignedStore(Scl, BC);
+SI->setMetadata(CGM.getModule().getMDKindID("nontemporal"), Node);
+SI->setAlignment(1);
+return SI;
+  }
+
   case X86::BI__builtin_ia32_selectb_128:
   case X86::BI__builtin_ia32_selectb_256:
   case X86::BI__builtin_ia32_selectb_512:

Modified: cfe/trunk/test/CodeGen/sse4a-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/sse4a-builtins.c?rev=273003=273002=273003=diff
==
--- cfe/trunk/test/CodeGen/sse4a-builtins.c (original)
+++ cfe/trunk/test/CodeGen/sse4a-builtins.c Fri Jun 17 09:28:16 2016
@@ -33,12 +33,14 @@ __m128i test_mm_insert_si64(__m128i x, _
 
 void test_mm_stream_sd(double *p, __m128d a) {
   // CHECK-LABEL: test_mm_stream_sd
-  // CHECK: call void @llvm.x86.sse4a.movnt.sd(i8* %{{[^,]+}}, <2 x double> 
%{{[^,]+}})
-  _mm_stream_sd(p, a);
+  // CHECK: extractelement <2 x double> %{{.*}}, i64 0
+  // CHECK: store double %{{.*}}, double* %{{.*}}, align 1, !nontemporal
+   _mm_stream_sd(p, a);
 }
 
 void test_mm_stream_ss(float *p, __m128 a) {
   // CHECK-LABEL: test_mm_stream_ss
-  // CHECK: call void @llvm.x86.sse4a.movnt.ss(i8* %{{[^,]+}}, <4 x float> 
%{{[^,]+}})
+  // CHECK: extractelement <4 x float> %{{.*}}, i64 0
+  // CHECK: store float %{{.*}}, float* %{{.*}}, align 1, !nontemporal
   _mm_stream_ss(p, a);
 }


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


Re: [PATCH] D21303: [clang-tidy] Adds performance-returning-type check.

2016-06-17 Thread Piotr Padlewski via cfe-commits
Prazek added a comment.

In http://reviews.llvm.org/D21303#460814, @alexfh wrote:

> 3. What's so special about `return`? Looks like a more general problem is: 
> passing an lvalue to a function/constructor/operator by const reference where 
> it could instead be moved (the lvalue isn't used afterwards and the 
> appropriate overload for rvalue reference is available).


Yes, you are right. We could generalize it more to suggest std::move for any 
last usage of variable (if there would be rvalue overload), but it is harde to 
do than this. The special thing about return, is that in most cases you 
shouldn't write 'return std::move(...)', so we want to find the cases where you 
should do it.


Repository:
  rL LLVM

http://reviews.llvm.org/D21303



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


Re: [PATCH] D21295: Add a negative TBAA test

2016-06-17 Thread Roger Ferrer Ibanez via cfe-commits
rogfer01 added a comment.

Ping? Thank you.


http://reviews.llvm.org/D21295



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


[PATCH] D21470: [clang-tidy] Don't run misc-definitions-in-headers check in failing TUs.

2016-06-17 Thread Haojian Wu via cfe-commits
hokein created this revision.
hokein added a reviewer: alexfh.
hokein added a subscriber: cfe-commits.

http://reviews.llvm.org/D21470

Files:
  clang-tidy/misc/DefinitionsInHeadersCheck.cpp

Index: clang-tidy/misc/DefinitionsInHeadersCheck.cpp
===
--- clang-tidy/misc/DefinitionsInHeadersCheck.cpp
+++ clang-tidy/misc/DefinitionsInHeadersCheck.cpp
@@ -72,6 +72,10 @@
 }
 
 void DefinitionsInHeadersCheck::check(const MatchFinder::MatchResult ) {
+  // Don't run the check in failing TUs.
+  if (Result.Context->getDiagnostics().hasErrorOccurred())
+return;
+
   // C++ [basic.def.odr] p6:
   // There can be more than one definition of a class type, enumeration type,
   // inline function with external linkage, class template, non-static function


Index: clang-tidy/misc/DefinitionsInHeadersCheck.cpp
===
--- clang-tidy/misc/DefinitionsInHeadersCheck.cpp
+++ clang-tidy/misc/DefinitionsInHeadersCheck.cpp
@@ -72,6 +72,10 @@
 }
 
 void DefinitionsInHeadersCheck::check(const MatchFinder::MatchResult ) {
+  // Don't run the check in failing TUs.
+  if (Result.Context->getDiagnostics().hasErrorOccurred())
+return;
+
   // C++ [basic.def.odr] p6:
   // There can be more than one definition of a class type, enumeration type,
   // inline function with external linkage, class template, non-static function
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20382: Add postorder support to RecursiveASTVisitor

2016-06-17 Thread Raphael Isemann via cfe-commits
teemperor added a comment.

ping


http://reviews.llvm.org/D20382



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


Re: [PATCH] D20389: NVPTX: Add supported CL features

2016-06-17 Thread Justin Holewinski via cfe-commits
jholewinski accepted this revision.
jholewinski added a comment.
This revision is now accepted and ready to land.

Looks good to me


Repository:
  rL LLVM

http://reviews.llvm.org/D20389



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


Re: [PATCH] D20561: Warn when taking address of packed member

2016-06-17 Thread Roger Ferrer Ibanez via cfe-commits
rogfer01 updated this revision to Diff 61089.
rogfer01 added a comment.

Following @rsmith suggestion, the diagnostic is silenced if the address is 
converted to a pointer with lower or equal alignment requirements.


http://reviews.llvm.org/D20561

Files:
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Sema/Sema.h
  lib/Sema/SemaCast.cpp
  lib/Sema/SemaChecking.cpp
  lib/Sema/SemaExpr.cpp
  lib/Sema/SemaInit.cpp
  test/Sema/address-packed-member-memops.c
  test/Sema/address-packed.c
  test/SemaCXX/address-packed-member-memops.cpp
  test/SemaCXX/address-packed.cpp

Index: test/SemaCXX/address-packed.cpp
===
--- /dev/null
+++ test/SemaCXX/address-packed.cpp
@@ -0,0 +1,118 @@
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
+extern void f1(int *);
+extern void f2(char *);
+
+struct __attribute__((packed)) Arguable {
+  int x;
+  char c;
+  static void foo();
+};
+
+extern void f3(void());
+
+namespace Foo {
+struct __attribute__((packed)) Arguable {
+  char c;
+  int x;
+  static void foo();
+};
+}
+
+struct Arguable *get_arguable();
+
+void f4(int &);
+
+void to_void(void *);
+
+template 
+void sink(T...);
+
+void g0() {
+  {
+Foo::Arguable arguable;
+f1();   // expected-warning {{packed member 'x' of class or structure 'Foo::Arguable'}}
+f2();   // no-warning
+f3(); // no-warning
+
+int  = arguable.x; // expected-error {{binding reference to packed member 'x' of class or structure 'Foo::Arguable'}}
+sink(w);
+f4(arguable.x); // expected-error {{binding reference to packed member 'x' of class or structure 'Foo::Arguable'}}
+
+to_void(); // no-warning
+void *p1 =// no-warning
+void *p2 = static_cast();  // no-warning
+void *p3 = reinterpret_cast(); // no-warning
+void *p4 = (void *)   // no-warning
+sink(p1, p2, p3, p4);
+  }
+  {
+Arguable arguable1;
+Arguable (arguable1);
+f1();   // expected-warning {{packed member 'x' of class or structure 'Arguable'}}
+f2();   // no-warning
+f3(); // no-warning
+  }
+  {
+Arguable *arguable1;
+Arguable *(arguable1);
+f1(>x);   // expected-warning {{packed member 'x' of class or structure 'Arguable'}}
+f2(>c);   // no-warning
+f3(>foo); // no-warning
+  }
+}
+
+struct __attribute__((packed)) A {
+  int x;
+  char c;
+
+  int *f0() {
+return >x; // expected-warning {{packed member 'x' of class or structure 'A'}}
+  }
+
+  int *g0() {
+return  // expected-warning {{packed member 'x' of class or structure 'A'}}
+  }
+
+  char *h0() {
+return  // no-warning
+  }
+};
+
+struct B : A {
+  int *f1() {
+return >x; // expected-warning {{packed member 'x' of class or structure 'A'}}
+  }
+
+  int *g1() {
+return  // expected-warning {{packed member 'x' of class or structure 'A'}}
+  }
+
+  char *h1() {
+return  // no-warning
+  }
+};
+
+template 
+class __attribute__((packed)) S {
+  Ty X;
+
+public:
+  const Ty *get() const {
+return  // expected-warning {{packed member 'X' of class or structure 'S'}}
+   // expected-warning@-1 {{packed member 'X' of class or structure 'S'}}
+  }
+};
+
+template 
+void h(Ty *);
+
+void g1() {
+  S s1;
+  s1.get(); // expected-note {{in instantiation of member function 'S::get'}}
+
+  S s2;
+  s2.get();
+
+  S s3;
+  s3.get(); // expected-note {{in instantiation of member function 'S::get'}}
+}
Index: test/SemaCXX/address-packed-member-memops.cpp
===
--- /dev/null
+++ test/SemaCXX/address-packed-member-memops.cpp
@@ -0,0 +1,28 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
+
+struct B {
+  int x, y, z, w;
+} b;
+
+struct __attribute__((packed)) A {
+  struct B b;
+} a;
+
+typedef __typeof__(sizeof(int)) size_t;
+
+extern "C" {
+void *memcpy(void *dest, const void *src, size_t n);
+int memcmp(const void *s1, const void *s2, size_t n);
+void *memmove(void *dest, const void *src, size_t n);
+void *memset(void *s, int c, size_t n);
+}
+
+int x;
+
+void foo() {
+  memcpy(, , sizeof(b));
+  memmove(, , sizeof(b));
+  memset(, 0, sizeof(b));
+  x = memcmp(, , sizeof(b));
+}
Index: test/Sema/address-packed.c
===
--- /dev/null
+++ test/Sema/address-packed.c
@@ -0,0 +1,160 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+extern void f1(int *);
+extern void f2(char *);
+
+struct Ok {
+  char c;
+  int x;
+};
+
+struct __attribute__((packed)) Arguable {
+  char c0;
+  int x;
+  char c1;
+};
+
+union __attribute__((packed)) UnionArguable {
+  char c;
+  int x;
+};
+
+typedef struct Arguable ArguableT;
+
+struct Arguable *get_arguable();
+
+void to_void(void *);
+
+void g0(void) {
+  {
+struct Ok ok;
+f1(); // no-warning
+f2(); // no-warning
+  }
+  {
+struct Arguable arguable;
+f2(); // no-warning
+ 

[PATCH] D21469: Add -mno-iamcu option

2016-06-17 Thread Andrey Turetskiy via cfe-commits
aturetsk created this revision.
aturetsk added reviewers: bruno, echristo.
aturetsk added subscribers: cfe-commits, zinovy.nis.
Herald added a subscriber: mehdi_amini.

Add -mno-iamcu option to:
1) Countervail -miamcu option easily
2) Be compatible with GCC which supports this option

http://reviews.llvm.org/D21469

Files:
  include/clang/Driver/Options.td
  lib/Driver/Driver.cpp
  lib/Driver/Tools.cpp
  test/Driver/miamcu-opt.c

Index: test/Driver/miamcu-opt.c
===
--- test/Driver/miamcu-opt.c
+++ test/Driver/miamcu-opt.c
@@ -4,16 +4,20 @@
 // RUN: %clang -miamcu -no-canonical-prefixes %s -### -o %t.o 2>&1 | FileCheck %s
 // RUN: %clang -miamcu -no-canonical-prefixes -m32 %s -### -o %t.o 2>&1 | FileCheck %s
 // RUN: %clang -miamcu -no-canonical-prefixes -target x86_64-unknown-linux-gnu %s -### -o %t.o 2>&1 | FileCheck %s
+// RUN: %clang -mno-iamcu -miamcu -no-canonical-prefixes %s -### -o %t.o 2>&1 | FileCheck %s
 // RUN: %clang -miamcu -no-canonical-prefixes -m64 %s -### -o %t.o 2>&1 | FileCheck %s -check-prefix=M64
 // RUN: %clang -miamcu -no-canonical-prefixes -dynamic %s -### -o %t.o 2>&1 | FileCheck %s -check-prefix=DYNAMIC
 // RUN: %clang -miamcu -no-canonical-prefixes  -target armv8-eabi %s -### -o %t.o 2>&1 | FileCheck %s -check-prefix=NOT-X86
+// RUN: %clang -miamcu -mno-iamcu -no-canonical-prefixes -target x86_64-unknown-linux-gnu %s -### -o %t.o 2>&1 | FileCheck %s -check-prefix=MNOIAMCU
 
 // M64: error: invalid argument '-miamcu' not allowed with '-m64'
 
 // DYNAMIC: error: invalid argument '-dynamic' not allowed with '-static'
 
 // NOT-X86: error: unsupported option '-miamcu' for target 'armv8---eabi'
 
+// MNOIAMCU-NOT: "-triple" "i586-intel-elfiamcu"
+
 // CHECK: "{{.*}}clang{{.*}}" "-cc1"
 // CHECK: "-triple" "i586-intel-elfiamcu"
 // CHECK: "-static-define"
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -2236,10 +2236,12 @@
   }
 
   // Set flags to support MCU ABI.
-  if (Args.hasArg(options::OPT_miamcu)) {
-CmdArgs.push_back("-mfloat-abi");
-CmdArgs.push_back("soft");
-CmdArgs.push_back("-mstack-alignment=4");
+  if (Arg *A = Args.getLastArg(options::OPT_miamcu, options::OPT_mno_iamcu)) {
+if (A->getOption().matches(options::OPT_miamcu)) {
+  CmdArgs.push_back("-mfloat-abi");
+  CmdArgs.push_back("soft");
+  CmdArgs.push_back("-mstack-alignment=4");
+}
   }
 }
 
Index: lib/Driver/Driver.cpp
===
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -280,8 +280,9 @@
   }
 
   // Enforce -static if -miamcu is present.
-  if (Args.hasArg(options::OPT_miamcu))
-DAL->AddFlagArg(0, Opts->getOption(options::OPT_static));
+  if (Arg *Ar = Args.getLastArg(options::OPT_miamcu, options::OPT_mno_iamcu))
+if (Ar->getOption().matches(options::OPT_miamcu))
+  DAL->AddFlagArg(0, Opts->getOption(options::OPT_static));
 
 // Add a default value of -mlinker-version=, if one was given and the user
 // didn't specify one.
@@ -375,22 +376,24 @@
   }
 
   // Handle -miamcu flag.
-  if (Args.hasArg(options::OPT_miamcu)) {
-if (Target.get32BitArchVariant().getArch() != llvm::Triple::x86)
-  D.Diag(diag::err_drv_unsupported_opt_for_target) << "-miamcu"
-   << Target.str();
-
-if (A && !A->getOption().matches(options::OPT_m32))
-  D.Diag(diag::err_drv_argument_not_allowed_with)
-  << "-miamcu" << A->getBaseArg().getAsString(Args);
-
-Target.setArch(llvm::Triple::x86);
-Target.setArchName("i586");
-Target.setEnvironment(llvm::Triple::UnknownEnvironment);
-Target.setEnvironmentName("");
-Target.setOS(llvm::Triple::ELFIAMCU);
-Target.setVendor(llvm::Triple::UnknownVendor);
-Target.setVendorName("intel");
+  if (Arg *Ar = Args.getLastArg(options::OPT_miamcu, options::OPT_mno_iamcu)) {
+if (Ar->getOption().matches(options::OPT_miamcu)) {
+  if (Target.get32BitArchVariant().getArch() != llvm::Triple::x86)
+D.Diag(diag::err_drv_unsupported_opt_for_target) << "-miamcu"
+ << Target.str();
+
+  if (A && !A->getOption().matches(options::OPT_m32))
+D.Diag(diag::err_drv_argument_not_allowed_with)
+<< "-miamcu" << A->getBaseArg().getAsString(Args);
+
+  Target.setArch(llvm::Triple::x86);
+  Target.setArchName("i586");
+  Target.setEnvironment(llvm::Triple::UnknownEnvironment);
+  Target.setEnvironmentName("");
+  Target.setOS(llvm::Triple::ELFIAMCU);
+  Target.setVendor(llvm::Triple::UnknownVendor);
+  Target.setVendorName("intel");
+}
   }
 
   return Target;
Index: include/clang/Driver/Options.td
===
--- include/clang/Driver/Options.td
+++ 

Re: [PATCH] D20561: Warn when taking address of packed member

2016-06-17 Thread Roger Ferrer Ibanez via cfe-commits
rogfer01 marked an inline comment as done.
rogfer01 added a comment.

http://reviews.llvm.org/D20561



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


Re: [PATCH] D21243: Fix clang-tidy patterns to adapt to newly added ExprWithCleanups nodes.

2016-06-17 Thread Alexander Kornienko via cfe-commits
alexfh accepted this revision.
alexfh added a comment.
This revision is now accepted and ready to land.

Yes, you're probably not the right person to fix our test coverage. Thanks for 
fixing the stuff that broke and I hope we'll figure out what else needs to be 
fixed in a finite time after the change is committed ;)

LG


http://reviews.llvm.org/D21243



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


Re: [PATCH] D19201: [clang-tidy] misc-throw-with-noexcept

2016-06-17 Thread Alexander Kornienko via cfe-commits
alexfh requested changes to this revision.
alexfh added a comment.
This revision now requires changes to proceed.

Removing from my dashboard until http://reviews.llvm.org/D20428 is submitted.


Repository:
  rL LLVM

http://reviews.llvm.org/D19201



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


Re: [PATCH] D20693: [clang-tidy] New checker to replace dynamic exception specifications

2016-06-17 Thread Alexander Kornienko via cfe-commits
alexfh added a comment.

Removing from my dashboard until http://reviews.llvm.org/D20428 is submitted.


http://reviews.llvm.org/D20693



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


Re: [PATCH] D21303: [clang-tidy] Adds performance-returning-type check.

2016-06-17 Thread Alexander Kornienko via cfe-commits
alexfh requested changes to this revision.
alexfh added a comment.
This revision now requires changes to proceed.

Apart from the other reviewers' comments, I have a few concerns:

1. The "performance-returning-type" name is missing an important part of 
information. Maybe "performance-return-value-conversion", 
"performance-return-value-copy", "performance-type-conversion-on-return", 
"performance-return-different-type" or something like that.
2. The "expression could be wrapped with std::move" warning is close to 
useless. There are many things that "could be", but the main question is "why"? 
The first thing the message has to explain, is what's wrong with the current 
state, and only then suggest a solution. Also think about cases where the 
suggested solution is not the optimal one (e.g. changing the return type is 
better).
3. What's so special about `return`? Looks like a more general problem is: 
passing an lvalue to a function/constructor/operator by const reference where 
it could instead be moved (the lvalue isn't used afterwards and the appropriate 
overload for rvalue reference is available).


Repository:
  rL LLVM

http://reviews.llvm.org/D21303



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


Re: [PATCH] D20277: [clang-tidy] UnnecessaryValueParamCheck - suggest std::move() if non-const value parameter can be moved.

2016-06-17 Thread Alexander Kornienko via cfe-commits
alexfh added a comment.

A few nits. Otherwise looks good, if Sam has no objections.



Comment at: clang-tidy/performance/UnnecessaryValueParamCheck.cpp:34
@@ -29,1 +33,3 @@
 
+template  bool isSetDifferenceEmpty(const S , const S ) {
+  for (const auto  : S1)

+1 to `isSubset`. And please add a comment explaining what should be a subset 
of what for this function to return `true`.


Comment at: clang-tidy/utils/Matchers.h:50
@@ +49,3 @@
+AST_MATCHER_FUNCTION(ast_matchers::TypeMatcher, isReferenceToConst) {
+  return ast_matchers::referenceType(ast_matchers::pointee(
+  ast_matchers::qualType(ast_matchers::isConstQualified(;

How about `using ast_matchers;` in this function to make the statement easier 
to read?


Comment at: clang-tidy/utils/TypeTraits.cpp:129
@@ +128,3 @@
+  auto *Record = Type->getAsCXXRecordDecl();
+  if (!Record || !Record->hasDefinition())
+return false;

Maybe simplify this a bit?

  return Record && Record->hasDefinition() && 
Record->hasNonTrivialMoveAssignment();


Comment at: clang-tidy/utils/TypeTraits.cpp:136
@@ +135,3 @@
+  auto *Record = Type->getAsCXXRecordDecl();
+  if (!Record || !Record->hasDefinition())
+return false;

ditto


Comment at: clang-tidy/utils/TypeTraits.h:32
@@ -31,1 +31,3 @@
 
+// Returns true if Type has a non-trivial move constructor.
+bool hasNonTrivialMoveConstructor(QualType Type);

Please use doxygen comments (`///`) and enclose inline code snippets in 
backquotes. The other function comments in this file should also be doxygen, 
I've fixed them in r272994.


http://reviews.llvm.org/D20277



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


[clang-tools-extra] r272995 - [clang-tidy] More doc fixes. NFC.

2016-06-17 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Fri Jun 17 07:01:15 2016
New Revision: 272995

URL: http://llvm.org/viewvc/llvm-project?rev=272995=rev
Log:
[clang-tidy] More doc fixes. NFC.

Modified:
clang-tools-extra/trunk/clang-tidy/utils/IncludeSorter.h
clang-tools-extra/trunk/clang-tidy/utils/LexerUtils.h
clang-tools-extra/trunk/clang-tidy/utils/OptionsUtils.h

Modified: clang-tools-extra/trunk/clang-tidy/utils/IncludeSorter.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/utils/IncludeSorter.h?rev=272995=272994=272995=diff
==
--- clang-tools-extra/trunk/clang-tidy/utils/IncludeSorter.h (original)
+++ clang-tools-extra/trunk/clang-tidy/utils/IncludeSorter.h Fri Jun 17 
07:01:15 2016
@@ -17,50 +17,50 @@ namespace clang {
 namespace tidy {
 namespace utils {
 
-// Class used by IncludeSorterCallback and IncludeInserterCallback to record 
the
-// names of the inclusions in a given source file being processed and generate
-// the necessary commands to sort the inclusions according to the precedence
-// enocded in IncludeKinds.
+/// Class used by ``IncludeInserterCallback`` to record the names of the
+/// inclusions in a given source file being processed and generate the 
necessary
+/// commands to sort the inclusions according to the precedence encoded in
+/// ``IncludeKinds``.
 class IncludeSorter {
 public:
-  // Supported include styles.
+  /// Supported include styles.
   enum IncludeStyle { IS_LLVM = 0, IS_Google = 1 };
 
-  // Converts "llvm" to IS_LLVM, otherwise returns IS_Google.
+  /// Converts "llvm" to ``IS_LLVM``, otherwise returns ``IS_Google``.
   static IncludeStyle parseIncludeStyle(const std::string );
 
-  // Converts IncludeStyle to string representation.
+  /// Converts ``IncludeStyle`` to string representation.
   static StringRef toString(IncludeStyle Style);
 
-  // The classifications of inclusions, in the order they should be sorted.
+  /// The classifications of inclusions, in the order they should be sorted.
   enum IncludeKinds {
-IK_MainTUInclude = 0,// e.g. #include "foo.h" when editing foo.cc
-IK_CSystemInclude = 1,   // e.g. #include 
-IK_CXXSystemInclude = 2, // e.g. #include 
-IK_NonSystemInclude = 3, // e.g. #include "bar.h"
-IK_InvalidInclude = 4// total number of valid IncludeKinds
+IK_MainTUInclude = 0,///< e.g. ``#include "foo.h"`` when editing foo.cc
+IK_CSystemInclude = 1,   ///< e.g. ``#include ``
+IK_CXXSystemInclude = 2, ///< e.g. ``#include ``
+IK_NonSystemInclude = 3, ///< e.g. ``#include "bar.h"``
+IK_InvalidInclude = 4///< total number of valid ``IncludeKind``s
   };
 
-  // IncludeSorter constructor; takes the FileID and name of the file to be
-  // processed by the sorter.
+  /// ``IncludeSorter`` constructor; takes the FileID and name of the file to 
be
+  /// processed by the sorter.
   IncludeSorter(const SourceManager *SourceMgr, const LangOptions *LangOpts,
 const FileID FileID, StringRef FileName, IncludeStyle Style);
 
-  // Returns the SourceManager-specific file ID for the file being handled by
-  // the sorter.
+  /// Returns the ``SourceManager``-specific file ID for the file being handled
+  /// by the sorter.
   const FileID current_FileID() const { return CurrentFileID; }
 
-  // Adds the given #include to the sorter.
+  /// Adds the given include directive to the sorter.
   void AddInclude(StringRef FileName, bool IsAngled,
   SourceLocation HashLocation, SourceLocation EndLocation);
 
-  // Returns the edits needed to sort the current set of includes and reset the
-  // internal state (so that different blocks of includes are sorted separately
-  // within the same file).
+  /// Returns the edits needed to sort the current set of includes and reset 
the
+  /// internal state (so that different blocks of includes are sorted 
separately
+  /// within the same file).
   std::vector GetEdits();
 
-  // Creates a quoted inclusion directive in the right sort order. Returns None
-  // on error or if header inclusion directive for header already exists.
+  /// Creates a quoted inclusion directive in the right sort order. Returns 
None
+  /// on error or if header inclusion directive for header already exists.
   Optional CreateIncludeInsertion(StringRef FileName, bool 
IsAngled);
 
 private:
@@ -70,13 +70,13 @@ private:
   const LangOptions *LangOpts;
   const IncludeStyle Style;
   FileID CurrentFileID;
-  // The file name stripped of common suffixes.
+  /// The file name stripped of common suffixes.
   StringRef CanonicalFile;
-  // Locations of visited include directives.
+  /// Locations of visited include directives.
   SourceRangeVector SourceLocations;
-  // Mapping from file name to #include locations.
+  /// Mapping from file name to #include locations.
   llvm::StringMap IncludeLocations;
-  // Includes sorted into buckets.
+  /// Includes sorted into buckets.
 

[clang-tools-extra] r272994 - [clang-tidy] Fix doxygen errors. NFC.

2016-06-17 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Fri Jun 17 06:43:33 2016
New Revision: 272994

URL: http://llvm.org/viewvc/llvm-project?rev=272994=rev
Log:
[clang-tidy] Fix doxygen errors. NFC.

Modified:
clang-tools-extra/trunk/clang-tidy/ClangTidy.h
clang-tools-extra/trunk/clang-tidy/modernize/DeprecatedHeadersCheck.h
clang-tools-extra/trunk/clang-tidy/readability/UniqueptrDeleteReleaseCheck.h
clang-tools-extra/trunk/clang-tidy/utils/DeclRefExprUtils.h
clang-tools-extra/trunk/clang-tidy/utils/FixItHintUtils.h
clang-tools-extra/trunk/clang-tidy/utils/HeaderFileExtensionsUtils.h
clang-tools-extra/trunk/clang-tidy/utils/HeaderGuard.h
clang-tools-extra/trunk/clang-tidy/utils/IncludeInserter.h
clang-tools-extra/trunk/clang-tidy/utils/TypeTraits.h
clang-tools-extra/trunk/docs/doxygen.cfg.in

Modified: clang-tools-extra/trunk/clang-tidy/ClangTidy.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/ClangTidy.h?rev=272994=272993=272994=diff
==
--- clang-tools-extra/trunk/clang-tidy/ClangTidy.h (original)
+++ clang-tools-extra/trunk/clang-tidy/ClangTidy.h Fri Jun 17 06:43:33 2016
@@ -94,11 +94,11 @@ private:
 /// base class's methods. E.g. to implement a check that validates namespace
 /// declarations, override ``registerMatchers``:
 ///
-/// ```c++
+/// ~~~{.cpp}
 /// void registerMatchers(ast_matchers::MatchFinder *Finder) override {
 ///   Finder->addMatcher(namespaceDecl().bind("namespace"), this);
 /// }
-/// ```
+/// ~~~
 ///
 /// and then override ``check(const MatchResult )`` to do the actual
 /// check for each match.
@@ -127,7 +127,7 @@ public:
   /// dependent properties, e.g. the order of include directives.
   virtual void registerPPCallbacks(CompilerInstance ) {}
 
-  /// \brief Override this to register ASTMatchers with \p Finder.
+  /// \brief Override this to register AST matchers with \p Finder.
   ///
   /// This should be used by clang-tidy checks that analyze code properties 
that
   /// dependent on AST knowledge.

Modified: clang-tools-extra/trunk/clang-tidy/modernize/DeprecatedHeadersCheck.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/DeprecatedHeadersCheck.h?rev=272994=272993=272994=diff
==
--- clang-tools-extra/trunk/clang-tidy/modernize/DeprecatedHeadersCheck.h 
(original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/DeprecatedHeadersCheck.h Fri 
Jun 17 06:43:33 2016
@@ -20,11 +20,16 @@ namespace modernize {
 /// alternatives.
 ///
 /// Before:
-///   #include 
+/// ~~~{.cpp}
+/// #include 
+/// ~~~
+///
 /// After:
-///   #include 
+/// ~~~{.cpp}
+/// #include 
+/// ~~~
 ///
-/// Example:  => 
+/// Example: `` => ``
 ///
 /// For the user-facing documentation see:
 /// 
http://clang.llvm.org/extra/clang-tidy/checks/modernize-deprecated-headers.html

Modified: 
clang-tools-extra/trunk/clang-tidy/readability/UniqueptrDeleteReleaseCheck.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/UniqueptrDeleteReleaseCheck.h?rev=272994=272993=272994=diff
==
--- 
clang-tools-extra/trunk/clang-tidy/readability/UniqueptrDeleteReleaseCheck.h 
(original)
+++ 
clang-tools-extra/trunk/clang-tidy/readability/UniqueptrDeleteReleaseCheck.h 
Fri Jun 17 06:43:33 2016
@@ -16,8 +16,8 @@ namespace clang {
 namespace tidy {
 namespace readability {
 
-/// Flag statements of the form: delete .release()
-/// and replace them with:  = nullptr
+/// Flags statements of the form ``delete .release();`` and
+/// replaces them with: `` = nullptr;``
 ///
 /// For the user-facing documentation see:
 /// 
http://clang.llvm.org/extra/clang-tidy/checks/readability-uniqueptr-delete-release.html

Modified: clang-tools-extra/trunk/clang-tidy/utils/DeclRefExprUtils.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/utils/DeclRefExprUtils.h?rev=272994=272993=272994=diff
==
--- clang-tools-extra/trunk/clang-tidy/utils/DeclRefExprUtils.h (original)
+++ clang-tools-extra/trunk/clang-tidy/utils/DeclRefExprUtils.h Fri Jun 17 
06:43:33 2016
@@ -18,11 +18,12 @@ namespace tidy {
 namespace utils {
 namespace decl_ref_expr {
 
-/// \brief Returns true if all DeclRefExpr to the variable within Stmt do not
-/// modify it.
+/// \brief Returns true if all ``DeclRefExpr`` to the variable within ``Stmt``
+/// do not modify it.
 ///
-/// Returns true if only const methods or operators are called on the variable
-/// or the variable is a const reference or value argument to a callExpr().
+/// Returns ``true`` if only const methods or operators are called on the
+/// variable or the variable is a const reference or value argument to a
+/// ``callExpr()``.
 bool isOnlyUsedAsConst(const VarDecl , 

Re: [gentoo-musl] Re: Add support for musl-libc on Linux

2016-06-17 Thread Lei Zhang via cfe-commits
2016-06-15 16:28 GMT+08:00 Lei Zhang :
> Here's another patch including test cases for various non-x86 archs,
> which should just work with my previous patches. ARM is left out
> purposely since it involves extra complexity. I'll work on it later.

Hi,

Here are another two patches which add support for ARM, with some test
cases included.

They're a lot bigger than previous patches, and I'm not 100% sure if I
missed anything. Any comments are utterly welcome :)


Lei


llvm-musl-arm.patch
Description: Binary data


clang-musl-arm.patch
Description: Binary data
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21020: [clang-tidy] readability-identifier-naming - Support for Macros

2016-06-17 Thread Alexander Kornienko via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL272993: [clang-tidy] readability-identifier-naming - Support 
for Macros (authored by alexfh).

Changed prior to commit:
  http://reviews.llvm.org/D21020?vs=61071=61074#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D21020

Files:
  clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp
  clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.h
  clang-tools-extra/trunk/docs/ReleaseNotes.rst
  clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming.cpp

Index: clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp
===
--- clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp
+++ clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp
@@ -12,11 +12,53 @@
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/Format.h"
 #include "clang/ASTMatchers/ASTMatchFinder.h"
+#include "clang/Frontend/CompilerInstance.h"
+#include "clang/Lex/PPCallbacks.h"
+#include "clang/Lex/Preprocessor.h"
+#include "llvm/ADT/DenseMapInfo.h"
 
 #define DEBUG_TYPE "clang-tidy"
 
 using namespace clang::ast_matchers;
 
+namespace llvm {
+/// Specialisation of DenseMapInfo to allow NamingCheckId objects in DenseMaps
+template <>
+struct DenseMapInfo<
+clang::tidy::readability::IdentifierNamingCheck::NamingCheckId> {
+  using NamingCheckId =
+  clang::tidy::readability::IdentifierNamingCheck::NamingCheckId;
+
+  static inline NamingCheckId getEmptyKey() {
+return NamingCheckId(
+clang::SourceLocation::getFromRawEncoding(static_cast(-1)),
+"EMPTY");
+  }
+
+  static inline NamingCheckId getTombstoneKey() {
+return NamingCheckId(
+clang::SourceLocation::getFromRawEncoding(static_cast(-2)),
+"TOMBSTONE");
+  }
+
+  static unsigned getHashValue(NamingCheckId Val) {
+assert(Val != getEmptyKey() && "Cannot hash the empty key!");
+assert(Val != getTombstoneKey() && "Cannot hash the tombstone key!");
+
+std::hash SecondHash;
+return Val.first.getRawEncoding() + SecondHash(Val.second);
+  }
+
+  static bool isEqual(NamingCheckId LHS, NamingCheckId RHS) {
+if (RHS == getEmptyKey())
+  return LHS == getEmptyKey();
+if (RHS == getTombstoneKey())
+  return LHS == getTombstoneKey();
+return LHS == RHS;
+  }
+};
+} // namespace llvm
+
 namespace clang {
 namespace tidy {
 namespace readability {
@@ -66,6 +108,7 @@
 m(TemplateTemplateParameter) \
 m(TemplateParameter) \
 m(TypeAlias) \
+m(MacroDefinition) \
 
 enum StyleKind {
 #define ENUMERATE(v) SK_ ## v,
@@ -84,6 +127,33 @@
 #undef NAMING_KEYS
 // clang-format on
 
+namespace {
+/// Callback supplies macros to IdentifierNamingCheck::checkMacro
+class IdentifierNamingCheckPPCallbacks : public PPCallbacks {
+public:
+  IdentifierNamingCheckPPCallbacks(Preprocessor *PP,
+   IdentifierNamingCheck *Check)
+  : PP(PP), Check(Check) {}
+
+  /// MacroDefined calls checkMacro for macros in the main file
+  void MacroDefined(const Token ,
+const MacroDirective *MD) override {
+Check->checkMacro(PP->getSourceManager(), MacroNameTok, MD->getMacroInfo());
+  }
+
+  /// MacroExpands calls expandMacro for macros in the main file
+  void MacroExpands(const Token , const MacroDefinition ,
+SourceRange /*Range*/,
+const MacroArgs * /*Args*/) override {
+Check->expandMacro(MacroNameTok, MD.getMacroInfo());
+  }
+
+private:
+  Preprocessor *PP;
+  IdentifierNamingCheck *Check;
+};
+} // namespace
+
 IdentifierNamingCheck::IdentifierNamingCheck(StringRef Name,
  ClangTidyContext *Context)
 : ClangTidyCheck(Name, Context) {
@@ -146,6 +216,12 @@
   Finder->addMatcher(nestedNameSpecifierLoc().bind("nestedNameLoc"), this);
 }
 
+void IdentifierNamingCheck::registerPPCallbacks(CompilerInstance ) {
+  Compiler.getPreprocessor().addPPCallbacks(
+  llvm::make_unique(
+  (), this));
+}
+
 static bool matchesStyle(StringRef Name,
  IdentifierNamingCheck::NamingStyle Style) {
   static llvm::Regex Matchers[] = {
@@ -506,8 +582,8 @@
 }
 
 static void addUsage(IdentifierNamingCheck::NamingCheckFailureMap ,
- const NamedDecl *Decl, SourceRange Range,
- const SourceManager *SM) {
+ const IdentifierNamingCheck::NamingCheckId ,
+ SourceRange Range) {
   // Do nothing if the provided range is invalid.
   if (Range.getBegin().isInvalid() || Range.getEnd().isInvalid())
 return;
@@ -522,14 +598,22 @@
   !Range.getEnd().isMacroID();
 }
 
+/// Convenience method when the usage to be added is a NamedDecl
+static void addUsage(IdentifierNamingCheck::NamingCheckFailureMap ,
+ 

[clang-tools-extra] r272993 - [clang-tidy] readability-identifier-naming - Support for Macros

2016-06-17 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Fri Jun 17 04:25:24 2016
New Revision: 272993

URL: http://llvm.org/viewvc/llvm-project?rev=272993=rev
Log:
[clang-tidy] readability-identifier-naming - Support for Macros

Summary:
Added support for macro definitions.
--

1. Added a pre-processor callback to catch macro definitions
2. Changed the type of the failure map so that macros and declarations can 
share the same map
3. Added extra tests to ensure fix-ups work using the new map
4. Added fix-ups for type aliases in variable and function declarations as part 
of adding the new tests

Reviewers: alexfh

Subscribers: Eugene.Zelenko, cfe-commits

Patch by James Reynolds!

Differential Revision: http://reviews.llvm.org/D21020

Modified:
clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp
clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.h
clang-tools-extra/trunk/docs/ReleaseNotes.rst
clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming.cpp

Modified: 
clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp?rev=272993=272992=272993=diff
==
--- clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp 
(original)
+++ clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp 
Fri Jun 17 04:25:24 2016
@@ -12,11 +12,53 @@
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/Format.h"
 #include "clang/ASTMatchers/ASTMatchFinder.h"
+#include "clang/Frontend/CompilerInstance.h"
+#include "clang/Lex/PPCallbacks.h"
+#include "clang/Lex/Preprocessor.h"
+#include "llvm/ADT/DenseMapInfo.h"
 
 #define DEBUG_TYPE "clang-tidy"
 
 using namespace clang::ast_matchers;
 
+namespace llvm {
+/// Specialisation of DenseMapInfo to allow NamingCheckId objects in DenseMaps
+template <>
+struct DenseMapInfo<
+clang::tidy::readability::IdentifierNamingCheck::NamingCheckId> {
+  using NamingCheckId =
+  clang::tidy::readability::IdentifierNamingCheck::NamingCheckId;
+
+  static inline NamingCheckId getEmptyKey() {
+return NamingCheckId(
+clang::SourceLocation::getFromRawEncoding(static_cast(-1)),
+"EMPTY");
+  }
+
+  static inline NamingCheckId getTombstoneKey() {
+return NamingCheckId(
+clang::SourceLocation::getFromRawEncoding(static_cast(-2)),
+"TOMBSTONE");
+  }
+
+  static unsigned getHashValue(NamingCheckId Val) {
+assert(Val != getEmptyKey() && "Cannot hash the empty key!");
+assert(Val != getTombstoneKey() && "Cannot hash the tombstone key!");
+
+std::hash SecondHash;
+return Val.first.getRawEncoding() + SecondHash(Val.second);
+  }
+
+  static bool isEqual(NamingCheckId LHS, NamingCheckId RHS) {
+if (RHS == getEmptyKey())
+  return LHS == getEmptyKey();
+if (RHS == getTombstoneKey())
+  return LHS == getTombstoneKey();
+return LHS == RHS;
+  }
+};
+} // namespace llvm
+
 namespace clang {
 namespace tidy {
 namespace readability {
@@ -66,6 +108,7 @@ namespace readability {
 m(TemplateTemplateParameter) \
 m(TemplateParameter) \
 m(TypeAlias) \
+m(MacroDefinition) \
 
 enum StyleKind {
 #define ENUMERATE(v) SK_ ## v,
@@ -84,6 +127,33 @@ static StringRef const StyleNames[] = {
 #undef NAMING_KEYS
 // clang-format on
 
+namespace {
+/// Callback supplies macros to IdentifierNamingCheck::checkMacro
+class IdentifierNamingCheckPPCallbacks : public PPCallbacks {
+public:
+  IdentifierNamingCheckPPCallbacks(Preprocessor *PP,
+   IdentifierNamingCheck *Check)
+  : PP(PP), Check(Check) {}
+
+  /// MacroDefined calls checkMacro for macros in the main file
+  void MacroDefined(const Token ,
+const MacroDirective *MD) override {
+Check->checkMacro(PP->getSourceManager(), MacroNameTok, 
MD->getMacroInfo());
+  }
+
+  /// MacroExpands calls expandMacro for macros in the main file
+  void MacroExpands(const Token , const MacroDefinition ,
+SourceRange /*Range*/,
+const MacroArgs * /*Args*/) override {
+Check->expandMacro(MacroNameTok, MD.getMacroInfo());
+  }
+
+private:
+  Preprocessor *PP;
+  IdentifierNamingCheck *Check;
+};
+} // namespace
+
 IdentifierNamingCheck::IdentifierNamingCheck(StringRef Name,
  ClangTidyContext *Context)
 : ClangTidyCheck(Name, Context) {
@@ -146,6 +216,12 @@ void IdentifierNamingCheck::registerMatc
   Finder->addMatcher(nestedNameSpecifierLoc().bind("nestedNameLoc"), this);
 }
 
+void IdentifierNamingCheck::registerPPCallbacks(CompilerInstance ) {
+  Compiler.getPreprocessor().addPPCallbacks(
+  llvm::make_unique(
+  (), this));
+}
+
 static bool matchesStyle(StringRef Name,
  IdentifierNamingCheck::NamingStyle Style) {
   static llvm::Regex 

Re: [PATCH] D21020: [clang-tidy] readability-identifier-naming - Support for Macros

2016-06-17 Thread Alexander Kornienko via cfe-commits
alexfh added a comment.

In http://reviews.llvm.org/D21020#460734, @JamesReynolds wrote:

> Thanks! All fixed now. Could you land this for me please?


Sure, will do. Thank you for working on this!


http://reviews.llvm.org/D21020



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


Re: [PATCH] D21020: [clang-tidy] readability-identifier-naming - Support for Macros

2016-06-17 Thread James Reynolds via cfe-commits
JamesReynolds marked an inline comment as done.
JamesReynolds added a comment.

Thanks! All fixed now. Could you land this for me please?


http://reviews.llvm.org/D21020



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


Re: [PATCH] D21020: [clang-tidy] readability-identifier-naming - Support for Macros

2016-06-17 Thread James Reynolds via cfe-commits
JamesReynolds marked 2 inline comments as done.


Comment at: clang-tidy/readability/IdentifierNamingCheck.h:98
@@ +97,3 @@
+
+  /// Add a usage of a macro if it already has a violation.
+  void expandMacro(const Token , const MacroInfo *MI);

Fixed this one too.


http://reviews.llvm.org/D21020



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


Re: [PATCH] D21020: [clang-tidy] readability-identifier-naming - Support for Macros

2016-06-17 Thread James Reynolds via cfe-commits
JamesReynolds updated this revision to Diff 61071.
JamesReynolds added a comment.

Fixed nits.


http://reviews.llvm.org/D21020

Files:
  clang-tidy/readability/IdentifierNamingCheck.cpp
  clang-tidy/readability/IdentifierNamingCheck.h
  docs/ReleaseNotes.rst
  test/clang-tidy/readability-identifier-naming.cpp

Index: test/clang-tidy/readability-identifier-naming.cpp
===
--- test/clang-tidy/readability-identifier-naming.cpp
+++ test/clang-tidy/readability-identifier-naming.cpp
@@ -61,6 +61,7 @@
 // RUN: {key: readability-identifier-naming.VariableCase, value: lower_case}, \
 // RUN: {key: readability-identifier-naming.VirtualMethodCase, value: UPPER_CASE}, \
 // RUN: {key: readability-identifier-naming.VirtualMethodPrefix, value: 'v_'}, \
+// RUN: {key: readability-identifier-naming.MacroDefinitionCase, value: UPPER_CASE}, \
 // RUN: {key: readability-identifier-naming.TypeAliasCase, value: lower_case}, \
 // RUN: {key: readability-identifier-naming.TypeAliasSuffix, value: '_t'}, \
 // RUN: {key: readability-identifier-naming.IgnoreFailedSplit, value: 0} \
@@ -307,6 +308,12 @@
 // CHECK-MESSAGES: :[[@LINE-1]]:26: warning: invalid case style for typedef 'struct_type'
 // CHECK-FIXES: {{^}}typedef this_structure struct_type_t;{{$}}
 
+struct_type GlobalTypedefTestFunction(struct_type a_argument1) {
+// CHECK-FIXES: {{^}}struct_type_t GlobalTypedefTestFunction(struct_type_t a_argument1) {
+struct_type typedef_test_1;
+// CHECK-FIXES: {{^}}struct_type_t typedef_test_1;
+}
+
 using my_struct_type = THIS___Structure;
 // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for type alias 'my_struct_type'
 // CHECK-FIXES: {{^}}using my_struct_type_t = this_structure;{{$}}
@@ -329,5 +336,11 @@
 // CHECK-FIXES: {{^}}  using ::foo_ns::inline_namespace::ce_function;{{$}}
 }
 
+#define MY_TEST_Macro(X) X()
+// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for macro definition 'MY_TEST_Macro'
+// CHECK-FIXES: {{^}}#define MY_TEST_MACRO(X) X()
+
+void MY_TEST_Macro(function) {}
+// CHECK-FIXES: {{^}}void MY_TEST_MACRO(function) {}
 }
 }
Index: docs/ReleaseNotes.rst
===
--- docs/ReleaseNotes.rst
+++ docs/ReleaseNotes.rst
@@ -249,6 +249,11 @@
   Warns about defaulted constructors and assignment operators that are actually
   deleted.
 
+- Updated `readability-identifier-naming-check
+  `_
+
+  Added support for enforcing the case of macro statements.
+
 - New `readability-redundant-control-flow
   `_ check
 
Index: clang-tidy/readability/IdentifierNamingCheck.h
===
--- clang-tidy/readability/IdentifierNamingCheck.h
+++ clang-tidy/readability/IdentifierNamingCheck.h
@@ -13,6 +13,9 @@
 #include "../ClangTidy.h"
 
 namespace clang {
+
+class MacroInfo;
+
 namespace tidy {
 namespace readability {
 
@@ -36,6 +39,7 @@
   void storeOptions(ClangTidyOptions::OptionMap ) override;
   void registerMatchers(ast_matchers::MatchFinder *Finder) override;
   void check(const ast_matchers::MatchFinder::MatchResult ) override;
+  void registerPPCallbacks(CompilerInstance ) override;
   void onEndOfTranslationUnit() override;
 
   enum CaseType {
@@ -64,7 +68,7 @@
 
   /// \brief Holds an identifier name check failure, tracking the kind of the
   /// identifer, its possible fixup and the starting locations of all the
-  /// idenfiier usages.
+  /// identifier usages.
   struct NamingCheckFailure {
 std::string KindName;
 std::string Fixup;
@@ -81,9 +85,19 @@
 
 NamingCheckFailure() : ShouldFix(true) {}
   };
-  typedef llvm::DenseMap
+
+  typedef std::pair NamingCheckId;
+
+  typedef llvm::DenseMap
   NamingCheckFailureMap;
 
+  /// Check Macros for style violations.
+  void checkMacro(SourceManager , const Token ,
+  const MacroInfo *MI);
+
+  /// Add a usage of a macro if it already has a violation.
+  void expandMacro(const Token , const MacroInfo *MI);
+
 private:
   std::vector NamingStyles;
   bool IgnoreFailedSplit;
Index: clang-tidy/readability/IdentifierNamingCheck.cpp
===
--- clang-tidy/readability/IdentifierNamingCheck.cpp
+++ clang-tidy/readability/IdentifierNamingCheck.cpp
@@ -12,11 +12,53 @@
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/Format.h"
 #include "clang/ASTMatchers/ASTMatchFinder.h"
+#include "clang/Frontend/CompilerInstance.h"
+#include "clang/Lex/PPCallbacks.h"
+#include "clang/Lex/Preprocessor.h"
+#include "llvm/ADT/DenseMapInfo.h"
 
 #define DEBUG_TYPE "clang-tidy"
 
 using namespace clang::ast_matchers;
 
+namespace llvm {
+///