[PATCH] D26830: [libcxx] Add string_view literals

2017-04-13 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added a comment.

@AntonBikineev Yeah, this should be abandoned. Sorry my mistake.


https://reviews.llvm.org/D26830



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


[PATCH] D31725: [libc++] Add _LIBCPP_DISABLE_EXTERN_TEMPLATE config option

2017-04-13 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF accepted this revision.
EricWF added a comment.
This revision is now accepted and ready to land.

LGTM minus doc.


https://reviews.llvm.org/D31725



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


[PATCH] D31725: [libc++] Add _LIBCPP_DISABLE_EXTERN_TEMPLATE config option

2017-04-13 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added a comment.

Please add docs to 
http://libcxx.llvm.org/docs/UsingLibcxx.html#libc-configuration-macros


https://reviews.llvm.org/D31725



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


[PATCH] D24371: Add diagnostics to require_constant_initialization

2017-04-13 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added a comment.

@rsmith gentle ping.


Repository:
  rL LLVM

https://reviews.llvm.org/D24371



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


[PATCH] D26830: [libcxx] Add string_view literals

2017-04-13 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added inline comments.



Comment at: 
test/std/strings/string.view/string.view.literals/literal2.pass.cpp:16
+
+int main()
+{

EricWF wrote:
> What's the point of this test that `literal.pass.cpp` doesn't cover?
Ping on this comment.



Comment at: 
test/std/strings/string.view/string.view.literals/literal3.pass.cpp:16
+
+int main()
+{

EricWF wrote:
> You can move this test into `literal.pass.cpp` but putting it at another 
> function scope.
Ping on this comment.


https://reviews.llvm.org/D26830



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


[PATCH] D31561: cmath: Skip Libc for integral types in isinf, etc.

2017-04-13 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF accepted this revision.
EricWF added a comment.
This revision is now accepted and ready to land.

LGTM minus inline comments.




Comment at: libcxx/include/math.h:354
 inline _LIBCPP_INLINE_VISIBILITY
-typename std::enable_if::value, bool>::type
+typename std::enable_if::value, bool>::type
 signbit(_A1 __lcpp_x) _NOEXCEPT

hfinkel wrote:
> I think that it would be safer / easier to understand if we used 
> !std::is_integral here. It is true for all standard types that 
> std::is_arithmetic implies is_integral or is_floating_point, but it seems 
> likely that some implementations have arithemtic types that are neither (e.g. 
> fixed-point types), and user-defined types seem likely.
@dexonsmith Could you please codify this point in a comment above the function. 
My initial reaction was "Why aren't we using `std::is_floating_point` instead". 


https://reviews.llvm.org/D31561



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


[PATCH] D31992: [clangd] Escape only necessary characters in JSON output

2017-04-13 Thread Joerg Sonnenberger via Phabricator via cfe-commits
joerg added a comment.

In https://reviews.llvm.org/D31992#725963, @klimek wrote:

> If I understand correctly, that's " and \ for JSON and ", \ and all 
> non-printable characters (which unfortunately requires understanding of 
> unicode to solve this fully correctly) in YAML.


I'd modify that slightly: let's escape those two and all the known ASCII 
control characters, but just pass the rest through. I.e. reduce the current \x 
etc handling to known problematic input and not second guess the rest.


Repository:
  rL LLVM

https://reviews.llvm.org/D31992



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


[libcxx] r300246 - [libc++] Add _LIBCPP_DISABLE_EXTERN_TEMPLATE config option

2017-04-13 Thread Shoaib Meenai via cfe-commits
Author: smeenai
Date: Thu Apr 13 15:13:32 2017
New Revision: 300246

URL: http://llvm.org/viewvc/llvm-project?rev=300246=rev
Log:
[libc++] Add _LIBCPP_DISABLE_EXTERN_TEMPLATE config option

When the libc++ extern template macros were added, the intent was for it
to be possible for consumers of the headers to disable extern templates
(via `-D_LIBCPP_EXTERN_TEMPLATE(...)=`). Unfortunately, support for
specifying function-like macros varies on the command line varies across
compilers (e.g. MSVC doesn't support it at all), and cmake doesn't allow
it for the same reason. Add a non-function macro for this purpose.

The intended use is for libraries which want to use the libc++ headers
without taking a dependency on the libc++ library itself. I can name the
macro something which reflects its intent rather than its behavior (e.g.
`_LIBCPP_HEADER_ONLY`) if desired.

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

Modified:
libcxx/trunk/docs/UsingLibcxx.rst
libcxx/trunk/include/__config

Modified: libcxx/trunk/docs/UsingLibcxx.rst
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/docs/UsingLibcxx.rst?rev=300246=300245=300246=diff
==
--- libcxx/trunk/docs/UsingLibcxx.rst (original)
+++ libcxx/trunk/docs/UsingLibcxx.rst Thu Apr 13 15:13:32 2017
@@ -146,6 +146,11 @@ thread safety annotations.
   build of libc++ which does not export any symbols, which can be useful when
   building statically for inclusion into another library.
 
+**_LIBCPP_DISABLE_EXTERN_TEMPLATE**:
+  This macro is used to disable extern template declarations in the libc++
+  headers. The intended use case is for clients who wish to use the libc++
+  headers without taking a dependency on the libc++ library itself.
+
 **_LIBCPP_ENABLE_TUPLE_IMPLICIT_REDUCED_ARITY_EXTENSION**:
   This macro is used to re-enable an extension in `std::tuple` which allowed
   it to be implicitly constructed from fewer initializers than contained

Modified: libcxx/trunk/include/__config
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=300246=300245=300246=diff
==
--- libcxx/trunk/include/__config (original)
+++ libcxx/trunk/include/__config Thu Apr 13 15:13:32 2017
@@ -856,6 +856,11 @@ template  struct __static_asse
 # endif
 #endif
 
+#ifdef _LIBCPP_DISABLE_EXTERN_TEMPLATE
+#define _LIBCPP_EXTERN_TEMPLATE(...)
+#define _LIBCPP_EXTERN_TEMPLATE2(...)
+#endif
+
 #ifndef _LIBCPP_EXTERN_TEMPLATE
 #define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
 #endif


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


[PATCH] D31725: [libc++] Add _LIBCPP_DISABLE_EXTERN_TEMPLATE config option

2017-04-13 Thread Shoaib Meenai via Phabricator via cfe-commits
smeenai updated this revision to Diff 95189.
smeenai added a comment.

Add documentation


https://reviews.llvm.org/D31725

Files:
  docs/UsingLibcxx.rst
  include/__config


Index: include/__config
===
--- include/__config
+++ include/__config
@@ -856,6 +856,11 @@
 # endif
 #endif
 
+#ifdef _LIBCPP_DISABLE_EXTERN_TEMPLATE
+#define _LIBCPP_EXTERN_TEMPLATE(...)
+#define _LIBCPP_EXTERN_TEMPLATE2(...)
+#endif
+
 #ifndef _LIBCPP_EXTERN_TEMPLATE
 #define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
 #endif
Index: docs/UsingLibcxx.rst
===
--- docs/UsingLibcxx.rst
+++ docs/UsingLibcxx.rst
@@ -146,6 +146,11 @@
   build of libc++ which does not export any symbols, which can be useful when
   building statically for inclusion into another library.
 
+**_LIBCPP_DISABLE_EXTERN_TEMPLATE**:
+  This macro is used to disable extern template declarations in the libc++
+  headers. The intended use case is for clients who wish to use the libc++
+  headers without taking a dependency on the libc++ library itself.
+
 **_LIBCPP_ENABLE_TUPLE_IMPLICIT_REDUCED_ARITY_EXTENSION**:
   This macro is used to re-enable an extension in `std::tuple` which allowed
   it to be implicitly constructed from fewer initializers than contained


Index: include/__config
===
--- include/__config
+++ include/__config
@@ -856,6 +856,11 @@
 # endif
 #endif
 
+#ifdef _LIBCPP_DISABLE_EXTERN_TEMPLATE
+#define _LIBCPP_EXTERN_TEMPLATE(...)
+#define _LIBCPP_EXTERN_TEMPLATE2(...)
+#endif
+
 #ifndef _LIBCPP_EXTERN_TEMPLATE
 #define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
 #endif
Index: docs/UsingLibcxx.rst
===
--- docs/UsingLibcxx.rst
+++ docs/UsingLibcxx.rst
@@ -146,6 +146,11 @@
   build of libc++ which does not export any symbols, which can be useful when
   building statically for inclusion into another library.
 
+**_LIBCPP_DISABLE_EXTERN_TEMPLATE**:
+  This macro is used to disable extern template declarations in the libc++
+  headers. The intended use case is for clients who wish to use the libc++
+  headers without taking a dependency on the libc++ library itself.
+
 **_LIBCPP_ENABLE_TUPLE_IMPLICIT_REDUCED_ARITY_EXTENSION**:
   This macro is used to re-enable an extension in `std::tuple` which allowed
   it to be implicitly constructed from fewer initializers than contained
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D31725: [libc++] Add _LIBCPP_DISABLE_EXTERN_TEMPLATE config option

2017-04-13 Thread Shoaib Meenai via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL300246: [libc++] Add _LIBCPP_DISABLE_EXTERN_TEMPLATE config 
option (authored by smeenai).

Changed prior to commit:
  https://reviews.llvm.org/D31725?vs=95189=95190#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D31725

Files:
  libcxx/trunk/docs/UsingLibcxx.rst
  libcxx/trunk/include/__config


Index: libcxx/trunk/docs/UsingLibcxx.rst
===
--- libcxx/trunk/docs/UsingLibcxx.rst
+++ libcxx/trunk/docs/UsingLibcxx.rst
@@ -146,6 +146,11 @@
   build of libc++ which does not export any symbols, which can be useful when
   building statically for inclusion into another library.
 
+**_LIBCPP_DISABLE_EXTERN_TEMPLATE**:
+  This macro is used to disable extern template declarations in the libc++
+  headers. The intended use case is for clients who wish to use the libc++
+  headers without taking a dependency on the libc++ library itself.
+
 **_LIBCPP_ENABLE_TUPLE_IMPLICIT_REDUCED_ARITY_EXTENSION**:
   This macro is used to re-enable an extension in `std::tuple` which allowed
   it to be implicitly constructed from fewer initializers than contained
Index: libcxx/trunk/include/__config
===
--- libcxx/trunk/include/__config
+++ libcxx/trunk/include/__config
@@ -856,6 +856,11 @@
 # endif
 #endif
 
+#ifdef _LIBCPP_DISABLE_EXTERN_TEMPLATE
+#define _LIBCPP_EXTERN_TEMPLATE(...)
+#define _LIBCPP_EXTERN_TEMPLATE2(...)
+#endif
+
 #ifndef _LIBCPP_EXTERN_TEMPLATE
 #define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
 #endif


Index: libcxx/trunk/docs/UsingLibcxx.rst
===
--- libcxx/trunk/docs/UsingLibcxx.rst
+++ libcxx/trunk/docs/UsingLibcxx.rst
@@ -146,6 +146,11 @@
   build of libc++ which does not export any symbols, which can be useful when
   building statically for inclusion into another library.
 
+**_LIBCPP_DISABLE_EXTERN_TEMPLATE**:
+  This macro is used to disable extern template declarations in the libc++
+  headers. The intended use case is for clients who wish to use the libc++
+  headers without taking a dependency on the libc++ library itself.
+
 **_LIBCPP_ENABLE_TUPLE_IMPLICIT_REDUCED_ARITY_EXTENSION**:
   This macro is used to re-enable an extension in `std::tuple` which allowed
   it to be implicitly constructed from fewer initializers than contained
Index: libcxx/trunk/include/__config
===
--- libcxx/trunk/include/__config
+++ libcxx/trunk/include/__config
@@ -856,6 +856,11 @@
 # endif
 #endif
 
+#ifdef _LIBCPP_DISABLE_EXTERN_TEMPLATE
+#define _LIBCPP_EXTERN_TEMPLATE(...)
+#define _LIBCPP_EXTERN_TEMPLATE2(...)
+#endif
+
 #ifndef _LIBCPP_EXTERN_TEMPLATE
 #define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
 #endif
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D32035: [OpenMP] Error when trying to offload to an unsupported architecture

2017-04-13 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
gtbercea created this revision.
Herald added a subscriber: rengolin.

Throw an error when offloading is unsupported for a particular target 
architecture.


Repository:
  rL LLVM

https://reviews.llvm.org/D32035

Files:
  include/clang/Basic/DiagnosticDriverKinds.td
  lib/Frontend/CompilerInvocation.cpp
  test/OpenMP/target_messages.cpp


Index: test/OpenMP/target_messages.cpp
===
--- test/OpenMP/target_messages.cpp
+++ test/OpenMP/target_messages.cpp
@@ -4,6 +4,8 @@
 // RUN: not %clang_cc1 -fopenmp -std=c++11 -triple nvptx64-nvidia-cuda -o - %s 
2>&1 | FileCheck --check-prefix CHECK-UNSUPPORTED-HOST-TARGET %s
 // RUN: not %clang_cc1 -fopenmp -std=c++11 -triple nvptx-nvidia-cuda -o - %s 
2>&1 | FileCheck --check-prefix CHECK-UNSUPPORTED-HOST-TARGET %s
 // CHECK-UNSUPPORTED-HOST-TARGET: error: The target 
'{{nvptx64-nvidia-cuda|nvptx-nvidia-cuda}}' is not a supported OpenMP host 
target.
+// RUN: not %clang_cc1 -fopenmp -std=c++11 -fopenmp-targets=hexagon-linux-gnu 
-o - %s 2>&1 | FileCheck --check-prefix CHECK-UNSUPPORTED-DEVICE-TARGET %s
+// CHECK-UNSUPPORTED-DEVICE-TARGET: The target 'hexagon-linux-gnu' is not a 
supported OpenMP device target.
 
 void foo() {
 }
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -2239,6 +2239,16 @@
 for (unsigned i = 0; i < A->getNumValues(); ++i) {
   llvm::Triple TT(A->getValue(i));
 
+  if (!(TT.getArch() == llvm::Triple::ppc ||
+TT.getArch() == llvm::Triple::ppc64 ||
+TT.getArch() == llvm::Triple::ppc64le ||
+TT.getArch() == llvm::Triple::nvptx ||
+TT.getArch() == llvm::Triple::nvptx64 ||
+TT.getArch() == llvm::Triple::x86 ||
+TT.getArch() == llvm::Triple::x86_64))
+Diags.Report(clang::diag::err_drv_omp_device_target_not_supported)
+<< A->getValue(i);
+
   if (TT.getArch() == llvm::Triple::UnknownArch)
 Diags.Report(clang::diag::err_drv_invalid_omp_target) << 
A->getValue(i);
   else
Index: include/clang/Basic/DiagnosticDriverKinds.td
===
--- include/clang/Basic/DiagnosticDriverKinds.td
+++ include/clang/Basic/DiagnosticDriverKinds.td
@@ -162,6 +162,8 @@
   "The provided host compiler IR file '%0' is required to generate code for 
OpenMP target regions but cannot be found.">;
 def err_drv_omp_host_target_not_supported : Error<
   "The target '%0' is not a supported OpenMP host target.">;
+def err_drv_omp_device_target_not_supported : Error<
+  "The target '%0' is not a supported OpenMP device target.">;
 def err_drv_expecting_fopenmp_with_fopenmp_targets : Error<
   "The option -fopenmp-targets must be used in conjunction with a -fopenmp 
option compatible with offloading, please use -fopenmp=libomp or 
-fopenmp=libiomp5.">;
 def warn_drv_omp_offload_target_duplicate : Warning<


Index: test/OpenMP/target_messages.cpp
===
--- test/OpenMP/target_messages.cpp
+++ test/OpenMP/target_messages.cpp
@@ -4,6 +4,8 @@
 // RUN: not %clang_cc1 -fopenmp -std=c++11 -triple nvptx64-nvidia-cuda -o - %s 2>&1 | FileCheck --check-prefix CHECK-UNSUPPORTED-HOST-TARGET %s
 // RUN: not %clang_cc1 -fopenmp -std=c++11 -triple nvptx-nvidia-cuda -o - %s 2>&1 | FileCheck --check-prefix CHECK-UNSUPPORTED-HOST-TARGET %s
 // CHECK-UNSUPPORTED-HOST-TARGET: error: The target '{{nvptx64-nvidia-cuda|nvptx-nvidia-cuda}}' is not a supported OpenMP host target.
+// RUN: not %clang_cc1 -fopenmp -std=c++11 -fopenmp-targets=hexagon-linux-gnu -o - %s 2>&1 | FileCheck --check-prefix CHECK-UNSUPPORTED-DEVICE-TARGET %s
+// CHECK-UNSUPPORTED-DEVICE-TARGET: The target 'hexagon-linux-gnu' is not a supported OpenMP device target.
 
 void foo() {
 }
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -2239,6 +2239,16 @@
 for (unsigned i = 0; i < A->getNumValues(); ++i) {
   llvm::Triple TT(A->getValue(i));
 
+  if (!(TT.getArch() == llvm::Triple::ppc ||
+TT.getArch() == llvm::Triple::ppc64 ||
+TT.getArch() == llvm::Triple::ppc64le ||
+TT.getArch() == llvm::Triple::nvptx ||
+TT.getArch() == llvm::Triple::nvptx64 ||
+TT.getArch() == llvm::Triple::x86 ||
+TT.getArch() == llvm::Triple::x86_64))
+Diags.Report(clang::diag::err_drv_omp_device_target_not_supported)
+<< A->getValue(i);
+
   if (TT.getArch() == llvm::Triple::UnknownArch)
 Diags.Report(clang::diag::err_drv_invalid_omp_target) << A->getValue(i);
   else
Index: include/clang/Basic/DiagnosticDriverKinds.td

r300231 - Follow-up to r300225: update ClangFormat.csproj too

2017-04-13 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Thu Apr 13 13:15:00 2017
New Revision: 300231

URL: http://llvm.org/viewvc/llvm-project?rev=300231=rev
Log:
Follow-up to r300225: update ClangFormat.csproj too

Modified:
cfe/trunk/tools/clang-format-vs/ClangFormat/ClangFormat.csproj

Modified: cfe/trunk/tools/clang-format-vs/ClangFormat/ClangFormat.csproj
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-format-vs/ClangFormat/ClangFormat.csproj?rev=300231=300230=300231=diff
==
--- cfe/trunk/tools/clang-format-vs/ClangFormat/ClangFormat.csproj (original)
+++ cfe/trunk/tools/clang-format-vs/ClangFormat/ClangFormat.csproj Thu Apr 13 
13:15:00 2017
@@ -14,7 +14,7 @@
 true
 Key.snk
 v4.0
-14.0
+15.0
 
 
 


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


[PATCH] D31591: Fix a bug which access nullptr and cause segmentation fault

2017-04-13 Thread Vassil Vassilev via Phabricator via cfe-commits
v.g.vassilev accepted this revision.
v.g.vassilev added a comment.

LGTM.


https://reviews.llvm.org/D31591



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


r300226 - Follow-up to r300225: update ClangFormat.sln to VS2017

2017-04-13 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Thu Apr 13 12:47:47 2017
New Revision: 300226

URL: http://llvm.org/viewvc/llvm-project?rev=300226=rev
Log:
Follow-up to r300225: update ClangFormat.sln to VS2017

This got lost in the previous patch somehow.

Modified:
cfe/trunk/tools/clang-format-vs/ClangFormat.sln

Modified: cfe/trunk/tools/clang-format-vs/ClangFormat.sln
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-format-vs/ClangFormat.sln?rev=300226=300225=300226=diff
==
--- cfe/trunk/tools/clang-format-vs/ClangFormat.sln (original)
+++ cfe/trunk/tools/clang-format-vs/ClangFormat.sln Thu Apr 13 12:47:47 2017
@@ -1,7 +1,7 @@
 
 Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 14
-VisualStudioVersion = 14.0.25420.1
+# Visual Studio 15
+VisualStudioVersion = 15.0.26228.12
 MinimumVisualStudioVersion = 10.0.40219.1
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClangFormat", 
"ClangFormat\ClangFormat.csproj", "{7FD1783E-2D31-4D05-BF23-6EBE1B42B608}"
 EndProject


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


[PATCH] D25383: [libcxx][modules] Add a submodule for math.h

2017-04-13 Thread Bruno Cardoso Lopes via Phabricator via cfe-commits
bruno abandoned this revision.
bruno added a comment.

This isn't needed anymore.


https://reviews.llvm.org/D25383



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


[libcxx] r300232 - Remove the binders from C++17. Reviewed as https://reviews.llvm.org/D31769

2017-04-13 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Thu Apr 13 13:25:32 2017
New Revision: 300232

URL: http://llvm.org/viewvc/llvm-project?rev=300232=rev
Log:
Remove the binders from C++17. Reviewed as https://reviews.llvm.org/D31769

Added:
libcxx/trunk/test/libcxx/depr/depr.function.objects/
libcxx/trunk/test/libcxx/depr/depr.function.objects/depr.adaptors/

libcxx/trunk/test/libcxx/depr/depr.function.objects/depr.adaptors.cxx1z.pass.cpp

libcxx/trunk/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/pointer_to_binary_function.cxx1z.fail.cpp

libcxx/trunk/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/pointer_to_unary_function.cxx1z.fail.cpp

libcxx/trunk/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/ptr_fun1.cxx1z.fail.cpp

libcxx/trunk/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/ptr_fun2.cxx1z.fail.cpp

libcxx/trunk/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun.cxx1z.fail.cpp

libcxx/trunk/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1.cxx1z.fail.cpp

libcxx/trunk/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1_ref_t.cxx1z.fail.cpp

libcxx/trunk/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1_t.cxx1z.fail.cpp

libcxx/trunk/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref.cxx1z.fail.cpp

libcxx/trunk/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref1.cxx1z.fail.cpp

libcxx/trunk/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref_t.cxx1z.fail.cpp

libcxx/trunk/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_t.cxx1z.fail.cpp

libcxx/trunk/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun.cxx1z.fail.cpp

libcxx/trunk/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1.cxx1z.fail.cpp

libcxx/trunk/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1_ref_t.cxx1z.fail.cpp

libcxx/trunk/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1_t.cxx1z.fail.cpp

libcxx/trunk/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref.cxx1z.fail.cpp

libcxx/trunk/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref1.cxx1z.fail.cpp

libcxx/trunk/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref_t.cxx1z.fail.cpp

libcxx/trunk/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_t.cxx1z.fail.cpp
Modified:
libcxx/trunk/include/__config
libcxx/trunk/include/functional

libcxx/trunk/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/pointer_to_binary_function.pass.cpp

libcxx/trunk/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/pointer_to_unary_function.pass.cpp

libcxx/trunk/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/ptr_fun1.pass.cpp

libcxx/trunk/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/ptr_fun2.pass.cpp

libcxx/trunk/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun.pass.cpp

libcxx/trunk/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1.pass.cpp

libcxx/trunk/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1_ref_t.pass.cpp

libcxx/trunk/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1_t.pass.cpp

libcxx/trunk/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref.pass.cpp

libcxx/trunk/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref1.pass.cpp

libcxx/trunk/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref_t.pass.cpp

libcxx/trunk/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_t.pass.cpp

libcxx/trunk/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun.pass.cpp

libcxx/trunk/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1.pass.cpp

libcxx/trunk/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1_ref_t.pass.cpp


[PATCH] D29401: Fix MSVC Compatibility around dependent type with missing 'typename'

2017-04-13 Thread Erich Keane via Phabricator via cfe-commits
erichkeane abandoned this revision.
erichkeane added a comment.

I don't really see a good solution for this, and haven't tried in a while, so 
I'll see if I can prep another version of this in the future.


https://reviews.llvm.org/D29401



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


[PATCH] D32047: [Driver] Add support for default UBSan blacklists

2017-04-13 Thread Vedant Kumar via Phabricator via cfe-commits
vsk created this revision.

Clang should look for a default UBSan blacklist in its resource dir.

Depends on https://reviews.llvm.org/D32043.


https://reviews.llvm.org/D32047

Files:
  lib/Driver/SanitizerArgs.cpp
  test/Driver/Inputs/resource_dir/ubsan_blacklist.txt
  test/Driver/fsanitize-blacklist.c


Index: test/Driver/fsanitize-blacklist.c
===
--- test/Driver/fsanitize-blacklist.c
+++ test/Driver/fsanitize-blacklist.c
@@ -30,9 +30,10 @@
 
 // Check that we can add multiple default blacklists if the matching sanitizers
 // are enabled.
-// RUN: %clang -target x86_64-linux-gnu -fsanitize=address,cfi -flto 
-fvisibility=hidden -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | 
FileCheck %s --check-prefix=MULTIPLE-DEFAULT-BLACKLISTS
+// RUN: %clang -target x86_64-linux-gnu -fsanitize=address,cfi,undefined -flto 
-fvisibility=hidden -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | 
FileCheck %s --check-prefix=MULTIPLE-DEFAULT-BLACKLISTS
 // MULTIPLE-DEFAULT-BLACKLISTS-DAG: 
-fsanitize-blacklist={{.*}}asan_blacklist.txt
 // MULTIPLE-DEFAULT-BLACKLISTS-DAG: 
-fsanitize-blacklist={{.*}}cfi_blacklist.txt
+// MULTIPLE-DEFAULT-BLACKLISTS-DAG: 
-fsanitize-blacklist={{.*}}ubsan_blacklist.txt
 
 // Ignore -fsanitize-blacklist flag if there is no -fsanitize flag.
 // RUN: %clang -target x86_64-linux-gnu -fsanitize-blacklist=%t.good %s -### 
2>&1 | FileCheck %s --check-prefix=CHECK-NO-SANITIZE --check-prefix=DELIMITERS
Index: lib/Driver/SanitizerArgs.cpp
===
--- lib/Driver/SanitizerArgs.cpp
+++ lib/Driver/SanitizerArgs.cpp
@@ -93,7 +93,8 @@
   {Memory, "msan_blacklist.txt"},
   {Thread, "tsan_blacklist.txt"},
   {DataFlow, "dfsan_abilist.txt"},
-  {CFI, "cfi_blacklist.txt"}};
+  {CFI, "cfi_blacklist.txt"},
+  {Undefined | Integer | Nullability, "ubsan_blacklist.txt"}};
   for (const auto  : DefaultBlacklists) {
 if (!(Kinds & BL.first))
   continue;


Index: test/Driver/fsanitize-blacklist.c
===
--- test/Driver/fsanitize-blacklist.c
+++ test/Driver/fsanitize-blacklist.c
@@ -30,9 +30,10 @@
 
 // Check that we can add multiple default blacklists if the matching sanitizers
 // are enabled.
-// RUN: %clang -target x86_64-linux-gnu -fsanitize=address,cfi -flto -fvisibility=hidden -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=MULTIPLE-DEFAULT-BLACKLISTS
+// RUN: %clang -target x86_64-linux-gnu -fsanitize=address,cfi,undefined -flto -fvisibility=hidden -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=MULTIPLE-DEFAULT-BLACKLISTS
 // MULTIPLE-DEFAULT-BLACKLISTS-DAG: -fsanitize-blacklist={{.*}}asan_blacklist.txt
 // MULTIPLE-DEFAULT-BLACKLISTS-DAG: -fsanitize-blacklist={{.*}}cfi_blacklist.txt
+// MULTIPLE-DEFAULT-BLACKLISTS-DAG: -fsanitize-blacklist={{.*}}ubsan_blacklist.txt
 
 // Ignore -fsanitize-blacklist flag if there is no -fsanitize flag.
 // RUN: %clang -target x86_64-linux-gnu -fsanitize-blacklist=%t.good %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-SANITIZE --check-prefix=DELIMITERS
Index: lib/Driver/SanitizerArgs.cpp
===
--- lib/Driver/SanitizerArgs.cpp
+++ lib/Driver/SanitizerArgs.cpp
@@ -93,7 +93,8 @@
   {Memory, "msan_blacklist.txt"},
   {Thread, "tsan_blacklist.txt"},
   {DataFlow, "dfsan_abilist.txt"},
-  {CFI, "cfi_blacklist.txt"}};
+  {CFI, "cfi_blacklist.txt"},
+  {Undefined | Integer | Nullability, "ubsan_blacklist.txt"}};
   for (const auto  : DefaultBlacklists) {
 if (!(Kinds & BL.first))
   continue;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r300223 - clang-format-vs: Use a separate license.txt copy

2017-04-13 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Thu Apr 13 12:37:17 2017
New Revision: 300223

URL: http://llvm.org/viewvc/llvm-project?rev=300223=rev
Log:
clang-format-vs: Use a separate license.txt copy

The regular file used to display very poorly in the VSIX installer due
to long lines, wrapping etc.

Added:
cfe/trunk/tools/clang-format-vs/ClangFormat/license.txt   (with props)
Modified:
cfe/trunk/tools/clang-format-vs/.gitignore
cfe/trunk/tools/clang-format-vs/CMakeLists.txt

Modified: cfe/trunk/tools/clang-format-vs/.gitignore
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-format-vs/.gitignore?rev=300223=300222=300223=diff
==
--- cfe/trunk/tools/clang-format-vs/.gitignore (original)
+++ cfe/trunk/tools/clang-format-vs/.gitignore Thu Apr 13 12:37:17 2017
@@ -7,6 +7,5 @@
 
 # Generated and copied files
 /ClangFormat/Key.snk
-/ClangFormat/license.txt
 /ClangFormat/clang-format.exe
 /ClangFormat/source.extension.vsixmanifest

Modified: cfe/trunk/tools/clang-format-vs/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-format-vs/CMakeLists.txt?rev=300223=300222=300223=diff
==
--- cfe/trunk/tools/clang-format-vs/CMakeLists.txt (original)
+++ cfe/trunk/tools/clang-format-vs/CMakeLists.txt Thu Apr 13 12:37:17 2017
@@ -6,11 +6,6 @@ if (BUILD_CLANG_FORMAT_VS_PLUGIN)
   "${CMAKE_CURRENT_SOURCE_DIR}/ClangFormat/clang-format.exe"
   DEPENDS clang-format)
 
-  add_custom_target(clang_format_license
-  ${CMAKE_COMMAND} -E copy_if_different
-  "${CLANG_SOURCE_DIR}/LICENSE.TXT"
-  "${CMAKE_CURRENT_SOURCE_DIR}/ClangFormat/license.txt")
-
   # Build number added to Clang version to ensure that new VSIX can be upgraded
   string(TIMESTAMP CLANG_FORMAT_VSIX_BUILD %y%m%d%H%M UTC)
 
@@ -34,5 +29,5 @@ if (BUILD_CLANG_FORMAT_VS_PLUGIN)
   COMMAND ${CMAKE_COMMAND} -E copy_if_different
   "${CMAKE_CURRENT_SOURCE_DIR}/ClangFormat/bin/Release/ClangFormat.vsix"
   "${LLVM_TOOLS_BINARY_DIR}/ClangFormat.vsix"
-  DEPENDS clang_format_exe_for_vsix clang_format_license)
+  DEPENDS clang_format_exe_for_vsix)
 endif()

