[PATCH] D33095: [analyzer] Avoid allocation in Std C function modelling.

2017-05-11 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ accepted this revision.
NoQ added a comment.
This revision is now accepted and ready to land.

Thanks :o

I guess i was planning for C++ support here, but never reached that far.

Is it an actual performance problem? Cause i think i did the checker for 
performance regressions and it seemed all good.


Repository:
  rL LLVM

https://reviews.llvm.org/D33095



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


[PATCH] D33092: [analyzer] Add checker to model builtin functions

2017-05-11 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ accepted this revision.
NoQ added a comment.
This revision is now accepted and ready to land.

Great, thanks!




Comment at: lib/StaticAnalyzer/Checkers/BuiltinFunctionChecker.cpp:51
+state = state->assume(ArgSVal.castAs(), true);
+// FIXME: do we want to warn here?
+if (!state)

That's a good question, because `assume(false)` seems much more broken than 
`assert(false)`.

But because we are overaggressive on branching as compared to only relying on 
presumption of code liveness (eg. splitting `void foo(x, y) { if (x) ...; if 
(y) ...; }` into 4 paths is unsafe - all code may be live without all paths 
being feasible - but we do that anyway, same with loops and eager assumptions 
and our aliasing approach and the whole inlining thing), i think we'd rather 
not warn.

I mean, due to the above, it is much more likely that the assumption is valid 
and the branch on which it fails is infeasible due to some function contract we 
dont' see, than that the assumption is actually violated. We may do well about 
null dereferences and such, but generally the static analyzer should try to 
avoid parts of code that have been carefully thought out :) We may probably 
want to catch cases when the assumption fails on all paths reaching it, but we 
shouldn't use symbolic execution for all-paths warnings.


https://reviews.llvm.org/D33092



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


[libcxx] r302871 - Fix C++03 test failures caused by static_assert emulation

2017-05-11 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Thu May 11 22:53:56 2017
New Revision: 302871

URL: http://llvm.org/viewvc/llvm-project?rev=302871=rev
Log:
Fix C++03 test failures caused by static_assert emulation

Modified:

libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.string/converted.pass.cpp

libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.string/from_bytes.pass.cpp

libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.string/to_bytes.pass.cpp

Modified: 
libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.string/converted.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.string/converted.pass.cpp?rev=302871=302870=302871=diff
==
--- 
libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.string/converted.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.string/converted.pass.cpp
 Thu May 11 22:53:56 2017
