Re: [PATCH] D24809: [libcxx] [cmake] Stop stripping -m32 from compiler flags

2016-09-26 Thread Michał Górny via cfe-commits
mgorny added a comment.

In https://reviews.llvm.org/D24809#553415, @EricWF wrote:

> > Stop stripping -m32 from the user-supplied flags. There is no valid reason 
> > to do that, stripping it silently is thoroughly confusing and makes it 
> > impossible to do distribution multi-ABI builds without resorting to ugly 
> > hacks.
>
>
> The reason for stripping it is configurations like `-DLLVM_BUILD_32_BITS=ON 
> -DLIBCXX_BUILD_32_BITS=OFF`, where we inherit the incorrect set of flags from 
> the LLVM parent project. I understand your frustration with this behavior but 
> I'm not sure how else to handle that.


Well, I'm afraid this only proves that the whole concept is broken and 
shouldn't be there in the first place ;-).

However, if this is the only case, maybe the stripping should be made 
conditional to in-tree builds?


https://reviews.llvm.org/D24809



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


Re: [PATCH] D24601: XFAIL Driver/darwin-stdlib.cpp if CLANG_DEFAULT_CXX_STDLIB is set

2016-09-26 Thread Vedant Kumar via cfe-commits
vsk added a subscriber: vsk.
vsk added a comment.

It should be fine to XFAIL this test temporarily. Is there a PR for this?


https://reviews.llvm.org/D24601



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


Re: [PATCH] D24693: [CodeGen] Don't emit lifetime intrinsics for some local variables

2016-09-26 Thread Vitaly Buka via cfe-commits
vitalybuka added a comment.

My assumption is that "start" makes access valid, and "end" makes access 
invalid, up to the next "start".
I see no problems problems with loops and multiple regions, as soon as access 
is happening between start and end. Loops always call "start" for nested alloca 
on each iteration and call "end" on iteration cleanup. For multiple starts I 
assume that variable is accessible right after the first start, and invalid 
after the first "end".
I see no cases other then this "goto" issues where clang behaves differently.

This patch addresses issues were the last intrinsic before access was "end":
call start, ... call end, ...access
or only the end: entry, ... call end, ... access


https://reviews.llvm.org/D24693



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


Re: [PATCH] D14259: The maximum alignment of std::aligned_storage applies to all Windows compilers

2016-09-26 Thread Marshall Clow via cfe-commits
mclow.lists accepted this revision.
mclow.lists added a comment.

I guess this is OK. I'd rather not have naked `_WIN32` references outside of 
<__config>, but this is not the first one.


https://reviews.llvm.org/D14259



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


Re: [PATCH] D24945: [libc++abi] Default to DLL annotations on Windows

2016-09-26 Thread Shoaib Meenai via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL282470: [libc++abi] Default to DLL annotations on Windows 
(authored by smeenai).

Changed prior to commit:
  https://reviews.llvm.org/D24945?vs=72598=72599#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D24945

Files:
  libcxxabi/trunk/CMakeLists.txt
  libcxxabi/trunk/include/__cxxabi_config.h

Index: libcxxabi/trunk/include/__cxxabi_config.h
===
--- libcxxabi/trunk/include/__cxxabi_config.h
+++ libcxxabi/trunk/include/__cxxabi_config.h
@@ -21,8 +21,13 @@
 #define __has_attribute(_attribute_) 0
 #endif
 
-#if defined(_LIBCXXABI_DLL)
- #if defined(cxxabi_EXPORTS)
+#if defined(_WIN32)
+ #if defined(_LIBCXXABI_DISABLE_DLL_IMPORT_EXPORT)
+  #define _LIBCXXABI_HIDDEN
+  #define _LIBCXXABI_DATA_VIS
+  #define _LIBCXXABI_FUNC_VIS
+  #define _LIBCXXABI_TYPE_VIS
+ #elif defined(_LIBCXXABI_BUILDING_LIBRARY)
   #define _LIBCXXABI_HIDDEN
   #define _LIBCXXABI_DATA_VIS __declspec(dllexport)
   #define _LIBCXXABI_FUNC_VIS __declspec(dllexport)
Index: libcxxabi/trunk/CMakeLists.txt
===
--- libcxxabi/trunk/CMakeLists.txt
+++ libcxxabi/trunk/CMakeLists.txt
@@ -249,6 +249,15 @@
   list(APPEND LIBCXXABI_LINK_FLAGS "-rtlib=compiler-rt")
 endif()
 
+# Let the library headers know they are currently being used to build the
+# library.
+add_definitions(-D_LIBCXXABI_BUILDING_LIBRARY)
+
+# Disable DLL annotations on Windows for static builds.
+if (WIN32 AND LIBCXXABI_ENABLE_STATIC AND NOT LIBCXXABI_ENABLE_SHARED)
+  add_definitions(-D_LIBCXXABI_DISABLE_DLL_IMPORT_EXPORT)
+endif()
+
 append_if(LIBCXXABI_COMPILE_FLAGS LIBCXXABI_HAS_WERROR_FLAG 
-Werror=return-type)
 
 # Get warning flags
@@ -333,7 +342,6 @@
   add_definitions(-D_LIBCPP_HAS_THREAD_API_PTHREAD)
 endif()
 
-# This is the _ONLY_ place where add_definitions is called.
 if (MSVC)
   add_definitions(-D_CRT_SECURE_NO_WARNINGS)
 endif()


Index: libcxxabi/trunk/include/__cxxabi_config.h
===
--- libcxxabi/trunk/include/__cxxabi_config.h
+++ libcxxabi/trunk/include/__cxxabi_config.h
@@ -21,8 +21,13 @@
 #define __has_attribute(_attribute_) 0
 #endif
 
-#if defined(_LIBCXXABI_DLL)
- #if defined(cxxabi_EXPORTS)
+#if defined(_WIN32)
+ #if defined(_LIBCXXABI_DISABLE_DLL_IMPORT_EXPORT)
+  #define _LIBCXXABI_HIDDEN
+  #define _LIBCXXABI_DATA_VIS
+  #define _LIBCXXABI_FUNC_VIS
+  #define _LIBCXXABI_TYPE_VIS
+ #elif defined(_LIBCXXABI_BUILDING_LIBRARY)
   #define _LIBCXXABI_HIDDEN
   #define _LIBCXXABI_DATA_VIS __declspec(dllexport)
   #define _LIBCXXABI_FUNC_VIS __declspec(dllexport)
Index: libcxxabi/trunk/CMakeLists.txt
===
--- libcxxabi/trunk/CMakeLists.txt
+++ libcxxabi/trunk/CMakeLists.txt
@@ -249,6 +249,15 @@
   list(APPEND LIBCXXABI_LINK_FLAGS "-rtlib=compiler-rt")
 endif()
 
+# Let the library headers know they are currently being used to build the
+# library.
+add_definitions(-D_LIBCXXABI_BUILDING_LIBRARY)
+
+# Disable DLL annotations on Windows for static builds.
+if (WIN32 AND LIBCXXABI_ENABLE_STATIC AND NOT LIBCXXABI_ENABLE_SHARED)
+  add_definitions(-D_LIBCXXABI_DISABLE_DLL_IMPORT_EXPORT)
+endif()
+
 append_if(LIBCXXABI_COMPILE_FLAGS LIBCXXABI_HAS_WERROR_FLAG -Werror=return-type)
 
 # Get warning flags
@@ -333,7 +342,6 @@
   add_definitions(-D_LIBCPP_HAS_THREAD_API_PTHREAD)
 endif()
 
-# This is the _ONLY_ place where add_definitions is called.
 if (MSVC)
   add_definitions(-D_CRT_SECURE_NO_WARNINGS)
 endif()
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxxabi] r282470 - [libc++abi] Default to DLL annotations on Windows

2016-09-26 Thread Shoaib Meenai via cfe-commits
Author: smeenai
Date: Mon Sep 26 22:44:09 2016
New Revision: 282470

URL: http://llvm.org/viewvc/llvm-project?rev=282470=rev
Log:
[libc++abi] Default to DLL annotations on Windows

`__declspec(dllexport)` and `__declspec(dllimport)` should only be used
when building libc++abi as a DLL, but that's the more common use case,
so default to adding the annotations and add an option to opt out.

Similar to r282449, which made the corresponding change for libc++.

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

Modified:
libcxxabi/trunk/CMakeLists.txt
libcxxabi/trunk/include/__cxxabi_config.h

Modified: libcxxabi/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/CMakeLists.txt?rev=282470=282469=282470=diff
==
--- libcxxabi/trunk/CMakeLists.txt (original)
+++ libcxxabi/trunk/CMakeLists.txt Mon Sep 26 22:44:09 2016
@@ -249,6 +249,15 @@ if (LIBCXXABI_USE_COMPILER_RT)
   list(APPEND LIBCXXABI_LINK_FLAGS "-rtlib=compiler-rt")
 endif()
 
+# Let the library headers know they are currently being used to build the
+# library.
+add_definitions(-D_LIBCXXABI_BUILDING_LIBRARY)
+
+# Disable DLL annotations on Windows for static builds.
+if (WIN32 AND LIBCXXABI_ENABLE_STATIC AND NOT LIBCXXABI_ENABLE_SHARED)
+  add_definitions(-D_LIBCXXABI_DISABLE_DLL_IMPORT_EXPORT)
+endif()
+
 append_if(LIBCXXABI_COMPILE_FLAGS LIBCXXABI_HAS_WERROR_FLAG 
-Werror=return-type)
 
 # Get warning flags
@@ -333,7 +342,6 @@ if (LIBCXXABI_HAS_PTHREAD_API)
   add_definitions(-D_LIBCPP_HAS_THREAD_API_PTHREAD)
 endif()
 
-# This is the _ONLY_ place where add_definitions is called.
 if (MSVC)
   add_definitions(-D_CRT_SECURE_NO_WARNINGS)
 endif()

Modified: libcxxabi/trunk/include/__cxxabi_config.h
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/include/__cxxabi_config.h?rev=282470=282469=282470=diff
==
--- libcxxabi/trunk/include/__cxxabi_config.h (original)
+++ libcxxabi/trunk/include/__cxxabi_config.h Mon Sep 26 22:44:09 2016
@@ -21,8 +21,13 @@
 #define __has_attribute(_attribute_) 0
 #endif
 
-#if defined(_LIBCXXABI_DLL)
- #if defined(cxxabi_EXPORTS)
+#if defined(_WIN32)
+ #if defined(_LIBCXXABI_DISABLE_DLL_IMPORT_EXPORT)
+  #define _LIBCXXABI_HIDDEN
+  #define _LIBCXXABI_DATA_VIS
+  #define _LIBCXXABI_FUNC_VIS
+  #define _LIBCXXABI_TYPE_VIS
+ #elif defined(_LIBCXXABI_BUILDING_LIBRARY)
   #define _LIBCXXABI_HIDDEN
   #define _LIBCXXABI_DATA_VIS __declspec(dllexport)
   #define _LIBCXXABI_FUNC_VIS __declspec(dllexport)


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


Re: [PATCH] D24945: [libc++abi] Default to DLL annotations on Windows

2016-09-26 Thread Shoaib Meenai via cfe-commits
smeenai updated this revision to Diff 72598.
smeenai added a comment.

Addressing @EricWF's comment


https://reviews.llvm.org/D24945

Files:
  CMakeLists.txt
  include/__cxxabi_config.h

Index: include/__cxxabi_config.h
===
--- include/__cxxabi_config.h
+++ include/__cxxabi_config.h
@@ -21,8 +21,13 @@
 #define __has_attribute(_attribute_) 0
 #endif
 
-#if defined(_LIBCXXABI_DLL)
- #if defined(cxxabi_EXPORTS)
+#if defined(_WIN32)
+ #if defined(_LIBCXXABI_DISABLE_DLL_IMPORT_EXPORT)
+  #define _LIBCXXABI_HIDDEN
+  #define _LIBCXXABI_DATA_VIS
+  #define _LIBCXXABI_FUNC_VIS
+  #define _LIBCXXABI_TYPE_VIS
+ #elif defined(_LIBCXXABI_BUILDING_LIBRARY)
   #define _LIBCXXABI_HIDDEN
   #define _LIBCXXABI_DATA_VIS __declspec(dllexport)
   #define _LIBCXXABI_FUNC_VIS __declspec(dllexport)
Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -249,6 +249,15 @@
   list(APPEND LIBCXXABI_LINK_FLAGS "-rtlib=compiler-rt")
 endif()
 
+# Let the library headers know they are currently being used to build the
+# library.
+add_definitions(-D_LIBCXXABI_BUILDING_LIBRARY)
+
+# Disable DLL annotations on Windows for static builds.
+if (WIN32 AND LIBCXXABI_ENABLE_STATIC AND NOT LIBCXXABI_ENABLE_SHARED)
+  add_definitions(-D_LIBCXXABI_DISABLE_DLL_IMPORT_EXPORT)
+endif()
+
 append_if(LIBCXXABI_COMPILE_FLAGS LIBCXXABI_HAS_WERROR_FLAG 
-Werror=return-type)
 
 # Get warning flags
@@ -333,7 +342,6 @@
   add_definitions(-D_LIBCPP_HAS_THREAD_API_PTHREAD)
 endif()
 
-# This is the _ONLY_ place where add_definitions is called.
 if (MSVC)
   add_definitions(-D_CRT_SECURE_NO_WARNINGS)
 endif()


Index: include/__cxxabi_config.h
===
--- include/__cxxabi_config.h
+++ include/__cxxabi_config.h
@@ -21,8 +21,13 @@
 #define __has_attribute(_attribute_) 0
 #endif
 
-#if defined(_LIBCXXABI_DLL)
- #if defined(cxxabi_EXPORTS)
+#if defined(_WIN32)
+ #if defined(_LIBCXXABI_DISABLE_DLL_IMPORT_EXPORT)
+  #define _LIBCXXABI_HIDDEN
+  #define _LIBCXXABI_DATA_VIS
+  #define _LIBCXXABI_FUNC_VIS
+  #define _LIBCXXABI_TYPE_VIS
+ #elif defined(_LIBCXXABI_BUILDING_LIBRARY)
   #define _LIBCXXABI_HIDDEN
   #define _LIBCXXABI_DATA_VIS __declspec(dllexport)
   #define _LIBCXXABI_FUNC_VIS __declspec(dllexport)
Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -249,6 +249,15 @@
   list(APPEND LIBCXXABI_LINK_FLAGS "-rtlib=compiler-rt")
 endif()
 
+# Let the library headers know they are currently being used to build the
+# library.
+add_definitions(-D_LIBCXXABI_BUILDING_LIBRARY)
+
+# Disable DLL annotations on Windows for static builds.
+if (WIN32 AND LIBCXXABI_ENABLE_STATIC AND NOT LIBCXXABI_ENABLE_SHARED)
+  add_definitions(-D_LIBCXXABI_DISABLE_DLL_IMPORT_EXPORT)
+endif()
+
 append_if(LIBCXXABI_COMPILE_FLAGS LIBCXXABI_HAS_WERROR_FLAG -Werror=return-type)
 
 # Get warning flags
@@ -333,7 +342,6 @@
   add_definitions(-D_LIBCPP_HAS_THREAD_API_PTHREAD)
 endif()
 
-# This is the _ONLY_ place where add_definitions is called.
 if (MSVC)
   add_definitions(-D_CRT_SECURE_NO_WARNINGS)
 endif()
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D24945: [libc++abi] Default to DLL annotations on Windows

2016-09-26 Thread Shoaib Meenai via cfe-commits
smeenai marked an inline comment as done.
smeenai added a comment.

https://reviews.llvm.org/D24945



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


Re: [PATCH] D23236: When ARC is enabled, no warning will be generated when a method1. Returns 'nil' in a method that is attributed to return a 'nonnull'2. The return-statement is a ConditionalOperator

2016-09-26 Thread Devin Coughlin via cfe-commits
dcoughlin accepted this revision.
dcoughlin added a comment.

LGTM.


https://reviews.llvm.org/D23236



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


[libcxx] r282468 - Fix possible division by zero

2016-09-26 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Mon Sep 26 21:13:27 2016
New Revision: 282468

URL: http://llvm.org/viewvc/llvm-project?rev=282468=rev
Log:
Fix possible division by zero

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