Added: cfe/trunk/tools/clang-format-vs/ClangFormat/license.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-format-vs/ClangFormat/license.txt?rev=300223=auto
==
--- cfe/trunk/tools/clang-format-vs/ClangFormat/license.txt (added)
+++ cfe/trunk/tools/clang-format-vs/ClangFormat/license.txt Thu Apr 13 12:37:17 
2017
@@ -0,0 +1,39 @@
+
+LLVM Release License
+
+University of Illinois/NCSA
+Open Source License
+
+Copyright (c) 2007-2017 University of Illinois at Urbana-Champaign.
+All rights reserved.
+
+Developed by:
+
+LLVM Team
+
+University of Illinois at Urbana-Champaign
+
+http://llvm.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy 
of this software and associated documentation files (the "Software"), to deal 
with the Software without restriction, including without limitation the rights 
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 
copies of the Software, and to permit persons to whom the Software is furnished 
to do so, subject to the following conditions:
+
+* Redistributions of source code must retain the above copyright notice, 
this list of conditions and the following disclaimers.
+
+* Redistributions in binary form must reproduce the above copyright 
notice, this list of conditions and the following disclaimers in the 
documentation and/or other materials provided with the distribution.
+
+* Neither the names of the LLVM Team, University of Illinois at 
Urbana-Champaign, nor the names of its contributors may be used to endorse or 
promote products derived from this Software without specific prior written 
permission.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE 
CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE 
SOFTWARE.
+
+
+The LLVM software contains code written by third parties.  Such software will 
have its own individual LICENSE.TXT file in the directory in which it appears.  
This file will describe the copyrights, license, and restrictions which apply
+to that code.
+
+The disclaimer of warranty in the University of Illinois Open Source License 
applies to all code in the LLVM Distribution, and nothing in any of the other 
licenses gives permission to use the names of the LLVM Team or 

[PATCH] D27546: [ASTReader] Sort RawComments before merging

2017-04-13 Thread Richard Smith via Phabricator via cfe-commits
rsmith added inline comments.



Comment at: lib/Serialization/ASTReader.cpp:8487
+std::sort(Comments.begin(), Comments.end(),
+  BeforeThanCompare(SourceMgr));
 Context.Comments.addDeserializedComments(Comments);

Does this cause us to deserialize the SLocEntry for every FileID referenced by 
a RawComment? That would seem pretty bad.


https://reviews.llvm.org/D27546



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


[PATCH] D27263: Address of bitfield in anonymous struct doesn't error.

2017-04-13 Thread Jacob Young via Phabricator via cfe-commits
jacobly added a comment.

Ping.


https://reviews.llvm.org/D27263



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


[PATCH] D29654: [OpenMP] Integrate OpenMP target region cubin into host binary

2017-04-13 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
gtbercea updated this revision to Diff 95175.
gtbercea added a comment.

Use the rename() utility function of LLVM for renaming the PTXAS output before 
invoking NVLINK.


Repository:
  rL LLVM

https://reviews.llvm.org/D29654

Files:
  lib/Driver/Driver.cpp
  lib/Driver/ToolChains/CommonArgs.cpp
  lib/Driver/ToolChains/CommonArgs.h
  lib/Driver/ToolChains/Cuda.cpp
  lib/Driver/ToolChains/Cuda.h
  lib/Driver/ToolChains/Gnu.cpp
  test/Driver/openmp-offload.c

Index: test/Driver/openmp-offload.c
===
--- test/Driver/openmp-offload.c
+++ test/Driver/openmp-offload.c
@@ -590,6 +590,16 @@
 
 /// ###
 
+/// Check cubin file generation and usage by nvlink
+// RUN:   %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -save-temps -no-canonical-prefixes %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHK-CUBIN %s
+
+// CHK-CUBIN: clang{{.*}}" "-o" "{{.*}}-openmp-nvptx64-nvidia-cuda.s"
+// CHK-CUBIN-NEXT: ptxas{{.*}}" "--output-file" "{{.*}}-openmp-nvptx64-nvidia-cuda.o" "{{.*}}-openmp-nvptx64-nvidia-cuda.s"
+// CHK-CUBIN-NEXT: nvlink" "-o" "{{.*}}-openmp-nvptx64-nvidia-cuda" {{.*}} "openmp-offload-openmp-nvptx64-nvidia-cuda.cubin"
+
+/// ###
+
 /// Check PTXAS is passed -c flag when offloading to an NVIDIA device using OpenMP.
 // RUN:   %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -save-temps -no-canonical-prefixes %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHK-PTXAS-DEFAULT %s
Index: lib/Driver/ToolChains/Gnu.cpp
===
--- lib/Driver/ToolChains/Gnu.cpp
+++ lib/Driver/ToolChains/Gnu.cpp
@@ -203,131 +203,6 @@
   // The types are (hopefully) good enough.
 }
 