@@ -30,7 +30,7 @@ struct TestHelper {
 
 template 
 void TestHelper::test() {
-  static_assert(std::is_same::value, "");
+  static_assert((std::is_same::value), "");
   {
 typedef std::codecvt_utf8 Codecvt;
 typedef std::wstring_convert Myconv;
@@ -47,7 +47,7 @@ void TestHelper::test() {
 
 template 
 void TestHelper::test() {
-  static_assert(std::is_same::value, "");
+  static_assert((std::is_same::value), "");
   {
 typedef std::codecvt_utf8 Codecvt;
 typedef std::wstring_convert Myconv;

Modified: 
libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.string/from_bytes.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.string/from_bytes.pass.cpp?rev=302871=302870=302871=diff
==
--- 
libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.string/from_bytes.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.string/from_bytes.pass.cpp
 Thu May 11 22:53:56 2017
@@ -33,7 +33,7 @@ struct TestHelper {
 
 template 
 void TestHelper::test() {
-  static_assert(std::is_same::value, "");
+  static_assert((std::is_same::value), "");
   {
 std::wstring_convert myconv;
 std::string bs("\xE1\x80\x85\x00");
@@ -52,7 +52,7 @@ void TestHelper::test() {
 
 template 
 void TestHelper::test() {
-  static_assert(std::is_same::value, "");
+  static_assert((std::is_same::value), "");
   {
 std::wstring_convert myconv;
 std::string bs("\xF1\x80\x80\x83");

Modified: 
libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.string/to_bytes.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.string/to_bytes.pass.cpp?rev=302871=302870=302871=diff
==
--- 
libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.string/to_bytes.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.string/to_bytes.pass.cpp
 Thu May 11 22:53:56 2017
@@ -33,7 +33,7 @@ struct TestHelper {
 
 template 
 void TestHelper::test() {
-  static_assert(std::is_same::value, "");
+  static_assert((std::is_same::value), "");
   {
 std::wstring_convert myconv;
 std::wstring ws(1, CharT(0x1005));
@@ -52,7 +52,7 @@ void TestHelper::test() {
 
 template 
 void TestHelper::test() {
-  static_assert(std::is_same::value, "");
+  static_assert((std::is_same::value), "");
   {
 std::wstring_convert myconv;
 std::wstring ws(1, CharT(0x40003));


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


[libcxx] r302870 - Cleanup test issues reported by STL @ Microsoft.

2017-05-11 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Thu May 11 22:38:28 2017
New Revision: 302870

URL: http://llvm.org/viewvc/llvm-project?rev=302870=rev
Log:
Cleanup test issues reported by STL @ Microsoft.

This patch cleans up a number of issues reported by STL, including:

1) Fix duplicate is_convertible test.
2) Move non-standard reference_wrapper tests under test/libcxx
3) Fix assumption that sizeof(wchar_t) == 32 in the codecvt and
   wstring_convert tests.

Added:
libcxx/trunk/test/libcxx/utilities/function.objects/refwrap/
libcxx/trunk/test/libcxx/utilities/function.objects/refwrap/binary.pass.cpp
  - copied, changed from r302869, 
libcxx/trunk/test/std/utilities/function.objects/refwrap/binary.pass.cpp
libcxx/trunk/test/libcxx/utilities/function.objects/refwrap/unary.pass.cpp
  - copied, changed from r302869, 
libcxx/trunk/test/std/utilities/function.objects/refwrap/unary.pass.cpp
Removed:
libcxx/trunk/test/std/utilities/function.objects/refwrap/binary.pass.cpp
libcxx/trunk/test/std/utilities/function.objects/refwrap/unary.pass.cpp
Modified:
libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf16_out.pass.cpp
libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8_out.pass.cpp

libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_in.pass.cpp

libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_out.pass.cpp

libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.string/converted.pass.cpp

libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.string/from_bytes.pass.cpp

libcxx/trunk/test/std/localization/locales/locale.convenience/conversions/conversions.string/to_bytes.pass.cpp
libcxx/trunk/test/std/utilities/meta/meta.rel/is_convertible.pass.cpp

Copied: 
libcxx/trunk/test/libcxx/utilities/function.objects/refwrap/binary.pass.cpp 
(from r302869, 
libcxx/trunk/test/std/utilities/function.objects/refwrap/binary.pass.cpp)
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/utilities/function.objects/refwrap/binary.pass.cpp?p2=libcxx/trunk/test/libcxx/utilities/function.objects/refwrap/binary.pass.cpp=libcxx/trunk/test/std/utilities/function.objects/refwrap/binary.pass.cpp=302869=302870=302870=diff
==
(empty)

Copied: 
libcxx/trunk/test/libcxx/utilities/function.objects/refwrap/unary.pass.cpp 
(from r302869, 
libcxx/trunk/test/std/utilities/function.objects/refwrap/unary.pass.cpp)
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/utilities/function.objects/refwrap/unary.pass.cpp?p2=libcxx/trunk/test/libcxx/utilities/function.objects/refwrap/unary.pass.cpp=libcxx/trunk/test/std/utilities/function.objects/refwrap/unary.pass.cpp=302869=302870=302870=diff
==
(empty)

Modified: 
libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf16_out.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf16_out.pass.cpp?rev=302870=302869=302870=diff
==
--- libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf16_out.pass.cpp 
(original)
+++ libcxx/trunk/test/std/localization/locale.stdcvt/codecvt_utf16_out.pass.cpp 
Thu May 11 22:38:28 2017
@@ -25,307 +25,329 @@
 #include 
 #include 
 
-int main()
-{
-{
-typedef std::codecvt_utf16 C;
-C c;
-wchar_t w = 0x40003;
-char n[4] = {0};
-const wchar_t* wp = nullptr;
-std::mbstate_t m;
-char* np = nullptr;
-std::codecvt_base::result r = c.out(m, , +1, wp, n, n+4, np);
-assert(r == std::codecvt_base::ok);
-assert(wp == +1);
-assert(np == n+4);
-assert(n[0] == char(0xD8));
-assert(n[1] == char(0xC0));
-assert(n[2] == char(0xDC));
-assert(n[3] == char(0x03));
-
-w = 0x1005;
-r = c.out(m, , +1, wp, n, n+4, np);
-assert(r == std::codecvt_base::ok);
-assert(wp == +1);
-assert(np == n+2);
-assert(n[0] == char(0x10));
-assert(n[1] == char(0x05));
-assert(n[2] == char(0xDC));
-assert(n[3] == char(0x03));
-
-w = 0x453;
-r = c.out(m, , +1, wp, n, n+4, np);
-assert(r == std::codecvt_base::ok);
-assert(wp == +1);
-assert(np == n+2);
-assert(n[0] == char(0x04));
-assert(n[1] == char(0x53));
-assert(n[2] == char(0xDC));
-assert(n[3] == char(0x03));
-
-w = 0x56;
-r = c.out(m, , +1, wp, n, n+4, np);
-assert(r == std::codecvt_base::ok);
-assert(wp == +1);
-assert(np == n+2);
-assert(n[0] == char(0x00));
-assert(n[1] == char(0x56));
-assert(n[2] == char(0xDC));
-assert(n[3] == char(0x03));
-}

[libcxx] r302869 - Remove non-standard basic_string_view::clear() member.

2017-05-11 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Thu May 11 22:35:53 2017
New Revision: 302869

URL: http://llvm.org/viewvc/llvm-project?rev=302869=rev
Log:
Remove non-standard basic_string_view::clear() member.

This patch removes the clear() member from . The
modifier was removed from the TS before it ever landed in the standard.
There is no reason libc++ should be providing this method.

Removed:

libcxx/trunk/test/std/strings/string.view/string.view.modifiers/clear.pass.cpp
Modified:
libcxx/trunk/include/string_view

Modified: libcxx/trunk/include/string_view
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/string_view?rev=302869=302868=302869=diff
==
--- libcxx/trunk/include/string_view (original)
+++ libcxx/trunk/include/string_view Thu May 11 22:35:53 2017
@@ -103,7 +103,6 @@ namespace std {
   constexpr const_pointer data() const noexcept;
 
   // 7.7, basic_string_view modifiers
-  constexpr void clear() noexcept;
   constexpr void remove_prefix(size_type n);
   constexpr void remove_suffix(size_type n);
   constexpr void swap(basic_string_view& s) noexcept;
@@ -293,13 +292,6 @@ public:
 
// [string.view.modifiers], modifiers:
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
-   void clear() _NOEXCEPT
-   {
-   __data = nullptr;
-   __size = 0;
-   }
-
-   _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
void remove_prefix(size_type __n) _NOEXCEPT
{
_LIBCPP_ASSERT(__n <= size(), "remove_prefix() can't remove 
more than size()");

Removed: 
libcxx/trunk/test/std/strings/string.view/string.view.modifiers/clear.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/string.view/string.view.modifiers/clear.pass.cpp?rev=302868=auto
==
--- 
libcxx/trunk/test/std/strings/string.view/string.view.modifiers/clear.pass.cpp 
(original)
+++ 
libcxx/trunk/test/std/strings/string.view/string.view.modifiers/clear.pass.cpp 
(removed)
@@ -1,67 +0,0 @@
-//===--===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===--===//
-
-
-// 
-
-// void clear() noexcept
-
-#include 
-#include 
-
-#include "test_macros.h"
-
-template
-void test ( const CharT *s, size_t len ) {
-typedef std::basic_string_view SV;
-{
-SV sv1 ( s );
-assert ( sv1.size() == len );
-assert ( sv1.data() == s );
-
-sv1.clear ();
-assert ( sv1.data() == nullptr );
-assert ( sv1.size() == 0 );
-assert ( sv1 == SV());
-}
-}
-
-#if TEST_STD_VER > 11
-constexpr size_t test_ce ( size_t n ) {
-typedef std::basic_string_view SV;
-SV sv1{ "ABCDEFGHIJKL", n };
-sv1.clear();
-return sv1.size();
-}
-#endif
-
-int main () {
-test ( "ABCDE", 5 );
-test ( "a", 1 );
-test ( "", 0 );
-
-test ( L"ABCDE", 5 );
-test ( L"a", 1 );
-test ( L"", 0 );
-
-#if TEST_STD_VER >= 11
-test ( u"ABCDE", 5 );
-test ( u"a", 1 );
-test ( u"", 0 );
-
-test ( U"ABCDE", 5 );
-test ( U"a", 1 );
-test ( U"", 0 );
-#endif
-
-#if TEST_STD_VER > 11
-static_assert ( test_ce (5) == 0, "" );
-#endif
-
-}


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


[libcxx] r302865 - Move POSIX specific test under test/libcxx subdirectory

2017-05-11 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Thu May 11 21:02:09 2017
New Revision: 302865

URL: http://llvm.org/viewvc/llvm-project?rev=302865=rev
Log:
Move POSIX specific test under test/libcxx subdirectory

Added:

libcxx/trunk/test/libcxx/thread/thread.condition/PR30202_notify_from_pthread_created_thread.pass.cpp
  - copied, changed from r302864, 
libcxx/trunk/test/std/thread/thread.condition/PR30202_notify_from_pthread_created_thread.pass.cpp
Removed:

libcxx/trunk/test/std/thread/thread.condition/PR30202_notify_from_pthread_created_thread.pass.cpp

Copied: 
libcxx/trunk/test/libcxx/thread/thread.condition/PR30202_notify_from_pthread_created_thread.pass.cpp
 (from r302864, 
libcxx/trunk/test/std/thread/thread.condition/PR30202_notify_from_pthread_created_thread.pass.cpp)
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/thread/thread.condition/PR30202_notify_from_pthread_created_thread.pass.cpp?p2=libcxx/trunk/test/libcxx/thread/thread.condition/PR30202_notify_from_pthread_created_thread.pass.cpp=libcxx/trunk/test/std/thread/thread.condition/PR30202_notify_from_pthread_created_thread.pass.cpp=302864=302865=302865=diff
==
(empty)

Removed: 
libcxx/trunk/test/std/thread/thread.condition/PR30202_notify_from_pthread_created_thread.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/thread/thread.condition/PR30202_notify_from_pthread_created_thread.pass.cpp?rev=302864=auto
==
--- 
libcxx/trunk/test/std/thread/thread.condition/PR30202_notify_from_pthread_created_thread.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/thread/thread.condition/PR30202_notify_from_pthread_created_thread.pass.cpp
 (removed)
@@ -1,76 +0,0 @@
-//===--===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===--===//
-//
-// UNSUPPORTED: libcpp-has-no-threads
-// REQUIRES: libcpp-has-thread-api-pthread
-
-// notify_all_at_thread_exit(...) requires move semantics to transfer the
-// unique_lock.
-// UNSUPPORTED: c++98, c++03
-
-// 
-
-// void
-//   notify_all_at_thread_exit(condition_variable& cond, unique_lock 
lk);
-
-// Test that this function works with threads that were not created by
-// std::thread. See http://llvm.org/PR30202.
-
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-std::condition_variable cv;
-std::mutex mut;
-bool exited = false;
-
-typedef std::chrono::milliseconds ms;
-typedef std::chrono::high_resolution_clock Clock;
-
-void* func(void*)
-{
-std::unique_lock lk(mut);
-std::notify_all_at_thread_exit(cv, std::move(lk));
-std::this_thread::sleep_for(ms(300));
-exited = true;
-return nullptr;
-}
-
-int main()
-{
-{
-std::unique_lock lk(mut);
-pthread_t id;
-int res = pthread_create(, 0, , nullptr);
-assert(res == 0);
-Clock::time_point t0 = Clock::now();
-assert(exited == false);
-cv.wait(lk);
-Clock::time_point t1 = Clock::now();
-assert(exited);
-assert(t1-t0 > ms(250));
-pthread_join(id, 0);
-}
-exited = false;
-{
-std::unique_lock lk(mut);
-std::thread t(, nullptr);
-Clock::time_point t0 = Clock::now();
-assert(exited == false);
-cv.wait(lk);
-Clock::time_point t1 = Clock::now();
-assert(exited);
-assert(t1-t0 > ms(250));
-t.join();
-}
-}


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


Re: r302835 - Issue diagnostics when returning FP values on x86_64 without SSE1/2

2017-05-11 Thread Reid Kleckner via cfe-commits
Re add list

On May 11, 2017 7:03 PM, "Reid Kleckner"  wrote:

> The mailer divides patches by repo: llvm, cfe, compiler-rt, and this patch
> spanned clang and llvm. I'm living in the monorepo future. 
>
> On May 11, 2017 6:46 PM, "Nico Weber"  wrote:
>
>> The inline snippet doesn't show the actual code change, but
>> http://llvm.org/viewvc/llvm-project?view=revision=302835 does
>> show it. Is the email sender broken?
>>
>> On Thu, May 11, 2017 at 6:43 PM, Reid Kleckner via cfe-commits <
>> cfe-commits@lists.llvm.org> wrote:
>>
>>> Author: rnk
>>> Date: Thu May 11 17:43:02 2017
>>> New Revision: 302835
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=302835=rev
>>> Log:
>>> Issue diagnostics when returning FP values on x86_64 without SSE1/2
>>>
>>> Avoid using report_fatal_error, because it will ask the user to file a
>>> bug. If the user attempts to disable SSE on x86_64 and them use floating
>>> point, that's a bug in their code, not a bug in the compiler.
>>>
>>> This is just a start. There are other ways to crash the backend in this
>>> configuration, but they should be updated to follow this pattern.
>>>
>>> Differential Revision: https://reviews.llvm.org/D27522
>>>
>>> Added:
>>> cfe/trunk/test/CodeGen/x86_64-mno-sse.c
>>>
>>> Added: cfe/trunk/test/CodeGen/x86_64-mno-sse.c
>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/x
>>> 86_64-mno-sse.c?rev=302835=auto
>>> 
>>> ==
>>> --- cfe/trunk/test/CodeGen/x86_64-mno-sse.c (added)
>>> +++ cfe/trunk/test/CodeGen/x86_64-mno-sse.c Thu May 11 17:43:02 2017
>>> @@ -0,0 +1,15 @@
>>> +// RUN: %clang_cc1 -triple x86_64-linux -target-feature -sse
>>> -target-feature -sse2 -S -o /dev/null -verify %s
>>> +// REQUIRES: x86-registered-target
>>> +
>>> +double f1(void) { // expected-error {{SSE register return with SSE
>>> disabled}}
>>> +  return 1.4;
>>> +}
>>> +extern double g;
>>> +void f2(void) { // expected-error {{SSE register return with SSE
>>> disabled}}
>>> +  g = f1();
>>> +}
>>> +void take_double(double);
>>> +void pass_double(void) {
>>> +  // FIXME: Still asserts.
>>> +  //take_double(1.5);
>>> +}
>>>
>>>
>>> ___
>>> cfe-commits mailing list
>>> cfe-commits@lists.llvm.org
>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>>
>>
>>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r302864 - Move tests for libc++ configurations into libcxx/ test subdirectory

2017-05-11 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Thu May 11 20:49:32 2017
New Revision: 302864

URL: http://llvm.org/viewvc/llvm-project?rev=302864=rev
Log:
Move tests for libc++ configurations into libcxx/ test subdirectory

Added:

libcxx/trunk/test/libcxx/input.output/file.streams/c.files/no.global.filesystem.namespace/

libcxx/trunk/test/libcxx/input.output/file.streams/c.files/no.global.filesystem.namespace/fopen.fail.cpp
  - copied, changed from r302862, 
libcxx/trunk/test/std/input.output/file.streams/c.files/no.global.filesystem.namespace/fopen.fail.cpp

libcxx/trunk/test/libcxx/input.output/file.streams/c.files/no.global.filesystem.namespace/rename.fail.cpp
  - copied, changed from r302862, 
libcxx/trunk/test/std/input.output/file.streams/c.files/no.global.filesystem.namespace/rename.fail.cpp
Removed:

libcxx/trunk/test/std/input.output/file.streams/c.files/no.global.filesystem.namespace/fopen.fail.cpp

libcxx/trunk/test/std/input.output/file.streams/c.files/no.global.filesystem.namespace/lit.local.cfg

libcxx/trunk/test/std/input.output/file.streams/c.files/no.global.filesystem.namespace/rename.fail.cpp

Copied: 
libcxx/trunk/test/libcxx/input.output/file.streams/c.files/no.global.filesystem.namespace/fopen.fail.cpp
 (from r302862, 
libcxx/trunk/test/std/input.output/file.streams/c.files/no.global.filesystem.namespace/fopen.fail.cpp)
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/input.output/file.streams/c.files/no.global.filesystem.namespace/fopen.fail.cpp?p2=libcxx/trunk/test/libcxx/input.output/file.streams/c.files/no.global.filesystem.namespace/fopen.fail.cpp=libcxx/trunk/test/std/input.output/file.streams/c.files/no.global.filesystem.namespace/fopen.fail.cpp=302862=302864=302864=diff
==
--- 
libcxx/trunk/test/std/input.output/file.streams/c.files/no.global.filesystem.namespace/fopen.fail.cpp
 (original)
+++ 
libcxx/trunk/test/libcxx/input.output/file.streams/c.files/no.global.filesystem.namespace/fopen.fail.cpp
 Thu May 11 20:49:32 2017
@@ -7,6 +7,8 @@
 //
 
//===--===//
 
+// REQUIRES: libcpp-has-no-global-filesystem-namespace
+
 #include 
 
 int main() {

Copied: 
libcxx/trunk/test/libcxx/input.output/file.streams/c.files/no.global.filesystem.namespace/rename.fail.cpp
 (from r302862, 
libcxx/trunk/test/std/input.output/file.streams/c.files/no.global.filesystem.namespace/rename.fail.cpp)
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/input.output/file.streams/c.files/no.global.filesystem.namespace/rename.fail.cpp?p2=libcxx/trunk/test/libcxx/input.output/file.streams/c.files/no.global.filesystem.namespace/rename.fail.cpp=libcxx/trunk/test/std/input.output/file.streams/c.files/no.global.filesystem.namespace/rename.fail.cpp=302862=302864=302864=diff
==
--- 
libcxx/trunk/test/std/input.output/file.streams/c.files/no.global.filesystem.namespace/rename.fail.cpp
 (original)
+++ 
libcxx/trunk/test/libcxx/input.output/file.streams/c.files/no.global.filesystem.namespace/rename.fail.cpp
 Thu May 11 20:49:32 2017
@@ -7,6 +7,8 @@
 //
 
//===--===//
 
+// REQUIRES: libcpp-has-no-global-filesystem-namespace
+
 #include 
 
 int main() {

Removed: 
libcxx/trunk/test/std/input.output/file.streams/c.files/no.global.filesystem.namespace/fopen.fail.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/c.files/no.global.filesystem.namespace/fopen.fail.cpp?rev=302863=auto
==
--- 
libcxx/trunk/test/std/input.output/file.streams/c.files/no.global.filesystem.namespace/fopen.fail.cpp
 (original)
+++ 
libcxx/trunk/test/std/input.output/file.streams/c.files/no.global.filesystem.namespace/fopen.fail.cpp
 (removed)
@@ -1,15 +0,0 @@
-//===--===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===--===//
-
-#include 
-
-int main() {
-// fopen is not available on systems without a global filesystem namespace.
-std::fopen("", "");
-}

Removed: 
libcxx/trunk/test/std/input.output/file.streams/c.files/no.global.filesystem.namespace/lit.local.cfg
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/c.files/no.global.filesystem.namespace/lit.local.cfg?rev=302863=auto
==
--- 
libcxx/trunk/test/std/input.output/file.streams/c.files/no.global.filesystem.namespace/lit.local.cfg
 

[libcxx] r302862 - Fix or move tests with non-standard assumptions

2017-05-11 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Thu May 11 20:44:51 2017
New Revision: 302862

URL: http://llvm.org/viewvc/llvm-project?rev=302862=rev
Log:
Fix or move tests with non-standard assumptions

Added:
libcxx/trunk/test/libcxx/thread/thread.threads/thread.thread.this/

libcxx/trunk/test/libcxx/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp
  - copied, changed from r302859, 
libcxx/trunk/test/std/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp
libcxx/trunk/test/libcxx/utilities/template.bitset/includes.pass.cpp
  - copied, changed from r302859, 
libcxx/trunk/test/std/utilities/template.bitset/includes.pass.cpp
libcxx/trunk/test/libcxx/utilities/tuple/tuple.tuple/empty_member.pass.cpp
  - copied, changed from r302859, 
libcxx/trunk/test/std/utilities/tuple/tuple.tuple/empty_member.pass.cpp

libcxx/trunk/test/std/thread/thread.threads/thread.thread.this/sleep_for_tested_elsewhere.pass.cpp
Removed:

libcxx/trunk/test/std/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp
libcxx/trunk/test/std/utilities/tuple/tuple.tuple/empty_member.pass.cpp
Modified:
libcxx/trunk/test/std/utilities/template.bitset/includes.pass.cpp

Copied: 
libcxx/trunk/test/libcxx/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp
 (from r302859, 
libcxx/trunk/test/std/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp)
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp?p2=libcxx/trunk/test/libcxx/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp=libcxx/trunk/test/std/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp=302859=302862=302862=diff
==
--- 
libcxx/trunk/test/std/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp
 (original)
+++ 
libcxx/trunk/test/libcxx/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp
 Thu May 11 20:44:51 2017
@@ -35,7 +35,6 @@
 
 void sig_action(int) {}
 
-#include 
 int main()
 {
 int ec;

Copied: libcxx/trunk/test/libcxx/utilities/template.bitset/includes.pass.cpp 
(from r302859, 
libcxx/trunk/test/std/utilities/template.bitset/includes.pass.cpp)
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/utilities/template.bitset/includes.pass.cpp?p2=libcxx/trunk/test/libcxx/utilities/template.bitset/includes.pass.cpp=libcxx/trunk/test/std/utilities/template.bitset/includes.pass.cpp=302859=302862=302862=diff
==
(empty)

Copied: 
libcxx/trunk/test/libcxx/utilities/tuple/tuple.tuple/empty_member.pass.cpp 
(from r302859, 
libcxx/trunk/test/std/utilities/tuple/tuple.tuple/empty_member.pass.cpp)
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/utilities/tuple/tuple.tuple/empty_member.pass.cpp?p2=libcxx/trunk/test/libcxx/utilities/tuple/tuple.tuple/empty_member.pass.cpp=libcxx/trunk/test/std/utilities/tuple/tuple.tuple/empty_member.pass.cpp=302859=302862=302862=diff
==
(empty)

Removed: 
libcxx/trunk/test/std/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp?rev=302861=auto
==
--- 
libcxx/trunk/test/std/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp
 (removed)
@@ -1,70 +0,0 @@
-//===--===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===--===//
-//
-// UNSUPPORTED: libcpp-has-no-threads
-
-// This test uses the POSIX header  which Windows doesn't provide
-// UNSUPPORTED: windows
-
-// This test depends on signal behaviour until r210210, so some system libs
-// don't pass.
-//
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.8
-// XFAIL: with_system_cxx_lib=macosx10.7
-
-// 
-
-// template 
-//   void sleep_for(const chrono::duration& rel_time);
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-void sig_action(int) {}
-
-#include 
-int main()
-{
-int ec;
-struct sigaction action;
-action.sa_handler = _action;
-sigemptyset(_mask);
-action.sa_flags = 0;
-
-ec = sigaction(SIGALRM, , nullptr);
-assert(!ec);
-
-struct itimerval it;
-std::memset(, 0, sizeof(itimerval));
-

Re: r302835 - Issue diagnostics when returning FP values on x86_64 without SSE1/2

2017-05-11 Thread Nico Weber via cfe-commits
The inline snippet doesn't show the actual code change, but
http://llvm.org/viewvc/llvm-project?view=revision=302835 does show
it. Is the email sender broken?

On Thu, May 11, 2017 at 6:43 PM, Reid Kleckner via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: rnk
> Date: Thu May 11 17:43:02 2017
> New Revision: 302835
>
> URL: http://llvm.org/viewvc/llvm-project?rev=302835=rev
> Log:
> Issue diagnostics when returning FP values on x86_64 without SSE1/2
>
> Avoid using report_fatal_error, because it will ask the user to file a
> bug. If the user attempts to disable SSE on x86_64 and them use floating
> point, that's a bug in their code, not a bug in the compiler.
>
> This is just a start. There are other ways to crash the backend in this
> configuration, but they should be updated to follow this pattern.
>
> Differential Revision: https://reviews.llvm.org/D27522
>
> Added:
> cfe/trunk/test/CodeGen/x86_64-mno-sse.c
>
> Added: cfe/trunk/test/CodeGen/x86_64-mno-sse.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/
> CodeGen/x86_64-mno-sse.c?rev=302835=auto
> 
> ==
> --- cfe/trunk/test/CodeGen/x86_64-mno-sse.c (added)
> +++ cfe/trunk/test/CodeGen/x86_64-mno-sse.c Thu May 11 17:43:02 2017
> @@ -0,0 +1,15 @@
> +// RUN: %clang_cc1 -triple x86_64-linux -target-feature -sse
> -target-feature -sse2 -S -o /dev/null -verify %s
> +// REQUIRES: x86-registered-target
> +
> +double f1(void) { // expected-error {{SSE register return with SSE
> disabled}}
> +  return 1.4;
> +}
> +extern double g;
> +void f2(void) { // expected-error {{SSE register return with SSE
> disabled}}
> +  g = f1();
> +}
> +void take_double(double);
> +void pass_double(void) {
> +  // FIXME: Still asserts.
> +  //take_double(1.5);
> +}
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r302859 - Guard usage of libc++ regex internals inside test.

2017-05-11 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Thu May 11 20:19:01 2017
New Revision: 302859

URL: http://llvm.org/viewvc/llvm-project?rev=302859=rev
Log:
Guard usage of libc++ regex internals inside test.

This patch attempts to make lookup_classname.pass.cpp usable against
other STL implementations by guarding the use of __regex_word. That being
said it seems likely that the test is still non-conforming due to how
libc++ handles the "w" character class.

Modified:
libcxx/trunk/test/std/re/re.traits/lookup_classname.pass.cpp

Modified: libcxx/trunk/test/std/re/re.traits/lookup_classname.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/re/re.traits/lookup_classname.pass.cpp?rev=302859=302858=302859=diff
==
--- libcxx/trunk/test/std/re/re.traits/lookup_classname.pass.cpp (original)
+++ libcxx/trunk/test/std/re/re.traits/lookup_classname.pass.cpp Thu May 11 
20:19:01 2017
@@ -27,39 +27,61 @@ test(const char_type* A,
  typename std::regex_traits::char_class_type expected,
  bool icase = false)
 {
+typedef typename std::regex_traits::char_class_type 
char_class_type;
 std::regex_traits t;
 typedef forward_iterator F;
-assert(t.lookup_classname(F(A), F(A + t.length(A)), icase) == expected);
+char_class_type result = t.lookup_classname(F(A), F(A + t.length(A)), 
icase);
+assert(result == expected);
+}
+
+template 
+void
+test_w(const char_type* A,
+   typename std::regex_traits::char_class_type expected,
+bool icase = false)
+{
+typedef typename std::regex_traits::char_class_type 
char_class_type;
+std::regex_traits t;
+typedef forward_iterator F;
+char_class_type result = t.lookup_classname(F(A), F(A + t.length(A)), 
icase);
+assert((result & expected) == expected);
+LIBCPP_ASSERT((expected | std::regex_traits::__regex_word) == 
result);
+
+const bool matches_underscore = t.isctype('_', result);
+if (result != expected)
+  assert(matches_underscore && "expected to match underscore");
+else
+  assert(!matches_underscore && "should not match underscore");
 }
 
 int main()
 {
 //  if __regex_word is not distinct from all the classes, bad things happen
 //  See https://bugs.llvm.org/show_bug.cgi?id=26476 for an example.
-assert((std::ctype_base::space  & std::regex_traits::__regex_word) 
== 0);
-assert((std::ctype_base::print  & std::regex_traits::__regex_word) 
== 0);
-assert((std::ctype_base::cntrl  & std::regex_traits::__regex_word) 
== 0);
-assert((std::ctype_base::upper  & std::regex_traits::__regex_word) 
== 0);
-assert((std::ctype_base::lower  & std::regex_traits::__regex_word) 
== 0);
-assert((std::ctype_base::alpha  & std::regex_traits::__regex_word) 
== 0);
-assert((std::ctype_base::digit  & std::regex_traits::__regex_word) 
== 0);
-assert((std::ctype_base::punct  & std::regex_traits::__regex_word) 
== 0);
-assert((std::ctype_base::xdigit & std::regex_traits::__regex_word) 
== 0);
-assert((std::ctype_base::blank  & std::regex_traits::__regex_word) 
== 0);
+LIBCPP_ASSERT((std::ctype_base::space  & 
std::regex_traits::__regex_word) == 0);
+LIBCPP_ASSERT((std::ctype_base::print  & 
std::regex_traits::__regex_word) == 0);
+LIBCPP_ASSERT((std::ctype_base::cntrl  & 
std::regex_traits::__regex_word) == 0);
+LIBCPP_ASSERT((std::ctype_base::upper  & 
std::regex_traits::__regex_word) == 0);
+LIBCPP_ASSERT((std::ctype_base::lower  & 
std::regex_traits::__regex_word) == 0);
+LIBCPP_ASSERT((std::ctype_base::alpha  & 
std::regex_traits::__regex_word) == 0);
+LIBCPP_ASSERT((std::ctype_base::digit  & 
std::regex_traits::__regex_word) == 0);
+LIBCPP_ASSERT((std::ctype_base::punct  & 
std::regex_traits::__regex_word) == 0);
+LIBCPP_ASSERT((std::ctype_base::xdigit & 
std::regex_traits::__regex_word) == 0);
+LIBCPP_ASSERT((std::ctype_base::blank  & 
std::regex_traits::__regex_word) == 0);
 
 test("d", std::ctype_base::digit);
 test("D", std::ctype_base::digit);
 test("d", std::ctype_base::digit, true);
 test("D", std::ctype_base::digit, true);
 
-test("w", std::regex_traits::__regex_word | std::ctype_base::alnum
-  | std::ctype_base::upper | std::ctype_base::lower);
-test("W", std::regex_traits::__regex_word | std::ctype_base::alnum
-  | std::ctype_base::upper | std::ctype_base::lower);
-test("w", std::regex_traits::__regex_word | std::ctype_base::alnum
-  | std::ctype_base::upper | std::ctype_base::lower, true);
-test("W", std::regex_traits::__regex_word | std::ctype_base::alnum
-  | std::ctype_base::upper | std::ctype_base::lower, true);
+test_w("w", std::ctype_base::alnum
+  | std::ctype_base::upper | std::ctype_base::lower);
+test_w("W", std::ctype_base::alnum
+  | std::ctype_base::upper | std::ctype_base::lower);
+test_w("w", 

[PATCH] D33103: [clang-tidy] TwineLocalCheck: add param # checking

2017-05-11 Thread Chih-Hung Hsieh via Phabricator via cfe-commits
chh added a comment.

LGTM. Leave approval to bkramer.


https://reviews.llvm.org/D33103



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


[PATCH] D33103: [clang-tidy] TwineLocalCheck: add param # checking

2017-05-11 Thread Yan Wang via Phabricator via cfe-commits
yawanng updated this revision to Diff 98705.
yawanng added a comment.

Add more tests.


https://reviews.llvm.org/D33103

Files:
  clang-tidy/llvm/TwineLocalCheck.cpp
  test/clang-tidy/llvm-twine-local.cpp


Index: test/clang-tidy/llvm-twine-local.cpp
===
--- test/clang-tidy/llvm-twine-local.cpp
+++ test/clang-tidy/llvm-twine-local.cpp
@@ -5,6 +5,7 @@
 public:
   Twine(const char *);
   Twine(int);
+  Twine();
   Twine +(const Twine &);
 };
 }
@@ -29,4 +30,35 @@
 // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: twine variables are prone to 
use-after-free bugs
 // CHECK-MESSAGES: note: FIX-IT applied suggested code changes
 // CHECK-FIXES: const char * Prefix = false ? "__INT_FAST" : "__UINT_FAST";
+
+  const Twine t2 = Twine();
+// CHECK-MESSAGES: :[[@LINE-1]]:15: warning: twine variables are prone to 
use-after-free bugs
+// CHECK-MESSAGES: note: FIX-IT applied suggested code changes
+// CHECK-FIXES: std::string t2 = (Twine()).str();
+  foo(Twine() + "b");
+
+  const Twine t3 = Twine(42);
+// CHECK-MESSAGES: :[[@LINE-1]]:15: warning: twine variables are prone to 
use-after-free bugs
+// CHECK-MESSAGES: note: FIX-IT applied suggested code changes
+// CHECK-FIXES: std::string t3 = (Twine(42)).str();
+
+  const Twine t4 = Twine(42) + "b";
+// CHECK-MESSAGES: :[[@LINE-1]]:15: warning: twine variables are prone to 
use-after-free bugs
+// CHECK-MESSAGES: note: FIX-IT applied suggested code changes
+// CHECK-FIXES: std::string t4 = (Twine(42) + "b").str();
+
+  const Twine t5 = Twine() + "b";
+// CHECK-MESSAGES: :[[@LINE-1]]:15: warning: twine variables are prone to 
use-after-free bugs
+// CHECK-MESSAGES: note: FIX-IT applied suggested code changes
+// CHECK-FIXES: std::string t5 = (Twine() + "b").str();
+
+  const Twine t6 = true ? Twine() : Twine(42);
+// CHECK-MESSAGES: :[[@LINE-1]]:15: warning: twine variables are prone to 
use-after-free bugs
+// CHECK-MESSAGES: note: FIX-IT applied suggested code changes
+// CHECK-FIXES: std::string t6 = (true ? Twine() : Twine(42)).str();
+
+  const Twine t7 = false ? Twine() : Twine("b");
+// CHECK-MESSAGES: :[[@LINE-1]]:15: warning: twine variables are prone to 
use-after-free bugs
+// CHECK-MESSAGES: note: FIX-IT applied suggested code changes
+// CHECK-FIXES: std::string t7 = (false ? Twine() : Twine("b")).str();
 }
Index: clang-tidy/llvm/TwineLocalCheck.cpp
===
--- clang-tidy/llvm/TwineLocalCheck.cpp
+++ clang-tidy/llvm/TwineLocalCheck.cpp
@@ -35,8 +35,11 @@
 // of the initializer.
 const Expr *C = VD->getInit()->IgnoreImplicit();
 
-while (isa(C))
+while (isa(C)) {
+  if (cast(C)->getNumArgs() == 0)
+break;
   C = cast(C)->getArg(0)->IgnoreParenImpCasts();
+}
 
 SourceRange TypeRange =
 VD->getTypeSourceInfo()->getTypeLoc().getSourceRange();


Index: test/clang-tidy/llvm-twine-local.cpp
===
--- test/clang-tidy/llvm-twine-local.cpp
+++ test/clang-tidy/llvm-twine-local.cpp
@@ -5,6 +5,7 @@
 public:
   Twine(const char *);
   Twine(int);
+  Twine();
   Twine +(const Twine &);
 };
 }
@@ -29,4 +30,35 @@
 // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: twine variables are prone to use-after-free bugs
 // CHECK-MESSAGES: note: FIX-IT applied suggested code changes
 // CHECK-FIXES: const char * Prefix = false ? "__INT_FAST" : "__UINT_FAST";
+
+  const Twine t2 = Twine();
+// CHECK-MESSAGES: :[[@LINE-1]]:15: warning: twine variables are prone to use-after-free bugs
+// CHECK-MESSAGES: note: FIX-IT applied suggested code changes
+// CHECK-FIXES: std::string t2 = (Twine()).str();
+  foo(Twine() + "b");
+
+  const Twine t3 = Twine(42);
+// CHECK-MESSAGES: :[[@LINE-1]]:15: warning: twine variables are prone to use-after-free bugs
+// CHECK-MESSAGES: note: FIX-IT applied suggested code changes
+// CHECK-FIXES: std::string t3 = (Twine(42)).str();
+
+  const Twine t4 = Twine(42) + "b";
+// CHECK-MESSAGES: :[[@LINE-1]]:15: warning: twine variables are prone to use-after-free bugs
+// CHECK-MESSAGES: note: FIX-IT applied suggested code changes
+// CHECK-FIXES: std::string t4 = (Twine(42) + "b").str();
+
+  const Twine t5 = Twine() + "b";
+// CHECK-MESSAGES: :[[@LINE-1]]:15: warning: twine variables are prone to use-after-free bugs
+// CHECK-MESSAGES: note: FIX-IT applied suggested code changes
+// CHECK-FIXES: std::string t5 = (Twine() + "b").str();
+
+  const Twine t6 = true ? Twine() : Twine(42);
+// CHECK-MESSAGES: :[[@LINE-1]]:15: warning: twine variables are prone to use-after-free bugs
+// CHECK-MESSAGES: note: FIX-IT applied suggested code changes
+// CHECK-FIXES: std::string t6 = (true ? Twine() : Twine(42)).str();
+
+  const Twine t7 = false ? Twine() : Twine("b");
+// CHECK-MESSAGES: :[[@LINE-1]]:15: warning: twine variables are prone to use-after-free bugs
+// CHECK-MESSAGES: note: FIX-IT applied suggested code changes
+// CHECK-FIXES: 

[PATCH] D33061: [tooling] RefactoringCallbacks code cleanup

2017-05-11 Thread Alexander Shaposhnikov via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL302855: [tooling] RefactoringCallbacks code cleanup 
(authored by alexshap).

Changed prior to commit:
  https://reviews.llvm.org/D33061?vs=98509=98704#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D33061

Files:
  cfe/trunk/include/clang/Tooling/RefactoringCallbacks.h
  cfe/trunk/lib/Tooling/RefactoringCallbacks.cpp


Index: cfe/trunk/include/clang/Tooling/RefactoringCallbacks.h
===
--- cfe/trunk/include/clang/Tooling/RefactoringCallbacks.h
+++ cfe/trunk/include/clang/Tooling/RefactoringCallbacks.h
@@ -53,7 +53,8 @@
 /// Runs AST matchers and stores the \c tooling::Replacements in a map.
 class ASTMatchRefactorer {
 public:
-  ASTMatchRefactorer(std::map );
+  explicit ASTMatchRefactorer(
+std::map );
 
   template 
   void addMatcher(const T , RefactoringCallback *Callback) {
@@ -103,7 +104,7 @@
 std::string Value;
   };
   ReplaceNodeWithTemplate(llvm::StringRef FromId,
-  std::vector &);
+  std::vector Template);
   std::string FromId;
   std::vector Template;
 };
Index: cfe/trunk/lib/Tooling/RefactoringCallbacks.cpp
===
--- cfe/trunk/lib/Tooling/RefactoringCallbacks.cpp
+++ cfe/trunk/lib/Tooling/RefactoringCallbacks.cpp
@@ -38,7 +38,7 @@
 
 class RefactoringASTConsumer : public ASTConsumer {
 public:
-  RefactoringASTConsumer(ASTMatchRefactorer )
+  explicit RefactoringASTConsumer(ASTMatchRefactorer )
   : Refactoring(Refactoring) {}
 
   void HandleTranslationUnit(ASTContext ) override {
@@ -153,8 +153,8 @@
 }
 
 ReplaceNodeWithTemplate::ReplaceNodeWithTemplate(
-llvm::StringRef FromId, std::vector &)
-: FromId(FromId), Template(Template) {}
+llvm::StringRef FromId, std::vector Template)
+: FromId(FromId), Template(std::move(Template)) {}
 
 llvm::Expected
 ReplaceNodeWithTemplate::create(StringRef FromId, StringRef ToTemplate) {


Index: cfe/trunk/include/clang/Tooling/RefactoringCallbacks.h
===
--- cfe/trunk/include/clang/Tooling/RefactoringCallbacks.h
+++ cfe/trunk/include/clang/Tooling/RefactoringCallbacks.h
@@ -53,7 +53,8 @@
 /// Runs AST matchers and stores the \c tooling::Replacements in a map.
 class ASTMatchRefactorer {
 public:
-  ASTMatchRefactorer(std::map );
+  explicit ASTMatchRefactorer(
+std::map );
 
   template 
   void addMatcher(const T , RefactoringCallback *Callback) {
@@ -103,7 +104,7 @@
 std::string Value;
   };
   ReplaceNodeWithTemplate(llvm::StringRef FromId,
-  std::vector &);
+  std::vector Template);
   std::string FromId;
   std::vector Template;
 };
Index: cfe/trunk/lib/Tooling/RefactoringCallbacks.cpp
===
--- cfe/trunk/lib/Tooling/RefactoringCallbacks.cpp
+++ cfe/trunk/lib/Tooling/RefactoringCallbacks.cpp
@@ -38,7 +38,7 @@
 
 class RefactoringASTConsumer : public ASTConsumer {
 public:
-  RefactoringASTConsumer(ASTMatchRefactorer )
+  explicit RefactoringASTConsumer(ASTMatchRefactorer )
   : Refactoring(Refactoring) {}
 
   void HandleTranslationUnit(ASTContext ) override {
@@ -153,8 +153,8 @@
 }
 
 ReplaceNodeWithTemplate::ReplaceNodeWithTemplate(
-llvm::StringRef FromId, std::vector &)
-: FromId(FromId), Template(Template) {}
+llvm::StringRef FromId, std::vector Template)
+: FromId(FromId), Template(std::move(Template)) {}
 
 llvm::Expected
 ReplaceNodeWithTemplate::create(StringRef FromId, StringRef ToTemplate) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r302855 - [tooling] RefactoringCallbacks code cleanup

2017-05-11 Thread Alexander Shaposhnikov via cfe-commits
Author: alexshap
Date: Thu May 11 19:16:56 2017
New Revision: 302855

URL: http://llvm.org/viewvc/llvm-project?rev=302855=rev
Log:
[tooling] RefactoringCallbacks code cleanup

This diff
 1. adds missing "explicit" for single argument constructors
 2. adds missing std::move in ReplaceNodeWithTemplate constructor

Test plan: make check-all

Differential revision: https://reviews.llvm.org/D33061

Modified:
cfe/trunk/include/clang/Tooling/RefactoringCallbacks.h
cfe/trunk/lib/Tooling/RefactoringCallbacks.cpp

Modified: cfe/trunk/include/clang/Tooling/RefactoringCallbacks.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Tooling/RefactoringCallbacks.h?rev=302855=302854=302855=diff
==
--- cfe/trunk/include/clang/Tooling/RefactoringCallbacks.h (original)
+++ cfe/trunk/include/clang/Tooling/RefactoringCallbacks.h Thu May 11 19:16:56 
2017
@@ -53,7 +53,8 @@ protected:
 /// Runs AST matchers and stores the \c tooling::Replacements in a map.
 class ASTMatchRefactorer {
 public:
-  ASTMatchRefactorer(std::map );
+  explicit ASTMatchRefactorer(
+std::map );
 
   template 
   void addMatcher(const T , RefactoringCallback *Callback) {
@@ -103,7 +104,7 @@ private:
 std::string Value;
   };
   ReplaceNodeWithTemplate(llvm::StringRef FromId,
-  std::vector &);
+  std::vector Template);
   std::string FromId;
   std::vector Template;
 };

Modified: cfe/trunk/lib/Tooling/RefactoringCallbacks.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/RefactoringCallbacks.cpp?rev=302855=302854=302855=diff
==
--- cfe/trunk/lib/Tooling/RefactoringCallbacks.cpp (original)
+++ cfe/trunk/lib/Tooling/RefactoringCallbacks.cpp Thu May 11 19:16:56 2017
@@ -38,7 +38,7 @@ void ASTMatchRefactorer::addDynamicMatch
 
 class RefactoringASTConsumer : public ASTConsumer {
 public:
-  RefactoringASTConsumer(ASTMatchRefactorer )
+  explicit RefactoringASTConsumer(ASTMatchRefactorer )
   : Refactoring(Refactoring) {}
 
   void HandleTranslationUnit(ASTContext ) override {
@@ -153,8 +153,8 @@ void ReplaceIfStmtWithItsBody::run(
 }
 
 ReplaceNodeWithTemplate::ReplaceNodeWithTemplate(
-llvm::StringRef FromId, std::vector &)
-: FromId(FromId), Template(Template) {}
+llvm::StringRef FromId, std::vector Template)
+: FromId(FromId), Template(std::move(Template)) {}
 
 llvm::Expected
 ReplaceNodeWithTemplate::create(StringRef FromId, StringRef ToTemplate) {


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


r302854 - Fix uninitialized bool read causing x86_64-mno-sse.c test failure

2017-05-11 Thread Reid Kleckner via cfe-commits
Author: rnk
Date: Thu May 11 19:10:49 2017
New Revision: 302854

URL: http://llvm.org/viewvc/llvm-project?rev=302854=rev
Log:
Fix uninitialized bool read causing x86_64-mno-sse.c test failure

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

Modified: cfe/trunk/lib/CodeGen/CodeGenAction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenAction.cpp?rev=302854=302853=302854=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenAction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenAction.cpp Thu May 11 19:10:49 2017
@@ -548,9 +548,9 @@ void BackendConsumer::UnsupportedDiagHan
 
   StringRef Filename;
   unsigned Line, Column;
-  bool BadDebugInfo;
-  FullSourceLoc Loc = getBestLocationFromDebugLoc(D, BadDebugInfo, Filename,
-  Line, Column);
+  bool BadDebugInfo = false;
+  FullSourceLoc Loc =
+  getBestLocationFromDebugLoc(D, BadDebugInfo, Filename, Line, Column);
 
   Diags.Report(Loc, diag::err_fe_backend_unsupported) << D.getMessage().str();
 
@@ -572,8 +572,8 @@ void BackendConsumer::EmitOptimizationMe
   StringRef Filename;
   unsigned Line, Column;
   bool BadDebugInfo = false;
-  FullSourceLoc Loc = getBestLocationFromDebugLoc(D, BadDebugInfo, Filename,
-  Line, Column);
+  FullSourceLoc Loc =
+  getBestLocationFromDebugLoc(D, BadDebugInfo, Filename, Line, Column);
 
   std::string Msg;
   raw_string_ostream MsgStream(Msg);


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


Re: r302840 - Module Debug Info: Emit namespaced C++ forward decls in the correct module.

2017-05-11 Thread Adrian Prantl via cfe-commits

> On May 11, 2017, at 4:43 PM, Richard Smith  wrote:
> 
> On 11 May 2017 at 15:59, Adrian Prantl via cfe-commits 
>  wrote:
> Author: adrian
> Date: Thu May 11 17:59:19 2017
> New Revision: 302840
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=302840=rev
> Log:
> Module Debug Info: Emit namespaced C++ forward decls in the correct module.
> 
> The AST merges NamespaceDecls, but for module debug info it is
> important to put a namespace decl (or rather its children) into the
> correct (sub-)module, so we need to use the parent module of the decl
> that triggered this namespace to be serialized as a second key when
> looking up DINamespace nodes.
> 
> I don't think that's quite right; the AST doesn't merge NamespaceDecls. It 
> looks like the issue is that we're mapping to the semantic DeclContext (which 
> will be the canonical declaration of the namespace and could be from a 
> different module) rather than the lexical DeclContext (the enclosing one, in 
> the same module)... and then getOrCreateNameSpace is again mapping to the 
> canonical declaration before calling getDeclContextDescriptor.

Thanks for pointing this out! It looks like I can simplify the code a lot if I 
can pass the lexical DeclContext to getOrCreateNamespace and then delegate the 
uniquing of the DINamespaces to DIBuilder (or rather MDNode), which will work 
now that DINamespaces don't carry line and file any more.

I see that there is Decl::getLexicalContext(), so this should be doable.

-- adrian
>  
> rdar://problem/29339538
> 
> Added:
> cfe/trunk/test/Modules/DebugInfoNamespace.cpp
> cfe/trunk/test/Modules/Inputs/DebugInfoNamespace/
> cfe/trunk/test/Modules/Inputs/DebugInfoNamespace/A.h
> cfe/trunk/test/Modules/Inputs/DebugInfoNamespace/B.h
> cfe/trunk/test/Modules/Inputs/DebugInfoNamespace/module.modulemap
> Modified:
> cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
> cfe/trunk/lib/CodeGen/CGDebugInfo.h
> 
> Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=302840=302839=302840=diff
> ==
> --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Thu May 11 17:59:19 2017
> @@ -208,8 +208,10 @@ llvm::DIScope *CGDebugInfo::getContextDe
>}
> 
>// Check namespace.
> -  if (const auto *NSDecl = dyn_cast(Context))
> -return getOrCreateNameSpace(NSDecl);
> +  if (const auto *NSDecl = dyn_cast(Context)) {
> +auto *ParentModule = dyn_cast(Default);
> +return getOrCreateNamespace(NSDecl, ParentModule);
> +  }
> 
>if (const auto *RDecl = dyn_cast(Context))
>  if (!RDecl->isDependentType())
> @@ -2861,7 +2863,7 @@ void CGDebugInfo::collectFunctionDeclPro
>if (DebugKind >= codegenoptions::LimitedDebugInfo) {
>  if (const NamespaceDecl *NSDecl =
>  dyn_cast_or_null(FD->getDeclContext()))
> -  FDContext = getOrCreateNameSpace(NSDecl);
> +FDContext = getOrCreateNamespace(NSDecl, getParentModuleOrNull(FD));
>  else if (const RecordDecl *RDecl =
>   dyn_cast_or_null(FD->getDeclContext())) {
>llvm::DIScope *Mod = getParentModuleOrNull(RDecl);
> @@ -3961,7 +3963,7 @@ void CGDebugInfo::EmitUsingDirective(con
>CGM.getCodeGenOpts().DebugExplicitImport) {
>  DBuilder.createImportedModule(
>  getCurrentContextDescriptor(cast(UD.getDeclContext())),
> -getOrCreateNameSpace(NSDecl),
> +getOrCreateNamespace(NSDecl, getParentModuleOrNull()),
>  getLineNumber(UD.getLocation()));
>}
>  }
> @@ -4021,23 +4023,32 @@ CGDebugInfo::EmitNamespaceAlias(const Na
>else
>  R = DBuilder.createImportedDeclaration(
>  getCurrentContextDescriptor(cast(NA.getDeclContext())),
> -getOrCreateNameSpace(cast(NA.getAliasedNamespace())),
> +getOrCreateNamespace(cast(NA.getAliasedNamespace()),
> + getParentModuleOrNull()),
>  getLineNumber(NA.getLocation()), NA.getName());
>VH.reset(R);
>return R;
>  }
> 
>  llvm::DINamespace *
> -CGDebugInfo::getOrCreateNameSpace(const NamespaceDecl *NSDecl) {
> +CGDebugInfo::getOrCreateNamespace(const NamespaceDecl *NSDecl,
> +  llvm::DIModule *ParentModule) {
>NSDecl = NSDecl->getCanonicalDecl();
> -  auto I = NameSpaceCache.find(NSDecl);
> -  if (I != NameSpaceCache.end())
> +  // The AST merges NamespaceDecls, but for module debug info it is 
> important to
> +  // put a namespace decl (or rather its children) into the correct
> +  // (sub-)module, so use the parent module of the decl that triggered this
> +  // namespace to be serialized as a second key.
> +  NamespaceKey Key = {NSDecl, ParentModule};
> +  auto I = NamespaceCache.find(Key);
> +  if (I != NamespaceCache.end())
>  return cast(I->second);
> 
>llvm::DIScope *Context = 

[PATCH] D32178: Delete unstable integration tests

2017-05-11 Thread Richard Smith via Phabricator via cfe-commits
rsmith added a comment.

Clang's regression test suite is not a sensible home for these tests. We should 
have a home and a plan for system-specific integration tests, but this is not 
it. Perhaps this should instead be a part of LNT / the test-suite project?


https://reviews.llvm.org/D32178



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


Re: r302840 - Module Debug Info: Emit namespaced C++ forward decls in the correct module.

2017-05-11 Thread Richard Smith via cfe-commits
On 11 May 2017 at 15:59, Adrian Prantl via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: adrian
> Date: Thu May 11 17:59:19 2017
> New Revision: 302840
>
> URL: http://llvm.org/viewvc/llvm-project?rev=302840=rev
> Log:
> Module Debug Info: Emit namespaced C++ forward decls in the correct module.
>
> The AST merges NamespaceDecls, but for module debug info it is
> important to put a namespace decl (or rather its children) into the
> correct (sub-)module, so we need to use the parent module of the decl
> that triggered this namespace to be serialized as a second key when
> looking up DINamespace nodes.
>

I don't think that's quite right; the AST doesn't merge NamespaceDecls. It
looks like the issue is that we're mapping to the semantic DeclContext
(which will be the canonical declaration of the namespace and could be from
a different module) rather than the lexical DeclContext (the enclosing one,
in the same module)... and then getOrCreateNameSpace is again mapping to
the canonical declaration before calling getDeclContextDescriptor.


> rdar://problem/29339538
>
> Added:
> cfe/trunk/test/Modules/DebugInfoNamespace.cpp
> cfe/trunk/test/Modules/Inputs/DebugInfoNamespace/
> cfe/trunk/test/Modules/Inputs/DebugInfoNamespace/A.h
> cfe/trunk/test/Modules/Inputs/DebugInfoNamespace/B.h
> cfe/trunk/test/Modules/Inputs/DebugInfoNamespace/module.modulemap
> Modified:
> cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
> cfe/trunk/lib/CodeGen/CGDebugInfo.h
>
> Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/
> CGDebugInfo.cpp?rev=302840=302839=302840=diff
> 
> ==
> --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Thu May 11 17:59:19 2017
> @@ -208,8 +208,10 @@ llvm::DIScope *CGDebugInfo::getContextDe
>}
>
>// Check namespace.
> -  if (const auto *NSDecl = dyn_cast(Context))
> -return getOrCreateNameSpace(NSDecl);
> +  if (const auto *NSDecl = dyn_cast(Context)) {
> +auto *ParentModule = dyn_cast(Default);
> +return getOrCreateNamespace(NSDecl, ParentModule);
> +  }
>
>if (const auto *RDecl = dyn_cast(Context))
>  if (!RDecl->isDependentType())
> @@ -2861,7 +2863,7 @@ void CGDebugInfo::collectFunctionDeclPro
>if (DebugKind >= codegenoptions::LimitedDebugInfo) {
>  if (const NamespaceDecl *NSDecl =
>  dyn_cast_or_null(FD->getDeclContext()))
> -  FDContext = getOrCreateNameSpace(NSDecl);
> +FDContext = getOrCreateNamespace(NSDecl, getParentModuleOrNull(FD));
>  else if (const RecordDecl *RDecl =
>   dyn_cast_or_null(FD->getDeclContext())) {
>llvm::DIScope *Mod = getParentModuleOrNull(RDecl);
> @@ -3961,7 +3963,7 @@ void CGDebugInfo::EmitUsingDirective(con
>CGM.getCodeGenOpts().DebugExplicitImport) {
>  DBuilder.createImportedModule(
>  getCurrentContextDescriptor(cast(UD.getDeclContext())),
> -getOrCreateNameSpace(NSDecl),
> +getOrCreateNamespace(NSDecl, getParentModuleOrNull()),
>  getLineNumber(UD.getLocation()));
>}
>  }
> @@ -4021,23 +4023,32 @@ CGDebugInfo::EmitNamespaceAlias(const Na
>else
>  R = DBuilder.createImportedDeclaration(
>  getCurrentContextDescriptor(cast(NA.getDeclContext())),
> -getOrCreateNameSpace(cast(NA.
> getAliasedNamespace())),
> +getOrCreateNamespace(cast(NA.
> getAliasedNamespace()),
> + getParentModuleOrNull()),
>  getLineNumber(NA.getLocation()), NA.getName());
>VH.reset(R);
>return R;
>  }
>
>  llvm::DINamespace *
> -CGDebugInfo::getOrCreateNameSpace(const NamespaceDecl *NSDecl) {
> +CGDebugInfo::getOrCreateNamespace(const NamespaceDecl *NSDecl,
> +  llvm::DIModule *ParentModule) {
>NSDecl = NSDecl->getCanonicalDecl();
> -  auto I = NameSpaceCache.find(NSDecl);
> -  if (I != NameSpaceCache.end())
> +  // The AST merges NamespaceDecls, but for module debug info it is
> important to
> +  // put a namespace decl (or rather its children) into the correct
> +  // (sub-)module, so use the parent module of the decl that triggered
> this
> +  // namespace to be serialized as a second key.
> +  NamespaceKey Key = {NSDecl, ParentModule};
> +  auto I = NamespaceCache.find(Key);
> +  if (I != NamespaceCache.end())
>  return cast(I->second);
>
>llvm::DIScope *Context = getDeclContextDescriptor(NSDecl);
> -  llvm::DINamespace *NS =
> -  DBuilder.createNameSpace(Context, NSDecl->getName(),
> NSDecl->isInline());
> -  NameSpaceCache[NSDecl].reset(NS);
> +  // Don't trust the context if it is a DIModule (see comment above).
> +  llvm::DINamespace *NS = DBuilder.createNameSpace(
> +  isa(Context) ? ParentModule : Context,
> NSDecl->getName(),
> +  NSDecl->isInline());
> +  NamespaceCache[Key].reset(NS);
>return NS;
>  }
>
>
> Modified: 

[PATCH] D33109: Enhance synchscope representation (clang)

2017-05-11 Thread Tony Tye via Phabricator via cfe-commits
t-tye accepted this revision.
t-tye added a comment.
This revision is now accepted and ready to land.

LGTM


https://reviews.llvm.org/D33109



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


[PATCH] D33109: Enhance synchscope representation (clang)

2017-05-11 Thread Konstantin Zhuravlyov via Phabricator via cfe-commits
kzhuravl created this revision.
Herald added a subscriber: wdng.

https://reviews.llvm.org/D33109

Files:
  lib/CodeGen/CGBuiltin.cpp
  test/CodeGen/ms-barriers-intrinsics.c

Index: test/CodeGen/ms-barriers-intrinsics.c
===
--- test/CodeGen/ms-barriers-intrinsics.c
+++ test/CodeGen/ms-barriers-intrinsics.c
@@ -13,19 +13,19 @@
 
 void test_ReadWriteBarrier() { _ReadWriteBarrier(); }
 // CHECK-LABEL: define void @test_ReadWriteBarrier
-// CHECK:   fence singlethread seq_cst
+// CHECK:   fence syncscope("singlethread") seq_cst
 // CHECK:   ret void
 // CHECK: }
 
 void test_ReadBarrier() { _ReadBarrier(); }
 // CHECK-LABEL: define void @test_ReadBarrier
-// CHECK:   fence singlethread seq_cst
+// CHECK:   fence syncscope("singlethread") seq_cst
 // CHECK:   ret void
 // CHECK: }
 
 void test_WriteBarrier() { _WriteBarrier(); }
 // CHECK-LABEL: define void @test_WriteBarrier
-// CHECK:   fence singlethread seq_cst
+// CHECK:   fence syncscope("singlethread") seq_cst
 // CHECK:   ret void
 // CHECK: }
 
@@ -36,4 +36,3 @@
 // CHECK-X64:   ret void
 // CHECK-X64: }
 #endif
-
Index: lib/CodeGen/CGBuiltin.cpp
===
--- lib/CodeGen/CGBuiltin.cpp
+++ lib/CodeGen/CGBuiltin.cpp
@@ -1810,12 +1810,12 @@
   case Builtin::BI__atomic_signal_fence:
   case Builtin::BI__c11_atomic_thread_fence:
   case Builtin::BI__c11_atomic_signal_fence: {
-llvm::SynchronizationScope Scope;
+llvm::SyncScope::ID SSID;
 if (BuiltinID == Builtin::BI__atomic_signal_fence ||
 BuiltinID == Builtin::BI__c11_atomic_signal_fence)
-  Scope = llvm::SingleThread;
+  SSID = llvm::SyncScope::SingleThread;
 else
-  Scope = llvm::CrossThread;
+  SSID = llvm::SyncScope::System;
 Value *Order = EmitScalarExpr(E->getArg(0));
 if (isa(Order)) {
   int ord = cast(Order)->getZExtValue();
@@ -1825,17 +1825,16 @@
 break;
   case 1:  // memory_order_consume
   case 2:  // memory_order_acquire
-Builder.CreateFence(llvm::AtomicOrdering::Acquire, Scope);
+Builder.CreateFence(llvm::AtomicOrdering::Acquire, SSID);
 break;
   case 3:  // memory_order_release
-Builder.CreateFence(llvm::AtomicOrdering::Release, Scope);
+Builder.CreateFence(llvm::AtomicOrdering::Release, SSID);
 break;
   case 4:  // memory_order_acq_rel
-Builder.CreateFence(llvm::AtomicOrdering::AcquireRelease, Scope);
+Builder.CreateFence(llvm::AtomicOrdering::AcquireRelease, SSID);
 break;
   case 5:  // memory_order_seq_cst
-Builder.CreateFence(llvm::AtomicOrdering::SequentiallyConsistent,
-Scope);
+Builder.CreateFence(llvm::AtomicOrdering::SequentiallyConsistent, SSID);
 break;
   }
   return RValue::get(nullptr);
@@ -1852,23 +1851,23 @@
 llvm::SwitchInst *SI = Builder.CreateSwitch(Order, ContBB);
 
 Builder.SetInsertPoint(AcquireBB);
-Builder.CreateFence(llvm::AtomicOrdering::Acquire, Scope);
+Builder.CreateFence(llvm::AtomicOrdering::Acquire, SSID);
 Builder.CreateBr(ContBB);
 SI->addCase(Builder.getInt32(1), AcquireBB);
 SI->addCase(Builder.getInt32(2), AcquireBB);
 
 Builder.SetInsertPoint(ReleaseBB);
-Builder.CreateFence(llvm::AtomicOrdering::Release, Scope);
+Builder.CreateFence(llvm::AtomicOrdering::Release, SSID);
 Builder.CreateBr(ContBB);
 SI->addCase(Builder.getInt32(3), ReleaseBB);
 
 Builder.SetInsertPoint(AcqRelBB);
-Builder.CreateFence(llvm::AtomicOrdering::AcquireRelease, Scope);
+Builder.CreateFence(llvm::AtomicOrdering::AcquireRelease, SSID);
 Builder.CreateBr(ContBB);
 SI->addCase(Builder.getInt32(4), AcqRelBB);
 
 Builder.SetInsertPoint(SeqCstBB);
-Builder.CreateFence(llvm::AtomicOrdering::SequentiallyConsistent, Scope);
+Builder.CreateFence(llvm::AtomicOrdering::SequentiallyConsistent, SSID);
 Builder.CreateBr(ContBB);
 SI->addCase(Builder.getInt32(5), SeqCstBB);
 
@@ -8005,13 +8004,13 @@
 
   case X86::BI__faststorefence: {
 return Builder.CreateFence(llvm::AtomicOrdering::SequentiallyConsistent,
-   llvm::CrossThread);
+   llvm::SyncScope::System);
   }
   case X86::BI_ReadWriteBarrier:
   case X86::BI_ReadBarrier:
   case X86::BI_WriteBarrier: {
 return Builder.CreateFence(llvm::AtomicOrdering::SequentiallyConsistent,
-   llvm::SingleThread);
+   llvm::SyncScope::SingleThread);
   }
   case X86::BI_BitScanForward:
   case X86::BI_BitScanForward64:
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D32248: CodeGen: Cast alloca to expected address space

2017-05-11 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments.



Comment at: lib/CodeGen/TargetInfo.cpp:7291
+  Address adjustAddrSpaceForAutoVar(Address A, const VarDecl *VD,
+  CodeGen::CodeGenFunction ) const override;
 };

yaxunl wrote:
> rjmccall wrote:
> > yaxunl wrote:
> > > rjmccall wrote:
> > > > How about, instead of introducing a second method, we just change 
> > > > performAddrSpaceCast to take two AST address spaces and a flag 
> > > > indicating whether the address is known to be non-null?  Does your 
> > > > target have an AST-level address space for the stack?
> > > In both AST and LLVM, the destination pointee type of address space cast 
> > > may be different from the source pointee type (e.g. `addrspacecast i32 
> > > addrspace(1)* %a to i8 addrspace(4)*` is valid LLVM instruction), so 
> > > performAddrSpaceCast needs to know the destination QualType, not just the 
> > > address space.
> > Is there any harm to generating separate cast instructions when this 
> > happens?
> They should be equivalent but the LLVM IR will be more verbose and take more 
> space, and LLVM passes will take more time since previously they only need to 
> process one instruction but now they need to process two instructions.
> 
> The original representation is more concise, why should we change that to 
> emit two instructions instead of one instruction?
It's a cleaner API.

But fine, whatever, feel free to pass down an optional llvm::PointerType* for 
the destination type.


https://reviews.llvm.org/D32248



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


[PATCH] D32178: Delete unstable integration tests

2017-05-11 Thread Jonathan Roelofs via Phabricator via cfe-commits
jroelofs added a comment.

ping @arphaman


https://reviews.llvm.org/D32178



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


r302842 - Remove unnecessary mapping from SourceLocation to Module.

2017-05-11 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Thu May 11 18:11:16 2017
New Revision: 302842

URL: http://llvm.org/viewvc/llvm-project?rev=302842=rev
Log:
Remove unnecessary mapping from SourceLocation to Module.

When we parse a redefinition of an entity for which we have a hidden existing
declaration, make it visible in the current module instead of mapping the
current source location to its containing module.

Modified:
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaLookup.cpp
cfe/trunk/lib/Sema/SemaTemplate.cpp

Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=302842=302841=302842=diff
==
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Thu May 11 18:11:16 2017
@@ -1456,6 +1456,11 @@ private:
   /// The modules we're currently parsing.
   llvm::SmallVector ModuleScopes;
 
+  /// Get the module whose scope we are currently within.
+  Module *getCurrentModule() const {
+return ModuleScopes.empty() ? nullptr : ModuleScopes.back().Module;
+  }
+
   VisibleModuleSet VisibleModules;
 
   Module *CachedFakeTopLevelModule;
@@ -1466,7 +1471,7 @@ public:
 
   /// \brief Make a merged definition of an existing hidden definition \p ND
   /// visible at the specified location.
-  void makeMergedDefinitionVisible(NamedDecl *ND, SourceLocation Loc);
+  void makeMergedDefinitionVisible(NamedDecl *ND);
 
   bool isModuleVisible(Module *M) { return VisibleModules.isVisible(M); }
 

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=302842=302841=302842=diff
==
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Thu May 11 18:11:16 2017
@@ -2127,7 +2127,7 @@ void Sema::MergeTypedefNameDecl(Scope *S
 New->setTypeSourceInfo(OldTD->getTypeSourceInfo());
 
   // Make the old tag definition visible.
-  makeMergedDefinitionVisible(Hidden, NewTag->getLocation());
+  makeMergedDefinitionVisible(Hidden);
 
   // If this was an unscoped enumeration, yank all of its enumerators
   // out of the scope.
@@ -3929,8 +3929,8 @@ bool Sema::checkVarDeclRedefinition(VarD
 
 // Make the canonical definition visible.
 if (auto *OldTD = Old->getDescribedVarTemplate())
-  makeMergedDefinitionVisible(OldTD, New->getLocation());
-makeMergedDefinitionVisible(Old, New->getLocation());
+  makeMergedDefinitionVisible(OldTD);
+makeMergedDefinitionVisible(Old);
 return false;
   } else {
 Diag(New->getLocation(), diag::err_redefinition) << New;
@@ -11884,9 +11884,8 @@ Sema::CheckForFunctionRedefinition(Funct
Definition->getNumTemplateParameterLists())) {
 SkipBody->ShouldSkip = true;
 if (auto *TD = Definition->getDescribedFunctionTemplate())
-  makeMergedDefinitionVisible(TD, FD->getLocation());
-makeMergedDefinitionVisible(const_cast(Definition),
-FD->getLocation());
+  makeMergedDefinitionVisible(TD);
+makeMergedDefinitionVisible(const_cast(Definition));
 return;
   }
 
@@ -13540,7 +13539,7 @@ Decl *Sema::ActOnTag(Scope *S, unsigned
 // we already have. Make the existing definition visible and
 // use it in place of this one.
 SkipBody->ShouldSkip = true;
-makeMergedDefinitionVisible(Hidden, KWLoc);
+makeMergedDefinitionVisible(Hidden);
 return Def;
   } else if (!IsExplicitSpecializationAfterInstantiation) {
 // A redeclaration in function prototype scope in C isn't

Modified: cfe/trunk/lib/Sema/SemaLookup.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=302842=302841=302842=diff
==
--- cfe/trunk/lib/Sema/SemaLookup.cpp (original)
+++ cfe/trunk/lib/Sema/SemaLookup.cpp Thu May 11 18:11:16 2017
@@ -1382,8 +1382,8 @@ Module *Sema::getOwningModule(Decl *Enti
   return M;
 }
 
-void Sema::makeMergedDefinitionVisible(NamedDecl *ND, SourceLocation Loc) {
-  if (auto *M = PP.getModuleContainingLocation(Loc))
+void Sema::makeMergedDefinitionVisible(NamedDecl *ND) {
+  if (auto *M = getCurrentModule())
 Context.mergeDefinitionIntoModule(ND, M);
   else
 // We're not building a module; just make the definition visible.
@@ -1393,7 +1393,7 @@ void Sema::makeMergedDefinitionVisible(N
   // visible too. They're not (necessarily) within a mergeable DeclContext.
   if (auto *TD = dyn_cast(ND))
 for (auto *Param : *TD->getTemplateParameters())
-  makeMergedDefinitionVisible(Param, Loc);
+  makeMergedDefinitionVisible(Param);
 }
 
 /// 

[libcxx] r302841 - Fix XFAIL to reflect recent fixes in GCC

2017-05-11 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Thu May 11 18:04:04 2017
New Revision: 302841

URL: http://llvm.org/viewvc/llvm-project?rev=302841=rev
Log:
Fix XFAIL to reflect recent fixes in GCC

Modified:

libcxx/trunk/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.prop.pass.cpp

Modified: 
libcxx/trunk/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.prop.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.prop.pass.cpp?rev=302841=302840=302841=diff
==
--- 
libcxx/trunk/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.prop.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.prop.pass.cpp
 Thu May 11 18:04:04 2017
@@ -11,7 +11,8 @@
 
 // GCC returns true for __is_trivially_constructible(void, int)
 // See gcc.gnu.org/PR80682
-// XFAIL: gcc
+// NOTE: This has been fixed in trunk and will be backported soon.
+// XFAIL: gcc-7, gcc-6, gcc-5, gcc-4
 
 // 
 


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


r302840 - Module Debug Info: Emit namespaced C++ forward decls in the correct module.

2017-05-11 Thread Adrian Prantl via cfe-commits
Author: adrian
Date: Thu May 11 17:59:19 2017
New Revision: 302840

URL: http://llvm.org/viewvc/llvm-project?rev=302840=rev
Log:
Module Debug Info: Emit namespaced C++ forward decls in the correct module.

The AST merges NamespaceDecls, but for module debug info it is
important to put a namespace decl (or rather its children) into the
correct (sub-)module, so we need to use the parent module of the decl
that triggered this namespace to be serialized as a second key when
looking up DINamespace nodes.

rdar://problem/29339538

Added:
cfe/trunk/test/Modules/DebugInfoNamespace.cpp
cfe/trunk/test/Modules/Inputs/DebugInfoNamespace/
cfe/trunk/test/Modules/Inputs/DebugInfoNamespace/A.h
cfe/trunk/test/Modules/Inputs/DebugInfoNamespace/B.h
cfe/trunk/test/Modules/Inputs/DebugInfoNamespace/module.modulemap
Modified:
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
cfe/trunk/lib/CodeGen/CGDebugInfo.h

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=302840=302839=302840=diff
==
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Thu May 11 17:59:19 2017
@@ -208,8 +208,10 @@ llvm::DIScope *CGDebugInfo::getContextDe
   }
 
   // Check namespace.
-  if (const auto *NSDecl = dyn_cast(Context))
-return getOrCreateNameSpace(NSDecl);
+  if (const auto *NSDecl = dyn_cast(Context)) {
+auto *ParentModule = dyn_cast(Default);
+return getOrCreateNamespace(NSDecl, ParentModule);
+  }
 
   if (const auto *RDecl = dyn_cast(Context))
 if (!RDecl->isDependentType())
@@ -2861,7 +2863,7 @@ void CGDebugInfo::collectFunctionDeclPro
   if (DebugKind >= codegenoptions::LimitedDebugInfo) {
 if (const NamespaceDecl *NSDecl =
 dyn_cast_or_null(FD->getDeclContext()))
-  FDContext = getOrCreateNameSpace(NSDecl);
+FDContext = getOrCreateNamespace(NSDecl, getParentModuleOrNull(FD));
 else if (const RecordDecl *RDecl =
  dyn_cast_or_null(FD->getDeclContext())) {
   llvm::DIScope *Mod = getParentModuleOrNull(RDecl);
@@ -3961,7 +3963,7 @@ void CGDebugInfo::EmitUsingDirective(con
   CGM.getCodeGenOpts().DebugExplicitImport) {
 DBuilder.createImportedModule(
 getCurrentContextDescriptor(cast(UD.getDeclContext())),
-getOrCreateNameSpace(NSDecl),
+getOrCreateNamespace(NSDecl, getParentModuleOrNull()),
 getLineNumber(UD.getLocation()));
   }
 }
@@ -4021,23 +4023,32 @@ CGDebugInfo::EmitNamespaceAlias(const Na
   else
 R = DBuilder.createImportedDeclaration(
 getCurrentContextDescriptor(cast(NA.getDeclContext())),
-getOrCreateNameSpace(cast(NA.getAliasedNamespace())),
+getOrCreateNamespace(cast(NA.getAliasedNamespace()),
+ getParentModuleOrNull()),
 getLineNumber(NA.getLocation()), NA.getName());
   VH.reset(R);
   return R;
 }
 
 llvm::DINamespace *
-CGDebugInfo::getOrCreateNameSpace(const NamespaceDecl *NSDecl) {
+CGDebugInfo::getOrCreateNamespace(const NamespaceDecl *NSDecl,
+  llvm::DIModule *ParentModule) {
   NSDecl = NSDecl->getCanonicalDecl();
-  auto I = NameSpaceCache.find(NSDecl);
-  if (I != NameSpaceCache.end())
+  // The AST merges NamespaceDecls, but for module debug info it is important 
to
+  // put a namespace decl (or rather its children) into the correct
+  // (sub-)module, so use the parent module of the decl that triggered this
+  // namespace to be serialized as a second key.
+  NamespaceKey Key = {NSDecl, ParentModule};
+  auto I = NamespaceCache.find(Key);
+  if (I != NamespaceCache.end())
 return cast(I->second);
 
   llvm::DIScope *Context = getDeclContextDescriptor(NSDecl);
-  llvm::DINamespace *NS =
-  DBuilder.createNameSpace(Context, NSDecl->getName(), NSDecl->isInline());
-  NameSpaceCache[NSDecl].reset(NS);
+  // Don't trust the context if it is a DIModule (see comment above).
+  llvm::DINamespace *NS = DBuilder.createNameSpace(
+  isa(Context) ? ParentModule : Context, NSDecl->getName(),
+  NSDecl->isInline());
+  NamespaceCache[Key].reset(NS);
   return NS;
 }
 

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.h?rev=302840=302839=302840=diff
==
--- cfe/trunk/lib/CodeGen/CGDebugInfo.h (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.h Thu May 11 17:59:19 2017
@@ -125,7 +125,8 @@ class CGDebugInfo {
   /// Cache declarations relevant to DW_TAG_imported_declarations (C++
   /// using declarations) that aren't covered by other more specific caches.
   llvm::DenseMap DeclCache;
-  llvm::DenseMap NameSpaceCache;
+  typedef std::pair 
NamespaceKey;
+  llvm::DenseMap NamespaceCache;
   llvm::DenseMap
   NamespaceAliasCache;
   

r302835 - Issue diagnostics when returning FP values on x86_64 without SSE1/2

2017-05-11 Thread Reid Kleckner via cfe-commits
Author: rnk
Date: Thu May 11 17:43:02 2017
New Revision: 302835

URL: http://llvm.org/viewvc/llvm-project?rev=302835=rev
Log:
Issue diagnostics when returning FP values on x86_64 without SSE1/2

Avoid using report_fatal_error, because it will ask the user to file a
bug. If the user attempts to disable SSE on x86_64 and them use floating
point, that's a bug in their code, not a bug in the compiler.

This is just a start. There are other ways to crash the backend in this
configuration, but they should be updated to follow this pattern.

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

Added:
cfe/trunk/test/CodeGen/x86_64-mno-sse.c

Added: cfe/trunk/test/CodeGen/x86_64-mno-sse.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/x86_64-mno-sse.c?rev=302835=auto
==
--- cfe/trunk/test/CodeGen/x86_64-mno-sse.c (added)
+++ cfe/trunk/test/CodeGen/x86_64-mno-sse.c Thu May 11 17:43:02 2017
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -triple x86_64-linux -target-feature -sse -target-feature 
-sse2 -S -o /dev/null -verify %s
+// REQUIRES: x86-registered-target
+
+double f1(void) { // expected-error {{SSE register return with SSE disabled}}
+  return 1.4;
+}
+extern double g;
+void f2(void) { // expected-error {{SSE register return with SSE disabled}}
+  g = f1();
+}
+void take_double(double);
+void pass_double(void) {
+  // FIXME: Still asserts.
+  //take_double(1.5);
+}


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


Re: r302817 - PR22877: When constructing an array via a constructor with a default argument

2017-05-11 Thread Richard Smith via cfe-commits
Looks like we'd want something like this:

Index: lib/CodeGen/TargetInfo.cpp
===
--- lib/CodeGen/TargetInfo.cpp  (revision 302818)
+++ lib/CodeGen/TargetInfo.cpp  (working copy)
@@ -7043,13 +7043,13 @@
 ABIArgInfo::getExtend() : ABIArgInfo::getDirect());
   }

+  if (CGCXXABI::RecordArgABI RAA = getRecordArgABI(Ty, getCXXABI()))
+return getNaturalAlignIndirect(Ty, RAA ==
CGCXXABI::RAA_DirectInMemory);
+
   // Ignore empty records.
   if (isEmptyRecord(getContext(), Ty, true))
 return ABIArgInfo::getIgnore();

-  if (CGCXXABI::RecordArgABI RAA = getRecordArgABI(Ty, getCXXABI()))
-return getNaturalAlignIndirect(Ty, RAA ==
CGCXXABI::RAA_DirectInMemory);
-
   uint64_t Size = getContext().getTypeSize(Ty);
   if (Size > 64)
 return getNaturalAlignIndirect(Ty, /*ByVal=*/true);


On 11 May 2017 at 14:34, Richard Smith  wrote:

> XFAIL'd for hexagon in r302825, filed PR33009 for the miscompile.
>
> Looks like it's only passing empty structs in C++ that is miscompiled, but
> that's still pretty serious.
>
> On 11 May 2017 at 14:30, Richard Smith  wrote:
>
>> Wow, the Hexagon target is just horribly broken. Reduced testcase:
>>
>> struct A { A(); A(const A&); ~A(); };
>> void f(A a);
>> void g() { f(A()); }
>>
>> This completely fails to pass an A object to f. Instrumented version:
>>
>> #include 
>> #define DUMP(ptr) printf("%s %p\\n", __PRETTY_FUNCTION__, ptr)
>>
>> struct A {
>>   A() { DUMP(this); }
>>   A(const A&) { DUMP(this); }
>>   ~A() { DUMP(this); }
>> };
>> void f(A a) { DUMP(); }
>> int main() { f(A()); }
>>
>> ... prints:
>>
>> A::A() 0x7ffd54d95658
>> void f(A) 0x7ffd54d95638
>> A::~A() 0x7ffd54d95658
>>
>> Also, the hexagon bot appears to be failing to send mail.
>>
>> On 11 May 2017 at 13:17, Krzysztof Parzyszek via cfe-commits <
>> cfe-commits@lists.llvm.org> wrote:
>>
>>> Hexagon is still broken.  :(
>>>
>>> http://lab.llvm.org:8011/builders/clang-hexagon-elf/builds/7942
>>>
>>> -Krzysztof
>>>
>>>
>>> On 5/11/2017 1:58 PM, Richard Smith via cfe-commits wrote:
>>>
 Author: rsmith
 Date: Thu May 11 13:58:24 2017
 New Revision: 302817

 URL: http://llvm.org/viewvc/llvm-project?rev=302817=rev
 Log:
 PR22877: When constructing an array via a constructor with a default
 argument
 in list-initialization, run cleanups for the default argument after each
 iteration of the initialization loop.

 We previously only ran the destructor for any temporary once, at the
 end of the
 complete loop, rather than once per iteration!

 Re-commit of r302750, reverted in r302776.

 Added:
  cfe/trunk/test/CodeGenCXX/array-default-argument.cpp
- copied, changed from r302775, cfe/trunk/test/CodeGenCXX/arra
 y-default-argument.cpp
 Modified:
  cfe/trunk/lib/CodeGen/CGExprAgg.cpp

 Modified: cfe/trunk/lib/CodeGen/CGExprAgg.cpp
 URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CG
 ExprAgg.cpp?rev=302817=302816=302817=diff
 
 ==
 --- cfe/trunk/lib/CodeGen/CGExprAgg.cpp (original)
 +++ cfe/trunk/lib/CodeGen/CGExprAgg.cpp Thu May 11 13:58:24 2017
 @@ -512,12 +512,20 @@ void AggExprEmitter::EmitArrayInit(Addre
   currentElement->addIncoming(element, entryBB);
 // Emit the actual filler expression.
 -LValue elementLV =
 -  CGF.MakeAddrLValue(Address(currentElement, elementAlign),
 elementType);
 -if (filler)
 -  EmitInitializationToLValue(filler, elementLV);
 -else
 -  EmitNullInitializationToLValue(elementLV);
 +{
 +  // C++1z [class.temporary]p5:
 +  //   when a default constructor is called to initialize an
 element of
 +  //   an array with no corresponding initializer [...] the
 destruction of
 +  //   every temporary created in a default argument is sequenced
 before
 +  //   the construction of the next array element, if any
 +  CodeGenFunction::RunCleanupsScope CleanupsScope(CGF);
 +  LValue elementLV =
 +CGF.MakeAddrLValue(Address(currentElement, elementAlign),
 elementType);
 +  if (filler)
 +EmitInitializationToLValue(filler, elementLV);
 +  else
 +EmitNullInitializationToLValue(elementLV);
 +}
 // Move on to the next element.
   llvm::Value *nextElement =

 Copied: cfe/trunk/test/CodeGenCXX/array-default-argument.cpp (from
 r302775, cfe/trunk/test/CodeGenCXX/array-default-argument.cpp)
 URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCX
 X/array-default-argument.cpp?p2=cfe/trunk/test/CodeGenCXX/ar
 ray-default-argument.cpp=cfe/trunk/test/CodeGenCXX/array-
 

[PATCH] D33103: [clang-tidy] TwineLocalCheck: add param # checking

2017-05-11 Thread Yan Wang via Phabricator via cfe-commits
yawanng updated this revision to Diff 98684.

https://reviews.llvm.org/D33103

Files:
  clang-tidy/llvm/TwineLocalCheck.cpp
  test/clang-tidy/llvm-twine-local.cpp


Index: test/clang-tidy/llvm-twine-local.cpp
===
--- test/clang-tidy/llvm-twine-local.cpp
+++ test/clang-tidy/llvm-twine-local.cpp
@@ -5,6 +5,7 @@
 public:
   Twine(const char *);
   Twine(int);
+  Twine();
   Twine +(const Twine &);
 };
 }
@@ -29,4 +30,10 @@
 // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: twine variables are prone to 
use-after-free bugs
 // CHECK-MESSAGES: note: FIX-IT applied suggested code changes
 // CHECK-FIXES: const char * Prefix = false ? "__INT_FAST" : "__UINT_FAST";
+
+  const Twine t2 = Twine();
+// CHECK-MESSAGES: :[[@LINE-1]]:15: warning: twine variables are prone to 
use-after-free bugs
+// CHECK-MESSAGES: note: FIX-IT applied suggested code changes
+// CHECK-FIXES: std::string t2 = (Twine()).str();
+  foo(Twine() + "b");
 }
Index: clang-tidy/llvm/TwineLocalCheck.cpp
===
--- clang-tidy/llvm/TwineLocalCheck.cpp
+++ clang-tidy/llvm/TwineLocalCheck.cpp
@@ -35,8 +35,11 @@
 // of the initializer.
 const Expr *C = VD->getInit()->IgnoreImplicit();
 
-while (isa(C))
+while (isa(C)) {
+  if (cast(C)->getNumArgs() == 0)
+break;
   C = cast(C)->getArg(0)->IgnoreParenImpCasts();
+}
 
 SourceRange TypeRange =
 VD->getTypeSourceInfo()->getTypeLoc().getSourceRange();


Index: test/clang-tidy/llvm-twine-local.cpp
===
--- test/clang-tidy/llvm-twine-local.cpp
+++ test/clang-tidy/llvm-twine-local.cpp
@@ -5,6 +5,7 @@
 public:
   Twine(const char *);
   Twine(int);
+  Twine();
   Twine +(const Twine &);
 };
 }
@@ -29,4 +30,10 @@
 // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: twine variables are prone to use-after-free bugs
 // CHECK-MESSAGES: note: FIX-IT applied suggested code changes
 // CHECK-FIXES: const char * Prefix = false ? "__INT_FAST" : "__UINT_FAST";
+
+  const Twine t2 = Twine();
+// CHECK-MESSAGES: :[[@LINE-1]]:15: warning: twine variables are prone to use-after-free bugs
+// CHECK-MESSAGES: note: FIX-IT applied suggested code changes
+// CHECK-FIXES: std::string t2 = (Twine()).str();
+  foo(Twine() + "b");
 }
Index: clang-tidy/llvm/TwineLocalCheck.cpp
===
--- clang-tidy/llvm/TwineLocalCheck.cpp
+++ clang-tidy/llvm/TwineLocalCheck.cpp
@@ -35,8 +35,11 @@
 // of the initializer.
 const Expr *C = VD->getInit()->IgnoreImplicit();
 
-while (isa(C))
+while (isa(C)) {
+  if (cast(C)->getNumArgs() == 0)
+break;
   C = cast(C)->getArg(0)->IgnoreParenImpCasts();
+}
 
 SourceRange TypeRange =
 VD->getTypeSourceInfo()->getTypeLoc().getSourceRange();
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r302817 - PR22877: When constructing an array via a constructor with a default argument

2017-05-11 Thread Richard Smith via cfe-commits
XFAIL'd for hexagon in r302825, filed PR33009 for the miscompile.

Looks like it's only passing empty structs in C++ that is miscompiled, but
that's still pretty serious.

On 11 May 2017 at 14:30, Richard Smith  wrote:

> Wow, the Hexagon target is just horribly broken. Reduced testcase:
>
> struct A { A(); A(const A&); ~A(); };
> void f(A a);
> void g() { f(A()); }
>
> This completely fails to pass an A object to f. Instrumented version:
>
> #include 
> #define DUMP(ptr) printf("%s %p\\n", __PRETTY_FUNCTION__, ptr)
>
> struct A {
>   A() { DUMP(this); }
>   A(const A&) { DUMP(this); }
>   ~A() { DUMP(this); }
> };
> void f(A a) { DUMP(); }
> int main() { f(A()); }
>
> ... prints:
>
> A::A() 0x7ffd54d95658
> void f(A) 0x7ffd54d95638
> A::~A() 0x7ffd54d95658
>
> Also, the hexagon bot appears to be failing to send mail.
>
> On 11 May 2017 at 13:17, Krzysztof Parzyszek via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Hexagon is still broken.  :(
>>
>> http://lab.llvm.org:8011/builders/clang-hexagon-elf/builds/7942
>>
>> -Krzysztof
>>
>>
>> On 5/11/2017 1:58 PM, Richard Smith via cfe-commits wrote:
>>
>>> Author: rsmith
>>> Date: Thu May 11 13:58:24 2017
>>> New Revision: 302817
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=302817=rev
>>> Log:
>>> PR22877: When constructing an array via a constructor with a default
>>> argument
>>> in list-initialization, run cleanups for the default argument after each
>>> iteration of the initialization loop.
>>>
>>> We previously only ran the destructor for any temporary once, at the end
>>> of the
>>> complete loop, rather than once per iteration!
>>>
>>> Re-commit of r302750, reverted in r302776.
>>>
>>> Added:
>>>  cfe/trunk/test/CodeGenCXX/array-default-argument.cpp
>>>- copied, changed from r302775, cfe/trunk/test/CodeGenCXX/arra
>>> y-default-argument.cpp
>>> Modified:
>>>  cfe/trunk/lib/CodeGen/CGExprAgg.cpp
>>>
>>> Modified: cfe/trunk/lib/CodeGen/CGExprAgg.cpp
>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CG
>>> ExprAgg.cpp?rev=302817=302816=302817=diff
>>> 
>>> ==
>>> --- cfe/trunk/lib/CodeGen/CGExprAgg.cpp (original)
>>> +++ cfe/trunk/lib/CodeGen/CGExprAgg.cpp Thu May 11 13:58:24 2017
>>> @@ -512,12 +512,20 @@ void AggExprEmitter::EmitArrayInit(Addre
>>>   currentElement->addIncoming(element, entryBB);
>>> // Emit the actual filler expression.
>>> -LValue elementLV =
>>> -  CGF.MakeAddrLValue(Address(currentElement, elementAlign),
>>> elementType);
>>> -if (filler)
>>> -  EmitInitializationToLValue(filler, elementLV);
>>> -else
>>> -  EmitNullInitializationToLValue(elementLV);
>>> +{
>>> +  // C++1z [class.temporary]p5:
>>> +  //   when a default constructor is called to initialize an
>>> element of
>>> +  //   an array with no corresponding initializer [...] the
>>> destruction of
>>> +  //   every temporary created in a default argument is sequenced
>>> before
>>> +  //   the construction of the next array element, if any
>>> +  CodeGenFunction::RunCleanupsScope CleanupsScope(CGF);
>>> +  LValue elementLV =
>>> +CGF.MakeAddrLValue(Address(currentElement, elementAlign),
>>> elementType);
>>> +  if (filler)
>>> +EmitInitializationToLValue(filler, elementLV);
>>> +  else
>>> +EmitNullInitializationToLValue(elementLV);
>>> +}
>>> // Move on to the next element.
>>>   llvm::Value *nextElement =
>>>
>>> Copied: cfe/trunk/test/CodeGenCXX/array-default-argument.cpp (from
>>> r302775, cfe/trunk/test/CodeGenCXX/array-default-argument.cpp)
>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCX
>>> X/array-default-argument.cpp?p2=cfe/trunk/test/CodeGenCXX/ar
>>> ray-default-argument.cpp=cfe/trunk/test/CodeGenCXX/array-
>>> default-argument.cpp=302775=302817=302817=diff
>>> 
>>> ==
>>> --- cfe/trunk/test/CodeGenCXX/array-default-argument.cpp (original)
>>> +++ cfe/trunk/test/CodeGenCXX/array-default-argument.cpp Thu May 11
>>> 13:58:24 2017
>>> @@ -17,11 +17,11 @@ void g() {
>>> // CHECK: br label %[[LOOP:.*]]
>>>   // [[LOOP]]:
>>> -  // CHECK: {{call|invoke}}[[THISCALL:( x86_thiscallcc)?]] void
>>> @_ZN1AC1Ev([[TEMPORARY:.*]])
>>> +  // CHECK: {{call|invoke}} {{.*}} @_ZN1AC1Ev([[TEMPORARY:.*]])
>>> // CHECK-EH:  unwind label %[[PARTIAL_ARRAY_LPAD:.*]]
>>> -  // CHECK: {{call|invoke}}[[THISCALL]] void @_ZN1BC1E1A({{.*}},
>>> [[TEMPORARY]])
>>> +  // CHECK: {{call|invoke}} {{.*}} @_ZN1BC1E1A({{.*}}, [[TEMPORARY]])
>>> // CHECK-EH:  unwind label %[[A_AND_PARTIAL_ARRAY_LPAD:.*]]
>>> -  // CHECK: {{call|invoke}}[[THISCALL]] void @_ZN1AD1Ev([[TEMPORARY]])
>>> +  // CHECK: {{call|invoke}} {{.*}} @_ZN1AD1Ev([[TEMPORARY]])
>>> // CHECK-EH:  unwind label %[[PARTIAL_ARRAY_LPAD]]
>>> // CHECK: 

r302825 - XFAIL this test for Hexagon.

2017-05-11 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Thu May 11 16:18:27 2017
New Revision: 302825

URL: http://llvm.org/viewvc/llvm-project?rev=302825=rev
Log:
XFAIL this test for Hexagon.

It's failing due to Hexagon calling convention lowering being broken (empty
structs are not passed even if they have nontrivial destructors / copy ctors).

Modified:
cfe/trunk/test/CodeGenCXX/array-default-argument.cpp

Modified: cfe/trunk/test/CodeGenCXX/array-default-argument.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/array-default-argument.cpp?rev=302825=302824=302825=diff
==
--- cfe/trunk/test/CodeGenCXX/array-default-argument.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/array-default-argument.cpp Thu May 11 16:18:27 
2017
@@ -1,6 +1,10 @@
 // RUN: %clang_cc1 -emit-llvm -o - %s -triple %itanium_abi_triple | FileCheck 
%s
 // RUN: %clang_cc1 -emit-llvm -o - %s -triple %itanium_abi_triple -std=c++98 
-fexceptions -fcxx-exceptions | FileCheck %s --check-prefix=CHECK 
--check-prefix=CHECK-EH
 
+// Hexagon calling convention lowering is horribly broken and fails to pass A
+// object to B constructor at all!
+// XFAIL: hexagon
+
 struct A {
   A();
   ~A();


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


Re: r302817 - PR22877: When constructing an array via a constructor with a default argument

2017-05-11 Thread Richard Smith via cfe-commits
Wow, the Hexagon target is just horribly broken. Reduced testcase:

struct A { A(); A(const A&); ~A(); };
void f(A a);
void g() { f(A()); }

This completely fails to pass an A object to f. Instrumented version:

#include 
#define DUMP(ptr) printf("%s %p\\n", __PRETTY_FUNCTION__, ptr)

struct A {
  A() { DUMP(this); }
  A(const A&) { DUMP(this); }
  ~A() { DUMP(this); }
};
void f(A a) { DUMP(); }
int main() { f(A()); }

... prints:

A::A() 0x7ffd54d95658
void f(A) 0x7ffd54d95638
A::~A() 0x7ffd54d95658

Also, the hexagon bot appears to be failing to send mail.

On 11 May 2017 at 13:17, Krzysztof Parzyszek via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Hexagon is still broken.  :(
>
> http://lab.llvm.org:8011/builders/clang-hexagon-elf/builds/7942
>
> -Krzysztof
>
>
> On 5/11/2017 1:58 PM, Richard Smith via cfe-commits wrote:
>
>> Author: rsmith
>> Date: Thu May 11 13:58:24 2017
>> New Revision: 302817
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=302817=rev
>> Log:
>> PR22877: When constructing an array via a constructor with a default
>> argument
>> in list-initialization, run cleanups for the default argument after each
>> iteration of the initialization loop.
>>
>> We previously only ran the destructor for any temporary once, at the end
>> of the
>> complete loop, rather than once per iteration!
>>
>> Re-commit of r302750, reverted in r302776.
>>
>> Added:
>>  cfe/trunk/test/CodeGenCXX/array-default-argument.cpp
>>- copied, changed from r302775, cfe/trunk/test/CodeGenCXX/arra
>> y-default-argument.cpp
>> Modified:
>>  cfe/trunk/lib/CodeGen/CGExprAgg.cpp
>>
>> Modified: cfe/trunk/lib/CodeGen/CGExprAgg.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CG
>> ExprAgg.cpp?rev=302817=302816=302817=diff
>> 
>> ==
>> --- cfe/trunk/lib/CodeGen/CGExprAgg.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CGExprAgg.cpp Thu May 11 13:58:24 2017
>> @@ -512,12 +512,20 @@ void AggExprEmitter::EmitArrayInit(Addre
>>   currentElement->addIncoming(element, entryBB);
>> // Emit the actual filler expression.
>> -LValue elementLV =
>> -  CGF.MakeAddrLValue(Address(currentElement, elementAlign),
>> elementType);
>> -if (filler)
>> -  EmitInitializationToLValue(filler, elementLV);
>> -else
>> -  EmitNullInitializationToLValue(elementLV);
>> +{
>> +  // C++1z [class.temporary]p5:
>> +  //   when a default constructor is called to initialize an element
>> of
>> +  //   an array with no corresponding initializer [...] the
>> destruction of
>> +  //   every temporary created in a default argument is sequenced
>> before
>> +  //   the construction of the next array element, if any
>> +  CodeGenFunction::RunCleanupsScope CleanupsScope(CGF);
>> +  LValue elementLV =
>> +CGF.MakeAddrLValue(Address(currentElement, elementAlign),
>> elementType);
>> +  if (filler)
>> +EmitInitializationToLValue(filler, elementLV);
>> +  else
>> +EmitNullInitializationToLValue(elementLV);
>> +}
>> // Move on to the next element.
>>   llvm::Value *nextElement =
>>
>> Copied: cfe/trunk/test/CodeGenCXX/array-default-argument.cpp (from
>> r302775, cfe/trunk/test/CodeGenCXX/array-default-argument.cpp)
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCX
>> X/array-default-argument.cpp?p2=cfe/trunk/test/CodeGenCXX/
>> array-default-argument.cpp=cfe/trunk/test/CodeGenCXX/
>> array-default-argument.cpp=302775=302817=302817=diff
>> 
>> ==
>> --- cfe/trunk/test/CodeGenCXX/array-default-argument.cpp (original)
>> +++ cfe/trunk/test/CodeGenCXX/array-default-argument.cpp Thu May 11
>> 13:58:24 2017
>> @@ -17,11 +17,11 @@ void g() {
>> // CHECK: br label %[[LOOP:.*]]
>>   // [[LOOP]]:
>> -  // CHECK: {{call|invoke}}[[THISCALL:( x86_thiscallcc)?]] void
>> @_ZN1AC1Ev([[TEMPORARY:.*]])
>> +  // CHECK: {{call|invoke}} {{.*}} @_ZN1AC1Ev([[TEMPORARY:.*]])
>> // CHECK-EH:  unwind label %[[PARTIAL_ARRAY_LPAD:.*]]
>> -  // CHECK: {{call|invoke}}[[THISCALL]] void @_ZN1BC1E1A({{.*}},
>> [[TEMPORARY]])
>> +  // CHECK: {{call|invoke}} {{.*}} @_ZN1BC1E1A({{.*}}, [[TEMPORARY]])
>> // CHECK-EH:  unwind label %[[A_AND_PARTIAL_ARRAY_LPAD:.*]]
>> -  // CHECK: {{call|invoke}}[[THISCALL]] void @_ZN1AD1Ev([[TEMPORARY]])
>> +  // CHECK: {{call|invoke}} {{.*}} @_ZN1AD1Ev([[TEMPORARY]])
>> // CHECK-EH:  unwind label %[[PARTIAL_ARRAY_LPAD]]
>> // CHECK: getelementptr {{.*}}, i{{[0-9]*}} 1
>> // CHECK: icmp eq
>> @@ -32,5 +32,5 @@ void g() {
>> f();
>>   // CHECK-NOT: @_ZN1AD1Ev(
>> -  // CHECK: {{call|invoke}}[[THISCALL]] void @_ZN1BD1Ev(
>> +  // CHECK: {{call|invoke}} {{.*}} @_ZN1BD1Ev(
>>   }
>>
>>
>> ___
>> cfe-commits mailing list
>> cfe-commits@lists.llvm.org
>> 

[libcxxabi] r302824 - [Libcxxabi]: Support using compiler-rt for MinGW64

2017-05-11 Thread Martell Malone via cfe-commits
Author: martell
Date: Thu May 11 16:16:29 2017
New Revision: 302824

URL: http://llvm.org/viewvc/llvm-project?rev=302824=rev
Log:
[Libcxxabi]: Support using compiler-rt for MinGW64

Reviewers: EricWF

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

Modified:
libcxxabi/trunk/cmake/config-ix.cmake

Modified: libcxxabi/trunk/cmake/config-ix.cmake
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/cmake/config-ix.cmake?rev=302824=302823=302824=diff
==
--- libcxxabi/trunk/cmake/config-ix.cmake (original)
+++ libcxxabi/trunk/cmake/config-ix.cmake Thu May 11 16:16:29 2017
@@ -30,9 +30,14 @@ if (LIBCXXABI_HAS_NODEFAULTLIBS_FLAG)
   if (MINGW)
 # Mingw64 requires quite a few "C" runtime libraries in order for basic
 # programs to link successfully with -nodefaultlibs.
-set(MINGW_LIBRARIES mingw32 gcc_s gcc moldname mingwex msvcrt advapi32
-shell32 user32 kernel32 iconv mingw32 gcc_s gcc 
moldname
-mingwex msvcrt)
+if (LIBCXXABI_USE_COMPILER_RT)
+  set(MINGW_RUNTIME ${LIBCXXABI_BUILTINS_LIBRARY})
+else ()
+  set(MINGW_RUNTIME gcc_s gcc)
+endif()
+set(MINGW_LIBRARIES mingw32 ${MINGW_RUNTIME} moldname mingwex msvcrt 
advapi32
+shell32 user32 kernel32 iconv mingw32 ${MINGW_RUNTIME}
+moldname mingwex msvcrt)
 list(APPEND CMAKE_REQUIRED_LIBRARIES ${MINGW_LIBRARIES})
   endif()
   if (CMAKE_C_FLAGS MATCHES -fsanitize OR CMAKE_CXX_FLAGS MATCHES -fsanitize)


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


[PATCH] D32248: CodeGen: Cast alloca to expected address space

2017-05-11 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added inline comments.



Comment at: lib/CodeGen/TargetInfo.cpp:7291
+  Address adjustAddrSpaceForAutoVar(Address A, const VarDecl *VD,
+  CodeGen::CodeGenFunction ) const override;
 };

rjmccall wrote:
> yaxunl wrote:
> > rjmccall wrote:
> > > How about, instead of introducing a second method, we just change 
> > > performAddrSpaceCast to take two AST address spaces and a flag indicating 
> > > whether the address is known to be non-null?  Does your target have an 
> > > AST-level address space for the stack?
> > In both AST and LLVM, the destination pointee type of address space cast 
> > may be different from the source pointee type (e.g. `addrspacecast i32 
> > addrspace(1)* %a to i8 addrspace(4)*` is valid LLVM instruction), so 
> > performAddrSpaceCast needs to know the destination QualType, not just the 
> > address space.
> Is there any harm to generating separate cast instructions when this happens?
They should be equivalent but the LLVM IR will be more verbose and take more 
space, and LLVM passes will take more time since previously they only need to 
process one instruction but now they need to process two instructions.

The original representation is more concise, why should we change that to emit 
two instructions instead of one instruction?


https://reviews.llvm.org/D32248



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


Re: r302817 - PR22877: When constructing an array via a constructor with a default argument

2017-05-11 Thread Krzysztof Parzyszek via cfe-commits

Hexagon is still broken.  :(

http://lab.llvm.org:8011/builders/clang-hexagon-elf/builds/7942

-Krzysztof

On 5/11/2017 1:58 PM, Richard Smith via cfe-commits wrote:

Author: rsmith
Date: Thu May 11 13:58:24 2017
New Revision: 302817

URL: http://llvm.org/viewvc/llvm-project?rev=302817=rev
Log:
PR22877: When constructing an array via a constructor with a default argument
in list-initialization, run cleanups for the default argument after each
iteration of the initialization loop.

We previously only ran the destructor for any temporary once, at the end of the
complete loop, rather than once per iteration!

Re-commit of r302750, reverted in r302776.

Added:
 cfe/trunk/test/CodeGenCXX/array-default-argument.cpp
   - copied, changed from r302775, 
cfe/trunk/test/CodeGenCXX/array-default-argument.cpp
Modified:
 cfe/trunk/lib/CodeGen/CGExprAgg.cpp

Modified: cfe/trunk/lib/CodeGen/CGExprAgg.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprAgg.cpp?rev=302817=302816=302817=diff
==
--- cfe/trunk/lib/CodeGen/CGExprAgg.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprAgg.cpp Thu May 11 13:58:24 2017
@@ -512,12 +512,20 @@ void AggExprEmitter::EmitArrayInit(Addre
  currentElement->addIncoming(element, entryBB);
  
  // Emit the actual filler expression.

-LValue elementLV =
-  CGF.MakeAddrLValue(Address(currentElement, elementAlign), elementType);
-if (filler)
-  EmitInitializationToLValue(filler, elementLV);
-else
-  EmitNullInitializationToLValue(elementLV);
+{
+  // C++1z [class.temporary]p5:
+  //   when a default constructor is called to initialize an element of
+  //   an array with no corresponding initializer [...] the destruction of
+  //   every temporary created in a default argument is sequenced before
+  //   the construction of the next array element, if any
+  CodeGenFunction::RunCleanupsScope CleanupsScope(CGF);
+  LValue elementLV =
+CGF.MakeAddrLValue(Address(currentElement, elementAlign), elementType);
+  if (filler)
+EmitInitializationToLValue(filler, elementLV);
+  else
+EmitNullInitializationToLValue(elementLV);
+}
  
  // Move on to the next element.

  llvm::Value *nextElement =

Copied: cfe/trunk/test/CodeGenCXX/array-default-argument.cpp (from r302775, 
cfe/trunk/test/CodeGenCXX/array-default-argument.cpp)
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/array-default-argument.cpp?p2=cfe/trunk/test/CodeGenCXX/array-default-argument.cpp=cfe/trunk/test/CodeGenCXX/array-default-argument.cpp=302775=302817=302817=diff
==
--- cfe/trunk/test/CodeGenCXX/array-default-argument.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/array-default-argument.cpp Thu May 11 13:58:24 
2017
@@ -17,11 +17,11 @@ void g() {
// CHECK: br label %[[LOOP:.*]]
  
// [[LOOP]]:

-  // CHECK: {{call|invoke}}[[THISCALL:( x86_thiscallcc)?]] void 
@_ZN1AC1Ev([[TEMPORARY:.*]])
+  // CHECK: {{call|invoke}} {{.*}} @_ZN1AC1Ev([[TEMPORARY:.*]])
// CHECK-EH:  unwind label %[[PARTIAL_ARRAY_LPAD:.*]]
-  // CHECK: {{call|invoke}}[[THISCALL]] void @_ZN1BC1E1A({{.*}}, [[TEMPORARY]])
+  // CHECK: {{call|invoke}} {{.*}} @_ZN1BC1E1A({{.*}}, [[TEMPORARY]])
// CHECK-EH:  unwind label %[[A_AND_PARTIAL_ARRAY_LPAD:.*]]
-  // CHECK: {{call|invoke}}[[THISCALL]] void @_ZN1AD1Ev([[TEMPORARY]])
+  // CHECK: {{call|invoke}} {{.*}} @_ZN1AD1Ev([[TEMPORARY]])
// CHECK-EH:  unwind label %[[PARTIAL_ARRAY_LPAD]]
// CHECK: getelementptr {{.*}}, i{{[0-9]*}} 1
// CHECK: icmp eq
@@ -32,5 +32,5 @@ void g() {
f();
  
// CHECK-NOT: @_ZN1AD1Ev(

-  // CHECK: {{call|invoke}}[[THISCALL]] void @_ZN1BD1Ev(
+  // CHECK: {{call|invoke}} {{.*}} @_ZN1BD1Ev(
  }


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



--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, 
hosted by The Linux Foundation

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


r302818 - Work around different -std= default for PS4 target.

2017-05-11 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Thu May 11 14:17:54 2017
New Revision: 302818

URL: http://llvm.org/viewvc/llvm-project?rev=302818=rev
Log:
Work around different -std= default for PS4 target.

Modified:
cfe/trunk/test/CodeGenCXX/array-default-argument.cpp

Modified: cfe/trunk/test/CodeGenCXX/array-default-argument.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/array-default-argument.cpp?rev=302818=302817=302818=diff
==
--- cfe/trunk/test/CodeGenCXX/array-default-argument.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/array-default-argument.cpp Thu May 11 14:17:54 
2017
@@ -1,5 +1,5 @@
 // RUN: %clang_cc1 -emit-llvm -o - %s -triple %itanium_abi_triple | FileCheck 
%s
-// RUN: %clang_cc1 -emit-llvm -o - %s -triple %itanium_abi_triple -fexceptions 
-fcxx-exceptions | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-EH
+// RUN: %clang_cc1 -emit-llvm -o - %s -triple %itanium_abi_triple -std=c++98 
-fexceptions -fcxx-exceptions | FileCheck %s --check-prefix=CHECK 
--check-prefix=CHECK-EH
 
 struct A {
   A();


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


Re: r302750 - PR22877: When constructing an array via a constructor with a default argument

2017-05-11 Thread Richard Smith via cfe-commits
Thanks for the revert, fixed up and recommitted in r302817.

Any idea why not a single buildbot sent me any email about this? :( (A
couple of them were red at the previous change too, but some of them were
not (eg. clang-cmake-armv7-a15).

On 11 May 2017 at 01:28, Diana Picus  wrote:

> Hexagon too:
> http://lab.llvm.org:8011/builders/clang-hexagon-elf/builds/7916
>
> On 11 May 2017 at 10:27, Diana Picus  wrote:
> > Hi Richard,
> >
> > I reverted this and its fixup in r302776 since some of the ARM bots
> > were still broken:
> > http://lab.llvm.org:8011/builders/clang-cmake-armv7-a15/builds/6969
> > http://lab.llvm.org:8011/builders/clang-cmake-thumbv7-a15/builds/6959
> > http://lab.llvm.org:8011/builders/clang-cmake-armv7-a15-full/builds/6717
> > http://lab.llvm.org:8011/builders/clang-cmake-thumbv7-
> a15-full-sh/builds/1518
> >
> > Sorry,
> > Diana
> >
> > On 11 May 2017 at 02:17, Richard Smith via cfe-commits
> >  wrote:
> >> Author: rsmith
> >> Date: Wed May 10 19:17:17 2017
> >> New Revision: 302750
> >>
> >> URL: http://llvm.org/viewvc/llvm-project?rev=302750=rev
> >> Log:
> >> PR22877: When constructing an array via a constructor with a default
> argument
> >> in list-initialization, run cleanups for the default argument after each
> >> iteration of the initialization loop.
> >>
> >> We previously only ran the destructor for any temporary once, at the
> end of the
> >> complete loop, rather than once per iteration!
> >>
> >> Added:
> >> cfe/trunk/test/CodeGenCXX/array-default-argument.cpp
> >> Modified:
> >> cfe/trunk/lib/CodeGen/CGExprAgg.cpp
> >>
> >> Modified: cfe/trunk/lib/CodeGen/CGExprAgg.cpp
> >> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/
> CGExprAgg.cpp?rev=302750=302749=302750=diff
> >> 
> ==
> >> --- cfe/trunk/lib/CodeGen/CGExprAgg.cpp (original)
> >> +++ cfe/trunk/lib/CodeGen/CGExprAgg.cpp Wed May 10 19:17:17 2017
> >> @@ -512,12 +512,20 @@ void AggExprEmitter::EmitArrayInit(Addre
> >>  currentElement->addIncoming(element, entryBB);
> >>
> >>  // Emit the actual filler expression.
> >> -LValue elementLV =
> >> -  CGF.MakeAddrLValue(Address(currentElement, elementAlign),
> elementType);
> >> -if (filler)
> >> -  EmitInitializationToLValue(filler, elementLV);
> >> -else
> >> -  EmitNullInitializationToLValue(elementLV);
> >> +{
> >> +  // C++1z [class.temporary]p5:
> >> +  //   when a default constructor is called to initialize an
> element of
> >> +  //   an array with no corresponding initializer [...] the
> destruction of
> >> +  //   every temporary created in a default argument is sequenced
> before
> >> +  //   the construction of the next array element, if any
> >> +  CodeGenFunction::RunCleanupsScope CleanupsScope(CGF);
> >> +  LValue elementLV =
> >> +CGF.MakeAddrLValue(Address(currentElement, elementAlign),
> elementType);
> >> +  if (filler)
> >> +EmitInitializationToLValue(filler, elementLV);
> >> +  else
> >> +EmitNullInitializationToLValue(elementLV);
> >> +}
> >>
> >>  // Move on to the next element.
> >>  llvm::Value *nextElement =
> >>
> >> Added: cfe/trunk/test/CodeGenCXX/array-default-argument.cpp
> >> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/
> CodeGenCXX/array-default-argument.cpp?rev=302750=auto
> >> 
> ==
> >> --- cfe/trunk/test/CodeGenCXX/array-default-argument.cpp (added)
> >> +++ cfe/trunk/test/CodeGenCXX/array-default-argument.cpp Wed May 10
> 19:17:17 2017
> >> @@ -0,0 +1,36 @@
> >> +// RUN: %clang_cc1 -emit-llvm -o - %s -triple %itanium_abi_triple |
> FileCheck %s
> >> +// RUN: %clang_cc1 -emit-llvm -o - %s -triple %itanium_abi_triple
> -fexceptions -fcxx-exceptions | FileCheck %s --check-prefix=CHECK
> --check-prefix=CHECK-EH
> >> +
> >> +struct A {
> >> +  A();
> >> +  ~A();
> >> +};
> >> +
> >> +struct B {
> >> +  B(A = A());
> >> +  ~B();
> >> +};
> >> +
> >> +void f();
> >> +// CHECK-LABEL: define void @_Z1gv()
> >> +void g() {
> >> +  // CHECK: br label %[[LOOP:.*]]
> >> +
> >> +  // [[LOOP]]:
> >> +  // CHECK: {{call|invoke}} void @_ZN1AC1Ev([[TEMPORARY:.*]])
> >> +  // CHECK-EH:  unwind label %[[PARTIAL_ARRAY_LPAD:.*]]
> >> +  // CHECK: {{call|invoke}} void @_ZN1BC1E1A({{.*}}, [[TEMPORARY]])
> >> +  // CHECK-EH:  unwind label %[[A_AND_PARTIAL_ARRAY_LPAD:.*]]
> >> +  // CHECK: {{call|invoke}} void @_ZN1AD1Ev([[TEMPORARY]])
> >> +  // CHECK-EH:  unwind label %[[PARTIAL_ARRAY_LPAD]]
> >> +  // CHECK: getelementptr {{.*}}, i{{[0-9]*}} 1
> >> +  // CHECK: icmp eq
> >> +  // CHECK: br i1 {{.*}} label %[[LOOP]]
> >> +  B b[5];
> >> +
> >> +  // CHECK: {{call|invoke}} void @_Z1fv()
> >> +  f();
> >> +
> >> +  // CHECK-NOT: @_ZN1AD1Ev(
> >> +  // CHECK: {{call|invoke}} void @_ZN1BD1Ev(
> 

r302817 - PR22877: When constructing an array via a constructor with a default argument

2017-05-11 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Thu May 11 13:58:24 2017
New Revision: 302817

URL: http://llvm.org/viewvc/llvm-project?rev=302817=rev
Log:
PR22877: When constructing an array via a constructor with a default argument
in list-initialization, run cleanups for the default argument after each
iteration of the initialization loop.

We previously only ran the destructor for any temporary once, at the end of the
complete loop, rather than once per iteration!

Re-commit of r302750, reverted in r302776.

Added:
cfe/trunk/test/CodeGenCXX/array-default-argument.cpp
  - copied, changed from r302775, 
cfe/trunk/test/CodeGenCXX/array-default-argument.cpp
Modified:
cfe/trunk/lib/CodeGen/CGExprAgg.cpp

Modified: cfe/trunk/lib/CodeGen/CGExprAgg.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprAgg.cpp?rev=302817=302816=302817=diff
==
--- cfe/trunk/lib/CodeGen/CGExprAgg.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprAgg.cpp Thu May 11 13:58:24 2017
@@ -512,12 +512,20 @@ void AggExprEmitter::EmitArrayInit(Addre
 currentElement->addIncoming(element, entryBB);
 
 // Emit the actual filler expression.
-LValue elementLV =
-  CGF.MakeAddrLValue(Address(currentElement, elementAlign), elementType);
-if (filler)
-  EmitInitializationToLValue(filler, elementLV);
-else
-  EmitNullInitializationToLValue(elementLV);
+{
+  // C++1z [class.temporary]p5:
+  //   when a default constructor is called to initialize an element of
+  //   an array with no corresponding initializer [...] the destruction of
+  //   every temporary created in a default argument is sequenced before
+  //   the construction of the next array element, if any
+  CodeGenFunction::RunCleanupsScope CleanupsScope(CGF);
+  LValue elementLV =
+CGF.MakeAddrLValue(Address(currentElement, elementAlign), elementType);
+  if (filler)
+EmitInitializationToLValue(filler, elementLV);
+  else
+EmitNullInitializationToLValue(elementLV);
+}
 
 // Move on to the next element.
 llvm::Value *nextElement =

Copied: cfe/trunk/test/CodeGenCXX/array-default-argument.cpp (from r302775, 
cfe/trunk/test/CodeGenCXX/array-default-argument.cpp)
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/array-default-argument.cpp?p2=cfe/trunk/test/CodeGenCXX/array-default-argument.cpp=cfe/trunk/test/CodeGenCXX/array-default-argument.cpp=302775=302817=302817=diff
==
--- cfe/trunk/test/CodeGenCXX/array-default-argument.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/array-default-argument.cpp Thu May 11 13:58:24 
2017
@@ -17,11 +17,11 @@ void g() {
   // CHECK: br label %[[LOOP:.*]]
 
   // [[LOOP]]:
-  // CHECK: {{call|invoke}}[[THISCALL:( x86_thiscallcc)?]] void 
@_ZN1AC1Ev([[TEMPORARY:.*]])
+  // CHECK: {{call|invoke}} {{.*}} @_ZN1AC1Ev([[TEMPORARY:.*]])
   // CHECK-EH:  unwind label %[[PARTIAL_ARRAY_LPAD:.*]]
-  // CHECK: {{call|invoke}}[[THISCALL]] void @_ZN1BC1E1A({{.*}}, [[TEMPORARY]])
+  // CHECK: {{call|invoke}} {{.*}} @_ZN1BC1E1A({{.*}}, [[TEMPORARY]])
   // CHECK-EH:  unwind label %[[A_AND_PARTIAL_ARRAY_LPAD:.*]]
-  // CHECK: {{call|invoke}}[[THISCALL]] void @_ZN1AD1Ev([[TEMPORARY]])
+  // CHECK: {{call|invoke}} {{.*}} @_ZN1AD1Ev([[TEMPORARY]])
   // CHECK-EH:  unwind label %[[PARTIAL_ARRAY_LPAD]]
   // CHECK: getelementptr {{.*}}, i{{[0-9]*}} 1
   // CHECK: icmp eq
@@ -32,5 +32,5 @@ void g() {
   f();
 
   // CHECK-NOT: @_ZN1AD1Ev(
-  // CHECK: {{call|invoke}}[[THISCALL]] void @_ZN1BD1Ev(
+  // CHECK: {{call|invoke}} {{.*}} @_ZN1BD1Ev(
 }


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


[PATCH] D30949: [CodeGen] Add an option to enable LLVM IR linting

2017-05-11 Thread Vedant Kumar via Phabricator via cfe-commits
vsk abandoned this revision.
vsk added a comment.

I'll try doing this some other way, maybe with optimization remarks.


https://reviews.llvm.org/D30949



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


[PATCH] D32690: [clang-tidy] modernize-use-emplace: Remove unnecessary make_tuple calls

2017-05-11 Thread Jonas Devlieghere via Phabricator via cfe-commits
JDevlieghere added a comment.

No comments from me either, looks good!


https://reviews.llvm.org/D32690



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


[PATCH] D32248: CodeGen: Cast alloca to expected address space

2017-05-11 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments.



Comment at: lib/CodeGen/TargetInfo.cpp:7291
+  Address adjustAddrSpaceForAutoVar(Address A, const VarDecl *VD,
+  CodeGen::CodeGenFunction ) const override;
 };

yaxunl wrote:
> rjmccall wrote:
> > How about, instead of introducing a second method, we just change 
> > performAddrSpaceCast to take two AST address spaces and a flag indicating 
> > whether the address is known to be non-null?  Does your target have an 
> > AST-level address space for the stack?
> In both AST and LLVM, the destination pointee type of address space cast may 
> be different from the source pointee type (e.g. `addrspacecast i32 
> addrspace(1)* %a to i8 addrspace(4)*` is valid LLVM instruction), so 
> performAddrSpaceCast needs to know the destination QualType, not just the 
> address space.
Is there any harm to generating separate cast instructions when this happens?


https://reviews.llvm.org/D32248



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


r302809 - Add a test that local submodule visibility has no effect on debug info

2017-05-11 Thread Adrian Prantl via cfe-commits
Author: adrian
Date: Thu May 11 11:40:48 2017
New Revision: 302809

URL: http://llvm.org/viewvc/llvm-project?rev=302809=rev
Log:
Add a test that local submodule visibility has no effect on debug info

rdar://problem/27876262

Modified:
cfe/trunk/test/Modules/DebugInfoSubmoduleImport.c

Modified: cfe/trunk/test/Modules/DebugInfoSubmoduleImport.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/DebugInfoSubmoduleImport.c?rev=302809=302808=302809=diff
==
--- cfe/trunk/test/Modules/DebugInfoSubmoduleImport.c (original)
+++ cfe/trunk/test/Modules/DebugInfoSubmoduleImport.c Thu May 11 11:40:48 2017
@@ -2,6 +2,11 @@
 // RUN: %clang_cc1 -fmodules -fmodule-format=obj -debug-info-kind=limited 
-dwarf-ext-refs \
 // RUN: -fimplicit-module-maps -x c -fmodules-cache-path=%t -I %S/Inputs \
 // RUN: %s -emit-llvm -debugger-tuning=lldb -o - | FileCheck %s
+//
+// RUN: %clang_cc1 -fmodules -fmodule-format=obj -debug-info-kind=limited 
-dwarf-ext-refs \
+// RUN: -fimplicit-module-maps -x c -fmodules-cache-path=%t -I %S/Inputs \
+// RUN: -fmodules-local-submodule-visibility \
+// RUN: %s -emit-llvm -debugger-tuning=lldb -o - | FileCheck %s
 #include "DebugSubmoduleA.h"
 #include "DebugSubmoduleB.h"
 


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


Re: [PATCH v2] [PPC64]: Add support for Swift calling convention

2017-05-11 Thread Adrian Prantl via cfe-commits
Thanks, with the testcase this LGTM!

-- adrian
> On May 11, 2017, at 12:07 AM, Andrew Jeffery  wrote:
> 
> Ping - does anyone have a moment to take a look?
> 
> Cheers,
> 
> Andrew
> 
> On Thu, 2017-04-27 at 13:52 +0930, Andrew Jeffery wrote:
>> For the tests I've extracted the int5 and int8 cases to cater for
>> different alignments for different platform ABIs. For Linux on POWER the
>> 5 and 8 element vectors must be naturally aligned with respect to the
>> total "soft" vector size, despite being represented as an aggregate.
>> Specifically, the patch caters for the following differences in
>> supporting powerpc64le-unknown-linux:
>> 
>>$ diff -u test/CodeGen/64bit-swiftcall.c test/CodeGen/ppc64-swiftcall.c
>>>--- test/CodeGen/64bit-swiftcall.c   2017-04-20 17:14:59.797963820 
>>> +0930
>>>+++ test/CodeGen/ppc64-swiftcall.c   2017-04-20 17:15:11.621965118 
>>> +0930
>>@@ -1,7 +1,6 @@
>>-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -target-cpu core2 
>> -emit-llvm -o - %s | FileCheck %s
>>-// RUN: %clang_cc1 -triple arm64-apple-ios9 -target-cpu cyclone 
>> -emit-llvm -o - %s | FileCheck %s
>>+// RUN: %clang_cc1 -triple powerpc64le-unknown-linux -emit-llvm -o - %s 
>> | FileCheck %s
>> 
>>-// REQUIRES: aarch64-registered-target,x86-registered-target
>>+// REQUIRES: powerpc-registered-target
>> 
>> #define SWIFTCALL __attribute__((swiftcall))
>> #define OUT __attribute__((swift_indirect_result))
>>@@ -370,8 +369,8 @@
>> 
>> TEST(int8)
>> // CHECK-LABEL: define {{.*}} @return_int8()
>>-// CHECK:   [[RET:%.*]] = alloca [[REC:<8 x i32>]], align 16
>>+// CHECK:   [[RET:%.*]] = alloca [[REC:<8 x i32>]], align 32
>> // CHECK:   [[VAR:%.*]] = alloca [[REC]], align
>> // CHECK:   store
>> // CHECK:   load
>> // CHECK:   store
>>@@ -414,8 +413,8 @@
>> 
>> TEST(int5)
>> // CHECK-LABEL: define {{.*}} @return_int5()
>>-// CHECK:   [[RET:%.*]] = alloca [[REC:<5 x i32>]], align 16
>>+// CHECK:   [[RET:%.*]] = alloca [[REC:<5 x i32>]], align 32
>> // CHECK:   [[VAR:%.*]] = alloca [[REC]], align
>> // CHECK:   store
>> // CHECK:   load
>> // CHECK:   store
>> 
>> Despite some duplication, the advantage of this approach over using
>> pattern matching for alignment in 64bit-swiftcall.c is that we ensure
>> each platform is using the expected alignment but without duplicating
>> the entirety of 64bit-swiftcall.c.
>> 
>>> Signed-off-by: Andrew Jeffery 
>> ---
>>  lib/Basic/Targets.cpp |  11 ++
>>  lib/CodeGen/TargetInfo.cpp|  14 ++-
>>  test/CodeGen/64bit-swiftcall-extvec-agg-align16.c | 117 
>> ++
>>  test/CodeGen/64bit-swiftcall-extvec-agg-align32.c | 116 
>> +
>>  test/CodeGen/64bit-swiftcall.c|  93 +
>>  5 files changed, 258 insertions(+), 93 deletions(-)
>>  create mode 100644 test/CodeGen/64bit-swiftcall-extvec-agg-align16.c
>>  create mode 100644 test/CodeGen/64bit-swiftcall-extvec-agg-align32.c
>> 
>> diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp
>> index aab3160af0f9..e32ad0b2dc39 100644
>> --- a/lib/Basic/Targets.cpp
>> +++ b/lib/Basic/Targets.cpp
>> @@ -1708,6 +1708,17 @@ public:
>>  }
>>  return false;
>>}
>> +
>> +  CallingConvCheckResult checkCallingConvention(CallingConv CC) const 
>> override {
>> +switch (CC) {
>> +case CC_C:
>> +case CC_Swift:
>> +return CCCR_OK;
>> +default:
>> +break;
>> +}
>> +return CCCR_Warning;
>> +  }
>>  };
>>  
>>  class DarwinPPC32TargetInfo : public DarwinTargetInfo {
>> diff --git a/lib/CodeGen/TargetInfo.cpp b/lib/CodeGen/TargetInfo.cpp
>> index d2fc3888ef29..6193f6c4ac29 100644
>> --- a/lib/CodeGen/TargetInfo.cpp
>> +++ b/lib/CodeGen/TargetInfo.cpp
>> @@ -4175,7 +4175,7 @@ 
>> PPC32TargetCodeGenInfo::initDwarfEHRegSizeTable(CodeGen::CodeGenFunction 
>> ,
>>  
>>  namespace {
>>  /// PPC64_SVR4_ABIInfo - The 64-bit PowerPC ELF (SVR4) ABI information.
>> -class PPC64_SVR4_ABIInfo : public ABIInfo {
>> +class PPC64_SVR4_ABIInfo : public SwiftABIInfo {
>>  public:
>>enum ABIKind {
>>  ELFv1 = 0,
>> @@ -4219,7 +4219,7 @@ private:
>>  public:
>>PPC64_SVR4_ABIInfo(CodeGen::CodeGenTypes , ABIKind Kind, bool HasQPX,
>>   bool SoftFloatABI)
>> -  : ABIInfo(CGT), Kind(Kind), HasQPX(HasQPX),
>> +  : SwiftABIInfo(CGT), Kind(Kind), HasQPX(HasQPX),
>>  IsSoftFloatABI(SoftFloatABI) {}
>>  
>>bool isPromotableTypeForABI(QualType Ty) const;
>> @@ -4262,6 +4262,16 @@ public:
>>  
>>Address EmitVAArg(CodeGenFunction , Address VAListAddr,
>>  QualType Ty) const override;
>> +
>> +  bool shouldPassIndirectlyForSwift(CharUnits totalSize,
>> +ArrayRef scalars,
>> +bool asReturnValue) const 

[PATCH] D33047: [ClangD] Refactor clangd into separate components

2017-05-11 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments.



Comment at: clangd/ClangdMain.cpp:41
   // dispatching.
-  DocumentStore Store;
-  ASTManager AST(Out, Store, RunSynchronously);
-  Store.addListener();
+  ClangdLSPServer AST(Out, RunSynchronously);
   JSONRPCDispatcher Dispatcher(llvm::make_unique(Out));

krasimir wrote:
> The combination of the name and the type of this variable makes no sense.
Totally agree, renamed it.



Comment at: clangd/ClangdServer.h:41
 
-  void cacheFixIts(DiagnosticToReplacementMap FixIts);
-  std::vector
-  getFixIts(const clangd::Diagnostic ) const;
-
-private:
-  std::unique_ptr AST;
-  DiagnosticToReplacementMap FixIts;
+  virtual bool shouldBuildDiagnosticsForFile(PathRef File) = 0;
+  virtual void onDiagnosticsReady(PathRef File,

krasimir wrote:
> I feel that `shouldBuildDiagnosticsForFile` doesn't belong to this interface.
Sorry, this sneaked in from some code that didn't end up in this commit.
It's also not used anywhere now. I've removed it from this change.



Comment at: clangd/ClangdServer.h:62
+/// Handles scheduling on a different thread for ClangdServer
+class ClangdScheduler {
+public:

krasimir wrote:
> Maybe explicitly mention `Worker` in the name of this class?
I actually like the name ClangdScheduler. Albeit, it's a bit too generic and 
lives inside the clangd namespace, so I'm afraid of clashes later on, but until 
that happens I'd rather keep it.
Do you find ClangdScheduler confusing? Does the comment help? 
But if you feel stongly that we shall change the name, let's do it.



Comment at: clangd/ClangdServer.h:68
+  /// Enqueue ServerRequest to be run on a worker thread
+  void Enqueue(ClangdServer , ServerRequest Request);
 

krasimir wrote:
> The constructor already gets a `ClangdServer`, why pass it here?
Just to avoid introducing redundant fields.
(I.e. ClangdServer stores ClangdScheduler, which stores a reference to 
ClangdServer).


https://reviews.llvm.org/D33047



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


[PATCH] D33010: Make google-build-using-namespace skip std::.*literals

2017-05-11 Thread Alexander Kornienko via Phabricator via cfe-commits
alexfh requested changes to this revision.
alexfh added inline comments.
This revision now requires changes to proceed.



Comment at: clang-tidy/google/UsingNamespaceDirectiveCheck.cpp:43
+  if (StandardLiteralsNamespaceRE.match(
+  U->getNominatedNamespace()->getQualifiedNameAsString())) {
+// Do not warn if name matches std::.*literals. User-defined literals in

`getQualifiedNameAsString()` is pretty expensive, since it allocates a string 
and reconstructs the qualified name by going up all declaration contexts. 
Instead, consider checking the names directly, something like this:

  const NamespaceDecl *NS = U->getNominatedNamespace();
  if (NS->getName().ends_with("literals")) {
const auto *Parent = dyn_cast_or_null(NS->getParent());
if (Parent && (Parent->isStdNamespace() || (Parent->getName() == "literals" 
&& Parent->getParent() && Parent->getParent()->isStdNamespace(
  return;
  }
  


https://reviews.llvm.org/D33010



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


[PATCH] D33047: [ClangD] Refactor clangd into separate components

2017-05-11 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov updated this revision to Diff 98634.
ilya-biryukov marked 3 inline comments as done.
ilya-biryukov added a comment.

Addressed style comments.
Moved ClangdScheduler to be the last field of the ClangdServer, so
that it's constructed last and destructed first.


https://reviews.llvm.org/D33047

Files:
  clangd/ASTManager.cpp
  clangd/ASTManager.h
  clangd/CMakeLists.txt
  clangd/ClangdLSPServer.cpp
  clangd/ClangdLSPServer.h
  clangd/ClangdMain.cpp
  clangd/ClangdServer.cpp
  clangd/ClangdServer.h
  clangd/ClangdUnit.cpp
  clangd/ClangdUnit.h
  clangd/ClangdUnitStore.cpp
  clangd/ClangdUnitStore.h
  clangd/DocumentStore.h
  clangd/DraftStore.cpp
  clangd/DraftStore.h
  clangd/GlobalCompilationDatabase.cpp
  clangd/GlobalCompilationDatabase.h
  clangd/Path.h
  clangd/ProtocolHandlers.cpp
  clangd/ProtocolHandlers.h

Index: clangd/ProtocolHandlers.h
===
--- clangd/ProtocolHandlers.h
+++ clangd/ProtocolHandlers.h
@@ -22,8 +22,8 @@
 
 namespace clang {
 namespace clangd {
-class ASTManager;
-class DocumentStore;
+class ClangdLSPServer;
+class ClangdLSPServer;
 
 struct InitializeHandler : Handler {
   InitializeHandler(JSONOutput ) : Handler(Output) {}
@@ -56,83 +56,83 @@
 };
 
 struct TextDocumentDidOpenHandler : Handler {
-  TextDocumentDidOpenHandler(JSONOutput , DocumentStore )
-  : Handler(Output), Store(Store) {}
+  TextDocumentDidOpenHandler(JSONOutput , ClangdLSPServer )
+  : Handler(Output), AST(AST) {}
 
   void handleNotification(llvm::yaml::MappingNode *Params) override;
 
 private:
-  DocumentStore 
+  ClangdLSPServer 
 };
 
 struct TextDocumentDidChangeHandler : Handler {
-  TextDocumentDidChangeHandler(JSONOutput , DocumentStore )
-  : Handler(Output), Store(Store) {}
+  TextDocumentDidChangeHandler(JSONOutput , ClangdLSPServer )
+  : Handler(Output), AST(AST) {}
 
   void handleNotification(llvm::yaml::MappingNode *Params) override;
 
 private:
-  DocumentStore 
+  ClangdLSPServer 
 };
 
 struct TextDocumentDidCloseHandler : Handler {
-  TextDocumentDidCloseHandler(JSONOutput , DocumentStore )
-  : Handler(Output), Store(Store) {}
+  TextDocumentDidCloseHandler(JSONOutput , ClangdLSPServer )
+  : Handler(Output), AST(AST) {}
 
   void handleNotification(llvm::yaml::MappingNode *Params) override;
 
 private:
-  DocumentStore 
+  ClangdLSPServer 
 };
 
 struct TextDocumentOnTypeFormattingHandler : Handler {
-  TextDocumentOnTypeFormattingHandler(JSONOutput , DocumentStore )
-  : Handler(Output), Store(Store) {}
+  TextDocumentOnTypeFormattingHandler(JSONOutput , ClangdLSPServer )
+  : Handler(Output), AST(AST) {}
 
   void handleMethod(llvm::yaml::MappingNode *Params, StringRef ID) override;
 
 private:
-  DocumentStore 
+  ClangdLSPServer 
 };
 
 struct TextDocumentRangeFormattingHandler : Handler {
-  TextDocumentRangeFormattingHandler(JSONOutput , DocumentStore )
-  : Handler(Output), Store(Store) {}
+  TextDocumentRangeFormattingHandler(JSONOutput , ClangdLSPServer )
+  : Handler(Output), AST(AST) {}
 
   void handleMethod(llvm::yaml::MappingNode *Params, StringRef ID) override;
 
 private:
-  DocumentStore 
+  ClangdLSPServer 
 };
 
 struct TextDocumentFormattingHandler : Handler {
-  TextDocumentFormattingHandler(JSONOutput , DocumentStore )
-  : Handler(Output), Store(Store) {}
+  TextDocumentFormattingHandler(JSONOutput , ClangdLSPServer )
+  : Handler(Output), AST(AST) {}
 
   void handleMethod(llvm::yaml::MappingNode *Params, StringRef ID) override;
 
 private:
-  DocumentStore 
+  ClangdLSPServer 
 };
 
 struct CodeActionHandler : Handler {
-  CodeActionHandler(JSONOutput , ASTManager )
+  CodeActionHandler(JSONOutput , ClangdLSPServer )
   : Handler(Output), AST(AST) {}
 
   void handleMethod(llvm::yaml::MappingNode *Params, StringRef ID) override;
 
 private:
-  ASTManager 
+  ClangdLSPServer 
 };
 
 struct CompletionHandler : Handler {
-  CompletionHandler(JSONOutput , ASTManager )
+  CompletionHandler(JSONOutput , ClangdLSPServer )
   : Handler(Output), AST(AST) {}
 
   void handleMethod(llvm::yaml::MappingNode *Params, StringRef ID) override;
 
  private:
-  ASTManager 
+  ClangdLSPServer 
 };
 
 } // namespace clangd
Index: clangd/ProtocolHandlers.cpp
===
--- clangd/ProtocolHandlers.cpp
+++ clangd/ProtocolHandlers.cpp
@@ -8,9 +8,10 @@
 //===--===//
 
 #include "ProtocolHandlers.h"
-#include "ASTManager.h"
-#include "DocumentStore.h"
+#include "ClangdServer.h"
+#include "DraftStore.h"
 #include "clang/Format/Format.h"
+#include "ClangdLSPServer.h"
 using namespace clang;
 using namespace clangd;
 
@@ -21,7 +22,7 @@
 Output.log("Failed to decode DidOpenTextDocumentParams!\n");
 return;
   }
-  Store.addDocument(DOTDP->textDocument.uri.file, DOTDP->textDocument.text);
+  

[PATCH] D33082: Fix Libc++ build with MinGW64

2017-05-11 Thread Ben Craig via Phabricator via cfe-commits
bcraig added a comment.

I agree that we need to be precise in our platform detection macros.  On 
Windows, we currently need to worry about which compiler is being used, whether 
we are targeting the mingw environment or the native (?) environment, and which 
c-runtime is being used.

For my msvc-kernel work, I'll need some amount of platform detection macros as 
well (I'm not expecting those to be added in this review).  I believe I will 
represent that with some combination of a "freestanding" macro, a different 
name for the CRT, and detection of the MSVC compiler, but I haven't gotten that 
far yet.


https://reviews.llvm.org/D33082



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


[PATCH] D32248: CodeGen: Cast alloca to expected address space

2017-05-11 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added inline comments.



Comment at: lib/CodeGen/TargetInfo.cpp:7291
+  Address adjustAddrSpaceForAutoVar(Address A, const VarDecl *VD,
+  CodeGen::CodeGenFunction ) const override;
 };

rjmccall wrote:
> How about, instead of introducing a second method, we just change 
> performAddrSpaceCast to take two AST address spaces and a flag indicating 
> whether the address is known to be non-null?  Does your target have an 
> AST-level address space for the stack?
In both AST and LLVM, the destination pointee type of address space cast may be 
different from the source pointee type (e.g. `addrspacecast i32 addrspace(1)* 
%a to i8 addrspace(4)*` is valid LLVM instruction), so performAddrSpaceCast 
needs to know the destination QualType, not just the address space.


https://reviews.llvm.org/D32248



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


[libcxx] r302802 - Mark LWG#2782 as complete. No functionality change; we already do this. Just added a few more tests.

2017-05-11 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Thu May 11 09:25:45 2017
New Revision: 302802

URL: http://llvm.org/viewvc/llvm-project?rev=302802=rev
Log:
Mark LWG#2782 as complete. No functionality change; we already do this. Just 
added a few more tests.

Modified:

libcxx/trunk/test/std/utilities/allocator.adaptor/allocator.adaptor.cnstr/allocs.pass.cpp
libcxx/trunk/www/cxx1z_status.html

Modified: 
libcxx/trunk/test/std/utilities/allocator.adaptor/allocator.adaptor.cnstr/allocs.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/allocator.adaptor/allocator.adaptor.cnstr/allocs.pass.cpp?rev=302802=302801=302802=diff
==
--- 
libcxx/trunk/test/std/utilities/allocator.adaptor/allocator.adaptor.cnstr/allocs.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/allocator.adaptor/allocator.adaptor.cnstr/allocs.pass.cpp
 Thu May 11 09:25:45 2017
@@ -107,5 +107,11 @@ int main()
 assert((a.inner_allocator() ==
 std::scoped_allocator_adaptor(A2(5), 
A3(6;
 }
-
+//  Test for LWG2782
+{
+static_assert(!std::is_convertible::value, "");
+static_assert(!std::is_convertible<
+ std::scoped_allocator_adaptor, 
+ std::scoped_allocator_adaptor>::value, "");
+}
 }

Modified: libcxx/trunk/www/cxx1z_status.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx1z_status.html?rev=302802=302801=302802=diff
==
--- libcxx/trunk/www/cxx1z_status.html (original)
+++ libcxx/trunk/www/cxx1z_status.html Thu May 11 09:25:45 2017
@@ -437,7 +437,7 @@
http://wg21.link/LWG2768;>2768any_cast 
and move semanticsKonaComplete
http://wg21.link/LWG2769;>2769Redundant 
const in the return type of any_cast(const 
any)KonaComplete
http://wg21.link/LWG2781;>2781Contradictory requirements for 
std::function and std::reference_wrapperKonaComplete
-   http://wg21.link/LWG2782;>2782scoped_allocator_adaptor 
constructors must be constrainedKona
+   http://wg21.link/LWG2782;>2782scoped_allocator_adaptor 
constructors must be constrainedKonaComplete
http://wg21.link/LWG2784;>2784Resolution 
to LWG 2484 is missing "otherwise, no effects" and is hard to 
parseKonaComplete
http://wg21.link/LWG2785;>2785quoted 
should work with basic_string_viewKonaComplete
http://wg21.link/LWG2786;>2786Annex C 
should mention shared_ptr changes for array 
supportKonaComplete


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


[libcxx] r302800 - Replace a nested namespace used for overload resolution with a struct. Richard Smith says that using the namespace results in an ODR violation, but I disagree. Nevertheless, the str

2017-05-11 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Thu May 11 09:00:54 2017
New Revision: 302800

URL: http://llvm.org/viewvc/llvm-project?rev=302800=rev
Log:
Replace a nested namespace used for overload resolution with a struct. Richard 
Smith says that using the namespace results in an ODR violation, but I 
disagree. Nevertheless, the struct works just as well.

Modified:
libcxx/trunk/include/memory

Modified: libcxx/trunk/include/memory
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/memory?rev=302800=302799=302800=diff
==
--- libcxx/trunk/include/memory (original)
+++ libcxx/trunk/include/memory Thu May 11 09:00:54 2017
@@ -996,11 +996,11 @@ struct __rebind_pointer {
 
 // allocator_traits
 
-namespace __has_pointer_type_imp
+struct __has_pointer_type_imp
 {
 template  static __two __test(...);
 template  static char __test(typename _Up::pointer* = 0);
-}
+};
 
 template 
 struct __has_pointer_type


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


[libcxx] r302799 - Mark LWG#2850 as complete. No functionality change; we had tests that covered it already. Just added comments to the tests. Thanks to K-ballo for the heads up.

2017-05-11 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Thu May 11 08:55:20 2017
New Revision: 302799

URL: http://llvm.org/viewvc/llvm-project?rev=302799=rev
Log:
Mark LWG#2850 as complete. No functionality change; we had tests that covered 
it already. Just added comments to the tests. Thanks to K-ballo for the heads 
up.

Modified:

libcxx/trunk/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_move.pass.cpp
libcxx/trunk/www/cxx1z_status.html

Modified: 
libcxx/trunk/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_move.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_move.pass.cpp?rev=302799=302798=302799=diff
==
--- 
libcxx/trunk/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_move.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_move.pass.cpp
 Thu May 11 08:55:20 2017
@@ -11,7 +11,8 @@
 
 // class function
 
-// function(const function& f);
+// function(const function&  f);
+// function(const function&& f);
 
 #include 
 #include 

Modified: libcxx/trunk/www/cxx1z_status.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx1z_status.html?rev=302799=302798=302799=diff
==
--- libcxx/trunk/www/cxx1z_status.html (original)
+++ libcxx/trunk/www/cxx1z_status.html Thu May 11 08:55:20 2017
@@ -461,7 +461,7 @@
http://wg21.link/LWG2837;>2837gcd and lcm 
should support a wider range of input 
valuesKonaComplete
http://wg21.link/LWG2838;>2838is_literal_type specification 
needs a little cleanupKonaComplete
http://wg21.link/LWG2842;>2842in_place_t 
check for optional::optional(U) should decay 
UKonaComplete
-   http://wg21.link/LWG2850;>2850std::function move constructor 
does unnecessary workKona
+   http://wg21.link/LWG2850;>2850std::function move constructor 
does unnecessary workKonaComplete
http://wg21.link/LWG2853;>2853Possible 
inconsistency in specification of erase in 
[vector.modifiers]KonaComplete
http://wg21.link/LWG2855;>2855std::throw_with_nested("string_literal")KonaComplete
http://wg21.link/LWG2857;>2857{variant,optional,any}::emplace
 should return the constructed valueKonaComplete


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


[libcxx] r302798 - Mark LWG#2796 as complete. No functionality change; we had tests that covered it already. Just added comments to the tests

2017-05-11 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Thu May 11 08:51:09 2017
New Revision: 302798

URL: http://llvm.org/viewvc/llvm-project?rev=302798=rev
Log:
Mark LWG#2796 as complete. No functionality change; we had tests that covered 
it already. Just added comments to the tests

Modified:
libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/dtor.pass.cpp
libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/dtor.pass.cpp
libcxx/trunk/www/cxx1z_status.html

Modified: 
libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/dtor.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/dtor.pass.cpp?rev=302798=302797=302798=diff
==
--- libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/dtor.pass.cpp 
(original)
+++ libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/dtor.pass.cpp 
Thu May 11 08:51:09 2017
@@ -15,6 +15,10 @@
 
 // ~tuple();
 
+// C++17 added:
+//   The destructor of tuple shall be a trivial destructor 
+// if (is_trivially_destructible_v && ...) is true.
+
 #include 
 #include 
 #include 

Modified: libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/dtor.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/dtor.pass.cpp?rev=302798=302797=302798=diff
==
--- libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/dtor.pass.cpp 
(original)
+++ libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/dtor.pass.cpp Thu 
May 11 08:51:09 2017
@@ -15,6 +15,10 @@
 
 // ~pair()
 
+// C++17 added:
+//   The destructor of pair shall be a trivial destructor 
+// if (is_trivially_destructible_v && is_trivially_destructible_v) 
is true.
+
 
 #include 
 #include 

Modified: libcxx/trunk/www/cxx1z_status.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx1z_status.html?rev=302798=302797=302798=diff
==
--- libcxx/trunk/www/cxx1z_status.html (original)
+++ libcxx/trunk/www/cxx1z_status.html Thu May 11 08:51:09 2017
@@ -447,7 +447,7 @@
http://wg21.link/LWG2790;>2790Missing 
specification of 
istreambuf_iterator::operator-Kona
http://wg21.link/LWG2794;>2794Missing 
requirements for allocator pointersKona
http://wg21.link/LWG2795;>2795[global.functions] 
provides incorrect example of ADL useKonaComplete
-   http://wg21.link/LWG2796;>2796tuple 
should be a literal typeKona
+   http://wg21.link/LWG2796;>2796tuple 
should be a literal typeKonaComplete
http://wg21.link/LWG2801;>2801Default-constructibility of 
unique_ptrKonaComplete
http://wg21.link/LWG2802;>2802shared_ptr 
constructor requirements for a deleterKona
http://wg21.link/LWG2804;>2804Unconditional constexpr 
default constructor for istream_iteratorKonaComplete
@@ -489,7 +489,7 @@
 
   
 
-  Last Updated: 17-Apr-2017
+  Last Updated: 11-May-2017
 
 
 


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


r302797 - [CodeCompletion] Provide member completions for dependent expressions whose

2017-05-11 Thread Alex Lorenz via cfe-commits
Author: arphaman
Date: Thu May 11 08:48:57 2017
New Revision: 302797

URL: http://llvm.org/viewvc/llvm-project?rev=302797=rev
Log:
[CodeCompletion] Provide member completions for dependent expressions whose
type is a TemplateSpecializationType or InjectedClassNameType

Fixes PR30847. Partially fixes PR20973 (first position only).

PR17614 is still not working, its expression has the dependent
builtin type. We'll have to teach the completion engine how to "resolve"
dependent expressions to fix it.

rdar://29818301

Modified:
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/Sema/SemaCodeComplete.cpp
cfe/trunk/lib/Sema/SemaLookup.cpp
cfe/trunk/test/CodeCompletion/member-access.cpp

Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=302797=302796=302797=diff
==
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Thu May 11 08:48:57 2017
@@ -3068,7 +3068,8 @@ public:
   bool IncludeGlobalScope = true);
   void LookupVisibleDecls(DeclContext *Ctx, LookupNameKind Kind,
   VisibleDeclConsumer ,
-  bool IncludeGlobalScope = true);
+  bool IncludeGlobalScope = true,
+  bool IncludeDependentBases = false);
 
   enum CorrectTypoKind {
 CTK_NonError, // CorrectTypo used in a non error recovery situation.

Modified: cfe/trunk/lib/Sema/SemaCodeComplete.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCodeComplete.cpp?rev=302797=302796=302797=diff
==
--- cfe/trunk/lib/Sema/SemaCodeComplete.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCodeComplete.cpp Thu May 11 08:48:57 2017
@@ -3881,7 +3881,8 @@ static void AddRecordMembersCompletionRe
   Results.allowNestedNameSpecifiers();
   CodeCompletionDeclConsumer Consumer(Results, SemaRef.CurContext);
   SemaRef.LookupVisibleDecls(RD, Sema::LookupMemberName, Consumer,
- SemaRef.CodeCompleter->includeGlobals());
+ SemaRef.CodeCompleter->includeGlobals(),
+ /*IncludeDependentBases=*/true);
 
   if (SemaRef.getLangOpts().CPlusPlus) {
 if (!Results.empty()) {
@@ -3949,6 +3950,16 @@ void Sema::CodeCompleteMemberReferenceEx
   if (const RecordType *Record = BaseType->getAs()) {
 AddRecordMembersCompletionResults(*this, Results, S, BaseType,
   Record->getDecl());
+  } else if (const auto *TST = BaseType->getAs()) {
+TemplateName TN = TST->getTemplateName();
+if (const auto *TD =
+dyn_cast_or_null(TN.getAsTemplateDecl())) {
+  CXXRecordDecl *RD = TD->getTemplatedDecl();
+  AddRecordMembersCompletionResults(*this, Results, S, BaseType, RD);
+}
+  } else if (const auto *ICNT = BaseType->getAs()) {
+if (auto *RD = ICNT->getDecl())
+  AddRecordMembersCompletionResults(*this, Results, S, BaseType, RD);
   } else if (!IsArrow && BaseType->isObjCObjectPointerType()) {
 // Objective-C property reference.
 AddedPropertiesSet AddedProperties;

Modified: cfe/trunk/lib/Sema/SemaLookup.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=302797=302796=302797=diff
==
--- cfe/trunk/lib/Sema/SemaLookup.cpp (original)
+++ cfe/trunk/lib/Sema/SemaLookup.cpp Thu May 11 08:48:57 2017
@@ -3445,7 +3445,8 @@ static void LookupVisibleDecls(DeclConte
bool QualifiedNameLookup,
bool InBaseClass,
VisibleDeclConsumer ,
-   VisibleDeclsRecord ) {
+   VisibleDeclsRecord ,
+   bool IncludeDependentBases = false) {
   if (!Ctx)
 return;
 
@@ -3501,7 +3502,8 @@ static void LookupVisibleDecls(DeclConte
 ShadowContextRAII Shadow(Visited);
 for (auto I : Ctx->using_directives()) {
   LookupVisibleDecls(I->getNominatedNamespace(), Result,
- QualifiedNameLookup, InBaseClass, Consumer, Visited);
+ QualifiedNameLookup, InBaseClass, Consumer, Visited,
+ IncludeDependentBases);
 }
   }
 
@@ -3513,14 +3515,28 @@ static void LookupVisibleDecls(DeclConte
 for (const auto  : Record->bases()) {
   QualType BaseType = B.getType();
 
-  // Don't look into dependent bases, because name lookup can't look
-  // there anyway.
-  if (BaseType->isDependentType())
-continue;
-
-  const RecordType *Record = BaseType->getAs();
-  if (!Record)
-continue;
+  RecordDecl *RD;
+  if (BaseType->isDependentType()) {
+if 

r302796 - [CodeCompletion] NFC, extract a function that generates member

2017-05-11 Thread Alex Lorenz via cfe-commits
Author: arphaman
Date: Thu May 11 08:41:00 2017
New Revision: 302796

URL: http://llvm.org/viewvc/llvm-project?rev=302796=rev
Log:
[CodeCompletion] NFC, extract a function that generates member
completion results for records

Modified:
cfe/trunk/lib/Sema/SemaCodeComplete.cpp

Modified: cfe/trunk/lib/Sema/SemaCodeComplete.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCodeComplete.cpp?rev=302796=302795=302796=diff
==
--- cfe/trunk/lib/Sema/SemaCodeComplete.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCodeComplete.cpp Thu May 11 08:41:00 2017
@@ -3869,6 +3869,40 @@ static void AddObjCProperties(
   }
 }
 
+static void AddRecordMembersCompletionResults(Sema ,
+  ResultBuilder , Scope *S,
+  QualType BaseType,
+  RecordDecl *RD) {
+  // Indicate that we are performing a member access, and the cv-qualifiers
+  // for the base object type.
+  Results.setObjectTypeQualifiers(BaseType.getQualifiers());
+
+  // Access to a C/C++ class, struct, or union.
+  Results.allowNestedNameSpecifiers();
+  CodeCompletionDeclConsumer Consumer(Results, SemaRef.CurContext);
+  SemaRef.LookupVisibleDecls(RD, Sema::LookupMemberName, Consumer,
+ SemaRef.CodeCompleter->includeGlobals());
+
+  if (SemaRef.getLangOpts().CPlusPlus) {
+if (!Results.empty()) {
+  // The "template" keyword can follow "->" or "." in the grammar.
+  // However, we only want to suggest the template keyword if something
+  // is dependent.
+  bool IsDependent = BaseType->isDependentType();
+  if (!IsDependent) {
+for (Scope *DepScope = S; DepScope; DepScope = DepScope->getParent())
+  if (DeclContext *Ctx = DepScope->getEntity()) {
+IsDependent = Ctx->isDependentContext();
+break;
+  }
+  }
+
+  if (IsDependent)
+Results.AddResult(CodeCompletionResult("template"));
+}
+  }
+}
+
 void Sema::CodeCompleteMemberReferenceExpr(Scope *S, Expr *Base,
SourceLocation OpLoc, bool IsArrow,
bool IsBaseExprStatement) {
@@ -3879,8 +3913,6 @@ void Sema::CodeCompleteMemberReferenceEx
   if (ConvertedBase.isInvalid())
 return;
   Base = ConvertedBase.get();
-
-  typedef CodeCompletionResult Result;
   
   QualType BaseType = Base->getType();
 
@@ -3915,34 +3947,8 @@ void Sema::CodeCompleteMemberReferenceEx
 ::IsMember);
   Results.EnterNewScope();
   if (const RecordType *Record = BaseType->getAs()) {
-// Indicate that we are performing a member access, and the cv-qualifiers
-// for the base object type.
-Results.setObjectTypeQualifiers(BaseType.getQualifiers());
-
-// Access to a C/C++ class, struct, or union.
-Results.allowNestedNameSpecifiers();
-CodeCompletionDeclConsumer Consumer(Results, CurContext);
-LookupVisibleDecls(Record->getDecl(), LookupMemberName, Consumer,
-   CodeCompleter->includeGlobals());
-
-if (getLangOpts().CPlusPlus) {
-  if (!Results.empty()) {
-// The "template" keyword can follow "->" or "." in the grammar.
-// However, we only want to suggest the template keyword if something
-// is dependent.
-bool IsDependent = BaseType->isDependentType();
-if (!IsDependent) {
-  for (Scope *DepScope = S; DepScope; DepScope = DepScope->getParent())
-if (DeclContext *Ctx = DepScope->getEntity()) {
-  IsDependent = Ctx->isDependentContext();
-  break;
-}
-}
-
-if (IsDependent)
-  Results.AddResult(Result("template"));
-  }
-}
+AddRecordMembersCompletionResults(*this, Results, S, BaseType,
+  Record->getDecl());
   } else if (!IsArrow && BaseType->isObjCObjectPointerType()) {
 // Objective-C property reference.
 AddedPropertiesSet AddedProperties;


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


Re: Fix two-stage build on windows using DistributionExample cmake cache

2017-05-11 Thread Matthew Larionov via cfe-commits
Thanks a lot!

On Thu, May 11, 2017 at 4:32 PM, NAKAMURA Takumi 
wrote:

> Applied in r302795.
>
> On Thu, May 11, 2017 at 9:51 PM Chris Bieneman via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Normally I would be happy to, but I'm actually at the airport about to
>> board a flight and won't have reliable internet access for at least the
>> next 24 hours.
>>
>> Can someone else land this for Matthew?
>>
>> Matthew, if nobody responds in email, try hopping onto LLVM's IRC channel.
>>
>> Thanks,
>> -Chris
>>
>> On May 11, 2017, at 3:40 AM, Matthew Larionov 
>> wrote:
>>
>> Unfortunately I don't have commit rights. Could you please land it for me?
>>
>> On Thu, May 11, 2017 at 1:28 PM, Chris Bieneman  wrote:
>>
>>> This patch LGTM!
>>>
>>> Thanks!
>>> -Chris
>>>
>>> On May 11, 2017, at 3:13 AM, Matthew Larionov 
>>> wrote:
>>>
>>> Chris, Hi! Could you please take a look at my patch?
>>> Or advice someone who could.
>>>
>>> On Wed, May 3, 2017 at 8:28 PM, Matthew Larionov 
>>> wrote:
>>>
 I've added a correct compiler name for bootstrap builds on windows.
 Also added an opportunity to override stage2 cache file to make
 distribution example more flexible.

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


[PATCH] D33047: [ClangD] Refactor clangd into separate components

2017-05-11 Thread Krasimir Georgiev via Phabricator via cfe-commits
krasimir added inline comments.



Comment at: clangd/CMakeLists.txt:12
   ProtocolHandlers.cpp
   )
 

nit: we might want to keep these sorted



Comment at: clangd/ClangdMain.cpp:41
   // dispatching.
-  DocumentStore Store;
-  ASTManager AST(Out, Store, RunSynchronously);
-  Store.addListener();
+  ClangdLSPServer AST(Out, RunSynchronously);
   JSONRPCDispatcher Dispatcher(llvm::make_unique(Out));

The combination of the name and the type of this variable makes no sense.



Comment at: clangd/ClangdServer.h:41
 
-  void cacheFixIts(DiagnosticToReplacementMap FixIts);
-  std::vector
-  getFixIts(const clangd::Diagnostic ) const;
-
-private:
-  std::unique_ptr AST;
-  DiagnosticToReplacementMap FixIts;
+  virtual bool shouldBuildDiagnosticsForFile(PathRef File) = 0;
+  virtual void onDiagnosticsReady(PathRef File,

I feel that `shouldBuildDiagnosticsForFile` doesn't belong to this interface.



Comment at: clangd/ClangdServer.h:49
 /// A request to the worker thread
-class ASTManagerRequest {
+class ServerRequest {
 public:

If this models a request to the worker thread, why not call it `WorkerRequest` 
or something? The current name is confusing, because it implies that also other 
requests might be handled in this way.



Comment at: clangd/ClangdServer.h:62
+/// Handles scheduling on a different thread for ClangdServer
+class ClangdScheduler {
+public:

Maybe explicitly mention `Worker` in the name of this class?



Comment at: clangd/ClangdServer.h:68
+  /// Enqueue ServerRequest to be run on a worker thread
+  void Enqueue(ClangdServer , ServerRequest Request);
 

The constructor already gets a `ClangdServer`, why pass it here?


https://reviews.llvm.org/D33047



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


[PATCH] D33094: [ASTMatchers] Add equals support for integer and boolean literals

2017-05-11 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments.



Comment at: include/clang/ASTMatchers/ASTMatchers.h:3827
+/// \brief Instantiations for the \c equals matcher.
+/// TODO add support for FloatingLiteral and CharacterLiteral
+/// @{

Lekensteyn wrote:
> aaron.ballman wrote:
> > Why not add this support immediately rather than a TODO?
> The parser would need additional changes for it to be usable in clang-query 
> (see D33093 for boolean support), my initial focus was on supporting 
> IntegerLiterals but bool was added to have an overload.
> 
> I'll look into adding support for other types.
If it turns out to be more work than you want to put in, don't feel obligated 
to do it. I just thought it might be nice to round it out.



Comment at: include/clang/ASTMatchers/ASTMatchersMacros.h:364
+/// comparing a \c ReturnType node against the a \c ParamType value.
+#define AST_CONCRETE_EQUALS_MATCHER(ReturnType, ParamType, OverloadId) 
\
+  inline ::clang::ast_matchers::internal::Matcher equals(  
\

Lekensteyn wrote:
> aaron.ballman wrote:
> > Instead of making the user of the macro pass in an overload id, could we 
> > make use of the `__LINE__` macro to automate it? Given the length of the 
> > macro name, I struggle to imagine many people accidentally defining two 
> > overloads on the same line (and we can document this macro appropriately, 
> > of course).
> Not sure how `__LINE__` would help, uniqueness is not the only requirement, 
> it must also be a fixed name such that Registry can refer to it. (Uniqueness 
> is also needed, otherwise it would be ambiguous).
> 
> Alternatively, the overload name can be removed, but then the returntype and 
> paramtype for the marshaller should be explicitly specified. This would 
> remove the magic numbers (for overload ID), is this an approach worth looking 
> into?
> Not sure how __LINE__ would help, uniqueness is not the only requirement, it 
> must also be a fixed name such that Registry can refer to it. (Uniqueness is 
> also needed, otherwise it would be ambiguous).

Ah, thank you for the explanation. The fixed name part makes this harder.

> Alternatively, the overload name can be removed, but then the returntype and 
> paramtype for the marshaller should be explicitly specified. This would 
> remove the magic numbers (for overload ID), is this an approach worth looking 
> into?

I'm not certain what that solution would look like in practice, but if it 
removes the magic numbers, that sounds promising (assuming the result isn't 
even more fragile, of course).


https://reviews.llvm.org/D33094



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


[PATCH] D33080: [Libc++] Use #pragma push_macro/pop_macro to better handle min/max on Windows

2017-05-11 Thread Ben Craig via Phabricator via cfe-commits
bcraig added a comment.

I like the warning that you generate for min and max macros existing.  Is the 
push_macro / pop_macro the right way to go though?  You could throw extra 
parenthesis around the declaration and usages of min/max to avoid macro 
expansion.

  #define add(x,y) (x)-(y)
  
  template 
  T (add)(T x, T y) // parens around add to suppress macro
  {
  return x+y;
  }
  
  int main() {
  return 
  (add)(5, 4) + // uses function
  add(5, 4);// uses macro
  }


https://reviews.llvm.org/D33080



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


Re: Fix two-stage build on windows using DistributionExample cmake cache

2017-05-11 Thread NAKAMURA Takumi via cfe-commits
Applied in r302795.

On Thu, May 11, 2017 at 9:51 PM Chris Bieneman via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Normally I would be happy to, but I'm actually at the airport about to
> board a flight and won't have reliable internet access for at least the
> next 24 hours.
>
> Can someone else land this for Matthew?
>
> Matthew, if nobody responds in email, try hopping onto LLVM's IRC channel.
>
> Thanks,
> -Chris
>
> On May 11, 2017, at 3:40 AM, Matthew Larionov 
> wrote:
>
> Unfortunately I don't have commit rights. Could you please land it for me?
>
> On Thu, May 11, 2017 at 1:28 PM, Chris Bieneman  wrote:
>
>> This patch LGTM!
>>
>> Thanks!
>> -Chris
>>
>> On May 11, 2017, at 3:13 AM, Matthew Larionov 
>> wrote:
>>
>> Chris, Hi! Could you please take a look at my patch?
>> Or advice someone who could.
>>
>> On Wed, May 3, 2017 at 8:28 PM, Matthew Larionov 
>> wrote:
>>
>>> I've added a correct compiler name for bootstrap builds on windows.
>>> Also added an opportunity to override stage2 cache file to make
>>> distribution example more flexible.
>>>
>>
>>
>>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r302795 - Fix two-stage build on windows using DistributionExample cmake cache

2017-05-11 Thread NAKAMURA Takumi via cfe-commits
Author: chapuni
Date: Thu May 11 08:19:24 2017
New Revision: 302795

URL: http://llvm.org/viewvc/llvm-project?rev=302795=rev
Log:
Fix two-stage build on windows using DistributionExample cmake cache

Thanks to Matthew Larionov 

Modified:
cfe/trunk/CMakeLists.txt
cfe/trunk/cmake/caches/DistributionExample.cmake

Modified: cfe/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=302795=302794=302795=diff
==
--- cfe/trunk/CMakeLists.txt (original)
+++ cfe/trunk/CMakeLists.txt Thu May 11 08:19:24 2017
@@ -579,10 +579,17 @@ if (CLANG_ENABLE_BOOTSTRAP)
 add_dependencies(clang-bootstrap-deps compiler-rt)
   endif()
 
+  set(C_COMPILER "clang")
+  set(CXX_COMPILER "clang++")
+  if(WIN32)
+set(C_COMPILER "clang-cl.exe")
+set(CXX_COMPILER "clang-cl.exe")
+  endif()
+
   set(COMPILER_OPTIONS
--DCMAKE_CXX_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang++
--DCMAKE_C_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang
--DCMAKE_ASM_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang)
+-DCMAKE_CXX_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/${CXX_COMPILER}
+-DCMAKE_C_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/${C_COMPILER}
+-DCMAKE_ASM_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/${C_COMPILER})
 
   if(BOOTSTRAP_LLVM_BUILD_INSTRUMENTED)
 add_dependencies(clang-bootstrap-deps llvm-profdata)

Modified: cfe/trunk/cmake/caches/DistributionExample.cmake
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/cmake/caches/DistributionExample.cmake?rev=302795=302794=302795=diff
==
--- cfe/trunk/cmake/caches/DistributionExample.cmake (original)
+++ cfe/trunk/cmake/caches/DistributionExample.cmake Thu May 11 08:19:24 2017
@@ -29,6 +29,13 @@ set(CLANG_BOOTSTRAP_TARGETS
 
 # Setup the bootstrap build.
 set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
-set(CLANG_BOOTSTRAP_CMAKE_ARGS
-  -C ${CMAKE_CURRENT_LIST_DIR}/DistributionExample-stage2.cmake
-  CACHE STRING "")
+
+if(STAGE2_CACHE_FILE)
+  set(CLANG_BOOTSTRAP_CMAKE_ARGS
+-C ${STAGE2_CACHE_FILE}
+CACHE STRING "")
+else()
+  set(CLANG_BOOTSTRAP_CMAKE_ARGS
+-C ${CMAKE_CURRENT_LIST_DIR}/DistributionExample-stage2.cmake
+CACHE STRING "")
+endif()


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


[PATCH] D33094: [ASTMatchers] Add equals support for integer and boolean literals

2017-05-11 Thread Peter Wu via Phabricator via cfe-commits
Lekensteyn added a comment.

In https://reviews.llvm.org/D33094#752153, @aaron.ballman wrote:

> Please be sure to regenerate the AST matcher documentation as well by running 
> clang/docs/tools/dump_ast_matchers.py


Will do, thanks for the hint.




Comment at: include/clang/ASTMatchers/ASTMatchers.h:3827
+/// \brief Instantiations for the \c equals matcher.
+/// TODO add support for FloatingLiteral and CharacterLiteral
+/// @{

aaron.ballman wrote:
> Why not add this support immediately rather than a TODO?
The parser would need additional changes for it to be usable in clang-query 
(see D33093 for boolean support), my initial focus was on supporting 
IntegerLiterals but bool was added to have an overload.

I'll look into adding support for other types.



Comment at: include/clang/ASTMatchers/ASTMatchersMacros.h:364
+/// comparing a \c ReturnType node against the a \c ParamType value.
+#define AST_CONCRETE_EQUALS_MATCHER(ReturnType, ParamType, OverloadId) 
\
+  inline ::clang::ast_matchers::internal::Matcher equals(  
\

aaron.ballman wrote:
> Instead of making the user of the macro pass in an overload id, could we make 
> use of the `__LINE__` macro to automate it? Given the length of the macro 
> name, I struggle to imagine many people accidentally defining two overloads 
> on the same line (and we can document this macro appropriately, of course).
Not sure how `__LINE__` would help, uniqueness is not the only requirement, it 
must also be a fixed name such that Registry can refer to it. (Uniqueness is 
also needed, otherwise it would be ambiguous).

Alternatively, the overload name can be removed, but then the returntype and 
paramtype for the marshaller should be explicitly specified. This would remove 
the magic numbers (for overload ID), is this an approach worth looking into?



Comment at: include/clang/ASTMatchers/ASTMatchersMacros.h:366
+  inline ::clang::ast_matchers::internal::Matcher equals(  
\
+  ParamType const ) {
\
+return ::clang::ast_matchers::internal::makeMatcher(   
\

aaron.ballman wrote:
> `const ParamType ` per the coding guidelines.
Will fix (this was copied from the above macros).


https://reviews.llvm.org/D33094



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


[PATCH] D33093: [ASTMatchers] Add support for boolean literals

2017-05-11 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM!


https://reviews.llvm.org/D33093



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


[PATCH] D33094: [ASTMatchers] Add equals support for integer and boolean literals

2017-05-11 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a reviewer: aaron.ballman.
aaron.ballman added a comment.

Please be sure to regenerate the AST matcher documentation as well by running 
clang/docs/tools/dump_ast_matchers.py




Comment at: include/clang/ASTMatchers/ASTMatchers.h:3827
+/// \brief Instantiations for the \c equals matcher.
+/// TODO add support for FloatingLiteral and CharacterLiteral
+/// @{

Why not add this support immediately rather than a TODO?



Comment at: include/clang/ASTMatchers/ASTMatchersMacros.h:364
+/// comparing a \c ReturnType node against the a \c ParamType value.
+#define AST_CONCRETE_EQUALS_MATCHER(ReturnType, ParamType, OverloadId) 
\
+  inline ::clang::ast_matchers::internal::Matcher equals(  
\

Instead of making the user of the macro pass in an overload id, could we make 
use of the `__LINE__` macro to automate it? Given the length of the macro name, 
I struggle to imagine many people accidentally defining two overloads on the 
same line (and we can document this macro appropriately, of course).



Comment at: include/clang/ASTMatchers/ASTMatchersMacros.h:366
+  inline ::clang::ast_matchers::internal::Matcher equals(  
\
+  ParamType const ) {
\
+return ::clang::ast_matchers::internal::makeMatcher(   
\

`const ParamType ` per the coding guidelines.



Comment at: include/clang/ASTMatchers/ASTMatchersMacros.h:371
+  typedef ::clang::ast_matchers::internal::Matcher(
\
+  _Type##OverloadId)(ParamType const )
+

Same here.


https://reviews.llvm.org/D33094



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


Re: Fix two-stage build on windows using DistributionExample cmake cache

2017-05-11 Thread Chris Bieneman via cfe-commits
Normally I would be happy to, but I'm actually at the airport about to board a 
flight and won't have reliable internet access for at least the next 24 hours.

Can someone else land this for Matthew?

Matthew, if nobody responds in email, try hopping onto LLVM's IRC channel.

Thanks,
-Chris

> On May 11, 2017, at 3:40 AM, Matthew Larionov  wrote:
> 
> Unfortunately I don't have commit rights. Could you please land it for me?
> 
>> On Thu, May 11, 2017 at 1:28 PM, Chris Bieneman  wrote:
>> This patch LGTM!
>> 
>> Thanks!
>> -Chris
>> 
>>> On May 11, 2017, at 3:13 AM, Matthew Larionov  wrote:
>>> 
>>> Chris, Hi! Could you please take a look at my patch?
>>> Or advice someone who could.
>>> 
 On Wed, May 3, 2017 at 8:28 PM, Matthew Larionov  
 wrote:
 I've added a correct compiler name for bootstrap builds on windows.
 Also added an opportunity to override stage2 cache file to make 
 distribution example more flexible.
>>> 
>> 
> 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D30896: [Clang-tidy] add check misc-prefer-switch-for-enums

2017-05-11 Thread Alexander Kornienko via Phabricator via cfe-commits
alexfh requested changes to this revision.
alexfh added a comment.

In https://reviews.llvm.org/D30896#703046, @jbcoe wrote:

> I think that clang-tidy allows case-specific subsetting of C++. It is said 
> that C++ contains a beautiful language and I've found that definition of 
> beauty to be very use-case
>  specific. Checks for side-effect free, Haskell-like, functional code would 
> be of enormous interest to some subsections of the C++ community ( financial 
> asset pricing and risk)
>
>   but of very little interest to others (device drivers for embedded code). 
> It would seem an enormous loss to me to require all clang-tidy checks to be 
> generally useful. 


We don't require checks to be useful to every single C++ developer, but there 
is a certain bar the check should meet. It's not well defined, but I don't 
think we want checks that are only useful to a single person / company / code 
base (maybe with an exception of LLVM, since, well, clang-tidy is a part of it 
;). The rationale is simple: every check added to clang-tidy adds up to all 
sorts of maintenance costs (source code maintenance, build and test times, 
binary sizes, complexity for the user, bugs filed, etc.), which should be 
outweighed by the usefulness of the check. When there's a single beneficiary of 
the check, they better care the costs of maintaining an out-of-tree check 
themselves.

Going back to what Aaron asked: is there any well-known coding standard, book 
or any other credible publication that formalizes recommendations on where 
using `switch` is preferred over `if`? I'm sure "enormous interest" would 
warrant existence of this kind of a recommendation, which might justify the 
presence of the check.

> It's a simple matter to define a clang-tidy config file to enable different 
> checks in different parts of a code base.


Repository:
  rL LLVM

https://reviews.llvm.org/D30896



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


[PATCH] D33095: [analyzer] Avoid allocation in Std C function modelling.

2017-05-11 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun created this revision.
Herald added a subscriber: whisperity.

Avoid an allocation in modelling Std C functions to improve the performance.


Repository:
  rL LLVM

https://reviews.llvm.org/D33095

Files:
  lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp


Index: lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
===
--- lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
+++ lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
@@ -440,7 +440,10 @@
   BasicValueFactory  = SVB.getBasicValueFactory();
   initFunctionSummaries(BVF);
 
-  std::string Name = FD->getQualifiedNameAsString();
+  IdentifierInfo *II = FD->getIdentifier();
+  if (!II)
+return None;
+  StringRef Name = II->getName();
   if (Name.empty() || !C.isCLibraryFunction(FD, Name))
 return None;
 


Index: lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
===
--- lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
+++ lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
@@ -440,7 +440,10 @@
   BasicValueFactory  = SVB.getBasicValueFactory();
   initFunctionSummaries(BVF);
 
-  std::string Name = FD->getQualifiedNameAsString();
+  IdentifierInfo *II = FD->getIdentifier();
+  if (!II)
+return None;
+  StringRef Name = II->getName();
   if (Name.empty() || !C.isCLibraryFunction(FD, Name))
 return None;
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D33092: [analyzer] Add checker to model builtin functions

2017-05-11 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun added a comment.

In https://reviews.llvm.org/D33092#752039, @NoQ wrote:

> Hmm, shouldn't this be part of `BuiltinFunctionChecker` aka 
> `core.builtin.BuiltinFunctions`? We already have `__builtin_assume_aligned` 
> here (though it doesn't seem to assume anything because that particular 
> assumption is hard to model).


You are completely right! I do not know how could I miss that. :)


https://reviews.llvm.org/D33092



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


[PATCH] D33092: [analyzer] Add checker to model builtin functions

2017-05-11 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun updated this revision to Diff 98609.
xazax.hun marked an inline comment as done.
xazax.hun edited the summary of this revision.
xazax.hun added a comment.

- Move this to the right checker.


https://reviews.llvm.org/D33092

Files:
  lib/StaticAnalyzer/Checkers/BuiltinFunctionChecker.cpp
  test/Analysis/builtin-assume.c


Index: test/Analysis/builtin-assume.c
===
--- /dev/null
+++ test/Analysis/builtin-assume.c
@@ -0,0 +1,8 @@
+// RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -verify 
%s
+
+void clang_analyzer_eval(int);
+
+void f(int i) {
+  __builtin_assume(i < 10);
+  clang_analyzer_eval(i < 15); // expected-warning {{TRUE}}
+}
Index: lib/StaticAnalyzer/Checkers/BuiltinFunctionChecker.cpp
===
--- lib/StaticAnalyzer/Checkers/BuiltinFunctionChecker.cpp
+++ lib/StaticAnalyzer/Checkers/BuiltinFunctionChecker.cpp
@@ -41,6 +41,21 @@
   default:
 return false;
 
+  case Builtin::BI__builtin_assume: {
+assert (CE->arg_begin() != CE->arg_end());
+SVal ArgSVal = state->getSVal(CE->getArg(0), LCtx);
+if (ArgSVal.isUndef())
+  return true; // Return true to model purity.
+
+state = state->assume(ArgSVal.castAs(), true);
+// FIXME: do we want to warn here?
+if (!state)
+  return true;
+
+C.addTransition(state);
+return true;
+  }
+
   case Builtin::BI__builtin_unpredictable:
   case Builtin::BI__builtin_expect:
   case Builtin::BI__builtin_assume_aligned:


Index: test/Analysis/builtin-assume.c
===
--- /dev/null
+++ test/Analysis/builtin-assume.c
@@ -0,0 +1,8 @@
+// RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -verify %s
+
+void clang_analyzer_eval(int);
+
+void f(int i) {
+  __builtin_assume(i < 10);
+  clang_analyzer_eval(i < 15); // expected-warning {{TRUE}}
+}
Index: lib/StaticAnalyzer/Checkers/BuiltinFunctionChecker.cpp
===
--- lib/StaticAnalyzer/Checkers/BuiltinFunctionChecker.cpp
+++ lib/StaticAnalyzer/Checkers/BuiltinFunctionChecker.cpp
@@ -41,6 +41,21 @@
   default:
 return false;
 
+  case Builtin::BI__builtin_assume: {
+assert (CE->arg_begin() != CE->arg_end());
+SVal ArgSVal = state->getSVal(CE->getArg(0), LCtx);
+if (ArgSVal.isUndef())
+  return true; // Return true to model purity.
+
+state = state->assume(ArgSVal.castAs(), true);
+// FIXME: do we want to warn here?
+if (!state)
+  return true;
+
+C.addTransition(state);
+return true;
+  }
+
   case Builtin::BI__builtin_unpredictable:
   case Builtin::BI__builtin_expect:
   case Builtin::BI__builtin_assume_aligned:
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D33094: [ASTMatchers] Add equals support for integer and boolean literals

2017-05-11 Thread Peter Wu via Phabricator via cfe-commits
Lekensteyn created this revision.

This allows the clang-query tool to use matchers like
"integerLiteral(equals(32))". The equals function is a template, so some
special trickery is needed.


https://reviews.llvm.org/D33094

Files:
  include/clang/ASTMatchers/ASTMatchers.h
  include/clang/ASTMatchers/ASTMatchersMacros.h
  lib/ASTMatchers/Dynamic/Registry.cpp
  unittests/ASTMatchers/Dynamic/RegistryTest.cpp


Index: unittests/ASTMatchers/Dynamic/RegistryTest.cpp
===
--- unittests/ASTMatchers/Dynamic/RegistryTest.cpp
+++ unittests/ASTMatchers/Dynamic/RegistryTest.cpp
@@ -511,6 +511,21 @@
   EXPECT_FALSE(matches("int i = 1;", Value));
 }
 
+TEST_F(RegistryTest, EqualsMatcher) {
+  Matcher IntegerStmt = constructMatcher(
+  "integerLiteral", constructMatcher("equals", VariantValue(42)))
+  .getTypedMatcher();
+  EXPECT_TRUE(matches("int x = 42;", IntegerStmt));
+  EXPECT_FALSE(matches("int x = 1;", IntegerStmt));
+
+  Matcher BooleanStmt = constructMatcher(
+  "cxxBoolLiteral", constructMatcher("equals", VariantValue(true)))
+  .getTypedMatcher();
+  EXPECT_TRUE(matches("bool x = true;", BooleanStmt));
+  EXPECT_FALSE(matches("bool x = false;", BooleanStmt));
+  EXPECT_FALSE(matches("bool x = 0;", BooleanStmt));
+}
+
 } // end anonymous namespace
 } // end namespace dynamic
 } // end namespace ast_matchers
Index: lib/ASTMatchers/Dynamic/Registry.cpp
===
--- lib/ASTMatchers/Dynamic/Registry.cpp
+++ lib/ASTMatchers/Dynamic/Registry.cpp
@@ -96,6 +96,9 @@
   REGISTER_OVERLOADED_2(references);
   REGISTER_OVERLOADED_2(thisPointerType);
 
+  // TODO add support for floats and char literals
+  REGISTER_OVERLOADED_2(equals);
+
   REGISTER_MATCHER(accessSpecDecl);
   REGISTER_MATCHER(addrLabelExpr);
   REGISTER_MATCHER(alignOfExpr);
Index: include/clang/ASTMatchers/ASTMatchersMacros.h
===
--- include/clang/ASTMatchers/ASTMatchersMacros.h
+++ include/clang/ASTMatchers/ASTMatchersMacros.h
@@ -359,6 +359,17 @@
   ::clang::ast_matchers::internal::BoundNodesTreeBuilder *Builder) 
\
   const
 
+/// \brief Defines functions and a type for the \c equals matcher, suitable for
+/// comparing a \c ReturnType node against the a \c ParamType value.
+#define AST_CONCRETE_EQUALS_MATCHER(ReturnType, ParamType, OverloadId) 
\
+  inline ::clang::ast_matchers::internal::Matcher equals(  
\
+  ParamType const ) {
\
+return ::clang::ast_matchers::internal::makeMatcher(   
\
+new internal::ValueEqualsMatcher(Param));   
\
+  }
\
+  typedef ::clang::ast_matchers::internal::Matcher(
\
+  _Type##OverloadId)(ParamType const )
+
 /// \brief Creates a variadic matcher for both a specific \c Type as well as
 /// the corresponding \c TypeLoc.
 #define AST_TYPE_MATCHER(NodeType, MatcherName)
\
Index: include/clang/ASTMatchers/ASTMatchers.h
===
--- include/clang/ASTMatchers/ASTMatchers.h
+++ include/clang/ASTMatchers/ASTMatchers.h
@@ -3813,7 +3813,7 @@
 ///   true
 /// \endcode
 ///
-/// Usable as: Matcher, Matcher,
+/// Usable as: Matcher, Matcher,
 ///Matcher, Matcher
 template 
 internal::PolymorphicMatcherWithParam1
@@ -3823,6 +3823,13 @@
 ValueT>(Value);
 }
 
+/// \brief Instantiations for the \c equals matcher.
+/// TODO add support for FloatingLiteral and CharacterLiteral
+/// @{
+AST_CONCRETE_EQUALS_MATCHER(CXXBoolLiteralExpr, bool, 0);
+AST_CONCRETE_EQUALS_MATCHER(IntegerLiteral, unsigned, 1);
+/// @}
+
 /// \brief Matches the operator Name of operator expressions (binary or
 /// unary).
 ///


Index: unittests/ASTMatchers/Dynamic/RegistryTest.cpp
===
--- unittests/ASTMatchers/Dynamic/RegistryTest.cpp
+++ unittests/ASTMatchers/Dynamic/RegistryTest.cpp
@@ -511,6 +511,21 @@
   EXPECT_FALSE(matches("int i = 1;", Value));
 }
 
+TEST_F(RegistryTest, EqualsMatcher) {
+  Matcher IntegerStmt = constructMatcher(
+  "integerLiteral", constructMatcher("equals", VariantValue(42)))
+  .getTypedMatcher();
+  EXPECT_TRUE(matches("int x = 42;", IntegerStmt));
+  EXPECT_FALSE(matches("int x = 1;", IntegerStmt));
+
+  Matcher BooleanStmt = constructMatcher(
+  "cxxBoolLiteral", constructMatcher("equals", VariantValue(true)))
+  .getTypedMatcher();
+  EXPECT_TRUE(matches("bool x = true;", BooleanStmt));
+  EXPECT_FALSE(matches("bool x = false;", BooleanStmt));
+  EXPECT_FALSE(matches("bool x = 0;", BooleanStmt));
+}
+
 } // end anonymous namespace
 } // end namespace dynamic
 } // end 

[PATCH] D33093: [ASTMatchers] Add support for boolean literals

2017-05-11 Thread Peter Wu via Phabricator via cfe-commits
Lekensteyn created this revision.

Recognize boolean literals for future extensions ("equals(true)").
Note that a specific VariantValue constructor is added to resolve

ambiguity (like "Value = 5") between unsigned and bool.
---

Passes clang-test, patch for equals will follow shortly.


https://reviews.llvm.org/D33093

Files:
  include/clang/ASTMatchers/Dynamic/Parser.h
  include/clang/ASTMatchers/Dynamic/VariantValue.h
  lib/ASTMatchers/Dynamic/Marshallers.h
  lib/ASTMatchers/Dynamic/Parser.cpp
  lib/ASTMatchers/Dynamic/VariantValue.cpp
  unittests/ASTMatchers/Dynamic/ParserTest.cpp
  unittests/ASTMatchers/Dynamic/VariantValueTest.cpp

Index: unittests/ASTMatchers/Dynamic/VariantValueTest.cpp
===
--- unittests/ASTMatchers/Dynamic/VariantValueTest.cpp
+++ unittests/ASTMatchers/Dynamic/VariantValueTest.cpp
@@ -75,12 +75,14 @@
   EXPECT_TRUE(Value.isString());
   EXPECT_EQ("A", Value.getString());
   EXPECT_TRUE(Value.hasValue());
+  EXPECT_FALSE(Value.isBoolean());
   EXPECT_FALSE(Value.isUnsigned());
   EXPECT_FALSE(Value.isMatcher());
   EXPECT_EQ("String", Value.getTypeAsString());
 
   Value = VariantMatcher::SingleMatcher(recordDecl());
   EXPECT_TRUE(Value.hasValue());
+  EXPECT_FALSE(Value.isBoolean());
   EXPECT_FALSE(Value.isUnsigned());
   EXPECT_FALSE(Value.isString());
   EXPECT_TRUE(Value.isMatcher());
@@ -91,12 +93,22 @@
   Value = 17;
   EXPECT_TRUE(Value.isUnsigned());
   EXPECT_EQ(17U, Value.getUnsigned());
+  EXPECT_FALSE(Value.isBoolean());
   EXPECT_TRUE(Value.hasValue());
   EXPECT_FALSE(Value.isMatcher());
   EXPECT_FALSE(Value.isString());
 
+  Value = true;
+  EXPECT_TRUE(Value.isBoolean());
+  EXPECT_EQ(true, Value.getBoolean());
+  EXPECT_TRUE(Value.hasValue());
+  EXPECT_FALSE(Value.isUnsigned());
+  EXPECT_FALSE(Value.isMatcher());
+  EXPECT_FALSE(Value.isString());
+
   Value = VariantValue();
   EXPECT_FALSE(Value.hasValue());
+  EXPECT_FALSE(Value.isBoolean());
   EXPECT_FALSE(Value.isUnsigned());
   EXPECT_FALSE(Value.isString());
   EXPECT_FALSE(Value.isMatcher());
Index: unittests/ASTMatchers/Dynamic/ParserTest.cpp
===
--- unittests/ASTMatchers/Dynamic/ParserTest.cpp
+++ unittests/ASTMatchers/Dynamic/ParserTest.cpp
@@ -75,6 +75,15 @@
   ExpectedMatchersTy ExpectedMatchers;
 };
 
+TEST(ParserTest, ParseBoolean) {
+  MockSema Sema;
+  Sema.parse("true");
+  Sema.parse("false");
+  EXPECT_EQ(2U, Sema.Values.size());
+  EXPECT_EQ(true, Sema.Values[0].getBoolean());
+  EXPECT_EQ(false, Sema.Values[1].getBoolean());
+}
+
 TEST(ParserTest, ParseUnsigned) {
   MockSema Sema;
   Sema.parse("0");
Index: lib/ASTMatchers/Dynamic/VariantValue.cpp
===
--- lib/ASTMatchers/Dynamic/VariantValue.cpp
+++ lib/ASTMatchers/Dynamic/VariantValue.cpp
@@ -24,6 +24,8 @@
   switch (getArgKind()) {
   case AK_Matcher:
 return (Twine("Matcher<") + MatcherKind.asStringRef() + ">").str();
+  case AK_Boolean:
+return "boolean";
   case AK_Unsigned:
 return "unsigned";
   case AK_String:
@@ -247,6 +249,10 @@
   *this = Other;
 }
 
+VariantValue::VariantValue(bool Boolean) : Type(VT_Nothing) {
+  setBoolean(Boolean);
+}
+
 VariantValue::VariantValue(unsigned Unsigned) : Type(VT_Nothing) {
   setUnsigned(Unsigned);
 }
@@ -265,6 +271,9 @@
   if (this == ) return *this;
   reset();
   switch (Other.Type) {
+  case VT_Boolean:
+setBoolean(Other.getBoolean());
+break;
   case VT_Unsigned:
 setUnsigned(Other.getUnsigned());
 break;
@@ -290,13 +299,29 @@
 delete Value.Matcher;
 break;
   // Cases that do nothing.
+  case VT_Boolean:
   case VT_Unsigned:
   case VT_Nothing:
 break;
   }
   Type = VT_Nothing;
 }
 
+bool VariantValue::isBoolean() const {
+  return Type == VT_Boolean;
+}
+
+bool VariantValue::getBoolean() const {
+  assert(isBoolean());
+  return Value.Boolean;
+}
+
+void VariantValue::setBoolean(bool NewValue) {
+  reset();
+  Type = VT_Boolean;
+  Value.Boolean = NewValue;
+}
+
 bool VariantValue::isUnsigned() const {
   return Type == VT_Unsigned;
 }
@@ -344,6 +369,12 @@
 
 bool VariantValue::isConvertibleTo(ArgKind Kind, unsigned *Specificity) const {
   switch (Kind.getArgKind()) {
+  case ArgKind::AK_Boolean:
+if (!isBoolean())
+  return false;
+*Specificity = 1;
+return true;
+
   case ArgKind::AK_Unsigned:
 if (!isUnsigned())
   return false;
@@ -383,6 +414,7 @@
   switch (Type) {
   case VT_String: return "String";
   case VT_Matcher: return getMatcher().getTypeAsString();
+  case VT_Boolean: return "Boolean";
   case VT_Unsigned: return "Unsigned";
   case VT_Nothing: return "Nothing";
   }
Index: lib/ASTMatchers/Dynamic/Parser.cpp
===
--- lib/ASTMatchers/Dynamic/Parser.cpp
+++ lib/ASTMatchers/Dynamic/Parser.cpp
@@ -153,8 

[PATCH] D33047: [ClangD] Refactor clangd into separate components

2017-05-11 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments.



Comment at: clangd/ClangdLSPServer.h:23
+
+class ClangdLSPServer {
+  class LSPDiagnosticsConsumer;

klimek wrote:
> I'd have expected something that's called LSP server to work on the LSP 
> protocol level (that is, have a server(iostream) equivalent method).
The idea is to have a class that wraps ClangdServer and is called by clangd's 
ProtocolHandlers.cpp to do all the work.
I.e. it's a replacement of what used to be called 'ASTManager'. Any suggestions 
for a better name? ClangdLSPHandler?

It's seems hard to implement the interface you suggest right away, lots of code 
will have to be moved. Happy to do that in further commits, but suggest we 
leave this class as is in this commit.



Comment at: clangd/ClangdUnit.h:44
+  /// Reparse with new contents
+  void reparse(StringRef Contents);
+

klimek wrote:
> One question is how we can handle when we want the old one to stick around 
> while we do a full reparse (when #includes change), so we still have fast 
> code completion.
My idea was to have two ClangdUnits for that and handle that somewhere 
else(i.e. ClangdUnitStore seem like a good place to do that)



Comment at: clangd/ClangdUnitStore.h:29-30
+  void runOnUnit(PathRef File, StringRef FileContents,
+ GlobalCompilationDatabase ,
+ std::shared_ptr PCHs, Func Action,
+ bool ReparseBeforeAction = true) {

klimek wrote:
> Not having read enough of the rest of the patch yet, I'd expect these things 
> to be stored on the class level instead of being passed around all the time.
> Similarly, we're missing the VFS?
The VFS changes are not in this commit, they will follow later, that's an 
initial refactoring of clangd to allow more gradual changes later.

The idea is that this class is an implementation detail of ClangdServer that 
handles synchronized access to underlying ClangdUnits(which are not 
thread-safe) and doesn't do anything else (i.e. doesn't care about storing the 
contents of the files etc).



Comment at: clangd/ClangdUnitStore.h:31
+ std::shared_ptr PCHs, Func Action,
+ bool ReparseBeforeAction = true) {
+std::lock_guard Lock(Mutex);

klimek wrote:
> Parameters after a function are unfortunate, as they make the code flow weird 
> when you want to pass in a lambda, but still want to set the parameter after 
> it :(
> Given how different the semantics are, I'd perhaps make these 2 functions:
> 
>   // Run on the translation unit.
>   // If there was a previous call of runOnUnitWithContent, the content 
> provided there will be used.
>   // Otherwise, the file will be read from VFS.
>   runOnStoredUnit(PathRef File, Func Action);
> 
>   // Run on the translation unit with the given content.
>   // Content will be stored as in-flight code for the given translation unit 
> only:
>   // - if a different translation unit is parsed that #includes File, Content 
> will not be used;
>   // - subsequent calls to runOnStoredUnit will re-use Content.
>   runOnUnitWithContent(PathRef File, StringRef Content, Func Action);
> 
> 
Moved the Func parameter to the end of the list.

The difference is semantics is different from what it seemed. Added comments 
and split function into two to clarify that.
We need Content in both cases, because if there's no ClangdUnit, then we'll 
have to create it and it requires initial text. And most actions need to call 
'ClangdUnit::reparse' before they are run. But not code completion, which 
basically does reparse itself, hence the ReparseBeforeActionParameter.
See updated code for more details.



Comment at: clangd/ClangdUnitStore.h:32
+ bool ReparseBeforeAction = true) {
+std::lock_guard Lock(Mutex);
+

klimek wrote:
> This is due to a restriction in the AST unit? If we don't need to reparse, 
> why can't we run multiple things over an AST at once?
There are things like codeComplete that are actually mutable, but all other 
things could probably be run in parallel. (Don't have a great insight into 
that, though).
I really didn't want to change any of clangd behaviour in that commit, but I'd 
be glad to try adding that later.
What we could have in the future:
runOnUnitUnderReadLock(... [](const ClangdUnit ) { auto diags = 
Unit.getLocalDiagnostics(); /* ... */} );
runOnUnitUnderWriteLock(... []( ClangdUnit ) { auto completions = 
Unit.codeComplete(); /* ... */} );




Comment at: clangd/GlobalCompilationDatabase.h:28
+/// Provides compilation arguments used for building ClangdUnit.
+class GlobalCompilationDatabase {
+public:

klimek wrote:
> What's global about this?
The fact that it's created only once(as opposed to 
tooling::CompilationDatabase, which can be recreated for each file) and handles 
all CompileCommand-related things(i.e. 

[PATCH] D33047: [ClangD] Refactor clangd into separate components

2017-05-11 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov updated this revision to Diff 98606.
ilya-biryukov marked 3 inline comments as done.
ilya-biryukov added a comment.

Addressed review comments


https://reviews.llvm.org/D33047

Files:
  clangd/ASTManager.cpp
  clangd/ASTManager.h
  clangd/CMakeLists.txt
  clangd/ClangdLSPServer.cpp
  clangd/ClangdLSPServer.h
  clangd/ClangdMain.cpp
  clangd/ClangdServer.cpp
  clangd/ClangdServer.h
  clangd/ClangdUnit.cpp
  clangd/ClangdUnit.h
  clangd/ClangdUnitStore.cpp
  clangd/ClangdUnitStore.h
  clangd/DocumentStore.h
  clangd/DraftStore.cpp
  clangd/DraftStore.h
  clangd/GlobalCompilationDatabase.cpp
  clangd/GlobalCompilationDatabase.h
  clangd/Path.h
  clangd/ProtocolHandlers.cpp
  clangd/ProtocolHandlers.h

Index: clangd/ProtocolHandlers.h
===
--- clangd/ProtocolHandlers.h
+++ clangd/ProtocolHandlers.h
@@ -22,8 +22,8 @@
 
 namespace clang {
 namespace clangd {
-class ASTManager;
-class DocumentStore;
+class ClangdLSPServer;
+class ClangdLSPServer;
 
 struct InitializeHandler : Handler {
   InitializeHandler(JSONOutput ) : Handler(Output) {}
@@ -56,83 +56,83 @@
 };
 
 struct TextDocumentDidOpenHandler : Handler {
-  TextDocumentDidOpenHandler(JSONOutput , DocumentStore )
-  : Handler(Output), Store(Store) {}
+  TextDocumentDidOpenHandler(JSONOutput , ClangdLSPServer )
+  : Handler(Output), AST(AST) {}
 
   void handleNotification(llvm::yaml::MappingNode *Params) override;
 
 private:
-  DocumentStore 
+  ClangdLSPServer 
 };
 
 struct TextDocumentDidChangeHandler : Handler {
-  TextDocumentDidChangeHandler(JSONOutput , DocumentStore )
-  : Handler(Output), Store(Store) {}
+  TextDocumentDidChangeHandler(JSONOutput , ClangdLSPServer )
+  : Handler(Output), AST(AST) {}
 
   void handleNotification(llvm::yaml::MappingNode *Params) override;
 
 private:
-  DocumentStore 
+  ClangdLSPServer 
 };
 
 struct TextDocumentDidCloseHandler : Handler {
-  TextDocumentDidCloseHandler(JSONOutput , DocumentStore )
-  : Handler(Output), Store(Store) {}
+  TextDocumentDidCloseHandler(JSONOutput , ClangdLSPServer )
+  : Handler(Output), AST(AST) {}
 
   void handleNotification(llvm::yaml::MappingNode *Params) override;
 
 private:
-  DocumentStore 
+  ClangdLSPServer 
 };
 
 struct TextDocumentOnTypeFormattingHandler : Handler {
-  TextDocumentOnTypeFormattingHandler(JSONOutput , DocumentStore )
-  : Handler(Output), Store(Store) {}
+  TextDocumentOnTypeFormattingHandler(JSONOutput , ClangdLSPServer )
+  : Handler(Output), AST(AST) {}
 
   void handleMethod(llvm::yaml::MappingNode *Params, StringRef ID) override;
 
 private:
-  DocumentStore 
+  ClangdLSPServer 
 };
 
 struct TextDocumentRangeFormattingHandler : Handler {
-  TextDocumentRangeFormattingHandler(JSONOutput , DocumentStore )
-  : Handler(Output), Store(Store) {}
+  TextDocumentRangeFormattingHandler(JSONOutput , ClangdLSPServer )
+  : Handler(Output), AST(AST) {}
 
   void handleMethod(llvm::yaml::MappingNode *Params, StringRef ID) override;
 
 private:
-  DocumentStore 
+  ClangdLSPServer 
 };
 
 struct TextDocumentFormattingHandler : Handler {
-  TextDocumentFormattingHandler(JSONOutput , DocumentStore )
-  : Handler(Output), Store(Store) {}
+  TextDocumentFormattingHandler(JSONOutput , ClangdLSPServer )
+  : Handler(Output), AST(AST) {}
 
   void handleMethod(llvm::yaml::MappingNode *Params, StringRef ID) override;
 
 private:
-  DocumentStore 
+  ClangdLSPServer 
 };
 
 struct CodeActionHandler : Handler {
-  CodeActionHandler(JSONOutput , ASTManager )
+  CodeActionHandler(JSONOutput , ClangdLSPServer )
   : Handler(Output), AST(AST) {}
 
   void handleMethod(llvm::yaml::MappingNode *Params, StringRef ID) override;
 
 private:
-  ASTManager 
+  ClangdLSPServer 
 };
 
 struct CompletionHandler : Handler {
-  CompletionHandler(JSONOutput , ASTManager )
+  CompletionHandler(JSONOutput , ClangdLSPServer )
   : Handler(Output), AST(AST) {}
 
   void handleMethod(llvm::yaml::MappingNode *Params, StringRef ID) override;
 
  private:
-  ASTManager 
+  ClangdLSPServer 
 };
 
 } // namespace clangd
Index: clangd/ProtocolHandlers.cpp
===
--- clangd/ProtocolHandlers.cpp
+++ clangd/ProtocolHandlers.cpp
@@ -8,9 +8,10 @@
 //===--===//
 
 #include "ProtocolHandlers.h"
-#include "ASTManager.h"
-#include "DocumentStore.h"
+#include "ClangdServer.h"
+#include "DraftStore.h"
 #include "clang/Format/Format.h"
+#include "ClangdLSPServer.h"
 using namespace clang;
 using namespace clangd;
 
@@ -21,7 +22,7 @@
 Output.log("Failed to decode DidOpenTextDocumentParams!\n");
 return;
   }
-  Store.addDocument(DOTDP->textDocument.uri.file, DOTDP->textDocument.text);
+  AST.openDocument(DOTDP->textDocument.uri.file, DOTDP->textDocument.text);
 }
 
 void TextDocumentDidCloseHandler::handleNotification(
@@ -32,7 +33,7 @@
 

Re: Fix two-stage build on windows using DistributionExample cmake cache

2017-05-11 Thread Matthew Larionov via cfe-commits
Unfortunately I don't have commit rights. Could you please land it for me?

On Thu, May 11, 2017 at 1:28 PM, Chris Bieneman  wrote:

> This patch LGTM!
>
> Thanks!
> -Chris
>
> On May 11, 2017, at 3:13 AM, Matthew Larionov 
> wrote:
>
> Chris, Hi! Could you please take a look at my patch?
> Or advice someone who could.
>
> On Wed, May 3, 2017 at 8:28 PM, Matthew Larionov 
> wrote:
>
>> I've added a correct compiler name for bootstrap builds on windows.
>> Also added an opportunity to override stage2 cache file to make
>> distribution example more flexible.
>>
>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: Fix two-stage build on windows using DistributionExample cmake cache

2017-05-11 Thread Chris Bieneman via cfe-commits
This patch LGTM!

Thanks!
-Chris

> On May 11, 2017, at 3:13 AM, Matthew Larionov  wrote:
> 
> Chris, Hi! Could you please take a look at my patch?
> Or advice someone who could.
> 
> On Wed, May 3, 2017 at 8:28 PM, Matthew Larionov  > wrote:
> I've added a correct compiler name for bootstrap builds on windows.
> Also added an opportunity to override stage2 cache file to make distribution 
> example more flexible.
> 

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


Re: Fix two-stage build on windows using DistributionExample cmake cache

2017-05-11 Thread Matthew Larionov via cfe-commits
Chris, Hi! Could you please take a look at my patch?
Or advice someone who could.

On Wed, May 3, 2017 at 8:28 PM, Matthew Larionov 
wrote:

> I've added a correct compiler name for bootstrap builds on windows.
> Also added an opportunity to override stage2 cache file to make
> distribution example more flexible.
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D33092: [analyzer] Add checker to model builtin functions

2017-05-11 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment.

Hmm, shouldn't this be part of `BuiltinFunctionChecker` aka 
`core.builtin.BuiltinFunctions`? We already have `__builtin_assume_aligned` 
here (though it doesn't seem to assume anything because that particular 
assumption is hard to model).




Comment at: lib/StaticAnalyzer/Checkers/ModelBuiltinChecker.cpp:49
+if (!State)
+  return false;
+

We could also pretend we modeled the call, so that to avoid invalidation.


Repository:
  rL LLVM

https://reviews.llvm.org/D33092



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


[PATCH] D33092: [analyzer] Add checker to model builtin functions

2017-05-11 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun created this revision.
Herald added subscribers: whisperity, mgorny.

I added a checker to model builtin functions. Only one builtin function is 
modelled so far. The motivation behind using `__builtin_assume` from the 
analyzers point of view is to add assumptions. The conventional way to express 
invariants is to use asserts (with correct annotations for noreturn functions). 
However on some platform the users do not want to pay the price of an assert, 
even in the debug build (especially in a hot code). This way we can express 
these invariants to the analyzer without runtime overhead.

What do you think?


Repository:
  rL LLVM

https://reviews.llvm.org/D33092

Files:
  include/clang/StaticAnalyzer/Checkers/Checkers.td
  lib/StaticAnalyzer/Checkers/CMakeLists.txt
  lib/StaticAnalyzer/Checkers/ModelBuiltinChecker.cpp
  test/Analysis/builtin-assume.c

Index: test/Analysis/builtin-assume.c
===
--- /dev/null
+++ test/Analysis/builtin-assume.c
@@ -0,0 +1,8 @@
+// RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -verify %s
+
+void clang_analyzer_eval(int);
+
+void f(int i) {
+  __builtin_assume(i < 10);
+  clang_analyzer_eval(i < 15); // expected-warning {{TRUE}}
+}
Index: lib/StaticAnalyzer/Checkers/ModelBuiltinChecker.cpp
===
--- /dev/null
+++ lib/StaticAnalyzer/Checkers/ModelBuiltinChecker.cpp
@@ -0,0 +1,59 @@
+//=== ModelBuiltinChecker.cpp - Model builtin functions -*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+//
+// This checker improves modeling of a few builtin compiler functions.
+// It does not generate warnings.
+//
+//===--===//
+
+#include "ClangSACheckers.h"
+#include "clang/StaticAnalyzer/Core/Checker.h"
+#include "clang/StaticAnalyzer/Core/CheckerManager.h"
+#include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h"
+#include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h"
+
+using namespace clang;
+using namespace clang::ento;
+
+namespace {
+class ModelBuiltinsChecker : public Checker {
+public:
+  bool evalCall(const CallExpr *CE, CheckerContext ) const {
+const FunctionDecl *FD =
+dyn_cast_or_null(CE->getCalleeDecl());
+if (!FD)
+  return false;
+if (!FD->getIdentifier())
+  return false;
+
+StringRef Name = FD->getName();
+if (Name.empty() || !C.isCLibraryFunction(FD, Name) ||
+Name != "__builtin_assume")
+  return false;
+
+ProgramStateRef State = C.getState();
+const LocationContext *LC = C.getLocationContext();
+SVal ArgSVal = State->getSVal(CE->getArg(0), LC);
+if (ArgSVal.isUndef())
+  return false;
+
+State = State->assume(ArgSVal.castAs(), true);
+// FIXME: do we want to warn here?
+if (!State)
+  return false;
+
+C.addTransition(State);
+return true;
+  }
+};
+} // end of anonymous namespace
+
+void ento::registerModelBuiltinsChecker(CheckerManager ) {
+  mgr.registerChecker();
+}
Index: lib/StaticAnalyzer/Checkers/CMakeLists.txt
===
--- lib/StaticAnalyzer/Checkers/CMakeLists.txt
+++ lib/StaticAnalyzer/Checkers/CMakeLists.txt
@@ -49,6 +49,7 @@
   MallocOverflowSecurityChecker.cpp
   MallocSizeofChecker.cpp
   MisusedMovedObjectChecker.cpp
+  ModelBuiltinChecker.cpp
   MPI-Checker/MPIBugReporter.cpp
   MPI-Checker/MPIChecker.cpp
   MPI-Checker/MPIFunctionClassifier.cpp
Index: include/clang/StaticAnalyzer/Checkers/Checkers.td
===
--- include/clang/StaticAnalyzer/Checkers/Checkers.td
+++ include/clang/StaticAnalyzer/Checkers/Checkers.td
@@ -99,6 +99,10 @@
   HelpText<"Check for dereferences of null pointers">,
   DescFile<"DereferenceChecker.cpp">;
 
+def ModelBuiltinsChecker : Checker<"ModelBuiltins">,
+  HelpText<"Model some compiler builtin functions">,
+  DescFile<"ModelBuiltinChecker.cpp">;
+
 def CallAndMessageChecker : Checker<"CallAndMessage">,
   HelpText<"Check for logical errors for function calls and Objective-C message expressions (e.g., uninitialized arguments, null function pointers)">,
   DescFile<"CallAndMessageChecker.cpp">;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D33080: [Libc++] Use #pragma push_macro/pop_macro to better handle min/max on Windows

2017-05-11 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added inline comments.



Comment at: include/__threading_support:632
 #endif // _LIBCPP_HAS_THREAD_API_PTHREAD
 
 #endif // !_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL || 
_LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL

Missing _LIBCPP_POP_MACROS


https://reviews.llvm.org/D33080



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


[PATCH] D33047: [ClangD] Refactor clangd into separate components

2017-05-11 Thread Manuel Klimek via Phabricator via cfe-commits
klimek added inline comments.



Comment at: clangd/ClangdLSPServer.h:23
+
+class ClangdLSPServer {
+  class LSPDiagnosticsConsumer;

I'd have expected something that's called LSP server to work on the LSP 
protocol level (that is, have a server(iostream) equivalent method).



Comment at: clangd/ClangdLSPServer.h:24-25
+class ClangdLSPServer {
+  class LSPDiagnosticsConsumer;
+
+public:

I like to put the public interface first, as that's what people usually look at 
first.



Comment at: clangd/ClangdLSPServer.h:48
+
+private:
+  JSONOutput 

AFAIK usually we don't duplicate access modifiers. 



Comment at: clangd/ClangdUnit.h:44
+  /// Reparse with new contents
+  void reparse(StringRef Contents);
+

One question is how we can handle when we want the old one to stick around 
while we do a full reparse (when #includes change), so we still have fast code 
completion.



Comment at: clangd/ClangdUnitStore.h:21
+namespace clang {
+namespace clangd {
+/// Thread-safe collection of ASTs built for specific files. Provides

Tiny nit: please add empty lines between classes and namespace delcs :)



Comment at: clangd/ClangdUnitStore.h:29-30
+  void runOnUnit(PathRef File, StringRef FileContents,
+ GlobalCompilationDatabase ,
+ std::shared_ptr PCHs, Func Action,
+ bool ReparseBeforeAction = true) {

Not having read enough of the rest of the patch yet, I'd expect these things to 
be stored on the class level instead of being passed around all the time.
Similarly, we're missing the VFS?



Comment at: clangd/ClangdUnitStore.h:31
+ std::shared_ptr PCHs, Func Action,
+ bool ReparseBeforeAction = true) {
+std::lock_guard Lock(Mutex);

Parameters after a function are unfortunate, as they make the code flow weird 
when you want to pass in a lambda, but still want to set the parameter after it 
:(
Given how different the semantics are, I'd perhaps make these 2 functions:

  // Run on the translation unit.
  // If there was a previous call of runOnUnitWithContent, the content provided 
there will be used.
  // Otherwise, the file will be read from VFS.
  runOnStoredUnit(PathRef File, Func Action);

  // Run on the translation unit with the given content.
  // Content will be stored as in-flight code for the given translation unit 
only:
  // - if a different translation unit is parsed that #includes File, Content 
will not be used;
  // - subsequent calls to runOnStoredUnit will re-use Content.
  runOnUnitWithContent(PathRef File, StringRef Content, Func Action);





Comment at: clangd/ClangdUnitStore.h:32
+ bool ReparseBeforeAction = true) {
+std::lock_guard Lock(Mutex);
+

This is due to a restriction in the AST unit? If we don't need to reparse, why 
can't we run multiple things over an AST at once?



Comment at: clangd/GlobalCompilationDatabase.cpp:55
+
+// TODO(ibiryukov): Invalidate cached compilation databases on changes
+auto result = CDB.get();

Here and elsewhere: in Clang, we use FIXME instead of TODO :)



Comment at: clangd/GlobalCompilationDatabase.h:28
+/// Provides compilation arguments used for building ClangdUnit.
+class GlobalCompilationDatabase {
+public:

What's global about this?


https://reviews.llvm.org/D33047



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


Re: r302777 - Reverted r302775

2017-05-11 Thread Serge Pavlov via cfe-commits
Sorry.
I have to investigate a fail in clang-tidy.

Thanks,
--Serge

2017-05-11 15:43 GMT+07:00 Richard Smith :

> When you revert a patch (even one of your own), please say why you
> reverted it in the commit message.
>
>
> On 11 May 2017 1:38 am, "Serge Pavlov via cfe-commits" <
> cfe-commits@lists.llvm.org> wrote:
>
> Author: sepavloff
> Date: Thu May 11 03:25:22 2017
> New Revision: 302777
>
> URL: http://llvm.org/viewvc/llvm-project?rev=302777=rev
> Log:
> Reverted r302775
>
> Added:
> cfe/trunk/test/Driver/arm-darwin-builtin.c
>   - copied unchanged from r302774, cfe/trunk/test/Driver/arm-darw
> in-builtin.c
> Modified:
> cfe/trunk/lib/Driver/Driver.cpp
> cfe/trunk/test/Driver/aarch64-cpus.c
> cfe/trunk/test/Driver/amdgpu-features.c
> cfe/trunk/test/Driver/arm-default-build-attributes.s
> cfe/trunk/test/Driver/cl-outputs.c
> cfe/trunk/test/Driver/clang_f_opts.c
> cfe/trunk/test/Driver/cuda-external-tools.cu
> cfe/trunk/test/Driver/debug-options.c
> cfe/trunk/test/Driver/gfortran.f90
> cfe/trunk/test/Driver/split-debug.h
> cfe/trunk/test/Driver/unknown-arg.c
> cfe/trunk/test/Index/index-attrs.c
> cfe/trunk/test/Index/index-attrs.cpp
> cfe/trunk/tools/driver/driver.cpp
>
> Modified: cfe/trunk/lib/Driver/Driver.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Dri
> ver.cpp?rev=302777=302776=302777=diff
> 
> ==
> --- cfe/trunk/lib/Driver/Driver.cpp (original)
> +++ cfe/trunk/lib/Driver/Driver.cpp Thu May 11 03:25:22 2017
> @@ -598,8 +598,6 @@ Compilation *Driver::BuildCompilation(Ar
>bool CCCPrintPhases;
>
>InputArgList Args = ParseArgStrings(ArgList.slice(1));
> -  if (Diags.hasErrorOccurred())
> -return nullptr;
>
>// Silence driver warnings if requested
>Diags.setIgnoreAllWarnings(Args.hasArg(options::OPT_w));
>
> Modified: cfe/trunk/test/Driver/aarch64-cpus.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/aa
> rch64-cpus.c?rev=302777=302776=302777=diff
> 
> ==
> --- cfe/trunk/test/Driver/aarch64-cpus.c (original)
> +++ cfe/trunk/test/Driver/aarch64-cpus.c Thu May 11 03:25:22 2017
> @@ -11,7 +11,7 @@
>  // RUN: %clang -target arm64 -### -c %s 2>&1 | FileCheck
> -check-prefix=ARM64-GENERIC %s
>  // RUN: %clang -target arm64 -mcpu=generic -### -c %s 2>&1 | FileCheck
> -check-prefix=ARM64-GENERIC %s
>  // RUN: %clang -target arm64 -mlittle-endian -### -c %s 2>&1 | FileCheck
> -check-prefix=ARM64-GENERIC %s
> -// RUN: %clang -target arm64 -mlittle-endian -mcpu=generic -### -c %s
> 2>&1 | FileCheck -check-prefix=ARM64-GENERIC %s
> +// RUN: %clang -target arm64 -mlittle-endian -mcpu-generic -### -c %s
> 2>&1 | FileCheck -check-prefix=ARM64-GENERIC %s
>
>  // ARM64-GENERIC: "-cc1"{{.*}} "-triple" "arm64{{.*}}" "-target-cpu"
> "generic"
>
>
> Modified: cfe/trunk/test/Driver/amdgpu-features.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/am
> dgpu-features.c?rev=302777=302776=302777=diff
> 
> ==
> --- cfe/trunk/test/Driver/amdgpu-features.c (original)
> +++ cfe/trunk/test/Driver/amdgpu-features.c Thu May 11 03:25:22 2017
> @@ -1,7 +1,7 @@
> -// RUN: %clang -### -target amdgcn -x cl -S -emit-llvm -mcpu=kaveri
> -mamdgpu-debugger-abi=0.0 %s -o - 2>&1 \
> +// RUN: %clang -### -target amdgcn -x cl -S -emit-llvm -mcpu=kaveri
> -mamdgpu-debugger-abi=0.0 %s -o 2>&1 \
>  // RUN:   | FileCheck --check-prefix=CHECK-MAMDGPU-DEBUGGER-ABI-0-0 %s
>  // CHECK-MAMDGPU-DEBUGGER-ABI-0-0: the clang compiler does not support
> '-mamdgpu-debugger-abi=0.0'
>
> -// RUN: %clang -### -target amdgcn -x cl -S -emit-llvm -mcpu=kaveri
> -mamdgpu-debugger-abi=1.0 %s -o - 2>&1 \
> +// RUN: %clang -### -target amdgcn -x cl -S -emit-llvm -mcpu=kaveri
> -mamdgpu-debugger-abi=1.0 %s -o 2>&1 \
>  // RUN:   | FileCheck --check-prefix=CHECK-MAMDGPU-DEBUGGER-ABI-1-0 %s
>  // CHECK-MAMDGPU-DEBUGGER-ABI-1-0: "-target-feature"
> "+amdgpu-debugger-insert-nops" "-target-feature"
> "+amdgpu-debugger-reserve-regs" "-target-feature"
> "+amdgpu-debugger-emit-prologue"
>
> Modified: cfe/trunk/test/Driver/arm-default-build-attributes.s
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/ar
> m-default-build-attributes.s?rev=302777=302776=302777=diff
> 
> ==
> --- cfe/trunk/test/Driver/arm-default-build-attributes.s (original)
> +++ cfe/trunk/test/Driver/arm-default-build-attributes.s Thu May 11
> 03:25:22 2017
> @@ -10,9 +10,9 @@
>
>  // Option ignored C/C++ (since we always emit hardware and ABI build
> attributes
>  // during codegen).
> -// RUN: %clang -target armv7--none-eabi -### -x c %s
> -mdefault-build-attributes 2>&1 \
> +// RUN: %clang -target armv7--none-eabi -### -x c %s
> 

Re: r302777 - Reverted r302775

2017-05-11 Thread Richard Smith via cfe-commits
When you revert a patch (even one of your own), please say why you reverted
it in the commit message.

On 11 May 2017 1:38 am, "Serge Pavlov via cfe-commits" <
cfe-commits@lists.llvm.org> wrote:

Author: sepavloff
Date: Thu May 11 03:25:22 2017
New Revision: 302777

URL: http://llvm.org/viewvc/llvm-project?rev=302777=rev
Log:
Reverted r302775

Added:
cfe/trunk/test/Driver/arm-darwin-builtin.c
  - copied unchanged from r302774, cfe/trunk/test/Driver/arm-
darwin-builtin.c
Modified:
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/test/Driver/aarch64-cpus.c
cfe/trunk/test/Driver/amdgpu-features.c
cfe/trunk/test/Driver/arm-default-build-attributes.s
cfe/trunk/test/Driver/cl-outputs.c
cfe/trunk/test/Driver/clang_f_opts.c
cfe/trunk/test/Driver/cuda-external-tools.cu
cfe/trunk/test/Driver/debug-options.c
cfe/trunk/test/Driver/gfortran.f90
cfe/trunk/test/Driver/split-debug.h
cfe/trunk/test/Driver/unknown-arg.c
cfe/trunk/test/Index/index-attrs.c
cfe/trunk/test/Index/index-attrs.cpp
cfe/trunk/tools/driver/driver.cpp

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/
Driver.cpp?rev=302777=302776=302777=diff

==
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Thu May 11 03:25:22 2017
@@ -598,8 +598,6 @@ Compilation *Driver::BuildCompilation(Ar
   bool CCCPrintPhases;

   InputArgList Args = ParseArgStrings(ArgList.slice(1));
-  if (Diags.hasErrorOccurred())
-return nullptr;

   // Silence driver warnings if requested
   Diags.setIgnoreAllWarnings(Args.hasArg(options::OPT_w));

Modified: cfe/trunk/test/Driver/aarch64-cpus.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/
aarch64-cpus.c?rev=302777=302776=302777=diff

==
--- cfe/trunk/test/Driver/aarch64-cpus.c (original)
+++ cfe/trunk/test/Driver/aarch64-cpus.c Thu May 11 03:25:22 2017
@@ -11,7 +11,7 @@
 // RUN: %clang -target arm64 -### -c %s 2>&1 | FileCheck
-check-prefix=ARM64-GENERIC %s
 // RUN: %clang -target arm64 -mcpu=generic -### -c %s 2>&1 | FileCheck
-check-prefix=ARM64-GENERIC %s
 // RUN: %clang -target arm64 -mlittle-endian -### -c %s 2>&1 | FileCheck
-check-prefix=ARM64-GENERIC %s
-// RUN: %clang -target arm64 -mlittle-endian -mcpu=generic -### -c %s 2>&1
| FileCheck -check-prefix=ARM64-GENERIC %s
+// RUN: %clang -target arm64 -mlittle-endian -mcpu-generic -### -c %s 2>&1
| FileCheck -check-prefix=ARM64-GENERIC %s

 // ARM64-GENERIC: "-cc1"{{.*}} "-triple" "arm64{{.*}}" "-target-cpu"
"generic"


Modified: cfe/trunk/test/Driver/amdgpu-features.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/
amdgpu-features.c?rev=302777=302776=302777=diff

==
--- cfe/trunk/test/Driver/amdgpu-features.c (original)
+++ cfe/trunk/test/Driver/amdgpu-features.c Thu May 11 03:25:22 2017
@@ -1,7 +1,7 @@
-// RUN: %clang -### -target amdgcn -x cl -S -emit-llvm -mcpu=kaveri
-mamdgpu-debugger-abi=0.0 %s -o - 2>&1 \
+// RUN: %clang -### -target amdgcn -x cl -S -emit-llvm -mcpu=kaveri
-mamdgpu-debugger-abi=0.0 %s -o 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-MAMDGPU-DEBUGGER-ABI-0-0 %s
 // CHECK-MAMDGPU-DEBUGGER-ABI-0-0: the clang compiler does not support
'-mamdgpu-debugger-abi=0.0'

-// RUN: %clang -### -target amdgcn -x cl -S -emit-llvm -mcpu=kaveri
-mamdgpu-debugger-abi=1.0 %s -o - 2>&1 \
+// RUN: %clang -### -target amdgcn -x cl -S -emit-llvm -mcpu=kaveri
-mamdgpu-debugger-abi=1.0 %s -o 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-MAMDGPU-DEBUGGER-ABI-1-0 %s
 // CHECK-MAMDGPU-DEBUGGER-ABI-1-0: "-target-feature"
"+amdgpu-debugger-insert-nops" "-target-feature"
"+amdgpu-debugger-reserve-regs"
"-target-feature" "+amdgpu-debugger-emit-prologue"

Modified: cfe/trunk/test/Driver/arm-default-build-attributes.s
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/
arm-default-build-attributes.s?rev=302777=302776=302777=diff

==
--- cfe/trunk/test/Driver/arm-default-build-attributes.s (original)
+++ cfe/trunk/test/Driver/arm-default-build-attributes.s Thu May 11
03:25:22 2017
@@ -10,9 +10,9 @@

 // Option ignored C/C++ (since we always emit hardware and ABI build
attributes
 // during codegen).
-// RUN: %clang -target armv7--none-eabi -### -x c %s
-mdefault-build-attributes 2>&1 \
+// RUN: %clang -target armv7--none-eabi -### -x c %s
-mdefault-build-attributes -verify 2>&1 \
 // RUN:| FileCheck %s -check-prefix CHECK-DISABLED
-// RUN: %clang -target armv7--none-eabi -### -x c++ %s
-mdefault-build-attributes 2>&1 \
+// RUN: %clang -target armv7--none-eabi -### -x c++ %s
-mdefault-build-attributes -verify 2>&1 \
 // RUN:| FileCheck %s -check-prefix CHECK-DISABLED

 // 

r302777 - Reverted r302775

2017-05-11 Thread Serge Pavlov via cfe-commits
Author: sepavloff
Date: Thu May 11 03:25:22 2017
New Revision: 302777

URL: http://llvm.org/viewvc/llvm-project?rev=302777=rev
Log:
Reverted r302775

Added:
cfe/trunk/test/Driver/arm-darwin-builtin.c
  - copied unchanged from r302774, 
cfe/trunk/test/Driver/arm-darwin-builtin.c
Modified:
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/test/Driver/aarch64-cpus.c
cfe/trunk/test/Driver/amdgpu-features.c
cfe/trunk/test/Driver/arm-default-build-attributes.s
cfe/trunk/test/Driver/cl-outputs.c
cfe/trunk/test/Driver/clang_f_opts.c
cfe/trunk/test/Driver/cuda-external-tools.cu
cfe/trunk/test/Driver/debug-options.c
cfe/trunk/test/Driver/gfortran.f90
cfe/trunk/test/Driver/split-debug.h
cfe/trunk/test/Driver/unknown-arg.c
cfe/trunk/test/Index/index-attrs.c
cfe/trunk/test/Index/index-attrs.cpp
cfe/trunk/tools/driver/driver.cpp

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=302777=302776=302777=diff
==
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Thu May 11 03:25:22 2017
@@ -598,8 +598,6 @@ Compilation *Driver::BuildCompilation(Ar
   bool CCCPrintPhases;
 
   InputArgList Args = ParseArgStrings(ArgList.slice(1));
-  if (Diags.hasErrorOccurred())
-return nullptr;
 
   // Silence driver warnings if requested
   Diags.setIgnoreAllWarnings(Args.hasArg(options::OPT_w));

Modified: cfe/trunk/test/Driver/aarch64-cpus.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/aarch64-cpus.c?rev=302777=302776=302777=diff
==
--- cfe/trunk/test/Driver/aarch64-cpus.c (original)
+++ cfe/trunk/test/Driver/aarch64-cpus.c Thu May 11 03:25:22 2017
@@ -11,7 +11,7 @@
 // RUN: %clang -target arm64 -### -c %s 2>&1 | FileCheck 
-check-prefix=ARM64-GENERIC %s
 // RUN: %clang -target arm64 -mcpu=generic -### -c %s 2>&1 | FileCheck 
-check-prefix=ARM64-GENERIC %s
 // RUN: %clang -target arm64 -mlittle-endian -### -c %s 2>&1 | FileCheck 
-check-prefix=ARM64-GENERIC %s
-// RUN: %clang -target arm64 -mlittle-endian -mcpu=generic -### -c %s 2>&1 | 
FileCheck -check-prefix=ARM64-GENERIC %s
+// RUN: %clang -target arm64 -mlittle-endian -mcpu-generic -### -c %s 2>&1 | 
FileCheck -check-prefix=ARM64-GENERIC %s
 
 // ARM64-GENERIC: "-cc1"{{.*}} "-triple" "arm64{{.*}}" "-target-cpu" "generic"
 

Modified: cfe/trunk/test/Driver/amdgpu-features.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/amdgpu-features.c?rev=302777=302776=302777=diff
==
--- cfe/trunk/test/Driver/amdgpu-features.c (original)
+++ cfe/trunk/test/Driver/amdgpu-features.c Thu May 11 03:25:22 2017
@@ -1,7 +1,7 @@
-// RUN: %clang -### -target amdgcn -x cl -S -emit-llvm -mcpu=kaveri 
-mamdgpu-debugger-abi=0.0 %s -o - 2>&1 \
+// RUN: %clang -### -target amdgcn -x cl -S -emit-llvm -mcpu=kaveri 
-mamdgpu-debugger-abi=0.0 %s -o 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-MAMDGPU-DEBUGGER-ABI-0-0 %s
 // CHECK-MAMDGPU-DEBUGGER-ABI-0-0: the clang compiler does not support 
'-mamdgpu-debugger-abi=0.0'
 
-// RUN: %clang -### -target amdgcn -x cl -S -emit-llvm -mcpu=kaveri 
-mamdgpu-debugger-abi=1.0 %s -o - 2>&1 \
+// RUN: %clang -### -target amdgcn -x cl -S -emit-llvm -mcpu=kaveri 
-mamdgpu-debugger-abi=1.0 %s -o 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-MAMDGPU-DEBUGGER-ABI-1-0 %s
 // CHECK-MAMDGPU-DEBUGGER-ABI-1-0: "-target-feature" 
"+amdgpu-debugger-insert-nops" "-target-feature" 
"+amdgpu-debugger-reserve-regs" "-target-feature" 
"+amdgpu-debugger-emit-prologue"

Modified: cfe/trunk/test/Driver/arm-default-build-attributes.s
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/arm-default-build-attributes.s?rev=302777=302776=302777=diff
==
--- cfe/trunk/test/Driver/arm-default-build-attributes.s (original)
+++ cfe/trunk/test/Driver/arm-default-build-attributes.s Thu May 11 03:25:22 
2017
@@ -10,9 +10,9 @@
 
 // Option ignored C/C++ (since we always emit hardware and ABI build attributes
 // during codegen).
-// RUN: %clang -target armv7--none-eabi -### -x c %s 
-mdefault-build-attributes 2>&1 \
+// RUN: %clang -target armv7--none-eabi -### -x c %s 
-mdefault-build-attributes -verify 2>&1 \
 // RUN:| FileCheck %s -check-prefix CHECK-DISABLED
-// RUN: %clang -target armv7--none-eabi -### -x c++ %s 
-mdefault-build-attributes 2>&1 \
+// RUN: %clang -target armv7--none-eabi -### -x c++ %s 
-mdefault-build-attributes -verify 2>&1 \
 // RUN:| FileCheck %s -check-prefix CHECK-DISABLED
 
 // CHECK-DISABLED-NOT: "-arm-add-build-attributes"

Modified: cfe/trunk/test/Driver/cl-outputs.c
URL: 

Re: r302750 - PR22877: When constructing an array via a constructor with a default argument

2017-05-11 Thread Diana Picus via cfe-commits
Hexagon too:
http://lab.llvm.org:8011/builders/clang-hexagon-elf/builds/7916

On 11 May 2017 at 10:27, Diana Picus  wrote:
> Hi Richard,
>
> I reverted this and its fixup in r302776 since some of the ARM bots
> were still broken:
> http://lab.llvm.org:8011/builders/clang-cmake-armv7-a15/builds/6969
> http://lab.llvm.org:8011/builders/clang-cmake-thumbv7-a15/builds/6959
> http://lab.llvm.org:8011/builders/clang-cmake-armv7-a15-full/builds/6717
> http://lab.llvm.org:8011/builders/clang-cmake-thumbv7-a15-full-sh/builds/1518
>
> Sorry,
> Diana
>
> On 11 May 2017 at 02:17, Richard Smith via cfe-commits
>  wrote:
>> Author: rsmith
>> Date: Wed May 10 19:17:17 2017
>> New Revision: 302750
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=302750=rev
>> Log:
>> PR22877: When constructing an array via a constructor with a default argument
>> in list-initialization, run cleanups for the default argument after each
>> iteration of the initialization loop.
>>
>> We previously only ran the destructor for any temporary once, at the end of 
>> the
>> complete loop, rather than once per iteration!
>>
>> Added:
>> cfe/trunk/test/CodeGenCXX/array-default-argument.cpp
>> Modified:
>> cfe/trunk/lib/CodeGen/CGExprAgg.cpp
>>
>> Modified: cfe/trunk/lib/CodeGen/CGExprAgg.cpp
>> URL: 
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprAgg.cpp?rev=302750=302749=302750=diff
>> ==
>> --- cfe/trunk/lib/CodeGen/CGExprAgg.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CGExprAgg.cpp Wed May 10 19:17:17 2017
>> @@ -512,12 +512,20 @@ void AggExprEmitter::EmitArrayInit(Addre
>>  currentElement->addIncoming(element, entryBB);
>>
>>  // Emit the actual filler expression.
>> -LValue elementLV =
>> -  CGF.MakeAddrLValue(Address(currentElement, elementAlign), 
>> elementType);
>> -if (filler)
>> -  EmitInitializationToLValue(filler, elementLV);
>> -else
>> -  EmitNullInitializationToLValue(elementLV);
>> +{
>> +  // C++1z [class.temporary]p5:
>> +  //   when a default constructor is called to initialize an element of
>> +  //   an array with no corresponding initializer [...] the destruction 
>> of
>> +  //   every temporary created in a default argument is sequenced before
>> +  //   the construction of the next array element, if any
>> +  CodeGenFunction::RunCleanupsScope CleanupsScope(CGF);
>> +  LValue elementLV =
>> +CGF.MakeAddrLValue(Address(currentElement, elementAlign), 
>> elementType);
>> +  if (filler)
>> +EmitInitializationToLValue(filler, elementLV);
>> +  else
>> +EmitNullInitializationToLValue(elementLV);
>> +}
>>
>>  // Move on to the next element.
>>  llvm::Value *nextElement =
>>
>> Added: cfe/trunk/test/CodeGenCXX/array-default-argument.cpp
>> URL: 
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/array-default-argument.cpp?rev=302750=auto
>> ==
>> --- cfe/trunk/test/CodeGenCXX/array-default-argument.cpp (added)
>> +++ cfe/trunk/test/CodeGenCXX/array-default-argument.cpp Wed May 10 19:17:17 
>> 2017
>> @@ -0,0 +1,36 @@
>> +// RUN: %clang_cc1 -emit-llvm -o - %s -triple %itanium_abi_triple | 
>> FileCheck %s
>> +// RUN: %clang_cc1 -emit-llvm -o - %s -triple %itanium_abi_triple 
>> -fexceptions -fcxx-exceptions | FileCheck %s --check-prefix=CHECK 
>> --check-prefix=CHECK-EH
>> +
>> +struct A {
>> +  A();
>> +  ~A();
>> +};
>> +
>> +struct B {
>> +  B(A = A());
>> +  ~B();
>> +};
>> +
>> +void f();
>> +// CHECK-LABEL: define void @_Z1gv()
>> +void g() {
>> +  // CHECK: br label %[[LOOP:.*]]
>> +
>> +  // [[LOOP]]:
>> +  // CHECK: {{call|invoke}} void @_ZN1AC1Ev([[TEMPORARY:.*]])
>> +  // CHECK-EH:  unwind label %[[PARTIAL_ARRAY_LPAD:.*]]
>> +  // CHECK: {{call|invoke}} void @_ZN1BC1E1A({{.*}}, [[TEMPORARY]])
>> +  // CHECK-EH:  unwind label %[[A_AND_PARTIAL_ARRAY_LPAD:.*]]
>> +  // CHECK: {{call|invoke}} void @_ZN1AD1Ev([[TEMPORARY]])
>> +  // CHECK-EH:  unwind label %[[PARTIAL_ARRAY_LPAD]]
>> +  // CHECK: getelementptr {{.*}}, i{{[0-9]*}} 1
>> +  // CHECK: icmp eq
>> +  // CHECK: br i1 {{.*}} label %[[LOOP]]
>> +  B b[5];
>> +
>> +  // CHECK: {{call|invoke}} void @_Z1fv()
>> +  f();
>> +
>> +  // CHECK-NOT: @_ZN1AD1Ev(
>> +  // CHECK: {{call|invoke}} void @_ZN1BD1Ev(
>> +}
>>
>>
>> ___
>> cfe-commits mailing list
>> cfe-commits@lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r302750 - PR22877: When constructing an array via a constructor with a default argument

2017-05-11 Thread Diana Picus via cfe-commits
Hi Richard,

I reverted this and its fixup in r302776 since some of the ARM bots
were still broken:
http://lab.llvm.org:8011/builders/clang-cmake-armv7-a15/builds/6969
http://lab.llvm.org:8011/builders/clang-cmake-thumbv7-a15/builds/6959
http://lab.llvm.org:8011/builders/clang-cmake-armv7-a15-full/builds/6717
http://lab.llvm.org:8011/builders/clang-cmake-thumbv7-a15-full-sh/builds/1518

Sorry,
Diana

On 11 May 2017 at 02:17, Richard Smith via cfe-commits
 wrote:
> Author: rsmith
> Date: Wed May 10 19:17:17 2017
> New Revision: 302750
>
> URL: http://llvm.org/viewvc/llvm-project?rev=302750=rev
> Log:
> PR22877: When constructing an array via a constructor with a default argument
> in list-initialization, run cleanups for the default argument after each
> iteration of the initialization loop.
>
> We previously only ran the destructor for any temporary once, at the end of 
> the
> complete loop, rather than once per iteration!
>
> Added:
> cfe/trunk/test/CodeGenCXX/array-default-argument.cpp
> Modified:
> cfe/trunk/lib/CodeGen/CGExprAgg.cpp
>
> Modified: cfe/trunk/lib/CodeGen/CGExprAgg.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprAgg.cpp?rev=302750=302749=302750=diff
> ==
> --- cfe/trunk/lib/CodeGen/CGExprAgg.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGExprAgg.cpp Wed May 10 19:17:17 2017
> @@ -512,12 +512,20 @@ void AggExprEmitter::EmitArrayInit(Addre
>  currentElement->addIncoming(element, entryBB);
>
>  // Emit the actual filler expression.
> -LValue elementLV =
> -  CGF.MakeAddrLValue(Address(currentElement, elementAlign), elementType);
> -if (filler)
> -  EmitInitializationToLValue(filler, elementLV);
> -else
> -  EmitNullInitializationToLValue(elementLV);
> +{
> +  // C++1z [class.temporary]p5:
> +  //   when a default constructor is called to initialize an element of
> +  //   an array with no corresponding initializer [...] the destruction 
> of
> +  //   every temporary created in a default argument is sequenced before
> +  //   the construction of the next array element, if any
> +  CodeGenFunction::RunCleanupsScope CleanupsScope(CGF);
> +  LValue elementLV =
> +CGF.MakeAddrLValue(Address(currentElement, elementAlign), 
> elementType);
> +  if (filler)
> +EmitInitializationToLValue(filler, elementLV);
> +  else
> +EmitNullInitializationToLValue(elementLV);
> +}
>
>  // Move on to the next element.
>  llvm::Value *nextElement =
>
> Added: cfe/trunk/test/CodeGenCXX/array-default-argument.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/array-default-argument.cpp?rev=302750=auto
> ==
> --- cfe/trunk/test/CodeGenCXX/array-default-argument.cpp (added)
> +++ cfe/trunk/test/CodeGenCXX/array-default-argument.cpp Wed May 10 19:17:17 
> 2017
> @@ -0,0 +1,36 @@
> +// RUN: %clang_cc1 -emit-llvm -o - %s -triple %itanium_abi_triple | 
> FileCheck %s
> +// RUN: %clang_cc1 -emit-llvm -o - %s -triple %itanium_abi_triple 
> -fexceptions -fcxx-exceptions | FileCheck %s --check-prefix=CHECK 
> --check-prefix=CHECK-EH
> +
> +struct A {
> +  A();
> +  ~A();
> +};
> +
> +struct B {
> +  B(A = A());
> +  ~B();
> +};
> +
> +void f();
> +// CHECK-LABEL: define void @_Z1gv()
> +void g() {
> +  // CHECK: br label %[[LOOP:.*]]
> +
> +  // [[LOOP]]:
> +  // CHECK: {{call|invoke}} void @_ZN1AC1Ev([[TEMPORARY:.*]])
> +  // CHECK-EH:  unwind label %[[PARTIAL_ARRAY_LPAD:.*]]
> +  // CHECK: {{call|invoke}} void @_ZN1BC1E1A({{.*}}, [[TEMPORARY]])
> +  // CHECK-EH:  unwind label %[[A_AND_PARTIAL_ARRAY_LPAD:.*]]
> +  // CHECK: {{call|invoke}} void @_ZN1AD1Ev([[TEMPORARY]])
> +  // CHECK-EH:  unwind label %[[PARTIAL_ARRAY_LPAD]]
> +  // CHECK: getelementptr {{.*}}, i{{[0-9]*}} 1
> +  // CHECK: icmp eq
> +  // CHECK: br i1 {{.*}} label %[[LOOP]]
> +  B b[5];
> +
> +  // CHECK: {{call|invoke}} void @_Z1fv()
> +  f();
> +
> +  // CHECK-NOT: @_ZN1AD1Ev(
> +  // CHECK: {{call|invoke}} void @_ZN1BD1Ev(
> +}
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r302776 - Revert "PR22877: When constructing an array via a constructor with a default argument in list-initialization, run cleanups for the default argument after each iteration of the initialization

2017-05-11 Thread Diana Picus via cfe-commits
Author: rovka
Date: Thu May 11 03:10:41 2017
New Revision: 302776

URL: http://llvm.org/viewvc/llvm-project?rev=302776=rev
Log:
Revert "PR22877: When constructing an array via a constructor with a default 
argument in list-initialization, run cleanups for the default argument after 
each iteration of the initialization loop."

Revert "clang/test/CodeGenCXX/array-default-argument.cpp: Satisfy targets that 
have x86_thiscallcc."

This reverts commit r302750 and its fixup r302757 because the test is
still breaking on some of the ARM bots.

array-default-argument.cpp:20:12: error: expected string not found in input
 // CHECK: {{call|invoke}}[[THISCALL:( x86_thiscallcc)?]] void 
@_ZN1AC1Ev([[TEMPORARY:.*]])
   ^
:18:1: note: scanning from here
arrayctor.loop: ; preds = %arrayctor.loop, %entry
^
:28:2: note: possible intended match here
 call void @_Z1fv()
 ^

--

Removed:
cfe/trunk/test/CodeGenCXX/array-default-argument.cpp
Modified:
cfe/trunk/lib/CodeGen/CGExprAgg.cpp

Modified: cfe/trunk/lib/CodeGen/CGExprAgg.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprAgg.cpp?rev=302776=302775=302776=diff
==
--- cfe/trunk/lib/CodeGen/CGExprAgg.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprAgg.cpp Thu May 11 03:10:41 2017
@@ -512,20 +512,12 @@ void AggExprEmitter::EmitArrayInit(Addre
 currentElement->addIncoming(element, entryBB);
 
 // Emit the actual filler expression.
-{
-  // C++1z [class.temporary]p5:
-  //   when a default constructor is called to initialize an element of
-  //   an array with no corresponding initializer [...] the destruction of
-  //   every temporary created in a default argument is sequenced before
-  //   the construction of the next array element, if any
-  CodeGenFunction::RunCleanupsScope CleanupsScope(CGF);
-  LValue elementLV =
-CGF.MakeAddrLValue(Address(currentElement, elementAlign), elementType);
-  if (filler)
-EmitInitializationToLValue(filler, elementLV);
-  else
-EmitNullInitializationToLValue(elementLV);
-}
+LValue elementLV =
+  CGF.MakeAddrLValue(Address(currentElement, elementAlign), elementType);
+if (filler)
+  EmitInitializationToLValue(filler, elementLV);
+else
+  EmitNullInitializationToLValue(elementLV);
 
 // Move on to the next element.
 llvm::Value *nextElement =

Removed: cfe/trunk/test/CodeGenCXX/array-default-argument.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/array-default-argument.cpp?rev=302775=auto
==
--- cfe/trunk/test/CodeGenCXX/array-default-argument.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/array-default-argument.cpp (removed)
@@ -1,36 +0,0 @@
-// RUN: %clang_cc1 -emit-llvm -o - %s -triple %itanium_abi_triple | FileCheck 
%s
-// RUN: %clang_cc1 -emit-llvm -o - %s -triple %itanium_abi_triple -fexceptions 
-fcxx-exceptions | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-EH
-
-struct A {
-  A();
-  ~A();
-};
-
-struct B {
-  B(A = A());
-  ~B();
-};
-
-void f();
-// CHECK-LABEL: define void @_Z1gv()
-void g() {
-  // CHECK: br label %[[LOOP:.*]]
-
-  // [[LOOP]]:
-  // CHECK: {{call|invoke}}[[THISCALL:( x86_thiscallcc)?]] void 
@_ZN1AC1Ev([[TEMPORARY:.*]])
-  // CHECK-EH:  unwind label %[[PARTIAL_ARRAY_LPAD:.*]]
-  // CHECK: {{call|invoke}}[[THISCALL]] void @_ZN1BC1E1A({{.*}}, [[TEMPORARY]])
-  // CHECK-EH:  unwind label %[[A_AND_PARTIAL_ARRAY_LPAD:.*]]
-  // CHECK: {{call|invoke}}[[THISCALL]] void @_ZN1AD1Ev([[TEMPORARY]])
-  // CHECK-EH:  unwind label %[[PARTIAL_ARRAY_LPAD]]
-  // CHECK: getelementptr {{.*}}, i{{[0-9]*}} 1
-  // CHECK: icmp eq
-  // CHECK: br i1 {{.*}} label %[[LOOP]]
-  B b[5];
-
-  // CHECK: {{call|invoke}} void @_Z1fv()
-  f();
-
-  // CHECK-NOT: @_ZN1AD1Ev(
-  // CHECK: {{call|invoke}}[[THISCALL]] void @_ZN1BD1Ev(
-}


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


[PATCH] D32825: [clang-format] Improve understanding of combined typedef+record declarations

2017-05-11 Thread Jacob Bandes-Storch via Phabricator via cfe-commits
jtbandes updated this revision to Diff 98593.
jtbandes added a comment.

Update from review


https://reviews.llvm.org/D32825

Files:
  lib/Format/UnwrappedLineFormatter.cpp
  unittests/Format/FormatTest.cpp


Index: unittests/Format/FormatTest.cpp
===
--- unittests/Format/FormatTest.cpp
+++ unittests/Format/FormatTest.cpp
@@ -443,6 +443,14 @@
"}",
AllowSimpleBracedStatements);
 
+  verifyFormat("struct A2 {\n"
+   "  int X;\n"
+   "};",
+   AllowSimpleBracedStatements);
+  verifyFormat("typedef struct A2 {\n"
+   "  int X;\n"
+   "} A2_t;",
+   AllowSimpleBracedStatements);
   verifyFormat("template  struct A2 {\n"
"  struct B {};\n"
"};",
Index: lib/Format/UnwrappedLineFormatter.cpp
===
--- lib/Format/UnwrappedLineFormatter.cpp
+++ lib/Format/UnwrappedLineFormatter.cpp
@@ -365,9 +365,14 @@
 } else if (Limit != 0 && !Line.startsWith(tok::kw_namespace) &&
!startsExternCBlock(Line)) {
   // We don't merge short records.
-  if (Line.First->isOneOf(tok::kw_class, tok::kw_union, tok::kw_struct,
-  Keywords.kw_interface))
-return 0;
+  {
+FormatToken *Tok =
+Line.First->is(tok::kw_typedef) ? Line.First->Next : Line.First;
+if (Tok &&
+Tok->isOneOf(tok::kw_class, tok::kw_union, tok::kw_struct,
+ Keywords.kw_interface))
+  return 0;
+  }
 
   // Check that we still have three lines and they fit into the limit.
   if (I + 2 == E || I[2]->Type == LT_Invalid)


Index: unittests/Format/FormatTest.cpp
===
--- unittests/Format/FormatTest.cpp
+++ unittests/Format/FormatTest.cpp
@@ -443,6 +443,14 @@
"}",
AllowSimpleBracedStatements);
 
+  verifyFormat("struct A2 {\n"
+   "  int X;\n"
+   "};",
+   AllowSimpleBracedStatements);
+  verifyFormat("typedef struct A2 {\n"
+   "  int X;\n"
+   "} A2_t;",
+   AllowSimpleBracedStatements);
   verifyFormat("template  struct A2 {\n"
"  struct B {};\n"
"};",
Index: lib/Format/UnwrappedLineFormatter.cpp
===
--- lib/Format/UnwrappedLineFormatter.cpp
+++ lib/Format/UnwrappedLineFormatter.cpp
@@ -365,9 +365,14 @@
 } else if (Limit != 0 && !Line.startsWith(tok::kw_namespace) &&
!startsExternCBlock(Line)) {
   // We don't merge short records.
-  if (Line.First->isOneOf(tok::kw_class, tok::kw_union, tok::kw_struct,
-  Keywords.kw_interface))
-return 0;
+  {
+FormatToken *Tok =
+Line.First->is(tok::kw_typedef) ? Line.First->Next : Line.First;
+if (Tok &&
+Tok->isOneOf(tok::kw_class, tok::kw_union, tok::kw_struct,
+ Keywords.kw_interface))
+  return 0;
+  }
 
   // Check that we still have three lines and they fit into the limit.
   if (I + 2 == E || I[2]->Type == LT_Invalid)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D32825: [clang-format] Improve understanding of combined typedef+record declarations

2017-05-11 Thread Jacob Bandes-Storch via Phabricator via cfe-commits
jtbandes marked an inline comment as done.
jtbandes added inline comments.



Comment at: lib/Format/UnwrappedLineFormatter.cpp:368
   // We don't merge short records.
-  if (Line.First->isOneOf(tok::kw_class, tok::kw_union, tok::kw_struct,
-  Keywords.kw_interface))
+  FormatToken *T =
+  Line.First->is(tok::kw_typedef) ? Line.First->Next : Line.First;

djasper wrote:
> Don't use "T", that's too much engrained as template parameter. Use "Tok".
Added nested scope to avoid shadowing `Tok` from above.


https://reviews.llvm.org/D32825



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


r302775 - Driver must return non-zero code on errors in command line

2017-05-11 Thread Serge Pavlov via cfe-commits
Author: sepavloff
Date: Thu May 11 03:00:33 2017
New Revision: 302775

URL: http://llvm.org/viewvc/llvm-project?rev=302775=rev
Log:
Driver must return non-zero code on errors in command line

Now if clang driver is given wrong arguments, in some cases it
continues execution and returns zero code. This change fixes this
behavior.

The fix revealed some errors in clang test set.

File test/Driver/gfortran.f90 added in r118203 checks forwarding
gfortran flags to GCC. Now driver reports error on this file, because
the option -working-directory implemented in clang differs from the
option with the same name implemented in gfortran, in clang the option
requires argument, in gfortran does not.

In the file test/Driver/arm-darwin-builtin.c clang is called with
options -fbuiltin-strcat and -fbuiltin-strcpy. These option were removed
in r191435 and now clang reports error on this test.

File arm-default-build-attributes.s uses option -verify, which is not
supported by driver, it is cc1 option.

Similarly, the file split-debug.h uses options -fmodules-embed-all-files
and -fmodule-format=obj, which are not supported by driver.

Other revealed errors are mainly mistypes.

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

Removed:
cfe/trunk/test/Driver/arm-darwin-builtin.c
Modified:
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/test/Driver/aarch64-cpus.c
cfe/trunk/test/Driver/amdgpu-features.c
cfe/trunk/test/Driver/arm-default-build-attributes.s
cfe/trunk/test/Driver/cl-outputs.c
cfe/trunk/test/Driver/clang_f_opts.c
cfe/trunk/test/Driver/cuda-external-tools.cu
cfe/trunk/test/Driver/debug-options.c
cfe/trunk/test/Driver/gfortran.f90
cfe/trunk/test/Driver/split-debug.h
cfe/trunk/test/Driver/unknown-arg.c
cfe/trunk/test/Index/index-attrs.c
cfe/trunk/test/Index/index-attrs.cpp
cfe/trunk/tools/driver/driver.cpp

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=302775=302774=302775=diff
==
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Thu May 11 03:00:33 2017
@@ -598,6 +598,8 @@ Compilation *Driver::BuildCompilation(Ar
   bool CCCPrintPhases;
 
   InputArgList Args = ParseArgStrings(ArgList.slice(1));
+  if (Diags.hasErrorOccurred())
+return nullptr;
 
   // Silence driver warnings if requested
   Diags.setIgnoreAllWarnings(Args.hasArg(options::OPT_w));

Modified: cfe/trunk/test/Driver/aarch64-cpus.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/aarch64-cpus.c?rev=302775=302774=302775=diff
==
--- cfe/trunk/test/Driver/aarch64-cpus.c (original)
+++ cfe/trunk/test/Driver/aarch64-cpus.c Thu May 11 03:00:33 2017
@@ -11,7 +11,7 @@
 // RUN: %clang -target arm64 -### -c %s 2>&1 | FileCheck 
-check-prefix=ARM64-GENERIC %s
 // RUN: %clang -target arm64 -mcpu=generic -### -c %s 2>&1 | FileCheck 
-check-prefix=ARM64-GENERIC %s
 // RUN: %clang -target arm64 -mlittle-endian -### -c %s 2>&1 | FileCheck 
-check-prefix=ARM64-GENERIC %s
-// RUN: %clang -target arm64 -mlittle-endian -mcpu-generic -### -c %s 2>&1 | 
FileCheck -check-prefix=ARM64-GENERIC %s
+// RUN: %clang -target arm64 -mlittle-endian -mcpu=generic -### -c %s 2>&1 | 
FileCheck -check-prefix=ARM64-GENERIC %s
 
 // ARM64-GENERIC: "-cc1"{{.*}} "-triple" "arm64{{.*}}" "-target-cpu" "generic"
 

Modified: cfe/trunk/test/Driver/amdgpu-features.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/amdgpu-features.c?rev=302775=302774=302775=diff
==
--- cfe/trunk/test/Driver/amdgpu-features.c (original)
+++ cfe/trunk/test/Driver/amdgpu-features.c Thu May 11 03:00:33 2017
@@ -1,7 +1,7 @@
-// RUN: %clang -### -target amdgcn -x cl -S -emit-llvm -mcpu=kaveri 
-mamdgpu-debugger-abi=0.0 %s -o 2>&1 \
+// RUN: %clang -### -target amdgcn -x cl -S -emit-llvm -mcpu=kaveri 
-mamdgpu-debugger-abi=0.0 %s -o - 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-MAMDGPU-DEBUGGER-ABI-0-0 %s
 // CHECK-MAMDGPU-DEBUGGER-ABI-0-0: the clang compiler does not support 
'-mamdgpu-debugger-abi=0.0'
 
-// RUN: %clang -### -target amdgcn -x cl -S -emit-llvm -mcpu=kaveri 
-mamdgpu-debugger-abi=1.0 %s -o 2>&1 \
+// RUN: %clang -### -target amdgcn -x cl -S -emit-llvm -mcpu=kaveri 
-mamdgpu-debugger-abi=1.0 %s -o - 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-MAMDGPU-DEBUGGER-ABI-1-0 %s
 // CHECK-MAMDGPU-DEBUGGER-ABI-1-0: "-target-feature" 
"+amdgpu-debugger-insert-nops" "-target-feature" 
"+amdgpu-debugger-reserve-regs" "-target-feature" 
"+amdgpu-debugger-emit-prologue"

Removed: cfe/trunk/test/Driver/arm-darwin-builtin.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/arm-darwin-builtin.c?rev=302774=auto

[PATCH] D33013: Driver must return non-zero code on errors in command line

2017-05-11 Thread Serge Pavlov via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL302775: Driver must return non-zero code on errors in 
command line (authored by sepavloff).

Changed prior to commit:
  https://reviews.llvm.org/D33013?vs=98395=98592#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D33013

Files:
  cfe/trunk/lib/Driver/Driver.cpp
  cfe/trunk/test/Driver/aarch64-cpus.c
  cfe/trunk/test/Driver/amdgpu-features.c
  cfe/trunk/test/Driver/arm-darwin-builtin.c
  cfe/trunk/test/Driver/arm-default-build-attributes.s
  cfe/trunk/test/Driver/cl-outputs.c
  cfe/trunk/test/Driver/clang_f_opts.c
  cfe/trunk/test/Driver/cuda-external-tools.cu
  cfe/trunk/test/Driver/debug-options.c
  cfe/trunk/test/Driver/gfortran.f90
  cfe/trunk/test/Driver/split-debug.h
  cfe/trunk/test/Driver/unknown-arg.c
  cfe/trunk/test/Index/index-attrs.c
  cfe/trunk/test/Index/index-attrs.cpp
  cfe/trunk/tools/driver/driver.cpp

Index: cfe/trunk/test/Driver/clang_f_opts.c
===
--- cfe/trunk/test/Driver/clang_f_opts.c
+++ cfe/trunk/test/Driver/clang_f_opts.c
@@ -186,7 +186,7 @@
 // CHECK-NO-SLP-VECTORIZE-AGG-NOT: "-vectorize-slp-aggressive"
 
 // RUN: %clang -### -S -fextended-identifiers %s 2>&1 | FileCheck -check-prefix=CHECK-EXTENDED-IDENTIFIERS %s
-// RUN: %clang -### -S -fno-extended-identifiers %s 2>&1 | FileCheck -check-prefix=CHECK-NO-EXTENDED-IDENTIFIERS %s
+// RUN: not %clang -### -S -fno-extended-identifiers %s 2>&1 | FileCheck -check-prefix=CHECK-NO-EXTENDED-IDENTIFIERS %s
 // CHECK-EXTENDED-IDENTIFIERS: "-cc1"
 // CHECK-EXTENDED-IDENTIFIERS-NOT: "-fextended-identifiers"
 // CHECK-NO-EXTENDED-IDENTIFIERS: error: unsupported option '-fno-extended-identifiers'
Index: cfe/trunk/test/Driver/debug-options.c
===
--- cfe/trunk/test/Driver/debug-options.c
+++ cfe/trunk/test/Driver/debug-options.c
@@ -80,7 +80,7 @@
 // RUN: %clang -### -c -gdwarf-2 %s 2>&1 \
 // RUN: | FileCheck -check-prefix=G_ONLY_DWARF2 %s
 //
-// RUN: %clang -### -c -gfoo %s 2>&1 | FileCheck -check-prefix=G_NO %s
+// RUN: not %clang -### -c -gfoo %s 2>&1 | FileCheck -check-prefix=G_ERR %s
 // RUN: %clang -### -c -g -g0 %s 2>&1 | FileCheck -check-prefix=G_NO %s
 // RUN: %clang -### -c -ggdb0 %s 2>&1 | FileCheck -check-prefix=G_NO %s
 // RUN: %clang -### -c -glldb -g0 %s 2>&1 | FileCheck -check-prefix=G_NO %s
@@ -171,6 +171,8 @@
 // G_PS4: "-dwarf-version=
 // G_PS4: "-generate-arange-section"
 //
+// G_ERR: error: unknown argument:
+//
 // G_NO: "-cc1"
 // G_NO-NOT: -debug-info-kind=
 //
Index: cfe/trunk/test/Driver/arm-default-build-attributes.s
===
--- cfe/trunk/test/Driver/arm-default-build-attributes.s
+++ cfe/trunk/test/Driver/arm-default-build-attributes.s
@@ -10,9 +10,9 @@
 
 // Option ignored C/C++ (since we always emit hardware and ABI build attributes
 // during codegen).
-// RUN: %clang -target armv7--none-eabi -### -x c %s -mdefault-build-attributes -verify 2>&1 \
+// RUN: %clang -target armv7--none-eabi -### -x c %s -mdefault-build-attributes 2>&1 \
 // RUN:| FileCheck %s -check-prefix CHECK-DISABLED
-// RUN: %clang -target armv7--none-eabi -### -x c++ %s -mdefault-build-attributes -verify 2>&1 \
+// RUN: %clang -target armv7--none-eabi -### -x c++ %s -mdefault-build-attributes 2>&1 \
 // RUN:| FileCheck %s -check-prefix CHECK-DISABLED
 
 // CHECK-DISABLED-NOT: "-arm-add-build-attributes"
Index: cfe/trunk/test/Driver/split-debug.h
===
--- cfe/trunk/test/Driver/split-debug.h
+++ cfe/trunk/test/Driver/split-debug.h
@@ -3,13 +3,4 @@
 // RUN: %clang -target x86_64-unknown-linux-gnu -gsplit-dwarf -c -fmodules -### %s 2> %t
 // RUN: FileCheck -check-prefix=CHECK-NO-ACTIONS < %t %s
 //
-// RUN: %clang -target x86_64-unknown-linux-gnu -gsplit-dwarf -c -fmodules -emit-module -fmodules-embed-all-files -fno-implicit-modules -fno-implicit-module-maps -### %s 2> %t
-// RUN: FileCheck -check-prefix=CHECK-NO-ACTIONS < %t %s
-//
-// FIXME: This should fail using clang, except that the type of the output for
-// an object output with modules is given as clang::driver::types::TY_PCH
-// rather than TY_Object.
-// RUN: %clang -target x86_64-unknown-linux-gnu -gsplit-dwarf -c -fmodules -fmodule-format=obj -### %s 2> %t
-// RUN: FileCheck -check-prefix=CHECK-NO-ACTIONS < %t %s
-//
 // CHECK-NO-ACTIONS-NOT: objcopy
Index: cfe/trunk/test/Driver/cl-outputs.c
===
--- cfe/trunk/test/Driver/cl-outputs.c
+++ cfe/trunk/test/Driver/cl-outputs.c
@@ -73,7 +73,7 @@
 // RUN: %clang_cl /c /o .. -### -- %s 2>&1 | FileCheck -check-prefix=oCRAZY2 %s
 // oCRAZY2:  "-o" "..obj"
 
-// RUN: %clang_cl /c %s -### /o 2>&1 | FileCheck -check-prefix=oMISSINGARG %s
+// RUN: not %clang_cl /c %s -### /o 2>&1 | FileCheck -check-prefix=oMISSINGARG 

[PATCH] D33061: [tooling] RefactoringCallbacks code cleanup

2017-05-11 Thread Eric Liu via Phabricator via cfe-commits
ioeric accepted this revision.
ioeric added a comment.
This revision is now accepted and ready to land.

lgtm


Repository:
  rL LLVM

https://reviews.llvm.org/D33061



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


[libcxx] r302773 - Fix `std::visit` for the zero variants case.

2017-05-11 Thread Michael Park via cfe-commits
Author: mpark
Date: Thu May 11 02:17:12 2017
New Revision: 302773

URL: http://llvm.org/viewvc/llvm-project?rev=302773=rev
Log:
Fix `std::visit` for the zero variants case.

Summary:
The following code is broken:

```
std::visit([]{});
```

Reviewers: EricWF

Reviewed By: EricWF

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

Modified:
libcxx/trunk/include/variant
libcxx/trunk/test/std/utilities/variant/variant.visit/visit.pass.cpp

Modified: libcxx/trunk/include/variant
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/variant?rev=302773=302772=302773=diff
==
--- libcxx/trunk/include/variant (original)
+++ libcxx/trunk/include/variant Thu May 11 02:17:12 2017
@@ -425,30 +425,21 @@ struct __base {
 constexpr auto __fmatrix =
 __make_fmatrix<_Visitor&&,
decltype(_VSTD::forward<_Vs>(__vs).__as_base())...>();
-const size_t __indices[] = {__vs.index()...};
-return __at(__fmatrix, __indices)(_VSTD::forward<_Visitor>(__visitor),
-  
_VSTD::forward<_Vs>(__vs).__as_base()...);
+return __at(__fmatrix, __vs.index()...)(
+_VSTD::forward<_Visitor>(__visitor),
+_VSTD::forward<_Vs>(__vs).__as_base()...);
   }
 
 private:
   template 
   inline _LIBCPP_INLINE_VISIBILITY
-  static constexpr const _Tp& __at_impl(const _Tp& __elem, const size_t*) {
-return __elem;
-  }
-
-  template 
-  inline _LIBCPP_INLINE_VISIBILITY
-  static constexpr auto&& __at_impl(const array<_Tp, _Np>& __elems,
-const size_t* __index) {
-return __at_impl(__elems[*__index], __index + 1);
-  }
+  static constexpr const _Tp& __at(const _Tp& __elem) { return __elem; }
 
-  template 
+  template 
   inline _LIBCPP_INLINE_VISIBILITY
   static constexpr auto&& __at(const array<_Tp, _Np>& __elems,
-   const size_t (&__indices)[_Ip]) {
-return __at_impl(__elems, begin(__indices));
+   size_t __index, _Indices... __indices) {
+return __at(__elems[__index], __indices...);
   }
 
   template 

Modified: libcxx/trunk/test/std/utilities/variant/variant.visit/visit.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/variant/variant.visit/visit.pass.cpp?rev=302773=302772=302773=diff
==
--- libcxx/trunk/test/std/utilities/variant/variant.visit/visit.pass.cpp 
(original)
+++ libcxx/trunk/test/std/utilities/variant/variant.visit/visit.pass.cpp Thu 
May 11 02:17:12 2017
@@ -94,6 +94,16 @@ void test_call_operator_forwarding() {
   using Fn = ForwardingCallObject;
   Fn obj{};
   const Fn  = obj;
+  { // test call operator forwarding - no variant
+std::visit(obj);
+assert(Fn::check_call<>(CT_NonConst | CT_LValue));
+std::visit(cobj);
+assert(Fn::check_call<>(CT_Const | CT_LValue));
+std::visit(std::move(obj));
+assert(Fn::check_call<>(CT_NonConst | CT_RValue));
+std::visit(std::move(cobj));
+assert(Fn::check_call<>(CT_Const | CT_RValue));
+  }
   { // test call operator forwarding - single variant, single arg
 using V = std::variant;
 V v(42);


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


r302771 - Make tests from r302765 windows friendly

2017-05-11 Thread Bruno Cardoso Lopes via cfe-commits
Author: bruno
Date: Thu May 11 02:06:52 2017
New Revision: 302771

URL: http://llvm.org/viewvc/llvm-project?rev=302771=rev
Log:
Make tests from r302765 windows friendly

and appease:
http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/2030

Modified:
cfe/trunk/test/Modules/redefinition-same-header.m
cfe/trunk/test/Sema/redefinition-same-header.c
cfe/trunk/test/SemaCXX/modules-ts.cppm

Modified: cfe/trunk/test/Modules/redefinition-same-header.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/redefinition-same-header.m?rev=302771=302770=302771=diff
==
--- cfe/trunk/test/Modules/redefinition-same-header.m (original)
+++ cfe/trunk/test/Modules/redefinition-same-header.m Thu May 11 02:06:52 2017
@@ -3,18 +3,18 @@
 // RUN:   -fimplicit-module-maps -fmodules-cache-path=%t.tmp %s -verify
 
 // expected-error@Inputs/SameHeader/C.h:3 {{redefinition of 'c'}}
-// expected-note-re@Inputs/SameHeader/B.h:3 {{'{{.*}}/C.h' included multiple 
times, additional include site in header from module 'X.B'}}
+// expected-note-re@Inputs/SameHeader/B.h:3 {{'{{.*}}C.h' included multiple 
times, additional include site in header from module 'X.B'}}
 // expected-note@Inputs/SameHeader/module.modulemap:6 {{X.B defined here}}
-// expected-note-re@redefinition-same-header.m:20 {{'{{.*}}/C.h' included 
multiple times, additional include site here}}
+// expected-note-re@redefinition-same-header.m:20 {{'{{.*}}C.h' included 
multiple times, additional include site here}}
 
 // expected-error@Inputs/SameHeader/C.h:5 {{redefinition of 'aaa'}}
-// expected-note-re@Inputs/SameHeader/B.h:3 {{'{{.*}}/C.h' included multiple 
times, additional include site in header from module 'X.B'}}
+// expected-note-re@Inputs/SameHeader/B.h:3 {{'{{.*}}C.h' included multiple 
times, additional include site in header from module 'X.B'}}
 // expected-note@Inputs/SameHeader/module.modulemap:6 {{X.B defined here}}
-// expected-note-re@redefinition-same-header.m:20 {{'{{.*}}/C.h' included 
multiple times, additional include site here}}
+// expected-note-re@redefinition-same-header.m:20 {{'{{.*}}C.h' included 
multiple times, additional include site here}}
 
 // expected-error@Inputs/SameHeader/C.h:9 {{redefinition of 'fd_set'}}
-// expected-note-re@Inputs/SameHeader/B.h:3 {{'{{.*}}/C.h' included multiple 
times, additional include site in header from module 'X.B'}}
+// expected-note-re@Inputs/SameHeader/B.h:3 {{'{{.*}}C.h' included multiple 
times, additional include site in header from module 'X.B'}}
 // expected-note@Inputs/SameHeader/module.modulemap:6 {{X.B defined here}}
-// expected-note-re@redefinition-same-header.m:20 {{'{{.*}}/C.h' included 
multiple times, additional include site here}}
+// expected-note-re@redefinition-same-header.m:20 {{'{{.*}}C.h' included 
multiple times, additional include site here}}
 #include "A.h" // maps to a modular
 #include "C.h" // textual include

Modified: cfe/trunk/test/Sema/redefinition-same-header.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/redefinition-same-header.c?rev=302771=302770=302771=diff
==
--- cfe/trunk/test/Sema/redefinition-same-header.c (original)
+++ cfe/trunk/test/Sema/redefinition-same-header.c Thu May 11 02:06:52 2017
@@ -5,8 +5,8 @@
 
 // expected-error@a.h:1 {{redefinition of 'yyy'}}
 // expected-note@a.h:1 {{unguarded header; consider using #ifdef guards or 
#pragma once}}
-// expected-note-re@redefinition-same-header.c:11 {{'{{.*}}/a.h' included 
multiple times, additional include site here}}
-// expected-note-re@redefinition-same-header.c:12 {{'{{.*}}/a.h' included 
multiple times, additional include site here}}
+// expected-note-re@redefinition-same-header.c:11 {{'{{.*}}a.h' included 
multiple times, additional include site here}}
+// expected-note-re@redefinition-same-header.c:12 {{'{{.*}}a.h' included 
multiple times, additional include site here}}
 
 #include "a.h"
 #include "a.h"

Modified: cfe/trunk/test/SemaCXX/modules-ts.cppm
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/modules-ts.cppm?rev=302771=302770=302771=diff
==
--- cfe/trunk/test/SemaCXX/modules-ts.cppm (original)
+++ cfe/trunk/test/SemaCXX/modules-ts.cppm Thu May 11 02:06:52 2017
@@ -18,7 +18,7 @@ int n;
 #if TEST >= 2
 // expected-error@-2 {{redefinition of '}}
 // expected-note@-3 {{unguarded header; consider using #ifdef guards or 
#pragma once}}
-// expected-note...@modules-ts.cppm:1 {{'{{.*}}/modules-ts.cppm' included 
multiple times, additional include site here}}
+// expected-note...@modules-ts.cppm:1 {{'{{.*}}modules-ts.cppm' included 
multiple times, additional include site here}}
 #endif
 
 #if TEST == 0


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

Re: [PATCH v2] [PPC64]: Add support for Swift calling convention

2017-05-11 Thread Andrew Jeffery via cfe-commits
Ping - does anyone have a moment to take a look?

Cheers,

Andrew

On Thu, 2017-04-27 at 13:52 +0930, Andrew Jeffery wrote:
> For the tests I've extracted the int5 and int8 cases to cater for
> different alignments for different platform ABIs. For Linux on POWER the
> 5 and 8 element vectors must be naturally aligned with respect to the
> total "soft" vector size, despite being represented as an aggregate.
> Specifically, the patch caters for the following differences in
> supporting powerpc64le-unknown-linux:
> 
>    $ diff -u test/CodeGen/64bit-swiftcall.c test/CodeGen/ppc64-swiftcall.c
> >    --- test/CodeGen/64bit-swiftcall.c   2017-04-20 17:14:59.797963820 
> > +0930
> >    +++ test/CodeGen/ppc64-swiftcall.c   2017-04-20 17:15:11.621965118 
> > +0930
>    @@ -1,7 +1,6 @@
>    -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -target-cpu core2 
> -emit-llvm -o - %s | FileCheck %s
>    -// RUN: %clang_cc1 -triple arm64-apple-ios9 -target-cpu cyclone 
> -emit-llvm -o - %s | FileCheck %s
>    +// RUN: %clang_cc1 -triple powerpc64le-unknown-linux -emit-llvm -o - %s | 
> FileCheck %s
> 
>    -// REQUIRES: aarch64-registered-target,x86-registered-target
>    +// REQUIRES: powerpc-registered-target
> 
> #define SWIFTCALL __attribute__((swiftcall))
> #define OUT __attribute__((swift_indirect_result))
>    @@ -370,8 +369,8 @@
> 
> TEST(int8)
> // CHECK-LABEL: define {{.*}} @return_int8()
>    -// CHECK:   [[RET:%.*]] = alloca [[REC:<8 x i32>]], align 16
>    +// CHECK:   [[RET:%.*]] = alloca [[REC:<8 x i32>]], align 32
> // CHECK:   [[VAR:%.*]] = alloca [[REC]], align
> // CHECK:   store
> // CHECK:   load
> // CHECK:   store
>    @@ -414,8 +413,8 @@
> 
> TEST(int5)
> // CHECK-LABEL: define {{.*}} @return_int5()
>    -// CHECK:   [[RET:%.*]] = alloca [[REC:<5 x i32>]], align 16
>    +// CHECK:   [[RET:%.*]] = alloca [[REC:<5 x i32>]], align 32
> // CHECK:   [[VAR:%.*]] = alloca [[REC]], align
> // CHECK:   store
> // CHECK:   load
> // CHECK:   store
> 
> Despite some duplication, the advantage of this approach over using
> pattern matching for alignment in 64bit-swiftcall.c is that we ensure
> each platform is using the expected alignment but without duplicating
> the entirety of 64bit-swiftcall.c.
> 
> > Signed-off-by: Andrew Jeffery 
> ---
>  lib/Basic/Targets.cpp |  11 ++
>  lib/CodeGen/TargetInfo.cpp|  14 ++-
>  test/CodeGen/64bit-swiftcall-extvec-agg-align16.c | 117 
> ++
>  test/CodeGen/64bit-swiftcall-extvec-agg-align32.c | 116 +
>  test/CodeGen/64bit-swiftcall.c|  93 +
>  5 files changed, 258 insertions(+), 93 deletions(-)
>  create mode 100644 test/CodeGen/64bit-swiftcall-extvec-agg-align16.c
>  create mode 100644 test/CodeGen/64bit-swiftcall-extvec-agg-align32.c
> 
> diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp
> index aab3160af0f9..e32ad0b2dc39 100644
> --- a/lib/Basic/Targets.cpp
> +++ b/lib/Basic/Targets.cpp
> @@ -1708,6 +1708,17 @@ public:
>  }
>  return false;
>    }
> +
> +  CallingConvCheckResult checkCallingConvention(CallingConv CC) const 
> override {
> +switch (CC) {
> +case CC_C:
> +case CC_Swift:
> +return CCCR_OK;
> +default:
> +break;
> +}
> +return CCCR_Warning;
> +  }
>  };
>  
>  class DarwinPPC32TargetInfo : public DarwinTargetInfo {
> diff --git a/lib/CodeGen/TargetInfo.cpp b/lib/CodeGen/TargetInfo.cpp
> index d2fc3888ef29..6193f6c4ac29 100644
> --- a/lib/CodeGen/TargetInfo.cpp
> +++ b/lib/CodeGen/TargetInfo.cpp
> @@ -4175,7 +4175,7 @@ 
> PPC32TargetCodeGenInfo::initDwarfEHRegSizeTable(CodeGen::CodeGenFunction ,
>  
>  namespace {
>  /// PPC64_SVR4_ABIInfo - The 64-bit PowerPC ELF (SVR4) ABI information.
> -class PPC64_SVR4_ABIInfo : public ABIInfo {
> +class PPC64_SVR4_ABIInfo : public SwiftABIInfo {
>  public:
>    enum ABIKind {
>  ELFv1 = 0,
> @@ -4219,7 +4219,7 @@ private:
>  public:
>    PPC64_SVR4_ABIInfo(CodeGen::CodeGenTypes , ABIKind Kind, bool HasQPX,
>   bool SoftFloatABI)
> -  : ABIInfo(CGT), Kind(Kind), HasQPX(HasQPX),
> +  : SwiftABIInfo(CGT), Kind(Kind), HasQPX(HasQPX),
>  IsSoftFloatABI(SoftFloatABI) {}
>  
>    bool isPromotableTypeForABI(QualType Ty) const;
> @@ -4262,6 +4262,16 @@ public:
>  
>    Address EmitVAArg(CodeGenFunction , Address VAListAddr,
>  QualType Ty) const override;
> +
> +  bool shouldPassIndirectlyForSwift(CharUnits totalSize,
> +ArrayRef scalars,
> +bool asReturnValue) const override {
> +return occupiesMoreThan(CGT, scalars, /*total*/ 4);
> +  }
> +
> +  bool isSwiftErrorInRegister() const override {
> +return true;
> +  }
>  };
>  
>  class PPC64_SVR4_TargetCodeGenInfo : public TargetCodeGenInfo {
> diff --git 

[PATCH] D32788: Fix std::inplace_merge to be stable for all inputs

2017-05-11 Thread Jan Wilken Dörrie via Phabricator via cfe-commits
jdoerrie added a comment.

Ping, please take a look at this.


https://reviews.llvm.org/D32788



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


[PATCH] D28832: Improve redefinition errors pointing to the same header.

2017-05-11 Thread Bruno Cardoso Lopes via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL302765: [Sema] Improve redefinition errors pointing to the 
same header (authored by bruno).

Changed prior to commit:
  https://reviews.llvm.org/D28832?vs=95369=98584#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D28832

Files:
  cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
  cfe/trunk/include/clang/Sema/Sema.h
  cfe/trunk/lib/Sema/SemaDecl.cpp
  cfe/trunk/test/Modules/Inputs/SameHeader/A.h
  cfe/trunk/test/Modules/Inputs/SameHeader/B.h
  cfe/trunk/test/Modules/Inputs/SameHeader/C.h
  cfe/trunk/test/Modules/Inputs/SameHeader/module.modulemap
  cfe/trunk/test/Modules/redefinition-same-header.m
  cfe/trunk/test/Sema/redefinition-same-header.c
  cfe/trunk/test/SemaCXX/modules-ts.cppm

Index: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
===
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
@@ -4609,6 +4609,8 @@
   "cannot add 'abi_tag' attribute in a redeclaration">;
 def err_new_abi_tag_on_redeclaration : Error<
   "'abi_tag' %0 missing in original declaration">;
+def note_use_ifdef_guards : Note<
+  "unguarded header; consider using #ifdef guards or #pragma once">;
 
 def note_deleted_dtor_no_operator_delete : Note<
   "virtual destructor requires an unambiguous, accessible 'operator delete'">;
@@ -,6 +8890,13 @@
   InGroup>;
 def note_equivalent_internal_linkage_decl : Note<
   "declared here%select{ in module '%1'|}0">;
+
+def note_redefinition_modules_same_file : Note<
+	"'%0' included multiple times, additional include site in header from module '%1'">;
+def note_redefinition_modules_same_file_modulemap : Note<
+	"consider adding '%0' as part of '%1' definition">;
+def note_redefinition_include_same_file : Note<
+	"'%0' included multiple times, additional include site here">;
 }
 
 let CategoryName = "Coroutines Issue" in {
Index: cfe/trunk/include/clang/Sema/Sema.h
===
--- cfe/trunk/include/clang/Sema/Sema.h
+++ cfe/trunk/include/clang/Sema/Sema.h
@@ -2353,6 +2353,7 @@
   void MergeVarDeclTypes(VarDecl *New, VarDecl *Old, bool MergeTypeWithOld);
   void MergeVarDeclExceptionSpecs(VarDecl *New, VarDecl *Old);
   bool checkVarDeclRedefinition(VarDecl *OldDefn, VarDecl *NewDefn);
+  void notePreviousDefinition(SourceLocation Old, SourceLocation New);
   bool MergeCXXFunctionDecl(FunctionDecl *New, FunctionDecl *Old, Scope *S);
 
   // AssignmentAction - This is used by all the assignment diagnostic functions
Index: cfe/trunk/test/SemaCXX/modules-ts.cppm
===
--- cfe/trunk/test/SemaCXX/modules-ts.cppm
+++ cfe/trunk/test/SemaCXX/modules-ts.cppm
@@ -17,7 +17,8 @@
 int n;
 #if TEST >= 2
 // expected-error@-2 {{redefinition of '}}
-// expected-note@-3 {{previous}}
+// expected-note@-3 {{unguarded header; consider using #ifdef guards or #pragma once}}
+// expected-note...@modules-ts.cppm:1 {{'{{.*}}/modules-ts.cppm' included multiple times, additional include site here}}
 #endif
 
 #if TEST == 0
Index: cfe/trunk/test/Modules/redefinition-same-header.m
===
--- cfe/trunk/test/Modules/redefinition-same-header.m
+++ cfe/trunk/test/Modules/redefinition-same-header.m
@@ -0,0 +1,20 @@
+// RUN: rm -rf %t.tmp
+// RUN: %clang_cc1 -fsyntax-only -I %S/Inputs/SameHeader -fmodules \
+// RUN:   -fimplicit-module-maps -fmodules-cache-path=%t.tmp %s -verify
+
+// expected-error@Inputs/SameHeader/C.h:3 {{redefinition of 'c'}}
+// expected-note-re@Inputs/SameHeader/B.h:3 {{'{{.*}}/C.h' included multiple times, additional include site in header from module 'X.B'}}
+// expected-note@Inputs/SameHeader/module.modulemap:6 {{X.B defined here}}
+// expected-note-re@redefinition-same-header.m:20 {{'{{.*}}/C.h' included multiple times, additional include site here}}
+
+// expected-error@Inputs/SameHeader/C.h:5 {{redefinition of 'aaa'}}
+// expected-note-re@Inputs/SameHeader/B.h:3 {{'{{.*}}/C.h' included multiple times, additional include site in header from module 'X.B'}}
+// expected-note@Inputs/SameHeader/module.modulemap:6 {{X.B defined here}}
+// expected-note-re@redefinition-same-header.m:20 {{'{{.*}}/C.h' included multiple times, additional include site here}}
+
+// expected-error@Inputs/SameHeader/C.h:9 {{redefinition of 'fd_set'}}
+// expected-note-re@Inputs/SameHeader/B.h:3 {{'{{.*}}/C.h' included multiple times, additional include site in header from module 'X.B'}}
+// expected-note@Inputs/SameHeader/module.modulemap:6 {{X.B defined here}}
+// expected-note-re@redefinition-same-header.m:20 {{'{{.*}}/C.h' included multiple times, additional include site here}}
+#include "A.h" // maps to a modular
+#include "C.h" // textual include
Index: 

r302765 - [Sema] Improve redefinition errors pointing to the same header

2017-05-11 Thread Bruno Cardoso Lopes via cfe-commits
Author: bruno
Date: Thu May 11 01:20:07 2017
New Revision: 302765

URL: http://llvm.org/viewvc/llvm-project?rev=302765=rev
Log:
[Sema] Improve redefinition errors pointing to the same header

Diagnostics related to redefinition errors that point to the same header
file do not provide much information that helps users fixing the issue.

- In the modules context, it usually happens because of non modular
includes.
- When modules aren't involved it might happen because of the lack of
header guards.

Enhance diagnostics in these scenarios.

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

rdar://problem/31669175

Added:
cfe/trunk/test/Modules/Inputs/SameHeader/
cfe/trunk/test/Modules/Inputs/SameHeader/A.h
cfe/trunk/test/Modules/Inputs/SameHeader/B.h
cfe/trunk/test/Modules/Inputs/SameHeader/C.h
cfe/trunk/test/Modules/Inputs/SameHeader/module.modulemap
cfe/trunk/test/Modules/redefinition-same-header.m
cfe/trunk/test/Sema/redefinition-same-header.c
Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/SemaCXX/modules-ts.cppm

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=302765=302764=302765=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Thu May 11 01:20:07 
2017
@@ -4609,6 +4609,8 @@ def err_abi_tag_on_redeclaration : Error
   "cannot add 'abi_tag' attribute in a redeclaration">;
 def err_new_abi_tag_on_redeclaration : Error<
   "'abi_tag' %0 missing in original declaration">;
+def note_use_ifdef_guards : Note<
+  "unguarded header; consider using #ifdef guards or #pragma once">;
 
 def note_deleted_dtor_no_operator_delete : Note<
   "virtual destructor requires an unambiguous, accessible 'operator delete'">;
@@ -,6 +8890,13 @@ def ext_equivalent_internal_linkage_decl
   InGroup>;
 def note_equivalent_internal_linkage_decl : Note<
   "declared here%select{ in module '%1'|}0">;
+
+def note_redefinition_modules_same_file : Note<
+   "'%0' included multiple times, additional include site in header from 
module '%1'">;
+def note_redefinition_modules_same_file_modulemap : Note<
+   "consider adding '%0' as part of '%1' definition">;
+def note_redefinition_include_same_file : Note<
+   "'%0' included multiple times, additional include site here">;
 }
 
 let CategoryName = "Coroutines Issue" in {

Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=302765=302764=302765=diff
==
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Thu May 11 01:20:07 2017
@@ -2353,6 +2353,7 @@ public:
   void MergeVarDeclTypes(VarDecl *New, VarDecl *Old, bool MergeTypeWithOld);
   void MergeVarDeclExceptionSpecs(VarDecl *New, VarDecl *Old);
   bool checkVarDeclRedefinition(VarDecl *OldDefn, VarDecl *NewDefn);
+  void notePreviousDefinition(SourceLocation Old, SourceLocation New);
   bool MergeCXXFunctionDecl(FunctionDecl *New, FunctionDecl *Old, Scope *S);
 
   // AssignmentAction - This is used by all the assignment diagnostic functions

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=302765=302764=302765=diff
==
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Thu May 11 01:20:07 2017
@@ -2021,7 +2021,7 @@ bool Sema::isIncompatibleTypedef(TypeDec
 Diag(New->getLocation(), diag::err_redefinition_variably_modified_typedef)
   << Kind << NewType;
 if (Old->getLocation().isValid())
-  Diag(Old->getLocation(), diag::note_previous_definition);
+  notePreviousDefinition(Old->getLocation(), New->getLocation());
 New->setInvalidDecl();
 return true;
   }
@@ -2034,7 +2034,7 @@ bool Sema::isIncompatibleTypedef(TypeDec
 Diag(New->getLocation(), diag::err_redefinition_different_typedef)
   << Kind << NewType << OldType;
 if (Old->getLocation().isValid())
-  Diag(Old->getLocation(), diag::note_previous_definition);
+  notePreviousDefinition(Old->getLocation(), New->getLocation());
 New->setInvalidDecl();
 return true;
   }
@@ -2101,7 +2101,7 @@ void Sema::MergeTypedefNameDecl(Scope *S
 
 NamedDecl *OldD = OldDecls.getRepresentativeDecl();
 if (OldD->getLocation().isValid())
-  Diag(OldD->getLocation(), diag::note_previous_definition);
+  notePreviousDefinition(OldD->getLocation(), New->getLocation());
 
 return New->setInvalidDecl();

[libcxxabi] r302764 - Revert "[libcxxabi] Align unwindHeader on a double-word boundary."

2017-05-11 Thread Akira Hatanaka via cfe-commits
Author: ahatanak
Date: Thu May 11 01:17:49 2017
New Revision: 302764

URL: http://llvm.org/viewvc/llvm-project?rev=302764=rev
Log:
Revert "[libcxxabi] Align unwindHeader on a double-word boundary."

This reverts commit r302763.

The commit caused bot failures.

Removed:
libcxxabi/trunk/test/exception_object_alignment.sh.cpp
Modified:
libcxxabi/trunk/src/cxa_exception.hpp

Modified: libcxxabi/trunk/src/cxa_exception.hpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_exception.hpp?rev=302764=302763=302764=diff
==
--- libcxxabi/trunk/src/cxa_exception.hpp (original)
+++ libcxxabi/trunk/src/cxa_exception.hpp Thu May 11 01:17:49 2017
@@ -61,13 +61,7 @@ struct _LIBCXXABI_HIDDEN __cxa_exception
 size_t referenceCount;
 #endif
 
-// This field is annotated with attribute aligned so that the exception
-// object following the field is sufficiently aligned and there is no
-// gap between the field and the exception object. r276215 made a change to
-// annotate _Unwind_Exception with __attribute__((aligned)), but we cannot
-// incorporate the fix on Darwin since it is an ABI-breaking change, which
-// is why we need the attribute on this field.
-_Unwind_Exception unwindHeader __attribute__((aligned));
+_Unwind_Exception unwindHeader;
 };
 
 // http://sourcery.mentor.com/archives/cxx-abi-dev/msg01924.html
@@ -102,9 +96,7 @@ struct _LIBCXXABI_HIDDEN __cxa_dependent
 void* primaryException;
 #endif
 
-// See the comment in __cxa_exception as to why this field has attribute
-// aligned.
-_Unwind_Exception unwindHeader __attribute__((aligned));
+_Unwind_Exception unwindHeader;
 };
 
 struct _LIBCXXABI_HIDDEN __cxa_eh_globals {

Removed: libcxxabi/trunk/test/exception_object_alignment.sh.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/exception_object_alignment.sh.cpp?rev=302763=auto
==
--- libcxxabi/trunk/test/exception_object_alignment.sh.cpp (original)
+++ libcxxabi/trunk/test/exception_object_alignment.sh.cpp (removed)
@@ -1,46 +0,0 @@
-//=== exception_object_alignment.sh.cpp 
---===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===--===//
-
-// UNSUPPORTED: libcxxabi-no-exceptions
-
-// RUN: %cxx %flags %compile_flags -O1 %s -o %t.exe
-// RUN: %exec %t.exe
-
-// This test used to segfault on Darwin because field unwindHeader of struct
-// __cxa_exception was not 16B aligned.
-
-namespace {
-
-struct S {
-  int a;
-  int __attribute__((aligned(16))) b;
-};
-
-class base1 {
-protected:
-  virtual ~base1() throw() {}
-};
-
-class derived: public base1 {
-public:
-  derived() : member() {}
-private:
-  S member;
-};
-
-}
-
-int main() {
-  try {
-throw derived();
-  }
-  catch(...) {
-  }
-  return 0;
-}


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


[PATCH] D27334: [OpenCL] Ambiguous function call.

2017-05-11 Thread Egor Churaev via Phabricator via cfe-commits
echuraev added a comment.

So, I think that we have to do some decision about this patch. @Anastasia, What 
do you think about it? Please see my commentary above. What should we do with 
this patch?


https://reviews.llvm.org/D27334



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


[PATCH] D33082: Fix Libc++ build with MinGW64

2017-05-11 Thread Shoaib Meenai via Phabricator via cfe-commits
smeenai added a comment.

@EricWF and I discussed this on IRC a bit. I'm not a fan of overloading 
`_LIBCPP_WIN32API` for this purpose, since to me that macro is meant for 
guarding Windows API functions, not for CRT functions. Eric suggested adding a 
new macro `_LIBCPP_MSVCRT_LIKE`, which I'd be fine with.


https://reviews.llvm.org/D33082



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


[PATCH] D33030: [libcxxabi] Align unwindHeader on a double-word boundary

2017-05-11 Thread Akira Hatanaka via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL302763: [libcxxabi] Align unwindHeader on a double-word 
boundary. (authored by ahatanak).

Changed prior to commit:
  https://reviews.llvm.org/D33030?vs=98401=98583#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D33030

Files:
  libcxxabi/trunk/src/cxa_exception.hpp
  libcxxabi/trunk/test/exception_object_alignment.sh.cpp


Index: libcxxabi/trunk/test/exception_object_alignment.sh.cpp
===
--- libcxxabi/trunk/test/exception_object_alignment.sh.cpp
+++ libcxxabi/trunk/test/exception_object_alignment.sh.cpp
@@ -0,0 +1,46 @@
+//=== exception_object_alignment.sh.cpp 
---===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// UNSUPPORTED: libcxxabi-no-exceptions
+
+// RUN: %cxx %flags %compile_flags -O1 %s -o %t.exe
+// RUN: %exec %t.exe
+
+// This test used to segfault on Darwin because field unwindHeader of struct
+// __cxa_exception was not 16B aligned.
+
+namespace {
+
+struct S {
+  int a;
+  int __attribute__((aligned(16))) b;
+};
+
+class base1 {
+protected:
+  virtual ~base1() throw() {}
+};
+
+class derived: public base1 {
+public:
+  derived() : member() {}
+private:
+  S member;
+};
+
+}
+
+int main() {
+  try {
+throw derived();
+  }
+  catch(...) {
+  }
+  return 0;
+}
Index: libcxxabi/trunk/src/cxa_exception.hpp
===
--- libcxxabi/trunk/src/cxa_exception.hpp
+++ libcxxabi/trunk/src/cxa_exception.hpp
@@ -61,7 +61,13 @@
 size_t referenceCount;
 #endif
 
-_Unwind_Exception unwindHeader;
+// This field is annotated with attribute aligned so that the exception
+// object following the field is sufficiently aligned and there is no
+// gap between the field and the exception object. r276215 made a change to
+// annotate _Unwind_Exception with __attribute__((aligned)), but we cannot
+// incorporate the fix on Darwin since it is an ABI-breaking change, which
+// is why we need the attribute on this field.
+_Unwind_Exception unwindHeader __attribute__((aligned));
 };
 
 // http://sourcery.mentor.com/archives/cxx-abi-dev/msg01924.html
@@ -96,7 +102,9 @@
 void* primaryException;
 #endif
 
-_Unwind_Exception unwindHeader;
+// See the comment in __cxa_exception as to why this field has attribute
+// aligned.
+_Unwind_Exception unwindHeader __attribute__((aligned));
 };
 
 struct _LIBCXXABI_HIDDEN __cxa_eh_globals {


Index: libcxxabi/trunk/test/exception_object_alignment.sh.cpp
===
--- libcxxabi/trunk/test/exception_object_alignment.sh.cpp
+++ libcxxabi/trunk/test/exception_object_alignment.sh.cpp
@@ -0,0 +1,46 @@
+//=== exception_object_alignment.sh.cpp ---===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// UNSUPPORTED: libcxxabi-no-exceptions
+
+// RUN: %cxx %flags %compile_flags -O1 %s -o %t.exe
+// RUN: %exec %t.exe
+
+// This test used to segfault on Darwin because field unwindHeader of struct
+// __cxa_exception was not 16B aligned.
+
+namespace {
+
+struct S {
+  int a;
+  int __attribute__((aligned(16))) b;
+};
+
+class base1 {
+protected:
+  virtual ~base1() throw() {}
+};
+
+class derived: public base1 {
+public:
+  derived() : member() {}
+private:
+  S member;
+};
+
+}
+
+int main() {
+  try {
+throw derived();
+  }
+  catch(...) {
+  }
+  return 0;
+}
Index: libcxxabi/trunk/src/cxa_exception.hpp
===
--- libcxxabi/trunk/src/cxa_exception.hpp
+++ libcxxabi/trunk/src/cxa_exception.hpp
@@ -61,7 +61,13 @@
 size_t referenceCount;
 #endif
 
-_Unwind_Exception unwindHeader;
+// This field is annotated with attribute aligned so that the exception
+// object following the field is sufficiently aligned and there is no
+// gap between the field and the exception object. r276215 made a change to
+// annotate _Unwind_Exception with __attribute__((aligned)), but we cannot
+// incorporate the fix on Darwin since it is an ABI-breaking change, which
+// is why we need the attribute on this field.
+_Unwind_Exception unwindHeader __attribute__((aligned));
 };
 
 // http://sourcery.mentor.com/archives/cxx-abi-dev/msg01924.html
@@ -96,7 +102,9 @@
 void* primaryException;
 #endif
 
-_Unwind_Exception unwindHeader;
+// See the 

  1   2   >