Modified: libcxx/trunk/src/experimental/filesystem/operations.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/experimental/filesystem/operations.cpp?rev=282468=282467=282468=diff
==
--- libcxx/trunk/src/experimental/filesystem/operations.cpp (original)
+++ libcxx/trunk/src/experimental/filesystem/operations.cpp Mon Sep 26 21:13:27 
2016
@@ -720,7 +720,7 @@ space_info __space(const path& p, std::e
 // Multiply with overflow checking.
 auto do_mult = [&](std::uintmax_t& out, std::uintmax_t other) {
   out = other * m_svfs.f_frsize;
-  if (out / other != m_svfs.f_frsize || other == 0)
+  if (other == 0 || out / other != m_svfs.f_frsize)
   out = static_cast(-1);
 };
 do_mult(si.capacity, m_svfs.f_blocks);


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


Re: [PATCH] D24119: [libc++] add linker option "-Wl, -z, defs" in standalone build

2016-09-26 Thread Eric Fiselier via cfe-commits
EricWF accepted this revision.
EricWF added a comment.
This revision is now accepted and ready to land.

LGTM. Thanks for the patch.


https://reviews.llvm.org/D24119



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


Re: [PATCH] D24809: [libcxx] [cmake] Stop stripping -m32 from compiler flags

2016-09-26 Thread Eric Fiselier via cfe-commits
EricWF added a comment.

> Stop stripping -m32 from the user-supplied flags. There is no valid reason to 
> do that, stripping it silently is thoroughly confusing and makes it 
> impossible to do distribution multi-ABI builds without resorting to ugly 
> hacks.


The reason for stripping it is configurations like `-DLLVM_BUILD_32_BITS=ON 
-DLIBCXX_BUILD_32_BITS=OFF`, where we inherit the incorrect set of flags from 
the LLVM parent project. I understand your frustration with this behavior but 
I'm not sure how else to handle that.

> Otherwise, in order to perform 32-bit builds the build scripts would have to 
> use LIBCXX_BUILD_32_BITS. However, -m32 is only one of the many different ABI 
> flags for different targets, and it really makes no sense to add separate 
> CMake options for each possible -m* flag and then keep a mapping from 
> well-known flags to the custom CMake options.


I don't see how using `-DLLVM_BUILD_32_BITS=ON` is impossible compared to using 
`-DCMAKE_CXX_FLAGS=-m32`, but the fact it acts differently than other ABI flags 
is unfortunate.

I'm not sure what the correct thing to do is. Does anybody else want to weigh 
in?


https://reviews.llvm.org/D24809



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


Re: [PATCH] D13280: [OpenCL] Adding reserved operator logical xor for OpenCL

2016-09-26 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko added a subscriber: Eugene.Zelenko.
Eugene.Zelenko closed this revision.
Eugene.Zelenko added a comment.

Committed in https://reviews.llvm.org/rL259651.


https://reviews.llvm.org/D13280



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


Re: [PATCH] D13349: [OpenCL] Casting boolean to an integer vector in OpenCL should set all bits if boolean is true

2016-09-26 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko added a subscriber: Eugene.Zelenko.
Eugene.Zelenko closed this revision.
Eugene.Zelenko added a comment.

Committed in https://reviews.llvm.org/rL249301.


https://reviews.llvm.org/D13349



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


Re: [PATCH] D24693: [CodeGen] Don't emit lifetime intrinsics for some local variables

2016-09-26 Thread Richard Smith via cfe-commits
rsmith added a comment.

Before we start with heroics here, we should consider whether the LLVM 
intrinsics are actually specified the right way. The current specification does 
the wrong thing for even trivial cases, such as a variable declared within a 
loop, so there's some impedance mismatch between the specification and how 
Clang uses the intrinsics, even with this patch applied. Can we get some 
clarity on how these intrinsics are *actually* supposed to work? (Is it 
permitted to have multiple start+end regions for the same alloca, or do we need 
to suppress them inside loops too? What happens if we have multiple starts but 
no ends?)


https://reviews.llvm.org/D24693



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


Re: [PATCH] D24945: [libc++abi] Default to DLL annotations on Windows

2016-09-26 Thread Eric Fiselier via cfe-commits
EricWF accepted this revision.
EricWF added a comment.
This revision is now accepted and ready to land.

LGTM after addressing inline comments. Unfortunately libc++abi doesn't have a 
way to  make `_LIBCXXABI_DISABLE_DLL_IMPORT_EXPORT` persistent, but this 
solution works for now.



Comment at: CMakeLists.txt:255
@@ -252,1 +254,3 @@
+add_definitions(-D_LIBCXXABI_BUILDING_LIBRARY)
+
 append_if(LIBCXXABI_COMPILE_FLAGS LIBCXXABI_HAS_WERROR_FLAG 
-Werror=return-type)

We probably want to define `_LIBCXXABI_DISABLE_DLL_IMPORT_EXPORT` on Windows 
when `LIBCXXABI_ENABLE_SHARED=OFF` and `LIBCXXABI_ENABLE_STATIC=ON`.


https://reviews.llvm.org/D24945



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


Re: [PATCH] D13419: Fix several problems at the intersection of template instantiations and visibility

2016-09-26 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko added a subscriber: Eugene.Zelenko.
Eugene.Zelenko added a comment.

Looks like patch was not committed.


Repository:
  rL LLVM

https://reviews.llvm.org/D13419



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


[libcxx] r282466 - Remove out of date items in TODO.txt

2016-09-26 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Mon Sep 26 20:28:47 2016
New Revision: 282466

URL: http://llvm.org/viewvc/llvm-project?rev=282466=rev
Log:
Remove out of date items in TODO.txt

Modified:
libcxx/trunk/TODO.TXT

Modified: libcxx/trunk/TODO.TXT
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/TODO.TXT?rev=282466=282465=282466=diff
==
--- libcxx/trunk/TODO.TXT (original)
+++ libcxx/trunk/TODO.TXT Mon Sep 26 20:28:47 2016
@@ -1,46 +1,25 @@
 This is meant to be a general place to list things that should be done 
"someday"
 
-3.8 Release Goals
-=
-* LFTS v1 (EricWF, MClow)
-* Filesystem TS (EricWF)
-* ASIO TS (MClow)
-*  Improvements (MClow)
-* Setup ABI Versioning policy (EricWF)
-* Fix PR19302 - Fix UB in list and __tree.
-
 
 ABI Related Tasks
 =
 * Explicitly manage and verify symbols exported from the dylib.
-* Explore using namespaces for managing symbol visibility.
-* Introduce and document ABI versioning/evolution policy.
 
 CXX Runtime Library Tasks
 =
-* Cleanup #ifdef hell in sources files that supports the different ABI 
libraries.
 * Fix that CMake always link to /usr/lib/libc++abi.dylib on OS X.
-* Fix selection of ABI symbol list on OS X.
-* Have CMake generate linker scripts for libc++.so that it properly links the
-  runtime library.
 * Look into mirroring libsupc++'s typeinfo vtable layout when 
libsupc++/libstdc++
   is used as the runtime library.
-* Audit libraries that CMake links into libc++. Are they all required?
 * Investigate and document interoperability between libc++ and libstdc++ on
   linux. Do this for every supported c++ runtime library.
 
 Atomic Related Tasks
 
-* Enable mixing of clang and GCC atomics internally. Currently some
-  parts of libc++ use atomics only when clang provides them.
-  (see memory@5380 for an example)
-* Audit use of libatomic builtins in  with GCC.
 * future should use  for synchronization.
 
 Test Suite Tasks
 
 * Move all libc++ specific tests from test/std into test/libcxx.
-* Improve how LIT handles compiler warnings.
 * Improve the quality and portability of the locale test data.
 * Convert failure tests to use Clang Verify.
 
@@ -52,5 +31,4 @@ Misc Tasks
 * Look at basic_string's move assignment operator, re LWG 2063 and POCMA
 * libc++ is missing try_emplace
 * Put a static_assert in std::allocator to deny const/volatile types (LWG 2447)
-* Document support (or lack of) for C++11 libraries in C++03.
-* Document supported compilers.
+


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


Re: [PATCH] D23236: When ARC is enabled, no warning will be generated when a method1. Returns 'nil' in a method that is attributed to return a 'nonnull'2. The return-statement is a ConditionalOperator

2016-09-26 Thread Akira Hatanaka via cfe-commits
ahatanak added a comment.

This looks fine to me.


https://reviews.llvm.org/D23236



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


Re: r282453 - P0145R3 (C++17 evaluation order tweaks): consistently emit the LHS of array

2016-09-26 Thread Richard Smith via cfe-commits
On Mon, Sep 26, 2016 at 5:57 PM, Kostya Serebryany via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Looks like yours:
>
> FAILED: tools/clang/lib/CodeGen/CMakeFiles/clangCodeGen.dir/CGExpr.cpp.obj
> C:\PROGRA~2\MICROS~1.0\VC\bin\AMD64_~1\cl.exe   /nologo /TP 
> -DCLANG_ENABLE_ARCMT -DCLANG_ENABLE_OBJC_REWRITER 
> -DCLANG_ENABLE_STATIC_ANALYZER -DGTEST_HAS_RTTI=0 -DUNICODE 
> -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS 
> -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_DEBUG_POINTER_IMPL="" 
> -D_GNU_SOURCE -D_HAS_EXCEPTIONS=0 -D_SCL_SECURE_NO_DEPRECATE 
> -D_SCL_SECURE_NO_WARNINGS -D_UNICODE -D__STDC_CONSTANT_MACROS 
> -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Itools\clang\lib\CodeGen 
> -IC:\b\slave\sanitizer-windows\llvm\tools\clang\lib\CodeGen 
> -IC:\b\slave\sanitizer-windows\llvm\tools\clang\include -Itools\clang\include 
> -Iinclude -IC:\b\slave\sanitizer-windows\llvm\include /DWIN32 /D_WINDOWS   
> /W4 -wd4141 -wd4146 -wd4180 -wd4244 -wd4258 -wd4267 -wd4291 -wd4345 -wd4351 
> -wd4355 -wd4456 -wd4457 -wd4458 -wd4459 -wd4503 -wd4624 -wd4722 -wd4800 
> -wd4100 -wd4127 -wd4512 -wd4505 -wd4610 -wd4510 -wd4702 -wd4245 -wd4706 
> -wd4310 -wd4701 -wd4703 -wd4389 -wd4611 -wd4805 -wd4204 -wd4577 -wd4091 
> -wd4592 -wd4319 -wd4324 -w14062 -we4238 /Zc:inline /Oi /Zc:rvalueCast /MD /O2 
> /Ob2   -UNDEBUG  /EHs-c- /GR- /showIncludes 
> /Fotools\clang\lib\CodeGen\CMakeFiles\clangCodeGen.dir\CGExpr.cpp.obj 
> /Fdtools\clang\lib\CodeGen\CMakeFiles\clangCodeGen.dir\ /FS -c 
> C:\b\slave\sanitizer-windows\llvm\tools\clang\lib\CodeGen\CGExpr.cpp
> C:\b\slave\sanitizer-windows\llvm\tools\clang\lib\CodeGen\CGExpr.cpp(2900) : 
> error C3486: a parameter for a lambda cannot have a default argument
> ninja: build stopped: subcommand failed.program finished with exit code 1
>
> Hah, oops, I remembered that old MSVC had this issue and avoided *using*
the default argument, but then forgot to actually remove it from the code.
Fixed in r282464.


> On Mon, Sep 26, 2016 at 4:49 PM, Richard Smith via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: rsmith
>> Date: Mon Sep 26 18:49:47 2016
>> New Revision: 282453
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=282453=rev
>> Log:
>> P0145R3 (C++17 evaluation order tweaks): consistently emit the LHS of
>> array
>> subscripting before the RHS, regardless of which is the base and which is
>> the
>> index.
>>
>> Added:
>> cfe/trunk/test/CodeGenCXX/cxx1z-eval-order.cpp
>> Modified:
>> cfe/trunk/lib/CodeGen/CGExpr.cpp
>> cfe/trunk/test/CodeGen/captured-statements-nested.c
>> cfe/trunk/test/CodeGenCXX/catch-undef-behavior.cpp
>> cfe/trunk/test/CodeGenCXX/cxx1y-initializer-aggregate.cpp
>> cfe/trunk/test/CodeGenCXX/pragma-loop-safety.cpp
>> cfe/trunk/test/CodeGenCXX/vla-lambda-capturing.cpp
>>
>> Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CG
>> Expr.cpp?rev=282453=282452=282453=diff
>> 
>> ==
>> --- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CGExpr.cpp Mon Sep 26 18:49:47 2016
>> @@ -2875,13 +2875,30 @@ static Address emitArraySubscriptGEP(Cod
>>
>>  LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr
>> *E,
>> bool Accessed) {
>> -  // The index must always be an integer, which is not an aggregate.
>> Emit it.
>> -  llvm::Value *Idx = EmitScalarExpr(E->getIdx());
>> -  QualType IdxTy  = E->getIdx()->getType();
>> -  bool IdxSigned = IdxTy->isSignedIntegerOrEnumerationType();
>> +  // The index must always be an integer, which is not an aggregate.
>> Emit it
>> +  // in lexical order (this complexity is, sadly, required by C++17).
>> +  llvm::Value *IdxPre =
>> +  (E->getLHS() == E->getIdx()) ? EmitScalarExpr(E->getIdx()) :
>> nullptr;
>> +  auto EmitIdxAfterBase = [&, IdxPre](bool Promote = true) ->
>> llvm::Value * {
>> +auto *Idx = IdxPre;
>> +if (E->getLHS() != E->getIdx()) {
>> +  assert(E->getRHS() == E->getIdx() && "index was neither LHS nor
>> RHS");
>> +  Idx = EmitScalarExpr(E->getIdx());
>> +}
>> +
>> +QualType IdxTy = E->getIdx()->getType();
>> +bool IdxSigned = IdxTy->isSignedIntegerOrEnumerationType();
>> +
>> +if (SanOpts.has(SanitizerKind::ArrayBounds))
>> +  EmitBoundsCheck(E, E->getBase(), Idx, IdxTy, Accessed);
>>
>> -  if (SanOpts.has(SanitizerKind::ArrayBounds))
>> -EmitBoundsCheck(E, E->getBase(), Idx, IdxTy, Accessed);
>> +// Extend or truncate the index type to 32 or 64-bits.
>> +if (Promote && Idx->getType() != IntPtrTy)
>> +  Idx = Builder.CreateIntCast(Idx, IntPtrTy, IdxSigned, "idxprom");
>> +
>> +return Idx;
>> +  };
>> +  IdxPre = nullptr;
>>
>>// If the base is a vector type, then we are forming a vector element
>> lvalue
>>// with this subscript.
>> @@ -2889,6 +2906,7 @@ LValue 

r282464 - Remove default argument from lambda to appease old MSVC.

2016-09-26 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Mon Sep 26 19:53:24 2016
New Revision: 282464

URL: http://llvm.org/viewvc/llvm-project?rev=282464=rev
Log:
Remove default argument from lambda to appease old MSVC.

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

Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=282464=282463=282464=diff
==
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Mon Sep 26 19:53:24 2016
@@ -2879,7 +2879,7 @@ LValue CodeGenFunction::EmitArraySubscri
   // in lexical order (this complexity is, sadly, required by C++17).
   llvm::Value *IdxPre =
   (E->getLHS() == E->getIdx()) ? EmitScalarExpr(E->getIdx()) : nullptr;
-  auto EmitIdxAfterBase = [&, IdxPre](bool Promote = true) -> llvm::Value * {
+  auto EmitIdxAfterBase = [&, IdxPre](bool Promote) -> llvm::Value * {
 auto *Idx = IdxPre;
 if (E->getLHS() != E->getIdx()) {
   assert(E->getRHS() == E->getIdx() && "index was neither LHS nor RHS");


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


r282463 - Defend test against differences between 32-bit and 64-bit MSABI manglings.

2016-09-26 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Mon Sep 26 19:52:29 2016
New Revision: 282463

URL: http://llvm.org/viewvc/llvm-project?rev=282463=rev
Log:
Defend test against differences between 32-bit and 64-bit MSABI manglings.

Modified:
cfe/trunk/test/CodeGenCXX/cxx1z-eval-order.cpp

Modified: cfe/trunk/test/CodeGenCXX/cxx1z-eval-order.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/cxx1z-eval-order.cpp?rev=282463=282462=282463=diff
==
--- cfe/trunk/test/CodeGenCXX/cxx1z-eval-order.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/cxx1z-eval-order.cpp Mon Sep 26 19:52:29 2016
@@ -45,13 +45,13 @@ void (*get_f())(A);
 void postfix_before_args() {
   // CHECK: call {{.*}}@{{.*}}get_f{{.*}}(
   // CHECK-ITANIUM: call {{.*}}@_ZN1AC1Ev(
-  // CHECK-WINDOWS: call {{.*}}@"\01??0A@@QEAA@XZ"(
+  // CHECK-WINDOWS: call {{.*}}@"\01??0A@@Q{{AE|EAA}}@XZ"(
   // CHECK: call {{.*}}%{{.*}}(
   get_f()(A{});
 
   // CHECK: call {{.*}}@{{.*}}side_effect{{.*}}(
   // CHECK-ITANIUM: call {{.*}}@_ZN1AC1Ev(
-  // CHECK-WINDOWS: call {{.*}}@"\01??0A@@QEAA@XZ"(
+  // CHECK-WINDOWS: call {{.*}}@"\01??0A@@Q{{AE|EAA}}@XZ"(
   // CHECK: call {{.*}}@{{.*}}callee{{.*}}(
   (side_effect(), callee)(A{});
 // CHECK: }
@@ -115,7 +115,7 @@ void *operator new(decltype(sizeof(0)),
 void alloc_before_init() {
   struct Q { Q(A) {} };
   // CHECK-ITANIUM: call {{.*}}@_Znw{{.*}}(
-  // CHECK-WINDOWS: call {{.*}}@"\01??2@YAPEAX_K@Z"(
+  // CHECK-WINDOWS: call {{.*}}@"\01??2@YAP{{EAX_K|AXI}}@Z"(
   // CHECK: call {{.*}}@{{.*}}make_a{{.*}}(
   delete new Q(make_a());
 


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


Re: r282453 - P0145R3 (C++17 evaluation order tweaks): consistently emit the LHS of array

2016-09-26 Thread Kostya Serebryany via cfe-commits
Looks like yours:

FAILED: tools/clang/lib/CodeGen/CMakeFiles/clangCodeGen.dir/CGExpr.cpp.obj
C:\PROGRA~2\MICROS~1.0\VC\bin\AMD64_~1\cl.exe   /nologo /TP
-DCLANG_ENABLE_ARCMT -DCLANG_ENABLE_OBJC_REWRITER
-DCLANG_ENABLE_STATIC_ANALYZER -DGTEST_HAS_RTTI=0 -DUNICODE
-D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS
-D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS
-D_DEBUG_POINTER_IMPL="" -D_GNU_SOURCE -D_HAS_EXCEPTIONS=0
-D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D_UNICODE
-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
-Itools\clang\lib\CodeGen
-IC:\b\slave\sanitizer-windows\llvm\tools\clang\lib\CodeGen
-IC:\b\slave\sanitizer-windows\llvm\tools\clang\include
-Itools\clang\include -Iinclude
-IC:\b\slave\sanitizer-windows\llvm\include /DWIN32 /D_WINDOWS   /W4
-wd4141 -wd4146 -wd4180 -wd4244 -wd4258 -wd4267 -wd4291 -wd4345
-wd4351 -wd4355 -wd4456 -wd4457 -wd4458 -wd4459 -wd4503 -wd4624
-wd4722 -wd4800 -wd4100 -wd4127 -wd4512 -wd4505 -wd4610 -wd4510
-wd4702 -wd4245 -wd4706 -wd4310 -wd4701 -wd4703 -wd4389 -wd4611
-wd4805 -wd4204 -wd4577 -wd4091 -wd4592 -wd4319 -wd4324 -w14062
-we4238 /Zc:inline /Oi /Zc:rvalueCast /MD /O2 /Ob2   -UNDEBUG  /EHs-c-
/GR- /showIncludes
/Fotools\clang\lib\CodeGen\CMakeFiles\clangCodeGen.dir\CGExpr.cpp.obj
/Fdtools\clang\lib\CodeGen\CMakeFiles\clangCodeGen.dir\ /FS -c
C:\b\slave\sanitizer-windows\llvm\tools\clang\lib\CodeGen\CGExpr.cpp
C:\b\slave\sanitizer-windows\llvm\tools\clang\lib\CodeGen\CGExpr.cpp(2900)
: error C3486: a parameter for a lambda cannot have a default argument
ninja: build stopped: subcommand failed.program finished with exit code 1


On Mon, Sep 26, 2016 at 4:49 PM, Richard Smith via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: rsmith
> Date: Mon Sep 26 18:49:47 2016
> New Revision: 282453
>
> URL: http://llvm.org/viewvc/llvm-project?rev=282453=rev
> Log:
> P0145R3 (C++17 evaluation order tweaks): consistently emit the LHS of array
> subscripting before the RHS, regardless of which is the base and which is
> the
> index.
>
> Added:
> cfe/trunk/test/CodeGenCXX/cxx1z-eval-order.cpp
> Modified:
> cfe/trunk/lib/CodeGen/CGExpr.cpp
> cfe/trunk/test/CodeGen/captured-statements-nested.c
> cfe/trunk/test/CodeGenCXX/catch-undef-behavior.cpp
> cfe/trunk/test/CodeGenCXX/cxx1y-initializer-aggregate.cpp
> cfe/trunk/test/CodeGenCXX/pragma-loop-safety.cpp
> cfe/trunk/test/CodeGenCXX/vla-lambda-capturing.cpp
>
> Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/
> CGExpr.cpp?rev=282453=282452=282453=diff
> 
> ==
> --- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGExpr.cpp Mon Sep 26 18:49:47 2016
> @@ -2875,13 +2875,30 @@ static Address emitArraySubscriptGEP(Cod
>
>  LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr
> *E,
> bool Accessed) {
> -  // The index must always be an integer, which is not an aggregate.
> Emit it.
> -  llvm::Value *Idx = EmitScalarExpr(E->getIdx());
> -  QualType IdxTy  = E->getIdx()->getType();
> -  bool IdxSigned = IdxTy->isSignedIntegerOrEnumerationType();
> +  // The index must always be an integer, which is not an aggregate.
> Emit it
> +  // in lexical order (this complexity is, sadly, required by C++17).
> +  llvm::Value *IdxPre =
> +  (E->getLHS() == E->getIdx()) ? EmitScalarExpr(E->getIdx()) :
> nullptr;
> +  auto EmitIdxAfterBase = [&, IdxPre](bool Promote = true) -> llvm::Value
> * {
> +auto *Idx = IdxPre;
> +if (E->getLHS() != E->getIdx()) {
> +  assert(E->getRHS() == E->getIdx() && "index was neither LHS nor
> RHS");
> +  Idx = EmitScalarExpr(E->getIdx());
> +}
> +
> +QualType IdxTy = E->getIdx()->getType();
> +bool IdxSigned = IdxTy->isSignedIntegerOrEnumerationType();
> +
> +if (SanOpts.has(SanitizerKind::ArrayBounds))
> +  EmitBoundsCheck(E, E->getBase(), Idx, IdxTy, Accessed);
>
> -  if (SanOpts.has(SanitizerKind::ArrayBounds))
> -EmitBoundsCheck(E, E->getBase(), Idx, IdxTy, Accessed);
> +// Extend or truncate the index type to 32 or 64-bits.
> +if (Promote && Idx->getType() != IntPtrTy)
> +  Idx = Builder.CreateIntCast(Idx, IntPtrTy, IdxSigned, "idxprom");
> +
> +return Idx;
> +  };
> +  IdxPre = nullptr;
>
>// If the base is a vector type, then we are forming a vector element
> lvalue
>// with this subscript.
> @@ -2889,6 +2906,7 @@ LValue CodeGenFunction::EmitArraySubscri
>!isa(E->getBase())) {
>  // Emit the vector as an lvalue to get its address.
>  LValue LHS = EmitLValue(E->getBase());
> +auto *Idx = EmitIdxAfterBase(/*Promote*/false);
>  assert(LHS.isSimple() && "Can only subscript lvalue vectors here!");
>  return LValue::MakeVectorElt(LHS.getAddress(), Idx,
>   E->getBase()->getType(),
> @@ 

Re: [PATCH] D24820: Add -stats-stats option

2016-09-26 Thread Adrian Prantl via cfe-commits
aprantl added a comment.

Awesome. Sorry!


Repository:
  rL LLVM

https://reviews.llvm.org/D24820



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


Re: [PATCH] D13813: Teach MyriadToolchain how to find its C++ header paths.

2016-09-26 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko added a subscriber: Eugene.Zelenko.
Eugene.Zelenko closed this revision.
Eugene.Zelenko added a comment.

Committed in https://reviews.llvm.org/rL250536.


https://reviews.llvm.org/D13813



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


Re: [PATCH] D13891: Apply modernize-use-default to llvm.

2016-09-26 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko added a subscriber: Eugene.Zelenko.
Eugene.Zelenko added a comment.

Looks like patch was not committed.


https://reviews.llvm.org/D13891



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


r282457 - P0145R3 (C++17 evaluation order tweaks): evaluate the base expression before

2016-09-26 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Mon Sep 26 18:56:57 2016
New Revision: 282457

URL: http://llvm.org/viewvc/llvm-project?rev=282457=rev
Log:
P0145R3 (C++17 evaluation order tweaks): evaluate the base expression before
the pointer-to-member expression in calls through .* and ->* expressions.

Modified:
cfe/trunk/lib/CodeGen/CGExprCXX.cpp
cfe/trunk/test/CodeGenCXX/cxx1z-eval-order.cpp

Modified: cfe/trunk/lib/CodeGen/CGExprCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprCXX.cpp?rev=282457=282456=282457=diff
==
--- cfe/trunk/lib/CodeGen/CGExprCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprCXX.cpp Mon Sep 26 18:56:57 2016
@@ -301,9 +301,6 @@ CodeGenFunction::EmitCXXMemberPointerCal
   const CXXRecordDecl *RD = 
 cast(MPT->getClass()->getAs()->getDecl());
 
-  // Get the member function pointer.
-  llvm::Value *MemFnPtr = EmitScalarExpr(MemFnExpr);
-
   // Emit the 'this' pointer.
   Address This = Address::invalid();
   if (BO->getOpcode() == BO_PtrMemI)
@@ -314,6 +311,9 @@ CodeGenFunction::EmitCXXMemberPointerCal
   EmitTypeCheck(TCK_MemberCall, E->getExprLoc(), This.getPointer(),
 QualType(MPT->getClass(), 0));
 
+  // Get the member function pointer.
+  llvm::Value *MemFnPtr = EmitScalarExpr(MemFnExpr);
+
   // Ask the ABI to load the callee.  Note that This is modified.
   llvm::Value *ThisPtrForCall = nullptr;
   llvm::Value *Callee =

Modified: cfe/trunk/test/CodeGenCXX/cxx1z-eval-order.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/cxx1z-eval-order.cpp?rev=282457=282456=282457=diff
==
--- cfe/trunk/test/CodeGenCXX/cxx1z-eval-order.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/cxx1z-eval-order.cpp Mon Sep 26 18:56:57 2016
@@ -125,35 +125,35 @@ void alloc_before_init() {
 // CHECK: }
 }
 
-#if 0
-// CHECKDISABLED-LABEL: define {{.*}}@{{.*}}dotstar_lhs_before_rhs{{.*}}(
+
+// CHECK-LABEL: define {{.*}}@{{.*}}dotstar_lhs_before_rhs{{.*}}(
 int dotstar_lhs_before_rhs() {
-  // CHECKDISABLED: call {{.*}}@{{.*}}make_a{{.*}}(
-  // CHECKDISABLED: call {{.*}}@{{.*}}make_mem_ptr_a{{.*}}(
+  // CHECK: call {{.*}}@{{.*}}make_a{{.*}}(
+  // CHECK: call {{.*}}@{{.*}}make_mem_ptr_a{{.*}}(
   int a = make_a().*make_mem_ptr_a();
 
-  // CHECKDISABLED: call {{.*}}@{{.*}}make_a_ptr{{.*}}(
-  // CHECKDISABLED: call {{.*}}@{{.*}}make_mem_ptr_a{{.*}}(
+  // CHECK: call {{.*}}@{{.*}}make_a_ptr{{.*}}(
+  // CHECK: call {{.*}}@{{.*}}make_mem_ptr_a{{.*}}(
   int b = make_a_ptr()->*make_mem_ptr_a();
 
-  // CHECKDISABLED: call {{.*}}@{{.*}}make_c{{.*}}(
-  // CHECKDISABLED: call {{.*}}@{{.*}}make_b{{.*}}(
+  // CHECK: call {{.*}}@{{.*}}make_c{{.*}}(
+  // CHECK: call {{.*}}@{{.*}}make_b{{.*}}(
   make_c()->*make_b();
 
-  // CHECKDISABLED: call {{.*}}@{{.*}}make_a{{.*}}(
-  // CHECKDISABLED: call {{.*}}@{{.*}}make_mem_fn_ptr_a{{.*}}(
-  // CHECKDISABLED: call
+  // CHECK: call {{.*}}@{{.*}}make_a{{.*}}(
+  // CHECK: call {{.*}}@{{.*}}make_mem_fn_ptr_a{{.*}}(
+  // CHECK: call
   (make_a().*make_mem_fn_ptr_a())();
 
-  // CHECKDISABLED: call {{.*}}@{{.*}}make_a_ptr{{.*}}(
-  // CHECKDISABLED: call {{.*}}@{{.*}}make_mem_fn_ptr_a{{.*}}(
-  // CHECKDISABLED: call
+  // CHECK: call {{.*}}@{{.*}}make_a_ptr{{.*}}(
+  // CHECK: call {{.*}}@{{.*}}make_mem_fn_ptr_a{{.*}}(
+  // CHECK: call
   (make_a_ptr()->*make_mem_fn_ptr_a())();
 
   return a + b;
-// CHECKDISABLED: }
+// CHECK: }
 }
-#endif
+
 #if 0
 // CHECKDISABLED-LABEL: define {{.*}}@{{.*}}assign_lhs_before_rhs{{.*}}(
 void assign_rhs_before_lhs() {


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


[PATCH] D24946: [CUDA] Added support for CUDA-8

2016-09-26 Thread Artem Belevich via cfe-commits
tra created this revision.
tra added a reviewer: jlebar.
tra added a subscriber: cfe-commits.
Herald added a subscriber: jlebar.

https://reviews.llvm.org/D24946

Files:
  lib/Driver/ToolChains.cpp
  lib/Headers/__clang_cuda_runtime_wrapper.h
  
test/Driver/Inputs/CUDA/usr/local/cuda/nvvm/libdevice/libdevice.compute_20.10.bc
  
test/Driver/Inputs/CUDA/usr/local/cuda/nvvm/libdevice/libdevice.compute_30.10.bc
  
test/Driver/Inputs/CUDA_80/usr/local/cuda/nvvm/libdevice/libdevice.compute_50.10.bc
  test/Driver/cuda-detect.cu

Index: test/Driver/cuda-detect.cu
===
--- test/Driver/cuda-detect.cu
+++ test/Driver/cuda-detect.cu
@@ -22,13 +22,14 @@
 // RUN:   --cuda-path=%S/Inputs/CUDA_80/usr/local/cuda %s 2>&1 \
 // RUN:   | FileCheck %s -check-prefix COMMON \
 // RUN: -check-prefix LIBDEVICE -check-prefix LIBDEVICE20
-// sm_30, sm_5x and sm_6x map to compute_30
+// sm_30, sm_6x map to compute_30.
 // RUN: %clang -### -v --target=i386-unknown-linux --cuda-gpu-arch=sm_30 \
 // RUN:   --cuda-path=%S/Inputs/CUDA_80/usr/local/cuda %s 2>&1 \
 // RUN:   | FileCheck %s -check-prefix COMMON \
 // RUN: -check-prefix LIBDEVICE -check-prefix LIBDEVICE30
+// sm_5x is a special case. Maps to compute_30 for cuda-7.x only.
 // RUN: %clang -### -v --target=i386-unknown-linux --cuda-gpu-arch=sm_50 \
-// RUN:   --cuda-path=%S/Inputs/CUDA_80/usr/local/cuda %s 2>&1 \
+// RUN:   --cuda-path=%S/Inputs/CUDA/usr/local/cuda %s 2>&1 \
 // RUN:   | FileCheck %s -check-prefix COMMON \
 // RUN: -check-prefix LIBDEVICE -check-prefix LIBDEVICE30
 // RUN: %clang -### -v --target=i386-unknown-linux --cuda-gpu-arch=sm_60 \
@@ -44,6 +45,12 @@
 // RUN:   --cuda-path=%S/Inputs/CUDA_80/usr/local/cuda %s 2>&1 \
 // RUN:   | FileCheck %s -check-prefix COMMON -check-prefix CUDAINC \
 // RUN: -check-prefix LIBDEVICE -check-prefix LIBDEVICE35
+// sm_5x -> compute_50 for CUDA-8.0 and newer.
+// RUN: %clang -### -v --target=i386-unknown-linux --cuda-gpu-arch=sm_50 \
+// RUN:   --cuda-path=%S/Inputs/CUDA_80/usr/local/cuda %s 2>&1 \
+// RUN:   | FileCheck %s -check-prefix COMMON \
+// RUN: -check-prefix LIBDEVICE -check-prefix LIBDEVICE50
+
 
 // Verify that -nocudainc prevents adding include path to CUDA headers.
 // RUN: %clang -### -v --target=i386-unknown-linux --cuda-gpu-arch=sm_35 \
@@ -56,8 +63,8 @@
 // RUN:   | FileCheck %s -check-prefix COMMON -check-prefix NOCUDAINC
 
 // Verify that we get an error if there's no libdevice library to link with.
-// NOTE: Inputs/CUDA deliberately does *not* have libdevice.compute_30  for this purpose.
-// RUN: %clang -### -v --target=i386-unknown-linux --cuda-gpu-arch=sm_30 \
+// NOTE: Inputs/CUDA deliberately does *not* have libdevice.compute_20  for this purpose.
+// RUN: %clang -### -v --target=i386-unknown-linux --cuda-gpu-arch=sm_20 \
 // RUN:   --cuda-path=%S/Inputs/CUDA/usr/local/cuda %s 2>&1 \
 // RUN:   | FileCheck %s -check-prefix COMMON -check-prefix MISSINGLIBDEVICE
 
@@ -81,15 +88,16 @@
 // CHECK: Found CUDA installation: {{.*}}/Inputs/CUDA/usr/local/cuda
 // NOCUDA-NOT: Found CUDA installation:
 
-// MISSINGLIBDEVICE: error: cannot find libdevice for sm_30.
+// MISSINGLIBDEVICE: error: cannot find libdevice for sm_20.
 
 // COMMON: "-triple" "nvptx-nvidia-cuda"
 // COMMON-SAME: "-fcuda-is-device"
 // LIBDEVICE-SAME: "-mlink-cuda-bitcode"
 // NOLIBDEVICE-NOT: "-mlink-cuda-bitcode"
 // LIBDEVICE20-SAME: libdevice.compute_20.10.bc
 // LIBDEVICE30-SAME: libdevice.compute_30.10.bc
 // LIBDEVICE35-SAME: libdevice.compute_35.10.bc
+// LIBDEVICE50-SAME: libdevice.compute_50.10.bc
 // NOLIBDEVICE-NOT: libdevice.compute_{{.*}}.bc
 // LIBDEVICE-SAME: "-target-feature" "+ptx42"
 // NOLIBDEVICE-NOT: "-target-feature" "+ptx42"
Index: lib/Headers/__clang_cuda_runtime_wrapper.h
===
--- lib/Headers/__clang_cuda_runtime_wrapper.h
+++ lib/Headers/__clang_cuda_runtime_wrapper.h
@@ -62,7 +62,7 @@
 #include "cuda.h"
 #if !defined(CUDA_VERSION)
 #error "cuda.h did not define CUDA_VERSION"
-#elif CUDA_VERSION < 7000 || CUDA_VERSION > 7050
+#elif CUDA_VERSION < 7000 || CUDA_VERSION > 8000
 #error "Unsupported CUDA version!"
 #endif
 
@@ -113,6 +113,7 @@
 #undef __cxa_vec_ctor
 #undef __cxa_vec_cctor
 #undef __cxa_vec_dtor
+#undef __cxa_vec_new
 #undef __cxa_vec_new2
 #undef __cxa_vec_new3
 #undef __cxa_vec_delete2
@@ -135,6 +136,25 @@
 // the headers we're about to include.
 #define __host__ UNEXPECTED_HOST_ATTRIBUTE
 
+// CUDA 8.0.41 relies on __USE_FAST_MATH__ and __CUDA_PREC_DIV's values
+// Previous versions used to check thether they are defined or not.
+// CU_DEVICE_INVALID macro is only defined in 8.0.41, so we use it
+// here to detect the switch.
+
+#if defined(CU_DEVICE_INVALID)
+#if defined(__USE_FAST_MATH__) && __USE_FAST_MATH__
+#define __USE_FAST_MATH__ 1
+#else
+#define __USE_FAST_MATH__ 0
+#endif
+
+#if defined(__CUDA_PREC_DIV) && __CUDA_PREC_DIV
+#define 

r282453 - P0145R3 (C++17 evaluation order tweaks): consistently emit the LHS of array

2016-09-26 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Mon Sep 26 18:49:47 2016
New Revision: 282453

URL: http://llvm.org/viewvc/llvm-project?rev=282453=rev
Log:
P0145R3 (C++17 evaluation order tweaks): consistently emit the LHS of array
subscripting before the RHS, regardless of which is the base and which is the
index.

Added:
cfe/trunk/test/CodeGenCXX/cxx1z-eval-order.cpp
Modified:
cfe/trunk/lib/CodeGen/CGExpr.cpp
cfe/trunk/test/CodeGen/captured-statements-nested.c
cfe/trunk/test/CodeGenCXX/catch-undef-behavior.cpp
cfe/trunk/test/CodeGenCXX/cxx1y-initializer-aggregate.cpp
cfe/trunk/test/CodeGenCXX/pragma-loop-safety.cpp
cfe/trunk/test/CodeGenCXX/vla-lambda-capturing.cpp

Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=282453=282452=282453=diff
==
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Mon Sep 26 18:49:47 2016
@@ -2875,13 +2875,30 @@ static Address emitArraySubscriptGEP(Cod
 
 LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E,
bool Accessed) {
-  // The index must always be an integer, which is not an aggregate.  Emit it.
-  llvm::Value *Idx = EmitScalarExpr(E->getIdx());
-  QualType IdxTy  = E->getIdx()->getType();
-  bool IdxSigned = IdxTy->isSignedIntegerOrEnumerationType();
+  // The index must always be an integer, which is not an aggregate.  Emit it
+  // in lexical order (this complexity is, sadly, required by C++17).
+  llvm::Value *IdxPre =
+  (E->getLHS() == E->getIdx()) ? EmitScalarExpr(E->getIdx()) : nullptr;
+  auto EmitIdxAfterBase = [&, IdxPre](bool Promote = true) -> llvm::Value * {
+auto *Idx = IdxPre;
+if (E->getLHS() != E->getIdx()) {
+  assert(E->getRHS() == E->getIdx() && "index was neither LHS nor RHS");
+  Idx = EmitScalarExpr(E->getIdx());
+}
+
+QualType IdxTy = E->getIdx()->getType();
+bool IdxSigned = IdxTy->isSignedIntegerOrEnumerationType();
+
+if (SanOpts.has(SanitizerKind::ArrayBounds))
+  EmitBoundsCheck(E, E->getBase(), Idx, IdxTy, Accessed);
 
-  if (SanOpts.has(SanitizerKind::ArrayBounds))
-EmitBoundsCheck(E, E->getBase(), Idx, IdxTy, Accessed);
+// Extend or truncate the index type to 32 or 64-bits.
+if (Promote && Idx->getType() != IntPtrTy)
+  Idx = Builder.CreateIntCast(Idx, IntPtrTy, IdxSigned, "idxprom");
+
+return Idx;
+  };
+  IdxPre = nullptr;
 
   // If the base is a vector type, then we are forming a vector element lvalue
   // with this subscript.
@@ -2889,6 +2906,7 @@ LValue CodeGenFunction::EmitArraySubscri
   !isa(E->getBase())) {
 // Emit the vector as an lvalue to get its address.
 LValue LHS = EmitLValue(E->getBase());
+auto *Idx = EmitIdxAfterBase(/*Promote*/false);
 assert(LHS.isSimple() && "Can only subscript lvalue vectors here!");
 return LValue::MakeVectorElt(LHS.getAddress(), Idx,
  E->getBase()->getType(),
@@ -2897,13 +2915,10 @@ LValue CodeGenFunction::EmitArraySubscri
 
   // All the other cases basically behave like simple offsetting.
 
-  // Extend or truncate the index type to 32 or 64-bits.
-  if (Idx->getType() != IntPtrTy)
-Idx = Builder.CreateIntCast(Idx, IntPtrTy, IdxSigned, "idxprom");
-
   // Handle the extvector case we ignored above.
   if (isa(E->getBase())) {
 LValue LV = EmitLValue(E->getBase());
+auto *Idx = EmitIdxAfterBase(/*Promote*/true);
 Address Addr = EmitExtVectorElementLValue(LV);
 
 QualType EltType = LV.getType()->castAs()->getElementType();
@@ -2919,6 +2934,7 @@ LValue CodeGenFunction::EmitArraySubscri
 // it.  It needs to be emitted first in case it's what captures
 // the VLA bounds.
 Addr = EmitPointerWithAlignment(E->getBase(), );
+auto *Idx = EmitIdxAfterBase(/*Promote*/true);
 
 // The element count here is the total number of non-VLA elements.
 llvm::Value *numElements = getVLASize(vla).first;
@@ -2938,14 +2954,16 @@ LValue CodeGenFunction::EmitArraySubscri
 
   } else if (const ObjCObjectType *OIT = 
E->getType()->getAs()){
 // Indexing over an interface, as in "NSString *P; P[4];"
-CharUnits InterfaceSize = getContext().getTypeSizeInChars(OIT);
-llvm::Value *InterfaceSizeVal = 
-  llvm::ConstantInt::get(Idx->getType(), InterfaceSize.getQuantity());;
-
-llvm::Value *ScaledIdx = Builder.CreateMul(Idx, InterfaceSizeVal);
 
 // Emit the base pointer.
 Addr = EmitPointerWithAlignment(E->getBase(), );
+auto *Idx = EmitIdxAfterBase(/*Promote*/true);
+
+CharUnits InterfaceSize = getContext().getTypeSizeInChars(OIT);
+llvm::Value *InterfaceSizeVal =
+llvm::ConstantInt::get(Idx->getType(), InterfaceSize.getQuantity());
+
+llvm::Value *ScaledIdx = Builder.CreateMul(Idx, InterfaceSizeVal);
 
 // We don't necessarily build correct LLVM struct types 

[PATCH] D24945: [libc++abi] Default to DLL annotations on Windows

2016-09-26 Thread Shoaib Meenai via cfe-commits
smeenai created this revision.
smeenai added reviewers: compnerd, EricWF, mclow.lists.
smeenai added a subscriber: cfe-commits.
Herald added subscribers: mgorny, beanz.

`__declspec(dllexport)` and `__declspec(dllimport)` should only be used
when building libc++abi as a DLL, but that's the more common use case,
so default to adding the annotations and add an option to opt out.

Similar to r282449, which made the corresponding change for libc++.

https://reviews.llvm.org/D24945

Files:
  CMakeLists.txt
  include/__cxxabi_config.h

Index: include/__cxxabi_config.h
===
--- include/__cxxabi_config.h
+++ include/__cxxabi_config.h
@@ -21,8 +21,13 @@
 #define __has_attribute(_attribute_) 0
 #endif
 
-#if defined(_LIBCXXABI_DLL)
- #if defined(cxxabi_EXPORTS)
+#if defined(_WIN32)
+ #if defined(_LIBCXXABI_DISABLE_DLL_IMPORT_EXPORT)
+  #define _LIBCXXABI_HIDDEN
+  #define _LIBCXXABI_DATA_VIS
+  #define _LIBCXXABI_FUNC_VIS
+  #define _LIBCXXABI_TYPE_VIS
+ #elif defined(_LIBCXXABI_BUILDING_LIBRARY)
   #define _LIBCXXABI_HIDDEN
   #define _LIBCXXABI_DATA_VIS __declspec(dllexport)
   #define _LIBCXXABI_FUNC_VIS __declspec(dllexport)
Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -249,6 +249,10 @@
   list(APPEND LIBCXXABI_LINK_FLAGS "-rtlib=compiler-rt")
 endif()
 
+# Let the library headers know they are currently being used to build the
+# library.
+add_definitions(-D_LIBCXXABI_BUILDING_LIBRARY)
+
 append_if(LIBCXXABI_COMPILE_FLAGS LIBCXXABI_HAS_WERROR_FLAG 
-Werror=return-type)
 
 # Get warning flags
@@ -333,7 +337,6 @@
   add_definitions(-D_LIBCPP_HAS_THREAD_API_PTHREAD)
 endif()
 
-# This is the _ONLY_ place where add_definitions is called.
 if (MSVC)
   add_definitions(-D_CRT_SECURE_NO_WARNINGS)
 endif()


Index: include/__cxxabi_config.h
===
--- include/__cxxabi_config.h
+++ include/__cxxabi_config.h
@@ -21,8 +21,13 @@
 #define __has_attribute(_attribute_) 0
 #endif
 
-#if defined(_LIBCXXABI_DLL)
- #if defined(cxxabi_EXPORTS)
+#if defined(_WIN32)
+ #if defined(_LIBCXXABI_DISABLE_DLL_IMPORT_EXPORT)
+  #define _LIBCXXABI_HIDDEN
+  #define _LIBCXXABI_DATA_VIS
+  #define _LIBCXXABI_FUNC_VIS
+  #define _LIBCXXABI_TYPE_VIS
+ #elif defined(_LIBCXXABI_BUILDING_LIBRARY)
   #define _LIBCXXABI_HIDDEN
   #define _LIBCXXABI_DATA_VIS __declspec(dllexport)
   #define _LIBCXXABI_FUNC_VIS __declspec(dllexport)
Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -249,6 +249,10 @@
   list(APPEND LIBCXXABI_LINK_FLAGS "-rtlib=compiler-rt")
 endif()
 
+# Let the library headers know they are currently being used to build the
+# library.
+add_definitions(-D_LIBCXXABI_BUILDING_LIBRARY)
+
 append_if(LIBCXXABI_COMPILE_FLAGS LIBCXXABI_HAS_WERROR_FLAG -Werror=return-type)
 
 # Get warning flags
@@ -333,7 +337,6 @@
   add_definitions(-D_LIBCPP_HAS_THREAD_API_PTHREAD)
 endif()
 
-# This is the _ONLY_ place where add_definitions is called.
 if (MSVC)
   add_definitions(-D_CRT_SECURE_NO_WARNINGS)
 endif()
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D14259: The maximum alignment of std::aligned_storage applies to all Windows compilers

2016-09-26 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko added a subscriber: Eugene.Zelenko.
Eugene.Zelenko added a comment.

Looks like patch was not committed.


https://reviews.llvm.org/D14259



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


Re: [PATCH] D14353: Allow use of private headers in different sub-modules.

2016-09-26 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko added a subscriber: Eugene.Zelenko.
Eugene.Zelenko closed this revision.
Eugene.Zelenko added a comment.

Committed in https://reviews.llvm.org/rL252170.


https://reviews.llvm.org/D14353



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


[PATCH] D24944: [CUDA] Added __nvvm_atom_{sys|cta}_* builtins for sm_60 GPUs.

2016-09-26 Thread Artem Belevich via cfe-commits
tra created this revision.
tra added a reviewer: jlebar.
tra added a subscriber: cfe-commits.
Herald added subscribers: jlebar, jholewinski.

https://reviews.llvm.org/D24944

Files:
  include/clang/Basic/BuiltinsNVPTX.def
  lib/Basic/Targets.cpp
  lib/CodeGen/CGBuiltin.cpp
  test/CodeGen/builtins-nvptx.c

Index: test/CodeGen/builtins-nvptx.c
===
--- test/CodeGen/builtins-nvptx.c
+++ test/CodeGen/builtins-nvptx.c
@@ -1,8 +1,12 @@
 // REQUIRES: nvptx-registered-target
-// RUN: %clang_cc1 -triple nvptx-unknown-unknown -fcuda-is-device -S -emit-llvm -o - -x cuda %s | \
-// RUN:   FileCheck -check-prefix=CHECK -check-prefix=LP32 %s
-// RUN: %clang_cc1 -triple nvptx64-unknown-unknown -fcuda-is-device -S -emit-llvm -o - -x cuda %s | \
-// RUN:   FileCheck -check-prefix=CHECK -check-prefix=LP64 %s
+// RUN: %clang_cc1 -triple nvptx-unknown-unknown -target-cpu sm_60 \
+// RUN:-fcuda-is-device -S -emit-llvm -o - -x cuda %s \
+// RUN:   | FileCheck -check-prefix=CHECK -check-prefix=LP32 %s
+// RUN: %clang_cc1 -triple nvptx64-unknown-unknown -target-cpu sm_60 \
+// RUN:-fcuda-is-device -S -emit-llvm -o - -x cuda %s \
+// RUN:   | FileCheck -check-prefix=CHECK -check-prefix=LP64 %s
+// RUN: %clang_cc1 -triple nvptx-unknown-unknown -target-cpu sm_53 \
+// RUN:   -DERROR_CHECK -fcuda-is-device -S -o /dev/null -x cuda -verify %s
 
 #define __device__ __attribute__((device))
 #define __global__ __attribute__((global))
@@ -191,8 +195,9 @@
 
 // Check for atomic intrinsics
 // CHECK-LABEL: nvvm_atom
-__device__ void nvvm_atom(float *fp, float f, int *ip, int i, unsigned int *uip, unsigned ui, long *lp, long l,
-  long long *llp, long long ll) {
+__device__ void nvvm_atom(float *fp, float f, double *dfp, double df, int *ip,
+  int i, unsigned int *uip, unsigned ui, long *lp,
+  long l, long long *llp, long long ll) {
   // CHECK: atomicrmw add
   __nvvm_atom_add_gen_i(ip, i);
   // CHECK: atomicrmw add
@@ -280,6 +285,255 @@
   // CHECK: call i32 @llvm.nvvm.atomic.load.dec.32.p0i32
   __nvvm_atom_dec_gen_ui(uip, ui);
 
+
+  //
+  // Atomics with scope (only supported on sm_60+).
+
+#if ERROR_CHECK || __CUDA_ARCH__ >= 600
+
+  // CHECK: call i32 @llvm.nvvm.atomic.add.gen.i.cta.i32.p0i32
+  // expected-error@+1 {{'__nvvm_atom_cta_add_gen_i' needs target feature satom}}
+  __nvvm_atom_cta_add_gen_i(ip, i);
+  // LP32: call i32 @llvm.nvvm.atomic.add.gen.i.cta.i32.p0i32
+  // LP64: call i64 @llvm.nvvm.atomic.add.gen.i.cta.i64.p0i64
+  // expected-error@+1 {{'__nvvm_atom_cta_add_gen_l' needs target feature satom}}
+  __nvvm_atom_cta_add_gen_l(, l);
+  // CHECK: call i64 @llvm.nvvm.atomic.add.gen.i.cta.i64.p0i64
+  // expected-error@+1 {{'__nvvm_atom_cta_add_gen_ll' needs target feature satom}}
+  __nvvm_atom_cta_add_gen_ll(, ll);
+  // CHECK: call i32 @llvm.nvvm.atomic.add.gen.i.sys.i32.p0i32
+  // expected-error@+1 {{'__nvvm_atom_sys_add_gen_i' needs target feature satom}}
+  __nvvm_atom_sys_add_gen_i(ip, i);
+  // LP32: call i32 @llvm.nvvm.atomic.add.gen.i.sys.i32.p0i32
+  // LP64: call i64 @llvm.nvvm.atomic.add.gen.i.sys.i64.p0i64
+  // expected-error@+1 {{'__nvvm_atom_sys_add_gen_l' needs target feature satom}}
+  __nvvm_atom_sys_add_gen_l(, l);
+  // CHECK: call i64 @llvm.nvvm.atomic.add.gen.i.sys.i64.p0i64
+  // expected-error@+1 {{'__nvvm_atom_sys_add_gen_ll' needs target feature satom}}
+  __nvvm_atom_sys_add_gen_ll(, ll);
+
+  // CHECK: call float @llvm.nvvm.atomic.add.gen.f.cta.f32.p0f32
+  // expected-error@+1 {{'__nvvm_atom_cta_add_gen_f' needs target feature satom}}
+  __nvvm_atom_cta_add_gen_f(fp, f);
+  // CHECK: call double @llvm.nvvm.atomic.add.gen.f.cta.f64.p0f64
+  // expected-error@+1 {{'__nvvm_atom_cta_add_gen_d' needs target feature satom}}
+  __nvvm_atom_cta_add_gen_d(dfp, df);
+  // CHECK: call float @llvm.nvvm.atomic.add.gen.f.sys.f32.p0f32
+  // expected-error@+1 {{'__nvvm_atom_sys_add_gen_f' needs target feature satom}}
+  __nvvm_atom_sys_add_gen_f(fp, f);
+  // CHECK: call double @llvm.nvvm.atomic.add.gen.f.sys.f64.p0f64
+  // expected-error@+1 {{'__nvvm_atom_sys_add_gen_d' needs target feature satom}}
+  __nvvm_atom_sys_add_gen_d(dfp, df);
+
+  // CHECK: call i32 @llvm.nvvm.atomic.exch.gen.i.cta.i32.p0i32
+  // expected-error@+1 {{'__nvvm_atom_cta_xchg_gen_i' needs target feature satom}}
+  __nvvm_atom_cta_xchg_gen_i(ip, i);
+  // LP32: call i32 @llvm.nvvm.atomic.exch.gen.i.cta.i32.p0i32
+  // LP64: call i64 @llvm.nvvm.atomic.exch.gen.i.cta.i64.p0i64
+  // expected-error@+1 {{'__nvvm_atom_cta_xchg_gen_l' needs target feature satom}}
+  __nvvm_atom_cta_xchg_gen_l(, l);
+  // CHECK: call i64 @llvm.nvvm.atomic.exch.gen.i.cta.i64.p0i64
+  // expected-error@+1 {{'__nvvm_atom_cta_xchg_gen_ll' needs target feature satom}}
+  __nvvm_atom_cta_xchg_gen_ll(, ll);
+
+  // CHECK: call i32 

[libcxx] r282446 - [libc++] Fix typos causing compilation errors when _LIBCPP_DEBUG_LEVEL >= 2

2016-09-26 Thread Oleg Ranevskyy via cfe-commits
Author: oleg
Date: Mon Sep 26 16:39:38 2016
New Revision: 282446

URL: http://llvm.org/viewvc/llvm-project?rev=282446=rev
Log:
[libc++] Fix typos causing compilation errors when _LIBCPP_DEBUG_LEVEL >= 2

Summary: This patch fixes a couple of typos that cause compilation errors when 
application includes  and enables the libc++'s debugging 
capabilities.

Reviewers: EricWF

Subscribers: llvm-commits

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

Modified:
libcxx/trunk/include/unordered_map

Modified: libcxx/trunk/include/unordered_map
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/unordered_map?rev=282446=282445=282446=diff
==
--- libcxx/trunk/include/unordered_map (original)
+++ libcxx/trunk/include/unordered_map Mon Sep 26 16:39:38 2016
@@ -1012,7 +1012,7 @@ public:
 iterator try_emplace(const_iterator __h, const key_type& __k, 
_Args&&... __args)
 {
 #if _LIBCPP_DEBUG_LEVEL >= 2
-_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
+_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__h) == this,
 "unordered_map::try_emplace(const_iterator, key, args...) called 
with an iterator not"
 " referring to this unordered_map");
 #endif
@@ -1024,7 +1024,7 @@ public:
 iterator try_emplace(const_iterator __h, key_type&& __k, _Args&&... 
__args)
 {
 #if _LIBCPP_DEBUG_LEVEL >= 2
-_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
+_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__h) == this,
 "unordered_map::try_emplace(const_iterator, key, args...) called 
with an iterator not"
 " referring to this unordered_map");
 #endif


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


Re: [PATCH] D24864: [libcxxabi] Refactor pthread usage into a separate API

2016-09-26 Thread Eric Fiselier via cfe-commits
EricWF added a comment.

LGTM other than the inline comments. I'll give it a final once over tonight or 
tomorrow.



Comment at: include/__cxxabi_config.h:36
@@ -35,1 +35,3 @@
  #endif
+ #if defined(_MSC_VER) && !defined(__clang__)
+  // Using Microsoft Visual C++ compiler

Does this configuration need to be in a public header if it's only used 
internally? I think `config.h` or `threading_support.h` would be a better place 
for this to live.


Comment at: src/config.h:22
@@ +21,3 @@
+
+#if defined(__GNUC__) || defined(__clang__)
+#define _LIBCXXABI_PRAGMA(_parameter_) _Pragma(#_parameter_)

What's the point of defining `_LIBCXXABI_WARNING`? It's unused and seems 
unneeded.


Comment at: src/fallback_malloc.ipp:30
@@ -29,3 +29,3 @@
 #ifndef _LIBCXXABI_HAS_NO_THREADS
-static pthread_mutex_t heap_mutex = PTHREAD_MUTEX_INITIALIZER;
+static __libcxxabi_mutex_t heap_mutex = PTHREAD_MUTEX_INITIALIZER;
 #else

s/`PTHREAD_MUTEX_INITIALIZER`/`_LIBCXXABI_MUTEX_INITIALIZER`


https://reviews.llvm.org/D24864



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


Re: [PATCH] D24372: [libcxx] Sprinkle constexpr over compressed_pair

2016-09-26 Thread Keno Fischer via cfe-commits
loladiro updated this revision to Diff 72581.
loladiro added a comment.

back to _VSTD::forward, address review comments, add tests for non-empty 
deleter and unique_ptrs of arrays.


Repository:
  rL LLVM

https://reviews.llvm.org/D24372

Files:
  include/memory
  test/std/utilities/memory/unique.ptr/unique.ptr.runtime/constinit.pass.cpp
  test/std/utilities/memory/unique.ptr/unique.ptr.single/constinit.pass.cpp

Index: test/std/utilities/memory/unique.ptr/unique.ptr.single/constinit.pass.cpp
===
--- /dev/null
+++ test/std/utilities/memory/unique.ptr/unique.ptr.single/constinit.pass.cpp
@@ -0,0 +1,70 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// UNSUPPORTED: c++98, c++03
+
+#include 
+#include 
+
+#ifndef _LIBCPP_SAFE_STATIC
+#define _LIBCPP_SAFE_STATIC
+#endif
+
+// This is basically std::default delete, except that it is not empty such that
+// we test a different code path in the implementation
+template  struct nonempty_delete {
+  uint32_t sentinel;
+  inline constexpr nonempty_delete() noexcept : sentinel(0xDEADBEEF) {}
+  template 
+  constexpr inline nonempty_delete(
+  const nonempty_delete &,
+  typename std::enable_if::type * =
+  0) noexcept : sentinel(0xBAADF00D) {}
+  inline void operator()(Tp *ptr) const noexcept {
+assert(sentinel == 0xDEADBEEF || sentinel == 0xBAADF00D);
+delete ptr;
+  }
+};
+
+extern std::unique_ptr a;
+extern std::unique_ptr b;
+extern std::unique_ptr c;
+extern std::unique_ptr d;
+void *tramplea = std::memset(, 0xab, sizeof(a));
+void *trampleb = std::memset(, 0xab, sizeof(b));
+void *tramplec = std::memset(, 0xab, sizeof(c));
+void *trampled = std::memset(, 0xab, sizeof(d));
+_LIBCPP_SAFE_STATIC std::unique_ptr a;
+_LIBCPP_SAFE_STATIC std::unique_ptr b(nullptr);
+_LIBCPP_SAFE_STATIC std::unique_ptr c;
+_LIBCPP_SAFE_STATIC std::unique_ptr d(nullptr);
+
+int main() {
+  // Check that the initialization of 'a' was performed before the
+  // initialization of 'tramplea'.
+  for (size_t n = 0; n != sizeof(a); ++n)
+assert(reinterpret_cast(tramplea)[n] == 0xab);
+  // Check that the initialization of 'b' was performed before the
+  // initialization of 'trampleb'.
+  for (size_t n = 0; n != sizeof(b); ++n)
+assert(reinterpret_cast(trampleb)[n] == 0xab);
+  // Check that the initialization of 'c' was performed before the
+  // initialization of 'tramplec'.
+  for (size_t n = 0; n != sizeof(c); ++n)
+assert(reinterpret_cast(tramplec)[n] == 0xab);
+  // Check that the initialization of 'd' was performed before the
+  // initialization of 'trampled'.
+  for (size_t n = 0; n != sizeof(d); ++n)
+assert(reinterpret_cast(trampled)[n] == 0xab);
+  // Put a unique_ptr object back so that the global dtor is valid.
+  new () std::unique_ptr;
+  new () std::unique_ptr;
+  new () std::unique_ptr;
+  new () std::unique_ptr;
+}
Index: test/std/utilities/memory/unique.ptr/unique.ptr.runtime/constinit.pass.cpp
===
--- /dev/null
+++ test/std/utilities/memory/unique.ptr/unique.ptr.runtime/constinit.pass.cpp
@@ -0,0 +1,70 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// UNSUPPORTED: c++98, c++03
+
+#include 
+#include 
+
+#ifndef _LIBCPP_SAFE_STATIC
+#define _LIBCPP_SAFE_STATIC
+#endif
+
+// This is basically std::default delete, except that it is not empty such that
+// we test a different code path in the implementation
+template  struct nonempty_delete {
+  uint32_t sentinel;
+  inline constexpr nonempty_delete() noexcept : sentinel(0xDEADBEEF) {}
+  template 
+  constexpr inline nonempty_delete(
+  const nonempty_delete &,
+  typename std::enable_if::type * =
+  0) noexcept : sentinel(0xBAADF00D) {}
+  inline void operator()(Tp *ptr) const noexcept {
+assert(sentinel == 0xDEADBEEF || sentinel == 0xBAADF00D);
+delete[] ptr;
+  }
+};
+
+extern std::unique_ptr a;
+extern std::unique_ptr b;
+extern std::unique_ptr c;
+extern std::unique_ptr d;
+void *tramplea = std::memset(, 0xab, sizeof(a));
+void *trampleb = 

Re: [PATCH] D24914: [clang-rename] Do not print out error message upon encountering multiple replacements in the same SourceLocation.

2016-09-26 Thread Alexander Kornienko via cfe-commits
alexfh requested changes to this revision.
This revision now requires changes to proceed.


Comment at: clang-rename/RenamingAction.cpp:73
@@ -73,1 +72,3 @@
   llvm::Error Err = FileToReplaces[Replace.getFilePath()].add(Replace);
+  // FIXME: As for clang-rename, replacement fails IFF either the AST node
+  // has been matched multiple times (which shouldn't happen in reality,

Did you mean "adding a replacement fails..."?


Comment at: clang-rename/RenamingAction.cpp:75
@@ +74,3 @@
+  // has been matched multiple times (which shouldn't happen in reality,
+  // need to fix that) or when it's a specific header. For now, just 
ignore 
+  // the error that happened as it doesn't mean a failure.

"Specific header"? What exactly does it mean here?


https://reviews.llvm.org/D24914



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


Re: [PATCH] D24877: [libc++] Default to DLL semantics on Windows

2016-09-26 Thread Shoaib Meenai via cfe-commits
smeenai abandoned this revision.
smeenai added a comment.

Your patch looks good to me and is a nicer way of accomplishing this. Thanks 
for taking care of it!


https://reviews.llvm.org/D24877



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


Re: [PATCH] D24609: [ARM] Add missing Interlocked intrinsics

2016-09-26 Thread Saleem Abdulrasool via cfe-commits
compnerd closed this revision.
compnerd added a comment.

r282447


https://reviews.llvm.org/D24609



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


Re: [PATCH] D24877: [libc++] Default to DLL semantics on Windows

2016-09-26 Thread Eric Fiselier via cfe-commits
EricWF resigned from this revision.
EricWF removed a reviewer: EricWF.
EricWF added a comment.

I fixed this with a slightly different patch in r282449. I hope you don't mind 
that I didn't use this patch, I just wanted to add support for generating 
custom __config headers for static builds on Windows. Let me know if you have 
any issues with my patch.

Resigning as a reviewer since this issue is fixed.


https://reviews.llvm.org/D24877



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


Re: [PATCH] D15643: [clang-format] Don't allow newline after uppercase Obj-C block return types

2016-09-26 Thread Daniel Jasper via cfe-commits
djasper closed this revision.
djasper added a comment.

Committed as r282448.


https://reviews.llvm.org/D15643



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


[libcxx] r282449 - Expect DLL builds on Windows by default and require a custom __config for static

2016-09-26 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Mon Sep 26 17:19:41 2016
New Revision: 282449

URL: http://llvm.org/viewvc/llvm-project?rev=282449=rev
Log:
Expect DLL builds on Windows by default and require a custom __config for static
builds.

On Windows the __declspec(dllimport) and __declspec(dllexport) attributes
require linking to a DLL, not a static library. Previously these annotations
were disabled by default unless _LIBCPP_DLL was defined. However the DLL
configuration is probably the more common one, so it should be supported by
default.

This patch enables import/export attributes by default and adds a
_LIBCPP_DISABLE_DLL_IMPORT_EXPORT macro which can be used to disable this
behavior. If libc++ is built as a static library on Windows then a custom 
__config
header will be generated that predefines this macro.

This patch is based off work by Shoaib Meenai.

Modified:
libcxx/trunk/CMakeLists.txt
libcxx/trunk/include/__config
libcxx/trunk/include/__config_site.in

Modified: libcxx/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.txt?rev=282449=282448=282449=diff
==
--- libcxx/trunk/CMakeLists.txt (original)
+++ libcxx/trunk/CMakeLists.txt Mon Sep 26 17:19:41 2016
@@ -330,6 +330,8 @@ endif()
 # headers
 add_compile_flags_if_supported(-nostdinc++)
 
+# Let the library headers know they are currently being used to build the
+# library.
 add_definitions(-D_LIBCPP_BUILDING_LIBRARY)
 
 # Warning flags ===
@@ -455,6 +457,14 @@ config_define_if(LIBCXX_HAS_PTHREAD_API
 config_define_if(LIBCXX_HAS_EXTERNAL_THREAD_API 
_LIBCPP_HAS_THREAD_API_EXTERNAL)
 config_define_if(LIBCXX_HAS_MUSL_LIBC _LIBCPP_HAS_MUSL_LIBC)
 
+# By default libc++ on Windows expects to use a shared library, which requires
+# the headers to use DLL import/export semantics. However when building a
+# static library only we modify the headers to disable DLL import/export.
+if (DEFINED WIN32 AND LIBCXX_ENABLE_STATIC AND NOT LIBCXX_ENABLE_SHARED)
+  message(STATUS "Generating custom __config for non-DLL Windows build")
+  config_define(ON _LIBCPP_DISABLE_DLL_IMPORT_EXPORT)
+endif()
+
 if (LIBCXX_NEEDS_SITE_CONFIG)
   configure_file(
 include/__config_site.in

Modified: libcxx/trunk/include/__config
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=282449=282448=282449=diff
==
--- libcxx/trunk/include/__config (original)
+++ libcxx/trunk/include/__config Mon Sep 26 17:19:41 2016
@@ -519,20 +519,20 @@ namespace std {
 
 
 #ifdef _WIN32
-// only really useful for a DLL. _LIBCPP_DLL should be a compiler builtin 
define ideally...
-#if defined(_LIBCPP_DLL) && defined(cxx_EXPORTS)
+#if defined(_LIBCPP_DISABLE_DLL_IMPORT_EXPORT)
+# define _LIBCPP_DLL_VIS
+# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
+# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
+#elif defined(_LIBCPP_BUILDING_LIBRARY)
 # define _LIBCPP_DLL_VIS __declspec(dllexport)
 # define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
 # define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS _LIBCPP_DLL_VIS
-#elif defined(_LIBCPP_DLL)
+#else
 # define _LIBCPP_DLL_VIS __declspec(dllimport)
 # define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS _LIBCPP_DLL_VIS
 # define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
-#else
-# define _LIBCPP_DLL_VIS
-# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
-# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
 #endif
+
 #define _LIBCPP_TYPE_VIS_LIBCPP_DLL_VIS
 #define _LIBCPP_FUNC_VIS_LIBCPP_DLL_VIS
 #define _LIBCPP_EXCEPTION_ABI   _LIBCPP_DLL_VIS

Modified: libcxx/trunk/include/__config_site.in
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config_site.in?rev=282449=282448=282449=diff
==
--- libcxx/trunk/include/__config_site.in (original)
+++ libcxx/trunk/include/__config_site.in Mon Sep 26 17:19:41 2016
@@ -21,5 +21,6 @@
 #cmakedefine _LIBCPP_HAS_MUSL_LIBC
 #cmakedefine _LIBCPP_HAS_THREAD_API_PTHREAD
 #cmakedefine _LIBCPP_HAS_THREAD_API_EXTERNAL
+#cmakedefine _LIBCPP_DISABLE_DLL_IMPORT_EXPORT
 
 #endif // _LIBCPP_CONFIG_SITE


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


r282448 - [clang-format] Don't allow newline after uppercase Obj-C block return types

2016-09-26 Thread Daniel Jasper via cfe-commits
Author: djasper
Date: Mon Sep 26 17:19:08 2016
New Revision: 282448

URL: http://llvm.org/viewvc/llvm-project?rev=282448=rev
Log:
[clang-format] Don't allow newline after uppercase Obj-C block return types

Fixes the following:
  BOOL (^aaa)(void) = ^BOOL {
  };

The first BOOL's token was getting set to TT_FunctionAnnotationRParen
incorrectly, which was causing an unexpected newline after (^aaa). This
was introduced in r245846.

Patch by Kent Sutherland, thank you!

Modified:
cfe/trunk/lib/Format/TokenAnnotator.cpp
cfe/trunk/unittests/Format/FormatTest.cpp

Modified: cfe/trunk/lib/Format/TokenAnnotator.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/TokenAnnotator.cpp?rev=282448=282447=282448=diff
==
--- cfe/trunk/lib/Format/TokenAnnotator.cpp (original)
+++ cfe/trunk/lib/Format/TokenAnnotator.cpp Mon Sep 26 17:19:08 2016
@@ -1037,12 +1037,17 @@ private:
   !Current.Next->isBinaryOperator() &&
   !Current.Next->isOneOf(tok::semi, tok::colon, tok::l_brace,
  tok::period, tok::arrow, tok::coloncolon))
-if (FormatToken *BeforeParen = Current.MatchingParen->Previous)
-  if (BeforeParen->is(tok::identifier) &&
-  BeforeParen->TokenText == BeforeParen->TokenText.upper() &&
-  (!BeforeParen->Previous ||
-   BeforeParen->Previous->ClosesTemplateDeclaration))
-Current.Type = TT_FunctionAnnotationRParen;
+if (FormatToken *AfterParen = Current.MatchingParen->Next) {
+  // Make sure this isn't the return type of an Obj-C block declaration
+  if (AfterParen->Tok.isNot(tok::caret)) {
+if (FormatToken *BeforeParen = Current.MatchingParen->Previous)
+  if (BeforeParen->is(tok::identifier) &&
+  BeforeParen->TokenText == BeforeParen->TokenText.upper() &&
+  (!BeforeParen->Previous ||
+   BeforeParen->Previous->ClosesTemplateDeclaration))
+Current.Type = TT_FunctionAnnotationRParen;
+  }
+}
 } else if (Current.is(tok::at) && Current.Next) {
   if (Current.Next->isStringLiteral()) {
 Current.Type = TT_ObjCStringLiteral;

Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=282448=282447=282448=diff
==
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Mon Sep 26 17:19:08 2016
@@ -11156,6 +11156,8 @@ TEST_F(FormatTest, FormatsBlocks) {
"  }\n"
"});");
   verifyFormat("Block b = ^int *(A *a, B *b) {}");
+  verifyFormat("BOOL (^aaa)(void) = ^BOOL {\n"
+   "};");
 
   FormatStyle FourIndent = getLLVMStyle();
   FourIndent.ObjCBlockIndentWidth = 4;


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


Re: [PATCH] D15643: [clang-format] Don't allow newline after uppercase Obj-C block return types

2016-09-26 Thread Kent Sutherland via cfe-commits
ksuther updated this revision to Diff 72578.
ksuther added a comment.

Added a unit test.


https://reviews.llvm.org/D15643

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

Index: unittests/Format/FormatTest.cpp
===
--- unittests/Format/FormatTest.cpp
+++ unittests/Format/FormatTest.cpp
@@ -11156,6 +11156,8 @@
"  }\n"
"});");
   verifyFormat("Block b = ^int *(A *a, B *b) {}");
+  verifyFormat("BOOL (^aaa)(void) = ^BOOL {\n"
+   "};");
 
   FormatStyle FourIndent = getLLVMStyle();
   FourIndent.ObjCBlockIndentWidth = 4;
Index: lib/Format/TokenAnnotator.cpp
===
--- lib/Format/TokenAnnotator.cpp
+++ lib/Format/TokenAnnotator.cpp
@@ -1037,12 +1037,17 @@
   !Current.Next->isBinaryOperator() &&
   !Current.Next->isOneOf(tok::semi, tok::colon, tok::l_brace,
  tok::period, tok::arrow, tok::coloncolon))
-if (FormatToken *BeforeParen = Current.MatchingParen->Previous)
-  if (BeforeParen->is(tok::identifier) &&
-  BeforeParen->TokenText == BeforeParen->TokenText.upper() &&
-  (!BeforeParen->Previous ||
-   BeforeParen->Previous->ClosesTemplateDeclaration))
-Current.Type = TT_FunctionAnnotationRParen;
+if (FormatToken *AfterParen = Current.MatchingParen->Next) {
+  // Make sure this isn't the return type of an Obj-C block declaration
+  if (AfterParen->Tok.isNot(tok::caret)) {
+if (FormatToken *BeforeParen = Current.MatchingParen->Previous)
+  if (BeforeParen->is(tok::identifier) &&
+  BeforeParen->TokenText == BeforeParen->TokenText.upper() &&
+  (!BeforeParen->Previous ||
+   BeforeParen->Previous->ClosesTemplateDeclaration))
+Current.Type = TT_FunctionAnnotationRParen;
+  }
+   }
 } else if (Current.is(tok::at) && Current.Next) {
   if (Current.Next->isStringLiteral()) {
 Current.Type = TT_ObjCStringLiteral;


Index: unittests/Format/FormatTest.cpp
===
--- unittests/Format/FormatTest.cpp
+++ unittests/Format/FormatTest.cpp
@@ -11156,6 +11156,8 @@
"  }\n"
"});");
   verifyFormat("Block b = ^int *(A *a, B *b) {}");
+  verifyFormat("BOOL (^aaa)(void) = ^BOOL {\n"
+   "};");
 
   FormatStyle FourIndent = getLLVMStyle();
   FourIndent.ObjCBlockIndentWidth = 4;
Index: lib/Format/TokenAnnotator.cpp
===
--- lib/Format/TokenAnnotator.cpp
+++ lib/Format/TokenAnnotator.cpp
@@ -1037,12 +1037,17 @@
   !Current.Next->isBinaryOperator() &&
   !Current.Next->isOneOf(tok::semi, tok::colon, tok::l_brace,
  tok::period, tok::arrow, tok::coloncolon))
-if (FormatToken *BeforeParen = Current.MatchingParen->Previous)
-  if (BeforeParen->is(tok::identifier) &&
-  BeforeParen->TokenText == BeforeParen->TokenText.upper() &&
-  (!BeforeParen->Previous ||
-   BeforeParen->Previous->ClosesTemplateDeclaration))
-Current.Type = TT_FunctionAnnotationRParen;
+if (FormatToken *AfterParen = Current.MatchingParen->Next) {
+  // Make sure this isn't the return type of an Obj-C block declaration
+  if (AfterParen->Tok.isNot(tok::caret)) {
+if (FormatToken *BeforeParen = Current.MatchingParen->Previous)
+  if (BeforeParen->is(tok::identifier) &&
+  BeforeParen->TokenText == BeforeParen->TokenText.upper() &&
+  (!BeforeParen->Previous ||
+   BeforeParen->Previous->ClosesTemplateDeclaration))
+Current.Type = TT_FunctionAnnotationRParen;
+  }
+		}
 } else if (Current.is(tok::at) && Current.Next) {
   if (Current.Next->isStringLiteral()) {
 Current.Type = TT_ObjCStringLiteral;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r282447 - headers: add missing Windows ARM Interlocked intrinsics

2016-09-26 Thread Saleem Abdulrasool via cfe-commits
Author: compnerd
Date: Mon Sep 26 17:12:43 2016
New Revision: 282447

URL: http://llvm.org/viewvc/llvm-project?rev=282447=rev
Log:
headers: add missing Windows ARM Interlocked intrinsics

On ARM, there are multiple versions of each of the intrinsics, with
acquire/relaxed/release barrier semantics.

The newly added ones are provided as inline functions here instead of builtins,
since they should only be available on certain archs (arm/aarch64).

This is necessary in order to compile C++ code for ARM in MSVC mode.

Patch by Martin Storsjö!

Modified:
cfe/trunk/lib/Headers/intrin.h

Modified: cfe/trunk/lib/Headers/intrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/intrin.h?rev=282447=282446=282447=diff
==
--- cfe/trunk/lib/Headers/intrin.h (original)
+++ cfe/trunk/lib/Headers/intrin.h Mon Sep 26 17:12:43 2016
@@ -490,6 +490,23 @@ _interlockedbittestandset(long volatile
   long _PrevVal = __atomic_fetch_or(_BitBase, 1l << _BitPos, __ATOMIC_SEQ_CST);
   return (_PrevVal >> _BitPos) & 1;
 }
+#if defined(__arm__) || defined(__aarch64__)
+static __inline__ unsigned char __DEFAULT_FN_ATTRS
+_interlockedbittestandset_acq(long volatile *_BitBase, long _BitPos) {
+  long _PrevVal = __atomic_fetch_or(_BitBase, 1l << _BitPos, __ATOMIC_ACQUIRE);
+  return (_PrevVal >> _BitPos) & 1;
+}
+static __inline__ unsigned char __DEFAULT_FN_ATTRS
+_interlockedbittestandset_nf(long volatile *_BitBase, long _BitPos) {
+  long _PrevVal = __atomic_fetch_or(_BitBase, 1l << _BitPos, __ATOMIC_RELAXED);
+  return (_PrevVal >> _BitPos) & 1;
+}
+static __inline__ unsigned char __DEFAULT_FN_ATTRS
+_interlockedbittestandset_rel(long volatile *_BitBase, long _BitPos) {
+  long _PrevVal = __atomic_fetch_or(_BitBase, 1l << _BitPos, __ATOMIC_RELEASE);
+  return (_PrevVal >> _BitPos) & 1;
+}
+#endif
 #ifdef __x86_64__
 static __inline__ unsigned char __DEFAULT_FN_ATTRS
 _BitScanForward64(unsigned long *_Index, unsigned __int64 _Mask) {
@@ -533,64 +550,521 @@ _interlockedbittestandset64(__int64 vola
   __atomic_fetch_or(_BitBase, 1ll << _BitPos, __ATOMIC_SEQ_CST);
   return (_PrevVal >> _BitPos) & 1;
 }
+#endif
 
/**\
 |* Interlocked Exchange Add
 
\**/
+#if defined(__arm__) || defined(__aarch64__)
+static __inline__ char __DEFAULT_FN_ATTRS
+_InterlockedExchangeAdd8_acq(char volatile *_Addend, char _Value) {
+  return __atomic_fetch_add(_Addend, _Value, __ATOMIC_ACQUIRE);
+}
+static __inline__ char __DEFAULT_FN_ATTRS
+_InterlockedExchangeAdd8_nf(char volatile *_Addend, char _Value) {
+  return __atomic_fetch_add(_Addend, _Value, __ATOMIC_RELAXED);
+}
+static __inline__ char __DEFAULT_FN_ATTRS
+_InterlockedExchangeAdd8_rel(char volatile *_Addend, char _Value) {
+  return __atomic_fetch_add(_Addend, _Value, __ATOMIC_RELAXED);
+}
+static __inline__ short __DEFAULT_FN_ATTRS
+_InterlockedExchangeAdd16_acq(short volatile *_Addend, short _Value) {
+  return __atomic_fetch_add(_Addend, _Value, __ATOMIC_ACQUIRE);
+}
+static __inline__ short __DEFAULT_FN_ATTRS
+_InterlockedExchangeAdd16_nf(short volatile *_Addend, short _Value) {
+  return __atomic_fetch_add(_Addend, _Value, __ATOMIC_RELAXED);
+}
+static __inline__ short __DEFAULT_FN_ATTRS
+_InterlockedExchangeAdd16_rel(short volatile *_Addend, short _Value) {
+  return __atomic_fetch_add(_Addend, _Value, __ATOMIC_RELEASE);
+}
+static __inline__ long __DEFAULT_FN_ATTRS
+_InterlockedExchangeAdd_acq(long volatile *_Addend, long _Value) {
+  return __atomic_fetch_add(_Addend, _Value, __ATOMIC_ACQUIRE);
+}
+static __inline__ long __DEFAULT_FN_ATTRS
+_InterlockedExchangeAdd_nf(long volatile *_Addend, long _Value) {
+  return __atomic_fetch_add(_Addend, _Value, __ATOMIC_RELAXED);
+}
+static __inline__ long __DEFAULT_FN_ATTRS
+_InterlockedExchangeAdd_rel(long volatile *_Addend, long _Value) {
+  return __atomic_fetch_add(_Addend, _Value, __ATOMIC_RELEASE);
+}
+#endif
+#if defined(__x86_64__) || defined(__arm__) || defined(__aarch64__)
 static __inline__ __int64 __DEFAULT_FN_ATTRS
 _InterlockedExchangeAdd64(__int64 volatile *_Addend, __int64 _Value) {
return __atomic_fetch_add(_Addend, _Value, __ATOMIC_SEQ_CST);
 }
+#endif
+#if defined(__arm__) || defined(__aarch64__)
+static __inline__ __int64 __DEFAULT_FN_ATTRS
+_InterlockedExchangeAdd64_acq(__int64 volatile *_Addend, __int64 _Value) {
+  return __atomic_fetch_add(_Addend, _Value, __ATOMIC_ACQUIRE);
+}
+static __inline__ __int64 __DEFAULT_FN_ATTRS
+_InterlockedExchangeAdd64_nf(__int64 volatile *_Addend, __int64 _Value) {
+  return __atomic_fetch_add(_Addend, _Value, __ATOMIC_RELAXED);
+}
+static __inline__ __int64 __DEFAULT_FN_ATTRS
+_InterlockedExchangeAdd64_rel(__int64 volatile *_Addend, __int64 _Value) {
+  return __atomic_fetch_add(_Addend, _Value, __ATOMIC_RELEASE);
+}
+#endif
 

Re: [PATCH] D15643: [clang-format] Don't allow newline after uppercase Obj-C block return types

2016-09-26 Thread Daniel Jasper via cfe-commits
djasper added a comment.

Ah, sorry for dropping this on the floor :(.

May I nonetheless ask you to add a test (unittests/Format/FormatTest.cpp)?


https://reviews.llvm.org/D15643



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


Re: [PATCH] D15643: [clang-format] Don't allow newline after uppercase Obj-C block return types

2016-09-26 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko added a subscriber: Eugene.Zelenko.
Eugene.Zelenko added a comment.

Looks like patch was not committed.


https://reviews.llvm.org/D15643



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


Re: [PATCH] D15691: [OpenCL] Improving OpenCL function pointer error checking to catch lone function designator

2016-09-26 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko added a subscriber: Eugene.Zelenko.
Eugene.Zelenko added a comment.

Committed in https://reviews.llvm.org/rL256838.


https://reviews.llvm.org/D15691



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


Re: [PATCH] D15994: Allow for unfinished #if blocks in preambles.

2016-09-26 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko added a subscriber: Eugene.Zelenko.
Eugene.Zelenko added a comment.

Looks like patch was not committed.


https://reviews.llvm.org/D15994



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


r282443 - [Modules TS] Diagnose 'export' declaration within 'export' declaration.

2016-09-26 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Mon Sep 26 16:27:23 2016
New Revision: 282443

URL: http://llvm.org/viewvc/llvm-project?rev=282443=rev
Log:
[Modules TS] Diagnose 'export' declaration within 'export' declaration.

Modified:
cfe/trunk/include/clang/AST/DeclBase.h
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/AST/DeclBase.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/SemaCXX/modules-ts.cppm

Modified: cfe/trunk/include/clang/AST/DeclBase.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclBase.h?rev=282443=282442=282443=diff
==
--- cfe/trunk/include/clang/AST/DeclBase.h (original)
+++ cfe/trunk/include/clang/AST/DeclBase.h Mon Sep 26 16:27:23 2016
@@ -568,6 +568,10 @@ public:
 return NextInContextAndBits.getInt() & ModulePrivateFlag;
   }
 
+  /// \brief Whether this declaration is exported (by virtue of being lexically
+  /// within an ExportDecl or by being a NamespaceDecl).
+  bool isExported() const;
+
   /// Return true if this declaration has an attribute which acts as
   /// definition of the entity, such as 'alias' or 'ifunc'.
   bool hasDefiningAttr() const;

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=282443=282442=282443=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Mon Sep 26 16:27:23 
2016
@@ -8522,6 +8522,8 @@ def err_module_self_import : Error<
   "import of module '%0' appears within same top-level module '%1'">;
 def err_module_import_in_implementation : Error<
   "@import of module '%0' in implementation of '%1'; use #import">;
+def err_export_within_export : Error<
+  "export declaration appears within another export declaration">;
 
 def ext_equivalent_internal_linkage_decl_in_modules : ExtWarn<
   "ambiguous use of internal linkage declaration %0 defined in multiple 
modules">,

Modified: cfe/trunk/lib/AST/DeclBase.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclBase.cpp?rev=282443=282442=282443=diff
==
--- cfe/trunk/lib/AST/DeclBase.cpp (original)
+++ cfe/trunk/lib/AST/DeclBase.cpp Mon Sep 26 16:27:23 2016
@@ -377,6 +377,22 @@ bool Decl::isReferenced() const {
   return false; 
 }
 
+bool Decl::isExported() const {
+  if (isModulePrivate())
+return false;
+  // Namespaces are always exported.
+  if (isa(this) || isa(this))
+return true;
+  // Otherwise, this is a strictly lexical check.
+  for (auto *DC = getLexicalDeclContext(); DC; DC = DC->getLexicalParent()) {
+if (cast(DC)->isModulePrivate())
+  return false;
+if (isa(DC))
+  return true;
+  }
+  return false;
+}
+
 bool Decl::hasDefiningAttr() const {
   return hasAttr() || hasAttr();
 }

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=282443=282442=282443=diff
==
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Mon Sep 26 16:27:23 2016
@@ -15465,14 +15465,17 @@ void Sema::createImplicitModuleImportFor
 /// (if present).
 Decl *Sema::ActOnStartExportDecl(Scope *S, SourceLocation ExportLoc,
  SourceLocation LBraceLoc) {
-  // FIXME: C++ Modules TS:
+  ExportDecl *D = ExportDecl::Create(Context, CurContext, ExportLoc);
+
+  // C++ Modules TS draft:
   //   An export-declaration [...] shall not contain more than one
   //   export keyword.
   //
   // The intent here is that an export-declaration cannot appear within another
   // export-declaration.
+  if (D->isExported())
+Diag(ExportLoc, diag::err_export_within_export);
 
-  ExportDecl *D = ExportDecl::Create(Context, CurContext, ExportLoc);
   CurContext->addDecl(D);
   PushDeclContext(S, D);
   return D;

Modified: cfe/trunk/test/SemaCXX/modules-ts.cppm
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/modules-ts.cppm?rev=282443=282442=282443=diff
==
--- cfe/trunk/test/SemaCXX/modules-ts.cppm (original)
+++ cfe/trunk/test/SemaCXX/modules-ts.cppm Mon Sep 26 16:27:23 2016
@@ -66,3 +66,18 @@ struct S {
 
 // FIXME: Exports of declarations without external linkage are disallowed.
 // Exports of declarations with non-external-linkage types are disallowed.
+
+// Cannot export within another export. This isn't precisely covered by the
+// language rules right now, but (per personal correspondence between zygoloid
+// and gdr) is the intent.
+#if TEST == 1
+export {
+  extern "C++" {
+namespace NestedExport {
+  export { // expected-error 

Re: [PATCH] D24628: [ASAN] Pass previous stack information through __sanitizer_finish_switch_fiber

2016-09-26 Thread Andrii Grynenko via cfe-commits
andriigrynenko updated this revision to Diff 72571.
andriigrynenko added a comment.

Do CHECKs for all iterations of the loop.


https://reviews.llvm.org/D24628

Files:
  include/sanitizer/common_interface_defs.h
  lib/asan/asan_thread.cc
  lib/asan/asan_thread.h
  test/asan/TestCases/Linux/swapcontext_annotation.cc

Index: test/asan/TestCases/Linux/swapcontext_annotation.cc
===
--- test/asan/TestCases/Linux/swapcontext_annotation.cc
+++ test/asan/TestCases/Linux/swapcontext_annotation.cc
@@ -1,12 +1,17 @@
 // Check that ASan plays well with annotated makecontext/swapcontext.
 
-// RUN: %clangxx_asan -lpthread -O0 %s -o %t && %run %t 2>&1 | FileCheck %s
-// RUN: %clangxx_asan -lpthread -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
-// RUN: %clangxx_asan -lpthread -O2 %s -o %t && %run %t 2>&1 | FileCheck %s
-// RUN: %clangxx_asan -lpthread -O3 %s -o %t && %run %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -std=c++11 -lpthread -O0 %s -o %t && %run %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -std=c++11 -lpthread -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -std=c++11 -lpthread -O2 %s -o %t && %run %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -std=c++11 -lpthread -O3 %s -o %t && %run %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -std=c++11 -lpthread -O0 %s -o %t && %run %t 2>&1 | FileCheck <( seq 60 | xargs -i -- grep LOOPCHECK %s ) --check-prefix LOOPCHECK
+// RUN: %clangxx_asan -std=c++11 -lpthread -O1 %s -o %t && %run %t 2>&1 | FileCheck <( seq 60 | xargs -i -- grep LOOPCHECK %s ) --check-prefix LOOPCHECK
+// RUN: %clangxx_asan -std=c++11 -lpthread -O2 %s -o %t && %run %t 2>&1 | FileCheck <( seq 60 | xargs -i -- grep LOOPCHECK %s ) --check-prefix LOOPCHECK
+// RUN: %clangxx_asan -std=c++11 -lpthread -O3 %s -o %t && %run %t 2>&1 | FileCheck <( seq 60 | xargs -i -- grep LOOPCHECK %s ) --check-prefix LOOPCHECK
+
 //
 // This test is too subtle to try on non-x86 arch for now.
-// REQUIRES: x86_64-supported-target,i386-supported-target
+// REQUIRES: x86-target-arch
 
 #include 
 #include 
@@ -25,9 +30,12 @@
 
 const int kStackSize = 1 << 20;
 
-void *main_thread_stack;
+const void *main_thread_stack;
 size_t main_thread_stacksize;
 
+const void *from_stack;
+size_t from_stacksize;
+
 __attribute__((noinline, noreturn)) void LongJump(jmp_buf env) {
   longjmp(env, 1);
   _exit(1);
@@ -44,14 +52,18 @@
 
 void NextChild() {
   CallNoReturn();
-  __sanitizer_finish_switch_fiber();
+  __sanitizer_finish_switch_fiber(nullptr, _stack, _stacksize);
+
+  printf("NextChild from: %p %zu\n", from_stack, from_stacksize);
 
   char x[32] = {0};  // Stack gets poisoned.
   printf("NextChild: %p\n", x);
 
   CallNoReturn();
 
-  __sanitizer_start_switch_fiber(main_thread_stack, main_thread_stacksize);
+  __sanitizer_start_switch_fiber(nullptr,
+ main_thread_stack,
+ main_thread_stacksize);
   CallNoReturn();
   if (swapcontext(_child_context, _context) < 0) {
 perror("swapcontext");
@@ -61,30 +73,39 @@
 
 void Child(int mode) {
   CallNoReturn();
-  __sanitizer_finish_switch_fiber();
+  __sanitizer_finish_switch_fiber(nullptr,
+  _thread_stack,
+  _thread_stacksize);
   char x[32] = {0};  // Stack gets poisoned.
   printf("Child: %p\n", x);
   CallNoReturn();
   // (a) Do nothing, just return to parent function.
   // (b) Jump into the original function. Stack remains poisoned unless we do
   // something.
   // (c) Jump to another function which will then jump back to the main function
   if (mode == 0) {
-__sanitizer_start_switch_fiber(main_thread_stack, main_thread_stacksize);
+__sanitizer_start_switch_fiber(nullptr,
+   main_thread_stack,
+   main_thread_stacksize);
 CallNoReturn();
   } else if (mode == 1) {
-__sanitizer_start_switch_fiber(main_thread_stack, main_thread_stacksize);
+__sanitizer_start_switch_fiber(nullptr,
+   main_thread_stack,
+   main_thread_stacksize);
 CallNoReturn();
 if (swapcontext(_context, _context) < 0) {
   perror("swapcontext");
   _exit(1);
 }
   } else if (mode == 2) {
+printf("NextChild stack: %p\n", next_child_stack);
+
 getcontext(_child_context);
 next_child_context.uc_stack.ss_sp = next_child_stack;
 next_child_context.uc_stack.ss_size = kStackSize / 2;
 makecontext(_child_context, (void (*)())NextChild, 0);
-__sanitizer_start_switch_fiber(next_child_context.uc_stack.ss_sp,
+__sanitizer_start_switch_fiber(nullptr,
+   next_child_context.uc_stack.ss_sp,
next_child_context.uc_stack.ss_size);
 CallNoReturn();
 if (swapcontext(_context, _child_context) < 0) {
@@ -105,16 +126,21 @@
   }
   

Re: [PATCH] D16262: [libc++] Treat trailing backslashes in a regex pattern as invalid.

2016-09-26 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko added a subscriber: Eugene.Zelenko.
Eugene.Zelenko closed this revision.
Eugene.Zelenko added a comment.

Committed in r258107.


https://reviews.llvm.org/D16262



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


Re: [PATCH] D16761: clang-cl: Support loading plugins on Windows

2016-09-26 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko added a subscriber: Eugene.Zelenko.
Eugene.Zelenko added a comment.

Was committed in r260265, but reverted in r260536.


https://reviews.llvm.org/D16761



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


Re: [PATCH] D16951: [MS ABI] dllimport'd class cannot have constexpr ctors

2016-09-26 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko added a subscriber: Eugene.Zelenko.
Eugene.Zelenko added a comment.

Looks like patch was not committed.


https://reviews.llvm.org/D16951



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


Re: [PATCH] D17469: [libcxx] Add deployment knobs to tests (for Apple platforms)

2016-09-26 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko added a comment.

It's fine. I just walk through all accepted revisions to find forgotten ones.


https://reviews.llvm.org/D17469



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


[libcxx] r282439 - [libc++] Extension: Make `move` and `forward` constexpr in C++11.

2016-09-26 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Mon Sep 26 15:55:02 2016
New Revision: 282439

URL: http://llvm.org/viewvc/llvm-project?rev=282439=rev
Log:
[libc++] Extension: Make `move` and `forward` constexpr in C++11.

Summary:
`std::move` and `std::forward` were not marked constexpr in C++11.  This can be 
very damaging because it makes otherwise constant expressions non-constant. For 
example:

```
#include 
template 
struct Foo {
  constexpr Foo(T&& tx) :  t(std::move(tx)) {}
  T t;
};
[[clang::require_constant_initialization]] Foo f(42); // Foo should be 
constant initialized but C++11 move is not constexpr. As a result `f` is an 
unsafe global.
```

This patch applies `constexpr` to `move` and `forward` as an extension in 
C++11. Normally the library is not allowed to add `constexpr` because it may be 
observable to the user. In particular adding constexpr may cause valid code to 
stop compiling. However these problems only happen in more complex situations, 
like making `__invoke(...)` constexpr. `forward` and `move` are simply enough 
that applying `constexpr` is safe. 

Note that libstdc++ has offered this extension since at least 4.8.1.

Most of the changes in this patch are simply test cleanups or additions. The 
main changes in the tests are:

* Fold all `forward_N.fail.cpp` tests into a single `forward.fail.cpp` test 
using -verify.
* Delete most `move_only_N.fail.cpp` tests because they weren't actually 
testing anything.
* Fold `move_copy.pass.cpp` and `move_only.pass.cpp` into a single 
`move.pass.cpp` test.
* Add return type and noexcept tests for `forward` and `move`.




Reviewers: rsmith, mclow.lists, EricWF

Subscribers: K-ballo, loladiro

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

Added:
libcxx/trunk/test/std/utilities/utility/forward/forward.fail.cpp
libcxx/trunk/test/std/utilities/utility/forward/forward_03.pass.cpp
libcxx/trunk/test/std/utilities/utility/forward/move.fail.cpp
libcxx/trunk/test/std/utilities/utility/forward/move.pass.cpp
Removed:
libcxx/trunk/test/std/utilities/utility/forward/forward1.fail.cpp
libcxx/trunk/test/std/utilities/utility/forward/forward2.fail.cpp
libcxx/trunk/test/std/utilities/utility/forward/forward3.fail.cpp
libcxx/trunk/test/std/utilities/utility/forward/forward4.fail.cpp
libcxx/trunk/test/std/utilities/utility/forward/forward5.fail.cpp
libcxx/trunk/test/std/utilities/utility/forward/forward6.fail.cpp
libcxx/trunk/test/std/utilities/utility/forward/move_copy.pass.cpp
libcxx/trunk/test/std/utilities/utility/forward/move_only.pass.cpp
libcxx/trunk/test/std/utilities/utility/forward/move_only1.fail.cpp
libcxx/trunk/test/std/utilities/utility/forward/move_only2.fail.cpp
libcxx/trunk/test/std/utilities/utility/forward/move_only3.fail.cpp
libcxx/trunk/test/std/utilities/utility/forward/move_only4.fail.cpp
Modified:
libcxx/trunk/include/type_traits
libcxx/trunk/test/std/utilities/utility/forward/forward.pass.cpp

Modified: libcxx/trunk/include/type_traits
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/type_traits?rev=282439=282438=282439=diff
==
--- libcxx/trunk/include/type_traits (original)
+++ libcxx/trunk/include/type_traits Mon Sep 26 15:55:02 2016
@@ -2155,7 +2155,7 @@ template  _LIBCPP_CONSTEXPR b
 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
 
 template 
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
 typename remove_reference<_Tp>::type&&
 move(_Tp&& __t) _NOEXCEPT
 {
@@ -2164,7 +2164,7 @@ move(_Tp&& __t) _NOEXCEPT
 }
 
 template 
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
 _Tp&&
 forward(typename remove_reference<_Tp>::type& __t) _NOEXCEPT
 {
@@ -2172,12 +2172,12 @@ forward(typename remove_reference<_Tp>::
 }
 
 template 
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
 _Tp&&
 forward(typename remove_reference<_Tp>::type&& __t) _NOEXCEPT
 {
 static_assert(!is_lvalue_reference<_Tp>::value,
-  "Can not forward an rvalue as an lvalue.");
+  "can not forward an rvalue as an lvalue");
 return static_cast<_Tp&&>(__t);
 }
 

Added: libcxx/trunk/test/std/utilities/utility/forward/forward.fail.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/utility/forward/forward.fail.cpp?rev=282439=auto
==
--- libcxx/trunk/test/std/utilities/utility/forward/forward.fail.cpp (added)
+++ libcxx/trunk/test/std/utilities/utility/forward/forward.fail.cpp Mon Sep 26 
15:55:02 2016
@@ -0,0 +1,53 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under 

Re: [PATCH] D24372: [libcxx] Sprinkle constexpr over compressed_pair

2016-09-26 Thread Eric Fiselier via cfe-commits
EricWF added a comment.

FYI `std::move` and `std::forward` are now constexpr in C++11. There is no need 
to use `__forward`.


Repository:
  rL LLVM

https://reviews.llvm.org/D24372



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


Re: [PATCH] D17815: [libc++abi] Use fallback_malloc to allocate __cxa_eh_globals in case of dynamic memory exhaustion.

2016-09-26 Thread Eric Fiselier via cfe-commits
EricWF accepted this revision.
EricWF added a comment.
This revision is now accepted and ready to land.

LGTM after addressing the inline comments.



Comment at: src/fallback_malloc.cpp:58
@@ +57,3 @@
+
+#define HEAP_SIZE   512
+char heap [ HEAP_SIZE ];

A static const variable would be better here.


Comment at: src/fallback_malloc.cpp:59
@@ +58,3 @@
+#define HEAP_SIZE   512
+char heap [ HEAP_SIZE ];
+

This should have `__attribute__((aligned))` on it.


Comment at: src/fallback_malloc.h:20
@@ +19,3 @@
+// Allocate some memory from _somewhere_
+void * __cxa_malloc_with_fallback(size_t size);
+

Please don't use the `__cxa` prefix on these functions. It makes it seem like 
they are part of the Itanium spec but they're really internal details.


https://reviews.llvm.org/D17815



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


Re: [PATCH] D17469: [libcxx] Add deployment knobs to tests (for Apple platforms)

2016-09-26 Thread Duncan P. N. Exon Smith via cfe-commits
Correct.  I haven't had a chance to get back to this.  I'm aiming to pick it up 
again in the next week or two, but if this is specifically blocking you, feel 
free to rebase and commit on my behalf.

> On 2016-Sep-26, at 13:39, Eugene Zelenko  wrote:
> 
> Eugene.Zelenko added a subscriber: Eugene.Zelenko.
> Eugene.Zelenko added a comment.
> 
> Looks like patch was not committed.
> 
> 
> https://reviews.llvm.org/D17469
> 
> 
> 

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


r282438 - Fix test on windows

2016-09-26 Thread Matthias Braun via cfe-commits
Author: matze
Date: Mon Sep 26 15:48:34 2016
New Revision: 282438

URL: http://llvm.org/viewvc/llvm-project?rev=282438=rev
Log:
Fix test on windows

Modified:
cfe/trunk/test/Driver/save-stats.c

Modified: cfe/trunk/test/Driver/save-stats.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/save-stats.c?rev=282438=282437=282438=diff
==
--- cfe/trunk/test/Driver/save-stats.c (original)
+++ cfe/trunk/test/Driver/save-stats.c Mon Sep 26 15:48:34 2016
@@ -9,8 +9,8 @@
 // NO-STATS-NO: -stats-file
 
 // RUN: %clang -target x86_64-apple-darwin -save-stats=obj -c -o 
obj/dir/save-stats.o %s -### 2>&1 | FileCheck %s -check-prefix=CHECK-OBJ
-// CHECK-OBJ: "-stats-file=obj/dir{{.}}save-stats.stats"
-// CHECK-OBJ: "-o" "obj/dir{{.}}save-stats.o"
+// CHECK-OBJ: "-stats-file=obj/dir{{/|}}save-stats.stats"
+// CHECK-OBJ: "-o" "obj/dir{{/|}}save-stats.o"
 
 // RUN: %clang -target x86_64-apple-darwin -save-stats=obj -c %s -### 2>&1 | 
FileCheck %s -check-prefix=CHECK-OBJ-NOO
 // CHECK-OBJ-NOO: "-stats-file=save-stats.stats"


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


Re: [PATCH] D24820: Add -stats-stats option

2016-09-26 Thread Matthias Braun via cfe-commits
MatzeB added inline comments.


Comment at: test/Driver/save-stats.c:12
@@ +11,3 @@
+// RUN: %clang -target x86_64-apple-darwin -save-stats=obj -c -o 
obj/dir/save-stats.o %s -### 2>&1 | FileCheck %s -check-prefix=CHECK-OBJ
+// CHECK-OBJ: "-stats-file=obj/dir{{/|}}save-stats.stats"
+// CHECK-OBJ: "-o" "obj/dir{{/|}}save-stats.o"

bruno wrote:
> aprantl wrote:
> > This is up to taste, but just accepting {{.}} as the path separator would 
> > be sufficient IMO and might be more readable.
> +1 to Adrian's suggestion
For the record: Switching to {{.}} in the final commit broke the windows bots, 
because they display an escaped slash here (= two backslash characters)...


Repository:
  rL LLVM

https://reviews.llvm.org/D24820



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


Re: [PATCH] D24799: [XRay] Check in Clang whether XRay supports the target when -fxray-instrument is passed

2016-09-26 Thread Serge Rogatch via cfe-commits
rSerge updated this revision to Diff 72554.
rSerge added a comment.

Implemented a workaround for XFAIL not differentiating between `x86` and 
`x86_64` because it searches for a substring in the triple string, thus `x86` 
matches both `x86-X-Y-Z` and `x86_64-X-Y-Z`.


https://reviews.llvm.org/D24799

Files:
  lib/Driver/Tools.cpp
  test/Driver/xray-instrument.c

Index: test/Driver/xray-instrument.c
===
--- test/Driver/xray-instrument.c
+++ test/Driver/xray-instrument.c
@@ -0,0 +1,3 @@
+// RUN: %clang -v -fxray-instrument -c %s
+// XFAIL: armeb, aarch64, aarch64_be, avr, bpfel, bpfeb, hexagon, mips, 
mipsel, mips64, mips64el, msp430, ppc, ppc64, ppc64le, r600, amdgcn, sparc, 
sparcv9, sparcel, systemz, tce, thumb, thumbeb, x86-, xcore, nvptx, nvptx64, 
le32, le64, amdil, amdil64, hsail, hsail64, spir, spir64, kalimba, shave, 
lanai, wasm32, wasm64, renderscript32, renderscript64
+typedef int a;
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -4767,7 +4767,20 @@
 
   if (Args.hasFlag(options::OPT_fxray_instrument,
options::OPT_fnoxray_instrument, false)) {
-CmdArgs.push_back("-fxray-instrument");
+const char* const XRayInstrumentOption = "-fxray-instrument";
+switch(getToolChain().getArch()) {
+case llvm::Triple::arm:
+case llvm::Triple::x86_64:
+  break;
+default:
+{
+  std::string Feature(XRayInstrumentOption);
+  Feature += " on ";
+  Feature += Triple.getArchName().data();
+  D.Diag(diag::err_drv_clang_unsupported) << Feature;
+  break;
+} }
+CmdArgs.push_back(XRayInstrumentOption);
 if (const Arg *A =
 Args.getLastArg(options::OPT_fxray_instruction_threshold_,
 options::OPT_fxray_instruction_threshold_EQ)) {


Index: test/Driver/xray-instrument.c
===
--- test/Driver/xray-instrument.c
+++ test/Driver/xray-instrument.c
@@ -0,0 +1,3 @@
+// RUN: %clang -v -fxray-instrument -c %s
+// XFAIL: armeb, aarch64, aarch64_be, avr, bpfel, bpfeb, hexagon, mips, mipsel, mips64, mips64el, msp430, ppc, ppc64, ppc64le, r600, amdgcn, sparc, sparcv9, sparcel, systemz, tce, thumb, thumbeb, x86-, xcore, nvptx, nvptx64, le32, le64, amdil, amdil64, hsail, hsail64, spir, spir64, kalimba, shave, lanai, wasm32, wasm64, renderscript32, renderscript64
+typedef int a;
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -4767,7 +4767,20 @@
 
   if (Args.hasFlag(options::OPT_fxray_instrument,
options::OPT_fnoxray_instrument, false)) {
-CmdArgs.push_back("-fxray-instrument");
+const char* const XRayInstrumentOption = "-fxray-instrument";
+switch(getToolChain().getArch()) {
+case llvm::Triple::arm:
+case llvm::Triple::x86_64:
+  break;
+default:
+{
+  std::string Feature(XRayInstrumentOption);
+  Feature += " on ";
+  Feature += Triple.getArchName().data();
+  D.Diag(diag::err_drv_clang_unsupported) << Feature;
+  break;
+} }
+CmdArgs.push_back(XRayInstrumentOption);
 if (const Arg *A =
 Args.getLastArg(options::OPT_fxray_instruction_threshold_,
 options::OPT_fxray_instruction_threshold_EQ)) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D17469: [libcxx] Add deployment knobs to tests (for Apple platforms)

2016-09-26 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko added a subscriber: Eugene.Zelenko.
Eugene.Zelenko added a comment.

Looks like patch was not committed.


https://reviews.llvm.org/D17469



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


Re: [PATCH] D24628: [ASAN] Pass previous stack information through __sanitizer_finish_switch_fiber

2016-09-26 Thread Andrii Grynenko via cfe-commits
andriigrynenko added inline comments.


Comment at: test/asan/TestCases/Linux/swapcontext_annotation.cc:176-199
@@ -164,7 +175,26 @@
 ret += Run(argc - 1, 0, stack);
+// CHECK: Child stack: [[CHILD_STACK:0x[0-9a-f]*]]
+// CHECK: Main context from: [[CHILD_STACK]] 524288
 ret += Run(argc - 1, 1, stack);
+// CHECK: Child stack: [[CHILD_STACK:0x[0-9a-f]*]]
+// CHECK: Main context from: [[CHILD_STACK]] 524288
 ret += Run(argc - 1, 2, stack);
+// CHECK: Child stack: [[CHILD_STACK:0x[0-9a-f]*]]
+// CHECK: NextChild stack: [[NEXT_CHILD_STACK:0x[0-9a-f]*]]
+// CHECK: NextChild from: [[CHILD_STACK]] 524288
+// CHECK: Main context from: [[NEXT_CHILD_STACK]] 524288
 ret += Run(argc - 1, 0, heap);
+// CHECK: Child stack: [[CHILD_STACK:0x[0-9a-f]*]]
+// CHECK: Main context from: [[CHILD_STACK]] 524288
 ret += Run(argc - 1, 1, heap);
+// CHECK: Child stack: [[CHILD_STACK:0x[0-9a-f]*]]
+// CHECK: Main context from: [[CHILD_STACK]] 524288
 ret += Run(argc - 1, 2, heap);
+// CHECK: Child stack: [[CHILD_STACK:0x[0-9a-f]*]]
+// CHECK: NextChild stack: [[NEXT_CHILD_STACK:0x[0-9a-f]*]]
+// CHECK: NextChild from: [[CHILD_STACK]] 524288
+// CHECK: Main context from: [[NEXT_CHILD_STACK]] 524288
+
+// CHECK: Iteration 0 passed
+printf("Iteration %d passed\n", i);
   }

dvyukov wrote:
> andriigrynenko wrote:
> > This only checks the first iteration of the loop. Can I do it better with 
> > FileCheck ? 
> Yes, you can add CHECKs for the second iteration as well.
> 
@dvyukov: What I meant is that I didn't see a way to have some kind of loop in 
these CHECKs. I don't want to copy-paste these same CHECKs 30 times :)


https://reviews.llvm.org/D24628



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


Re: [PATCH] D24903: [libcxx] [include] Declare __STDC_*_MACROS for C++11 compat in old libc

2016-09-26 Thread Michał Górny via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL282435: [include] Declare __STDC_*_MACROS for C++11 compat 
in old libc (authored by mgorny).

Changed prior to commit:
  https://reviews.llvm.org/D24903?vs=72492=72552#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D24903

Files:
  libcxx/trunk/include/inttypes.h
  libcxx/trunk/include/stdint.h

Index: libcxx/trunk/include/stdint.h
===
--- libcxx/trunk/include/stdint.h
+++ libcxx/trunk/include/stdint.h
@@ -0,0 +1,121 @@
+// -*- C++ -*-
+//=== stdint.h ===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#ifndef _LIBCPP_STDINT_H
+#define _LIBCPP_STDINT_H
+
+/*
+stdint.h synopsis
+
+Macros:
+
+INT8_MIN
+INT16_MIN
+INT32_MIN
+INT64_MIN
+
+INT8_MAX
+INT16_MAX
+INT32_MAX
+INT64_MAX
+
+UINT8_MAX
+UINT16_MAX
+UINT32_MAX
+UINT64_MAX
+
+INT_LEAST8_MIN
+INT_LEAST16_MIN
+INT_LEAST32_MIN
+INT_LEAST64_MIN
+
+INT_LEAST8_MAX
+INT_LEAST16_MAX
+INT_LEAST32_MAX
+INT_LEAST64_MAX
+
+UINT_LEAST8_MAX
+UINT_LEAST16_MAX
+UINT_LEAST32_MAX
+UINT_LEAST64_MAX
+
+INT_FAST8_MIN
+INT_FAST16_MIN
+INT_FAST32_MIN
+INT_FAST64_MIN
+
+INT_FAST8_MAX
+INT_FAST16_MAX
+INT_FAST32_MAX
+INT_FAST64_MAX
+
+UINT_FAST8_MAX
+UINT_FAST16_MAX
+UINT_FAST32_MAX
+UINT_FAST64_MAX
+
+INTPTR_MIN
+INTPTR_MAX
+UINTPTR_MAX
+
+INTMAX_MIN
+INTMAX_MAX
+
+UINTMAX_MAX
+
+PTRDIFF_MIN
+PTRDIFF_MAX
+
+SIG_ATOMIC_MIN
+SIG_ATOMIC_MAX
+
+SIZE_MAX
+
+WCHAR_MIN
+WCHAR_MAX
+
+WINT_MIN
+WINT_MAX
+
+INT8_C(value)
+INT16_C(value)
+INT32_C(value)
+INT64_C(value)
+
+UINT8_C(value)
+UINT16_C(value)
+UINT32_C(value)
+UINT64_C(value)
+
+INTMAX_C(value)
+UINTMAX_C(value)
+
+*/
+
+#include <__config>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+/* C99 stdlib (e.g. glibc < 2.18) does not provide macros needed
+   for C++11 unless __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS
+   are defined
+*/
+#if defined(__cplusplus) && !defined(__STDC_LIMIT_MACROS)
+#   define __STDC_LIMIT_MACROS
+#endif
+#if defined(__cplusplus) && !defined(__STDC_CONSTANT_MACROS)
+#   define __STDC_CONSTANT_MACROS
+#endif
+
+#include_next 
+
+#endif  // _LIBCPP_STDINT_H
Index: libcxx/trunk/include/inttypes.h
===
--- libcxx/trunk/include/inttypes.h
+++ libcxx/trunk/include/inttypes.h
@@ -237,6 +237,13 @@
 #pragma GCC system_header
 #endif
 
+/* C99 stdlib (e.g. glibc < 2.18) does not provide format macros needed
+   for C++11 unless __STDC_FORMAT_MACROS is defined
+*/
+#if defined(__cplusplus) && !defined(__STDC_FORMAT_MACROS)
+#   define __STDC_FORMAT_MACROS
+#endif
+
 #include_next 
 
 #ifdef __cplusplus
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r282435 - [include] Declare __STDC_*_MACROS for C++11 compat in old libc

2016-09-26 Thread Michal Gorny via cfe-commits
Author: mgorny
Date: Mon Sep 26 15:20:00 2016
New Revision: 282435

URL: http://llvm.org/viewvc/llvm-project?rev=282435=rev
Log:
[include] Declare __STDC_*_MACROS for C++11 compat in old libc

Declare __STDC_FORMAT_MACROS, __STDC_LIMIT_MACROS and
__STDC_CONSTANT_MACROS before including real inttypes.h/stdint.h when
the wrapper-header is included in C++11, in order to enable
the necessary macros in C99-compliant libc.

The C99 standard defined that the format macros in inttypes.h should be
defined by the C++ implementations only when __STDC_FORMAT_MACROS is
defined, and the limit and constant macros in stdint.h should be defined
only when __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS are defined
appropriately. Following this specification, multiple old versions of
glibc up to 2.17 do not define those macros by default for C++,
rendering the libc++ headers non-compliant to the C++11 standard.

In order to achieve the necessary compliance, __STDC_FORMAT_MACROS is
defined in wrapped inttypes.h just before including the system
inttypes.h, when C++11 or newer is used. Both __STDC_LIMIT_MACROS
and __STDC_CONSTANT_MACROS are defined in newly-wrapped stdint.h. This
fixes the C++11 compliance while preserving the current behavior for
C++03.

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

Added:
libcxx/trunk/include/stdint.h
Modified:
libcxx/trunk/include/inttypes.h

Modified: libcxx/trunk/include/inttypes.h
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/inttypes.h?rev=282435=282434=282435=diff
==
--- libcxx/trunk/include/inttypes.h (original)
+++ libcxx/trunk/include/inttypes.h Mon Sep 26 15:20:00 2016
@@ -237,6 +237,13 @@ uintmax_t wcstoumax(const wchar_t* restr
 #pragma GCC system_header
 #endif
 
+/* C99 stdlib (e.g. glibc < 2.18) does not provide format macros needed
+   for C++11 unless __STDC_FORMAT_MACROS is defined
+*/
+#if defined(__cplusplus) && !defined(__STDC_FORMAT_MACROS)
+#   define __STDC_FORMAT_MACROS
+#endif
+
 #include_next 
 
 #ifdef __cplusplus

Added: libcxx/trunk/include/stdint.h
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/stdint.h?rev=282435=auto
==
--- libcxx/trunk/include/stdint.h (added)
+++ libcxx/trunk/include/stdint.h Mon Sep 26 15:20:00 2016
@@ -0,0 +1,121 @@
+// -*- C++ -*-
+//=== stdint.h 
===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#ifndef _LIBCPP_STDINT_H
+#define _LIBCPP_STDINT_H
+
+/*
+stdint.h synopsis
+
+Macros:
+
+INT8_MIN
+INT16_MIN
+INT32_MIN
+INT64_MIN
+
+INT8_MAX
+INT16_MAX
+INT32_MAX
+INT64_MAX
+
+UINT8_MAX
+UINT16_MAX
+UINT32_MAX
+UINT64_MAX
+
+INT_LEAST8_MIN
+INT_LEAST16_MIN
+INT_LEAST32_MIN
+INT_LEAST64_MIN
+
+INT_LEAST8_MAX
+INT_LEAST16_MAX
+INT_LEAST32_MAX
+INT_LEAST64_MAX
+
+UINT_LEAST8_MAX
+UINT_LEAST16_MAX
+UINT_LEAST32_MAX
+UINT_LEAST64_MAX
+
+INT_FAST8_MIN
+INT_FAST16_MIN
+INT_FAST32_MIN
+INT_FAST64_MIN
+
+INT_FAST8_MAX
+INT_FAST16_MAX
+INT_FAST32_MAX
+INT_FAST64_MAX
+
+UINT_FAST8_MAX
+UINT_FAST16_MAX
+UINT_FAST32_MAX
+UINT_FAST64_MAX
+
+INTPTR_MIN
+INTPTR_MAX
+UINTPTR_MAX
+
+INTMAX_MIN
+INTMAX_MAX
+
+UINTMAX_MAX
+
+PTRDIFF_MIN
+PTRDIFF_MAX
+
+SIG_ATOMIC_MIN
+SIG_ATOMIC_MAX
+
+SIZE_MAX
+
+WCHAR_MIN
+WCHAR_MAX
+
+WINT_MIN
+WINT_MAX
+
+INT8_C(value)
+INT16_C(value)
+INT32_C(value)
+INT64_C(value)
+
+UINT8_C(value)
+UINT16_C(value)
+UINT32_C(value)
+UINT64_C(value)
+
+INTMAX_C(value)
+UINTMAX_C(value)
+
+*/
+
+#include <__config>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+/* C99 stdlib (e.g. glibc < 2.18) does not provide macros needed
+   for C++11 unless __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS
+   are defined
+*/
+#if defined(__cplusplus) && !defined(__STDC_LIMIT_MACROS)
+#   define __STDC_LIMIT_MACROS
+#endif
+#if defined(__cplusplus) && !defined(__STDC_CONSTANT_MACROS)
+#   define __STDC_CONSTANT_MACROS
+#endif
+
+#include_next 
+
+#endif  // _LIBCPP_STDINT_H


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


Re: [PATCH] D24903: [libcxx] [include] Declare __STDC_*_MACROS for C++11 compat in old libc

2016-09-26 Thread Michał Górny via cfe-commits
mgorny added a comment.

Ok. Thanks for the review.


https://reviews.llvm.org/D24903



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


Re: [PATCH] D17840: [OPENMP] Private, firstprivate, and lastprivate clauses for distribute, host code generation

2016-09-26 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko added a subscriber: Eugene.Zelenko.
Eugene.Zelenko added a comment.

Looks like patch was not committed.


Repository:
  rL LLVM

https://reviews.llvm.org/D17840



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


Re: [PATCH] D17890: [OpenMP][NVPTX][CUDA] Adding support for printf for an NVPTX OpenMP device.

2016-09-26 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko added a subscriber: Eugene.Zelenko.
Eugene.Zelenko added a comment.

Looks like patch was not committed.


https://reviews.llvm.org/D17890



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


Re: [PATCH] D17979: [OPENMP] Add regression test for codegen of distribute pragma for NVPTX

2016-09-26 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko added a subscriber: Eugene.Zelenko.
Eugene.Zelenko added a comment.

Looks like patch was not committed.


Repository:
  rL LLVM

https://reviews.llvm.org/D17979



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


Re: [PATCH] D24903: [libcxx] [include] Declare __STDC_*_MACROS for C++11 compat in old libc

2016-09-26 Thread Eric Fiselier via cfe-commits
EricWF accepted this revision.
EricWF added a comment.
This revision is now accepted and ready to land.

LGTM. Please remove the `LIBCXX` macros before committing.



Comment at: include/stdint.h:118
@@ +117,3 @@
+#   define __STDC_CONSTANT_MACROS
+#   define __STDC_CONSTANT_MACROS_DEFINED_BY_LIBCXX
+#endif

We don't actually need the `__STDC_CONSTANT_MACROS_DEFINED_BY_LIBCXX`. Please 
remove before commiting.


https://reviews.llvm.org/D24903



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


Re: [PATCH] D24886: Add [[clang::suppress(rule, ...)]] attribute

2016-09-26 Thread Aaron Ballman via cfe-commits
aaron.ballman added a comment.

In https://reviews.llvm.org/D24886#552859, @rsmith wrote:

> Giving this the name `[[clang::suppress(...)]]` seems unhelpful. This 
> attribute is specified by the C++ core guidelines, not by clang, and 
> presumably we want code using this attribute to be portable across 
> implementations of the C++ code guidelines. I'd suggest asking the editors of 
> the core guidelines what attribute namespace they'd like used, and using that 
> here rather than using `clang`.


I believe this attribute should be used to silence diagnostics for more than 
just the C++ Core Guidelines, so I don't think it makes sense to let them 
dictate what attribute namespace should be used. However, I would appreciate if 
they didn't suggest implementers stomp all over the attribute namespace used by 
standards-based attributes, either.


https://reviews.llvm.org/D24886



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


Re: [PATCH] D24886: Add [[clang::suppress(rule, ...)]] attribute

2016-09-26 Thread Richard Smith via cfe-commits
rsmith added a comment.

Giving this the name `[[clang::suppress(...)]]` seems unhelpful. This attribute 
is specified by the C++ core guidelines, not by clang, and presumably we want 
code using this attribute to be portable across implementations of the C++ code 
guidelines. I'd suggest asking the editors of the core guidelines what 
attribute namespace they'd like used, and using that here rather than using 
`clang`.


https://reviews.llvm.org/D24886



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


Re: [PATCH] D24609: [ARM] Add missing Interlocked intrinsics

2016-09-26 Thread Martin Storsjö via cfe-commits
mstorsjo added a comment.

Ping, can someone commit this one now?


https://reviews.llvm.org/D24609



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


Re: [PATCH] D24932: Fix PR 30440

2016-09-26 Thread Dmitry Polukhin via cfe-commits
DmitryPolukhin added a comment.

LGTM, added Richard in case he has something to add.


Repository:
  rL LLVM

https://reviews.llvm.org/D24932



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


Re: [PATCH] D24933: Enable configuration files in clang

2016-09-26 Thread Daniel Dunbar via cfe-commits
ddunbar added a comment.

I am too out of the loop on Clang development to be able to comment on the 
specific direction, but I will just say that I am highly in favor of adding new 
features in this direction. Thank you!


https://reviews.llvm.org/D24933



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


Re: r282426 - CC1: Add -save-stats option

2016-09-26 Thread Hal Finkel via cfe-commits
Nice!

 -Hal

- Original Message -
> From: "Matthias Braun via cfe-commits" 
> To: cfe-commits@lists.llvm.org
> Sent: Monday, September 26, 2016 1:53:34 PM
> Subject: r282426 - CC1: Add -save-stats option
> 
> Author: matze
> Date: Mon Sep 26 13:53:34 2016
> New Revision: 282426
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=282426=rev
> Log:
> CC1: Add -save-stats option
> 
> This option behaves in a similar spirit as -save-temps and writes
> internal llvm statistics in json format to a file.
> 
> Differential Revision: https://reviews.llvm.org/D24820
> 
> Added:
> cfe/trunk/test/Driver/save-stats.c
> cfe/trunk/test/Frontend/stats-file.c
> Modified:
> cfe/trunk/docs/CommandGuide/clang.rst
> cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td
> cfe/trunk/include/clang/Driver/CC1Options.td
> cfe/trunk/include/clang/Driver/Options.td
> cfe/trunk/include/clang/Frontend/FrontendOptions.h
> cfe/trunk/lib/Driver/Tools.cpp
> cfe/trunk/lib/Frontend/CompilerInstance.cpp
> cfe/trunk/lib/Frontend/CompilerInvocation.cpp
> cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
> cfe/trunk/test/Misc/warning-flags.c
> 
> Modified: cfe/trunk/docs/CommandGuide/clang.rst
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/CommandGuide/clang.rst?rev=282426=282425=282426=diff
> ==
> --- cfe/trunk/docs/CommandGuide/clang.rst (original)
> +++ cfe/trunk/docs/CommandGuide/clang.rst Mon Sep 26 13:53:34 2016
> @@ -408,6 +408,12 @@ Driver Options
>  
>Save intermediate compilation results.
>  
> +.. option:: -save-stats, -save-stats=cwd, -save-stats=obj
> +
> +  Save internal code generation (LLVM) statistics to a file in the
> current
> +  directory (:option:`-save-stats`/:option:`-save-stats=cwd`) or the
> directory
> +  of the output file (:option:`-save-state=obj`).
> +
>  .. option:: -integrated-as, -no-integrated-as
>  
>Used to enable and disable, respectively, the use of the
>integrated
> 
> Modified: cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td?rev=282426=282425=282426=diff
> ==
> --- cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td
> (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td Mon Sep
> 26 13:53:34 2016
> @@ -107,6 +107,8 @@ def warn_fe_cc_print_header_failure : Wa
>  "unable to open CC_PRINT_HEADERS file: %0 (using stderr)">;
>  def warn_fe_cc_log_diagnostics_failure : Warning<
>  "unable to open CC_LOG_DIAGNOSTICS file: %0 (using stderr)">;
> +def warn_fe_unable_to_open_stats_file : Warning<
> +"unable to open statistics output file '%0': '%1'">;
>  def err_fe_no_pch_in_dir : Error<
>  "no suitable precompiled header file found in directory '%0'">;
>  def err_fe_action_not_available : Error<
> 
> Modified: cfe/trunk/include/clang/Driver/CC1Options.td
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=282426=282425=282426=diff
> ==
> --- cfe/trunk/include/clang/Driver/CC1Options.td (original)
> +++ cfe/trunk/include/clang/Driver/CC1Options.td Mon Sep 26 13:53:34
> 2016
> @@ -509,6 +509,8 @@ def arcmt_migrate : Flag<["-"], "arcmt-m
>  
>  def print_stats : Flag<["-"], "print-stats">,
>HelpText<"Print performance metrics and statistics">;
> +def stats_file : Joined<["-"], "stats-file=">,
> +  HelpText<"Filename to write statistics to">;
>  def fdump_record_layouts : Flag<["-"], "fdump-record-layouts">,
>HelpText<"Dump record layout information">;
>  def fdump_record_layouts_simple : Flag<["-"],
>  "fdump-record-layouts-simple">,
> 
> Modified: cfe/trunk/include/clang/Driver/Options.td
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=282426=282425=282426=diff
> ==
> --- cfe/trunk/include/clang/Driver/Options.td (original)
> +++ cfe/trunk/include/clang/Driver/Options.td Mon Sep 26 13:53:34
> 2016
> @@ -1876,6 +1876,11 @@ def save_temps_EQ : Joined<["-", "--"],
>  def save_temps : Flag<["-", "--"], "save-temps">,
>  Flags<[DriverOption]>,
>Alias, AliasArgs<["cwd"]>,
>HelpText<"Save intermediate compilation results">;
> +def save_stats_EQ : Joined<["-", "--"], "save-stats=">,
> Flags<[DriverOption]>,
> +  HelpText<"Save llvm statistics.">;
> +def save_stats : Flag<["-", "--"], "save-stats">,
> Flags<[DriverOption]>,
> +  Alias, AliasArgs<["cwd"]>,
> +  HelpText<"Save llvm statistics.">;
>  def via_file_asm : Flag<["-", "--"], "via-file-asm">,
>  InternalDebugOpt,
>HelpText<"Write assembly to file for input to assemble jobs">;
>  def sectalign : 

Re: [PATCH] D24820: Add -stats-stats option

2016-09-26 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL282426: CC1: Add -save-stats option (authored by matze).

Changed prior to commit:
  https://reviews.llvm.org/D24820?vs=72376=72532#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D24820

Files:
  cfe/trunk/docs/CommandGuide/clang.rst
  cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td
  cfe/trunk/include/clang/Driver/CC1Options.td
  cfe/trunk/include/clang/Driver/Options.td
  cfe/trunk/include/clang/Frontend/FrontendOptions.h
  cfe/trunk/lib/Driver/Tools.cpp
  cfe/trunk/lib/Frontend/CompilerInstance.cpp
  cfe/trunk/lib/Frontend/CompilerInvocation.cpp
  cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
  cfe/trunk/test/Driver/save-stats.c
  cfe/trunk/test/Frontend/stats-file.c
  cfe/trunk/test/Misc/warning-flags.c

Index: cfe/trunk/include/clang/Driver/Options.td
===
--- cfe/trunk/include/clang/Driver/Options.td
+++ cfe/trunk/include/clang/Driver/Options.td
@@ -1876,6 +1876,11 @@
 def save_temps : Flag<["-", "--"], "save-temps">, Flags<[DriverOption]>,
   Alias, AliasArgs<["cwd"]>,
   HelpText<"Save intermediate compilation results">;
+def save_stats_EQ : Joined<["-", "--"], "save-stats=">, Flags<[DriverOption]>,
+  HelpText<"Save llvm statistics.">;
+def save_stats : Flag<["-", "--"], "save-stats">, Flags<[DriverOption]>,
+  Alias, AliasArgs<["cwd"]>,
+  HelpText<"Save llvm statistics.">;
 def via_file_asm : Flag<["-", "--"], "via-file-asm">, InternalDebugOpt,
   HelpText<"Write assembly to file for input to assemble jobs">;
 def sectalign : MultiArg<["-"], "sectalign", 3>;
Index: cfe/trunk/include/clang/Driver/CC1Options.td
===
--- cfe/trunk/include/clang/Driver/CC1Options.td
+++ cfe/trunk/include/clang/Driver/CC1Options.td
@@ -509,6 +509,8 @@
 
 def print_stats : Flag<["-"], "print-stats">,
   HelpText<"Print performance metrics and statistics">;
+def stats_file : Joined<["-"], "stats-file=">,
+  HelpText<"Filename to write statistics to">;
 def fdump_record_layouts : Flag<["-"], "fdump-record-layouts">,
   HelpText<"Dump record layout information">;
 def fdump_record_layouts_simple : Flag<["-"], "fdump-record-layouts-simple">,
Index: cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td
===
--- cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td
+++ cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td
@@ -107,6 +107,8 @@
 "unable to open CC_PRINT_HEADERS file: %0 (using stderr)">;
 def warn_fe_cc_log_diagnostics_failure : Warning<
 "unable to open CC_LOG_DIAGNOSTICS file: %0 (using stderr)">;
+def warn_fe_unable_to_open_stats_file : Warning<
+"unable to open statistics output file '%0': '%1'">;
 def err_fe_no_pch_in_dir : Error<
 "no suitable precompiled header file found in directory '%0'">;
 def err_fe_action_not_available : Error<
Index: cfe/trunk/include/clang/Frontend/FrontendOptions.h
===
--- cfe/trunk/include/clang/Frontend/FrontendOptions.h
+++ cfe/trunk/include/clang/Frontend/FrontendOptions.h
@@ -273,6 +273,9 @@
   // included by this file.
   std::string FindPchSource;
 
+  /// Filename to write statistics to.
+  std::string StatsFile;
+
 public:
   FrontendOptions() :
 DisableFree(false), RelocatablePCH(false), ShowHelp(false),
Index: cfe/trunk/test/Misc/warning-flags.c
===
--- cfe/trunk/test/Misc/warning-flags.c
+++ cfe/trunk/test/Misc/warning-flags.c
@@ -18,7 +18,7 @@
 
 The list of warnings below should NEVER grow.  It should gradually shrink to 0.
 
-CHECK: Warnings without flags (84):
+CHECK: Warnings without flags (85):
 CHECK-NEXT:   ext_excess_initializers
 CHECK-NEXT:   ext_excess_initializers_in_char_array_initializer
 CHECK-NEXT:   ext_expected_semi_decl_list
@@ -66,6 +66,7 @@
 CHECK-NEXT:   warn_fe_cc_log_diagnostics_failure
 CHECK-NEXT:   warn_fe_cc_print_header_failure
 CHECK-NEXT:   warn_fe_macro_contains_embedded_newline
+CHECK-NEXT:   warn_fe_unable_to_open_stats_file
 CHECK-NEXT:   warn_file_asm_volatile
 CHECK-NEXT:   warn_ignoring_ftabstop_value
 CHECK-NEXT:   warn_implements_nscopying
Index: cfe/trunk/test/Driver/save-stats.c
===
--- cfe/trunk/test/Driver/save-stats.c
+++ cfe/trunk/test/Driver/save-stats.c
@@ -0,0 +1,20 @@
+// RUN: %clang -target x86_64-apple-darwin -save-stats %s -### 2>&1 | FileCheck %s
+// RUN: %clang -target x86_64-apple-darwin -save-stats=cwd %s -### 2>&1 | FileCheck %s
+// CHECK: "-stats-file=save-stats.stats"
+// CHECK: "{{.*}}save-stats.c"
+
+// RUN: %clang -target x86_64-apple-darwin -S %s -### 2>&1 | FileCheck %s -check-prefix=NO-STATS
+// NO-STATS-NO: -stats-file
+// NO-STATS: "{{.*}}save-stats.c"
+// NO-STATS-NO: 

r282426 - CC1: Add -save-stats option

2016-09-26 Thread Matthias Braun via cfe-commits
Author: matze
Date: Mon Sep 26 13:53:34 2016
New Revision: 282426

URL: http://llvm.org/viewvc/llvm-project?rev=282426=rev
Log:
CC1: Add -save-stats option

This option behaves in a similar spirit as -save-temps and writes
internal llvm statistics in json format to a file.

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

Added:
cfe/trunk/test/Driver/save-stats.c
cfe/trunk/test/Frontend/stats-file.c
Modified:
cfe/trunk/docs/CommandGuide/clang.rst
cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td
cfe/trunk/include/clang/Driver/CC1Options.td
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/include/clang/Frontend/FrontendOptions.h
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/lib/Frontend/CompilerInstance.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
cfe/trunk/test/Misc/warning-flags.c

Modified: cfe/trunk/docs/CommandGuide/clang.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/CommandGuide/clang.rst?rev=282426=282425=282426=diff
==
--- cfe/trunk/docs/CommandGuide/clang.rst (original)
+++ cfe/trunk/docs/CommandGuide/clang.rst Mon Sep 26 13:53:34 2016
@@ -408,6 +408,12 @@ Driver Options
 
   Save intermediate compilation results.
 
+.. option:: -save-stats, -save-stats=cwd, -save-stats=obj
+
+  Save internal code generation (LLVM) statistics to a file in the current
+  directory (:option:`-save-stats`/:option:`-save-stats=cwd`) or the directory
+  of the output file (:option:`-save-state=obj`).
+
 .. option:: -integrated-as, -no-integrated-as
 
   Used to enable and disable, respectively, the use of the integrated

Modified: cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td?rev=282426=282425=282426=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td Mon Sep 26 
13:53:34 2016
@@ -107,6 +107,8 @@ def warn_fe_cc_print_header_failure : Wa
 "unable to open CC_PRINT_HEADERS file: %0 (using stderr)">;
 def warn_fe_cc_log_diagnostics_failure : Warning<
 "unable to open CC_LOG_DIAGNOSTICS file: %0 (using stderr)">;
+def warn_fe_unable_to_open_stats_file : Warning<
+"unable to open statistics output file '%0': '%1'">;
 def err_fe_no_pch_in_dir : Error<
 "no suitable precompiled header file found in directory '%0'">;
 def err_fe_action_not_available : Error<

Modified: cfe/trunk/include/clang/Driver/CC1Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=282426=282425=282426=diff
==
--- cfe/trunk/include/clang/Driver/CC1Options.td (original)
+++ cfe/trunk/include/clang/Driver/CC1Options.td Mon Sep 26 13:53:34 2016
@@ -509,6 +509,8 @@ def arcmt_migrate : Flag<["-"], "arcmt-m
 
 def print_stats : Flag<["-"], "print-stats">,
   HelpText<"Print performance metrics and statistics">;
+def stats_file : Joined<["-"], "stats-file=">,
+  HelpText<"Filename to write statistics to">;
 def fdump_record_layouts : Flag<["-"], "fdump-record-layouts">,
   HelpText<"Dump record layout information">;
 def fdump_record_layouts_simple : Flag<["-"], "fdump-record-layouts-simple">,

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=282426=282425=282426=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Mon Sep 26 13:53:34 2016
@@ -1876,6 +1876,11 @@ def save_temps_EQ : Joined<["-", "--"],
 def save_temps : Flag<["-", "--"], "save-temps">, Flags<[DriverOption]>,
   Alias, AliasArgs<["cwd"]>,
   HelpText<"Save intermediate compilation results">;
+def save_stats_EQ : Joined<["-", "--"], "save-stats=">, Flags<[DriverOption]>,
+  HelpText<"Save llvm statistics.">;
+def save_stats : Flag<["-", "--"], "save-stats">, Flags<[DriverOption]>,
+  Alias, AliasArgs<["cwd"]>,
+  HelpText<"Save llvm statistics.">;
 def via_file_asm : Flag<["-", "--"], "via-file-asm">, InternalDebugOpt,
   HelpText<"Write assembly to file for input to assemble jobs">;
 def sectalign : MultiArg<["-"], "sectalign", 3>;

Modified: cfe/trunk/include/clang/Frontend/FrontendOptions.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/FrontendOptions.h?rev=282426=282425=282426=diff
==
--- cfe/trunk/include/clang/Frontend/FrontendOptions.h (original)
+++ cfe/trunk/include/clang/Frontend/FrontendOptions.h Mon Sep 26 13:53:34 2016
@@ -273,6 +273,9 @@ 

Re: [PATCH] D24916: [analyzer] Extend bug reports with extra notes - CloneChecker

2016-09-26 Thread Vassil Vassilev via cfe-commits
v.g.vassilev added inline comments.


Comment at: lib/StaticAnalyzer/Checkers/CloneChecker.cpp:102
@@ -95,5 +101,3 @@
 // as a note.
-DiagEngine.Report(Group.Sequences.front().getStartLoc(), WarnID);
-for (unsigned i = 1; i < Group.Sequences.size(); ++i) {
-  DiagEngine.Report(Group.Sequences[i].getStartLoc(), NoteID);
-}
+static const char *const MsgSingular = "Clone of this code was detected";
+static const char *const MsgPlural = "Clones of this code were detected";

I was thinking whether we shouldn't say `code snippet` or something that 
qualifies code, as it is too generic term.


Comment at: lib/StaticAnalyzer/Checkers/CloneChecker.cpp:112
@@ +111,3 @@
+  R->addNote("Code clone here",
+  makeLocation(Group.Sequences[i], Mgr),
+  Group.Sequences[i].getSourceRange());

Is that missing an indent?


https://reviews.llvm.org/D24916



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


Re: [PATCH] D24864: [libcxxabi] Refactor pthread usage into a separate API

2016-09-26 Thread Saleem Abdulrasool via cfe-commits
compnerd added inline comments.


Comment at: src/config.h:41
@@ +40,3 @@
+defined(__CloudABI__) || \
+defined(__sun__)
+#  define _LIBCXXABI_HAS_THREAD_API_PTHREAD

Can you change this to `defined(__sun__) && defined(_POSIX_THREADS)` at the 
very least?  There is no reason to assume pthreads on Solaris.  Solaris Threads 
are a valid threading model.


Comment at: src/config.h:42
@@ +41,3 @@
+defined(__sun__)
+#  define _LIBCXXABI_HAS_THREAD_API_PTHREAD
+# else

Can we use `_LIBCXXABI_USE_THREAD_API_PTHREAD` instead?  You can have more than 
one threading API on a platform, and wish to use a specific one.


Comment at: src/config.h:46
@@ +45,3 @@
+# endif
+#endif
+

I really think that we should use `_POSIX_THREADS` macro rather than this 
enumeration approach.


Comment at: test/test_fallback_malloc.pass.cpp:13
@@ -12,3 +12,3 @@
 
-#include 
+#include "../src/threading_support.h"
 

Can we add the include directory as a header search path for the tests?  Seems 
it may be nicer, but, obviously, we can do that later.


https://reviews.llvm.org/D24864



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


Re: [PATCH] D24862: Workaround ASTMatcher crashes. Added some more test cases.

2016-09-26 Thread Haojian Wu via cfe-commits
hokein accepted this revision.
hokein added a comment.

LGTM.


https://reviews.llvm.org/D24862



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


[PATCH] D24933: Enable configuration files in clang

2016-09-26 Thread Serge Pavlov via cfe-commits
sepavloff created this revision.
sepavloff added reviewers: rnk, ddunbar.
sepavloff added a subscriber: cfe-commits.

The implementation follows the discussion in mail list
(http://lists.llvm.org/pipermail/cfe-dev/2016-September/050776.html).
Main part of the config file support is implemented in llvm source tree,
in CommandLine library, see D24926 and D24917.

https://reviews.llvm.org/D24933

Files:
  include/clang/Driver/Driver.h
  lib/Driver/Driver.cpp
  test/Driver/Inputs/config-1.cfg
  test/Driver/Inputs/config-2.cfg
  test/Driver/config-file.c
  tools/driver/driver.cpp

Index: tools/driver/driver.cpp
===
--- tools/driver/driver.cpp
+++ tools/driver/driver.cpp
@@ -330,6 +330,14 @@
   llvm::BumpPtrAllocator A;
   llvm::StringSaver Saver(A);
 
+  // Try reading options from configuration file.
+  static const char * const SearchDirs[] = { "~/.llvm", "/etc/llvm" };
+  llvm::SmallString<128> ConfigFile;
+  auto SRes = llvm::cl::findConfigFile(ConfigFile, argv, SearchDirs, "clang");
+  llvm::cl::reportConfigFileSearchError(SRes, ConfigFile, SearchDirs, ProgName);
+  if (SRes == llvm::cl::CfgFileSearch::Successful)
+llvm::cl::readConfigFile(ConfigFile, Saver, argv);
+
   // Parse response files using the GNU syntax, unless we're in CL mode. There
   // are two ways to put clang in CL compatibility mode: argv[0] is either
   // clang-cl or cl, or --driver-mode=cl is on the command line. The normal
@@ -446,6 +454,8 @@
   ProcessWarningOptions(Diags, *DiagOpts, /*ReportDiags=*/false);
 
   Driver TheDriver(Path, llvm::sys::getDefaultTargetTriple(), Diags);
+  if (!ConfigFile.empty())
+TheDriver.setConfigFile(ConfigFile.str());
   SetInstallDir(argv, TheDriver, CanonicalPrefixes);
 
   insertTargetAndModeArgs(TargetAndMode.first, TargetAndMode.second, argv,
Index: test/Driver/config-file.c
===
--- /dev/null
+++ test/Driver/config-file.c
@@ -0,0 +1,30 @@
+// RUN: %clang --config %S/Inputs/config-1.cfg -c %s -### 2>&1 | FileCheck %s -check-prefix CHECK-HHH
+// CHECK-HHH: Target: x86_64-apple-darwin
+// CHECK-HHH: Configuration file: {{.*}}/Inputs/config-1.cfg
+// CHECK-HHH: -Werror
+// CHECK-HHH: -std=c99
+
+// RUN: not %clang --config %S/Inputs/inexistent.cfg -c %s -### 2>&1 | FileCheck %s -check-prefix CHECK-INEX
+// CHECK-INEX: Configuration file {{.*}}/Inputs/inexistent.cfg' specified by option '--config' cannot be found
+
+// RUN: not %clang --config inexistent.cfg -c %s -### 2>&1 | FileCheck %s -check-prefix CHECK-INEX-NOSEARCH
+// CHECK-INEX-NOSEARCH: Configuration {{.*}}inexistent.cfg' specified by option '--config' cannot be found in directories:
+// CHECK-INEX-NOSEARCH: ~/.llvm
+// CHECK-INEX-NOSEARCH: /etc/llvm
+
+// RUN: %clang --config %S/Inputs/config-2.cfg -### 2>&1 | FileCheck %s -check-prefix CHECK-HHH-NOFILE
+// CHECK-HHH-NOFILE: Target: x86_64-unknown-linux
+// CHECK-HHH-NOFILE: Configuration file: {{.*}}/Inputs/config-2.cfg
+
+// RUN: %clang --config %S/Inputs/config-1.cfg -c %s -v 2>&1 | FileCheck %s -check-prefix CHECK-V
+// CHECK-V: Target: x86_64-apple-darwin
+// CHECK-V: Configuration file: {{.*}}/Inputs/config-1.cfg
+// CHECK-V: -triple{{.*}}x86_64-apple-
+
+// RUN: env CLANGCFG=%S/Inputs/config-1.cfg %clang -c %s -### 2>&1 | FileCheck %s -check-prefix CHECK-ENV
+// CHECK-ENV: Target: x86_64-apple-darwin
+// CHECK-ENV: Configuration file: {{.*}}/Inputs/config-1.cfg
+// CHECK-ENV: -Werror
+
+// RUN: env CLANGCFG=inexistent.cfg not %clang -c %s -### 2>&1 | FileCheck %s -check-prefix CHECK-ENV-INEX
+// CHECK-ENV-INEX: Configuration file 'inexistent.cfg' specified by environment variable cannot be found
Index: test/Driver/Inputs/config-2.cfg
===
--- /dev/null
+++ test/Driver/Inputs/config-2.cfg
@@ -0,0 +1,2 @@
+# target
+-target x86_64-unknown-linux-gnu
Index: test/Driver/Inputs/config-1.cfg
===
--- /dev/null
+++ test/Driver/Inputs/config-1.cfg
@@ -0,0 +1,7 @@
+
+
+# Empty lines and line started with # are ignored
+-Werror -std=\
+c99
+# Target
+-target x86_64-apple-darwin
\ No newline at end of file
Index: lib/Driver/Driver.cpp
===
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -895,6 +895,10 @@
 
   // Print out the install directory.
   OS << "InstalledDir: " << InstalledDir << '\n';
+
+  // If configuration file was used, print its path.
+  if (!ConfigFile.empty())
+OS << "Configuration file: " << ConfigFile << '\n';
 }
 
 /// PrintDiagnosticCategories - Implement the --print-diagnostic-categories
Index: include/clang/Driver/Driver.h
===
--- include/clang/Driver/Driver.h
+++ include/clang/Driver/Driver.h
@@ -187,6 +187,9 @@
   /// Name to use when invoking gcc/g++.
   

[PATCH] D24932: Fix PR 30440

2016-09-26 Thread Alex Lorenz via cfe-commits
arphaman created this revision.
arphaman added a reviewer: DmitryPolukhin.
arphaman added a subscriber: cfe-commits.
arphaman set the repository for this revision to rL LLVM.

This patch fixes PR 30440 by initializing CXXNameMangler's FunctionTypeDepth in 
the two constructors added in r274222 (The commit that caused this regression).

Repository:
  rL LLVM

https://reviews.llvm.org/D24932

Files:
  lib/AST/ItaniumMangle.cpp
  test/CodeGenCXX/mangle-abi-tag.cpp

Index: test/CodeGenCXX/mangle-abi-tag.cpp
===
--- test/CodeGenCXX/mangle-abi-tag.cpp
+++ test/CodeGenCXX/mangle-abi-tag.cpp
@@ -219,3 +219,16 @@
 }
 // f19_test(N19::C, N19::F, N19::D)
 // CHECK-DAG: define void 
@_Z8f19_testN3N191CINS_1AEXadL_ZNS_3fooB1BES1_NS_1DENS_1FES2_(
+
+namespace pr30440 {
+
+template void g(F);
+template auto h(A ...a)->decltype (g (0, g < a > (a) ...)) {
+}
+// CHECK-DAG: define {{.*}} 
@_ZN7pr304401hIJEEEDTcl1gLi0Espcl1gIL_ZZNS_1hEDpT_E1aEEfp_EEES2_(
+
+void pr30440_test () {
+  h();
+}
+
+}
Index: lib/AST/ItaniumMangle.cpp
===
--- lib/AST/ItaniumMangle.cpp
+++ lib/AST/ItaniumMangle.cpp
@@ -405,14 +405,14 @@
   CXXNameMangler(CXXNameMangler , raw_ostream _)
   : Context(Outer.Context), Out(Out_), NullOut(false),
 Structor(Outer.Structor), StructorType(Outer.StructorType),
-SeqID(Outer.SeqID), AbiTagsRoot(AbiTags),
-Substitutions(Outer.Substitutions) {}
+SeqID(Outer.SeqID), FunctionTypeDepth(Outer.FunctionTypeDepth),
+AbiTagsRoot(AbiTags), Substitutions(Outer.Substitutions) {}
 
   CXXNameMangler(CXXNameMangler , llvm::raw_null_ostream _)
   : Context(Outer.Context), Out(Out_), NullOut(true),
 Structor(Outer.Structor), StructorType(Outer.StructorType),
-SeqID(Outer.SeqID), AbiTagsRoot(AbiTags),
-Substitutions(Outer.Substitutions) {}
+SeqID(Outer.SeqID), FunctionTypeDepth(Outer.FunctionTypeDepth),
+AbiTagsRoot(AbiTags), Substitutions(Outer.Substitutions) {}
 
 #if MANGLE_CHECKER
   ~CXXNameMangler() {


Index: test/CodeGenCXX/mangle-abi-tag.cpp
===
--- test/CodeGenCXX/mangle-abi-tag.cpp
+++ test/CodeGenCXX/mangle-abi-tag.cpp
@@ -219,3 +219,16 @@
 }
 // f19_test(N19::C, N19::F, N19::D)
 // CHECK-DAG: define void @_Z8f19_testN3N191CINS_1AEXadL_ZNS_3fooB1BES1_NS_1DENS_1FES2_(
+
+namespace pr30440 {
+
+template void g(F);
+template auto h(A ...a)->decltype (g (0, g < a > (a) ...)) {
+}
+// CHECK-DAG: define {{.*}} @_ZN7pr304401hIJEEEDTcl1gLi0Espcl1gIL_ZZNS_1hEDpT_E1aEEfp_EEES2_(
+
+void pr30440_test () {
+  h();
+}
+
+}
Index: lib/AST/ItaniumMangle.cpp
===
--- lib/AST/ItaniumMangle.cpp
+++ lib/AST/ItaniumMangle.cpp
@@ -405,14 +405,14 @@
   CXXNameMangler(CXXNameMangler , raw_ostream _)
   : Context(Outer.Context), Out(Out_), NullOut(false),
 Structor(Outer.Structor), StructorType(Outer.StructorType),
-SeqID(Outer.SeqID), AbiTagsRoot(AbiTags),
-Substitutions(Outer.Substitutions) {}
+SeqID(Outer.SeqID), FunctionTypeDepth(Outer.FunctionTypeDepth),
+AbiTagsRoot(AbiTags), Substitutions(Outer.Substitutions) {}
 
   CXXNameMangler(CXXNameMangler , llvm::raw_null_ostream _)
   : Context(Outer.Context), Out(Out_), NullOut(true),
 Structor(Outer.Structor), StructorType(Outer.StructorType),
-SeqID(Outer.SeqID), AbiTagsRoot(AbiTags),
-Substitutions(Outer.Substitutions) {}
+SeqID(Outer.SeqID), FunctionTypeDepth(Outer.FunctionTypeDepth),
+AbiTagsRoot(AbiTags), Substitutions(Outer.Substitutions) {}
 
 #if MANGLE_CHECKER
   ~CXXNameMangler() {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D24916: [analyzer] Extend bug reports with extra notes - CloneChecker

2016-09-26 Thread Artem Dergachev via cfe-commits
NoQ updated this revision to Diff 72521.
NoQ added a comment.

Addressed inline comments on the original review 
https://reviews.llvm.org/D24278. Rebased on top of the updated 
https://reviews.llvm.org/D24278. Changed warning messages completely according 
to Anna's comments in https://reviews.llvm.org/D24278.


https://reviews.llvm.org/D24916

Files:
  include/clang/Analysis/CloneDetection.h
  lib/Analysis/CloneDetection.cpp
  lib/StaticAnalyzer/Checkers/CloneChecker.cpp
  test/Analysis/copypaste/blocks.cpp
  test/Analysis/copypaste/function-try-block.cpp
  test/Analysis/copypaste/functions.cpp
  test/Analysis/copypaste/macro-complexity.cpp
  test/Analysis/copypaste/macros.cpp
  test/Analysis/copypaste/objc-methods.m
  test/Analysis/copypaste/plist-diagnostics.cpp
  test/Analysis/copypaste/sub-sequences.cpp
  test/Analysis/copypaste/suspicious-clones.cpp
  test/Analysis/copypaste/text-diagnostics.cpp
  test/Analysis/plist-diagnostics-notes-as-events.cpp

Index: test/Analysis/plist-diagnostics-notes-as-events.cpp
===
--- /dev/null
+++ test/Analysis/plist-diagnostics-notes-as-events.cpp
@@ -0,0 +1,97 @@
+// RUN: %clang_cc1 -analyze -analyzer-output=plist -analyzer-config notes-as-events=true -o %t.plist -std=c++11 -analyzer-checker=alpha.clone.CloneChecker -verify %s
+// RUN: FileCheck --input-file=%t.plist %s
+
+void log();
+
+int max(int a, int b) { // expected-warning{{Clone of this code was detected}}
+  log();
+  if (a > b)
+return a;
+  return b;
+}
+
+int maxClone(int a, int b) { // no-note (converted into event)
+  log();
+  if (a > b)
+return a;
+  return b;
+}
+
+// CHECK:  diagnostics
+// CHECK-NEXT:  
+// CHECK-NEXT:   
+// CHECK-NEXT:path
+// CHECK-NEXT:
+// CHECK-NEXT: 
+// CHECK-NEXT:  kindevent
+// CHECK-NEXT:  location
+// CHECK-NEXT:  
+// CHECK-NEXT:   line13
+// CHECK-NEXT:   col28
+// CHECK-NEXT:   file0
+// CHECK-NEXT:  
+// CHECK-NEXT:  ranges
+// CHECK-NEXT:  
+// CHECK-NEXT:
+// CHECK-NEXT: 
+// CHECK-NEXT:  line13
+// CHECK-NEXT:  col28
+// CHECK-NEXT:  file0
+// CHECK-NEXT: 
+// CHECK-NEXT: 
+// CHECK-NEXT:  line18
+// CHECK-NEXT:  col1
+// CHECK-NEXT:  file0
+// CHECK-NEXT: 
+// CHECK-NEXT:
+// CHECK-NEXT:  
+// CHECK-NEXT:  depth0
+// CHECK-NEXT:  extended_message
+// CHECK-NEXT:  Code clone here
+// CHECK-NEXT:  message
+// CHECK-NEXT:  Code clone here
+// CHECK-NEXT: 
+// CHECK-NEXT: 
+// CHECK-NEXT:  kindevent
+// CHECK-NEXT:  location
+// CHECK-NEXT:  
+// CHECK-NEXT:   line6
+// CHECK-NEXT:   col23
+// CHECK-NEXT:   file0
+// CHECK-NEXT:  
+// CHECK-NEXT:  ranges
+// CHECK-NEXT:  
+// CHECK-NEXT:
+// CHECK-NEXT: 
+// CHECK-NEXT:  line6
+// CHECK-NEXT:  col23
+// CHECK-NEXT:  file0
+// CHECK-NEXT: 
+// CHECK-NEXT: 
+// CHECK-NEXT:  line11
+// CHECK-NEXT:  col1
+// CHECK-NEXT:  file0
+// CHECK-NEXT: 
+// CHECK-NEXT:
+// CHECK-NEXT:  
+// CHECK-NEXT:  depth0
+// CHECK-NEXT:  extended_message
+// CHECK-NEXT:  Clone of this code was detected
+// CHECK-NEXT:  message
+// CHECK-NEXT:  Clone of this code was detected
+// CHECK-NEXT: 
+// CHECK-NEXT:
+// CHECK-NEXT:descriptionClone of this code was detected
+// CHECK-NEXT:categoryCode clone
+// CHECK-NEXT:typeExact code clone
+// CHECK-NEXT:check_namealpha.clone.CloneChecker
+// CHECK-NEXT:
+// CHECK-NEXT:issue_hash_content_of_line_in_context3d15184f38c5fa57e479b744fe3f5035
+// CHECK-NEXT:   location
+// CHECK-NEXT:   
+// CHECK-NEXT:line6
+// CHECK-NEXT:col23
+// CHECK-NEXT:file0
+// CHECK-NEXT:   
+// CHECK-NEXT:   
+// CHECK-NEXT:  
Index: test/Analysis/copypaste/text-diagnostics.cpp
===
--- /dev/null
+++ test/Analysis/copypaste/text-diagnostics.cpp
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -analyze -analyzer-output=text -std=c++11 -analyzer-checker=alpha.clone.CloneChecker -verify %s
+
+void log();
+
+int max(int a, int b) { // expected-warning{{Clone of this code was detected}} // expected-note{{Clone of this code was detected}}
+  log();
+  if (a > b)
+return a;
+  return b;
+}
+
+int maxClone(int a, int b) { // expected-note{{Code clone here}}
+  log();
+  if (a > b)
+return a;
+  return b;
+}
Index: test/Analysis/copypaste/suspicious-clones.cpp
===
--- test/Analysis/copypaste/suspicious-clones.cpp
+++ test/Analysis/copypaste/suspicious-clones.cpp
@@ -8,14 +8,14 @@
   log();
   if (a > b)
 return a;
-  return b; // expected-note{{suggestion is based on the usage of this variable in a similar piece of code}}
+  return b; // expected-note{{Suggestion is 

Re: [PATCH] D24813: Driver: Add a test for triple with opencl environment

2016-09-26 Thread Anastasia Stulova via cfe-commits
Anastasia accepted this revision.
Anastasia added a comment.
This revision is now accepted and ready to land.

LGTM!


https://reviews.llvm.org/D24813



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


Re: [PATCH] D24915: [analyzer] Extend bug reports with extra notes - ObjCDeallocChecker

2016-09-26 Thread Artem Dergachev via cfe-commits
NoQ updated this revision to Diff 72520.
NoQ added a comment.

Addressed two inline comments by Devin in the original review 
https://reviews.llvm.org/D24278. Rebased on top of the updated 
https://reviews.llvm.org/D24278.


https://reviews.llvm.org/D24915

Files:
  lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp
  test/Analysis/DeallocMissingRelease.m
  test/Analysis/PR2978.m
  test/Analysis/properties.m

Index: test/Analysis/properties.m
===
--- test/Analysis/properties.m
+++ test/Analysis/properties.m
@@ -134,11 +134,17 @@
   NSString *_name;
 }
 @property (retain) NSString * name;
+#if !__has_feature(objc_arc)
+// expected-note@-2 {{Property is declared here}}
+#endif
 @property (assign) id friend;
 @end
 
 @implementation Person
 @synthesize name = _name;
+#if !__has_feature(objc_arc)
+// expected-note@-2 {{Property is synthesized here}}
+#endif
 
 -(void)dealloc {
 #if !__has_feature(objc_arc)
Index: test/Analysis/PR2978.m
===
--- test/Analysis/PR2978.m
+++ test/Analysis/PR2978.m
@@ -29,22 +29,22 @@
   id _nonPropertyIvar;
 }
 @property(retain) id X;
-@property(retain) id Y;
-@property(assign) id Z;
+@property(retain) id Y; // expected-note{{Property is declared here}}
+@property(assign) id Z; // expected-note{{Property is declared here}}
 @property(assign) id K;
 @property(weak) id L;
 @property(readonly) id N;
 @property(retain) id M;
 @property(weak) id P;
-@property(weak) id Q;
+@property(weak) id Q; // expected-note{{Property is declared here}}
 @property(retain) id R;
-@property(weak, readonly) id S;
+@property(weak, readonly) id S; // expected-note{{Property is declared here}}
 
 @property(assign, readonly) id T; // Shadowed in class extension
 @property(assign) id U;
 
 @property(retain) id V;
-@property(retain) id W;
+@property(retain) id W; // expected-note{{Property is declared here}}
 -(id) O;
 -(void) setO: (id) arg;
 @end
@@ -56,16 +56,16 @@
 
 @implementation MyClass
 @synthesize X = _X;
-@synthesize Y = _Y;
-@synthesize Z = _Z;
+@synthesize Y = _Y; // expected-note{{Property is synthesized here}}
+@synthesize Z = _Z; // expected-note{{Property is synthesized here}}
 @synthesize K = _K;
 @synthesize L = _L;
 @synthesize N = _N;
 @synthesize M = _M;
-@synthesize Q = _Q;
+@synthesize Q = _Q; // expected-note{{Property is synthesized here}}
 @synthesize R = _R;
 @synthesize V = _V;
-@synthesize W = _W;
+@synthesize W = _W; // expected-note{{Property is synthesized here}}
 
 -(id) O{ return 0; }
 -(void) setO:(id)arg { }
Index: test/Analysis/DeallocMissingRelease.m
===
--- test/Analysis/DeallocMissingRelease.m
+++ test/Analysis/DeallocMissingRelease.m
@@ -80,6 +80,9 @@
 
 @interface MyPropertyClass1 : NSObject
 @property (copy) NSObject *ivar;
+#if NON_ARC
+// expected-note@-2 {{Property is declared here}}
+#endif
 @end
 
 @implementation MyPropertyClass1
@@ -93,6 +96,9 @@
 
 @interface MyPropertyClass2 : NSObject
 @property (retain) NSObject *ivar;
+#if NON_ARC
+// expected-note@-2 {{Property is declared here}}
+#endif
 @end
 
 @implementation MyPropertyClass2
@@ -108,10 +114,16 @@
   NSObject *_ivar;
 }
 @property (retain) NSObject *ivar;
+#if NON_ARC
+// expected-note@-2 {{Property is declared here}}
+#endif
 @end
 
 @implementation MyPropertyClass3
 @synthesize ivar = _ivar;
+#if NON_ARC
+// expected-note@-2 {{Property is synthesized here}}
+#endif
 - (void)dealloc
 {
 #if NON_ARC
@@ -125,13 +137,19 @@
   void (^_blockPropertyIvar)(void);
 }
 @property (copy) void (^blockProperty)(void);
+#if NON_ARC
+// expected-note@-2 {{Property is declared here}}
+#endif
 @property (copy) void (^blockProperty2)(void);
 @property (copy) void (^blockProperty3)(void);
 
 @end
 
 @implementation MyPropertyClass4
 @synthesize blockProperty = _blockPropertyIvar;
+#if NON_ARC
+// expected-note@-2 {{Property is synthesized here}}
+#endif
 - (void)dealloc
 {
 #if NON_ARC
@@ -163,10 +181,16 @@
   NSObject *_ivar;
 }
 @property (retain) NSObject *ivar;
+#if NON_ARC
+// expected-note@-2 {{Property is declared here}}
+#endif
 @end
 
 @implementation MyPropertyClassWithReturnInDealloc
 @synthesize ivar = _ivar;
+#if NON_ARC
+// expected-note@-2 {{Property is synthesized here}}
+#endif
 - (void)dealloc
 {
   return;
@@ -182,12 +206,18 @@
   MyPropertyClassWithReleaseInOtherInstance *_other;
 }
 @property (retain) NSObject *ivar;
+#if NON_ARC
+// expected-note@-2 {{Property is declared here}}
+#endif
 
 -(void)releaseIvars;
 @end
 
 @implementation MyPropertyClassWithReleaseInOtherInstance
 @synthesize ivar = _ivar;
+#if NON_ARC
+// expected-note@-2 {{Property is synthesized here}}
+#endif
 
 -(void)releaseIvars; {
 #if NON_ARC
@@ -208,10 +238,16 @@
   NSObject *_ivar;
 }
 @property (retain) NSObject *ivar;
+#if NON_ARC
+// expected-note@-2 {{Property is declared here}}
+#endif
 @end
 
 @implementation 

Re: [PATCH] D24278: [analyzer] Extend bug reports with extra notes.

2016-09-26 Thread Artem Dergachev via cfe-commits
NoQ updated this revision to Diff 72519.
NoQ marked 10 inline comments as done.
NoQ added a comment.

Addressed inline comments. Renamed extra notes to notes.


https://reviews.llvm.org/D24278

Files:
  include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
  include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
  include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
  lib/Rewrite/HTMLRewrite.cpp
  lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
  lib/StaticAnalyzer/Core/BugReporter.cpp
  lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
  lib/StaticAnalyzer/Core/PathDiagnostic.cpp
  lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
  lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp

Index: lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
===
--- lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
+++ lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
@@ -113,16 +113,28 @@
   Diag.Report(WarnLoc, WarnID) << PD->getShortDescription()
<< PD->path.back()->getRanges();
 
+  // First, add extra notes, even if paths should not be included.
+  for (const auto  : PD->path) {
+if (!isa(Piece.get()))
+  continue;
+
+SourceLocation NoteLoc = Piece->getLocation().asLocation();
+Diag.Report(NoteLoc, NoteID) << Piece->getString()
+ << Piece->getRanges();
+  }
+
   if (!IncludePath)
 continue;
 
+  // Then, add the path notes if necessary.
   PathPieces FlatPath = PD->path.flatten(/*ShouldFlattenMacros=*/true);
-  for (PathPieces::const_iterator PI = FlatPath.begin(),
-  PE = FlatPath.end();
-   PI != PE; ++PI) {
-SourceLocation NoteLoc = (*PI)->getLocation().asLocation();
-Diag.Report(NoteLoc, NoteID) << (*PI)->getString()
- << (*PI)->getRanges();
+  for (const auto  : FlatPath) {
+if (isa(Piece.get()))
+  continue;
+
+SourceLocation NoteLoc = Piece->getLocation().asLocation();
+Diag.Report(NoteLoc, NoteID) << Piece->getString()
+ << Piece->getRanges();
   }
 }
   }
Index: lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
===
--- lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
+++ lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
@@ -281,6 +281,9 @@
   ReportMacro(o, cast(P), FM, SM, LangOpts,
   indent, depth);
   break;
+case PathDiagnosticPiece::Note:
+  // FIXME: Extend the plist format to support those.
+  break;
   }
 }
 
Index: lib/StaticAnalyzer/Core/PathDiagnostic.cpp
===
--- lib/StaticAnalyzer/Core/PathDiagnostic.cpp
+++ lib/StaticAnalyzer/Core/PathDiagnostic.cpp
@@ -60,6 +60,7 @@
 PathDiagnosticCallPiece::~PathDiagnosticCallPiece() {}
 PathDiagnosticControlFlowPiece::~PathDiagnosticControlFlowPiece() {}
 PathDiagnosticMacroPiece::~PathDiagnosticMacroPiece() {}
+PathDiagnosticNotePiece::~PathDiagnosticNotePiece() {}
 
 void PathPieces::flattenTo(PathPieces , PathPieces ,
bool ShouldFlattenMacros) const {
@@ -95,6 +96,7 @@
 }
 case PathDiagnosticPiece::Event:
 case PathDiagnosticPiece::ControlFlow:
+case PathDiagnosticPiece::Note:
   Current.push_back(Piece);
   break;
 }
@@ -342,15 +344,16 @@
   }
 
   switch (X.getKind()) {
-case clang::ento::PathDiagnosticPiece::ControlFlow:
+case PathDiagnosticPiece::ControlFlow:
   return compareControlFlow(cast(X),
 cast(Y));
-case clang::ento::PathDiagnosticPiece::Event:
+case PathDiagnosticPiece::Event:
+case PathDiagnosticPiece::Note:
   return None;
-case clang::ento::PathDiagnosticPiece::Macro:
+case PathDiagnosticPiece::Macro:
   return compareMacro(cast(X),
   cast(Y));
-case clang::ento::PathDiagnosticPiece::Call:
+case PathDiagnosticPiece::Call:
   return compareCall(cast(X),
  cast(Y));
   }
@@ -1098,6 +1101,10 @@
 ID.Add(**I);
 }
 
+void PathDiagnosticNotePiece::Profile(llvm::FoldingSetNodeID ) const {
+  PathDiagnosticSpotPiece::Profile(ID);
+}
+
 void PathDiagnostic::Profile(llvm::FoldingSetNodeID ) const {
   ID.Add(getLocation());
   ID.AddString(BugType);
Index: lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
===
--- lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
+++ lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
@@ -152,13 +152,30 @@
   }
 
   // Process the path.
-  unsigned n = path.size();
-  unsigned max = n;
-
-  for (PathPieces::const_reverse_iterator I = path.rbegin(),
-   E = path.rend();
-I != E; ++I, --n)
-HandlePiece(R, FID, **I, n, max);
+  // Maintain the counts of 

Re: [PATCH] D24874: Fully implement the matcher for CXXCtorInitializer

2016-09-26 Thread Aaron Ballman via cfe-commits
aaron.ballman closed this revision.
aaron.ballman added a comment.

Thanks! Commit in r282417


https://reviews.llvm.org/D24874



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


r282417 - Complete support for the cxxCtorInitializer() AST matcher so that it can be used as a top-level matcher.

2016-09-26 Thread Aaron Ballman via cfe-commits
Author: aaronballman
Date: Mon Sep 26 12:04:27 2016
New Revision: 282417

URL: http://llvm.org/viewvc/llvm-project?rev=282417=rev
Log:
Complete support for the cxxCtorInitializer() AST matcher so that it can be 
used as a top-level matcher.

Modified:
cfe/trunk/include/clang/ASTMatchers/ASTMatchFinder.h
cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
cfe/trunk/lib/ASTMatchers/ASTMatchFinder.cpp
cfe/trunk/unittests/ASTMatchers/ASTMatchersNodeTest.cpp

Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchFinder.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchFinder.h?rev=282417=282416=282417=diff
==
--- cfe/trunk/include/clang/ASTMatchers/ASTMatchFinder.h (original)
+++ cfe/trunk/include/clang/ASTMatchers/ASTMatchFinder.h Mon Sep 26 12:04:27 
2016
@@ -158,6 +158,8 @@ public:
   MatchCallback *Action);
   void addMatcher(const TypeLocMatcher ,
   MatchCallback *Action);
+  void addMatcher(const CXXCtorInitializerMatcher ,
+  MatchCallback *Action);
   /// @}
 
   /// \brief Adds a matcher to execute when running over the AST.
@@ -208,6 +210,7 @@ public:
 std::vector>
 NestedNameSpecifierLoc;
 std::vector> TypeLoc;
+std::vector> 
CtorInit;
 /// \brief All the callbacks in one container to simplify iteration.
 llvm::SmallPtrSet AllCallbacks;
   };

Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h?rev=282417=282416=282417=diff
==
--- cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h (original)
+++ cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h Mon Sep 26 12:04:27 2016
@@ -125,6 +125,7 @@ typedef internal::Matcher Type
 typedef internal::Matcher TypeLocMatcher;
 typedef internal::Matcher NestedNameSpecifierMatcher;
 typedef internal::Matcher 
NestedNameSpecifierLocMatcher;
+typedef internal::Matcher CXXCtorInitializerMatcher;
 /// @}
 
 /// \brief Matches any node.

Modified: cfe/trunk/lib/ASTMatchers/ASTMatchFinder.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ASTMatchers/ASTMatchFinder.cpp?rev=282417=282416=282417=diff
==
--- cfe/trunk/lib/ASTMatchers/ASTMatchFinder.cpp (original)
+++ cfe/trunk/lib/ASTMatchers/ASTMatchFinder.cpp Mon Sep 26 12:04:27 2016
@@ -126,6 +126,8 @@ public:
   traverse(*Q);
 else if (const TypeLoc *T = DynNode.get())
   traverse(*T);
+else if (const auto *C = DynNode.get())
+  traverse(*C);
 // FIXME: Add other base types after adding tests.
 
 // It's OK to always overwrite the bound nodes, as if there was
@@ -194,6 +196,12 @@ public:
   return false;
 return traverse(NNS);
   }
+  bool TraverseConstructorInitializer(CXXCtorInitializer *CtorInit) {
+if (!CtorInit)
+  return true;
+ScopedIncrement ScopedDepth();
+return traverse(*CtorInit);
+  }
 
   bool shouldVisitTemplateInstantiations() const { return true; }
   bool shouldVisitImplicitCode() const { return true; }
@@ -235,6 +243,10 @@ private:
   bool baseTraverse(NestedNameSpecifierLoc NNS) {
 return VisitorBase::TraverseNestedNameSpecifierLoc(NNS);
   }
+  bool baseTraverse(const CXXCtorInitializer ) {
+return VisitorBase::TraverseConstructorInitializer(
+const_cast());
+  }
 
   // Sets 'Matched' to true if 'Matcher' matches 'Node' and:
   //   0 < CurrentDepth <= MaxDepth.
@@ -371,6 +383,7 @@ public:
   bool TraverseTypeLoc(TypeLoc TypeNode);
   bool TraverseNestedNameSpecifier(NestedNameSpecifier *NNS);
   bool TraverseNestedNameSpecifierLoc(NestedNameSpecifierLoc NNS);
+  bool TraverseConstructorInitializer(CXXCtorInitializer *CtorInit);
 
   // Matches children or descendants of 'Node' with 'BaseMatcher'.
   bool memoizedMatchesRecursively(const ast_type_traits::DynTypedNode ,
@@ -472,6 +485,8 @@ public:
   match(*N);
 } else if (auto *N = Node.get()) {
   match(*N);
+} else if (auto *N = Node.get()) {
+  match(*N);
 }
   }
 
@@ -593,6 +608,9 @@ private:
   void matchDispatch(const NestedNameSpecifierLoc *Node) {
 matchWithoutFilter(*Node, Matchers->NestedNameSpecifierLoc);
   }
+  void matchDispatch(const CXXCtorInitializer *Node) {
+matchWithoutFilter(*Node, Matchers->CtorInit);
+  }
   void matchDispatch(const void *) { /* Do nothing. */ }
   /// @}
 
@@ -864,6 +882,17 @@ bool MatchASTVisitor::TraverseNestedName
   
RecursiveASTVisitor::TraverseNestedNameSpecifierLoc(NNS);
 }
 
+bool MatchASTVisitor::TraverseConstructorInitializer(
+CXXCtorInitializer *CtorInit) {
+  if (!CtorInit)
+

Re: [PATCH] D24928: [ASTMatcher] Clarify isStaticStorageClass and hasStaticStorageDuration documents.

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

LGTM, thank you for the clarifications!



Comment at: include/clang/ASTMatchers/ASTMatchers.h:3395
@@ -3392,1 +3394,3 @@
+/// \brief Matches variable/function declarations that have "static" storage
+/// class specifier ("static" key word) written in the source.
 ///

Might as well correct "key word" to be "keyword" instead, as a drive-by fix.


https://reviews.llvm.org/D24928



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


Re: [PATCH] D24669: {Sema] Gcc compatibility of vector shift.

2016-09-26 Thread Vladimir Yakovlev via cfe-commits
vbyakovlcl added inline comments.


Comment at: llvm/tools/clang/include/clang/Basic/DiagnosticGroups.td:522
@@ -521,2 +521,3 @@
 def GNUZeroVariadicMacroArguments : 
DiagGroup<"gnu-zero-variadic-macro-arguments">;
+def GNUVecElemSize : DiagGroup<"gnu-vec-elem-size">;
 def Fallback : DiagGroup<"fallback">;

aaron.ballman wrote:
> Is this the same warning flag GCC uses?
Gcc prints error messages 

t.c:21:13: error: invalid operands to binary << (have vector_int8 and 
vector_short8)
   vi8 = vi8 << vs8;

I could not find a flag controlling this error.


Comment at: llvm/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td:2306
@@ -2304,1 +2305,3 @@
+  "vector operands do not have the same elements sizes (%0 and %1)">,
+  InGroup, DefaultIgnore;
 def err_ext_vector_component_exceeds_length : Error<

aaron.ballman wrote:
> Why is this off by default?
The question is: would we like to have the feature as a clang extension? 


Repository:
  rL LLVM

https://reviews.llvm.org/D24669



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


Re: [PATCH] D24914: [clang-rename] Do not print out error message upon encountering multiple replacements in the same SourceLocation.

2016-09-26 Thread Kirill Bobyrev via cfe-commits
omtcyfz added a comment.

@arphaman, thank you for the comments! Improved the wording.


https://reviews.llvm.org/D24914



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


Re: [PATCH] D24914: [clang-rename] Do not print out error message upon encountering multiple replacements in the same SourceLocation.

2016-09-26 Thread Kirill Bobyrev via cfe-commits
omtcyfz updated this revision to Diff 72511.
omtcyfz marked 2 inline comments as done.
omtcyfz added a comment.

Address two comments.


https://reviews.llvm.org/D24914

Files:
  clang-rename/RenamingAction.cpp

Index: clang-rename/RenamingAction.cpp
===
--- clang-rename/RenamingAction.cpp
+++ clang-rename/RenamingAction.cpp
@@ -68,12 +68,14 @@
<< ":" << FullLoc.getSpellingLineNumber() << ":"
<< FullLoc.getSpellingColumnNumber() << "\n";
   }
-  // FIXME: better error handling.
   tooling::Replacement Replace(SourceMgr, Loc, PrevNameLen, NewName);
   llvm::Error Err = FileToReplaces[Replace.getFilePath()].add(Replace);
+  // FIXME: As for clang-rename, replacement fails IFF either the AST node
+  // has been matched multiple times (which shouldn't happen in reality,
+  // need to fix that) or when it's a specific header. For now, just 
ignore 
+  // the error that happened as it doesn't mean a failure.
   if (Err)
-llvm::errs() << "Renaming failed in " << Replace.getFilePath() << "! "
- << llvm::toString(std::move(Err)) << "\n";
+llvm::consumeError(std::move(Err));
 }
   }
 


Index: clang-rename/RenamingAction.cpp
===
--- clang-rename/RenamingAction.cpp
+++ clang-rename/RenamingAction.cpp
@@ -68,12 +68,14 @@
<< ":" << FullLoc.getSpellingLineNumber() << ":"
<< FullLoc.getSpellingColumnNumber() << "\n";
   }
-  // FIXME: better error handling.
   tooling::Replacement Replace(SourceMgr, Loc, PrevNameLen, NewName);
   llvm::Error Err = FileToReplaces[Replace.getFilePath()].add(Replace);
+  // FIXME: As for clang-rename, replacement fails IFF either the AST node
+  // has been matched multiple times (which shouldn't happen in reality,
+  // need to fix that) or when it's a specific header. For now, just ignore 
+  // the error that happened as it doesn't mean a failure.
   if (Err)
-llvm::errs() << "Renaming failed in " << Replace.getFilePath() << "! "
- << llvm::toString(std::move(Err)) << "\n";
+llvm::consumeError(std::move(Err));
 }
   }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D24928: [ASTMatcher] Clarify isStaticStorageClass and hasStaticStorageDuration documents.

2016-09-26 Thread Haojian Wu via cfe-commits
hokein created this revision.
hokein added a reviewer: aaron.ballman.
hokein added a subscriber: cfe-commits.
Herald added a subscriber: klimek.

https://reviews.llvm.org/D24928

Files:
  docs/LibASTMatchersReference.html
  include/clang/ASTMatchers/ASTMatchers.h
  unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp

Index: unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
===
--- unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
+++ unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
@@ -669,7 +669,7 @@
 
 TEST(Matcher, VarDecl_StorageDuration) {
   std::string T =
-"void f() { int x; static int y; } int a;";
+"void f() { int x; static int y; } int a;static int b;extern int c;";
 
   EXPECT_TRUE(matches(T, varDecl(hasName("x"), hasAutomaticStorageDuration(;
   EXPECT_TRUE(
@@ -679,6 +679,8 @@
 
   EXPECT_TRUE(matches(T, varDecl(hasName("y"), hasStaticStorageDuration(;
   EXPECT_TRUE(matches(T, varDecl(hasName("a"), hasStaticStorageDuration(;
+  EXPECT_TRUE(matches(T, varDecl(hasName("b"), hasStaticStorageDuration(;
+  EXPECT_TRUE(matches(T, varDecl(hasName("c"), hasStaticStorageDuration(;
   EXPECT_TRUE(notMatches(T, varDecl(hasName("x"), hasStaticStorageDuration(;
 
   // FIXME: It is really hard to test with thread_local itself because not all
@@ -853,6 +855,7 @@
   matches("static void f() {}", functionDecl(isStaticStorageClass(;
   EXPECT_TRUE(matches("static int i = 1;", varDecl(isStaticStorageClass(;
   EXPECT_TRUE(notMatches("int i = 1;", varDecl(isStaticStorageClass(;
+  EXPECT_TRUE(notMatches("extern int i;", varDecl(isStaticStorageClass(;
   EXPECT_TRUE(notMatches("void f() {}", functionDecl(isStaticStorageClass(;
 }
 
Index: include/clang/ASTMatchers/ASTMatchers.h
===
--- include/clang/ASTMatchers/ASTMatchers.h
+++ include/clang/ASTMatchers/ASTMatchers.h
@@ -2942,16 +2942,20 @@
 }
 
 /// \brief Matches a variable declaration that has static storage duration.
+/// It includes the variable declared at namespace scope and those declared
+/// with "static" and "extern" storage class specifiers.
 ///
-/// Example matches y and a, but not x or z.
-/// (matcher = varDecl(hasStaticStorageDuration())
 /// \code
 /// void f() {
 ///   int x;
 ///   static int y;
 ///   thread_local int z;
 /// }
 /// int a;
+/// static int b;
+/// extern int c;
+/// varDecl(isStaticStorageClass())
+///   matches the function declaration y, a, b and c.
 /// \endcode
 AST_MATCHER(VarDecl, hasStaticStorageDuration) {
   return Node.getStorageDuration() == SD_Static;
@@ -3387,13 +3391,15 @@
   return Node.isExternC();
 }
 
-/// \brief Matches variable/function declarations that have static storage class
-/// (with "static" key word) written in the source.
+/// \brief Matches variable/function declarations that have "static" storage
+/// class specifier ("static" key word) written in the source.
 ///
 /// Given:
 /// \code
 ///   static void f() {}
 ///   static int i = 0;
+///   extern int j;
+///   int k;
 /// \endcode
 /// functionDecl(isStaticStorageClass())
 ///   matches the function declaration f.
Index: docs/LibASTMatchersReference.html
===
--- docs/LibASTMatchersReference.html
+++ docs/LibASTMatchersReference.html
@@ -2611,12 +2611,14 @@
 
 
 Matcherhttp://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html;>FunctionDeclisStaticStorageClass
-Matches variablefunction declarations that have static storage class
-(with "static" key word) written in the source.
+Matches variablefunction declarations that have "static" storage
+class specifier ("static" key word) written in the source.
 
 Given:
   static void f() {}
   static int i = 0;
+  extern int j;
+  int k;
 functionDecl(isStaticStorageClass())
   matches the function declaration f.
 varDecl(isStaticStorageClass())
@@ -3394,15 +3396,19 @@
 
 Matcherhttp://clang.llvm.org/doxygen/classclang_1_1VarDecl.html;>VarDeclhasStaticStorageDuration
 Matches a variable declaration that has static storage duration.
+It includes the variable declared at namespace scope and those declared
+with "static" and "extern" storage class specifiers.
 
-Example matches y and a, but not x or z.
-(matcher = varDecl(hasStaticStorageDuration())
 void f() {
   int x;
   static int y;
   thread_local int z;
 }
 int a;
+static int b;
+extern int c;
+varDecl(isStaticStorageClass())
+  matches the function declaration y, a, b and c.
 
 
 
@@ -3488,12 +3494,14 @@
 
 
 Matcherhttp://clang.llvm.org/doxygen/classclang_1_1VarDecl.html;>VarDeclisStaticStorageClass
-Matches variablefunction declarations that have static storage class
-(with "static" key word) written in the source.
+Matches variablefunction declarations that have "static" storage
+class specifier ("static" key word) written in the source.
 
 Given:
   static void f() {}
   static int i = 0;

Re: [PATCH] D24821: [ASTMatcher] Add isStaticStorageClass matcher for varDecl and functionDecl.

2016-09-26 Thread Haojian Wu via cfe-commits
hokein added inline comments.


Comment at: cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h:3391
@@ +3390,3 @@
+/// \brief Matches variable/function declarations that have static storage 
class
+/// (with "static" key word) written in the source.
+///

aaron.ballman wrote:
> It would be nice if you could clarify how this differs from the storage 
> duration. This is a bit confusing because we already have 
> `hasStaticStorageDuration()` for variables.
Good point! Will make a follow-up patch to do it.


Repository:
  rL LLVM

https://reviews.llvm.org/D24821



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


Re: [PATCH] D24820: Add -stats-stats option

2016-09-26 Thread Bruno Cardoso Lopes via cfe-commits
bruno accepted this revision.
bruno added a comment.
This revision is now accepted and ready to land.

Thanks Matthias

LGTM!


Repository:
  rL LLVM

https://reviews.llvm.org/D24820



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


Re: [PATCH] D24821: [ASTMatcher] Add isStaticStorageClass matcher for varDecl and functionDecl.

2016-09-26 Thread Aaron Ballman via cfe-commits
aaron.ballman added a subscriber: aaron.ballman.


Comment at: cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h:3391
@@ +3390,3 @@
+/// \brief Matches variable/function declarations that have static storage 
class
+/// (with "static" key word) written in the source.
+///

It would be nice if you could clarify how this differs from the storage 
duration. This is a bit confusing because we already have 
`hasStaticStorageDuration()` for variables.


Repository:
  rL LLVM

https://reviews.llvm.org/D24821



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


Re: [PATCH] D24914: [clang-rename] Do not print out error message upon encountering multiple replacements in the same SourceLocation.

2016-09-26 Thread Alex Lorenz via cfe-commits
arphaman added a subscriber: arphaman.


Comment at: clang-rename/RenamingAction.cpp:75
@@ +74,3 @@
+  // has been matched multiple times (which shouldn't happen in reality,
+  // need to fix that) or when it's a specific header. For now, just ingore
+  // there error that happened as it doesn't mean a failure.

s/ingore/ignore/


Comment at: clang-rename/RenamingAction.cpp:76
@@ -74,1 +75,3 @@
+  // need to fix that) or when it's a specific header. For now, just ingore
+  // there error that happened as it doesn't mean a failure.
   if (Err)

Did you mean to use 'the' instead of 'there' here?


https://reviews.llvm.org/D24914



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


r282415 - [ASTMatcher] Add isStaticStorageClass matcher for varDecl and functionDecl.

2016-09-26 Thread Haojian Wu via cfe-commits
Author: hokein
Date: Mon Sep 26 11:01:52 2016
New Revision: 282415

URL: http://llvm.org/viewvc/llvm-project?rev=282415=rev
Log:
[ASTMatcher] Add isStaticStorageClass matcher for varDecl and functionDecl.

Reviewers: klimek

Subscribers: cfe-commits, klimek

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

Modified:
cfe/trunk/docs/LibASTMatchersReference.html
cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
cfe/trunk/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp

Modified: cfe/trunk/docs/LibASTMatchersReference.html
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LibASTMatchersReference.html?rev=282415=282414=282415=diff
==
--- cfe/trunk/docs/LibASTMatchersReference.html (original)
+++ cfe/trunk/docs/LibASTMatchersReference.html Mon Sep 26 11:01:52 2016
@@ -2610,6 +2610,20 @@ functionDecl(isNoThrow()) and functionPr
 
 
 
+Matcherhttp://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html;>FunctionDeclisStaticStorageClass
+Matches 
variablefunction declarations that have static storage class
+(with "static" key word) written in the source.
+
+Given:
+  static void f() {}
+  static int i = 0;
+functionDecl(isStaticStorageClass())
+  matches the function declaration f.
+varDecl(isStaticStorageClass())
+  matches the variable declaration i.
+
+
+
 Matcherhttp://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html;>FunctionDeclisTemplateInstantiation
 Matches 
template instantiations of function, class, or static
 member variable template instantiations.
@@ -3473,6 +3487,20 @@ functionDecl(isExternC())
 
 
 
+Matcherhttp://clang.llvm.org/doxygen/classclang_1_1VarDecl.html;>VarDeclisStaticStorageClass
+Matches 
variablefunction declarations that have static storage class
+(with "static" key word) written in the source.
+
+Given:
+  static void f() {}
+  static int i = 0;
+functionDecl(isStaticStorageClass())
+  matches the function declaration f.
+varDecl(isStaticStorageClass())
+  matches the variable declaration i.
+
+
+
 Matcherhttp://clang.llvm.org/doxygen/classclang_1_1VarDecl.html;>VarDeclisTemplateInstantiation
 Matches 
template instantiations of function, class, or static
 member variable template instantiations.
@@ -4092,7 +4120,7 @@ matcher, or is a pointer to a type that
 
 
 Matcherhttp://clang.llvm.org/doxygen/classclang_1_1CXXMethodDecl.html;>CXXMethodDeclforEachOverriddenMatcherhttp://clang.llvm.org/doxygen/classclang_1_1CXXMethodDecl.html;>CXXMethodDecl
 InnerMatcher
-Matches each 
method overridden by the given method. This matcher may
+Matches each 
method overriden by the given method. This matcher may
 produce multiple matches.
 
 Given

Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h?rev=282415=282414=282415=diff
==
--- cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h (original)
+++ cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h Mon Sep 26 11:01:52 2016
@@ -3387,6 +3387,24 @@ AST_POLYMORPHIC_MATCHER(isExternC, AST_P
   return Node.isExternC();
 }
 
+/// \brief Matches variable/function declarations that have static storage 
class
+/// (with "static" key word) written in the source.
+///
+/// Given:
+/// \code
+///   static void f() {}
+///   static int i = 0;
+/// \endcode
+/// functionDecl(isStaticStorageClass())
+///   matches the function declaration f.
+/// varDecl(isStaticStorageClass())
+///   matches the variable declaration i.
+AST_POLYMORPHIC_MATCHER(isStaticStorageClass,
+AST_POLYMORPHIC_SUPPORTED_TYPES(FunctionDecl,
+VarDecl)) {
+  return Node.getStorageClass() == SC_Static;
+}
+
 /// \brief Matches deleted function declarations.
 ///
 /// Given:

Modified: cfe/trunk/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp?rev=282415=282414=282415=diff
==
--- cfe/trunk/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp (original)
+++ cfe/trunk/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp Mon Sep 26 
11:01:52 2016
@@ -848,6 +848,14 @@ TEST(IsExternC, MatchesExternCVariableDe
   EXPECT_TRUE(notMatches("int i;", varDecl(isExternC(;
 }
 
+TEST(IsStaticStorageClass, MatchesStaticDeclarations) {
+  EXPECT_TRUE(
+  matches("static void f() {}", functionDecl(isStaticStorageClass(;
+  EXPECT_TRUE(matches("static int i = 1;", varDecl(isStaticStorageClass(;
+  EXPECT_TRUE(notMatches("int i = 1;", varDecl(isStaticStorageClass(;
+  EXPECT_TRUE(notMatches("void f() {}", functionDecl(isStaticStorageClass(;
+}
+
 TEST(IsDefaulted, MatchesDefaultedFunctionDeclarations) {
   EXPECT_TRUE(notMatches("class A { ~A(); };",
   

  1   2   >