-/// Add OpenMP linker script arguments at the end of the argument list so that
-/// the fat binary is built by embedding each of the device images into the
-/// host. The linker script also defines a few symbols required by the code
-/// generation so that the images can be easily retrieved at runtime by the
-/// offloading library. This should be used only in tool chains that support
-/// linker scripts.
-static void AddOpenMPLinkerScript(const ToolChain , Compilation ,
-  const InputInfo ,
-  const InputInfoList ,
-  const ArgList , ArgStringList ,
-  const JobAction ) {
-
-  // If this is not an OpenMP host toolchain, we don't need to do anything.
-  if (!JA.isHostOffloading(Action::OFK_OpenMP))
-return;
-
-  // Create temporary linker script. Keep it if save-temps is enabled.
-  const char *LKS;
-  SmallString<256> Name = llvm::sys::path::filename(Output.getFilename());
-  if (C.getDriver().isSaveTempsEnabled()) {
-llvm::sys::path::replace_extension(Name, "lk");
-LKS = C.getArgs().MakeArgString(Name.c_str());
-  } else {
-llvm::sys::path::replace_extension(Name, "");
-Name = C.getDriver().GetTemporaryPath(Name, "lk");
-LKS = C.addTempFile(C.getArgs().MakeArgString(Name.c_str()));
-  }
-
-  // Add linker script option to the command.
-  CmdArgs.push_back("-T");
-  CmdArgs.push_back(LKS);
-
-  // Create a buffer to write the contents of the linker script.
-  std::string LksBuffer;
-  llvm::raw_string_ostream LksStream(LksBuffer);
-
-  // Get the OpenMP offload tool chains so that we can extract the triple
-  // associated with each device input.
-  auto OpenMPToolChains = C.getOffloadToolChains();
-  assert(OpenMPToolChains.first != OpenMPToolChains.second &&
- "No OpenMP toolchains??");
-
-  // Track the input file name and device triple in order to build the script,
-  // inserting binaries in the designated sections.
-  SmallVector, 8> InputBinaryInfo;
-
-  // Add commands to embed target binaries. We ensure that each section and
-  // image is 16-byte aligned. This is not mandatory, but increases the
-  // likelihood of data to be aligned with a cache block in several main host
-  // machines.
-  LksStream << "/*\n";
-  LksStream << "   OpenMP Offload Linker Script\n";
-  LksStream << " *** Automatically generated by Clang ***\n";
-  LksStream << "*/\n";
-  LksStream << "TARGET(binary)\n";
-  auto DTC = OpenMPToolChains.first;
-  for (auto  : Inputs) {
-const Action *A = II.getAction();
-// Is this a device linking action?
-if (A && isa(A) &&
-A->isDeviceOffloading(Action::OFK_OpenMP)) {
-  assert(DTC != OpenMPToolChains.second &&
- "More device inputs than device toolchains??");
-  InputBinaryInfo.push_back(std::make_pair(
-  DTC->second->getTriple().normalize(), II.getFilename()));
-  ++DTC;
-  LksStream << "INPUT(" << II.getFilename() << ")\n";
-}
-  }
-
-  assert(DTC == OpenMPToolChains.second 

[PATCH] D31757: [clang-tidy] Add a clang-tidy check for possible inefficient vector operations

2017-04-13 Thread Haojian Wu via Phabricator via cfe-commits
hokein added a comment.

Thanks for the comments.




Comment at: clang-tidy/performance/InefficientVectorOperationCheck.cpp:81
+  hasLoopInit(LoopVarInit),
+  hasCondition(binaryOperator(hasOperatorName("<"),
+  hasLHS(RefersToLoopVar),

aaron.ballman wrote:
> Perhaps you could support other comparisons, but not attempt to generate a 
> fix-it for them? It seems odd that this would trigger for `<` but not `<=`, 
> but I can see why you'd not want to figure out the reserve call for `!(foo >= 
> 10)`.
We could support other comparisons in the future. I think it is a good start to 
just support `<` in the first version as `<` usage happens more frequently than 
other comparisons.

Added a fixme.



Comment at: clang-tidy/performance/InefficientVectorOperationCheck.cpp:83
+  hasLHS(RefersToLoopVar),
+  hasRHS(expr().bind(LoopEndExprName,
+  hasIncrement(unaryOperator(hasOperatorName("++"),

aaron.ballman wrote:
> Thinking out loud, but, what happens if the loop end expression has some 
> hidden complexity to it? e.g.,
> ```
> for (int i = 0; i < i + 1; ++i) { // This is a "creative" loop.
>   v.push_back(i);
> }
> ```
Good point. It will copy the expr "i+1" to "reserve" parameter. This kind of 
case should not be existed, but it is safer to filter out this case.



Comment at: clang-tidy/performance/InefficientVectorOperationCheck.cpp:95-96
+const MatchFinder::MatchResult ) {
+  if (Result.Context->getDiagnostics().hasUncompilableErrorOccurred())
+return;
+

aaron.ballman wrote:
> We don't usually add this test in to our check calls; why are you adding it 
> here?
It will prevent some unexpected things happened when the translation unit fails 
to compile.

We had a few experiences before. We encountered some misbehavior of some checks 
(e.g. https://reviews.llvm.org/rL294578) with a non-compilable TU, and then we 
added this statement to avoid the misbehavior.



https://reviews.llvm.org/D31757



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


[PATCH] D27546: [ASTReader] Sort RawComments before merging

2017-04-13 Thread Bruno Cardoso Lopes via Phabricator via cfe-commits
bruno closed this revision.
bruno added a comment.

Done in r290134


https://reviews.llvm.org/D27546



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


r300245 - clang-format-vs licence.txt: drop svn:executable

2017-04-13 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Thu Apr 13 15:09:18 2017
New Revision: 300245

URL: http://llvm.org/viewvc/llvm-project?rev=300245=rev
Log:
clang-format-vs licence.txt: drop svn:executable

Not sure how it ended up with that property in the first place.

Modified:
cfe/trunk/tools/clang-format-vs/ClangFormat/license.txt   (props changed)

Propchange: cfe/trunk/tools/clang-format-vs/ClangFormat/license.txt
--
--- svn:executable (original)
+++ svn:executable (removed)
@@ -1 +0,0 @@
-*


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


[PATCH] D31757: [clang-tidy] Add a clang-tidy check for possible inefficient vector operations

2017-04-13 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments.



Comment at: clang-tidy/performance/InefficientVectorOperationCheck.cpp:95-96
+const MatchFinder::MatchResult ) {
+  if (Result.Context->getDiagnostics().hasUncompilableErrorOccurred())
+return;
+

hokein wrote:
> aaron.ballman wrote:
> > We don't usually add this test in to our check calls; why are you adding it 
> > here?
> It will prevent some unexpected things happened when the translation unit 
> fails to compile.
> 
> We had a few experiences before. We encountered some misbehavior of some 
> checks (e.g. https://reviews.llvm.org/rL294578) with a non-compilable TU, and 
> then we added this statement to avoid the misbehavior.
> 
I think that this should be moved up into whatever layer calls check(), because 
it does not seem like the checks are actually valid if the TU has had a fatal 
error. However, that doesn't have to be part of this patch.



Comment at: clang-tidy/performance/InefficientVectorOperationCheck.cpp:109-111
+  auto AllVectorVarRefs = utils::decl_ref_expr::allDeclRefExprs(
+  *VectorVarDecl, *LoopParent, *Result.Context);
+  for (const auto *Ref : AllVectorVarRefs) {

aaron.ballman wrote:
> I'm not certain what types are being used here. Can you turn 
> `AllVectorVarRefs` into something with an explicit type so that I can know 
> what `Ref`'s type is?
I may not have been clear -- I don't mean that the variable name should contain 
type information, I mean that the type should not be automatically deduced. We 
only use `auto` when the type is spelled explicitly in the initialization or is 
otherwise obvious from context (like range-based for loops).


https://reviews.llvm.org/D31757



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


[PATCH] D30837: [libcxx] Support for shared_ptr<T()>

2017-04-13 Thread Erik Pilkington via Phabricator via cfe-commits
erik.pilkington added inline comments.



Comment at: include/memory:3606
+template <>
+class _LIBCPP_TEMPLATE_VIS allocator<__shared_ptr_dummy_rebind_allocator_type>
+{

EricWF wrote:
> I would prefer using an entirely different allocator type, not a 
> specialization of `std::allocator`. 
> 
> Re-naming this class to `__shared_ptr_dummy_rebind_allocator` and moving it 
> closer to `__shared_ptr_default_allocator` would be  good.
Unfortunately, for this approach to work we have to specialize `std::allocator` 
because we use the `template  allocator(const allocator<_Up> &)` 
constructor at `__shared_ptr_pointer::__on_zero_shared_weak`. 

If specializing `std::allocator` is a problem, I suppose we could pass in a 
special entirely empty struct as an "allocator" to `__shared_ptr_pointer` when 
necessary, then metaprogram our way out of using the converting constructor at 
`__shared_ptr_ptr::__on_zero_shared_weak`. I think the current approach is 
simpler though.


https://reviews.llvm.org/D30837



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


r300257 - [CMake] Support building Fuchsia toolchain on Darwin

2017-04-13 Thread Petr Hosek via cfe-commits
Author: phosek
Date: Thu Apr 13 16:09:42 2017
New Revision: 300257

URL: http://llvm.org/viewvc/llvm-project?rev=300257=rev
Log:
[CMake] Support building Fuchsia toolchain on Darwin

This is already supported on Linux but on Darwin it requires some
extra flags.

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

Modified:
cfe/trunk/cmake/caches/Fuchsia-stage2.cmake
cfe/trunk/cmake/caches/Fuchsia.cmake

Modified: cfe/trunk/cmake/caches/Fuchsia-stage2.cmake
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/cmake/caches/Fuchsia-stage2.cmake?rev=300257=300256=300257=diff
==
--- cfe/trunk/cmake/caches/Fuchsia-stage2.cmake (original)
+++ cfe/trunk/cmake/caches/Fuchsia-stage2.cmake Thu Apr 13 16:09:42 2017
@@ -19,6 +19,10 @@ if(NOT APPLE)
   set(CLANG_DEFAULT_LINKER lld CACHE STRING "")
 endif()
 
+if(APPLE)
+  set(LLDB_CODESIGN_IDENTITY "" CACHE STRING "")
+endif()
+
 set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "")
 set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -gline-tables-only -DNDEBUG" CACHE 
STRING "")
 set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -gline-tables-only -DNDEBUG" CACHE 
STRING "")

Modified: cfe/trunk/cmake/caches/Fuchsia.cmake
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/cmake/caches/Fuchsia.cmake?rev=300257=300256=300257=diff
==
--- cfe/trunk/cmake/caches/Fuchsia.cmake (original)
+++ cfe/trunk/cmake/caches/Fuchsia.cmake Thu Apr 13 16:09:42 2017
@@ -19,6 +19,12 @@ if(NOT APPLE)
   set(BOOTSTRAP_LLVM_ENABLE_LLD ON CACHE BOOL "")
 endif()
 
+if(APPLE)
+  set(COMPILER_RT_ENABLE_IOS OFF CACHE BOOL "")
+  set(COMPILER_RT_ENABLE_TVOS OFF CACHE BOOL "")
+  set(COMPILER_RT_ENABLE_WATCHOS OFF CACHE BOOL "")
+endif()
+
 set(CLANG_BOOTSTRAP_TARGETS
   check-all
   check-llvm


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


[PATCH] D31769: Remove the binders `bind1st`, `bind2nd`, `men_fun`, etc from C++17

2017-04-13 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists closed this revision.
mclow.lists added a comment.

committed as revision 300232


https://reviews.llvm.org/D31769



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


Re: r300122 - [clang-cl] Make all sanitizer flags available in clang-cl

2017-04-13 Thread Akira Hatanaka via cfe-commits

> On Apr 13, 2017, at 9:50 AM, Reid Kleckner  wrote:
> 
> Fixed in r300209. Was the -Wslash-u-filename warning not explanatory enough 
> to suggest the solution? Maybe we could add a note like "escape source paths 
> starting with /U by passing them at the end of the command line after —".

Ah, I see, I didn’t think it was correlated. I could have figured it out if I 
had read the warnings more carefully, but I think a note like the one you 
suggested would have been clearer.

> /Users/buildslave/jenkins/sharedspace/phase1@2/llvm/tools/clang/test/Driver/fsanitize.c:113:27:
>  error: expected string not found in input
> // CHECK-USE-AFTER-SCOPE: -cc1{{.*}}-fsanitize-address-use-after-scope
>   ^
> :1:1: note: scanning from here
> clang-5.0: warning: unknown argument ignored in clang-cl: '-target' 
> [-Wunknown-argument]
> ^
> :7:89: note: possible intended match here
> clang-5.0: warning: 
> '/Users/buildslave/jenkins/sharedspace/phase1@2/llvm/tools/clang/test/Driver/fsanitize.c'
>  treated as the '/U' option [-Wslash-u-filename]
> 
> On Thu, Apr 13, 2017 at 1:12 AM, Akira Hatanaka  > wrote:
> I’m afraid I have to revert this to turn the bots green again.
> 
>> On Apr 12, 2017, at 10:41 PM, Akira Hatanaka via cfe-commits 
>> > wrote:
>> 
>> I think this broke some of the bots.
>> 
>> http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA_check/30152/ 
>> 
>> 
>> Could you take a look?
>>  
>>> On Apr 12, 2017, at 3:50 PM, Reid Kleckner via cfe-commits 
>>> > wrote:
>>> 
>>> Author: rnk
>>> Date: Wed Apr 12 17:50:51 2017
>>> New Revision: 300122
>>> 
>>> URL: http://llvm.org/viewvc/llvm-project?rev=300122=rev 
>>> 
>>> Log:
>>> [clang-cl] Make all sanitizer flags available in clang-cl
>>> 
>>> Summary:
>>> Use a tablegen let {} block so that new sanitizer flags are available by
>>> default in all driver modes. This should cut down on time wasted with
>>> bugs like http://crbug.com/710928 .
>>> 
>>> Reviewers: vitalybuka, hans
>>> 
>>> Subscribers: kcc, llvm-commits
>>> 
>>> Differential Revision: https://reviews.llvm.org/D31988 
>>> 
>>> 
>>> Modified:
>>>cfe/trunk/include/clang/Driver/Options.td
>>>cfe/trunk/test/Driver/fsanitize.c
>>> 
>>> Modified: cfe/trunk/include/clang/Driver/Options.td
>>> URL: 
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=300122=300121=300122=diff
>>>  
>>> 
>>> ==
>>> --- cfe/trunk/include/clang/Driver/Options.td (original)
>>> +++ cfe/trunk/include/clang/Driver/Options.td Wed Apr 12 17:50:51 2017
>>> @@ -778,65 +778,71 @@ def fno_signaling_math : Flag<["-"], "fn
>>> def fjump_tables : Flag<["-"], "fjump-tables">, Group;
>>> def fno_jump_tables : Flag<["-"], "fno-jump-tables">, Group, 
>>> Flags<[CC1Option]>,
>>>   HelpText<"Do not use jump tables for lowering switches">;
>>> +
>>> +// Begin sanitizer flags. These should all be core options exposed in all 
>>> driver
>>> +// modes.
>>> +let Flags = [CC1Option, CoreOption] in {
>>> +
>>> def fsanitize_EQ : CommaJoined<["-"], "fsanitize=">, Group,
>>> -   Flags<[CC1Option, CoreOption]>, MetaVarName<"">,
>>> +   MetaVarName<"">,
>>>HelpText<"Turn on runtime checks for various forms of 
>>> undefined "
>>> "or suspicious behavior. See user manual for 
>>> available checks">;
>>> def fno_sanitize_EQ : CommaJoined<["-"], "fno-sanitize=">, 
>>> Group,
>>> -  Flags<[CoreOption]>;
>>> +  Flags<[CoreOption, DriverOption]>;
>>> def fsanitize_blacklist : Joined<["-"], "fsanitize-blacklist=">,
>>> -  Group, Flags<[CC1Option, 
>>> CoreOption]>,
>>> +  Group,
>>>   HelpText<"Path to blacklist file for sanitizers">;
>>> def fno_sanitize_blacklist : Flag<["-"], "fno-sanitize-blacklist">,
>>>  Group,
>>>  HelpText<"Don't use blacklist file for 
>>> sanitizers">;
>>> def fsanitize_coverage
>>> : CommaJoined<["-"], "fsanitize-coverage=">,
>>> -  Group, Flags<[CoreOption]>,
>>> +  Group,
>>>   HelpText<"Specify the type of coverage instrumentation for 
>>> Sanitizers">;
>>> def fno_sanitize_coverage
>>> : CommaJoined<["-"], "fno-sanitize-coverage=">,
>>> -  Group, Flags<[CoreOption]>,
>>> +  Group, Flags<[CoreOption, DriverOption]>,
>>>   

[PATCH] D30837: [libcxx] Support for shared_ptr<T()>

2017-04-13 Thread Erik Pilkington via Phabricator via cfe-commits
erik.pilkington updated this revision to Diff 95210.
erik.pilkington added a comment.

This new patch includes @EricWF's static_assert & test.
Thanks,
Erik


https://reviews.llvm.org/D30837

Files:
  include/memory
  
test/libcxx/utilities/memory/util.smartptr/util.smartptr.shared/function_type_default_deleter.fail.cpp
  
test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp

Index: test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp
===
--- test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp
+++ test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp
@@ -45,6 +45,13 @@
 virtual ~Foo() = default;
 };
 
+struct Result {};
+static Result theFunction() { return Result(); }
+static int resultDeletorCount;
+static void resultDeletor(Result (*pf)()) {
+  assert(pf == theFunction);
+  ++resultDeletorCount;
+}
 
 int main()
 {
@@ -65,7 +72,11 @@
 std::shared_ptr p2 = std::make_shared();
 assert(p2.get());
 }
-
+{ // https://bugs.llvm.org/show_bug.cgi?id=27566
+  std::shared_ptr x(, );
+  std::shared_ptr y(theFunction, resultDeletor);
+}
+assert(resultDeletorCount == 2);
 #if TEST_STD_VER >= 11
 nc = globalMemCounter.outstanding_new;
 {
Index: test/libcxx/utilities/memory/util.smartptr/util.smartptr.shared/function_type_default_deleter.fail.cpp
===
--- test/libcxx/utilities/memory/util.smartptr/util.smartptr.shared/function_type_default_deleter.fail.cpp
+++ test/libcxx/utilities/memory/util.smartptr/util.smartptr.shared/function_type_default_deleter.fail.cpp
@@ -0,0 +1,40 @@
+#include 
+
+template  struct Tag {};
+
+template 
+using SPtr = std::shared_ptr;
+
+template 
+using FnType = void(Tag);
+
+template 
+void TestFn(Tag) {}
+
+template 
+FnType* getFn() {
+  return ;
+}
+
+struct Deleter {
+  template 
+  void operator()(Tp) const {
+using RawT = typename std::remove_pointer::type;
+static_assert(std::is_function::value ||
+  std::is_null_pointer::value, "");
+  }
+};
+
+int main() {
+  {
+SPtr<0> s; // OK
+SPtr<1> s1(nullptr); // OK
+SPtr<2> s2(getFn<2>(), Deleter{}); // OK
+SPtr<3> s3(nullptr, Deleter{}); // OK
+  }
+  // expected-error@memory:* 2 {{static_assert failed "default_delete cannot be instantiated for function types"}}
+  {
+SPtr<4> s4(getFn<4>()); // expected-note {{requested here}}
+SPtr<5> s5(getFn<5>(), std::default_delete>{}); // expected-note {{requested here}}
+  }
+}
Index: include/memory
===
--- include/memory
+++ include/memory
@@ -2274,6 +2274,8 @@
 template 
 struct _LIBCPP_TEMPLATE_VIS default_delete
 {
+static_assert(!is_function<_Tp>::value,
+  "default_delete cannot be instantiated for function types");
 #ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR default_delete() _NOEXCEPT = default;
 #else
@@ -3493,6 +3495,17 @@
 __a.deallocate(_PTraits::pointer_to(*this), 1);
 }
 
+struct __shared_ptr_dummy_rebind_allocator_type;
+template <>
+class _LIBCPP_TEMPLATE_VIS allocator<__shared_ptr_dummy_rebind_allocator_type>
+{
+template 
+struct rebind
+{
+typedef allocator<_Other> other;
+};
+};
+
 template class _LIBCPP_TEMPLATE_VIS enable_shared_from_this;
 
 template
@@ -3761,6 +3774,17 @@
 #endif  // _LIBCPP_HAS_NO_VARIADICS
 
 private:
+template ::value>
+struct __shared_ptr_default_allocator
+{
+typedef allocator<_Yp> type;
+};
+
+template 
+struct __shared_ptr_default_allocator<_Yp, true>
+{
+typedef allocator<__shared_ptr_dummy_rebind_allocator_type> type;
+};
 
 template 
 _LIBCPP_INLINE_VISIBILITY
@@ -3776,8 +3800,7 @@
 }
 }
 
-_LIBCPP_INLINE_VISIBILITY
-void __enable_weak_this(const volatile void*, const volatile void*) _NOEXCEPT {}
+_LIBCPP_INLINE_VISIBILITY void __enable_weak_this(...) _NOEXCEPT {}
 
 template  friend class _LIBCPP_TEMPLATE_VIS shared_ptr;
 template  friend class _LIBCPP_TEMPLATE_VIS weak_ptr;
@@ -3808,8 +3831,9 @@
 : __ptr_(__p)
 {
 unique_ptr<_Yp> __hold(__p);
-typedef __shared_ptr_pointer<_Yp*, default_delete<_Yp>, allocator<_Yp> > _CntrlBlk;
-__cntrl_ = new _CntrlBlk(__p, default_delete<_Yp>(), allocator<_Yp>());
+typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT;
+typedef __shared_ptr_pointer<_Yp*, default_delete<_Yp>, _AllocT > _CntrlBlk;
+__cntrl_ = new _CntrlBlk(__p, default_delete<_Yp>(), _AllocT());
 __hold.release();
 

[PATCH] D29654: [OpenMP] Integrate OpenMP target region cubin into host binary

2017-04-13 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
gtbercea marked 4 inline comments as done.
gtbercea added inline comments.



Comment at: test/Driver/openmp-offload.c:594
+/// Check cubin file generation and usage by nvlink
+// RUN:   %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda 
-save-temps -no-canonical-prefixes %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHK-CUBIN %s

rnk wrote:
> In this case, it would be nicer if you arranged for ptxas to output to a 
> .cubin file.
@rnk I'm not sure what you mean by this comment, can you please clarify?


Repository:
  rL LLVM

https://reviews.llvm.org/D29654



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


[PATCH] D31717: CodeGen: Let lifetime intrinsic use alloca address space

2017-04-13 Thread Matt Arsenault via Phabricator via cfe-commits
arsenm accepted this revision.
arsenm added a comment.
This revision is now accepted and ready to land.

LGTM




Comment at: test/CodeGenOpenCL/lifetime.cl:14
+// AMDGIZ: @llvm.lifetime.start.p5i
+  helper_no_markers();
+}

Check line for the end as well?


https://reviews.llvm.org/D31717



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


[PATCH] D31778: [Modules] Implement ODR-like semantics for tag types in C/ObjC

2017-04-13 Thread Bruno Cardoso Lopes via Phabricator via cfe-commits
bruno added a comment.

@rsmith ping!


https://reviews.llvm.org/D31778



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


[PATCH] D32035: [OpenMP] Error when trying to offload to an unsupported architecture

2017-04-13 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
gtbercea updated this revision to Diff 95198.
gtbercea added a comment.

Re-use an already existing flag rather than creating a new one.


Repository:
  rL LLVM

https://reviews.llvm.org/D32035

Files:
  lib/Frontend/CompilerInvocation.cpp
  test/OpenMP/target_messages.cpp


Index: test/OpenMP/target_messages.cpp
===
--- test/OpenMP/target_messages.cpp
+++ test/OpenMP/target_messages.cpp
@@ -4,6 +4,8 @@
 // RUN: not %clang_cc1 -fopenmp -std=c++11 -triple nvptx64-nvidia-cuda -o - %s 
2>&1 | FileCheck --check-prefix CHECK-UNSUPPORTED-HOST-TARGET %s
 // RUN: not %clang_cc1 -fopenmp -std=c++11 -triple nvptx-nvidia-cuda -o - %s 
2>&1 | FileCheck --check-prefix CHECK-UNSUPPORTED-HOST-TARGET %s
 // CHECK-UNSUPPORTED-HOST-TARGET: error: The target 
'{{nvptx64-nvidia-cuda|nvptx-nvidia-cuda}}' is not a supported OpenMP host 
target.
+// RUN: not %clang_cc1 -fopenmp -std=c++11 -fopenmp-targets=hexagon-linux-gnu 
-o - %s 2>&1 | FileCheck --check-prefix CHECK-UNSUPPORTED-DEVICE-TARGET %s
+// CHECK-UNSUPPORTED-DEVICE-TARGET: OpenMP target is invalid: 
'hexagon-linux-gnu'
 
 void foo() {
 }
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -2239,6 +2239,16 @@
 for (unsigned i = 0; i < A->getNumValues(); ++i) {
   llvm::Triple TT(A->getValue(i));
 
+  if (!(TT.getArch() == llvm::Triple::ppc ||
+TT.getArch() == llvm::Triple::ppc64 ||
+TT.getArch() == llvm::Triple::ppc64le ||
+TT.getArch() == llvm::Triple::nvptx ||
+TT.getArch() == llvm::Triple::nvptx64 ||
+TT.getArch() == llvm::Triple::x86 ||
+TT.getArch() == llvm::Triple::x86_64))
+Diags.Report(clang::diag::err_drv_invalid_omp_target)
+<< A->getValue(i);
+
   if (TT.getArch() == llvm::Triple::UnknownArch)
 Diags.Report(clang::diag::err_drv_invalid_omp_target) << 
A->getValue(i);
   else


Index: test/OpenMP/target_messages.cpp
===
--- test/OpenMP/target_messages.cpp
+++ test/OpenMP/target_messages.cpp
@@ -4,6 +4,8 @@
 // RUN: not %clang_cc1 -fopenmp -std=c++11 -triple nvptx64-nvidia-cuda -o - %s 2>&1 | FileCheck --check-prefix CHECK-UNSUPPORTED-HOST-TARGET %s
 // RUN: not %clang_cc1 -fopenmp -std=c++11 -triple nvptx-nvidia-cuda -o - %s 2>&1 | FileCheck --check-prefix CHECK-UNSUPPORTED-HOST-TARGET %s
 // CHECK-UNSUPPORTED-HOST-TARGET: error: The target '{{nvptx64-nvidia-cuda|nvptx-nvidia-cuda}}' is not a supported OpenMP host target.
+// RUN: not %clang_cc1 -fopenmp -std=c++11 -fopenmp-targets=hexagon-linux-gnu -o - %s 2>&1 | FileCheck --check-prefix CHECK-UNSUPPORTED-DEVICE-TARGET %s
+// CHECK-UNSUPPORTED-DEVICE-TARGET: OpenMP target is invalid: 'hexagon-linux-gnu'
 
 void foo() {
 }
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -2239,6 +2239,16 @@
 for (unsigned i = 0; i < A->getNumValues(); ++i) {
   llvm::Triple TT(A->getValue(i));
 
+  if (!(TT.getArch() == llvm::Triple::ppc ||
+TT.getArch() == llvm::Triple::ppc64 ||
+TT.getArch() == llvm::Triple::ppc64le ||
+TT.getArch() == llvm::Triple::nvptx ||
+TT.getArch() == llvm::Triple::nvptx64 ||
+TT.getArch() == llvm::Triple::x86 ||
+TT.getArch() == llvm::Triple::x86_64))
+Diags.Report(clang::diag::err_drv_invalid_omp_target)
+<< A->getValue(i);
+
   if (TT.getArch() == llvm::Triple::UnknownArch)
 Diags.Report(clang::diag::err_drv_invalid_omp_target) << A->getValue(i);
   else
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D32043: [Driver] Load all necessary default sanitizer blacklists

2017-04-13 Thread Vedant Kumar via Phabricator via cfe-commits
vsk created this revision.

This patch removes a limitation which causes us to load at most one
default sanitizer blacklist when multiple sanitizers are enabled. E.g if
asan + cfi are enabled, and default blacklists for both sanitizers are
present, we would only load one of the blacklists.

The new behavior would be to load all available default blacklists for
enabled sanitizers.


https://reviews.llvm.org/D32043

Files:
  lib/Driver/SanitizerArgs.cpp
  test/Driver/Inputs/resource_dir/cfi_blacklist.txt
  test/Driver/fsanitize-blacklist.c


Index: test/Driver/fsanitize-blacklist.c
===
--- test/Driver/fsanitize-blacklist.c
+++ test/Driver/fsanitize-blacklist.c
@@ -20,9 +20,20 @@
 // CHECK-BLACKLIST2: -fdepfile-entry={{.*}}.good" 
"-fdepfile-entry={{.*}}.second
 
 // Check that the default blacklist is not added as an extra dependency.
-// RUN: %clang -target x86_64-linux-gnu -fsanitize=address 
-resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s 
--check-prefix=CHECK-DEFAULT-BLACKLIST --implicit-check-not=fdepfile-entry
+// RUN: %clang -target x86_64-linux-gnu -fsanitize=address 
-resource-dir=%S/Inputs/resource_dir %s -### &> %t.cc1_asan
+// RUN: FileCheck %s --check-prefix=CHECK-DEFAULT-BLACKLIST 
--implicit-check-not=fdepfile-entry -input-file %t.cc1_asan
 // CHECK-DEFAULT-BLACKLIST: -fsanitize-blacklist={{.*}}asan_blacklist.txt
 
+// Check that default blacklists are not added unless the matching sanitizer is
+// enabled, even if the blacklist exists.
+// RUN: FileCheck %s --implicit-check-not=cfi_blacklist.txt -input-file 
%t.cc1_asan
+
+// Check that we can add multiple default blacklists if the matching sanitizers
+// are enabled.
+// RUN: %clang -target x86_64-linux-gnu -fsanitize=address,cfi -flto 
-fvisibility=hidden -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | 
FileCheck %s --check-prefix=MULTIPLE-DEFAULT-BLACKLISTS
+// MULTIPLE-DEFAULT-BLACKLISTS-DAG: 
-fsanitize-blacklist={{.*}}asan_blacklist.txt
+// MULTIPLE-DEFAULT-BLACKLISTS-DAG: 
-fsanitize-blacklist={{.*}}cfi_blacklist.txt
+
 // Ignore -fsanitize-blacklist flag if there is no -fsanitize flag.
 // RUN: %clang -target x86_64-linux-gnu -fsanitize-blacklist=%t.good %s -### 
2>&1 | FileCheck %s --check-prefix=CHECK-NO-SANITIZE --check-prefix=DELIMITERS
 // CHECK-NO-SANITIZE-NOT: -fsanitize-blacklist
Index: lib/Driver/SanitizerArgs.cpp
===
--- lib/Driver/SanitizerArgs.cpp
+++ lib/Driver/SanitizerArgs.cpp
@@ -85,27 +85,24 @@
 /// Sanitizers set.
 static std::string toString(const clang::SanitizerSet );
 
-static bool getDefaultBlacklist(const Driver , SanitizerMask Kinds,
-std::string ) {
-  const char *BlacklistFile = nullptr;
-  if (Kinds & Address)
-BlacklistFile = "asan_blacklist.txt";
-  else if (Kinds & Memory)
-BlacklistFile = "msan_blacklist.txt";
-  else if (Kinds & Thread)
-BlacklistFile = "tsan_blacklist.txt";
-  else if (Kinds & DataFlow)
-BlacklistFile = "dfsan_abilist.txt";
-  else if (Kinds & CFI)
-BlacklistFile = "cfi_blacklist.txt";
-
-  if (BlacklistFile) {
+/// Add default blacklists from the resource directory.
+static void findDefaultBlacklists(const Driver , SanitizerMask Kinds,
+  std::vector ) {
+  const std::pair DefaultBlacklists[] = {
+  {Address, "asan_blacklist.txt"},
+  {Memory, "msan_blacklist.txt"},
+  {Thread, "tsan_blacklist.txt"},
+  {DataFlow, "dfsan_abilist.txt"},
+  {CFI, "cfi_blacklist.txt"}};
+  for (const auto  : DefaultBlacklists) {
+if (!(Kinds & BL.first))
+  continue;
+
 clang::SmallString<64> Path(D.ResourceDir);
-llvm::sys::path::append(Path, BlacklistFile);
-BLPath = Path.str();
-return true;
+llvm::sys::path::append(Path, BL.second);
+if (llvm::sys::fs::exists(Path))
+  BlacklistFiles.push_back(Path.str());
   }
-  return false;
 }
 
 /// Sets group bits for every group that has at least one representative 
already
@@ -382,12 +379,8 @@
   TrappingKinds &= Kinds;
 
   // Setup blacklist files.
-  // Add default blacklist from resource directory.
-  {
-std::string BLPath;
-if (getDefaultBlacklist(D, Kinds, BLPath) && llvm::sys::fs::exists(BLPath))
-  BlacklistFiles.push_back(BLPath);
-  }
+  findDefaultBlacklists(D, Kinds, BlacklistFiles);
+
   // Parse -f(no-)sanitize-blacklist options.
   for (const auto *Arg : Args) {
 if (Arg->getOption().matches(options::OPT_fsanitize_blacklist)) {


Index: test/Driver/fsanitize-blacklist.c
===
--- test/Driver/fsanitize-blacklist.c
+++ test/Driver/fsanitize-blacklist.c
@@ -20,9 +20,20 @@
 // CHECK-BLACKLIST2: -fdepfile-entry={{.*}}.good" "-fdepfile-entry={{.*}}.second
 
 // Check that the default blacklist is not added as an extra dependency.
-// RUN: %clang -target 

[PATCH] D31982: [analyzer] Improve suppression for inlined defensive checks when operator& is involved.

2017-04-13 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ updated this revision to Diff 95082.
NoQ added a comment.

Remove accidentally added braces in unrelated code.


https://reviews.llvm.org/D31982

Files:
  lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
  lib/StaticAnalyzer/Core/Store.cpp
  test/Analysis/explain-svals.cpp
  test/Analysis/inlining/inline-defensive-checks.c
  test/Analysis/inlining/inline-defensive-checks.cpp
  test/Analysis/uninit-const.cpp

Index: test/Analysis/uninit-const.cpp
===
--- test/Analysis/uninit-const.cpp
+++ test/Analysis/uninit-const.cpp
@@ -122,7 +122,7 @@
 }
 
 void f_uninit(void) {
-  int x;
+  int x;   // expected-note {{'x' declared without an initial value}}
   doStuff_uninit();  // expected-warning {{1st function call argument is a pointer to uninitialized value}}
// expected-note@-1 {{1st function call argument is a pointer to uninitialized value}}
 }
Index: test/Analysis/inlining/inline-defensive-checks.cpp
===
--- test/Analysis/inlining/inline-defensive-checks.cpp
+++ test/Analysis/inlining/inline-defensive-checks.cpp
@@ -70,4 +70,17 @@
 void test(int *p1, int *p2) {
   idc(p1);
 	Foo f(p1);
-}
\ No newline at end of file
+}
+
+struct Bar {
+  int x;
+};
+void idcBar(Bar *b) {
+  if (b)
+;
+}
+void testRefToField(Bar *b) {
+  idcBar(b);
+  int  = b->x; // no-warning
+  x = 5;
+}
Index: test/Analysis/inlining/inline-defensive-checks.c
===
--- test/Analysis/inlining/inline-defensive-checks.c
+++ test/Analysis/inlining/inline-defensive-checks.c
@@ -1,7 +1,7 @@
 // RUN: %clang_analyze_cc1 -analyzer-checker=core -analyzer-config suppress-inlined-defensive-checks=true -verify %s
 
 // Perform inline defensive checks.
-void idc(int *p) {
+void idc(void *p) {
 	if (p)
 		;
 }
@@ -139,3 +139,42 @@
   int z = y;
   idcTriggerZeroValueThroughCall(z);
 }
+
+struct S {
+  int f1;
+  int f2;
+};
+
+void idcTrackZeroValueThroughUnaryPointerOperators(struct S *s) {
+  idc(s);
+  *(&(s->f1)) = 7; // no-warning
+}
+
+void idcTrackZeroValueThroughUnaryPointerOperatorsWithOffset1(struct S *s) {
+  idc(s);
+  int *x = &(s->f2);
+  *x = 7; // no-warning
+}
+
+void idcTrackZeroValueThroughUnaryPointerOperatorsWithOffset2(struct S *s) {
+  idc(s);
+  int *x = &(s->f2) - 1;
+  // FIXME: Should not warn.
+  *x = 7; // expected-warning{{Dereference of null pointer}}
+}
+
+void idcTrackZeroValueThroughUnaryPointerOperatorsWithAssignment(struct S *s) {
+  idc(s);
+  int *x = &(s->f1);
+  *x = 7; // no-warning
+}
+
+
+struct S2 {
+  int a[1];
+};
+
+void idcTrackZeroValueThroughUnaryPointerOperatorsWithArrayField(struct S2 *s) {
+  idc(s);
+  *(&(s->a[0])) = 7; // no-warning
+}
Index: test/Analysis/explain-svals.cpp
===
--- test/Analysis/explain-svals.cpp
+++ test/Analysis/explain-svals.cpp
@@ -81,9 +81,10 @@
 
 namespace {
 class C {
+public:
   int x[10];
+  int y;
 
-public:
   void test_5(int i) {
 clang_analyzer_explain(this); // expected-warning-re^pointer to 'this' object$
 clang_analyzer_explain([i]); // expected-warning-re^pointer to element of type 'int' with index 'argument 'i'' of field 'x' of 'this' object$
@@ -96,3 +97,9 @@
   clang_analyzer_explain(conjure_S()); // expected-warning-re^lazily frozen compound value of temporary object constructed at statement 'conjure_S\(\)'$
   clang_analyzer_explain(conjure_S().z); // expected-warning-re^value derived from \(symbol of type 'struct S' conjured at statement 'conjure_S\(\)'\) for field 'z' of temporary object constructed at statement 'conjure_S\(\)'$
 }
+
+void test_7() {
+  C *c = 0;
+  // FIXME: we need to be explaining '40' rather than '0' here; not explainer bug.
+  clang_analyzer_explain(>y); // expected-warning-re^concrete memory address '0'$
+}
Index: lib/StaticAnalyzer/Core/Store.cpp
===
--- lib/StaticAnalyzer/Core/Store.cpp
+++ lib/StaticAnalyzer/Core/Store.cpp
@@ -406,6 +406,10 @@
 // FIXME: What we should return is the field offset.  For example,
 //  add the field offset to the integer value.  That way funny things
 //  like this work properly:  &(((struct foo *) 0xa)->f)
+//  However, that's not easy to fix without reducing our abilities
+//  to catch null pointer dereference. Eg., ((struct foo *)0x0)->f = 7
+//  is a null dereference even though we're dereferencing offset of f
+//  rather than null.
 return Base;
 
   default:
Index: lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
===
--- lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
+++ lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
@@ -961,6 +961,28 @@
   const Expr *Inner = nullptr;
   if (const Expr 

[PATCH] D31886: [analyzer] Simplify values in binary operations more aggressively

2017-04-13 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL300178: [analyzer] Simplify values in binary operations a 
bit more aggressively. (authored by dergachev).

Changed prior to commit:
  https://reviews.llvm.org/D31886?vs=94955=95084#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D31886

Files:
  cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h
  cfe/trunk/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
  cfe/trunk/test/Analysis/additive-folding.cpp

Index: cfe/trunk/test/Analysis/additive-folding.cpp
===
--- cfe/trunk/test/Analysis/additive-folding.cpp
+++ cfe/trunk/test/Analysis/additive-folding.cpp
@@ -205,3 +205,12 @@
 
   clang_analyzer_eval(x == 3); // expected-warning{{UNKNOWN}}
 }
+
+void additiveSymSymFolding(int x, int y) {
+  // We should simplify 'x - 1' to '0' and handle the comparison,
+  // despite both sides being complicated symbols.
+  int z = x - 1;
+  if (x == 1)
+if (y >= 0)
+  clang_analyzer_eval(z <= y); // expected-warning{{TRUE}}
+}
Index: cfe/trunk/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
===
--- cfe/trunk/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
@@ -14,6 +14,7 @@
 #include "clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/APSIntType.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h"
+#include "clang/StaticAnalyzer/Core/PathSensitive/SValVisitor.h"
 
 using namespace clang;
 using namespace ento;
@@ -44,6 +45,10 @@
   ///  (integer) value, that value is returned. Otherwise, returns NULL.
   const llvm::APSInt *getKnownValue(ProgramStateRef state, SVal V) override;
 
+  /// Recursively descends into symbolic expressions and replaces symbols
+  /// with their known values (in the sense of the getKnownValue() method).
+  SVal simplifySVal(ProgramStateRef State, SVal V) override;
+
   SVal MakeSymIntVal(const SymExpr *LHS, BinaryOperator::Opcode op,
  const llvm::APSInt , QualType resultTy);
 };
@@ -537,11 +542,12 @@
   // Does the symbolic expression simplify to a constant?
   // If so, "fold" the constant by setting 'lhs' to a ConcreteInt
   // and try again.
-  ConstraintManager  = state->getConstraintManager();
-  if (const llvm::APSInt *Constant = CMgr.getSymVal(state, Sym)) {
-lhs = nonloc::ConcreteInt(*Constant);
-continue;
-  }
+  SVal simplifiedLhs = simplifySVal(state, lhs);
+  if (simplifiedLhs != lhs)
+if (auto simplifiedLhsAsNonLoc = simplifiedLhs.getAs()) {
+  lhs = *simplifiedLhsAsNonLoc;
+  continue;
+}
 
   // Is the RHS a constant?
   if (const llvm::APSInt *RHSValue = getKnownValue(state, rhs))
@@ -993,3 +999,74 @@
   // FIXME: Add support for SymExprs.
   return nullptr;
 }
+
+SVal SimpleSValBuilder::simplifySVal(ProgramStateRef State, SVal V) {
+  // For now, this function tries to constant-fold symbols inside a
+  // nonloc::SymbolVal, and does nothing else. More simplifications should
+  // be possible, such as constant-folding an index in an ElementRegion.
+
+  class Simplifier : public FullSValVisitor {
+ProgramStateRef State;
+SValBuilder 
+
+  public:
+Simplifier(ProgramStateRef State)
+: State(State), SVB(State->getStateManager().getSValBuilder()) {}
+
+SVal VisitSymbolData(const SymbolData *S) {
+  if (const llvm::APSInt *I =
+  SVB.getKnownValue(State, nonloc::SymbolVal(S)))
+return Loc::isLocType(S->getType()) ? (SVal)SVB.makeIntLocVal(*I)
+: (SVal)SVB.makeIntVal(*I);
+  return nonloc::SymbolVal(S);
+}
+
+// TODO: Support SymbolCast. Support IntSymExpr when/if we actually
+// start producing them.
+
+SVal VisitSymIntExpr(const SymIntExpr *S) {
+  SVal LHS = Visit(S->getLHS());
+  SVal RHS;
+  // By looking at the APSInt in the right-hand side of S, we cannot
+  // figure out if it should be treated as a Loc or as a NonLoc.
+  // So make our guess by recalling that we cannot multiply pointers
+  // or compare a pointer to an integer.
+  if (Loc::isLocType(S->getLHS()->getType()) &&
+  BinaryOperator::isComparisonOp(S->getOpcode())) {
+// The usual conversion of $sym to {$sym}, as they have
+// the same meaning for Loc-type symbols, but the latter form
+// is preferred in SVal computations for being Loc itself.
+if (SymbolRef Sym = LHS.getAsSymbol()) {
+  assert(Loc::isLocType(Sym->getType()));
+  LHS = SVB.makeLoc(Sym);
+}
+RHS = SVB.makeIntLocVal(S->getRHS());
+  } else {
+RHS = SVB.makeIntVal(S->getRHS());
+  }
+  return SVB.evalBinOp(State, S->getOpcode(), 

r300181 - Revert "[clang-cl] Make all sanitizer flags available in clang-cl"

2017-04-13 Thread Akira Hatanaka via cfe-commits
Author: ahatanak
Date: Thu Apr 13 03:02:29 2017
New Revision: 300181

URL: http://llvm.org/viewvc/llvm-project?rev=300181=rev
Log:
Revert "[clang-cl] Make all sanitizer flags available in clang-cl"

This reverts commit 47979b20b475664013d19382fc6875b5b9f3ed9d.

This was causing a couple of bots to fail.

http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA_check/30152

Modified:
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/test/Driver/fsanitize.c

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=300181=300180=300181=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Thu Apr 13 03:02:29 2017
@@ -778,71 +778,65 @@ def fno_signaling_math : Flag<["-"], "fn
 def fjump_tables : Flag<["-"], "fjump-tables">, Group;
 def fno_jump_tables : Flag<["-"], "fno-jump-tables">, Group, 
Flags<[CC1Option]>,
   HelpText<"Do not use jump tables for lowering switches">;
-
-// Begin sanitizer flags. These should all be core options exposed in all 
driver
-// modes.
-let Flags = [CC1Option, CoreOption] in {
-
 def fsanitize_EQ : CommaJoined<["-"], "fsanitize=">, Group,
-   MetaVarName<"">,
+   Flags<[CC1Option, CoreOption]>, MetaVarName<"">,
HelpText<"Turn on runtime checks for various forms of 
undefined "
 "or suspicious behavior. See user manual for 
available checks">;
 def fno_sanitize_EQ : CommaJoined<["-"], "fno-sanitize=">, 
Group,
-  Flags<[CoreOption, DriverOption]>;
+  Flags<[CoreOption]>;
 def fsanitize_blacklist : Joined<["-"], "fsanitize-blacklist=">,
-  Group,
+  Group, Flags<[CC1Option, CoreOption]>,
   HelpText<"Path to blacklist file for sanitizers">;
 def fno_sanitize_blacklist : Flag<["-"], "fno-sanitize-blacklist">,
  Group,
  HelpText<"Don't use blacklist file for 
sanitizers">;
 def fsanitize_coverage
 : CommaJoined<["-"], "fsanitize-coverage=">,
-  Group,
+  Group, Flags<[CoreOption]>,
   HelpText<"Specify the type of coverage instrumentation for Sanitizers">;
 def fno_sanitize_coverage
 : CommaJoined<["-"], "fno-sanitize-coverage=">,
-  Group, Flags<[CoreOption, DriverOption]>,
+  Group, Flags<[CoreOption]>,
   HelpText<"Disable specified features of coverage instrumentation for "
"Sanitizers">;
 def fsanitize_memory_track_origins_EQ : Joined<["-"], 
"fsanitize-memory-track-origins=">,
-Group,
+Group, 
Flags<[CC1Option]>,
 HelpText<"Enable origins tracking in 
MemorySanitizer">;
 def fsanitize_memory_track_origins : Flag<["-"], 
"fsanitize-memory-track-origins">,
- Group,
+ Group, Flags<[CC1Option]>,
  HelpText<"Enable origins tracking in 
MemorySanitizer">;
 def fno_sanitize_memory_track_origins : Flag<["-"], 
"fno-sanitize-memory-track-origins">,
-Group,
-Flags<[CoreOption, DriverOption]>,
+Group, 
Flags<[CC1Option]>,
 HelpText<"Disable origins tracking in 
MemorySanitizer">;
 def fsanitize_memory_use_after_dtor : Flag<["-"], 
"fsanitize-memory-use-after-dtor">,
- Group,
+ Group, Flags<[CC1Option]>,
  HelpText<"Enable use-after-destroy 
detection in MemorySanitizer">;
 def fsanitize_address_field_padding : Joined<["-"], 
"fsanitize-address-field-padding=">,
-Group,
+Group, 
Flags<[CC1Option]>,
 HelpText<"Level of field padding for 
AddressSanitizer">;
 def fsanitize_address_use_after_scope : Flag<["-"], 
"fsanitize-address-use-after-scope">,
-Group,
+Group, 
Flags<[CC1Option]>,
 HelpText<"Enable use-after-scope 
detection in AddressSanitizer">;
 def fno_sanitize_address_use_after_scope : Flag<["-"], 
"fno-sanitize-address-use-after-scope">,
-   Group,
-   Flags<[CoreOption, DriverOption]>,
+   Group, 
Flags<[CC1Option]>,
HelpText<"Disable use-after-scope 
detection in 

[libcxx] r300191 - Add TEST_NOEXCEPT_FALSE to support D31738

2017-04-13 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Thu Apr 13 05:17:23 2017
New Revision: 300191

URL: http://llvm.org/viewvc/llvm-project?rev=300191=rev
Log:
Add TEST_NOEXCEPT_FALSE to support D31738

Modified:
libcxx/trunk/test/support/test_macros.h

Modified: libcxx/trunk/test/support/test_macros.h
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/test_macros.h?rev=300191=300190=300191=diff
==
--- libcxx/trunk/test/support/test_macros.h (original)
+++ libcxx/trunk/test/support/test_macros.h Thu Apr 13 05:17:23 2017
@@ -106,6 +106,7 @@
 #define TEST_ALIGNAS(...) alignas(__VA_ARGS__)
 #define TEST_CONSTEXPR constexpr
 #define TEST_NOEXCEPT noexcept
+#define TEST_NOEXCEPT_FALSE noexcept(false)
 #define TEST_NOEXCEPT_COND(...) noexcept(__VA_ARGS__)
 # if TEST_STD_VER >= 14
 #   define TEST_CONSTEXPR_CXX14 constexpr
@@ -123,6 +124,7 @@
 #define TEST_CONSTEXPR
 #define TEST_CONSTEXPR_CXX14
 #define TEST_NOEXCEPT throw()
+#define TEST_NOEXCEPT_FALSE
 #define TEST_NOEXCEPT_COND(...)
 #define TEST_THROW_SPEC(...) throw(__VA_ARGS__)
 #endif


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


r300187 - [analyzer] Add numerous assertions to SVal, SymExpr, and MemRegion classes.

2017-04-13 Thread Artem Dergachev via cfe-commits
Author: dergachev
Date: Thu Apr 13 04:48:05 2017
New Revision: 300187

URL: http://llvm.org/viewvc/llvm-project?rev=300187=rev
Log:
[analyzer] Add numerous assertions to SVal, SymExpr, and MemRegion classes.

Clean up vtable anchors (remove anchors for regions that have regular
out-of-line virtual methods, add anchors for regions that don't have those).

Fix private/public methods (all constructors should now be private for leaf
classes, protected for abstract classes).

No functional change intended, only extra sanity checks and cleanups.

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

Modified:

cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h
cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h
cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h
cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SymExpr.h
cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h
cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp

Modified: 
cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h?rev=300187=300186=300187=diff
==
--- 
cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h 
(original)
+++ 
cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h 
Thu Apr 13 04:48:05 2017
@@ -20,6 +20,7 @@
 #include "clang/StaticAnalyzer/Core/PathSensitive/APSIntType.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/SVals.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/StoreRef.h"
+#include "clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h"
 
 namespace clang {
 namespace ento {
@@ -29,8 +30,9 @@ class CompoundValData : public llvm::Fol
   llvm::ImmutableList L;
 
 public:
-  CompoundValData(QualType t, llvm::ImmutableList l)
-: T(t), L(l) {}
+  CompoundValData(QualType t, llvm::ImmutableList l) : T(t), L(l) {
+assert(NonLoc::isCompoundType(t));
+  }
 
   typedef llvm::ImmutableList::iterator iterator;
   iterator begin() const { return L.begin(); }
@@ -47,7 +49,9 @@ class LazyCompoundValData : public llvm:
   const TypedValueRegion *region;
 public:
   LazyCompoundValData(const StoreRef , const TypedValueRegion *r)
-: store(st), region(r) {}
+  : store(st), region(r) {
+assert(NonLoc::isCompoundType(r->getValueType()));
+  }
 
   const void *getStore() const { return store.getStore(); }
   const TypedValueRegion *getRegion() const { return region; }

Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h?rev=300187=300186=300187=diff
==
--- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h 
(original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h Thu 
Apr 13 04:48:05 2017
@@ -182,6 +182,7 @@ protected:
 
   MemSpaceRegion(MemRegionManager *mgr, Kind k) : MemRegion(k), Mgr(mgr) {
 assert(classof(this));
+assert(mgr);
   }
 
   MemRegionManager* getMemRegionManager() const override { return Mgr; }
@@ -215,9 +216,12 @@ public:
 
 class GlobalsSpaceRegion : public MemSpaceRegion {
   virtual void anchor();
+
 protected:
-  GlobalsSpaceRegion(MemRegionManager *mgr, Kind k)
-: MemSpaceRegion(mgr, k) {}
+  GlobalsSpaceRegion(MemRegionManager *mgr, Kind k) : MemSpaceRegion(mgr, k) {
+assert(classof(this));
+  }
+
 public:
   static bool classof(const MemRegion *R) {
 Kind k = R->getKind();
@@ -236,7 +240,9 @@ class StaticGlobalSpaceRegion : public G
   const CodeTextRegion *CR;
   
   StaticGlobalSpaceRegion(MemRegionManager *mgr, const CodeTextRegion *cr)
-: GlobalsSpaceRegion(mgr, StaticGlobalSpaceRegionKind), CR(cr) {}
+: GlobalsSpaceRegion(mgr, StaticGlobalSpaceRegionKind), CR(cr) {
+assert(cr);
+  }
 
 public:
   void Profile(llvm::FoldingSetNodeID ) const override;
@@ -257,9 +263,13 @@ public:
 /// RegionStoreManager::invalidateRegions (instead of finding all the dependent
 /// globals, we invalidate the whole parent region).
 class NonStaticGlobalSpaceRegion : public GlobalsSpaceRegion {
+  virtual void anchor() override;
+
 protected:
   NonStaticGlobalSpaceRegion(MemRegionManager *mgr, Kind k)
-: GlobalsSpaceRegion(mgr, k) {}
+  : GlobalsSpaceRegion(mgr, k) {
+assert(classof(this));
+  }
 
 public:
 
@@ -326,7 +336,6 @@ public:
 };
 
 class HeapSpaceRegion : public MemSpaceRegion {
-  virtual void anchor();
   friend class MemRegionManager;
   
   HeapSpaceRegion(MemRegionManager *mgr)
@@ -341,10 +350,10 @@ public:
 };
   
 class UnknownSpaceRegion : public MemSpaceRegion {
-  virtual void anchor();
   friend class 

[PATCH] D26837: [analyzer] Litter the SVal/SymExpr/MemRegion class hierarchy with asserts.

2017-04-13 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL300187: [analyzer] Add numerous assertions to SVal, SymExpr, 
and MemRegion classes. (authored by dergachev).

Changed prior to commit:
  https://reviews.llvm.org/D26837?vs=79538=95092#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D26837

Files:
  cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h
  cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h
  cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h
  cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SymExpr.h
  cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h
  cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp

Index: cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp
===
--- cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp
@@ -379,10 +379,8 @@
 //===--===//
 
 void GlobalsSpaceRegion::anchor() { }
-void HeapSpaceRegion::anchor() { }
-void UnknownSpaceRegion::anchor() { }
-void StackLocalsSpaceRegion::anchor() { }
-void StackArgumentsSpaceRegion::anchor() { }
+void NonStaticGlobalSpaceRegion::anchor() { }
+void StackSpaceRegion::anchor() { }
 void TypedRegion::anchor() { }
 void TypedValueRegion::anchor() { }
 void CodeTextRegion::anchor() { }
Index: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SymExpr.h
===
--- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SymExpr.h
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SymExpr.h
@@ -42,6 +42,12 @@
 protected:
   SymExpr(Kind k) : K(k) {}
 
+  static bool isValidTypeForSymbol(QualType T) {
+// FIXME: Depending on whether we choose to deprecate structural symbols,
+// this may become much stricter.
+return !T.isNull() && !T->isVoidType();
+  }
+
 public:
   virtual ~SymExpr() {}
 
@@ -103,7 +109,9 @@
   const SymbolID Sym;
 
 protected:
-  SymbolData(Kind k, SymbolID sym) : SymExpr(k), Sym(sym) {}
+  SymbolData(Kind k, SymbolID sym) : SymExpr(k), Sym(sym) {
+assert(classof(this));
+  }
 
 public:
   ~SymbolData() override {}
Index: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h
===
--- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h
@@ -20,6 +20,7 @@
 #include "clang/StaticAnalyzer/Core/PathSensitive/APSIntType.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/SVals.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/StoreRef.h"
+#include "clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h"
 
 namespace clang {
 namespace ento {
@@ -29,8 +30,9 @@
   llvm::ImmutableList L;
 
 public:
-  CompoundValData(QualType t, llvm::ImmutableList l)
-: T(t), L(l) {}
+  CompoundValData(QualType t, llvm::ImmutableList l) : T(t), L(l) {
+assert(NonLoc::isCompoundType(t));
+  }
 
   typedef llvm::ImmutableList::iterator iterator;
   iterator begin() const { return L.begin(); }
@@ -47,7 +49,9 @@
   const TypedValueRegion *region;
 public:
   LazyCompoundValData(const StoreRef , const TypedValueRegion *r)
-: store(st), region(r) {}
+  : store(st), region(r) {
+assert(NonLoc::isCompoundType(r->getValueType()));
+  }
 
   const void *getStore() const { return store.getStore(); }
   const TypedValueRegion *getRegion() const { return region; }
Index: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h
===
--- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h
@@ -44,7 +44,10 @@
 
 public:
   SymbolRegionValue(SymbolID sym, const TypedValueRegion *r)
-: SymbolData(SymbolRegionValueKind, sym), R(r) {}
+  : SymbolData(SymbolRegionValueKind, sym), R(r) {
+assert(r);
+assert(isValidTypeForSymbol(r->getValueType()));
+  }
 
   const TypedValueRegion* getRegion() const { return R; }
 
@@ -81,7 +84,15 @@
   SymbolConjured(SymbolID sym, const Stmt *s, const LocationContext *lctx,
  QualType t, unsigned count, const void *symbolTag)
   : SymbolData(SymbolConjuredKind, sym), S(s), T(t), Count(count),
-LCtx(lctx), SymbolTag(symbolTag) {}
+LCtx(lctx), SymbolTag(symbolTag) {
+// FIXME: 's' might be a nullptr if we're conducting invalidation
+// that was caused by a destructor call on a temporary object,
+// which has no statement associated with it.
+// Due to this, we might be creating the same invalidation symbol for
+// two different invalidation passes (for two different 

[PATCH] D31982: [analyzer] Improve suppression for inlined defensive checks when operator& is involved.

2017-04-13 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun added inline comments.



Comment at: lib/StaticAnalyzer/Core/BugReporterVisitors.cpp:975
+  if (Op->getOpcode() == UO_AddrOf)
+if (Op->getSubExpr()->isLValue()) {
+  Ex = Op->getSubExpr()->IgnoreParenCasts();

Maybe you could move this condition one level up with &&?



Comment at: lib/StaticAnalyzer/Core/BugReporterVisitors.cpp:977
+  Ex = Op->getSubExpr()->IgnoreParenCasts();
+  while (true) {
+if (const auto *ME = dyn_cast(Ex)) {

Can't you writhe this like:

```
while (const auto *ME = dyn_cast(Ex)) {
  Ex = ME->getBase()->IgnoreParenCasts();
  }
```

?




https://reviews.llvm.org/D31982



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


Re: r300122 - [clang-cl] Make all sanitizer flags available in clang-cl

2017-04-13 Thread Akira Hatanaka via cfe-commits
I’m afraid I have to revert this to turn the bots green again.

> On Apr 12, 2017, at 10:41 PM, Akira Hatanaka via cfe-commits 
>  wrote:
> 
> I think this broke some of the bots.
> 
> http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA_check/30152/ 
> 
> 
> Could you take a look?
>  
>> On Apr 12, 2017, at 3:50 PM, Reid Kleckner via cfe-commits 
>> > wrote:
>> 
>> Author: rnk
>> Date: Wed Apr 12 17:50:51 2017
>> New Revision: 300122
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=300122=rev 
>> 
>> Log:
>> [clang-cl] Make all sanitizer flags available in clang-cl
>> 
>> Summary:
>> Use a tablegen let {} block so that new sanitizer flags are available by
>> default in all driver modes. This should cut down on time wasted with
>> bugs like http://crbug.com/710928 .
>> 
>> Reviewers: vitalybuka, hans
>> 
>> Subscribers: kcc, llvm-commits
>> 
>> Differential Revision: https://reviews.llvm.org/D31988 
>> 
>> 
>> Modified:
>>cfe/trunk/include/clang/Driver/Options.td
>>cfe/trunk/test/Driver/fsanitize.c
>> 
>> Modified: cfe/trunk/include/clang/Driver/Options.td
>> URL: 
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=300122=300121=300122=diff
>>  
>> 
>> ==
>> --- cfe/trunk/include/clang/Driver/Options.td (original)
>> +++ cfe/trunk/include/clang/Driver/Options.td Wed Apr 12 17:50:51 2017
>> @@ -778,65 +778,71 @@ def fno_signaling_math : Flag<["-"], "fn
>> def fjump_tables : Flag<["-"], "fjump-tables">, Group;
>> def fno_jump_tables : Flag<["-"], "fno-jump-tables">, Group, 
>> Flags<[CC1Option]>,
>>   HelpText<"Do not use jump tables for lowering switches">;
>> +
>> +// Begin sanitizer flags. These should all be core options exposed in all 
>> driver
>> +// modes.
>> +let Flags = [CC1Option, CoreOption] in {
>> +
>> def fsanitize_EQ : CommaJoined<["-"], "fsanitize=">, Group,
>> -   Flags<[CC1Option, CoreOption]>, MetaVarName<"">,
>> +   MetaVarName<"">,
>>HelpText<"Turn on runtime checks for various forms of 
>> undefined "
>> "or suspicious behavior. See user manual for 
>> available checks">;
>> def fno_sanitize_EQ : CommaJoined<["-"], "fno-sanitize=">, 
>> Group,
>> -  Flags<[CoreOption]>;
>> +  Flags<[CoreOption, DriverOption]>;
>> def fsanitize_blacklist : Joined<["-"], "fsanitize-blacklist=">,
>> -  Group, Flags<[CC1Option, 
>> CoreOption]>,
>> +  Group,
>>   HelpText<"Path to blacklist file for sanitizers">;
>> def fno_sanitize_blacklist : Flag<["-"], "fno-sanitize-blacklist">,
>>  Group,
>>  HelpText<"Don't use blacklist file for 
>> sanitizers">;
>> def fsanitize_coverage
>> : CommaJoined<["-"], "fsanitize-coverage=">,
>> -  Group, Flags<[CoreOption]>,
>> +  Group,
>>   HelpText<"Specify the type of coverage instrumentation for 
>> Sanitizers">;
>> def fno_sanitize_coverage
>> : CommaJoined<["-"], "fno-sanitize-coverage=">,
>> -  Group, Flags<[CoreOption]>,
>> +  Group, Flags<[CoreOption, DriverOption]>,
>>   HelpText<"Disable specified features of coverage instrumentation for "
>>"Sanitizers">;
>> def fsanitize_memory_track_origins_EQ : Joined<["-"], 
>> "fsanitize-memory-track-origins=">,
>> -Group, 
>> Flags<[CC1Option]>,
>> +Group,
>> HelpText<"Enable origins tracking in 
>> MemorySanitizer">;
>> def fsanitize_memory_track_origins : Flag<["-"], 
>> "fsanitize-memory-track-origins">,
>> - Group, 
>> Flags<[CC1Option]>,
>> + Group,
>>  HelpText<"Enable origins tracking in 
>> MemorySanitizer">;
>> def fno_sanitize_memory_track_origins : Flag<["-"], 
>> "fno-sanitize-memory-track-origins">,
>> -Group, 
>> Flags<[CC1Option]>,
>> +Group,
>> +Flags<[CoreOption, DriverOption]>,
>> HelpText<"Disable origins tracking 
>> in MemorySanitizer">;
>> def fsanitize_memory_use_after_dtor : Flag<["-"], 
>> "fsanitize-memory-use-after-dtor">,
>> - Group, 
>> Flags<[CC1Option]>,
>> + 

[PATCH] D31885: Remove TBAA information from LValues representing union members

2017-04-13 Thread Krzysztof Parzyszek via Phabricator via cfe-commits
kparzysz updated this revision to Diff 95217.
kparzysz edited the summary of this revision.
kparzysz added a reviewer: hfinkel.
kparzysz added a comment.

Fixed the testcases (forgot to use FileCheck).


Repository:
  rL LLVM

https://reviews.llvm.org/D31885

Files:
  lib/CodeGen/CGExpr.cpp
  lib/CodeGen/CodeGenFunction.h
  test/CodeGen/union-tbaa1.c
  test/CodeGenCXX/union-tbaa2.cpp

Index: test/CodeGenCXX/union-tbaa2.cpp
===
--- /dev/null
+++ test/CodeGenCXX/union-tbaa2.cpp
@@ -0,0 +1,41 @@
+// RUN: %clang_cc1 %s -triple x86_64-unknown-linux-gnu -target-cpu x86-64 -target-feature +sse4.2 -target-feature +avx -emit-llvm -o - | FileCheck %s
+
+// Testcase from llvm.org/PR32056
+
+extern "C" int printf (const char *__restrict __format, ...);
+
+typedef double __m256d __attribute__((__vector_size__(32)));
+
+static __inline __m256d __attribute__((__always_inline__, __nodebug__,
+   __target__("avx")))
+_mm256_setr_pd(double __a, double __b, double __c, double __d) {
+  return (__m256d){ __a, __b, __c, __d };
+}
+
+struct A {
+  A () {
+// Check that there is no TBAA information generated for the stores to the
+// union members:
+// CHECK: store <4 x double>
+// CHECK-NOT: tbaa
+// CHECK: store <4 x double>
+// CHECK-NOT: tbaa
+a = _mm256_setr_pd(0.0, 1.0, 2.0, 3.0);
+b = _mm256_setr_pd(4.0, 5.0, 6.0, 7.0);
+  }
+
+  const double *begin() { return c; }
+  const double *end() { return c+8; }
+
+  union {
+struct { __m256d a, b; };
+double c[8];
+  };
+};
+
+int main(int argc, char *argv[]) {
+  A a;
+  for (double value : a)
+printf("%f ", value);
+  return 0;
+}
Index: test/CodeGen/union-tbaa1.c
===
--- /dev/null
+++ test/CodeGen/union-tbaa1.c
@@ -0,0 +1,42 @@
+// RUN: %clang_cc1 %s -triple hexagon-unknown-elf -O2 -emit-llvm -o - | FileCheck %s
+
+typedef union __attribute__((aligned(4))) {
+  unsigned short uh[2];
+  unsigned uw;
+} vect32;
+
+void bar(vect32 p[][2]);
+
+// CHECK-LABEL: define void @fred
+void fred(unsigned Num, int Vec[2], int *Index, int Arr[4][2]) {
+  vect32 Tmp[4][2];
+// Generate tbaa for the load of Index:
+// CHECK: load i32, i32* %Index{{.*}}tbaa
+// But no tbaa for the two stores:
+// CHECK: %uw[[UW1:[0-9]*]] = getelementptr
+// CHECK: store{{.*}}%uw[[UW1]]
+// CHECK-NOT: tbaa
+// There will be a load after the store, and it will use tbaa. Make sure
+// the check-not above doesn't find it:
+// CHECK: load
+  Tmp[*Index][0].uw = Arr[*Index][0] * Num;
+// CHECK: %uw[[UW2:[0-9]*]] = getelementptr
+// CHECK: store{{.*}}%uw[[UW2]]
+// CHECK-NOT: tbaa
+  Tmp[*Index][1].uw = Arr[*Index][1] * Num;
+// Same here, don't generate tbaa for the loads:
+// CHECK: %uh[[UH1:[0-9]*]] = bitcast %union.vect32
+// CHECK: %arrayidx[[AX1:[0-9]*]] = getelementptr{{.*}}%uh[[UH1]]
+// CHECK: load i16, i16* %arrayidx[[AX1]]
+// CHECK-NOT: tbaa
+// CHECK: store
+  Vec[0] = Tmp[*Index][0].uh[1];
+// CHECK: %uh[[UH2:[0-9]*]] = bitcast %union.vect32
+// CHECK: %arrayidx[[AX2:[0-9]*]] = getelementptr{{.*}}%uh[[UH2]]
+// CHECK: load i16, i16* %arrayidx[[AX2]]
+// CHECK-NOT: tbaa
+// CHECK: store
+  Vec[1] = Tmp[*Index][1].uh[1];
+  bar(Tmp);
+}
+
Index: lib/CodeGen/CodeGenFunction.h
===
--- lib/CodeGen/CodeGenFunction.h
+++ lib/CodeGen/CodeGenFunction.h
@@ -2886,6 +2886,17 @@
   /// that the address will be used to access the object.
   LValue EmitCheckedLValue(const Expr *E, TypeCheckKind TCK);
 
+private:
+  /// The actual implementations of LValue emission. As a workaround for
+  /// a problem in representing union member accesses in TBAA, the public
+  /// functions will remove the TBAA information from any LValue generated
+  /// for such an access.
+  /// When the TBAA issue is fixed, the public wrappers (declared above)
+  /// should be replaced with these functions.
+  LValue EmitLValueImpl(const Expr *E);
+  LValue EmitCheckedLValueImpl(const Expr *E, TypeCheckKind TCK);
+
+public:
   RValue convertTempToRValue(Address addr, QualType type,
  SourceLocation Loc);
 
Index: lib/CodeGen/CGExpr.cpp
===
--- lib/CodeGen/CGExpr.cpp
+++ lib/CodeGen/CGExpr.cpp
@@ -980,7 +980,37 @@
   return true;
 }
 
+/// Hacks to remove TBAA information from LValues that represent union members.
+/// The TBAA in the current form does not work for union members: the aliasing
+/// information emitted in such cases may be incorrect (leading to incorrect
+/// optimizations).
+static bool isUnionAccess(const Expr *E) {
+  switch (E->getStmtClass()) {
+case Stmt::MemberExprClass: {
+  const Expr *BE = cast(E)->getBase();
+  if (BE->getType()->isUnionType())
+return true;
+  return isUnionAccess(BE);
+}
+case Stmt::ImplicitCastExprClass:
+  return 

[PATCH] D32014: Remove unused varible

2017-04-13 Thread Wei-Ren Chen via Phabricator via cfe-commits
chenwj added a comment.

I don't have commit access, need someone's help.  :-)


https://reviews.llvm.org/D32014



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


[libcxx] r300261 - [libcxx] Direct support for Fuchsia

2017-04-13 Thread Petr Hosek via cfe-commits
Author: phosek
Date: Thu Apr 13 16:29:21 2017
New Revision: 300261

URL: http://llvm.org/viewvc/llvm-project?rev=300261=rev
Log:
[libcxx] Direct support for Fuchsia

Fuchsia's libc was forked from musl, but has evolved sufficiently
since then so it no longer makes sense to pretend it's musl. This
change implements direct support for Fuchsia rather than
piggybacking on musl support.

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

Added:
libcxx/trunk/include/support/fuchsia/
libcxx/trunk/include/support/fuchsia/xlocale.h
Modified:
libcxx/trunk/include/__config
libcxx/trunk/include/__locale

Modified: libcxx/trunk/include/__config
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=300261=300260=300261=diff
==
--- libcxx/trunk/include/__config (original)
+++ libcxx/trunk/include/__config Thu Apr 13 16:29:21 2017
@@ -1027,7 +1027,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanit
 #endif
 
 #if defined(__BIONIC__) || defined(__CloudABI__) ||
\
-defined(_LIBCPP_HAS_MUSL_LIBC)
+defined(__Fuchsia__) || defined(_LIBCPP_HAS_MUSL_LIBC)
 #define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE
 #endif
 

Modified: libcxx/trunk/include/__locale
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__locale?rev=300261=300260=300261=diff
==
--- libcxx/trunk/include/__locale (original)
+++ libcxx/trunk/include/__locale Thu Apr 13 16:29:21 2017
@@ -37,9 +37,11 @@
 #elif (defined(__GLIBC__) || defined(__APPLE__)  || defined(__FreeBSD__) \
 || defined(__EMSCRIPTEN__) || defined(__IBMCPP__))
 # include 
+#elif defined(__Fuchsia__)
+# include 
 #elif defined(_LIBCPP_HAS_MUSL_LIBC)
 # include 
-#endif // __GLIBC__ || __APPLE__ || __FreeBSD__ || __sun__ || __EMSCRIPTEN__ 
|| __IBMCPP__
+#endif
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header

Added: libcxx/trunk/include/support/fuchsia/xlocale.h
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/support/fuchsia/xlocale.h?rev=300261=auto
==
--- libcxx/trunk/include/support/fuchsia/xlocale.h (added)
+++ libcxx/trunk/include/support/fuchsia/xlocale.h Thu Apr 13 16:29:21 2017
@@ -0,0 +1,23 @@
+// -*- C++ -*-
+//===--- support/fuchsia/xlocale.h 
===//
+//
+// 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.
+//
+//===--===//
+
+#ifndef _LIBCPP_SUPPORT_FUCHSIA_XLOCALE_H
+#define _LIBCPP_SUPPORT_FUCHSIA_XLOCALE_H
+
+#if defined(__Fuchsia__)
+
+#include 
+#include 
+#include 
+#include 
+
+#endif // defined(__Fuchsia__)
+
+#endif // _LIBCPP_SUPPORT_FUCHSIA_XLOCALE_H


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


r300266 - Add test for anonymous struct containing an implicitly private data member.

2017-04-13 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Thu Apr 13 16:51:04 2017
New Revision: 300266

URL: http://llvm.org/viewvc/llvm-project?rev=300266=rev
Log:
Add test for anonymous struct containing an implicitly private data member.

Patch by Jacob Young!

Modified:
cfe/trunk/test/SemaCXX/anonymous-struct.cpp

Modified: cfe/trunk/test/SemaCXX/anonymous-struct.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/anonymous-struct.cpp?rev=300266=300265=300266=diff
==
--- cfe/trunk/test/SemaCXX/anonymous-struct.cpp (original)
+++ cfe/trunk/test/SemaCXX/anonymous-struct.cpp Thu Apr 13 16:51:04 2017
@@ -21,6 +21,9 @@ struct E {
   };
   static struct {
   };
+  class {
+int anon_priv_field; // expected-error {{anonymous struct cannot contain a 
private data member}}
+  };
 };
 
 template  void foo(T);


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


[PATCH] D32064: [asan] Disable ASan global-GC depending on the target and CGOpts

2017-04-13 Thread Peter Collingbourne via Phabricator via cfe-commits
pcc added a comment.

I think it would be better to move this logic to the driver and have it pass in 
an `-mllvm` flag. The sanitizer passes should really be taking no arguments in 
the constructor like the other passes, so I don't want us to add another 
argument here.


Repository:
  rL LLVM

https://reviews.llvm.org/D32064



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


r300262 - PR32185: Revert r291512 and add a testcase for PR32185.

2017-04-13 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Thu Apr 13 16:37:24 2017
New Revision: 300262

URL: http://llvm.org/viewvc/llvm-project?rev=300262=rev
Log:
PR32185: Revert r291512 and add a testcase for PR32185.

This reverts an attempt to check that types match when matching a
dependently-typed non-type template parameter. (This comes up when matching the
parameters of a template template parameter against the parameters of a
template template argument.)

The matching rules here are murky at best. Our behavior after this revert is
definitely wrong for certain C++17 features (for 'auto' template parameter
types within the parameter list of a template template argument in particular),
but our behavior before this revert is wrong for some pre-existing testcases,
so reverting to our prior behavior seems like our best option.

Modified:
cfe/trunk/lib/Sema/SemaTemplate.cpp
cfe/trunk/test/Modules/cxx-templates.cpp
cfe/trunk/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp
cfe/trunk/test/SemaTemplate/deduction.cpp
cfe/trunk/test/SemaTemplate/temp_arg_template.cpp
cfe/trunk/test/SemaTemplate/temp_arg_template_cxx1z.cpp

Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=300262=300261=300262=diff
==
--- cfe/trunk/lib/Sema/SemaTemplate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplate.cpp Thu Apr 13 16:37:24 2017
@@ -2109,7 +2109,6 @@ struct DependencyChecker : RecursiveASTV
   typedef RecursiveASTVisitor super;
 
   unsigned Depth;
-  bool FindLessThanDepth;
 
   // Whether we're looking for a use of a template parameter that makes the
   // overall construct type-dependent / a dependent type. This is strictly
@@ -2120,16 +2119,25 @@ struct DependencyChecker : RecursiveASTV
   bool Match;
   SourceLocation MatchLoc;
 
-  DependencyChecker(unsigned Depth, bool IgnoreNonTypeDependent,
-bool FindLessThanDepth = false)
-  : Depth(Depth), FindLessThanDepth(FindLessThanDepth),
-IgnoreNonTypeDependent(IgnoreNonTypeDependent), Match(false) {}
+  DependencyChecker(unsigned Depth, bool IgnoreNonTypeDependent)
+  : Depth(Depth), IgnoreNonTypeDependent(IgnoreNonTypeDependent),
+Match(false) {}
 
   DependencyChecker(TemplateParameterList *Params, bool IgnoreNonTypeDependent)
-  : DependencyChecker(Params->getDepth(), IgnoreNonTypeDependent) {}
+  : IgnoreNonTypeDependent(IgnoreNonTypeDependent), Match(false) {
+NamedDecl *ND = Params->getParam(0);
+if (TemplateTypeParmDecl *PD = dyn_cast(ND)) {
+  Depth = PD->getDepth();
+} else if (NonTypeTemplateParmDecl *PD =
+ dyn_cast(ND)) {
+  Depth = PD->getDepth();
+} else {
+  Depth = cast(ND)->getDepth();
+}
+  }
 
   bool Matches(unsigned ParmDepth, SourceLocation Loc = SourceLocation()) {
-if (FindLessThanDepth ^ (ParmDepth >= Depth)) {
+if (ParmDepth >= Depth) {
   Match = true;
   MatchLoc = Loc;
   return true;
@@ -6432,15 +6440,6 @@ Sema::BuildExpressionFromIntegralTemplat
   return E;
 }
 
-static bool isDependentOnOuter(NonTypeTemplateParmDecl *NTTP) {
-  if (NTTP->getDepth() == 0 || !NTTP->getType()->isDependentType())
-return false;
-  DependencyChecker Checker(NTTP->getDepth(), /*IgnoreNonTypeDependent*/ false,
-/*FindLessThanDepth*/ true);
-  Checker.TraverseType(NTTP->getType());
-  return Checker.Match;
-}
-
 /// \brief Match two template parameters within template parameter lists.
 static bool MatchTemplateParameterKind(Sema , NamedDecl *New, NamedDecl *Old,
bool Complain,
@@ -6497,10 +6496,11 @@ static bool MatchTemplateParameterKind(S
 
 // If we are matching a template template argument to a template
 // template parameter and one of the non-type template parameter types
-// is dependent on an outer template's parameter, then we must wait until
-// template instantiation time to actually compare the arguments.
+// is dependent, then we must wait until template instantiation time
+// to actually compare the arguments.
 if (Kind == Sema::TPL_TemplateTemplateArgumentMatch &&
-(isDependentOnOuter(OldNTTP) || isDependentOnOuter(NewNTTP)))
+(OldNTTP->getType()->isDependentType() ||
+ NewNTTP->getType()->isDependentType()))
   return true;
 
 if (!S.Context.hasSameType(OldNTTP->getType(), NewNTTP->getType())) {

Modified: cfe/trunk/test/Modules/cxx-templates.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/cxx-templates.cpp?rev=300262=300261=300262=diff
==
--- cfe/trunk/test/Modules/cxx-templates.cpp (original)
+++ cfe/trunk/test/Modules/cxx-templates.cpp Thu Apr 13 16:37:24 2017
@@ -49,8 +49,14 @@ void g() {
   // expected-note@Inputs/cxx-templates-a.h:11 {{candidate}}
   

[PATCH] D27263: Address of bitfield in anonymous struct doesn't error.

2017-04-13 Thread Richard Smith via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL300264: Diagnose attempt to take address of bitfield members 
in anonymous structs. (authored by rsmith).

Changed prior to commit:
  https://reviews.llvm.org/D27263?vs=79759=95222#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D27263

Files:
  cfe/trunk/lib/Sema/SemaExpr.cpp
  cfe/trunk/test/Sema/expr-address-of.c
  cfe/trunk/test/SemaCXX/ptrtomember.cpp


Index: cfe/trunk/test/SemaCXX/ptrtomember.cpp
===
--- cfe/trunk/test/SemaCXX/ptrtomember.cpp
+++ cfe/trunk/test/SemaCXX/ptrtomember.cpp
@@ -13,9 +13,13 @@
 
 struct S2 {
   int bitfield : 1;
+  struct {
+int anon_bitfield : 1;
+  };
 };
 
 int S2::*pf = ::bitfield; // expected-error {{address of bit-field 
requested}}
+int S2::*anon_pf = ::anon_bitfield; // expected-error {{address of 
bit-field requested}}
 
 struct S3 {
   void m();
Index: cfe/trunk/test/Sema/expr-address-of.c
===
--- cfe/trunk/test/Sema/expr-address-of.c
+++ cfe/trunk/test/Sema/expr-address-of.c
@@ -102,8 +102,9 @@
   register struct {char* x;} t1 = {"Hello"};
   char* dummy1 = &(t1.x[0]);
 
-  struct {int a : 10;} t2;
+  struct {int a : 10; struct{int b : 10;};} t2;
   int* dummy2 = &(t2.a); // expected-error {{address of bit-field requested}}
+  int* dummy3 = &(t2.b); // expected-error {{address of bit-field requested}}
 
   void* t3 = &(*(void*)0);
 }
Index: cfe/trunk/lib/Sema/SemaExpr.cpp
===
--- cfe/trunk/lib/Sema/SemaExpr.cpp
+++ cfe/trunk/lib/Sema/SemaExpr.cpp
@@ -1772,7 +1772,10 @@
   !Diags.isIgnored(diag::warn_arc_repeated_use_of_weak, E->getLocStart()))
   recordUseOfEvaluatedWeak(E);
 
-  if (FieldDecl *FD = dyn_cast(D)) {
+  FieldDecl *FD = dyn_cast(D);
+  if (IndirectFieldDecl *IFD = dyn_cast(D))
+FD = IFD->getAnonField();
+  if (FD) {
 UnusedPrivateFields.remove(FD);
 // Just in case we're building an illegal pointer-to-member.
 if (FD->isBitField())


Index: cfe/trunk/test/SemaCXX/ptrtomember.cpp
===
--- cfe/trunk/test/SemaCXX/ptrtomember.cpp
+++ cfe/trunk/test/SemaCXX/ptrtomember.cpp
@@ -13,9 +13,13 @@
 
 struct S2 {
   int bitfield : 1;
+  struct {
+int anon_bitfield : 1;
+  };
 };
 
 int S2::*pf = ::bitfield; // expected-error {{address of bit-field requested}}
+int S2::*anon_pf = ::anon_bitfield; // expected-error {{address of bit-field requested}}
 
 struct S3 {
   void m();
Index: cfe/trunk/test/Sema/expr-address-of.c
===
--- cfe/trunk/test/Sema/expr-address-of.c
+++ cfe/trunk/test/Sema/expr-address-of.c
@@ -102,8 +102,9 @@
   register struct {char* x;} t1 = {"Hello"};
   char* dummy1 = &(t1.x[0]);
 
-  struct {int a : 10;} t2;
+  struct {int a : 10; struct{int b : 10;};} t2;
   int* dummy2 = &(t2.a); // expected-error {{address of bit-field requested}}
+  int* dummy3 = &(t2.b); // expected-error {{address of bit-field requested}}
 
   void* t3 = &(*(void*)0);
 }
Index: cfe/trunk/lib/Sema/SemaExpr.cpp
===
--- cfe/trunk/lib/Sema/SemaExpr.cpp
+++ cfe/trunk/lib/Sema/SemaExpr.cpp
@@ -1772,7 +1772,10 @@
   !Diags.isIgnored(diag::warn_arc_repeated_use_of_weak, E->getLocStart()))
   recordUseOfEvaluatedWeak(E);
 
-  if (FieldDecl *FD = dyn_cast(D)) {
+  FieldDecl *FD = dyn_cast(D);
+  if (IndirectFieldDecl *IFD = dyn_cast(D))
+FD = IFD->getAnonField();
+  if (FD) {
 UnusedPrivateFields.remove(FD);
 // Just in case we're building an illegal pointer-to-member.
 if (FD->isBitField())
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r300264 - Diagnose attempt to take address of bitfield members in anonymous structs.

2017-04-13 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Thu Apr 13 16:49:46 2017
New Revision: 300264

URL: http://llvm.org/viewvc/llvm-project?rev=300264=rev
Log:
Diagnose attempt to take address of bitfield members in anonymous structs.

Patch by Jacob Young!

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

Modified:
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/test/Sema/expr-address-of.c
cfe/trunk/test/SemaCXX/ptrtomember.cpp

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=300264=300263=300264=diff
==
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Thu Apr 13 16:49:46 2017
@@ -1772,7 +1772,10 @@ Sema::BuildDeclRefExpr(ValueDecl *D, Qua
   !Diags.isIgnored(diag::warn_arc_repeated_use_of_weak, E->getLocStart()))
   recordUseOfEvaluatedWeak(E);
 
-  if (FieldDecl *FD = dyn_cast(D)) {
+  FieldDecl *FD = dyn_cast(D);
+  if (IndirectFieldDecl *IFD = dyn_cast(D))
+FD = IFD->getAnonField();
+  if (FD) {
 UnusedPrivateFields.remove(FD);
 // Just in case we're building an illegal pointer-to-member.
 if (FD->isBitField())

Modified: cfe/trunk/test/Sema/expr-address-of.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/expr-address-of.c?rev=300264=300263=300264=diff
==
--- cfe/trunk/test/Sema/expr-address-of.c (original)
+++ cfe/trunk/test/Sema/expr-address-of.c Thu Apr 13 16:49:46 2017
@@ -102,8 +102,9 @@ char* f7() {
   register struct {char* x;} t1 = {"Hello"};
   char* dummy1 = &(t1.x[0]);
 
-  struct {int a : 10;} t2;
+  struct {int a : 10; struct{int b : 10;};} t2;
   int* dummy2 = &(t2.a); // expected-error {{address of bit-field requested}}
+  int* dummy3 = &(t2.b); // expected-error {{address of bit-field requested}}
 
   void* t3 = &(*(void*)0);
 }

Modified: cfe/trunk/test/SemaCXX/ptrtomember.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/ptrtomember.cpp?rev=300264=300263=300264=diff
==
--- cfe/trunk/test/SemaCXX/ptrtomember.cpp (original)
+++ cfe/trunk/test/SemaCXX/ptrtomember.cpp Thu Apr 13 16:49:46 2017
@@ -13,9 +13,13 @@ int foo(int S::* ps, S *s)
 
 struct S2 {
   int bitfield : 1;
+  struct {
+int anon_bitfield : 1;
+  };
 };
 
 int S2::*pf = ::bitfield; // expected-error {{address of bit-field 
requested}}
+int S2::*anon_pf = ::anon_bitfield; // expected-error {{address of 
bit-field requested}}
 
 struct S3 {
   void m();


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


r300271 - [docs] Regenerate diagnostics reference.

2017-04-13 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Thu Apr 13 17:44:22 2017
New Revision: 300271

URL: http://llvm.org/viewvc/llvm-project?rev=300271=rev
Log:
[docs] Regenerate diagnostics reference.

Modified:
cfe/trunk/docs/DiagnosticsReference.rst

Modified: cfe/trunk/docs/DiagnosticsReference.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/DiagnosticsReference.rst?rev=300271=300270=300271=diff
==
--- cfe/trunk/docs/DiagnosticsReference.rst (original)
+++ cfe/trunk/docs/DiagnosticsReference.rst Thu Apr 13 17:44:22 2017
@@ -797,6 +797,23 @@ This diagnostic is enabled by default.
 
++
 
 
+-Wbitfield-enum-conversion
+--
+**Diagnostic text:**
+
++--+
+|:warning:`warning:` |nbsp| :diagtext:`bit-field` |nbsp| :placeholder:`A` 
|nbsp| :diagtext:`is not wide enough to store all enumerators of` |nbsp| 
:placeholder:`B`|
++--+
+
++--+
+|:warning:`warning:` |nbsp| :diagtext:`signed bit-field` |nbsp| 
:placeholder:`A` |nbsp| :diagtext:`needs an extra bit to represent the largest 
positive enumerators of` |nbsp| :placeholder:`B`|
++--+
+
++-+
+|:warning:`warning:` |nbsp| :diagtext:`assigning value of signed enum type` 
|nbsp| :placeholder:`B` |nbsp| :diagtext:`to unsigned bit-field` |nbsp| 
:placeholder:`A`:diagtext:`; negative enumerators of enum` |nbsp| 
:placeholder:`B` |nbsp| :diagtext:`will be converted to positive values`|
++-+
+
+
 -Wbitfield-width
 
 This diagnostic is enabled by default.
@@ -833,6 +850,8 @@ This diagnostic is enabled by default.
 
 -Wblock-capture-autoreleasing
 -
+This diagnostic is enabled by default.
+
 **Diagnostic text:**
 
 
+-+
@@ -2380,7 +2399,7 @@ This diagnostic is enabled by default.
 
 Some of the diagnostics controlled by this flag are enabled by default.
 
-Also controls `-Wbool-conversion`_, `-Wconstant-conversion`_, 
`-Wenum-conversion`_, `-Wfloat-conversion`_, `-Wint-conversion`_, 
`-Wliteral-conversion`_, `-Wnon-literal-null-conversion`_, 
`-Wnull-conversion`_, `-Wobjc-literal-conversion`_, `-Wshorten-64-to-32`_, 
`-Wsign-conversion`_, `-Wstring-conversion`_.
+Also controls `-Wbitfield-enum-conversion`_, `-Wbool-conversion`_, 
`-Wconstant-conversion`_, `-Wenum-conversion`_, `-Wfloat-conversion`_, 
`-Wint-conversion`_, `-Wliteral-conversion`_, `-Wnon-literal-null-conversion`_, 
`-Wnull-conversion`_, `-Wobjc-literal-conversion`_, `-Wshorten-64-to-32`_, 
`-Wsign-conversion`_, `-Wstring-conversion`_.
 
 **Diagnostic text:**
 
@@ -2414,6 +2433,17 @@ Also controls `-Wbool-conversion`_, `-Wc
 Synonym for `-Wnull-conversion`_.
 
 
+-Wcoroutine
+---
+This diagnostic is enabled by default.
+
+**Diagnostic text:**
+
++-+
+|:warning:`warning:` |nbsp| :placeholder:`A` |nbsp| :diagtext:`is required to 
declare the member 'unhandled\_exception()' when exceptions are enabled`|
++-+
+
+
 -Wcovered-switch-default
 
 **Diagnostic text:**
@@ -4463,6 +4493,8 @@ This diagnostic is enabled by default.
 | 

[PATCH] D32029: [ObjC] Fix lifetime markers of loop variable in EmitObjCForCollectionStmt

2017-04-13 Thread John McCall via Phabricator via cfe-commits
rjmccall accepted this revision.
rjmccall added a comment.
This revision is now accepted and ready to land.

Yes, looks good to me.


Repository:
  rL LLVM

https://reviews.llvm.org/D32029



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


r300287 - [ObjC] Fix lifetime markers of loop variable in EmitObjCForCollectionStmt

2017-04-13 Thread Kuba Mracek via cfe-commits
Author: kuba.brecka
Date: Thu Apr 13 19:32:43 2017
New Revision: 300287

URL: http://llvm.org/viewvc/llvm-project?rev=300287=rev
Log:
[ObjC] Fix lifetime markers of loop variable in EmitObjCForCollectionStmt

CodeGenFunction::EmitObjCForCollectionStmt currently emits lifetime markers for 
the loop variable in an inconsistent way:  lifetime.start is emitted before the 
loop is entered, but lifetime.end is emitted inside the loop.  AddressSanitizer 
uses these markers to track out-of-scope accesses to local variables, and we 
get false positives in Obj-C foreach loops (in the 2nd iteration of the loop). 
The markers of the loop variable need to be either both inside the loop (so 
that we poison and unpoison the variable in each iteration), or both outside. 
This patch implements the "both inside" approach.

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


Modified:
cfe/trunk/lib/CodeGen/CGObjC.cpp
cfe/trunk/test/CodeGenObjC/arc-foreach.m
cfe/trunk/test/CodeGenObjC/arc-ternary-op.m

Modified: cfe/trunk/lib/CodeGen/CGObjC.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjC.cpp?rev=300287=300286=300287=diff
==
--- cfe/trunk/lib/CodeGen/CGObjC.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjC.cpp Thu Apr 13 19:32:43 2017
@@ -1469,11 +1469,6 @@ void CodeGenFunction::EmitObjCForCollect
   if (DI)
 DI->EmitLexicalBlockStart(Builder, S.getSourceRange().getBegin());
 
-  // The local variable comes into scope immediately.
-  AutoVarEmission variable = AutoVarEmission::invalid();
-  if (const DeclStmt *SD = dyn_cast(S.getElement()))
-variable = EmitAutoVarAlloca(*cast(SD->getSingleDecl()));
-
   JumpDest LoopEnd = getJumpDestInCurrentScope("forcoll.end");
 
   // Fast enumeration state.
@@ -1625,8 +1620,10 @@ void CodeGenFunction::EmitObjCForCollect
   bool elementIsVariable;
   LValue elementLValue;
   QualType elementType;
+  AutoVarEmission variable = AutoVarEmission::invalid();
   if (const DeclStmt *SD = dyn_cast(S.getElement())) {
 // Initialize the variable, in case it's a __block variable or something.
+variable = EmitAutoVarAlloca(*cast(SD->getSingleDecl()));
 EmitAutoVarInit(variable);
 
 const VarDecl* D = cast(SD->getSingleDecl());

Modified: cfe/trunk/test/CodeGenObjC/arc-foreach.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/arc-foreach.m?rev=300287=300286=300287=diff
==
--- cfe/trunk/test/CodeGenObjC/arc-foreach.m (original)
+++ cfe/trunk/test/CodeGenObjC/arc-foreach.m Thu Apr 13 19:32:43 2017
@@ -24,9 +24,9 @@ void test0(NSArray *array) {
 
 // CHECK-LP64-LABEL:define void @test0(
 // CHECK-LP64:  [[ARRAY:%.*]] = alloca [[ARRAY_T:%.*]]*,
-// CHECK-LP64-NEXT: [[X:%.*]] = alloca i8*,
 // CHECK-LP64-NEXT: [[STATE:%.*]] = alloca [[STATE_T:%.*]],
 // CHECK-LP64-NEXT: [[BUFFER:%.*]] = alloca [16 x i8*], align 8
+// CHECK-LP64-NEXT: [[X:%.*]] = alloca i8*,
 // CHECK-LP64-NEXT: [[BLOCK:%.*]] = alloca [[BLOCK_T:<{.*}>]],
 
 // Initialize 'array'.
@@ -97,9 +97,9 @@ void test1(NSArray *array) {
 
 // CHECK-LP64-LABEL:define void @test1(
 // CHECK-LP64:  alloca [[ARRAY_T:%.*]]*,
-// CHECK-LP64-NEXT: [[X:%.*]] = alloca i8*,
 // CHECK-LP64-NEXT: [[STATE:%.*]] = alloca [[STATE_T:%.*]],
 // CHECK-LP64-NEXT: alloca [16 x i8*], align 8
+// CHECK-LP64-NEXT: [[X:%.*]] = alloca i8*,
 // CHECK-LP64-NEXT: [[BLOCK:%.*]] = alloca [[BLOCK_T:<{.*}>]],
 
 // CHECK-LP64:  [[T0:%.*]] = getelementptr inbounds [[STATE_T]], 
[[STATE_T]]* [[STATE]], i32 0, i32 1
@@ -160,7 +160,7 @@ void test3(NSArray *array) {
 
   // CHECK-LP64-LABEL:define void @test3(
   // CHECK-LP64:  [[ARRAY:%.*]] = alloca [[ARRAY_T]]*, align 8
-  // CHECK-LP64-NEXT: [[X:%.*]] = alloca i8*, align 8
+  // CHECK-LP64:  [[X:%.*]] = alloca i8*, align 8
   // CHECK-LP64:  [[T0:%.*]] = load i8*, i8** [[X]], align 8
   // CHECK-LP64-NEXT: [[T1:%.*]] = icmp ne i8* [[T0]], null
   // CHECK-LP64-NEXT: br i1 [[T1]],

Modified: cfe/trunk/test/CodeGenObjC/arc-ternary-op.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/arc-ternary-op.m?rev=300287=300286=300287=diff
==
--- cfe/trunk/test/CodeGenObjC/arc-ternary-op.m (original)
+++ cfe/trunk/test/CodeGenObjC/arc-ternary-op.m Thu Apr 13 19:32:43 2017
@@ -120,9 +120,9 @@ void test2(int cond) {
 
   // CHECK-LABEL:define void @test2(
   // CHECK:  [[COND:%.*]] = alloca i32,
-  // CHECK:  alloca i8*
   // CHECK:  [[CLEANUP_SAVE:%.*]] = alloca i8*
   // CHECK:  [[RUN_CLEANUP:%.*]] = alloca i1
+  // CHECK:  alloca i8*
   //   Evaluate condition; cleanup disabled by default.
   // CHECK:  [[T0:%.*]] = load i32, i32* [[COND]],
   // CHECK-NEXT: icmp ne i32 [[T0]], 0


___
cfe-commits mailing list

[PATCH] D32029: [ObjC] Fix lifetime markers of loop variable in EmitObjCForCollectionStmt

2017-04-13 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL300287: [ObjC] Fix lifetime markers of loop variable in 
EmitObjCForCollectionStmt (authored by kuba.brecka).

Changed prior to commit:
  https://reviews.llvm.org/D32029?vs=95157=95251#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D32029

Files:
  cfe/trunk/lib/CodeGen/CGObjC.cpp
  cfe/trunk/test/CodeGenObjC/arc-foreach.m
  cfe/trunk/test/CodeGenObjC/arc-ternary-op.m


Index: cfe/trunk/lib/CodeGen/CGObjC.cpp
===
--- cfe/trunk/lib/CodeGen/CGObjC.cpp
+++ cfe/trunk/lib/CodeGen/CGObjC.cpp
@@ -1469,11 +1469,6 @@
   if (DI)
 DI->EmitLexicalBlockStart(Builder, S.getSourceRange().getBegin());
 
-  // The local variable comes into scope immediately.
-  AutoVarEmission variable = AutoVarEmission::invalid();
-  if (const DeclStmt *SD = dyn_cast(S.getElement()))
-variable = EmitAutoVarAlloca(*cast(SD->getSingleDecl()));
-
   JumpDest LoopEnd = getJumpDestInCurrentScope("forcoll.end");
 
   // Fast enumeration state.
@@ -1625,8 +1620,10 @@
   bool elementIsVariable;
   LValue elementLValue;
   QualType elementType;
+  AutoVarEmission variable = AutoVarEmission::invalid();
   if (const DeclStmt *SD = dyn_cast(S.getElement())) {
 // Initialize the variable, in case it's a __block variable or something.
+variable = EmitAutoVarAlloca(*cast(SD->getSingleDecl()));
 EmitAutoVarInit(variable);
 
 const VarDecl* D = cast(SD->getSingleDecl());
Index: cfe/trunk/test/CodeGenObjC/arc-foreach.m
===
--- cfe/trunk/test/CodeGenObjC/arc-foreach.m
+++ cfe/trunk/test/CodeGenObjC/arc-foreach.m
@@ -24,9 +24,9 @@
 
 // CHECK-LP64-LABEL:define void @test0(
 // CHECK-LP64:  [[ARRAY:%.*]] = alloca [[ARRAY_T:%.*]]*,
-// CHECK-LP64-NEXT: [[X:%.*]] = alloca i8*,
 // CHECK-LP64-NEXT: [[STATE:%.*]] = alloca [[STATE_T:%.*]],
 // CHECK-LP64-NEXT: [[BUFFER:%.*]] = alloca [16 x i8*], align 8
+// CHECK-LP64-NEXT: [[X:%.*]] = alloca i8*,
 // CHECK-LP64-NEXT: [[BLOCK:%.*]] = alloca [[BLOCK_T:<{.*}>]],
 
 // Initialize 'array'.
@@ -97,9 +97,9 @@
 
 // CHECK-LP64-LABEL:define void @test1(
 // CHECK-LP64:  alloca [[ARRAY_T:%.*]]*,
-// CHECK-LP64-NEXT: [[X:%.*]] = alloca i8*,
 // CHECK-LP64-NEXT: [[STATE:%.*]] = alloca [[STATE_T:%.*]],
 // CHECK-LP64-NEXT: alloca [16 x i8*], align 8
+// CHECK-LP64-NEXT: [[X:%.*]] = alloca i8*,
 // CHECK-LP64-NEXT: [[BLOCK:%.*]] = alloca [[BLOCK_T:<{.*}>]],
 
 // CHECK-LP64:  [[T0:%.*]] = getelementptr inbounds [[STATE_T]], 
[[STATE_T]]* [[STATE]], i32 0, i32 1
@@ -160,7 +160,7 @@
 
   // CHECK-LP64-LABEL:define void @test3(
   // CHECK-LP64:  [[ARRAY:%.*]] = alloca [[ARRAY_T]]*, align 8
-  // CHECK-LP64-NEXT: [[X:%.*]] = alloca i8*, align 8
+  // CHECK-LP64:  [[X:%.*]] = alloca i8*, align 8
   // CHECK-LP64:  [[T0:%.*]] = load i8*, i8** [[X]], align 8
   // CHECK-LP64-NEXT: [[T1:%.*]] = icmp ne i8* [[T0]], null
   // CHECK-LP64-NEXT: br i1 [[T1]],
Index: cfe/trunk/test/CodeGenObjC/arc-ternary-op.m
===
--- cfe/trunk/test/CodeGenObjC/arc-ternary-op.m
+++ cfe/trunk/test/CodeGenObjC/arc-ternary-op.m
@@ -120,9 +120,9 @@
 
   // CHECK-LABEL:define void @test2(
   // CHECK:  [[COND:%.*]] = alloca i32,
-  // CHECK:  alloca i8*
   // CHECK:  [[CLEANUP_SAVE:%.*]] = alloca i8*
   // CHECK:  [[RUN_CLEANUP:%.*]] = alloca i1
+  // CHECK:  alloca i8*
   //   Evaluate condition; cleanup disabled by default.
   // CHECK:  [[T0:%.*]] = load i32, i32* [[COND]],
   // CHECK-NEXT: icmp ne i32 [[T0]], 0


Index: cfe/trunk/lib/CodeGen/CGObjC.cpp
===
--- cfe/trunk/lib/CodeGen/CGObjC.cpp
+++ cfe/trunk/lib/CodeGen/CGObjC.cpp
@@ -1469,11 +1469,6 @@
   if (DI)
 DI->EmitLexicalBlockStart(Builder, S.getSourceRange().getBegin());
 
-  // The local variable comes into scope immediately.
-  AutoVarEmission variable = AutoVarEmission::invalid();
-  if (const DeclStmt *SD = dyn_cast(S.getElement()))
-variable = EmitAutoVarAlloca(*cast(SD->getSingleDecl()));
-
   JumpDest LoopEnd = getJumpDestInCurrentScope("forcoll.end");
 
   // Fast enumeration state.
@@ -1625,8 +1620,10 @@
   bool elementIsVariable;
   LValue elementLValue;
   QualType elementType;
+  AutoVarEmission variable = AutoVarEmission::invalid();
   if (const DeclStmt *SD = dyn_cast(S.getElement())) {
 // Initialize the variable, in case it's a __block variable or something.
+variable = EmitAutoVarAlloca(*cast(SD->getSingleDecl()));
 EmitAutoVarInit(variable);
 
 const VarDecl* D = cast(SD->getSingleDecl());
Index: cfe/trunk/test/CodeGenObjC/arc-foreach.m
===
--- cfe/trunk/test/CodeGenObjC/arc-foreach.m
+++ cfe/trunk/test/CodeGenObjC/arc-foreach.m
@@ -24,9 +24,9 @@
 
 // 

r300272 - [IR] Make getParamAttributes take argument numbers, not ArgNo+1

2017-04-13 Thread Reid Kleckner via cfe-commits
Author: rnk
Date: Thu Apr 13 18:12:13 2017
New Revision: 300272

URL: http://llvm.org/viewvc/llvm-project?rev=300272=rev
Log:
[IR] Make getParamAttributes take argument numbers, not ArgNo+1

Add hasParamAttribute() and use it instead of hasAttribute(ArgNo+1,
Kind) everywhere.

The fact that the AttributeList index for an argument is ArgNo+1 should
be a hidden implementation detail.

NFC

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

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=300272=300271=300272=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Thu Apr 13 18:12:13 2017
@@ -2953,7 +2953,7 @@ static void replaceUsesOfNonProtoConstan
   }
 
   // Add any parameter attributes.
-  newArgAttrs.push_back(oldAttrs.getParamAttributes(argNo + 1));
+  newArgAttrs.push_back(oldAttrs.getParamAttributes(argNo));
   argNo++;
 }
 if (dontTransform)


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


[PATCH] D31591: Fix a bug which access nullptr and cause segmentation fault

2017-04-13 Thread Yuka Takahashi via Phabricator via cfe-commits
yamaguchi added a comment.

I don't have a commit access. Can you commit?


https://reviews.llvm.org/D31591



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


r300290 - Revert r300287.

2017-04-13 Thread Kuba Mracek via cfe-commits
Author: kuba.brecka
Date: Thu Apr 13 20:00:03 2017
New Revision: 300290

URL: http://llvm.org/viewvc/llvm-project?rev=300290=rev
Log:
Revert r300287.


Modified:
cfe/trunk/lib/CodeGen/CGObjC.cpp
cfe/trunk/test/CodeGenObjC/arc-foreach.m
cfe/trunk/test/CodeGenObjC/arc-ternary-op.m

Modified: cfe/trunk/lib/CodeGen/CGObjC.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjC.cpp?rev=300290=300289=300290=diff
==
--- cfe/trunk/lib/CodeGen/CGObjC.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjC.cpp Thu Apr 13 20:00:03 2017
@@ -1469,6 +1469,11 @@ void CodeGenFunction::EmitObjCForCollect
   if (DI)
 DI->EmitLexicalBlockStart(Builder, S.getSourceRange().getBegin());
 
+  // The local variable comes into scope immediately.
+  AutoVarEmission variable = AutoVarEmission::invalid();
+  if (const DeclStmt *SD = dyn_cast(S.getElement()))
+variable = EmitAutoVarAlloca(*cast(SD->getSingleDecl()));
+
   JumpDest LoopEnd = getJumpDestInCurrentScope("forcoll.end");
 
   // Fast enumeration state.
@@ -1620,10 +1625,8 @@ void CodeGenFunction::EmitObjCForCollect
   bool elementIsVariable;
   LValue elementLValue;
   QualType elementType;
-  AutoVarEmission variable = AutoVarEmission::invalid();
   if (const DeclStmt *SD = dyn_cast(S.getElement())) {
 // Initialize the variable, in case it's a __block variable or something.
-variable = EmitAutoVarAlloca(*cast(SD->getSingleDecl()));
 EmitAutoVarInit(variable);
 
 const VarDecl* D = cast(SD->getSingleDecl());

Modified: cfe/trunk/test/CodeGenObjC/arc-foreach.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/arc-foreach.m?rev=300290=300289=300290=diff
==
--- cfe/trunk/test/CodeGenObjC/arc-foreach.m (original)
+++ cfe/trunk/test/CodeGenObjC/arc-foreach.m Thu Apr 13 20:00:03 2017
@@ -24,9 +24,9 @@ void test0(NSArray *array) {
 
 // CHECK-LP64-LABEL:define void @test0(
 // CHECK-LP64:  [[ARRAY:%.*]] = alloca [[ARRAY_T:%.*]]*,
+// CHECK-LP64-NEXT: [[X:%.*]] = alloca i8*,
 // CHECK-LP64-NEXT: [[STATE:%.*]] = alloca [[STATE_T:%.*]],
 // CHECK-LP64-NEXT: [[BUFFER:%.*]] = alloca [16 x i8*], align 8
-// CHECK-LP64-NEXT: [[X:%.*]] = alloca i8*,
 // CHECK-LP64-NEXT: [[BLOCK:%.*]] = alloca [[BLOCK_T:<{.*}>]],
 
 // Initialize 'array'.
@@ -97,9 +97,9 @@ void test1(NSArray *array) {
 
 // CHECK-LP64-LABEL:define void @test1(
 // CHECK-LP64:  alloca [[ARRAY_T:%.*]]*,
+// CHECK-LP64-NEXT: [[X:%.*]] = alloca i8*,
 // CHECK-LP64-NEXT: [[STATE:%.*]] = alloca [[STATE_T:%.*]],
 // CHECK-LP64-NEXT: alloca [16 x i8*], align 8
-// CHECK-LP64-NEXT: [[X:%.*]] = alloca i8*,
 // CHECK-LP64-NEXT: [[BLOCK:%.*]] = alloca [[BLOCK_T:<{.*}>]],
 
 // CHECK-LP64:  [[T0:%.*]] = getelementptr inbounds [[STATE_T]], 
[[STATE_T]]* [[STATE]], i32 0, i32 1
@@ -160,7 +160,7 @@ void test3(NSArray *array) {
 
   // CHECK-LP64-LABEL:define void @test3(
   // CHECK-LP64:  [[ARRAY:%.*]] = alloca [[ARRAY_T]]*, align 8
-  // CHECK-LP64:  [[X:%.*]] = alloca i8*, align 8
+  // CHECK-LP64-NEXT: [[X:%.*]] = alloca i8*, align 8
   // CHECK-LP64:  [[T0:%.*]] = load i8*, i8** [[X]], align 8
   // CHECK-LP64-NEXT: [[T1:%.*]] = icmp ne i8* [[T0]], null
   // CHECK-LP64-NEXT: br i1 [[T1]],

Modified: cfe/trunk/test/CodeGenObjC/arc-ternary-op.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/arc-ternary-op.m?rev=300290=300289=300290=diff
==
--- cfe/trunk/test/CodeGenObjC/arc-ternary-op.m (original)
+++ cfe/trunk/test/CodeGenObjC/arc-ternary-op.m Thu Apr 13 20:00:03 2017
@@ -120,9 +120,9 @@ void test2(int cond) {
 
   // CHECK-LABEL:define void @test2(
   // CHECK:  [[COND:%.*]] = alloca i32,
+  // CHECK:  alloca i8*
   // CHECK:  [[CLEANUP_SAVE:%.*]] = alloca i8*
   // CHECK:  [[RUN_CLEANUP:%.*]] = alloca i1
-  // CHECK:  alloca i8*
   //   Evaluate condition; cleanup disabled by default.
   // CHECK:  [[T0:%.*]] = load i32, i32* [[COND]],
   // CHECK-NEXT: icmp ne i32 [[T0]], 0


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


r300270 - [docs] Fix a couple of typos in command line flag help text and regenerate documentation.

2017-04-13 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Thu Apr 13 17:39:49 2017
New Revision: 300270

URL: http://llvm.org/viewvc/llvm-project?rev=300270=rev
Log:
[docs] Fix a couple of typos in command line flag help text and regenerate 
documentation.

Modified:
cfe/trunk/docs/ClangCommandLineReference.rst
cfe/trunk/include/clang/Driver/Options.td

Modified: cfe/trunk/docs/ClangCommandLineReference.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ClangCommandLineReference.rst?rev=300270=300269=300270=diff
==
--- cfe/trunk/docs/ClangCommandLineReference.rst (original)
+++ cfe/trunk/docs/ClangCommandLineReference.rst Thu Apr 13 17:39:49 2017
@@ -198,6 +198,10 @@ Specify comma-separated list of triples
 
 .. option:: -framework 
 
+.. option:: -frtlib-add-rpath, -fno-rtlib-add-rpath
+
+Add -rpath with architecture-specific resource directory to the linker flags
+
 .. option:: --gcc-toolchain=, -gcc-toolchain 
 
 Use the gcc toolchain at the given directory
@@ -238,6 +242,8 @@ Make the next included directory (-I or
 
 Run the migrator
 
+.. option:: -mios-simulator-version-min=, 
-miphonesimulator-version-min=
+
 .. option:: -mlinker-version=
 
 .. option:: -mlittle-endian, -EL
@@ -250,6 +256,8 @@ Additional arguments to forward to LLVM'
 
 Directory to dump module dependencies to
 
+.. option:: -mtvos-simulator-version-min=, 
-mappletvsimulator-version-min=
+
 .. option:: -multi\_module
 
 .. option:: -multiply\_defined 
@@ -258,6 +266,8 @@ Directory to dump module dependencies to
 .. option:: -multiply\_defined\_unused 
 .. program:: clang
 
+.. option:: -mwatchos-simulator-version-min=, 
-mwatchsimulator-version-min=
+
 .. option:: --no-cuda-version-check
 
 Don't error out if the detected version of the CUDA install is too low for the 
requested CUDA gpu architecture.
@@ -416,6 +426,10 @@ Print the library path for the currently
 
 Print the full program path of 
 
+.. option:: -print-resource-dir, --print-resource-dir
+
+Print the resource directory pathname
+
 .. option:: -print-search-dirs, --print-search-dirs
 
 Print the paths used for finding libraries and programs
@@ -678,6 +692,8 @@ Inline functions which are (explicitly o
 
 .. option:: -fno-crash-diagnostics
 
+Disable auto-generation of preprocessed source files and a script for 
reproduction during a clang crash
+
 .. option:: -fno-sanitize-blacklist
 
 Don't use blacklist file for sanitizers
@@ -872,6 +888,10 @@ Add directory to AFTER include search pa
 
 Add directory to SYSTEM framework search path
 
+.. option:: -iframeworkwithsysroot
+
+Add directory to SYSTEM framework search path, absolute paths are relative to 
-isysroot
+
 .. option:: -imacros, --imacros, --imacros=
 
 Include macros from file before parsing
@@ -1053,9 +1073,7 @@ Enable C++17 aligned allocation function
 
 .. option:: -fallow-unsupported
 
-.. option:: -maltivec, -mno-altivec
-
-Enable AltiVec vector initializer syntax
+.. option:: -faltivec, -fno-altivec
 
 .. option:: -fansi-escape-codes
 
@@ -1155,6 +1173,10 @@ Place each data in its own section (ELF
 
 Emit extra debug info to make sample profile more accurate.
 
+.. option:: -fdebug-macro, -fno-debug-macro
+
+Emit macro debug information
+
 .. option:: -fdebug-pass-arguments
 
 .. option:: -fdebug-pass-structure
@@ -1531,7 +1553,11 @@ Generate instrumented code to collect ex
 
 Use instrumentation data for profile-guided optimization
 
+.. option:: -fprofile-sample-use, -fauto-profile, -fno-profile-sample-use
+
+.. program:: clang1
 .. option:: -fprofile-sample-use=, -fauto-profile=
+.. program:: clang
 
 Enable sample-based profile guided optimizations
 
@@ -1653,7 +1679,7 @@ Enable optimizations based on the strict
 
 .. option:: -fstrict-return, -fno-strict-return
 
-Always treat control flow paths that fall off the end of a non-voidfunction as 
unreachable
+Always treat control flow paths that fall off the end of a non-void function 
as unreachable
 
 .. option:: -fstrict-vtable-pointers, -fno-strict-vtable-pointers
 
@@ -1765,6 +1791,10 @@ Treat signed integer overflow as two's c
 
 Store string literals as writable data
 
+.. option:: -fxray-always-instrument=
+
+Filename defining the whitelist for imbuing the 'always instrument' XRay 
attribute.
+
 .. option:: -fxray-instruction-threshold
 
 .. program:: clang1
@@ -1777,6 +1807,10 @@ Sets the minimum function size to instru
 
 Generate XRay instrumentation sleds on function entry and exit
 
+.. option:: -fxray-never-instrument=
+
+Filename defining the whitelist for imbuing the 'never instrument' XRay 
attribute.
+
 .. option:: -fzero-initialized-in-bss, -fno-zero-initialized-in-bss
 
 .. option:: -fzvector, -fno-zvector, -mzvector
@@ -1875,7 +1909,7 @@ Link stack frames through backchain on S
 
 .. option:: -mconsole
 
-.. option:: -mcpu=, -mv4 (equivalent to -mcpu=hexagonv4), -mv5 
(equivalent to -mcpu=hexagonv5), -mv55 (equivalent to -mcpu=hexagonv55), -mv60 
(equivalent to 

[PATCH] D32064: [asan] Disable ASan global-GC depending on the target and CGOpts

2017-04-13 Thread Evgeniy Stepanov via Phabricator via cfe-commits
eugenis created this revision.

The linux part is a bit ahead of time - the instrumentation code where this 
matters have not landed yet. But when it does, this would be the right 
condition, and for now ELF instrumentation simply ignores this setting.


Repository:
  rL LLVM

https://reviews.llvm.org/D32064

Files:
  lib/CodeGen/BackendUtil.cpp


Index: lib/CodeGen/BackendUtil.cpp
===
--- lib/CodeGen/BackendUtil.cpp
+++ lib/CodeGen/BackendUtil.cpp
@@ -132,16 +132,20 @@
 // that we add to the PassManagerBuilder.
 class PassManagerBuilderWrapper : public PassManagerBuilder {
 public:
-  PassManagerBuilderWrapper(const CodeGenOptions ,
+  PassManagerBuilderWrapper(const Triple ,
+const CodeGenOptions ,
 const LangOptions )
-  : PassManagerBuilder(), CGOpts(CGOpts), LangOpts(LangOpts) {}
+  : PassManagerBuilder(), TargetTriple(TargetTriple), CGOpts(CGOpts),
+LangOpts(LangOpts) {}
+  const Triple () const { return TargetTriple; }
   const CodeGenOptions () const { return CGOpts; }
   const LangOptions () const { return LangOpts; }
+
 private:
+  const Triple 
   const CodeGenOptions 
   const LangOptions 
 };
-
 }
 
 static void addObjCARCAPElimPass(const PassManagerBuilder , 
PassManagerBase ) {
@@ -188,16 +192,36 @@
   PM.add(createSanitizerCoverageModulePass(Opts));
 }
 
+// Check if ASan should use GC-friendly instrumentation for globals.
+// First of all, there is no point if -fdata-sections is off (expect for MachO,
+// where this is not a factor). Also, on ELF this feature requires an assembler
+// extension that only works with -integrated-as at the moment.
+static bool asanUseGlobalsGC(const Triple , const CodeGenOptions ) {
+  switch (T.getObjectFormat()) {
+  case Triple::MachO:
+return true;
+  case Triple::COFF:
+return CGOpts.DataSections;
+  case Triple::ELF:
+return CGOpts.DataSections && !CGOpts.DisableIntegratedAS;
+  default:
+return false;
+  }
+}
+
 static void addAddressSanitizerPasses(const PassManagerBuilder ,
   legacy::PassManagerBase ) {
   const PassManagerBuilderWrapper  =
   static_cast(Builder);
+  const Triple  = BuilderWrapper.getTargetTriple();
   const CodeGenOptions  = BuilderWrapper.getCGOpts();
   bool Recover = CGOpts.SanitizeRecover.has(SanitizerKind::Address);
   bool UseAfterScope = CGOpts.SanitizeAddressUseAfterScope;
+  bool UseGlobalsGC = asanUseGlobalsGC(T, CGOpts);
   PM.add(createAddressSanitizerFunctionPass(/*CompileKernel*/ false, Recover,
 UseAfterScope));
-  PM.add(createAddressSanitizerModulePass(/*CompileKernel*/false, Recover));
+  PM.add(createAddressSanitizerModulePass(/*CompileKernel*/ false, Recover,
+  UseGlobalsGC));
 }
 
 static void addKernelAddressSanitizerPasses(const PassManagerBuilder ,
@@ -435,16 +459,16 @@
   if (CodeGenOpts.DisableLLVMPasses)
 return;
 
-  PassManagerBuilderWrapper PMBuilder(CodeGenOpts, LangOpts);
-
   // Figure out TargetLibraryInfo.  This needs to be added to MPM and FPM
   // manually (and not via PMBuilder), since some passes (eg. InstrProfiling)
   // are inserted before PMBuilder ones - they'd get the default-constructed
   // TLI with an unknown target otherwise.
   Triple TargetTriple(TheModule->getTargetTriple());
   std::unique_ptr TLII(
   createTLII(TargetTriple, CodeGenOpts));
 
+  PassManagerBuilderWrapper PMBuilder(TargetTriple, CodeGenOpts, LangOpts);
+
   // At O0 and O1 we only run the always inliner which is more efficient. At
   // higher optimization levels we run the normal inliner.
   if (CodeGenOpts.OptimizationLevel <= 1) {


Index: lib/CodeGen/BackendUtil.cpp
===
--- lib/CodeGen/BackendUtil.cpp
+++ lib/CodeGen/BackendUtil.cpp
@@ -132,16 +132,20 @@
 // that we add to the PassManagerBuilder.
 class PassManagerBuilderWrapper : public PassManagerBuilder {
 public:
-  PassManagerBuilderWrapper(const CodeGenOptions ,
+  PassManagerBuilderWrapper(const Triple ,
+const CodeGenOptions ,
 const LangOptions )
-  : PassManagerBuilder(), CGOpts(CGOpts), LangOpts(LangOpts) {}
+  : PassManagerBuilder(), TargetTriple(TargetTriple), CGOpts(CGOpts),
+LangOpts(LangOpts) {}
+  const Triple () const { return TargetTriple; }
   const CodeGenOptions () const { return CGOpts; }
   const LangOptions () const { return LangOpts; }
+
 private:
+  const Triple 
   const CodeGenOptions 
   const LangOptions 
 };
-
 }
 
 static void addObjCARCAPElimPass(const PassManagerBuilder , PassManagerBase ) {
@@ -188,16 +192,36 @@
   PM.add(createSanitizerCoverageModulePass(Opts));
 }
 
+// Check if ASan should use GC-friendly instrumentation for globals.
+// First of all, there is no point if -fdata-sections is off (expect 

[PATCH] D32029: [ObjC] Fix lifetime markers of loop variable in EmitObjCForCollectionStmt

2017-04-13 Thread Kuba (Brecka) Mracek via Phabricator via cfe-commits
kubamracek added a comment.

Note that C++ foreach loops also generate lifetime.start and lifetime.end 
inside of the loop body.


Repository:
  rL LLVM

https://reviews.llvm.org/D32029



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


r300279 - [Profile] PE binary coverage bug fix

2017-04-13 Thread Xinliang David Li via cfe-commits
Author: davidxl
Date: Thu Apr 13 18:37:21 2017
New Revision: 300279

URL: http://llvm.org/viewvc/llvm-project?rev=300279=rev
Log:
[Profile] PE binary coverage bug fix

PR/32584

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

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

Modified: cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp?rev=300279=300278=300279=diff
==
--- cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp (original)
+++ cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp Thu Apr 13 18:37:21 2017
@@ -966,7 +966,7 @@ bool isMachO(const CodeGenModule ) {
 }
 
 StringRef getCoverageSection(const CodeGenModule ) {
-  return llvm::getInstrProfCoverageSectionName(isMachO(CGM));
+  return llvm::getInstrProfCoverageSectionName(());
 }
 
 std::string normalizeFilename(StringRef Filename) {


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


[PATCH] D32064: [asan] Disable ASan global-GC depending on the target and CGOpts

2017-04-13 Thread Evgeniy Stepanov via Phabricator via cfe-commits
eugenis added a comment.

From a quick look at the code, it seems like -fno-data-sections on COFF would 
suppress GC of globals the same as on ELF. Is that true?


Repository:
  rL LLVM

https://reviews.llvm.org/D32064



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


[PATCH] D32063: [clang-move] cleanup: create ClangMoveActionFactory on the stack

2017-04-13 Thread Alexander Shaposhnikov via Phabricator via cfe-commits
alexshap created this revision.
alexshap created this object with visibility "All Users".

This diff removes unnecessary using of unique_ptr with ClangMoveActionFactory 
(pico cleanup).
NFC


Repository:
  rL LLVM

https://reviews.llvm.org/D32063

Files:
  tool/ClangMoveMain.cpp


Index: tool/ClangMoveMain.cpp
===
--- tool/ClangMoveMain.cpp
+++ tool/ClangMoveMain.cpp
@@ -127,10 +127,9 @@
   move::ClangMoveContext Context{Spec, Tool.getReplacements(),
  InitialDirectory.str(), Style, DumpDecls};
   move::DeclarationReporter Reporter;
-  auto Factory = llvm::make_unique(
-  , );
-
-  int CodeStatus = Tool.run(Factory.get());
+  move::ClangMoveActionFactory Factory(, );
+  
+  int CodeStatus = Tool.run();
   if (CodeStatus)
 return CodeStatus;
 


Index: tool/ClangMoveMain.cpp
===
--- tool/ClangMoveMain.cpp
+++ tool/ClangMoveMain.cpp
@@ -127,10 +127,9 @@
   move::ClangMoveContext Context{Spec, Tool.getReplacements(),
  InitialDirectory.str(), Style, DumpDecls};
   move::DeclarationReporter Reporter;
-  auto Factory = llvm::make_unique(
-  , );
-
-  int CodeStatus = Tool.run(Factory.get());
+  move::ClangMoveActionFactory Factory(, );
+  
+  int CodeStatus = Tool.run();
   if (CodeStatus)
 return CodeStatus;
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D27263: Address of bitfield in anonymous struct doesn't error.

2017-04-13 Thread Richard Smith via Phabricator via cfe-commits
rsmith added a comment.

The change to test/SemaCXX/anonymous-struct.cpp appeared to be unrelated to the 
rest of the patch, so I committed it separately as r300266.

Thank you!


Repository:
  rL LLVM

https://reviews.llvm.org/D27263



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


r300283 - Fix PR31934: forming refs to functions with enable_if attrs.

2017-04-13 Thread George Burgess IV via cfe-commits
Author: gbiv
Date: Thu Apr 13 18:47:08 2017
New Revision: 300283

URL: http://llvm.org/viewvc/llvm-project?rev=300283=rev
Log:
Fix PR31934: forming refs to functions with enable_if attrs.

Modified:
cfe/trunk/lib/Sema/SemaInit.cpp
cfe/trunk/test/SemaCXX/enable_if.cpp

Modified: cfe/trunk/lib/Sema/SemaInit.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInit.cpp?rev=300283=300282=300283=diff
==
--- cfe/trunk/lib/Sema/SemaInit.cpp (original)
+++ cfe/trunk/lib/Sema/SemaInit.cpp Thu Apr 13 18:47:08 2017
@@ -6684,6 +6684,19 @@ InitializationSequence::Perform(Sema ,
   if (S.CheckExceptionSpecCompatibility(CurInit.get(), DestType))
 return ExprError();
 
+  // We don't check for e.g. function pointers here, since address
+  // availability checks should only occur when the function first decays
+  // into a pointer or reference.
+  if (CurInit.get()->getType()->isFunctionProtoType()) {
+if (auto *DRE = dyn_cast(CurInit.get()->IgnoreParens())) {
+  if (auto *FD = dyn_cast(DRE->getDecl())) {
+if (!S.checkAddressOfFunctionIsAvailable(FD, /*Complain=*/true,
+ DRE->getLocStart()))
+  return ExprError();
+  }
+}
+  }
+
   // Even though we didn't materialize a temporary, the binding may still
   // extend the lifetime of a temporary. This happens if we bind a 
reference
   // to the result of a cast to reference type.

Modified: cfe/trunk/test/SemaCXX/enable_if.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/enable_if.cpp?rev=300283=300282=300283=diff
==
--- cfe/trunk/test/SemaCXX/enable_if.cpp (original)
+++ cfe/trunk/test/SemaCXX/enable_if.cpp Thu Apr 13 18:47:08 2017
@@ -472,3 +472,30 @@ namespace instantiate_constexpr_in_enabl
   };
   void g() { X().f(); }
 }
+
+namespace PR31934 {
+int foo(int a) __attribute__((enable_if(a, "")));
+int runFn(int (&)(int));
+
+void run() {
+  {
+int ()(int) = foo; // expected-error{{cannot take address of function 
'foo'}}
+int baz = runFn(foo); // expected-error{{cannot take address of function 
'foo'}}
+  }
+
+  {
+int ()(int) = (foo); // expected-error{{cannot take address of 
function 'foo'}}
+int baz = runFn((foo)); // expected-error{{cannot take address of function 
'foo'}}
+  }
+
+  {
+int ()(int) = static_cast(foo); // 
expected-error{{cannot take address of function 'foo'}}
+int baz = runFn(static_cast(foo)); // expected-error{{cannot 
take address of function 'foo'}}
+  }
+
+  {
+int ()(int) = static_cast((foo)); // 
expected-error{{cannot take address of function 'foo'}}
+int baz = runFn(static_cast((foo))); // 
expected-error{{cannot take address of function 'foo'}}
+  }
+}
+}


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


[PATCH] D32064: [asan] Disable ASan global-GC depending on the target and compiler flags

2017-04-13 Thread Evgeniy Stepanov via Phabricator via cfe-commits
eugenis updated this revision to Diff 95254.
eugenis retitled this revision from "[asan] Disable ASan global-GC depending on 
the target and CGOpts" to "[asan] Disable ASan global-GC depending on the 
target and compiler flags".

Repository:
  rL LLVM

https://reviews.llvm.org/D32064

Files:
  lib/Driver/SanitizerArgs.cpp
  test/Driver/asan-gc.c


Index: test/Driver/asan-gc.c
===
--- /dev/null
+++ test/Driver/asan-gc.c
@@ -0,0 +1,14 @@
+// RUN: %clang -target x86_64-linux-gnu -fsanitize=address %s -### 2>&1 | 
FileCheck %s --check-prefix=WITHOUT-GC
+// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fdata-sections %s 
-### 2>&1 | FileCheck %s --check-prefix=WITH-GC
+// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fno-data-sections 
-fdata-sections %s -### 2>&1 | FileCheck %s --check-prefix=WITH-GC
+// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fno-integrated-as 
-fdata-sections %s -### 2>&1 | FileCheck %s --check-prefix=WITHOUT-GC
+
+// RUN: %clang -target x86_64-apple-macosx10.11.0 -fsanitize=address %s -### 
2>&1 | FileCheck %s --check-prefix=WITH-GC
+// RUN: %clang -target x86_64-apple-macosx10.11.0 -fsanitize=address 
-fno-integrated-as %s -### 2>&1 | FileCheck %s --check-prefix=WITH-GC
+
+// RUN: %clang -target x86_64-pc-windows-msvc19.0.24215 -fsanitize=address %s 
-### 2>&1 | FileCheck %s --check-prefix=WITHOUT-GC
+// RUN: %clang -target x86_64-pc-windows-msvc19.0.24215 -fsanitize=address 
-fdata-sections %s -### 2>&1 | FileCheck %s --check-prefix=WITH-GC
+
+
+// WITHOUT-GC: "-mllvm" "-asan-globals-live-support=0"
+// WITH-GC-NOT: -asan-globals-live-support=0
Index: lib/Driver/SanitizerArgs.cpp
===
--- lib/Driver/SanitizerArgs.cpp
+++ lib/Driver/SanitizerArgs.cpp
@@ -618,6 +618,29 @@
   CmdArgs.push_back(Args.MakeArgString(LinkerOptionFlag));
 }
 
+// Check if ASan should use GC-friendly instrumentation for globals.
+// First of all, there is no point if -fdata-sections is off (expect for MachO,
+// where this is not a factor). Also, on ELF this feature requires an assembler
+// extension that only works with -integrated-as at the moment.
+static bool useAsanGlobalsGC(const ToolChain ,
+ const llvm::opt::ArgList ) {
+  bool IntegratedAs = TC.useIntegratedAs();
+  bool DataSections =
+  Args.hasFlag(options::OPT_fdata_sections, options::OPT_fno_data_sections,
+   tools::isUseSeparateSections(TC.getTriple()));
+
+  switch (TC.getTriple().getObjectFormat()) {
+  case llvm::Triple::MachO:
+return true;
+  case llvm::Triple::COFF:
+return DataSections;
+  case llvm::Triple::ELF:
+return DataSections && IntegratedAs;
+  default:
+return false;
+  }
+}
+
 void SanitizerArgs::addArgs(const ToolChain , const llvm::opt::ArgList 
,
 llvm::opt::ArgStringList ,
 types::ID InputType) const {
@@ -745,6 +768,11 @@
Sanitizers.Mask & CFIClasses)
 << "-fvisibility=";
   }
+
+  if (Sanitizers.has(Address) && !useAsanGlobalsGC(TC, Args)) {
+CmdArgs.push_back("-mllvm");
+CmdArgs.push_back("-asan-globals-live-support=0");
+  }
 }
 
 SanitizerMask parseArgValues(const Driver , const llvm::opt::Arg *A,


Index: test/Driver/asan-gc.c
===
--- /dev/null
+++ test/Driver/asan-gc.c
@@ -0,0 +1,14 @@
+// RUN: %clang -target x86_64-linux-gnu -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=WITHOUT-GC
+// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fdata-sections %s -### 2>&1 | FileCheck %s --check-prefix=WITH-GC
+// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fno-data-sections -fdata-sections %s -### 2>&1 | FileCheck %s --check-prefix=WITH-GC
+// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fno-integrated-as -fdata-sections %s -### 2>&1 | FileCheck %s --check-prefix=WITHOUT-GC
+
+// RUN: %clang -target x86_64-apple-macosx10.11.0 -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=WITH-GC
+// RUN: %clang -target x86_64-apple-macosx10.11.0 -fsanitize=address -fno-integrated-as %s -### 2>&1 | FileCheck %s --check-prefix=WITH-GC
+
+// RUN: %clang -target x86_64-pc-windows-msvc19.0.24215 -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=WITHOUT-GC
+// RUN: %clang -target x86_64-pc-windows-msvc19.0.24215 -fsanitize=address -fdata-sections %s -### 2>&1 | FileCheck %s --check-prefix=WITH-GC
+
+
+// WITHOUT-GC: "-mllvm" "-asan-globals-live-support=0"
+// WITH-GC-NOT: -asan-globals-live-support=0
Index: lib/Driver/SanitizerArgs.cpp
===
--- lib/Driver/SanitizerArgs.cpp
+++ lib/Driver/SanitizerArgs.cpp
@@ -618,6 +618,29 @@
   CmdArgs.push_back(Args.MakeArgString(LinkerOptionFlag));
 }
 
+// Check if ASan should use 

[PATCH] D31856: Headers: Make the type of SIZE_MAX the same as size_t

2017-04-13 Thread Duncan P. N. Exon Smith via Phabricator via cfe-commits
dexonsmith added reviewers: hfinkel, rsmith.
dexonsmith added a comment.

+Hal and Richard, a couple of possible reviewers.


https://reviews.llvm.org/D31856



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


r300225 - Warning-free clang-format plugin install for VS 15.0

2017-04-13 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Thu Apr 13 12:42:45 2017
New Revision: 300225

URL: http://llvm.org/viewvc/llvm-project?rev=300225=rev
Log:
Warning-free clang-format plugin install for VS 15.0

With the new release of VS, it's required that all plugins migrate to
the new VSIX manifest format. The new format is backwards compatible
with all versions newer that Visual Studio 2012, so this migration
effectively drops support for older versions of the IDE.

It's also required that these new extensions are built with Visual
Studio 2017, so unfortunately it was necessary to migrate the project
and solution. Also removed COM references to EnvDTE and
Microsoft.VisualStudio.TextManager.Interop from the csproj, as they seem
to both be unnecessary and would trigger build warnings because of
changes to GAC.

Patch by Hugo Puhlmann!

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

Modified:
cfe/trunk/tools/clang-format-vs/ClangFormat/ClangFormat.csproj
cfe/trunk/tools/clang-format-vs/ClangFormat/packages.config
cfe/trunk/tools/clang-format-vs/source.extension.vsixmanifest.in

Modified: cfe/trunk/tools/clang-format-vs/ClangFormat/ClangFormat.csproj
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-format-vs/ClangFormat/ClangFormat.csproj?rev=300225=300224=300225=diff
==
--- cfe/trunk/tools/clang-format-vs/ClangFormat/ClangFormat.csproj (original)
+++ cfe/trunk/tools/clang-format-vs/ClangFormat/ClangFormat.csproj Thu Apr 13 
12:42:45 2017
@@ -59,8 +59,10 @@
   
   
 
-  ..\packages\VSSDK.DTE.7.0.3\lib\net20\envdte.dll
-  False
+  True
+
+
+  True
 
 
 
@@ -116,10 +118,6 @@
   
..\packages\VSSDK.Text.10.0.4\lib\net40\Microsoft.VisualStudio.Text.UI.Wpf.dll
   False
 
-
-  
..\packages\VSSDK.TextManager.Interop.7.0.4\lib\net20\Microsoft.VisualStudio.TextManager.Interop.dll
-  True
-
 
   False
 
@@ -146,42 +144,6 @@
 
   
   
-
-  {80CC9F66-E7D8-4DDD-85B6-D9E6CD0E93E2}
-  8
-  0
-  0
-  primary
-  False
-  False
-
-
-  {26AD1324-4B7C-44BC-84F8-B86AED45729F}
-  10
-  0
-  0
-  primary
-  False
-  False
-
-
-  {1A31287A-4D7D-413E-8E32-3B374931BD89}
-  8
-  0
-  0
-  primary
-  False
-  False
-
-
-  {2CE2370E-D744-4936-A090-3FFFE667B0E1}
-  9
-  0
-  0
-  primary
-  False
-  False
-
 
   {1CBA492E-7263-47BB-87FE-639000619B15}
   8
@@ -230,7 +192,9 @@
   
   
 
-
+
+  Designer
+
 
   Designer
 
@@ -294,4 +258,4 @@
   
   
   -->
-
\ No newline at end of file
+

Modified: cfe/trunk/tools/clang-format-vs/ClangFormat/packages.config
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-format-vs/ClangFormat/packages.config?rev=300225=300224=300225=diff
==
--- cfe/trunk/tools/clang-format-vs/ClangFormat/packages.config (original)
+++ cfe/trunk/tools/clang-format-vs/ClangFormat/packages.config Thu Apr 13 
12:42:45 2017
@@ -2,7 +2,6 @@
 
   
   
-  
   
   
   

Modified: cfe/trunk/tools/clang-format-vs/source.extension.vsixmanifest.in
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-format-vs/source.extension.vsixmanifest.in?rev=300225=300224=300225=diff
==
--- cfe/trunk/tools/clang-format-vs/source.extension.vsixmanifest.in (original)
+++ cfe/trunk/tools/clang-format-vs/source.extension.vsixmanifest.in Thu Apr 13 
12:42:45 2017
@@ -1,39 +1,19 @@
 
-http://schemas.microsoft.com/developer/vsx-schema/2010;>
-  
-ClangFormat
-LLVM
-@CLANG_FORMAT_VS_VERSION@
+http://schemas.microsoft.com/developer/vsx-schema/2011; 
xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011;>
+  
+
+ClangFormat
 A tool to format C/C++/Obj-C 
code.
-1033
-http://clang.llvm.org/docs/ClangFormat.html
+http://clang.llvm.org/docs/ClangFormat.html
 license.txt
-false
-
-  
-Pro
-  
-  
-Pro
-  
-  
-Pro
-  
-  
-Pro
-  
-  
-Pro
-  
-
-
-  
-  
-
-Visual Studio MPF
-
-  
-  
-|%CurrentProject%;PkgdefProjectOutputGroup|
-  
-
+  
+  
+
+  
+  
+
+  
+  
+
+  
+


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


[PATCH] D31757: [clang-tidy] Add a clang-tidy check for possible inefficient vector operations

2017-04-13 Thread Haojian Wu via Phabricator via cfe-commits
hokein updated this revision to Diff 95174.
hokein marked 11 inline comments as done.
hokein added a comment.

Address review comments.


https://reviews.llvm.org/D31757

Files:
  clang-tidy/performance/CMakeLists.txt
  clang-tidy/performance/InefficientVectorOperationCheck.cpp
  clang-tidy/performance/InefficientVectorOperationCheck.h
  clang-tidy/performance/PerformanceTidyModule.cpp
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/performance-inefficient-vector-operation.rst
  test/clang-tidy/performance-inefficient-vector-operation.cpp

Index: test/clang-tidy/performance-inefficient-vector-operation.cpp
===
--- /dev/null
+++ test/clang-tidy/performance-inefficient-vector-operation.cpp
@@ -0,0 +1,183 @@
+// RUN: %check_clang_tidy %s performance-inefficient-vector-operation %t -- -format-style=llvm --
+
+typedef int size_t;
+
+namespace std {
+template 
+class vector {
+ public:
+  typedef T* iterator;
+  typedef const T* const_iterator;
+  typedef T& reference;
+  typedef const T& const_reference;
+  typedef size_t size_type;
+
+  explicit vector();
+  explicit vector(size_type n);
+
+  void push_back(const T& val);
+  void reserve(size_t n);
+  void resize(size_t n);
+
+  size_t size();
+  const_reference operator[] (size_type) const;
+  reference operator[] (size_type);
+};
+} // namespace std
+
+void f(std::vector& t) {
+  {
+std::vector v;
+// CHECK-FIXES: v.reserve(10);
+for (int i = 0; i < 10; ++i)
+  v.push_back(i);
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: 'push_back' is called inside a loop; consider pre-allocating the vector capacity before the loop
+  }
+  {
+std::vector v;
+// CHECK-FIXES: v.reserve(10);
+for (int i = 0; i < 10; i++)
+  v.push_back(i);
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: 'push_back' is called
+  }
+  {
+std::vector v;
+// CHECK-FIXES: v.reserve(10);
+for (int i = 0; i < 10; ++i)
+  v.push_back(0);
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: 'push_back' is called
+  }
+  {
+std::vector v;
+// CHECK-FIXES: v.reserve(5);
+for (int i = 0; i < 5; ++i) {
+  v.push_back(i);
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: 'push_back' is called
+}
+// CHECK-FIXES-NOT: v.reserve(10);
+for (int i = 0; i < 10; ++i) {
+  // No fix for this loop as we encounter the prior loops.
+  v.push_back(i);
+}
+  }
+  {
+std::vector v;
+std::vector v2;
+v2.reserve(3);
+// CHECK-FIXES: v.reserve(10);
+for (int i = 0; i < 10; ++i)
+  v.push_back(i);
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: 'push_back' is called
+  }
+  {
+std::vector v;
+// CHECK-FIXES: v.reserve(t.size());
+for (size_t i = 0; i < t.size(); ++i) {
+  v.push_back(t[i]);
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: 'push_back' is called
+}
+  }
+  {
+std::vector v;
+// CHECK-FIXES: v.reserve(t.size() - 1);
+for (size_t i = 0; i < t.size() - 1; ++i) {
+  v.push_back(t[i]);
+} // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: 'push_back' is called
+  }
+
+  //  Non-fixed Cases 
+  {
+std::vector v;
+v.reserve(20);
+// CHECK-FIXES-NOT: v.reserve(10);
+// There is a "reserve" call already.
+for (int i = 0; i < 10; ++i) {
+  v.push_back(i);
+}
+  }
+  {
+std::vector v;
+v.reserve(5);
+// CHECK-FIXES-NOT: v.reserve(10);
+// There is a "reserve" call already.
+for (int i = 0; i < 10; ++i) {
+  v.push_back(i);
+}
+  }
+  {
+std::vector v;
+v.resize(5);
+// CHECK-FIXES-NOT: v.reserve(10);
+// There is a ref usage of v before the loop.
+for (int i = 0; i < 10; ++i) {
+  v.push_back(i);
+}
+  }
+  {
+std::vector v;
+v.push_back(0);
+// CHECK-FIXES-NOT: v.reserve(10);
+// There is a ref usage of v before the loop.
+for (int i = 0; i < 10; ++i) {
+  v.push_back(i);
+}
+  }
+  {
+std::vector v;
+f(v);
+// CHECK-FIXES-NOT: v.reserve(10);
+// There is a ref usage of v before the loop.
+for (int i = 0; i < 10; ++i) {
+  v.push_back(i);
+}
+  }
+  {
+std::vector v(20);
+// CHECK-FIXES-NOT: v.reserve(10);
+// v is not constructed with default constructor.
+for (int i = 0; i < 10; ++i) {
+  v.push_back(i);
+}
+  }
+  {
+std::vector v;
+// CHECK-FIXES-NOT: v.reserve(10);
+// For-loop is not started with 0.
+for (int i = 1; i < 10; ++i) {
+  v.push_back(i);
+}
+  }
+  {
+std::vector v;
+// CHECK-FIXES-NOT: v.reserve(t.size());
+// v isn't referenced in for-loop body.
+for (size_t i = 0; i < t.size(); ++i) {
+  t.push_back(i);
+}
+  }
+  {
+std::vector v;
+int k;
+// CHECK-FIXES-NOT: v.reserve(10);
+// For-loop isn't a fixable loop.
+for (size_t i = 0; k < 10; ++i) {
+  v.push_back(t[i]);
+}
+  }
+  {
+std::vector v;
+

[PATCH] D13117: [DarwinDriver] Use -lto_library to specify the path for libLTO.dylib

2017-04-13 Thread Bruno Cardoso Lopes via Phabricator via cfe-commits
bruno closed this revision.
bruno added a comment.

Done way back in r248932


Repository:
  rL LLVM

https://reviews.llvm.org/D13117



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


[PATCH] D27429: [Chrono][Darwin] On Darwin use CLOCK_UPTIME_RAW instead of CLOCK_MONOTONIC

2017-04-13 Thread Bruno Cardoso Lopes via Phabricator via cfe-commits
bruno closed this revision.
bruno added a comment.

r291466 & r291517


https://reviews.llvm.org/D27429



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


[PATCH] D29658: [OpenMP] Customize CUDA-based tool chain selection

2017-04-13 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
gtbercea updated this revision to Diff 95171.
gtbercea added a comment.

Remove tests which belong into a different patch.


Repository:
  rL LLVM

https://reviews.llvm.org/D29658

Files:
  lib/Driver/Driver.cpp


Index: lib/Driver/Driver.cpp
===
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -553,8 +553,22 @@
   if (TT.getArch() == llvm::Triple::UnknownArch)
 Diag(clang::diag::err_drv_invalid_omp_target) << Val;
   else {
-const ToolChain  = getToolChain(C.getInputArgs(), TT);
-C.addOffloadDeviceToolChain(, Action::OFK_OpenMP);
+const ToolChain *TC = nullptr;
+// CUDA toolchains have to be selected differently. They pair host
+// and device in their implementation.
+if (TT.isNVPTX()) {
+  const ToolChain *HostTC =
+  C.getSingleOffloadToolChain();
+  assert(HostTC && "Host toolchain should be always defined.");
+  auto  =
+  ToolChains[TT.str() + "/" + HostTC->getTriple().normalize()];
+  if (!CudaTC)
+CudaTC = llvm::make_unique(
+*this, TT, *HostTC, C.getInputArgs());
+  TC = CudaTC.get();
+} else
+  TC = (C.getInputArgs(), TT);
+C.addOffloadDeviceToolChain(TC, Action::OFK_OpenMP);
   }
 }
   } else


Index: lib/Driver/Driver.cpp
===
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -553,8 +553,22 @@
   if (TT.getArch() == llvm::Triple::UnknownArch)
 Diag(clang::diag::err_drv_invalid_omp_target) << Val;
   else {
-const ToolChain  = getToolChain(C.getInputArgs(), TT);
-C.addOffloadDeviceToolChain(, Action::OFK_OpenMP);
+const ToolChain *TC = nullptr;
+// CUDA toolchains have to be selected differently. They pair host
+// and device in their implementation.
+if (TT.isNVPTX()) {
+  const ToolChain *HostTC =
+  C.getSingleOffloadToolChain();
+  assert(HostTC && "Host toolchain should be always defined.");
+  auto  =
+  ToolChains[TT.str() + "/" + HostTC->getTriple().normalize()];
+  if (!CudaTC)
+CudaTC = llvm::make_unique(
+*this, TT, *HostTC, C.getInputArgs());
+  TC = CudaTC.get();
+} else
+  TC = (C.getInputArgs(), TT);
+C.addOffloadDeviceToolChain(TC, Action::OFK_OpenMP);
   }
 }
   } else
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D29001: [Modules] Fallback to building the module if a timeout occurs

2017-04-13 Thread Bruno Cardoso Lopes via Phabricator via cfe-commits
bruno closed this revision.
bruno added a comment.

Updating: already done in r298175


https://reviews.llvm.org/D29001



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


[PATCH] D31757: [clang-tidy] Add a clang-tidy check for possible inefficient vector operations

2017-04-13 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments.



Comment at: clang-tidy/performance/InefficientVectorOperationCheck.cpp:81
+  hasLoopInit(LoopVarInit),
+  hasCondition(binaryOperator(hasOperatorName("<"),
+  hasLHS(RefersToLoopVar),

Perhaps you could support other comparisons, but not attempt to generate a 
fix-it for them? It seems odd that this would trigger for `<` but not `<=`, but 
I can see why you'd not want to figure out the reserve call for `!(foo >= 10)`.



Comment at: clang-tidy/performance/InefficientVectorOperationCheck.cpp:83
+  hasLHS(RefersToLoopVar),
+  hasRHS(expr().bind(LoopEndExprName,
+  hasIncrement(unaryOperator(hasOperatorName("++"),

Thinking out loud, but, what happens if the loop end expression has some hidden 
complexity to it? e.g.,
```
for (int i = 0; i < i + 1; ++i) { // This is a "creative" loop.
  v.push_back(i);
}
```



Comment at: clang-tidy/performance/InefficientVectorOperationCheck.cpp:84
+  hasRHS(expr().bind(LoopEndExprName,
+  hasIncrement(unaryOperator(hasOperatorName("++"),
+ hasUnaryOperand(RefersToLoopVar))),

Can you add a test case for post-increment (all of your tests use 
pre-increment)? Also, count-down loops seem reasonable to support as well, no?
```
for (int i = 10; i >= 0; --i) {
  v.push_back(i);
}
```



Comment at: clang-tidy/performance/InefficientVectorOperationCheck.cpp:86-87
+ hasUnaryOperand(RefersToLoopVar))),
+  hasBody(anyOf(compoundStmt(statementCountIs(1), has(PushBackCall)),
+PushBackCall)),
+  hasParent(compoundStmt(has(VectorVarDefStmt)).bind(LoopParentName)))

You should update the documentation to mention that this check only worries 
about a for loop with a single statement in it. It will be surprising that this 
code does not trigger the same diagnostic:
```
for (...) {
  std::cout << i;
  v.push_back(i);
}
```



Comment at: clang-tidy/performance/InefficientVectorOperationCheck.cpp:95-96
+const MatchFinder::MatchResult ) {
+  if (Result.Context->getDiagnostics().hasUncompilableErrorOccurred())
+return;
+

We don't usually add this test in to our check calls; why are you adding it 
here?



Comment at: clang-tidy/performance/InefficientVectorOperationCheck.cpp:98
+
+  const SourceManager *SM = Result.SourceManager;
+  const auto *ForLoop = Result.Nodes.getNodeAs(LoopCounterName);

Might as well make this a reference rather than a pointer (simplifies code 
elsewhere).



Comment at: clang-tidy/performance/InefficientVectorOperationCheck.cpp:100-104
+  const auto* PushBackCall =
+  Result.Nodes.getNodeAs(PushBackCallName);
+  const auto* LoopEndExpr =
+  Result.Nodes.getNodeAs(LoopEndExprName);
+  const auto* LoopParent =

Formatting (I would recommend running clang-format over the patch).



Comment at: clang-tidy/performance/InefficientVectorOperationCheck.cpp:109-111
+  auto AllVectorVarRefs = utils::decl_ref_expr::allDeclRefExprs(
+  *VectorVarDecl, *LoopParent, *Result.Context);
+  for (const auto *Ref : AllVectorVarRefs) {

I'm not certain what types are being used here. Can you turn `AllVectorVarRefs` 
into something with an explicit type so that I can know what `Ref`'s type is?



Comment at: clang-tidy/performance/InefficientVectorOperationCheck.cpp:117
+//
+// FIXME: make it more intelligent to identified the pre-allocating
+// operations before the for loop.

identified -> identify



Comment at: clang-tidy/performance/InefficientVectorOperationCheck.h:20
+/// Finds possible inefficient `std::vector` operations (e.g. `push_back`) in
+/// for-loops that may cause unnecessary memory reallocations.
+///

Drop the hyphen in for loops.



Comment at: 
docs/clang-tidy/checks/performance-inefficient-vector-operation.rst:7
+Finds possible inefficient `std::vector` operations (e.g. `push_back`) that may
+cause unnecessary memory reallocations.
+

The docs should talk more about the limitations of the check (like how many 
statements it can contain, etc).


https://reviews.llvm.org/D31757



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


[PATCH] D31992: [clangd] Escape only necessary characters in JSON output

2017-04-13 Thread Marc-Andre Laperle via Phabricator via cfe-commits
malaperle-ericsson added a comment.

In https://reviews.llvm.org/D31992#725913, @joerg wrote:

> I'm strongly against this patch. Can you give an actual test case for the 
> problematic behavior?


Sure I can add a test. If you meant more real work scenario, you can juste type 
"é" in VS Code and it will throw an exception trying to parse \x


Repository:
  rL LLVM

https://reviews.llvm.org/D31992



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


r300178 - [analyzer] Simplify values in binary operations a bit more aggressively.

2017-04-13 Thread Artem Dergachev via cfe-commits
Author: dergachev
Date: Thu Apr 13 02:20:04 2017
New Revision: 300178

URL: http://llvm.org/viewvc/llvm-project?rev=300178=rev
Log:
[analyzer] Simplify values in binary operations a bit more aggressively.

SValBuilder tries to constant-fold symbols in the left-hand side of the symbolic
expression whenever it fails to evaluate the expression directly. However, it
only constant-folds them when they are atomic expressions, not when they are
complicated expressions themselves. This patch adds recursive constant-folding
to the left-hand side subexpression (there's a lack of symmetry because we're
trying to have symbols on the left and constants on the right). As an example,
we'd now be able to handle operations similar to "$x + 1 < $y", when $x is
constrained to a constant.

rdar://problem/31354676

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

Modified:
cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h
cfe/trunk/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
cfe/trunk/test/Analysis/additive-folding.cpp

Modified: 
cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h?rev=300178=300177=300178=diff
==
--- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h 
(original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h Thu 
Apr 13 02:20:04 2017
@@ -112,6 +112,11 @@ public:
   /// Evaluates a given SVal. If the SVal has only one possible (integer) 
value,
   /// that value is returned. Otherwise, returns NULL.
   virtual const llvm::APSInt *getKnownValue(ProgramStateRef state, SVal val) = 
0;
+
+  /// Simplify symbolic expressions within a given SVal. Return an SVal
+  /// that represents the same value, but is hopefully easier to work with
+  /// than the original SVal.
+  virtual SVal simplifySVal(ProgramStateRef State, SVal Val) = 0;
   
   /// Constructs a symbolic expression for two non-location values.
   SVal makeSymExprValNN(ProgramStateRef state, BinaryOperator::Opcode op,

Modified: cfe/trunk/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp?rev=300178=300177=300178=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp Thu Apr 13 02:20:04 
2017
@@ -14,6 +14,7 @@
 #include "clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/APSIntType.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h"
+#include "clang/StaticAnalyzer/Core/PathSensitive/SValVisitor.h"
 
 using namespace clang;
 using namespace ento;
@@ -44,6 +45,10 @@ public:
   ///  (integer) value, that value is returned. Otherwise, returns NULL.
   const llvm::APSInt *getKnownValue(ProgramStateRef state, SVal V) override;
 
+  /// Recursively descends into symbolic expressions and replaces symbols
+  /// with their known values (in the sense of the getKnownValue() method).
+  SVal simplifySVal(ProgramStateRef State, SVal V) override;
+
   SVal MakeSymIntVal(const SymExpr *LHS, BinaryOperator::Opcode op,
  const llvm::APSInt , QualType resultTy);
 };
@@ -537,11 +542,12 @@ SVal SimpleSValBuilder::evalBinOpNN(Prog
   // Does the symbolic expression simplify to a constant?
   // If so, "fold" the constant by setting 'lhs' to a ConcreteInt
   // and try again.
-  ConstraintManager  = state->getConstraintManager();
-  if (const llvm::APSInt *Constant = CMgr.getSymVal(state, Sym)) {
-lhs = nonloc::ConcreteInt(*Constant);
-continue;
-  }
+  SVal simplifiedLhs = simplifySVal(state, lhs);
+  if (simplifiedLhs != lhs)
+if (auto simplifiedLhsAsNonLoc = simplifiedLhs.getAs()) {
+  lhs = *simplifiedLhsAsNonLoc;
+  continue;
+}
 
   // Is the RHS a constant?
   if (const llvm::APSInt *RHSValue = getKnownValue(state, rhs))
@@ -993,3 +999,74 @@ const llvm::APSInt *SimpleSValBuilder::g
   // FIXME: Add support for SymExprs.
   return nullptr;
 }
+
+SVal SimpleSValBuilder::simplifySVal(ProgramStateRef State, SVal V) {
+  // For now, this function tries to constant-fold symbols inside a
+  // nonloc::SymbolVal, and does nothing else. More simplifications should
+  // be possible, such as constant-folding an index in an ElementRegion.
+
+  class Simplifier : public FullSValVisitor {
+ProgramStateRef State;
+SValBuilder 
+
+  public:
+Simplifier(ProgramStateRef State)
+: State(State), SVB(State->getStateManager().getSValBuilder()) {}
+
+SVal VisitSymbolData(const SymbolData *S) {
+  if (const llvm::APSInt *I =

[PATCH] D31167: Use FPContractModeKind universally

2017-04-13 Thread Mehdi AMINI via Phabricator via cfe-commits
mehdi_amini added a comment.

I believe considering the goal of moving to using per-instruction FMF and kills 
the global backend option, this leads to a bitcode upgrade issue: OpenCL (or 
other) bitcode that were generated bitcode don't have the right FMF and will be 
upgraded conservatively.
Performance regression when upgrading bitcode are to be expected in general, so 
it is not a bug.
To recover, an option for an OpenCL backend would be to add a pass that set the 
expected FMF everywhere after bitcode upgrade.


Repository:
  rL LLVM

https://reviews.llvm.org/D31167



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


[PATCH] D26838: [analyzer] Enforce super-region classes for various memory regions through compile-time and run-time type checks.

2017-04-13 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL300189: [analyzer] Enforce super-region classes for various 
memory regions. (authored by dergachev).

Changed prior to commit:
  https://reviews.llvm.org/D26838?vs=79537=95093#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D26838

Files:
  cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h
  cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h
  cfe/trunk/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIChecker.cpp
  cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
  cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp
  cfe/trunk/lib/StaticAnalyzer/Core/RegionStore.cpp
  cfe/trunk/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
  cfe/trunk/lib/StaticAnalyzer/Core/Store.cpp

Index: cfe/trunk/lib/StaticAnalyzer/Core/RegionStore.cpp
===
--- cfe/trunk/lib/StaticAnalyzer/Core/RegionStore.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Core/RegionStore.cpp
@@ -1341,7 +1341,8 @@
   if (!Array.getAs())
 return UnknownVal();
 
-  const MemRegion* R = Array.castAs().getRegion();
+  const SubRegion *R =
+  cast(Array.castAs().getRegion());
   NonLoc ZeroIdx = svalBuilder.makeZeroArrayIndex();
   return loc::MemRegionVal(MRMgr.getElementRegion(T, ZeroIdx, R, Ctx));
 }
@@ -1384,7 +1385,7 @@
 T = SR->getSymbol()->getType();
   }
 }
-MR = GetElementZeroRegion(MR, T);
+MR = GetElementZeroRegion(cast(MR), T);
   }
 
   // FIXME: Perhaps this method should just take a 'const MemRegion*' argument
Index: cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
===
--- cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
@@ -512,7 +512,8 @@
   if (CNE->isArray()) {
 // FIXME: allocating an array requires simulating the constructors.
 // For now, just return a symbolicated region.
-const MemRegion *NewReg = symVal.castAs().getRegion();
+const SubRegion *NewReg =
+symVal.castAs().getRegionAs();
 QualType ObjTy = CNE->getType()->getAs()->getPointeeType();
 const ElementRegion *EleReg =
   getStoreManager().GetElementZeroRegion(NewReg, ObjTy);
Index: cfe/trunk/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
===
--- cfe/trunk/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
@@ -950,22 +950,22 @@
   if (const MemRegion *region = lhs.getAsRegion()) {
 rhs = convertToArrayIndex(rhs).castAs();
 SVal index = UnknownVal();
-const MemRegion *superR = nullptr;
+const SubRegion *superR = nullptr;
 // We need to know the type of the pointer in order to add an integer to it.
 // Depending on the type, different amount of bytes is added.
 QualType elementType;
 
 if (const ElementRegion *elemReg = dyn_cast(region)) {
   assert(op == BO_Add || op == BO_Sub);
   index = evalBinOpNN(state, op, elemReg->getIndex(), rhs,
   getArrayIndexType());
-  superR = elemReg->getSuperRegion();
+  superR = cast(elemReg->getSuperRegion());
   elementType = elemReg->getElementType();
 }
 else if (isa(region)) {
   assert(op == BO_Add || op == BO_Sub);
   index = (op == BO_Add) ? rhs : evalMinus(rhs);
-  superR = region;
+  superR = cast(region);
   // TODO: Is this actually reliable? Maybe improving our MemRegion
   // hierarchy to provide typed regions for all non-void pointers would be
   // better. For instance, we cannot extend this towards LocAsInteger
Index: cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp
===
--- cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp
@@ -31,54 +31,56 @@
 // MemRegion Construction.
 //===--===//
 
-template 
-RegionTy* MemRegionManager::getSubRegion(const A1 a1,
- const MemRegion *superRegion) {
+template 
+RegionTy* MemRegionManager::getSubRegion(const Arg1Ty arg1,
+ const SuperTy *superRegion) {
   llvm::FoldingSetNodeID ID;
-  RegionTy::ProfileRegion(ID, a1, superRegion);
+  RegionTy::ProfileRegion(ID, arg1, superRegion);
   void *InsertPos;
   RegionTy* R = cast_or_null(Regions.FindNodeOrInsertPos(ID,
InsertPos));
 
   if (!R) {
 R = A.Allocate();
-new (R) RegionTy(a1, superRegion);
+new (R) RegionTy(arg1, superRegion);
 Regions.InsertNode(R, InsertPos);
   }
 
   return R;
 }
 
-template 
-RegionTy* MemRegionManager::getSubRegion(const A1 a1, const A2 a2,
- const 

r300189 - [analyzer] Enforce super-region classes for various memory regions.

2017-04-13 Thread Artem Dergachev via cfe-commits
Author: dergachev
Date: Thu Apr 13 04:56:07 2017
New Revision: 300189

URL: http://llvm.org/viewvc/llvm-project?rev=300189=rev
Log:
[analyzer] Enforce super-region classes for various memory regions.

We now check the type of the super-region pointer for most SubRegion classes
in compile time; some checks are run-time though.

This is an API-breaking change (we now require explicit casts to specific region
sub-classes), but in practice very few checkers are affected.

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

Modified:
cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h
cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h
cfe/trunk/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIChecker.cpp
cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp
cfe/trunk/lib/StaticAnalyzer/Core/RegionStore.cpp
cfe/trunk/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
cfe/trunk/lib/StaticAnalyzer/Core/Store.cpp

Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h?rev=300189=300188=300189=diff
==
--- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h 
(original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h Thu 
Apr 13 04:56:07 2017
@@ -458,8 +458,8 @@ class AllocaRegion : public SubRegion {
 // memory allocated by alloca at the same call site.
   const Expr *Ex;
 
-  AllocaRegion(const Expr *ex, unsigned cnt, const MemRegion *superRegion)
-: SubRegion(superRegion, AllocaRegionKind), Cnt(cnt), Ex(ex) {
+  AllocaRegion(const Expr *ex, unsigned cnt, const MemSpaceRegion *superRegion)
+  : SubRegion(superRegion, AllocaRegionKind), Cnt(cnt), Ex(ex) {
 assert(Ex);
   }
 
@@ -546,7 +546,7 @@ class CodeTextRegion : public TypedRegio
   virtual void anchor() override;
 
 protected:
-  CodeTextRegion(const MemRegion *sreg, Kind k) : TypedRegion(sreg, k) {
+  CodeTextRegion(const MemSpaceRegion *sreg, Kind k) : TypedRegion(sreg, k) {
 assert(classof(this));
   }
 
@@ -565,7 +565,7 @@ class FunctionCodeRegion : public CodeTe
 
   const NamedDecl *FD;
 
-  FunctionCodeRegion(const NamedDecl *fd, const MemRegion* sreg)
+  FunctionCodeRegion(const NamedDecl *fd, const CodeSpaceRegion* sreg)
 : CodeTextRegion(sreg, FunctionCodeRegionKind), FD(fd) {
 assert(isa(fd) || isa(fd));
   }
@@ -616,7 +616,7 @@ class BlockCodeRegion : public CodeTextR
   CanQualType locTy;
 
   BlockCodeRegion(const BlockDecl *bd, CanQualType lTy,
-  AnalysisDeclContext *ac, const MemRegion* sreg)
+  AnalysisDeclContext *ac, const CodeSpaceRegion* sreg)
   : CodeTextRegion(sreg, BlockCodeRegionKind), BD(bd), AC(ac), locTy(lTy) {
 assert(bd);
 assert(ac);
@@ -663,11 +663,14 @@ class BlockDataRegion : public TypedRegi
   void *OriginalVars;
 
   BlockDataRegion(const BlockCodeRegion *bc, const LocationContext *lc,
-  unsigned count, const MemRegion *sreg)
+  unsigned count, const MemSpaceRegion *sreg)
   : TypedRegion(sreg, BlockDataRegionKind), BC(bc), LC(lc),
 BlockCount(count), ReferencedVars(nullptr), OriginalVars(nullptr) {
 assert(bc);
 assert(lc);
+assert(isa(sreg) ||
+   isa(sreg) ||
+   isa(sreg));
   }
 
   static void ProfileRegion(llvm::FoldingSetNodeID&, const BlockCodeRegion *,
@@ -741,12 +744,13 @@ class SymbolicRegion : public SubRegion
 
   const SymbolRef sym;
 
-  SymbolicRegion(const SymbolRef s, const MemRegion *sreg)
+  SymbolicRegion(const SymbolRef s, const MemSpaceRegion *sreg)
   : SubRegion(sreg, SymbolicRegionKind), sym(s) {
 assert(s);
 assert(s->getType()->isAnyPointerType() ||
s->getType()->isReferenceType() ||
s->getType()->isBlockPointerType());
+assert(isa(sreg) || isa(sreg));
   }
 
 public:
@@ -777,7 +781,7 @@ class StringRegion : public TypedValueRe
 
   const StringLiteral* Str;
 
-  StringRegion(const StringLiteral *str, const MemRegion *sreg)
+  StringRegion(const StringLiteral *str, const GlobalInternalSpaceRegion *sreg)
   : TypedValueRegion(sreg, StringRegionKind), Str(str) {
 assert(str);
   }
@@ -815,7 +819,8 @@ class ObjCStringRegion : public TypedVal
 
   const ObjCStringLiteral* Str;
 
-  ObjCStringRegion(const ObjCStringLiteral *str, const MemRegion *sreg)
+  ObjCStringRegion(const ObjCStringLiteral *str,
+   const GlobalInternalSpaceRegion *sreg)
   : TypedValueRegion(sreg, ObjCStringRegionKind), Str(str) {
 assert(str);
   }
@@ -853,9 +858,12 @@ class CompoundLiteralRegion : public Typ
 
   const CompoundLiteralExpr *CL;
 
-  CompoundLiteralRegion(const CompoundLiteralExpr *cl, const MemRegion *sReg)
+  

[PATCH] D31562: [coroutines] Fix building of new/delete expressions when get_return_object_on_allocation_failure() is present.

2017-04-13 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov added inline comments.



Comment at: lib/Sema/CoroutineBuilder.h:1
+//===- CoroutineBuilder.h - Coroutine Semantic checking -*- C++ 
-*-===//
+//

This file is called:

  CoroutineStmtBuilder.h

in trunk



Comment at: lib/Sema/CoroutineBuilder.h:14
+
+#ifndef LLVM_CLANG_LIB_SEMA_COROUTINEBUILDER_H
+#define LLVM_CLANG_LIB_SEMA_COROUTINEBUILDER_H

```
#ifndef LLVM_CLANG_LIB_SEMA_COROUTINESTMTBUILDER_H
#define LLVM_CLANG_LIB_SEMA_COROUTINESTMTBUILDER_H
```


https://reviews.llvm.org/D31562



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


[PATCH] D31992: [clangd] Escape only necessary characters in JSON output

2017-04-13 Thread Joerg Sonnenberger via Phabricator via cfe-commits
joerg added a comment.

I'm strongly against this patch. Can you give an actual test case for the 
problematic behavior?


Repository:
  rL LLVM

https://reviews.llvm.org/D31992



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


[PATCH] D31992: [clangd] Escape only necessary characters in JSON output

2017-04-13 Thread Manuel Klimek via Phabricator via cfe-commits
klimek added inline comments.



Comment at: clangd/Protocol.cpp:26-50
+  for (llvm::StringRef::iterator i = Input.begin(), e = Input.end(); i != e; 
++i) {
+if (*i == '\\')
+  EscapedInput += "";
+else if (*i == '"')
+  EscapedInput += "\\\"";
+// bell
+else if (*i == 0x07)

For json we only need the first 2 though, right?


Repository:
  rL LLVM

https://reviews.llvm.org/D31992



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


[PATCH] D31992: [clangd] Escape only necessary characters in JSON output

2017-04-13 Thread Marc-Andre Laperle via Phabricator via cfe-commits
malaperle-ericsson added a comment.

In https://reviews.llvm.org/D31992#725866, @krasimir wrote:

> Seems that we're starting to hit some YAML/JSON mismatches, or is it that 
> your YAML string support is lacking?


I don't think so. It seems like JSON and YAML are not completely aligned on 
escaped characters. See http://yaml.org/spec/1.2/spec.html#id2776092 which 
specifies unicode 8, 16, and 32 bits are escaped with \x, \u, and \U whereas 
http://www.json.org/string.gif specifies that unicode 16 bit characters can be 
encoded with \u but \x and \U are not supported. This leads me to believe that 
a YAML parser can read JSON but a JSON parser will not necessarily be able to 
read YAML. I thought about using json cpp but that's a much bigger change


Repository:
  rL LLVM

https://reviews.llvm.org/D31992



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


[PATCH] D31976: Avoid assert when a non-static member function is qualified with __unaligned

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

This seems reasonable to me, but you should wait for confirmation before 
committing (I'm not as familiar with the mangler as others are).




Comment at: test/CodeGenCXX/unaligned-duplicated-mangle-name.cpp:16
+void A::foo() // expected-error {{definition with same mangled name as another 
definition}}
+  // expected-note@-6 {{previous definition is here}}
+{

Might as well put this note with the declaration rather than using an offset 
for the message.


https://reviews.llvm.org/D31976



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


[PATCH] D31992: [clangd] Escape only necessary characters in JSON output

2017-04-13 Thread Manuel Klimek via Phabricator via cfe-commits
klimek added a comment.

In https://reviews.llvm.org/D31992#725912, @malaperle-ericsson wrote:

> In https://reviews.llvm.org/D31992#725866, @krasimir wrote:
>
> > Seems that we're starting to hit some YAML/JSON mismatches, or is it that 
> > your YAML string support is lacking?
>
>
> I don't think so. It seems like JSON and YAML are not completely aligned on 
> escaped characters. See http://yaml.org/spec/1.2/spec.html#id2776092 which 
> specifies unicode 8, 16, and 32 bits are escaped with \x, \u, and \U whereas 
> http://www.json.org/string.gif specifies that unicode 16 bit characters can 
> be encoded with \u but \x and \U are not supported. This leads me to believe 
> that a YAML parser can read JSON but a JSON parser will not necessarily be 
> able to read YAML. I thought about using json cpp but that's a much bigger 
> change


Here we only talk about what we escape, which should be the minimum required.
If I understand correctly, that's " and \ for JSON and ", \ and all 
non-printable characters (which unfortunately requires understanding of unicode 
to solve this fully correctly) in YAML.
Am I missing something?


Repository:
  rL LLVM

https://reviews.llvm.org/D31992



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


r300295 - [docs] UBSan: Mention that print_stacktrace=1 is unsupported on Darwin

2017-04-13 Thread Vedant Kumar via cfe-commits
Author: vedantk
Date: Thu Apr 13 20:59:44 2017
New Revision: 300295

URL: http://llvm.org/viewvc/llvm-project?rev=300295=rev
Log:
[docs] UBSan: Mention that print_stacktrace=1 is unsupported on Darwin

Printing out stack traces along with UBSan diagnostics is unsupported on
Darwin. That's because it isn't possible to use the fast unwinder or the
slow unwinder.

Apparently, it's inappropriate to use the fast unwinder for UBSan
issues. I'm not exactly sure why (see the comment in ubsan_diag.cc).
Forcing use of the fast unwinder produces decent results, AFAICT.

Darwin also does not appear to have a slow unwinder suitable for use
with the sanitizers. Apparently that's because of PR20800 [1][2]. But
that bug has been fixed. I'm not sure if there is anything preventing
use of the slow unwinder now.

Currently, passing UBSAN_OPTIONS=print_stacktrace=1 does nothing on
Darwin. This isn't good, but it might be a while before we can fix the
situation, so we should at least document it.

[1] https://github.com/google/sanitizers/issues/137
"We can't use the slow unwinder on OSX now, because Clang produces
incorrect unwind info for the ASan runtime functions on OSX
(http://llvm.org/PR20800)."

[2] https://bugs.llvm.org/show_bug.cgi?id=20800
Bug 20800 - Invalid compact unwind info generated for a function without
frame pointers on OSX

Modified:
cfe/trunk/docs/UndefinedBehaviorSanitizer.rst

Modified: cfe/trunk/docs/UndefinedBehaviorSanitizer.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/UndefinedBehaviorSanitizer.rst?rev=300295=300294=300295=diff
==
--- cfe/trunk/docs/UndefinedBehaviorSanitizer.rst (original)
+++ cfe/trunk/docs/UndefinedBehaviorSanitizer.rst Thu Apr 13 20:59:44 2017
@@ -157,6 +157,8 @@ will need to:
``UBSAN_OPTIONS=print_stacktrace=1``.
 #. Make sure ``llvm-symbolizer`` binary is in ``PATH``.
 
+Stacktrace printing for UBSan issues is currently not supported on Darwin.
+
 Issue Suppression
 =
 


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


[PATCH] D31482: [AMDGPU][GFX9] Set +fp32-denormals for >=gfx900 unless -cl-denorms-are-zero is set

2017-04-13 Thread Konstantin Zhuravlyov via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
kzhuravl marked 2 inline comments as done.
Closed by commit rL300306: [AMDGPU][GFX9] Set +fp32-denormals for >=gfx900 
unless -cl-denorms-are-zero is… (authored by kzhuravl).

Changed prior to commit:
  https://reviews.llvm.org/D31482?vs=93422=95270#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D31482

Files:
  cfe/trunk/lib/Basic/Targets.cpp
  cfe/trunk/test/CodeGenOpenCL/gfx9-fp32-denorms.cl


Index: cfe/trunk/test/CodeGenOpenCL/gfx9-fp32-denorms.cl
===
--- cfe/trunk/test/CodeGenOpenCL/gfx9-fp32-denorms.cl
+++ cfe/trunk/test/CodeGenOpenCL/gfx9-fp32-denorms.cl
@@ -0,0 +1,13 @@
+// REQUIRES: amdgpu-registered-target
+
+// RUN: %clang_cc1 -triple amdgcn-unknown-unknown -target-cpu gfx900 -S 
-emit-llvm -o - %s | FileCheck --check-prefix=DEFAULT %s
+// RUN: %clang_cc1 -triple amdgcn-unknown-unknown -target-cpu gfx900 -S 
-emit-llvm -o - -target-feature +fp32-denormals %s | FileCheck 
--check-prefix=FEATURE_FP32_DENORMALS_ON %s
+// RUN: %clang_cc1 -triple amdgcn-unknown-unknown -target-cpu gfx900 -S 
-emit-llvm -o - -target-feature -fp32-denormals %s | FileCheck 
--check-prefix=FEATURE_FP32_DENORMALS_OFF %s
+// RUN: %clang_cc1 -triple amdgcn-unknown-unknown -target-cpu gfx900 -S 
-emit-llvm -o - -cl-denorms-are-zero %s | FileCheck 
--check-prefix=OPT_DENORMS_ARE_ZERO %s
+
+// DEFAULT: +fp32-denormals
+// FEATURE_FP32_DENORMALS_ON: +fp32-denormals
+// FEATURE_FP32_DENORMALS_OFF: -fp32-denormals
+// OPT_DENORMS_ARE_ZERO: -fp32-denormals
+
+kernel void gfx9_fp32_denorms() {}
Index: cfe/trunk/lib/Basic/Targets.cpp
===
--- cfe/trunk/lib/Basic/Targets.cpp
+++ cfe/trunk/lib/Basic/Targets.cpp
@@ -2112,9 +2112,12 @@
   bool hasFP64:1;
   bool hasFMAF:1;
   bool hasLDEXPF:1;
-  bool hasFullSpeedFP32Denorms:1;
   const AddrSpace AS;
 
+  static bool hasFullSpeedFMAF32(StringRef GPUName) {
+return parseAMDGCNName(GPUName) >= GK_GFX9;
+  }
+
   static bool isAMDGCN(const llvm::Triple ) {
 return TT.getArch() == llvm::Triple::amdgcn;
   }
@@ -2130,7 +2133,6 @@
   hasFP64(false),
   hasFMAF(false),
   hasLDEXPF(false),
-  hasFullSpeedFP32Denorms(false),
   AS(isGenericZero(Triple)){
 if (getTriple().getArch() == llvm::Triple::amdgcn) {
   hasFP64 = true;
@@ -2200,7 +2202,8 @@
 hasFP64Denormals = true;
 }
 if (!hasFP32Denormals)
-  TargetOpts.Features.push_back((Twine(hasFullSpeedFP32Denorms &&
+  TargetOpts.Features.push_back(
+  (Twine(hasFullSpeedFMAF32(TargetOpts.CPU) &&
   !CGOpts.FlushDenorm ? '+' : '-') + Twine("fp32-denormals")).str());
 // Always do not flush fp64 or fp16 denorms.
 if (!hasFP64Denormals && hasFP64)


Index: cfe/trunk/test/CodeGenOpenCL/gfx9-fp32-denorms.cl
===
--- cfe/trunk/test/CodeGenOpenCL/gfx9-fp32-denorms.cl
+++ cfe/trunk/test/CodeGenOpenCL/gfx9-fp32-denorms.cl
@@ -0,0 +1,13 @@
+// REQUIRES: amdgpu-registered-target
+
+// RUN: %clang_cc1 -triple amdgcn-unknown-unknown -target-cpu gfx900 -S -emit-llvm -o - %s | FileCheck --check-prefix=DEFAULT %s
+// RUN: %clang_cc1 -triple amdgcn-unknown-unknown -target-cpu gfx900 -S -emit-llvm -o - -target-feature +fp32-denormals %s | FileCheck --check-prefix=FEATURE_FP32_DENORMALS_ON %s
+// RUN: %clang_cc1 -triple amdgcn-unknown-unknown -target-cpu gfx900 -S -emit-llvm -o - -target-feature -fp32-denormals %s | FileCheck --check-prefix=FEATURE_FP32_DENORMALS_OFF %s
+// RUN: %clang_cc1 -triple amdgcn-unknown-unknown -target-cpu gfx900 -S -emit-llvm -o - -cl-denorms-are-zero %s | FileCheck --check-prefix=OPT_DENORMS_ARE_ZERO %s
+
+// DEFAULT: +fp32-denormals
+// FEATURE_FP32_DENORMALS_ON: +fp32-denormals
+// FEATURE_FP32_DENORMALS_OFF: -fp32-denormals
+// OPT_DENORMS_ARE_ZERO: -fp32-denormals
+
+kernel void gfx9_fp32_denorms() {}
Index: cfe/trunk/lib/Basic/Targets.cpp
===
--- cfe/trunk/lib/Basic/Targets.cpp
+++ cfe/trunk/lib/Basic/Targets.cpp
@@ -2112,9 +2112,12 @@
   bool hasFP64:1;
   bool hasFMAF:1;
   bool hasLDEXPF:1;
-  bool hasFullSpeedFP32Denorms:1;
   const AddrSpace AS;
 
+  static bool hasFullSpeedFMAF32(StringRef GPUName) {
+return parseAMDGCNName(GPUName) >= GK_GFX9;
+  }
+
   static bool isAMDGCN(const llvm::Triple ) {
 return TT.getArch() == llvm::Triple::amdgcn;
   }
@@ -2130,7 +2133,6 @@
   hasFP64(false),
   hasFMAF(false),
   hasLDEXPF(false),
-  hasFullSpeedFP32Denorms(false),
   AS(isGenericZero(Triple)){
 if (getTriple().getArch() == llvm::Triple::amdgcn) {
   hasFP64 = true;
@@ -2200,7 +2202,8 @@
 hasFP64Denormals = true;
 }
 if (!hasFP32Denormals)
-  TargetOpts.Features.push_back((Twine(hasFullSpeedFP32Denorms &&
+  TargetOpts.Features.push_back(
+  

r300306 - [AMDGPU][GFX9] Set +fp32-denormals for >=gfx900 unless -cl-denorms-are-zero is set

2017-04-13 Thread Konstantin Zhuravlyov via cfe-commits
Author: kzhuravl
Date: Fri Apr 14 00:33:57 2017
New Revision: 300306

URL: http://llvm.org/viewvc/llvm-project?rev=300306=rev
Log:
[AMDGPU][GFX9] Set +fp32-denormals for >=gfx900 unless -cl-denorms-are-zero is 
set

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

Added:
cfe/trunk/test/CodeGenOpenCL/gfx9-fp32-denorms.cl
Modified:
cfe/trunk/lib/Basic/Targets.cpp

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=300306=300305=300306=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Fri Apr 14 00:33:57 2017
@@ -2112,9 +2112,12 @@ class AMDGPUTargetInfo final : public Ta
   bool hasFP64:1;
   bool hasFMAF:1;
   bool hasLDEXPF:1;
-  bool hasFullSpeedFP32Denorms:1;
   const AddrSpace AS;
 
+  static bool hasFullSpeedFMAF32(StringRef GPUName) {
+return parseAMDGCNName(GPUName) >= GK_GFX9;
+  }
+
   static bool isAMDGCN(const llvm::Triple ) {
 return TT.getArch() == llvm::Triple::amdgcn;
   }
@@ -2130,7 +2133,6 @@ public:
   hasFP64(false),
   hasFMAF(false),
   hasLDEXPF(false),
-  hasFullSpeedFP32Denorms(false),
   AS(isGenericZero(Triple)){
 if (getTriple().getArch() == llvm::Triple::amdgcn) {
   hasFP64 = true;
@@ -2200,7 +2202,8 @@ public:
 hasFP64Denormals = true;
 }
 if (!hasFP32Denormals)
-  TargetOpts.Features.push_back((Twine(hasFullSpeedFP32Denorms &&
+  TargetOpts.Features.push_back(
+  (Twine(hasFullSpeedFMAF32(TargetOpts.CPU) &&
   !CGOpts.FlushDenorm ? '+' : '-') + Twine("fp32-denormals")).str());
 // Always do not flush fp64 or fp16 denorms.
 if (!hasFP64Denormals && hasFP64)

Added: cfe/trunk/test/CodeGenOpenCL/gfx9-fp32-denorms.cl
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenOpenCL/gfx9-fp32-denorms.cl?rev=300306=auto
==
--- cfe/trunk/test/CodeGenOpenCL/gfx9-fp32-denorms.cl (added)
+++ cfe/trunk/test/CodeGenOpenCL/gfx9-fp32-denorms.cl Fri Apr 14 00:33:57 2017
@@ -0,0 +1,13 @@
+// REQUIRES: amdgpu-registered-target
+
+// RUN: %clang_cc1 -triple amdgcn-unknown-unknown -target-cpu gfx900 -S 
-emit-llvm -o - %s | FileCheck --check-prefix=DEFAULT %s
+// RUN: %clang_cc1 -triple amdgcn-unknown-unknown -target-cpu gfx900 -S 
-emit-llvm -o - -target-feature +fp32-denormals %s | FileCheck 
--check-prefix=FEATURE_FP32_DENORMALS_ON %s
+// RUN: %clang_cc1 -triple amdgcn-unknown-unknown -target-cpu gfx900 -S 
-emit-llvm -o - -target-feature -fp32-denormals %s | FileCheck 
--check-prefix=FEATURE_FP32_DENORMALS_OFF %s
+// RUN: %clang_cc1 -triple amdgcn-unknown-unknown -target-cpu gfx900 -S 
-emit-llvm -o - -cl-denorms-are-zero %s | FileCheck 
--check-prefix=OPT_DENORMS_ARE_ZERO %s
+
+// DEFAULT: +fp32-denormals
+// FEATURE_FP32_DENORMALS_ON: +fp32-denormals
+// FEATURE_FP32_DENORMALS_OFF: -fp32-denormals
+// OPT_DENORMS_ARE_ZERO: -fp32-denormals
+
+kernel void gfx9_fp32_denorms() {}


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


r300303 - clang/test/CoverageMapping/unused_names.c: Relax an expression for targeting PECOFF.

2017-04-13 Thread NAKAMURA Takumi via cfe-commits
Author: chapuni
Date: Thu Apr 13 22:16:48 2017
New Revision: 300303

URL: http://llvm.org/viewvc/llvm-project?rev=300303=rev
Log:
clang/test/CoverageMapping/unused_names.c: Relax an expression for targeting 
PECOFF.

Modified:
cfe/trunk/test/CoverageMapping/unused_names.c

Modified: cfe/trunk/test/CoverageMapping/unused_names.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CoverageMapping/unused_names.c?rev=300303=300302=300303=diff
==
--- cfe/trunk/test/CoverageMapping/unused_names.c (original)
+++ cfe/trunk/test/CoverageMapping/unused_names.c Thu Apr 13 22:16:48 2017
@@ -3,7 +3,7 @@
 // RUN: FileCheck -check-prefix=SYSHEADER -input-file %t %s
 
 // CHECK-DAG: @__profc_bar
-// CHECK-DAG: @__llvm_prf_nm = private constant {{.*}}, section 
"{{.*}}__llvm_prf_names"
+// CHECK-DAG: @__llvm_prf_nm = private constant {{.*}}, section 
"{{.*__llvm_prf_names|.*lprfn}}"
 
 // These are never instantiated, so we shouldn't get counters for them.
 //


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


Re: r300303 - clang/test/CoverageMapping/unused_names.c: Relax an expression for targeting PECOFF.

2017-04-13 Thread NAKAMURA Takumi via cfe-commits
Could you confirm if it is right fix?

On Fri, Apr 14, 2017 at 12:29 PM NAKAMURA Takumi via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: chapuni
> Date: Thu Apr 13 22:16:48 2017
> New Revision: 300303
>
> URL: http://llvm.org/viewvc/llvm-project?rev=300303=rev
> Log:
> clang/test/CoverageMapping/unused_names.c: Relax an expression for
> targeting PECOFF.
>
> Modified:
> cfe/trunk/test/CoverageMapping/unused_names.c
>
> Modified: cfe/trunk/test/CoverageMapping/unused_names.c
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CoverageMapping/unused_names.c?rev=300303=300302=300303=diff
>
> ==
> --- cfe/trunk/test/CoverageMapping/unused_names.c (original)
> +++ cfe/trunk/test/CoverageMapping/unused_names.c Thu Apr 13 22:16:48 2017
> @@ -3,7 +3,7 @@
>  // RUN: FileCheck -check-prefix=SYSHEADER -input-file %t %s
>
>  // CHECK-DAG: @__profc_bar
> -// CHECK-DAG: @__llvm_prf_nm = private constant {{.*}}, section
> "{{.*}}__llvm_prf_names"
> +// CHECK-DAG: @__llvm_prf_nm = private constant {{.*}}, section
> "{{.*__llvm_prf_names|.*lprfn}}"
>
>  // These are never instantiated, so we shouldn't get counters for them.
>  //
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D32029: [ObjC] Fix lifetime markers of loop variable in EmitObjCForCollectionStmt

2017-04-13 Thread Kuba (Brecka) Mracek via Phabricator via cfe-commits
kubamracek reopened this revision.
kubamracek added a comment.
This revision is now accepted and ready to land.

Reverted because this fails for-in.m by crashing the compiler when compiling:

  void t2(NSArray *array) {
for (NSArray *array in array) { // expected-warning {{collection expression 
type 'NSArray *' may not respond}}
}
  }


Repository:
  rL LLVM

https://reviews.llvm.org/D32029



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


r300301 - Remove unused function /nfc

2017-04-13 Thread Xinliang David Li via cfe-commits
Author: davidxl
Date: Thu Apr 13 22:01:25 2017
New Revision: 300301

URL: http://llvm.org/viewvc/llvm-project?rev=300301=rev
Log:
Remove unused function /nfc

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

Modified: cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp?rev=300301=300300=300301=diff
==
--- cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp (original)
+++ cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp Thu Apr 13 22:01:25 2017
@@ -961,10 +961,6 @@ struct CounterCoverageMappingBuilder
   }
 };
 
-bool isMachO(const CodeGenModule ) {
-  return CGM.getTarget().getTriple().isOSBinFormatMachO();
-}
-
 StringRef getCoverageSection(const CodeGenModule ) {
   return llvm::getInstrProfCoverageSectionName(());
 }


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


[PATCH] D32063: [clang-move] cleanup: create ClangMoveActionFactory on the stack

2017-04-13 Thread Haojian Wu via Phabricator via cfe-commits
hokein accepted this revision.
hokein added a comment.
This revision is now accepted and ready to land.

LGTM, thanks for the cleanup ;)


Repository:
  rL LLVM

https://reviews.llvm.org/D32063



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


[PATCH] D31757: [clang-tidy] Add a clang-tidy check for possible inefficient vector operations

2017-04-13 Thread Haojian Wu via Phabricator via cfe-commits
hokein added inline comments.



Comment at: clang-tidy/performance/InefficientVectorOperationCheck.cpp:109-111
+  auto AllVectorVarRefs = utils::decl_ref_expr::allDeclRefExprs(
+  *VectorVarDecl, *LoopParent, *Result.Context);
+  for (const auto *Ref : AllVectorVarRefs) {

aaron.ballman wrote:
> aaron.ballman wrote:
> > I'm not certain what types are being used here. Can you turn 
> > `AllVectorVarRefs` into something with an explicit type so that I can know 
> > what `Ref`'s type is?
> I may not have been clear -- I don't mean that the variable name should 
> contain type information, I mean that the type should not be automatically 
> deduced. We only use `auto` when the type is spelled explicitly in the 
> initialization or is otherwise obvious from context (like range-based for 
> loops).
I'd prefer to use `auto` to initialize `AllVectorVarRefExprs`, as its type is 
`SmallPtrSet`, which is a long and noisy name. Using 
`auto` can increases readability here.


https://reviews.llvm.org/D31757



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


[PATCH] D32029: [ObjC] Fix lifetime markers of loop variable in EmitObjCForCollectionStmt

2017-04-13 Thread Kuba (Brecka) Mracek via Phabricator via cfe-commits
kubamracek updated this revision to Diff 95271.
kubamracek added a comment.

Trying a different approach:  Keeping the loop variable alive for the whole 
loop by extending ForScope and registering the cleanup function inside 
EmitAutoVarAlloca.


https://reviews.llvm.org/D32029

Files:
  lib/CodeGen/CGDecl.cpp
  lib/CodeGen/CGObjC.cpp
  test/CodeGenObjC/arc-blocks.m
  test/CodeGenObjCXX/arc-references.mm

Index: test/CodeGenObjCXX/arc-references.mm
===
--- test/CodeGenObjCXX/arc-references.mm
+++ test/CodeGenObjCXX/arc-references.mm
@@ -21,7 +21,7 @@
   // CHECK: call void @_Z6calleev
   callee();
   // CHECK: call void @objc_release
-  // CHECK-NEXT: ret
+  // CHECK: ret
 }
 
 // No lifetime extension when we're binding a reference to an lvalue.
@@ -44,9 +44,9 @@
   const __weak id  = strong_id();
   // CHECK-NEXT: call void @_Z6calleev()
   callee();
+  // CHECK-NEXT: call void @objc_destroyWeak
   // CHECK-NEXT: [[PTR:%.*]] = bitcast i8*** [[REF]] to i8*
   // CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 8, i8* [[PTR]])
-  // CHECK-NEXT: call void @objc_destroyWeak
   // CHECK-NEXT: ret void
 }
 
Index: test/CodeGenObjC/arc-blocks.m
===
--- test/CodeGenObjC/arc-blocks.m
+++ test/CodeGenObjC/arc-blocks.m
@@ -532,16 +532,16 @@
   // CHECK-NEXT: [[T0:%.*]] = load void ()*, void ()** [[B]]
   // CHECK-NEXT: [[T1:%.*]] = bitcast void ()* [[T0]] to i8*
   // CHECK-NEXT: call void @objc_release(i8* [[T1]])
-  // CHECK-NEXT: [[BPTR2:%.*]] = bitcast void ()** [[B]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 8, i8* [[BPTR2]])
 
   // CHECK-NEXT: [[T0:%.*]] = load i1, i1* [[CLEANUP_ACTIVE]]
   // CHECK-NEXT: br i1 [[T0]]
   // CHECK:  [[T0:%.*]] = load i8*, i8** [[CLEANUP_ADDR]]
   // CHECK-NEXT: call void @objc_release(i8* [[T0]])
   // CHECK-NEXT: br label
 
-  // CHECK:  [[T0:%.*]] = load i8*, i8** [[X]]
+  // CHECK:  [[BPTR2:%.*]] = bitcast void ()** [[B]] to i8*
+  // CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 8, i8* [[BPTR2]])
+  // CHECK-NEXT:  [[T0:%.*]] = load i8*, i8** [[X]]
   // CHECK-NEXT: call void @objc_release(i8* [[T0]])
   // CHECK-NEXT: ret void
 }
Index: lib/CodeGen/CGObjC.cpp
===
--- lib/CodeGen/CGObjC.cpp
+++ lib/CodeGen/CGObjC.cpp
@@ -1469,6 +1469,8 @@
   if (DI)
 DI->EmitLexicalBlockStart(Builder, S.getSourceRange().getBegin());
 
+  RunCleanupsScope ForScope(*this);
+
   // The local variable comes into scope immediately.
   AutoVarEmission variable = AutoVarEmission::invalid();
   if (const DeclStmt *SD = dyn_cast(S.getElement()))
@@ -1499,8 +1501,6 @@
   ArrayType::Normal, 0);
   Address ItemsPtr = CreateMemTemp(ItemsTy, "items.ptr");
 
-  RunCleanupsScope ForScope(*this);
-
   // Emit the collection pointer.  In ARC, we do a retain.
   llvm::Value *Collection;
   if (getLangOpts().ObjCAutoRefCount) {
Index: lib/CodeGen/CGDecl.cpp
===
--- lib/CodeGen/CGDecl.cpp
+++ lib/CodeGen/CGDecl.cpp
@@ -1118,6 +1118,12 @@
   if (D.hasAttr())
 EmitVarAnnotations(, address.getPointer());
 
+  // Make sure we call @llvm.lifetime.end.
+  if (emission.useLifetimeMarkers())
+EHStack.pushCleanup(NormalEHLifetimeMarker,
+ emission.getAllocatedAddress(),
+ emission.getSizeForLifetimeMarkers());
+
   return emission;
 }
 
@@ -1408,13 +1414,6 @@
 
   const VarDecl  = *emission.Variable;
 
-  // Make sure we call @llvm.lifetime.end.  This needs to happen
-  // *last*, so the cleanup needs to be pushed *first*.
-  if (emission.useLifetimeMarkers())
-EHStack.pushCleanup(NormalEHLifetimeMarker,
- emission.getAllocatedAddress(),
- emission.getSizeForLifetimeMarkers());
-
   // Check the type for a cleanup.
   if (QualType::DestructionKind dtorKind = D.getType().isDestructedType())
 emitAutoVarTypeCleanup(emission, dtorKind);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r300296 - Remove empty test directory for nonexistent standard clause.

2017-04-13 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Thu Apr 13 21:04:44 2017
New Revision: 300296

URL: http://llvm.org/viewvc/llvm-project?rev=300296=rev
Log:
Remove empty test directory for nonexistent standard clause.

Removed:
cfe/trunk/test/CXX/garbage.collection/

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


Re: r300295 - [docs] UBSan: Mention that print_stacktrace=1 is unsupported on Darwin

2017-04-13 Thread Vedant Kumar via cfe-commits
Does anyone know what it would take to get the slow unwinder to work on Darwin?

thanks,
vedant

> On Apr 13, 2017, at 6:59 PM, Vedant Kumar via cfe-commits 
>  wrote:
> 
> Author: vedantk
> Date: Thu Apr 13 20:59:44 2017
> New Revision: 300295
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=300295=rev
> Log:
> [docs] UBSan: Mention that print_stacktrace=1 is unsupported on Darwin
> 
> Printing out stack traces along with UBSan diagnostics is unsupported on
> Darwin. That's because it isn't possible to use the fast unwinder or the
> slow unwinder.
> 
> Apparently, it's inappropriate to use the fast unwinder for UBSan
> issues. I'm not exactly sure why (see the comment in ubsan_diag.cc).
> Forcing use of the fast unwinder produces decent results, AFAICT.
> 
> Darwin also does not appear to have a slow unwinder suitable for use
> with the sanitizers. Apparently that's because of PR20800 [1][2]. But
> that bug has been fixed. I'm not sure if there is anything preventing
> use of the slow unwinder now.
> 
> Currently, passing UBSAN_OPTIONS=print_stacktrace=1 does nothing on
> Darwin. This isn't good, but it might be a while before we can fix the
> situation, so we should at least document it.
> 
> [1] https://github.com/google/sanitizers/issues/137
> "We can't use the slow unwinder on OSX now, because Clang produces
> incorrect unwind info for the ASan runtime functions on OSX
> (http://llvm.org/PR20800)."
> 
> [2] https://bugs.llvm.org/show_bug.cgi?id=20800
> Bug 20800 - Invalid compact unwind info generated for a function without
> frame pointers on OSX
> 
> Modified:
>cfe/trunk/docs/UndefinedBehaviorSanitizer.rst
> 
> Modified: cfe/trunk/docs/UndefinedBehaviorSanitizer.rst
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/UndefinedBehaviorSanitizer.rst?rev=300295=300294=300295=diff
> ==
> --- cfe/trunk/docs/UndefinedBehaviorSanitizer.rst (original)
> +++ cfe/trunk/docs/UndefinedBehaviorSanitizer.rst Thu Apr 13 20:59:44 2017
> @@ -157,6 +157,8 @@ will need to:
>``UBSAN_OPTIONS=print_stacktrace=1``.
> #. Make sure ``llvm-symbolizer`` binary is in ``PATH``.
> 
> +Stacktrace printing for UBSan issues is currently not supported on Darwin.
> +
> Issue Suppression
> =
> 
> 
> 
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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


r300304 - Fix use after free error

2017-04-13 Thread Xinliang David Li via cfe-commits
Author: davidxl
Date: Thu Apr 13 23:14:29 2017
New Revision: 300304

URL: http://llvm.org/viewvc/llvm-project?rev=300304=rev
Log:
Fix use after free error

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

Modified: cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp?rev=300304=300303=300304=diff
==
--- cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp (original)
+++ cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp Thu Apr 13 23:14:29 2017
@@ -961,7 +961,7 @@ struct CounterCoverageMappingBuilder
   }
 };
 
-StringRef getCoverageSection(const CodeGenModule ) {
+std::string getCoverageSection(const CodeGenModule ) {
   return llvm::getInstrProfCoverageSectionName(());
 }
 


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


  1   2   >