[PATCH] Fix stack overflow in MSVC unqualified type lookup logic

2016-05-27 Thread Will Wilson via cfe-commits
Hi Alexey,

A customer encountered a stack overflow in the code from r229817. I've
created a small repro for testing the issue and a fix. The fix should also
better deal with lookup into partially specialized base templates.

Test case included and tested against latest trunk.

Let me know if it looks acceptable!

Cheers,
Will.

-- 
*Indefiant *: http://www.indefiant.com
Home of Recode : Runtime C++ Editing for VS


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


Re: [PATCH] D20451: [Parser] Fix look ahead after EOF while parsing objc message and lambdas

2016-05-27 Thread Doug Gregor via cfe-commits
doug.gregor accepted this revision.
doug.gregor added a comment.
This revision is now accepted and ready to land.

LGTM, sorry for the delay!


http://reviews.llvm.org/D20451



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


[PATCH] D20766: [clang-tidy] Fix script adding new clang-tidy check

2016-05-27 Thread Etienne Bergeron via cfe-commits
etienneb created this revision.
etienneb added a reviewer: alexfh.
etienneb added a subscriber: cfe-commits.

The `getName()` call is useless. It's better to show a better example
as tutorial.

http://reviews.llvm.org/D20766

Files:
  clang-tidy/add_new_check.py

Index: clang-tidy/add_new_check.py
===
--- clang-tidy/add_new_check.py
+++ clang-tidy/add_new_check.py
@@ -138,7 +138,7 @@
   if (MatchedDecl->getName().startswith("awesome_"))
 return;
   diag(MatchedDecl->getLocation(), "function '%%0' is insufficiently awesome")
-  << MatchedDecl->getName()
+  << MatchedDecl
   << FixItHint::CreateInsertion(MatchedDecl->getLocation(), "awesome_");
 }
 


Index: clang-tidy/add_new_check.py
===
--- clang-tidy/add_new_check.py
+++ clang-tidy/add_new_check.py
@@ -138,7 +138,7 @@
   if (MatchedDecl->getName().startswith("awesome_"))
 return;
   diag(MatchedDecl->getLocation(), "function '%%0' is insufficiently awesome")
-  << MatchedDecl->getName()
+  << MatchedDecl
   << FixItHint::CreateInsertion(MatchedDecl->getLocation(), "awesome_");
 }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r271080 - AMDGPU: Add fract builtin

2016-05-27 Thread Matt Arsenault via cfe-commits
Author: arsenm
Date: Fri May 27 19:43:27 2016
New Revision: 271080

URL: http://llvm.org/viewvc/llvm-project?rev=271080=rev
Log:
AMDGPU: Add fract builtin

Modified:
cfe/trunk/include/clang/Basic/BuiltinsAMDGPU.def
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/test/CodeGenOpenCL/builtins-amdgcn.cl

Modified: cfe/trunk/include/clang/Basic/BuiltinsAMDGPU.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsAMDGPU.def?rev=271080=271079=271080=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsAMDGPU.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsAMDGPU.def Fri May 27 19:43:27 2016
@@ -38,6 +38,8 @@ BUILTIN(__builtin_amdgcn_frexp_mant, "dd
 BUILTIN(__builtin_amdgcn_frexp_mantf, "ff", "nc")
 BUILTIN(__builtin_amdgcn_frexp_exp, "id", "nc")
 BUILTIN(__builtin_amdgcn_frexp_expf, "if", "nc")
+BUILTIN(__builtin_amdgcn_fract, "dd", "nc")
+BUILTIN(__builtin_amdgcn_fractf, "ff", "nc")
 BUILTIN(__builtin_amdgcn_class, "bdi", "nc")
 BUILTIN(__builtin_amdgcn_classf, "bfi", "nc")
 BUILTIN(__builtin_amdgcn_cubeid, "", "nc")

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=271080=271079=271080=diff
==
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Fri May 27 19:43:27 2016
@@ -7129,6 +7129,9 @@ Value *CodeGenFunction::EmitAMDGPUBuilti
   case AMDGPU::BI__builtin_amdgcn_frexp_expf: {
 return emitUnaryBuiltin(*this, E, Intrinsic::amdgcn_frexp_exp);
   }
+  case AMDGPU::BI__builtin_amdgcn_fract:
+  case AMDGPU::BI__builtin_amdgcn_fractf:
+return emitUnaryBuiltin(*this, E, Intrinsic::amdgcn_fract);
   case AMDGPU::BI__builtin_amdgcn_class:
   case AMDGPU::BI__builtin_amdgcn_classf:
 return emitFPIntBuiltin(*this, E, Intrinsic::amdgcn_class);

Modified: cfe/trunk/test/CodeGenOpenCL/builtins-amdgcn.cl
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenOpenCL/builtins-amdgcn.cl?rev=271080=271079=271080=diff
==
--- cfe/trunk/test/CodeGenOpenCL/builtins-amdgcn.cl (original)
+++ cfe/trunk/test/CodeGenOpenCL/builtins-amdgcn.cl Fri May 27 19:43:27 2016
@@ -178,6 +178,20 @@ void test_frexp_exp_f64(global int* out,
   *out = __builtin_amdgcn_frexp_exp(a);
 }
 
+// CHECK-LABEL: @test_fract_f32
+// CHECK: call float @llvm.amdgcn.fract.f32
+void test_fract_f32(global int* out, float a)
+{
+  *out = __builtin_amdgcn_fractf(a);
+}
+
+// CHECK-LABEL: @test_fract_f64
+// CHECK: call double @llvm.amdgcn.fract.f64
+void test_fract_f64(global int* out, double a)
+{
+  *out = __builtin_amdgcn_fract(a);
+}
+
 // CHECK-LABEL: @test_class_f32
 // CHECK: call i1 @llvm.amdgcn.class.f32
 void test_class_f32(global float* out, float a, int b)


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


r271077 - Clean up: remove trailing spaces in x86 intrinsic headers.

2016-05-27 Thread Ekaterina Romanova via cfe-commits
Author: kromanova
Date: Fri May 27 19:18:59 2016
New Revision: 271077

URL: http://llvm.org/viewvc/llvm-project?rev=271077=rev
Log:
Clean up: remove trailing spaces in x86 intrinsic headers.

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


Modified:
cfe/trunk/lib/Headers/__wmmintrin_aes.h
cfe/trunk/lib/Headers/__wmmintrin_pclmul.h
cfe/trunk/lib/Headers/avx512fintrin.h
cfe/trunk/lib/Headers/avx512vldqintrin.h
cfe/trunk/lib/Headers/mwaitxintrin.h
cfe/trunk/lib/Headers/pmmintrin.h

Modified: cfe/trunk/lib/Headers/__wmmintrin_aes.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/__wmmintrin_aes.h?rev=271077=271076=271077=diff
==
--- cfe/trunk/lib/Headers/__wmmintrin_aes.h (original)
+++ cfe/trunk/lib/Headers/__wmmintrin_aes.h Fri May 27 19:18:59 2016
@@ -125,9 +125,9 @@ _mm_aesimc_si128(__m128i __V)
   return (__m128i)__builtin_ia32_aesimc128((__v2di)__V);
 }
 
-/// \brief Generates a round key for AES encyption, operating on 128-bit data 
+/// \brief Generates a round key for AES encyption, operating on 128-bit data
 ///specified in the first source operand and using an 8-bit round constant
-///specified by the second source operand, and writes the result to the 
+///specified by the second source operand, and writes the result to the
 ///destination.
 ///
 /// \headerfile 

Modified: cfe/trunk/lib/Headers/__wmmintrin_pclmul.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/__wmmintrin_pclmul.h?rev=271077=271076=271077=diff
==
--- cfe/trunk/lib/Headers/__wmmintrin_pclmul.h (original)
+++ cfe/trunk/lib/Headers/__wmmintrin_pclmul.h Fri May 27 19:18:59 2016
@@ -24,15 +24,15 @@
 #define _WMMINTRIN_PCLMUL_H
 
 /// \brief Multiplies two 64-bit integer values, which are selected from source
-///operands using the immediate-value operand. The multiplication is a 
+///operands using the immediate-value operand. The multiplication is a
 ///carry-less multiplication, and the 128-bit integer product is stored in
 ///the destination.
 ///
 /// \headerfile 
 ///
-/// \code 
+/// \code
 /// __m128i _mm_clmulepi64_si128(__m128i __X, __m128i __Y, const int __I);
-/// \endcode 
+/// \endcode
 ///
 /// This intrinsic corresponds to the \c VPCLMULQDQ instruction.
 ///

Modified: cfe/trunk/lib/Headers/avx512fintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512fintrin.h?rev=271077=271076=271077=diff
==
--- cfe/trunk/lib/Headers/avx512fintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512fintrin.h Fri May 27 19:18:59 2016
@@ -949,7 +949,7 @@ _mm_maskz_max_sd(__mmask8 __U,__m128d __
(__v2df)_mm_setzero_pd(), \
(__mmask8)(U), (int)(R)); })
 
-static __inline __m512i 
+static __inline __m512i
 __DEFAULT_FN_ATTRS
 _mm512_max_epi32(__m512i __A, __m512i __B)
 {
@@ -1508,7 +1508,7 @@ _mm_rsqrt14_ss(__m128 __A, __m128 __B)
 }
 
 static __inline__ __m128 __DEFAULT_FN_ATTRS
-_mm_mask_rsqrt14_ss (__m128 __W, __mmask8 __U, __m128 __A, __m128 __B) 
+_mm_mask_rsqrt14_ss (__m128 __W, __mmask8 __U, __m128 __A, __m128 __B)
 {
  return (__m128) __builtin_ia32_rsqrt14ss_mask ((__v4sf) __A,
   (__v4sf) __B,
@@ -1517,7 +1517,7 @@ _mm_mask_rsqrt14_ss (__m128 __W, __mmask
 }
 
 static __inline__ __m128 __DEFAULT_FN_ATTRS
-_mm_maskz_rsqrt14_ss (__mmask8 __U, __m128 __A, __m128 __B) 
+_mm_maskz_rsqrt14_ss (__mmask8 __U, __m128 __A, __m128 __B)
 {
  return (__m128) __builtin_ia32_rsqrt14ss_mask ((__v4sf) __A,
   (__v4sf) __B,
@@ -1536,7 +1536,7 @@ _mm_rsqrt14_sd(__m128d __A, __m128d __B)
 }
 
 static __inline__ __m128d __DEFAULT_FN_ATTRS
-_mm_mask_rsqrt14_sd (__m128d __W, __mmask8 __U, __m128d __A, __m128d __B) 
+_mm_mask_rsqrt14_sd (__m128d __W, __mmask8 __U, __m128d __A, __m128d __B)
 {
  return (__m128d) __builtin_ia32_rsqrt14sd_mask ( (__v2df) __A,
   (__v2df) __B,
@@ -1545,7 +1545,7 @@ _mm_mask_rsqrt14_sd (__m128d __W, __mmas
 }
 
 static __inline__ __m128d __DEFAULT_FN_ATTRS
-_mm_maskz_rsqrt14_sd (__mmask8 __U, __m128d __A, __m128d __B) 
+_mm_maskz_rsqrt14_sd (__mmask8 __U, __m128d __A, __m128d __B)
 {
  return (__m128d) __builtin_ia32_rsqrt14sd_mask ( (__v2df) __A,
   (__v2df) __B,
@@ -1616,7 +1616,7 @@ _mm_rcp14_ss(__m128 __A, __m128 __B)
 }
 
 static __inline__ __m128 __DEFAULT_FN_ATTRS
-_mm_mask_rcp14_ss (__m128 __W, __mmask8 __U, __m128 __A, __m128 __B) 
+_mm_mask_rcp14_ss (__m128 __W, __mmask8 __U, __m128 __A, __m128 __B)
 {
  return (__m128) __builtin_ia32_rcp14ss_mask ((__v4sf) __A,
   (__v4sf) __B,
@@ -1625,7 +1625,7 @@ _mm_mask_rcp14_ss (__m128 __W, __mmask8
 }
 
 static __inline__ __m128 __DEFAULT_FN_ATTRS
-_mm_maskz_rcp14_ss (__mmask8 __U, __m128 __A, __m128 __B) 

Re: [PATCH] D20640: [AMDGPU] Set default dwarf version to 2

2016-05-27 Thread Tom Stellard via cfe-commits
tstellarAMD accepted this revision.
tstellarAMD added a comment.
This revision is now accepted and ready to land.

LGTM.


http://reviews.llvm.org/D20640



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


[libcxx] r271074 - Add missing include to test_iterators.h

2016-05-27 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri May 27 18:43:29 2016
New Revision: 271074

URL: http://llvm.org/viewvc/llvm-project?rev=271074=rev
Log:
Add missing include to test_iterators.h

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

Modified: libcxx/trunk/test/support/test_iterators.h
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/test_iterators.h?rev=271074=271073=271074=diff
==
--- libcxx/trunk/test/support/test_iterators.h (original)
+++ libcxx/trunk/test/support/test_iterators.h Fri May 27 18:43:29 2016
@@ -12,6 +12,7 @@
 
 #include 
 #include 
+#include 
 #include 
 
 #include "test_macros.h"


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


[libcxx] r271073 - Fix PR27751. Add proper dependancies for install-libcxx-headers rule

2016-05-27 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri May 27 18:33:10 2016
New Revision: 271073

URL: http://llvm.org/viewvc/llvm-project?rev=271073=rev
Log:
Fix PR27751. Add proper dependancies for install-libcxx-headers rule

Modified:
libcxx/trunk/include/CMakeLists.txt

Modified: libcxx/trunk/include/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/CMakeLists.txt?rev=271073=271072=271073=diff
==
--- libcxx/trunk/include/CMakeLists.txt (original)
+++ libcxx/trunk/include/CMakeLists.txt Fri May 27 18:33:10 2016
@@ -41,6 +41,7 @@ if (LIBCXX_INSTALL_HEADERS)
 # Add a target that executes the generation commands.
 add_custom_target(generate_config_header ALL
   DEPENDS ${LIBCXX_BINARY_DIR}/__generated_config)
+set(generated_config_deps generate_config_header)
 # Install the generated header as __config.
 install(FILES ${LIBCXX_BINARY_DIR}/__generated_config
   DESTINATION include/c++/v1
@@ -53,7 +54,7 @@ if (LIBCXX_INSTALL_HEADERS)
 # this target is just needed as a placeholder for the distribution target
 add_custom_target(libcxx-headers)
 add_custom_target(install-libcxx-headers
-  DEPENDS libcxx-headers
+  DEPENDS libcxx-headers ${generated_config_deps}
   COMMAND "${CMAKE_COMMAND}"
   -DCMAKE_INSTALL_COMPONENT=libcxx-headers
   -P "${CMAKE_BINARY_DIR}/cmake_install.cmake")


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


[libcxx] r271070 - Fix PR27875. Parse LIBCXX_CXX_ABI_LIBRARY_PATH as a path not a string

2016-05-27 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri May 27 18:05:37 2016
New Revision: 271070

URL: http://llvm.org/viewvc/llvm-project?rev=271070=rev
Log:
Fix PR27875. Parse LIBCXX_CXX_ABI_LIBRARY_PATH as a path not a string

Modified:
libcxx/trunk/cmake/Modules/HandleLibCXXABI.cmake

Modified: libcxx/trunk/cmake/Modules/HandleLibCXXABI.cmake
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/cmake/Modules/HandleLibCXXABI.cmake?rev=271070=271069=271070=diff
==
--- libcxx/trunk/cmake/Modules/HandleLibCXXABI.cmake (original)
+++ libcxx/trunk/cmake/Modules/HandleLibCXXABI.cmake Fri May 27 18:05:37 2016
@@ -21,9 +21,11 @@ macro(setup_abi_lib abidefines abilib ab
 CACHE PATH
 "Paths to C++ ABI header directories separated by ';'." FORCE
 )
-
+  set(LIBCXX_CXX_ABI_LIBRARY_PATH "${LIBCXX_CXX_ABI_LIBRARY_PATH}"
+CACHE PATH
+"Paths to C++ ABI library directory"
+)
   set(LIBCXX_CXX_ABI_LIBRARY ${abilib})
-
   set(LIBCXX_ABILIB_FILES ${abifiles})
 
   file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/include")


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


Re: [PATCH] D20388: AMDGPU: Fix supported CL features

2016-05-27 Thread Matt Arsenault via cfe-commits
arsenm added inline comments.


Comment at: test/Misc/r600.languageOptsOpenCL.cl:4
@@ +3,3 @@
+// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple r600-unknown-unknown 
-target-cpu cypress
+// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple r600-unknown-unknown 
-target-cpu turks -DTURKS
+// RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple r600-unknown-unknown 
-target-cpu cayman

We should probably add builtin device macros for these


Repository:
  rL LLVM

http://reviews.llvm.org/D20388



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


[libcxx] r271065 - Guard testing of tuple extensions to make tests portable

2016-05-27 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri May 27 17:41:45 2016
New Revision: 271065

URL: http://llvm.org/viewvc/llvm-project?rev=271065=rev
Log:
Guard testing of tuple extensions to make tests portable

Modified:

libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/UTypes.pass.cpp

libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_copy.pass.cpp

libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_move.pass.cpp

libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/const_Types.pass.cpp

libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple.include.utility.pass.cpp

Modified: 
libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/UTypes.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/UTypes.pass.cpp?rev=271065=271064=271065=diff
==
--- 
libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/UTypes.pass.cpp 
(original)
+++ 
libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/UTypes.pass.cpp 
Fri May 27 17:41:45 2016
@@ -82,6 +82,8 @@ void test_default_constructible_extensio
 MoveOnly, Tuple, MoveOnly, MoveOnly
 >::value, "");
 }
+// testing extensions
+#ifdef _LIBCPP_VERSION
 {
 typedef std::tuple Tuple;
 typedef std::tuple NestedTuple;
@@ -96,6 +98,7 @@ void test_default_constructible_extensio
 MoveOnly, Tuple, MoveOnly, MoveOnly
 >::value, "");
 }
+#endif
 }
 
 int main()
@@ -118,6 +121,7 @@ int main()
 assert(std::get<2>(t) == 2);
 }
 // extensions
+#ifdef _LIBCPP_VERSION
 {
 std::tuple t(MoveOnly(0),
MoveOnly(1));
@@ -131,7 +135,8 @@ int main()
 assert(std::get<1>(t) == MoveOnly());
 assert(std::get<2>(t) == MoveOnly());
 }
-#if _LIBCPP_STD_VER > 11
+#endif
+#if TEST_STD_VER > 11
 {
 constexpr std::tuple t0{Empty()};
 }

Modified: 
libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_copy.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_copy.pass.cpp?rev=271065=271064=271065=diff
==
--- 
libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_copy.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_copy.pass.cpp
 Fri May 27 17:41:45 2016
@@ -52,6 +52,8 @@ int main()
 assert(alloc_last::allocator_constructed);
 assert(std::get<0>(t) == 2);
 }
+// testing extensions
+#ifdef _LIBCPP_VERSION
 {
 typedef std::tuple T;
 T t0(2, 3);
@@ -75,4 +77,5 @@ int main()
 assert(std::get<1>(t) == 2);
 assert(std::get<2>(t) == 3);
 }
+#endif
 }

Modified: 
libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_move.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_move.pass.cpp?rev=271065=271064=271065=diff
==
--- 
libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_move.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_move.pass.cpp
 Fri May 27 17:41:45 2016
@@ -53,6 +53,8 @@ int main()
 assert(alloc_last::allocator_constructed);
 assert(std::get<0>(t) == 1);
 }
+// testing extensions
+#ifdef _LIBCPP_VERSION
 {
 typedef std::tuple T;
 T t0(0 ,1);
@@ -74,4 +76,5 @@ int main()
 assert(std::get<1>(t) == 2);
 assert(std::get<2>(t) == 3);
 }
+#endif
 }

Modified: 
libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/const_Types.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/const_Types.pass.cpp?rev=271065=271064=271065=diff
==
--- 
libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/const_Types.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/const_Types.pass.cpp
 Fri May 27 17:41:45 2016
@@ -136,7 +136,8 @@ int main()
 assert(std::get<2>(t) == 2);
 assert(std::get<3>(t) == 3);
 }
-// extensions
+// extensions
+#ifdef _LIBCPP_VERSION
 {
 std::tuple t(2);
 assert(std::get<0>(t) == 2);
@@ -156,4 +157,5 @@ int main()
 assert(std::get<2>(t) == "text");
 assert(std::get<3>(t) == 0.0);
 }
+#endif
 }

Modified: 

Re: [PATCH] D20388: AMDGPU: Fix supported CL features

2016-05-27 Thread Jan Vesely via cfe-commits
jvesely updated the summary for this revision.
jvesely added a subscriber: cfe-commits.
jvesely updated this revision to Diff 58850.
jvesely marked an inline comment as done.
jvesely added a comment.

report only exported extensions.

int64 atomics, fp16, and 3d image writes are actually not currently exported, 
but should be more or less done for SI+


Repository:
  rL LLVM

http://reviews.llvm.org/D20388

Files:
  lib/Basic/Targets.cpp
  test/Misc/amdgcn.languageOptsOpenCL.cl
  test/Misc/r600.languageOptsOpenCL.cl

Index: test/Misc/r600.languageOptsOpenCL.cl
===
--- /dev/null
+++ test/Misc/r600.languageOptsOpenCL.cl
@@ -0,0 +1,63 @@
+// REQUIRES: amdgpu-registered-target
+// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple r600-unknown-unknown -target-cpu cayman
+// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple r600-unknown-unknown -target-cpu cypress
+// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple r600-unknown-unknown -target-cpu turks -DTURKS
+// RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple r600-unknown-unknown -target-cpu cayman
+// RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple r600-unknown-unknown -target-cpu cypress
+// RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple r600-unknown-unknown -target-cpu turks -DTURKS
+// RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple r600-unknown-unknown -target-cpu cayman
+// RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple r600-unknown-unknown -target-cpu cypress
+// RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple r600-unknown-unknown -target-cpu turks -DTURKS
+// expected-no-diagnostics
+
+#ifndef cl_clang_storage_class_specifiers
+#error "Missing cl_clang_storage_class_specifiers define"
+#endif
+#pragma OPENCL EXTENSION cl_clang_storage_class_specifiers: enable
+
+#if (__OPENCL_C_VERSION__ < 120) && !defined TURKS
+#ifndef cl_khr_fp64
+#error "Missing cl_khr_fp64 define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_fp64: enable
+#endif
+
+#if (__OPENCL_C_VERSION__ == 100)
+#ifndef cl_khr_byte_addressable_store
+#error "Missing cl_khr_byte_addressable_store define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_byte_addressable_store: enable
+
+#ifndef cl_khr_global_int32_base_atomics
+#error "Missing cl_khr_global_int32_base_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_global_int32_base_atomics: enable
+
+#ifndef cl_khr_global_int32_extended_atomics
+#error "Missing cl_khr_global_int32_extended_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_global_int32_extended_atomics: enable
+
+#ifndef cl_khr_local_int32_base_atomics
+#error "Missing cl_khr_local_int32_base_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_local_int32_base_atomics: enable
+
+#ifndef cl_khr_local_int32_extended_atomics
+#error "Missing cl_khr_local_int32_extended_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_local_int32_extended_atomics: enable
+
+#endif
+
+#if (__OPENCL_C_VERSION__ >= 110)
+#ifndef cl_khr_gl_sharing
+#error "Missing cl_khr_gl_sharing define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_gl_sharing: enable
+
+#ifndef cl_khr_gl_event
+#error "Missing cl_khr_gl_event define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_gl_event: enable
+#endif
Index: test/Misc/amdgcn.languageOptsOpenCL.cl
===
--- /dev/null
+++ test/Misc/amdgcn.languageOptsOpenCL.cl
@@ -0,0 +1,61 @@
+// REQUIRES: amdgpu-registered-target
+// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple amdgcn-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple amdgcn-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple amdgcn-unknown-unknown
+// expected-no-diagnostics
+
+#ifndef cl_clang_storage_class_specifiers
+#error "Missing cl_clang_storage_class_specifiers define"
+#endif
+#pragma OPENCL EXTENSION cl_clang_storage_class_specifiers: enable
+
+#ifndef cl_khr_fp64
+#error "Missing cl_khr_fp64 define"
+#endif
+
+#ifndef cl_khr_3d_image_writes
+#error "Missing cl_khr_3d_image_writes define"
+#endif
+
+#if (__OPENCL_C_VERSION__ < 120)
+#pragma OPENCL EXTENSION cl_khr_fp64: enable
+#pragma OPENCL EXTENSION cl_khr_3d_image_writes: enable
+#endif
+
+#ifndef cl_khr_byte_addressable_store
+#error "Missing cl_khr_byte_addressable_store define"
+#endif
+
+#ifndef cl_khr_global_int32_base_atomics
+#error "Missing cl_khr_global_int32_base_atomics define"
+#endif
+
+#ifndef cl_khr_global_int32_extended_atomics
+#error "Missing cl_khr_global_int32_extended_atomics define"
+#endif
+
+#ifndef cl_khr_local_int32_base_atomics
+#error "Missing cl_khr_local_int32_base_atomics define"
+#endif
+
+#ifndef cl_khr_local_int32_extended_atomics
+#error "Missing cl_khr_local_int32_extended_atomics define"
+#endif
+
+#if (__OPENCL_C_VERSION__ == 100)
+#pragma OPENCL EXTENSION cl_khr_byte_addressable_store: enable
+#pragma OPENCL EXTENSION cl_khr_global_int32_base_atomics: enable
+#pragma OPENCL 

Re: [PATCH] D20388: AMDGPU: Fix supported CL features

2016-05-27 Thread Jan Vesely via cfe-commits
jvesely marked an inline comment as done.
jvesely added a comment.

Repository:
  rL LLVM

http://reviews.llvm.org/D20388



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


r271063 - docs: Clarify that LTO visibility is based on source-level symbol visibility.

2016-05-27 Thread Peter Collingbourne via cfe-commits
Author: pcc
Date: Fri May 27 17:31:30 2016
New Revision: 271063

URL: http://llvm.org/viewvc/llvm-project?rev=271063=rev
Log:
docs: Clarify that LTO visibility is based on source-level symbol visibility.

Modified:
cfe/trunk/docs/LTOVisibility.rst

Modified: cfe/trunk/docs/LTOVisibility.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LTOVisibility.rst?rev=271063=271062=271063=diff
==
--- cfe/trunk/docs/LTOVisibility.rst (original)
+++ cfe/trunk/docs/LTOVisibility.rst Fri May 27 17:31:30 2016
@@ -23,14 +23,16 @@ control flow integrity features can only
 visibility. A class's LTO visibility is treated as an ODR-relevant property
 of its definition, so it must be consistent between translation units.
 
-In translation units built with LTO, LTO visibility is based on symbol
-visibility or, on the Windows platform, the dllimport and dllexport
-attributes. When targeting non-Windows platforms, classes with a visibility
-other than hidden visibility receive public LTO visibility. When targeting
-Windows, classes with dllimport or dllexport attributes receive public LTO
-visibility. All other classes receive hidden LTO visibility. Classes with
-internal linkage (e.g. classes declared in unnamed namespaces) also receive
-hidden LTO visibility.
+In translation units built with LTO, LTO visibility is based on the
+class's symbol visibility as expressed at the source level (i.e. the
+``__attribute__((visibility("...")))`` attribute, or the ``-fvisibility=``
+flag) or, on the Windows platform, the dllimport and dllexport attributes. When
+targeting non-Windows platforms, classes with a visibility other than hidden
+visibility receive public LTO visibility. When targeting Windows, classes
+with dllimport or dllexport attributes receive public LTO visibility. All
+other classes receive hidden LTO visibility. Classes with internal linkage
+(e.g. classes declared in unnamed namespaces) also receive hidden LTO
+visibility.
 
 A class defined in a translation unit built without LTO receives public
 LTO visibility regardless of its object file visibility, linkage or other


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


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

2016-05-27 Thread Jan Vesely via cfe-commits
jvesely updated the summary for this revision.
jvesely added a subscriber: cfe-commits.
jvesely updated this revision to Diff 58849.
jvesely added a comment.

Report only clinfo exported extensions.


Repository:
  rL LLVM

http://reviews.llvm.org/D20389

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

Index: test/Misc/nvptx.languageOptsOpenCL.cl
===
--- /dev/null
+++ test/Misc/nvptx.languageOptsOpenCL.cl
@@ -0,0 +1,55 @@
+// REQUIRES: nvptx-registered-target
+// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple nvptx-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple nvptx64-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple nvptx-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple 
nvptx64-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple nvptx-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple 
nvptx64-unknown-unknown
+// expected-no-diagnostics
+
+#ifndef cl_clang_storage_class_specifiers
+#error "Missing cl_clang_storage_class_specifiers define"
+#endif
+#pragma OPENCL EXTENSION cl_clang_storage_class_specifiers: enable
+
+#ifndef cl_khr_fp64
+#error "Missing cl_khr_fp64 define"
+#endif
+#if (__OPENCL_C_VERSION__ < 120)
+#pragma OPENCL EXTENSION cl_khr_fp64: enable
+#endif
+
+#ifndef cl_khr_byte_addressable_store
+#error "Missing cl_khr_byte_addressable_store define"
+#endif
+
+#ifndef cl_khr_global_int32_base_atomics
+#error "Missing cl_khr_global_int32_base_atomics define"
+#endif
+
+#ifndef cl_khr_global_int32_extended_atomics
+#error "Missing cl_khr_global_int32_extended_atomics define"
+#endif
+
+#ifndef cl_khr_local_int32_base_atomics
+#error "Missing cl_khr_local_int32_base_atomics define"
+#endif
+
+#ifndef cl_khr_local_int32_extended_atomics
+#error "Missing cl_khr_local_int32_extended_atomics define"
+#endif
+
+#if (__OPENCL_C_VERSION__ == 100)
+#pragma OPENCL EXTENSION cl_khr_byte_addressable_store: enable
+#pragma OPENCL EXTENSION cl_khr_global_int32_base_atomics: enable
+#pragma OPENCL EXTENSION cl_khr_global_int32_extended_atomics: enable
+#pragma OPENCL EXTENSION cl_khr_local_int32_base_atomics: enable
+#pragma OPENCL EXTENSION cl_khr_local_int32_extended_atomics: enable
+#endif
+
+#if (__OPENCL_C_VERSION__ >= 110)
+#ifndef cl_khr_gl_sharing
+#error "Missing cl_khr_gl_sharing define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_gl_sharing: enable
+#endif
Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -1862,6 +1862,19 @@
 
 return GPU != GK_NONE;
   }
+  void setSupportedOpenCLOpts() override {
+auto  = getSupportedOpenCLOpts();
+Opts.cl_clang_storage_class_specifiers = 1;
+Opts.cl_khr_gl_sharing = 1;
+Opts.cl_khr_icd = 1;
+
+Opts.cl_khr_fp64 = 1;
+Opts.cl_khr_byte_addressable_store = 1;
+Opts.cl_khr_global_int32_base_atomics = 1;
+Opts.cl_khr_global_int32_extended_atomics = 1;
+Opts.cl_khr_local_int32_base_atomics = 1;
+Opts.cl_khr_local_int32_extended_atomics = 1;
+  }
 };
 
 const Builtin::Info NVPTXTargetInfo::BuiltinInfo[] = {


Index: test/Misc/nvptx.languageOptsOpenCL.cl
===
--- /dev/null
+++ test/Misc/nvptx.languageOptsOpenCL.cl
@@ -0,0 +1,55 @@
+// REQUIRES: nvptx-registered-target
+// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple nvptx-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple nvptx64-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple nvptx-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple nvptx64-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple nvptx-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple nvptx64-unknown-unknown
+// expected-no-diagnostics
+
+#ifndef cl_clang_storage_class_specifiers
+#error "Missing cl_clang_storage_class_specifiers define"
+#endif
+#pragma OPENCL EXTENSION cl_clang_storage_class_specifiers: enable
+
+#ifndef cl_khr_fp64
+#error "Missing cl_khr_fp64 define"
+#endif
+#if (__OPENCL_C_VERSION__ < 120)
+#pragma OPENCL EXTENSION cl_khr_fp64: enable
+#endif
+
+#ifndef cl_khr_byte_addressable_store
+#error "Missing cl_khr_byte_addressable_store define"
+#endif
+
+#ifndef cl_khr_global_int32_base_atomics
+#error "Missing cl_khr_global_int32_base_atomics define"
+#endif
+
+#ifndef cl_khr_global_int32_extended_atomics
+#error "Missing cl_khr_global_int32_extended_atomics define"
+#endif
+
+#ifndef cl_khr_local_int32_base_atomics
+#error "Missing cl_khr_local_int32_base_atomics define"
+#endif
+
+#ifndef cl_khr_local_int32_extended_atomics
+#error "Missing cl_khr_local_int32_extended_atomics define"
+#endif
+
+#if (__OPENCL_C_VERSION__ == 100)
+#pragma OPENCL EXTENSION cl_khr_byte_addressable_store: enable
+#pragma 

[libcxx] r271060 - Tolerate incorrect return type for 'isinf' and 'isnan' in tests.

2016-05-27 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri May 27 17:19:53 2016
New Revision: 271060

URL: http://llvm.org/viewvc/llvm-project?rev=271060=rev
Log:
Tolerate incorrect return type for 'isinf' and 'isnan' in tests.

Summary:
GLIBC recently removed the incorrect `int isinf(double)` and `int 
isnan(double)` overloads in C++11 and greater. This causes previously `XFAIL: 
linux`  tests to start passing.

Since there is no longer a way to 'XFAIL' the tests I choose to simply tolerate 
this bug.

See https://sourceware.org/bugzilla/show_bug.cgi?id=19439


Reviewers: rsmith, mclow.lists, EricWF

Subscribers: jroelofs, cfe-commits

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

Removed:
libcxx/trunk/test/std/depr/depr.c.headers/math_h_isinf.pass.cpp
libcxx/trunk/test/std/depr/depr.c.headers/math_h_isnan.pass.cpp
libcxx/trunk/test/std/numerics/c.math/cmath_isinf.pass.cpp
libcxx/trunk/test/std/numerics/c.math/cmath_isnan.pass.cpp
Modified:
libcxx/trunk/test/std/depr/depr.c.headers/math_h.pass.cpp
libcxx/trunk/test/std/numerics/c.math/cmath.pass.cpp

Modified: libcxx/trunk/test/std/depr/depr.c.headers/math_h.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/depr/depr.c.headers/math_h.pass.cpp?rev=271060=271059=271060=diff
==
--- libcxx/trunk/test/std/depr/depr.c.headers/math_h.pass.cpp (original)
+++ libcxx/trunk/test/std/depr/depr.c.headers/math_h.pass.cpp Fri May 27 
17:19:53 2016
@@ -9,9 +9,6 @@
 
 // 
 
-// NOTE: isinf and isnan are tested separately because they are expected to 
fail
-// on linux. We don't want their expected failure to hide other failures in 
this file.
-
 #include 
 #include 
 #include 
@@ -631,6 +628,29 @@ void test_isgreaterequal()
 assert(isgreaterequal(-1.0, 0.F) == false);
 }
 
+void test_isinf()
+{
+#ifdef isinf
+#error isinf defined
+#endif
+static_assert((std::is_same::value), "");
+
+typedef decltype(isinf((double)0)) DoubleRetType;
+#ifndef __linux__
+static_assert((std::is_same::value), "");
+#else
+// GLIBC < 2.26 defines 'isinf(double)' with a return type of 'int' in
+// all C++ dialects. The test should tolerate this.
+// See: https://sourceware.org/bugzilla/show_bug.cgi?id=19439
+static_assert((std::is_same::value
+|| std::is_same::value), "");
+#endif
+
+static_assert((std::is_same::value), "");
+static_assert((std::is_same::value), "");
+assert(isinf(-1.0) == false);
+}
+
 void test_isless()
 {
 #ifdef isless
@@ -688,6 +708,29 @@ void test_islessgreater()
 assert(islessgreater(-1.0, 0.F) == true);
 }
 
+void test_isnan()
+{
+#ifdef isnan
+#error isnan defined
+#endif
+static_assert((std::is_same::value), "");
+
+typedef decltype(isnan((double)0)) DoubleRetType;
+#ifndef __linux__
+static_assert((std::is_same::value), "");
+#else
+// GLIBC < 2.26 defines 'isnan(double)' with a return type of 'int' in
+// all C++ dialects. The test should tolerate this.
+// See: https://sourceware.org/bugzilla/show_bug.cgi?id=19439
+static_assert((std::is_same::value
+|| std::is_same::value), "");
+#endif
+
+static_assert((std::is_same::value), "");
+static_assert((std::is_same::value), "");
+assert(isnan(-1.0) == false);
+}
+
 void test_isunordered()
 {
 #ifdef isunordered
@@ -1443,9 +1486,11 @@ int main()
 test_isnormal();
 test_isgreater();
 test_isgreaterequal();
+test_isinf();
 test_isless();
 test_islessequal();
 test_islessgreater();
+test_isnan();
 test_isunordered();
 test_acosh();
 test_asinh();

Removed: libcxx/trunk/test/std/depr/depr.c.headers/math_h_isinf.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/depr/depr.c.headers/math_h_isinf.pass.cpp?rev=271059=auto
==
--- libcxx/trunk/test/std/depr/depr.c.headers/math_h_isinf.pass.cpp (original)
+++ libcxx/trunk/test/std/depr/depr.c.headers/math_h_isinf.pass.cpp (removed)
@@ -1,30 +0,0 @@
-//===--===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===--===//
-
-// 
-
-// isinf
-
-// XFAIL: linux
-
-#include 
-#include 
-#include 
-
-int main()
-{
-#ifdef isinf
-#error isinf defined
-#endif
-static_assert((std::is_same::value), 

Re: [PATCH] D19835: Tolerate incorrect return type for 'isinf' and 'isnan' in tests.

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

Accepting to get the test suite passing on newer linux distributions again. I 
tried modifying the tests to test the GLIBC version but IMO it was more 
complexity than it was worth.


http://reviews.llvm.org/D19835



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


Re: Missing definition of a template virtual function

2016-05-27 Thread Richard Smith via cfe-commits
On Fri, May 27, 2016 at 1:03 PM, Srivastava, Sunil via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Hi,
>
>
>
> I want to discuss the issue in PR27895,
>
>https://llvm.org/bugs/show_bug.cgi?id=27895
>
>
>
> But I will give a slightly different example for this discussion.
>
>
>
> The issue can be demonstrated by this standalone code. Should this example
> link
>
> successfully?
>

Yes, this is a bug. We emit a direct call to
TmplWithArray::operator[] so we're required to also emit a
definition of it. I think the code that r227073 removed was really masking
this bug rather than fixing it. It seems like there are two issues here:

 1) Sema should mark a virtual function as used if it sees an
obviously-devirtualizable call to the function (where the base object has a
known dynamic type)

 2) Clang CodeGen's devirtualization of obviously-devirtualizable calls
should not devirtualize calls to linkonce_odr functions that it can't emit

--
>
> template < typename T, int N = 0 > class TmplWithArray {
>
> public:
>
>   virtual T& operator [] (int idx);
>
>   T ar[N+1];
>
> };
>
> template  T& TmplWithArray::operator[](int idx) {
>
>   return ar[idx];
>
> }
>
> class Wrapper {
>
>   TmplWithArray data;
>
>   bool indexIt(int a);
>
> };
>
> bool Wrapper::indexIt(int a)
>
> {
>
>return data[a];
>
> }
>
> int main(){}
>
> --
>
>
>
> Starting from  r227073 it does not link (at any optimization level). The
> code
>
> has a direct call to the operator[] function, but that function definition
> is
>
> not generated.
>
>
>
> Versions prior to r227073,
>
> -  at –O0 or –O1, generate the operator[] function and the direct
> call, and
>
> -  at –O2 do not generate the function, but inline it
>
> Either way they link fine.
>
>
>
> In this example the key-function for the generation of the vtable is the
>
> operator[] function itself.
>
>
>
> So the compiler can either generate both the vtable and the operator[]
>
> function, or not generate either; they are both consistent states.
>
>
>
> The call in data[a] is to a virtual function, and if the compiler left it
> as a
>
> virtual call, it will link. There will be no ctor, no vtable, and no
> operator[]
>
> function. Wrapper::indexIt will be dead code, but it will link.
>
>
>
> But the compiler does devirtualization of the call and generates a direct
> call,
>
> yet, beginning with r227073, it does not generate the operator[] function.
>
> Hence the link failure.
>
>
>
> Another interesting tidbit is that if the operator[] is replaced by a plain
>
> function doing the same thing, along with the corresponding change in the
>
> usage, something like:
>
> virtual T& getElt(int idx);
>
> then the behavior is the same as pre r227073. Either getElt is defined or
> it
>
> gets inlined.
>
>
>
> BTW, this is not just an idle curiosity. This example was trimmed down from
>
> a user bug report having a link failure.
>
>
>
> Sunil Srivastava
>
> Sony Interactive Entertainment
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D19843: Use the name of the file on disk to issue a new diagnostic about non-portable #include and #import paths.

2016-05-27 Thread Eric Niebler via cfe-commits
eric_niebler added a comment.

Awesome, thanks.



Comment at: include/clang/Basic/DiagnosticLexKinds.td:278
@@ +277,3 @@
+def pp_nonportable_path : Warning<
+  "non-portable path '%0' found in preprocessor directive">,
+  InGroup;

rsmith wrote:
> The fix-it hints aren't shown in some modes of operation; it might be helpful 
> for this diagnostic to be a bit more explicit about what's non-portable since 
> without the fixit it's not obvious. Maybe something like
> 
> "non-portable path to file '%0'; specified path differs in case from file 
> name on disk"
> 
> where %0 is the corrected path?
Good suggestion.


Comment at: lib/Lex/PPDirectives.cpp:1763-1765
@@ +1762,5 @@
+  // than the one we're about to open.
+  //
+  // Because testing for non-portable paths is expensive, only do it if the
+  // warning is not currently ignored.
+  const bool CheckIncludePathPortability =

rsmith wrote:
> Looks like this comment is stale?
Oops, yeah.


http://reviews.llvm.org/D19843



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


[PATCH] D20757: Add "REQUIRES-ANY" feature test

2016-05-27 Thread Eric Fiselier via cfe-commits
EricWF created this revision.
EricWF added reviewers: ddunbar, rnk.
EricWF added subscribers: cfe-commits, llvm-commits.
EricWF set the repository for this revision to rL LLVM.

This patch adds a "REQUIRES-ANY" feature test that is disjunctive. This marks a 
test as `UNSUPPORTED` if none of the specified features are available.

Libc++ has the need to write feature test such as `// REQUIRES-ANY: c++98, 
c++03`  when testing of behavior that is specific to older dialects but has 
since changed.


Repository:
  rL LLVM

http://reviews.llvm.org/D20757

Files:
  utils/lit/lit/TestRunner.py
  utils/lit/tests/Inputs/shtest-format/requires-any-missing.txt
  utils/lit/tests/Inputs/shtest-format/requires-any-present.txt
  utils/lit/tests/shtest-format.py

Index: utils/lit/tests/shtest-format.py
===
--- utils/lit/tests/shtest-format.py
+++ utils/lit/tests/shtest-format.py
@@ -47,6 +47,8 @@
 
 # CHECK: UNRESOLVED: shtest-format :: no-test-line.txt
 # CHECK: PASS: shtest-format :: pass.txt
+# CHECK: UNSUPPORTED: shtest-format :: requires-any-missing.txt
+# CHECK: PASS: shtest-format :: requires-any-present.txt
 # CHECK: UNSUPPORTED: shtest-format :: requires-missing.txt
 # CHECK: PASS: shtest-format :: requires-present.txt
 # CHECK: UNSUPPORTED: shtest-format :: unsupported_dir/some-test.txt
@@ -69,9 +71,9 @@
 # CHECK: shtest-format :: external_shell/fail_with_bad_encoding.txt
 # CHECK: shtest-format :: fail.txt
 
-# CHECK: Expected Passes: 4
+# CHECK: Expected Passes: 5
 # CHECK: Expected Failures  : 3
-# CHECK: Unsupported Tests  : 2
+# CHECK: Unsupported Tests  : 3
 # CHECK: Unresolved Tests   : 1
 # CHECK: Unexpected Passes  : 1
 # CHECK: Unexpected Failures: 3
Index: utils/lit/tests/Inputs/shtest-format/requires-any-present.txt
===
--- /dev/null
+++ utils/lit/tests/Inputs/shtest-format/requires-any-present.txt
@@ -0,0 +1,2 @@
+RUN: true
+REQUIRES-ANY: a-missing-feature, a-present-feature
Index: utils/lit/tests/Inputs/shtest-format/requires-any-missing.txt
===
--- /dev/null
+++ utils/lit/tests/Inputs/shtest-format/requires-any-missing.txt
@@ -0,0 +1,2 @@
+RUN: true
+REQUIRES-ANY: a-missing-feature, a-missing-feature-2
Index: utils/lit/lit/TestRunner.py
===
--- utils/lit/lit/TestRunner.py
+++ utils/lit/lit/TestRunner.py
@@ -616,8 +616,10 @@
 sourcepath = test.getSourcePath()
 script = []
 requires = []
+requires_any = []
 unsupported = []
-keywords = ['RUN:', 'XFAIL:', 'REQUIRES:', 'UNSUPPORTED:', 'END.']
+keywords = ['RUN:', 'XFAIL:', 'REQUIRES:', 'REQUIRES-ANY:',
+'UNSUPPORTED:', 'END.']
 for line_number, command_type, ln in \
 parseIntegratedTestScriptCommands(sourcepath, keywords):
 if command_type == 'RUN':
@@ -642,6 +644,8 @@
 test.xfails.extend([s.strip() for s in ln.split(',')])
 elif command_type == 'REQUIRES':
 requires.extend([s.strip() for s in ln.split(',')])
+elif command_type == 'REQUIRES-ANY':
+requires_any.extend([s.strip() for s in ln.split(',')])
 elif command_type == 'UNSUPPORTED':
 unsupported.extend([s.strip() for s in ln.split(',')])
 elif command_type == 'END':
@@ -668,6 +672,12 @@
 msg = ', '.join(missing_required_features)
 return lit.Test.Result(Test.UNSUPPORTED,
"Test requires the following features: %s" % 
msg)
+requires_any_features = [f for f in requires_any
+ if f in test.config.available_features]
+if requires_any and not requires_any_features:
+msg = ' ,'.join(requires_any)
+return lit.Test.Result(Test.UNSUPPORTED,
+"Test requires any of the following features: %s" % msg)
 unsupported_features = [f for f in unsupported
 if f in test.config.available_features]
 if unsupported_features:


Index: utils/lit/tests/shtest-format.py
===
--- utils/lit/tests/shtest-format.py
+++ utils/lit/tests/shtest-format.py
@@ -47,6 +47,8 @@
 
 # CHECK: UNRESOLVED: shtest-format :: no-test-line.txt
 # CHECK: PASS: shtest-format :: pass.txt
+# CHECK: UNSUPPORTED: shtest-format :: requires-any-missing.txt
+# CHECK: PASS: shtest-format :: requires-any-present.txt
 # CHECK: UNSUPPORTED: shtest-format :: requires-missing.txt
 # CHECK: PASS: shtest-format :: requires-present.txt
 # CHECK: UNSUPPORTED: shtest-format :: unsupported_dir/some-test.txt
@@ -69,9 +71,9 @@
 # CHECK: shtest-format :: external_shell/fail_with_bad_encoding.txt
 # CHECK: shtest-format :: fail.txt
 
-# CHECK: Expected Passes: 4
+# CHECK: Expected Passes: 5
 # CHECK: Expected Failures  : 3
-# CHECK: Unsupported Tests  

Re: [PATCH] D19843: Use the name of the file on disk to issue a new diagnostic about non-portable #include and #import paths.

2016-05-27 Thread Richard Smith via cfe-commits
rsmith accepted this revision.
rsmith added a reviewer: rsmith.
rsmith added a comment.
This revision is now accepted and ready to land.

LGTM once the LLVM side is landed.



Comment at: include/clang/Basic/DiagnosticLexKinds.td:278
@@ +277,3 @@
+def pp_nonportable_path : Warning<
+  "non-portable path '%0' found in preprocessor directive">,
+  InGroup;

The fix-it hints aren't shown in some modes of operation; it might be helpful 
for this diagnostic to be a bit more explicit about what's non-portable since 
without the fixit it's not obvious. Maybe something like

"non-portable path to file '%0'; specified path differs in case from file 
name on disk"

where %0 is the corrected path?


Comment at: lib/Lex/PPDirectives.cpp:1763-1765
@@ +1762,5 @@
+  // than the one we're about to open.
+  //
+  // Because testing for non-portable paths is expensive, only do it if the
+  // warning is not currently ignored.
+  const bool CheckIncludePathPortability =

Looks like this comment is stale?


http://reviews.llvm.org/D19843



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


Re: [PATCH] D20748: Handle recursion in LLVMIRGeneration Timer

2016-05-27 Thread Vedant Kumar via cfe-commits

> On May 27, 2016, at 2:55 PM, Rafael Espíndola  
> wrote:
> 
> On 27 May 2016 at 17:32, Vedant Kumar  wrote:
>> vsk added a comment.
>> 
>> Comments on this patch -- The increment and decrement snippets seem like 
>> they could be pulled into helper methods. That should make it easier to 
>> update all users of LLVMIRGeneration. I wasn't able to come up with a 
>> regression test, but I do think this patch needs one.
>> 
>> Overall comments -- My main concern is that this isn't the only affected 
>> user of the Timer class. I have a preference for 
>> http://reviews.llvm.org/D20735 because it defines the underlying problem 
>> away. I'll defer to someone else on this (maybe @rafael?).
> 
> What is the other recursive use?

I meant to say: it may not be the only affected user. E.g I don't know if there 
are affected users out-of-tree.

Some in-tree users are ASTReader, AnalysisConsumer::HandleTranslationUnit, and 
BackendConsumer. It's not obvious to me at a glance that BackendConsumer is the 
only affected user, but that could be the case.

vedant

> 
> Cheers,
> Rafael

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


Re: [PATCH] D20677: Make it possible to build a -fno-exceptions libc++abi variant.

2016-05-27 Thread Asiri Rathnayake via cfe-commits
rmaprath added a comment.



> I have a small concern about how difficult this would make things for us 
> though - our toolchain setup uses `-ffunction-sections` and `-fdata-sections` 
> along with linker's unused-section elimination to get rid of most of the 
> stuff not necessary for the final image, but I can't remember if 
> unused-section elimination happens before or after checking for missing 
> symbols. If it is the latter, then we might be in trouble with this approach. 
> I will have a look into this when I get back to work.


Come to think of it, I'm 90% sure it's the latter (I don't see how the former 
can work - the linker has to load all the objects while resolving all the 
dependencies, then only it can get rid of the stuff the final image doesn't 
really need). The linker will give up as soon as it hits a missing symbol 
referred from a section which is actually unused in the final image (but is 
within some object which contains sections that are actually needed for the 
image).

Of course I need to confirm that 10% when I get my hands on the linker, but I 
have a feeling this is going to be a blocker for us.


http://reviews.llvm.org/D20677



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


Re: [PATCH] D20748: Handle recursion in LLVMIRGeneration Timer

2016-05-27 Thread Rafael Espíndola via cfe-commits
On 27 May 2016 at 17:32, Vedant Kumar  wrote:
> vsk added a comment.
>
> Comments on this patch -- The increment and decrement snippets seem like they 
> could be pulled into helper methods. That should make it easier to update all 
> users of LLVMIRGeneration. I wasn't able to come up with a regression test, 
> but I do think this patch needs one.
>
> Overall comments -- My main concern is that this isn't the only affected user 
> of the Timer class. I have a preference for http://reviews.llvm.org/D20735 
> because it defines the underlying problem away. I'll defer to someone else on 
> this (maybe @rafael?).

What is the other recursive use?

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


Re: [PATCH] D20677: Make it possible to build a -fno-exceptions libc++abi variant.

2016-05-27 Thread Asiri Rathnayake via cfe-commits
rmaprath added a comment.

In http://reviews.llvm.org/D20677#442713, @EricWF wrote:

> In http://reviews.llvm.org/D20677#442687, @rmaprath wrote:
>
> > In http://reviews.llvm.org/D20677#442559, @EricWF wrote:
> >
> > > I have an issue with this change since it allows a libc++abi built 
> > > without exceptions to be used in a program compiled with them. I assert 
> > > that this should not be supported in any way.
> > >
> > > My personal preference would be to remove as much of the exception API 
> > > from the library when it's built without exceptions. This should cause 
> > > link errors if a program contains any code that throws. If this is not 
> > > done it creates bugs within code like `__terminate` as mentioned in an 
> > > inline comment.
> > >
> > > I would like to see another revision of this patch that removes as much 
> > > of the exception API as possible. Looking at the symbols defined in 
> > > `cxxabi.h` I would say ever symbol in sections 2.4 and 2.5 should not 
> > > longer be defined in the library.
> >
> >
> > That sounds generally OK to me. The toolchain I'm working on (ARM Compiler 
> > 6) has an elaborate mechanism (based on build attributes) to select the 
> > correct variant of libraries. In other words, if any of your objects are 
> > compiled with exceptions, you are guaranteed to no select any of the 
> > no-exceptions library variants. This avoids the problem you mentioned 
> > altogether.
>
>
> Note that that behavior will cause different issues in some cases. If you  
> link an executable  to two libraries, `libfoo.so` and `libbar.so`, where one 
> was compiled with exceptions and the other without you'll get two copies of 
> libc++abi in the program. Now you have two copies of the global terminate 
> handler and two copies of `__terminate` for the linker to select from.
>  If it selects the nothrow `__terminate` and the terminate handler throws an 
> exception your in trouble.


In this case, I expect the linker to only select one variant of libc++abi (the 
one with exceptions). The idea behind build-attributes is to capture user 
intentions, if the user links his program with `libbar.a` and `libfoo.a` user 
libraries (with and without exceptions), the linker would assume that the user 
meant to use exceptions rather than not, and hence select the with-exceptions 
libc++abi variant. The theory behind build-attributes is bit more complicated 
that that though, I'm not the best person to go on about this.

In any case, I agree that getting the linker to produce an error (when linking 
with-exceptions objects with a no-exceptions libc++abi) is much more clearer.

I have a small concern about how difficult this would make things for us though 
- our toolchain setup uses `-ffunction-sections` and `-fdata-sections` along 
with linker's unused-section elimination to get rid of most of the stuff not 
necessary for the final image, but I can't remember if unused-section 
elimination happens before or after checking for missing symbols. If it is the 
latter, then we might be in trouble with this approach. I will have a look into 
this when I get back to work.

Cheers,

/ Asiri


http://reviews.llvm.org/D20677



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


Re: [PATCH] D20748: Handle recursion in LLVMIRGeneration Timer

2016-05-27 Thread Vedant Kumar via cfe-commits
vsk added a comment.

Comments on this patch -- The increment and decrement snippets seem like they 
could be pulled into helper methods. That should make it easier to update all 
users of LLVMIRGeneration. I wasn't able to come up with a regression test, but 
I do think this patch needs one.

Overall comments -- My main concern is that this isn't the only affected user 
of the Timer class. I have a preference for http://reviews.llvm.org/D20735 
because it defines the underlying problem away. I'll defer to someone else on 
this (maybe @rafael?).


http://reviews.llvm.org/D20748



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


Re: [PATCH] D20677: Make it possible to build a -fno-exceptions libc++abi variant.

2016-05-27 Thread Eric Fiselier via cfe-commits
EricWF added a comment.

In http://reviews.llvm.org/D20677#442687, @rmaprath wrote:

> In http://reviews.llvm.org/D20677#442559, @EricWF wrote:
>
> > I have an issue with this change since it allows a libc++abi built without 
> > exceptions to be used in a program compiled with them. I assert that this 
> > should not be supported in any way.
> >
> > My personal preference would be to remove as much of the exception API from 
> > the library when it's built without exceptions. This should cause link 
> > errors if a program contains any code that throws. If this is not done it 
> > creates bugs within code like `__terminate` as mentioned in an inline 
> > comment.
> >
> > I would like to see another revision of this patch that removes as much of 
> > the exception API as possible. Looking at the symbols defined in `cxxabi.h` 
> > I would say ever symbol in sections 2.4 and 2.5 should not longer be 
> > defined in the library.
>
>
> That sounds generally OK to me. The toolchain I'm working on (ARM Compiler 6) 
> has an elaborate mechanism (based on build attributes) to select the correct 
> variant of libraries. In other words, if any of your objects are compiled 
> with exceptions, you are guaranteed to no select any of the no-exceptions 
> library variants. This avoids the problem you mentioned altogether.


Note that that behavior will cause different issues in some cases. If you  link 
an executable  to two libraries, `libfoo.so` and `libbar.so`, where one was 
compiled with exceptions and the other without you'll get two copies of 
libc++abi in the program. Now you have two copies of the global terminate 
handler and two copies of `__terminate` for the linker to select from.
If it selects the nothrow `__terminate` and the terminate handler throws an 
exception your in trouble.

That's not a reason to hold up this patch, but it is a potential problem you 
should be aware of.


http://reviews.llvm.org/D20677



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


Re: [PATCH] D20684: [X86][SSE] Replace VPMOVSX and (V)PMOVZX integer extension intrinsics with generic IR (clang)

2016-05-27 Thread Simon Pilgrim via cfe-commits
RKSimon added a comment.

In http://reviews.llvm.org/D20684#442514, @ab wrote:

> I'd add the unsigned typedefs with their signed counterparts; no reason not 
> to.
>  With that, LGTM.


Thanks, I'll do that as a follow up commit.


Repository:
  rL LLVM

http://reviews.llvm.org/D20684



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


Re: [PATCH] D20744: [OpenCL] Disable warning about core features by default

2016-05-27 Thread Yaxun Liu via cfe-commits
yaxunl accepted this revision.
yaxunl added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rL LLVM

http://reviews.llvm.org/D20744



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


Re: [PATCH] D20677: Make it possible to build a -fno-exceptions libc++abi variant.

2016-05-27 Thread Asiri Rathnayake via cfe-commits
rmaprath added a comment.

In http://reviews.llvm.org/D20677#442559, @EricWF wrote:

> I have an issue with this change since it allows a libc++abi built without 
> exceptions to be used in a program compiled with them. I assert that this 
> should not be supported in any way.
>
> My personal preference would be to remove as much of the exception API from 
> the library when it's built without exceptions. This should cause link errors 
> if a program contains any code that throws. If this is not done it creates 
> bugs within code like `__terminate` as mentioned in an inline comment.
>
> I would like to see another revision of this patch that removes as much of 
> the exception API as possible. Looking at the symbols defined in `cxxabi.h` I 
> would say ever symbol in sections 2.4 and 2.5 should not longer be defined in 
> the library.


That sounds generally OK to me. The toolchain I'm working on (ARM Compiler 6) 
has an elaborate mechanism (based on build attributes) to select the correct 
variant of libraries. In other words, if any of your objects are compiled with 
exceptions, you are guaranteed to no select any of the no-exceptions library 
variants. This avoids the problem you mentioned altogether.

But I can see that this can be a problem for any other toolchain that does not 
have such a functionality, and a link-time error would be more suitable.

I'll re-spin a patch soon.

Thanks.

/ Asiri


http://reviews.llvm.org/D20677



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


[PATCH] D20749: Introduce support for relative C++ ABI gated on LTO visibility.

2016-05-27 Thread Peter Collingbourne via cfe-commits
pcc created this revision.
pcc added reviewers: rsmith, rjmccall, rafael, mehdi_amini, aaron.ballman, 
majnemer, rnk.
pcc added a subscriber: cfe-commits.
Herald added a subscriber: mehdi_amini.

I'd like to propose this patch as an alternative to D17893 and D18199
that approaches the user interface to the relative C++ ABI feature from
a different angle. Instead of adding custom attributes and a whitelist,
we instead introduce a flag, -flto-relative-c++-abi-vtables, which enables
the relative ABI only for classes with hidden LTO visibility [0], which is
a concept we introduced for whole-program devirtualization that is based
on object file visibility. That concept also effectively controls where
the compiler is allowed to change the ABI arbitrarily. By using that very
similar concept, we can start off with a much simpler overall user interface,
at least for programs that are already using LTO.

It may seem strange to tie this feature to LTO visibility (and LTO), since
the feature of course does not intrinsically rely on LTO. However, I think
it seems reasonable for hidden LTO visibility to act as one possible source
of information for where the new ABI can be applied. At a later point we
can consider introducing other ways to enable the ABI (such as specific
attributes or whitelisting as proposed in D17893).

By requiring classes to have hidden visibility (a prerequisite for hidden
LTO visibility), we also avoid being blocked on the issues around non-hidden
visibility in ELF that were raised on the initial discussion thread for this
feature [1].

LTO also makes it a little easier to detect ABI mismatches in a platform
independent way using module flags. This patch introduces a module flag that
is used for that purpose.

[0] http://clang.llvm.org/docs/LTOVisibility.html
[1] http://lists.llvm.org/pipermail/llvm-dev/2016-February/096146.html

http://reviews.llvm.org/D20749

Files:
  docs/UsersManual.rst
  include/clang/AST/DeclCXX.h
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Basic/LangOptions.def
  include/clang/Driver/Options.td
  include/clang/Frontend/CodeGenOptions.def
  include/clang/Sema/Sema.h
  lib/AST/DeclCXX.cpp
  lib/CodeGen/CGClass.cpp
  lib/CodeGen/CGDebugInfo.cpp
  lib/CodeGen/CGVTables.cpp
  lib/CodeGen/CGVTables.h
  lib/CodeGen/CodeGenFunction.h
  lib/CodeGen/CodeGenModule.cpp
  lib/CodeGen/CodeGenModule.h
  lib/CodeGen/ItaniumCXXABI.cpp
  lib/CodeGen/MicrosoftCXXABI.cpp
  lib/Driver/Tools.cpp
  lib/Frontend/CompilerInvocation.cpp
  lib/Sema/SemaDeclCXX.cpp
  test/CodeGenCXX/bitsets.cpp
  test/CodeGenCXX/debug-info-virtual-fn-relative.cpp
  test/CodeGenCXX/vtable-relative-abi.cpp
  test/Driver/unstable-cxx-abi-vtables.cpp
  test/SemaCXX/unstable-cxx-abi.cpp

Index: test/SemaCXX/unstable-cxx-abi.cpp
===
--- /dev/null
+++ test/SemaCXX/unstable-cxx-abi.cpp
@@ -0,0 +1,35 @@
+// RUN: %clang_cc1 %s -w -std=c++11 -fsyntax-only -verify -flto-relative-c++-abi-vtables -fvisibility hidden
+
+struct __attribute__((visibility("default"))) platform { // expected-note 2{{base 'platform' uses the platform ABI}}
+  virtual void f();
+};
+struct relative { // expected-note 2{{base 'relative' uses the relative ABI}}
+  virtual void f();
+};
+
+struct mixed_bases : platform, relative {}; // expected-error {{inconsistent ABI for class 'mixed_bases'}}
+struct mixed_base_vbase : platform, virtual relative {}; // expected-error {{inconsistent ABI for class 'mixed_base_vbase'}}
+
+void f() {
+  struct relative2 {
+virtual void f();
+  };
+  struct relative_derived : relative, relative2 {};
+}
+
+struct __attribute__((visibility("default"))) platform2 {
+  void mf() {
+struct platform3 {
+  virtual void f();
+};
+struct platform_derived : platform, platform3 {};
+  }
+};
+
+struct __attribute__((visibility("default"))) non_dynamic {};
+
+struct relative_derived : non_dynamic, relative {};
+struct platform_derived : non_dynamic, platform {};
+
+struct relative_derived2 : relative_derived, relative {};
+struct platform_derived2 : platform_derived, platform {};
Index: test/Driver/unstable-cxx-abi-vtables.cpp
===
--- /dev/null
+++ test/Driver/unstable-cxx-abi-vtables.cpp
@@ -0,0 +1,5 @@
+// RUN: %clang -flto-relative-c++-abi-vtables -### %s 2>&1 | FileCheck -check-prefix=CLASSES %s
+// CLASSES: '-fwhole-program-vtables' only allowed with '-flto'
+//
+// RUN: %clang -flto -flto-relative-c++-abi-vtables -### %s 2>&1 | FileCheck -check-prefix=LTO-CLASSES %s
+// LTO-CLASSES: "-flto-relative-c++-abi-vtables"
Index: test/CodeGenCXX/vtable-relative-abi.cpp
===
--- /dev/null
+++ test/CodeGenCXX/vtable-relative-abi.cpp
@@ -0,0 +1,123 @@
+// RUN: %clang_cc1 %s -flto -triple x86_64-unknown-linux-gnu -fvisibility hidden -flto-relative-c++-abi-vtables -emit-llvm -o - | FileCheck --check-prefix=CHECK 

[PATCH] D20748: Handle recursion in LLVMIRGeneration Timer

2016-05-27 Thread Davide Italiano via cfe-commits
davide created this revision.
davide added reviewers: rafael, vsk.
davide added a subscriber: cfe-commits.

See http://reviews.llvm.org/D20735 for more context.
Implementing this clang-side is not as terrible as I originally thought. Maybe 
needs a test case, but I wasn't able to reduce one easily (yet). 

http://reviews.llvm.org/D20748

Files:
  clang/lib/CodeGen/CodeGenAction.cpp

Index: clang/lib/CodeGen/CodeGenAction.cpp
===
--- clang/lib/CodeGen/CodeGenAction.cpp
+++ clang/lib/CodeGen/CodeGenAction.cpp
@@ -50,6 +50,7 @@
 ASTContext *Context;

 Timer LLVMIRGeneration;
+unsigned LLVMIRGenerationRefCount;

 std::unique_ptr Gen;

@@ -73,6 +74,7 @@
 : Diags(Diags), Action(Action), CodeGenOpts(CodeGenOpts),
   TargetOpts(TargetOpts), LangOpts(LangOpts), AsmOutStream(OS),
   Context(nullptr), LLVMIRGeneration("LLVM IR Generation Time"),
+  LLVMIRGenerationRefCount(0),
   Gen(CreateLLVMCodeGen(Diags, InFile, HeaderSearchOpts, PPOpts,
 CodeGenOpts, C, CoverageInfo)) {
   llvm::TimePassesIsEnabled = TimePasses;
@@ -112,13 +114,20 @@
  Context->getSourceManager(),
  "LLVM IR generation of declaration");

-  if (llvm::TimePassesIsEnabled)
-LLVMIRGeneration.startTimer();
+  // Recurse.
+  if (llvm::TimePassesIsEnabled) {
+LLVMIRGenerationRefCount += 1;
+if (LLVMIRGenerationRefCount == 1)
+  LLVMIRGeneration.startTimer();
+  }

   Gen->HandleTopLevelDecl(D);

-  if (llvm::TimePassesIsEnabled)
-LLVMIRGeneration.stopTimer();
+  if (llvm::TimePassesIsEnabled) {
+LLVMIRGenerationRefCount -= 1;
+if (LLVMIRGenerationRefCount == 0)
+  LLVMIRGeneration.stopTimer();
+  }

   return true;
 }
@@ -139,13 +148,19 @@
 void HandleTranslationUnit(ASTContext ) override {
   {
 PrettyStackTraceString CrashInfo("Per-file LLVM IR generation");
-if (llvm::TimePassesIsEnabled)
-  LLVMIRGeneration.startTimer();
+if (llvm::TimePassesIsEnabled) {
+  LLVMIRGenerationRefCount += 1;
+  if (LLVMIRGenerationRefCount == 1)
+LLVMIRGeneration.startTimer();
+}

 Gen->HandleTranslationUnit(C);

-if (llvm::TimePassesIsEnabled)
-  LLVMIRGeneration.stopTimer();
+if (llvm::TimePassesIsEnabled) {
+  LLVMIRGenerationRefCount -= 1;
+  if (LLVMIRGenerationRefCount == 0)
+LLVMIRGeneration.stopTimer();
+}
   }

   // Silently ignore if we weren't initialized for some reason.


Index: clang/lib/CodeGen/CodeGenAction.cpp
===
--- clang/lib/CodeGen/CodeGenAction.cpp
+++ clang/lib/CodeGen/CodeGenAction.cpp
@@ -50,6 +50,7 @@
 ASTContext *Context;

 Timer LLVMIRGeneration;
+unsigned LLVMIRGenerationRefCount;

 std::unique_ptr Gen;

@@ -73,6 +74,7 @@
 : Diags(Diags), Action(Action), CodeGenOpts(CodeGenOpts),
   TargetOpts(TargetOpts), LangOpts(LangOpts), AsmOutStream(OS),
   Context(nullptr), LLVMIRGeneration("LLVM IR Generation Time"),
+  LLVMIRGenerationRefCount(0),
   Gen(CreateLLVMCodeGen(Diags, InFile, HeaderSearchOpts, PPOpts,
 CodeGenOpts, C, CoverageInfo)) {
   llvm::TimePassesIsEnabled = TimePasses;
@@ -112,13 +114,20 @@
  Context->getSourceManager(),
  "LLVM IR generation of declaration");

-  if (llvm::TimePassesIsEnabled)
-LLVMIRGeneration.startTimer();
+  // Recurse.
+  if (llvm::TimePassesIsEnabled) {
+LLVMIRGenerationRefCount += 1;
+if (LLVMIRGenerationRefCount == 1)
+  LLVMIRGeneration.startTimer();
+  }

   Gen->HandleTopLevelDecl(D);

-  if (llvm::TimePassesIsEnabled)
-LLVMIRGeneration.stopTimer();
+  if (llvm::TimePassesIsEnabled) {
+LLVMIRGenerationRefCount -= 1;
+if (LLVMIRGenerationRefCount == 0)
+  LLVMIRGeneration.stopTimer();
+  }

   return true;
 }
@@ -139,13 +148,19 @@
 void HandleTranslationUnit(ASTContext ) override {
   {
 PrettyStackTraceString CrashInfo("Per-file LLVM IR generation");
-if (llvm::TimePassesIsEnabled)
-  LLVMIRGeneration.startTimer();
+if (llvm::TimePassesIsEnabled) {
+  LLVMIRGenerationRefCount += 1;
+  if (LLVMIRGenerationRefCount == 1)
+LLVMIRGeneration.startTimer();
+}

 Gen->HandleTranslationUnit(C);

-if (llvm::TimePassesIsEnabled)
-  LLVMIRGeneration.stopTimer();
+if (llvm::TimePassesIsEnabled) {
+  LLVMIRGenerationRefCount -= 1;
+  if (LLVMIRGenerationRefCount == 0)
+

r271042 - [Driver] Fix driver support for color diagnostics

2016-05-27 Thread Bruno Cardoso Lopes via cfe-commits
Author: bruno
Date: Fri May 27 15:43:00 2016
New Revision: 271042

URL: http://llvm.org/viewvc/llvm-project?rev=271042=rev
Log:
[Driver] Fix driver support for color diagnostics

Diagnostics that happen during driver time do not have color output support
unless -fcolor-diagonostic is explicitly passed into the driver.  This is not a
problem for cc1 since dianostic arguments are properly handled and color is
enabled by default if the terminal supports it.

Make the driver behave like CC1. There are tests that already check for these
flags, but for the color itself there's no sensible way to test it.

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

rdar://problem/26290980

Modified:
cfe/trunk/include/clang/Frontend/CompilerInvocation.h
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp

Modified: cfe/trunk/include/clang/Frontend/CompilerInvocation.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CompilerInvocation.h?rev=271042=271041=271042=diff
==
--- cfe/trunk/include/clang/Frontend/CompilerInvocation.h (original)
+++ cfe/trunk/include/clang/Frontend/CompilerInvocation.h Fri May 27 15:43:00 
2016
@@ -47,7 +47,8 @@ class DiagnosticsEngine;
 /// When errors are encountered, return false and, if Diags is non-null,
 /// report the error(s).
 bool ParseDiagnosticArgs(DiagnosticOptions , llvm::opt::ArgList ,
- DiagnosticsEngine *Diags = nullptr);
+ DiagnosticsEngine *Diags = nullptr,
+ bool DefaultDiagColor = true);
 
 class CompilerInvocationBase : public RefCountedBase {
   void operator=(const CompilerInvocationBase &) = delete;

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=271042=271041=271042=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Fri May 27 15:43:00 2016
@@ -5589,43 +5589,27 @@ void Clang::ConstructJob(Compilation ,
   CmdArgs.push_back("-fno-diagnostics-show-note-include-stack");
   }
 
-  // Color diagnostics are the default, unless the terminal doesn't support
-  // them.
-  // Support both clang's -f[no-]color-diagnostics and gcc's
-  // -f[no-]diagnostics-colors[=never|always|auto].
-  enum { Colors_On, Colors_Off, Colors_Auto } ShowColors = Colors_Auto;
-  for (const auto  : Args) {
-const Option  = Arg->getOption();
+  // Color diagnostics are parsed by the driver directly from argv
+  // and later re-parsed to construct this job; claim any possible
+  // color diagnostic here to avoid warn_drv_unused_argument and
+  // diagnose bad OPT_fdiagnostics_color_EQ values.
+  for (Arg *A : Args) {
+const Option  = A->getOption();
 if (!O.matches(options::OPT_fcolor_diagnostics) &&
 !O.matches(options::OPT_fdiagnostics_color) &&
 !O.matches(options::OPT_fno_color_diagnostics) &&
 !O.matches(options::OPT_fno_diagnostics_color) &&
 !O.matches(options::OPT_fdiagnostics_color_EQ))
   continue;
-
-Arg->claim();
-if (O.matches(options::OPT_fcolor_diagnostics) ||
-O.matches(options::OPT_fdiagnostics_color)) {
-  ShowColors = Colors_On;
-} else if (O.matches(options::OPT_fno_color_diagnostics) ||
-   O.matches(options::OPT_fno_diagnostics_color)) {
-  ShowColors = Colors_Off;
-} else {
-  assert(O.matches(options::OPT_fdiagnostics_color_EQ));
-  StringRef value(Arg->getValue());
-  if (value == "always")
-ShowColors = Colors_On;
-  else if (value == "never")
-ShowColors = Colors_Off;
-  else if (value == "auto")
-ShowColors = Colors_Auto;
-  else
+if (O.matches(options::OPT_fdiagnostics_color_EQ)) {
+  StringRef Value(A->getValue());
+  if (Value != "always" && Value != "never" && Value != "auto")
 getToolChain().getDriver().Diag(diag::err_drv_clang_unsupported)
-<< ("-fdiagnostics-color=" + value).str();
+  << ("-fdiagnostics-color=" + Value).str();
 }
+A->claim();
   }
-  if (ShowColors == Colors_On ||
-  (ShowColors == Colors_Auto && 
llvm::sys::Process::StandardErrHasColors()))
+  if (D.getDiags().getDiagnosticOptions().ShowColors)
 CmdArgs.push_back("-fcolor-diagnostics");
 
   if (Args.hasArg(options::OPT_fansi_escape_codes))

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=271042=271041=271042=diff
==
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Fri May 27 15:43:00 2016
@@ -860,8 +860,51 @@ static void ParseDependencyOutputArgs(De
 

Re: [PATCH] D20444: [OpenCL] Include opencl-c.h by default as a clang module

2016-05-27 Thread Yaxun Liu via cfe-commits
yaxunl marked an inline comment as done.


Comment at: include/clang/Basic/LangOptions.def:220
@@ -219,3 +219,3 @@
 ENUM_LANGOPT(AddressSpaceMapMangling , AddrSpaceMapMangling, 2, ASMM_Target, 
"OpenCL address space map mangling mode")
-
+LANGOPT(IncludeDefaultHeader, 1, 0, "Include default header file for OpenCL")
 BENIGN_LANGOPT(DelayedTemplateParsing , 1, 0, "delayed template parsing")

I agree and has made the change.

The module caches AST of the header file, which is essentially the same thing 
as PCH.

I checked a typical OpenCL progam. Without including header,

   ---User Time---   --System Time--   --User+System--   ---Wall Time---  --- 
Name ---
   0.0160 (100.0%)   0.0080 (100.0%)   0.0240 (100.0%)   0.0211 (100.0%)  Clang 
front-end timer
   0.0160 (100.0%)   0.0080 (100.0%)   0.0240 (100.0%)   0.0211 (100.0%)  Total


With header but without module caching,
   ---User Time---   --System Time--   --User+System--   ---Wall Time---  --- 
Name ---
   0.2160 (100.0%)   0.0120 (100.0%)   0.2280 (100.0%)   0.2271 (100.0%)  Clang 
front-end timer
   0.2160 (100.0%)   0.0120 (100.0%)   0.2280 (100.0%)   0.2271 (100.0%)  Total

With header and module caching,
   ---User Time---   --System Time--   --User+System--   ---Wall Time---  --- 
Name ---
   0.0160 (100.0%)   0.0080 (100.0%)   0.0240 (100.0%)   0.0222 ( 93.6%)  Clang 
front-end timer
   0. (  0.0%)   0. (  0.0%)   0. (  0.0%)   0.0008 (  3.5%)  
Reading modules
   0. (  0.0%)   0. (  0.0%)   0. (  0.0%)   0.0007 (  2.9%)  
Loading 
/home/yaxunl/llvm-tot/llvm/tools/clang/test/CodeGenOpenCL/./JJHF9CF78G8Z/opencl_c-3RXFI66A6CUM7.pcm
   0.0160 (100.0%)   0.0080 (100.0%)   0.0240 (100.0%)   0.0237 (100.0%)  Total

So the caching is very effective and essentially makes the header loading time 
to be ignored.


http://reviews.llvm.org/D20444



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


Re: [PATCH] D20444: [OpenCL] Include opencl-c.h by default as a clang module

2016-05-27 Thread Yaxun Liu via cfe-commits
yaxunl retitled this revision from "[OpenCL] Include opencl-c.h by default as a 
module" to "[OpenCL] Include opencl-c.h by default as a clang module".
yaxunl updated the summary for this revision.
yaxunl updated this revision to Diff 58830.
yaxunl added a comment.

Revised as Anastasia suggested.

Add option -finclude-default-header to include OpenCL default header file, 
which is off by default.
Add test to make sure the AST of the header is really cached and works for 
different OpenCL versions.


http://reviews.llvm.org/D20444

Files:
  include/clang/Basic/LangOptions.def
  include/clang/Driver/CC1Options.td
  include/clang/Frontend/CompilerInvocation.h
  lib/Frontend/CompilerInvocation.cpp
  lib/Headers/module.modulemap
  test/Headers/opencl-c-header.cl

Index: test/Headers/opencl-c-header.cl
===
--- test/Headers/opencl-c-header.cl
+++ test/Headers/opencl-c-header.cl
@@ -1,9 +1,61 @@
 // RUN: %clang_cc1 -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s | FileCheck %s
 // RUN: %clang_cc1 -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.1| FileCheck %s
 // RUN: %clang_cc1 -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.2| FileCheck %s
-// RUN: %clang_cc1 -internal-isystem ../../lib/Headers -include opencl-c.h -fblocks -emit-llvm -o - %s -cl-std=CL2.0| FileCheck %s
+// RUN: %clang_cc1 -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL2.0| FileCheck --check-prefix=CHECK20 %s
+// RUN: %clang_cc1 -emit-llvm -verify -DNO_HEADER %s
 
+// RUN: %clang_cc1 -finclude-default-header -emit-llvm -o - %s | FileCheck %s
 // CHECK: _Z16convert_char_rtec
+// CHECK20: _Z3ctzc
+
+// Test including the default header as a module.
+// The module should be compiled only once and loaded from cache afterwards.
+
+// ===
+// Clear current directory.
+// RUN: rm -rf %t
+// RUN: mkdir -p %t
+
+// ===
+// Compile for OpenCL 1.0 for the first time. A module should be generated.
+// RUN: %clang_cc1 -cc1 -emit-llvm -o - -finclude-default-header -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fdisable-module-hash %s | FileCheck %s
+// RUN: cp %t/opencl_c.pcm %t/1_0.pcm
+
+// ===
+// Compile for OpenCL 1.0 for the second time. The module should not change.
+// RUN: %clang_cc1 -cc1 -emit-llvm -o - -finclude-default-header -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fdisable-module-hash %s | FileCheck %s
+// RUN: diff %t/1_0.pcm %t/opencl_c.pcm
+// RUN: rm %t/opencl_c.pcm
+
+// ===
+// Compile for OpenCL 2.0 for the first time. The module should change.
+// RUN: %clang_cc1 -cc1  -emit-llvm -o - -cl-std=CL2.0 -finclude-default-header -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fdisable-module-hash %s | FileCheck --check-prefix=CHECK20 %s
+// RUN: not diff %t/1_0.pcm %t/opencl_c.pcm
+// RUN: cp %t/opencl_c.pcm %t/2_0.pcm
+
+// ===
+// Compile for OpenCL 2.0 for the second time. The module should not change.
+// RUN: %clang_cc1 -cc1  -emit-llvm -o - -cl-std=CL2.0 -finclude-default-header -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fdisable-module-hash %s | FileCheck --check-prefix=CHECK20 %s
+// RUN: diff %t/2_0.pcm %t/opencl_c.pcm
+
+// Check cached module works for different OpenCL versions.
+// RUN: rm -rf %t
+// RUN: mkdir -p %t
+// RUN: %clang_cc1 -cc1 -emit-llvm -o - -finclude-default-header -fmodules -fimplicit-module-maps -fmodules-cache-path=%t %s | FileCheck %s
+// RUN: %clang_cc1 -cc1  -emit-llvm -o - -cl-std=CL2.0 -finclude-default-header -fmodules -fimplicit-module-maps -fmodules-cache-path=%t %s | FileCheck --check-prefix=CHECK20 %s
+// RUN: %clang_cc1 -cc1  -emit-llvm -o - -cl-std=CL2.0 -triple amdgcn--amdhsa -finclude-default-header -fmodules -fimplicit-module-maps -fmodules-cache-path=%t %s | FileCheck --check-prefix=CHECK20 %s
+// RUN: %clang_cc1 -cc1 -emit-llvm -o - -finclude-default-header -fmodules -fimplicit-module-maps -fmodules-cache-path=%t %s | FileCheck %s
+// RUN: %clang_cc1 -cc1  -emit-llvm -o - -cl-std=CL2.0 -finclude-default-header -fmodules -fimplicit-module-maps -fmodules-cache-path=%t %s | FileCheck --check-prefix=CHECK20 %s
+// RUN: %clang_cc1 -cc1  -emit-llvm -o - -cl-std=CL2.0 -triple amdgcn--amdhsa -finclude-default-header -fmodules -fimplicit-module-maps -fmodules-cache-path=%t %s | FileCheck --check-prefix=CHECK20 %s
+
 char f(char x) {
+#if __OPENCL_C_VERSION__ != CL_VERSION_2_0
   return convert_char_rte(x);
+#ifdef NO_HEADER
+  //expected-warning@-2{{implicit declaration of function 'convert_char_rte' is invalid in C99}}
+#endif //NO_HEADER
+
+#else //__OPENCL_C_VERSION__
+  return ctz(x);
+#endif //__OPENCL_C_VERSION__
 }
Index: lib/Headers/module.modulemap
===
--- lib/Headers/module.modulemap
+++ lib/Headers/module.modulemap
@@ -157,3 +157,8 @@
 module _Builtin_stddef_max_align_t 

Re: [PATCH] D20334: [libcxx] Fix a bug in strstreambuf::overflow

2016-05-27 Thread Akira Hatanaka via cfe-commits
ahatanak added a comment.

Thanks!

Marshall, I've filed a PR for this bug:
https://llvm.org/bugs/show_bug.cgi?id=27915


http://reviews.llvm.org/D20334



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


Re: [PATCH] D19843: Use the name of the file on disk to issue a new diagnostic about non-portable #include and #import paths.

2016-05-27 Thread Eric Niebler via cfe-commits
eric_niebler updated this revision to Diff 58828.
eric_niebler added a comment.

Add fixit tests, fix path separator fixit issue on Windows.


http://reviews.llvm.org/D19843

Files:
  include/clang/Basic/DiagnosticGroups.td
  include/clang/Basic/DiagnosticLexKinds.td
  include/clang/Basic/FileManager.h
  include/clang/Basic/VirtualFileSystem.h
  include/clang/Lex/DirectoryLookup.h
  include/clang/Lex/HeaderSearch.h
  lib/Basic/FileManager.cpp
  lib/Basic/VirtualFileSystem.cpp
  lib/Lex/HeaderSearch.cpp
  lib/Lex/PPDirectives.cpp
  test/Lexer/Inputs/case-insensitive-include.h
  test/Lexer/case-insensitive-include-ms.c
  test/Lexer/case-insensitive-include.c
  test/PCH/case-insensitive-include.c

Index: test/PCH/case-insensitive-include.c
===
--- test/PCH/case-insensitive-include.c
+++ test/PCH/case-insensitive-include.c
@@ -2,7 +2,7 @@
 
 // Test this without pch.
 // RUN: cp %S/Inputs/case-insensitive-include.h %T
-// RUN: %clang_cc1 -fsyntax-only %s -include %s -I %T -verify
+// RUN: %clang_cc1 -Wno-nonportable-include-path -fsyntax-only %s -include %s -I %T -verify
 
 // Test with pch.
 // RUN: %clang_cc1 -emit-pch -o %t.pch %s -I %T
Index: test/Lexer/case-insensitive-include.c
===
--- /dev/null
+++ test/Lexer/case-insensitive-include.c
@@ -0,0 +1,27 @@
+// REQUIRES: case-insensitive-filesystem
+
+// RUN: mkdir -p %T/apath
+// RUN: cp %S/Inputs/case-insensitive-include.h %T
+// RUN: cd %T
+// RUN: %clang_cc1 -fsyntax-only %s -include %s -I %T -verify
+// RUN: %clang_cc1 -fsyntax-only -fdiagnostics-parseable-fixits %s -include %s -I %T 2>&1 | FileCheck %s
+
+#include "case-insensitive-include.h"
+#include "Case-Insensitive-Include.h" // expected-warning {{non-portable path}}
+// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:10-[[@LINE-1]]:38}:"\"case-insensitive-include.h\""
+
+#include "../Output/./case-insensitive-include.h"
+#include "../Output/./Case-Insensitive-Include.h" // expected-warning {{non-portable path}}
+// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:10-[[@LINE-1]]:50}:"\"../Output/./case-insensitive-include.h\""
+#include "../output/./case-insensitive-include.h" // expected-warning {{non-portable path}}
+// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:10-[[@LINE-1]]:50}:"\"../Output/./case-insensitive-include.h\""
+
+#include "apath/.././case-insensitive-include.h"
+#include "apath/.././Case-Insensitive-Include.h" // expected-warning {{non-portable path}}
+// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:10-[[@LINE-1]]:49}:"\"apath/.././case-insensitive-include.h\""
+#include "APath/.././case-insensitive-include.h" // For the sake of efficiency, this case is not diagnosed. :-(
+
+#include "../Output/./apath/.././case-insensitive-include.h"
+#include "../Output/./APath/.././case-insensitive-include.h" // For the sake of efficiency, this case is not diagnosed. :-(
+#include "../output/./apath/.././case-insensitive-include.h" // expected-warning {{non-portable path}}
+// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:10-[[@LINE-1]]:61}:"\"../Output/./apath/.././case-insensitive-include.h\""
Index: test/Lexer/case-insensitive-include-ms.c
===
--- /dev/null
+++ test/Lexer/case-insensitive-include-ms.c
@@ -0,0 +1,18 @@
+// REQUIRES: case-insensitive-filesystem
+
+// RUN: mkdir -p %T/apath
+// RUN: cp %S/Inputs/case-insensitive-include.h %T
+// RUN: cd %T
+// RUN: %clang_cc1 -fsyntax-only -fms-compatibility %s -include %s -I %T -verify
+// RUN: %clang_cc1 -fsyntax-only -fms-compatibility -fdiagnostics-parseable-fixits %s -include %s -I %T 2>&1 | FileCheck %s
+
+#include "..\Output\.\case-insensitive-include.h"
+#include "..\Output\.\Case-Insensitive-Include.h" // expected-warning {{non-portable path}}
+// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:10-[[@LINE-1]]:50}:"\"..\\Output\\.\\case-insensitive-include.h\""
+#include "..\output\.\case-insensitive-include.h" // expected-warning {{non-portable path}}
+// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:10-[[@LINE-1]]:50}:"\"..\\Output\\.\\case-insensitive-include.h\""
+
+#include "apath\..\.\case-insensitive-include.h"
+#include "apath\..\.\Case-Insensitive-Include.h" // expected-warning {{non-portable path}}
+// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:10-[[@LINE-1]]:49}:"\"apath\\..\\.\\case-insensitive-include.h\""
+#include "APath\..\.\case-insensitive-include.h" // For the sake of efficiency, this case is not diagnosed. :-(
Index: test/Lexer/Inputs/case-insensitive-include.h
===
--- /dev/null
+++ test/Lexer/Inputs/case-insensitive-include.h
@@ -0,0 +1,5 @@
+#pragma once
+
+struct S {
+  int x;
+};
Index: lib/Lex/PPDirectives.cpp
===
--- lib/Lex/PPDirectives.cpp
+++ lib/Lex/PPDirectives.cpp
@@ -24,6 +24,9 @@
 #include "clang/Lex/ModuleLoader.h"
 #include "clang/Lex/Pragma.h"
 #include 

Missing definition of a template virtual function

2016-05-27 Thread Srivastava, Sunil via cfe-commits
Hi,

I want to discuss the issue in PR27895,
   https://llvm.org/bugs/show_bug.cgi?id=27895

But I will give a slightly different example for this discussion.

The issue can be demonstrated by this standalone code. Should this example link
successfully?
--
template < typename T, int N = 0 > class TmplWithArray {
public:
  virtual T& operator [] (int idx);
  T ar[N+1];
};
template  T& TmplWithArray::operator[](int idx) {
  return ar[idx];
}
class Wrapper {
  TmplWithArray data;
  bool indexIt(int a);
};
bool Wrapper::indexIt(int a)
{
   return data[a];
}
int main(){}
--

Starting from  r227073 it does not link (at any optimization level). The code
has a direct call to the operator[] function, but that function definition is
not generated.

Versions prior to r227073,
-  at -O0 or -O1, generate the operator[] function and the direct call, and
-  at -O2 do not generate the function, but inline it
Either way they link fine.

In this example the key-function for the generation of the vtable is the
operator[] function itself.

So the compiler can either generate both the vtable and the operator[]
function, or not generate either; they are both consistent states.

The call in data[a] is to a virtual function, and if the compiler left it as a
virtual call, it will link. There will be no ctor, no vtable, and no operator[]
function. Wrapper::indexIt will be dead code, but it will link.

But the compiler does devirtualization of the call and generates a direct call,
yet, beginning with r227073, it does not generate the operator[] function.
Hence the link failure.

Another interesting tidbit is that if the operator[] is replaced by a plain
function doing the same thing, along with the corresponding change in the
usage, something like:
virtual T& getElt(int idx);
then the behavior is the same as pre r227073. Either getElt is defined or it
gets inlined.

BTW, this is not just an idle curiosity. This example was trimmed down from
a user bug report having a link failure.

Sunil Srivastava
Sony Interactive Entertainment
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20447: [OpenCL] Fixup extension list

2016-05-27 Thread Jan Vesely via cfe-commits
jvesely marked 7 inline comments as done.


Comment at: test/SemaOpenCL/extension-version.cl:12
@@ +11,3 @@
+#ifndef cl_clang_storage_class_specifiers
+#error "Missing cl_clang_storage_class_specifiers define"
+#endif

arsenm wrote:
> When the AMD compiler added these warnings a long time ago I found them 
> obnoxious and required adding more complicated ifdef combinations to silence 
> them
moved to D20744


Repository:
  rL LLVM

http://reviews.llvm.org/D20447



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


Re: [PATCH] D20677: Make it possible to build a -fno-exceptions libc++abi variant.

2016-05-27 Thread Eric Fiselier via cfe-commits
EricWF added a comment.

I have an issue with this change since it allows a libc++abi built without 
exceptions to be used in a program compiled with them. I assert that this 
should not be supported in any way.

My personal preference would be to remove as much of the exception API from the 
library when it's built without exceptions. This should cause link errors if a 
program contains any code that throws. If this is not done it creates bugs 
within code like `__terminate` as mentioned in an inline comment.

I would like to see another revision of this patch that removes as much of the 
exception API as possible. Looking at the symbols defined in `cxxabi.h` I would 
say ever symbol in sections 2.4 and 2.5 should not longer be defined in the 
library.



Comment at: src/cxa_handlers.cpp:62
@@ -61,3 +61,3 @@
 void
 __terminate(terminate_handler func) _NOEXCEPT
 {

If any part of your executable was compiled with exceptions on, and it sets a 
terminate handler that throws an exception this does the wrong thing.  I don't 
really like that although I admit that would certainly be an exceptional 
situation.

At minimum this requirement needs to be documented explicitly somewhere. Within 
the CMake option description seems fine for now.


Comment at: src/cxa_personality.cpp:1204
@@ -1203,2 +1203,3 @@
 }
+#ifndef _LIBCXXABI_NO_EXCEPTIONS
 try

This is yucky. We are in exception handling code and we are saying it has been 
built without exceptions. I understand this "gets libc++abi to compile" without 
exceptions but it doesn't really make sense.


http://reviews.llvm.org/D20677



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


Re: [PATCH] D20677: Make it possible to build a -fno-exceptions libc++abi variant.

2016-05-27 Thread Marshall Clow via cfe-commits
mclow.lists added a comment.

If you're really going to do this, you should probably empty out most of the 
routines in src/cxa_exception.cpp as well.


http://reviews.llvm.org/D20677



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


Re: [PATCH] D20602: Add .rgba syntax extension to ext_vector_type types

2016-05-27 Thread Pirama Arumuga Nainar via cfe-commits
pirama updated this revision to Diff 58813.
pirama added a comment.

Switched to emitting errors when rgba is used in OpenCL < 2.2.  Also, fixed the
diagnostic's name mismatch at its point of issue.


http://reviews.llvm.org/D20602

Files:
  include/clang/AST/Type.h
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/AST/Expr.cpp
  lib/Sema/SemaExprMember.cpp
  test/CodeGen/ext-vector.c
  test/Sema/ext_vector_components.c
  test/SemaOpenCL/ext_vectors.cl

Index: test/SemaOpenCL/ext_vectors.cl
===
--- /dev/null
+++ test/SemaOpenCL/ext_vectors.cl
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL1.1
+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0
+
+typedef float float4 __attribute__((ext_vector_type(4)));
+
+void test_ext_vector_accessors(float4 V) {
+  V = V.wzyx;
+  V = V.abgr; // expected-error {{vector component name 'a' cannot be used earlier than OpenCL version 2.2}}
+  V = V.xyzr; // expected-error {{vector component name 'r' cannot be used earlier than OpenCL version 2.2}} \
+  // expected-error {{illegal vector component name 'r'}}
+}
Index: test/Sema/ext_vector_components.c
===
--- test/Sema/ext_vector_components.c
+++ test/Sema/ext_vector_components.c
@@ -39,6 +39,33 @@
 vec4.x = vec16.sF;
   
 vec4p->yz = vec4p->xy;
+
+vec2.a; // expected-error {{vector component access exceeds type 'float2'}}
+vec2.rgba; // expected-error {{vector component access exceeds type 'float2'}}
+vec4.rgba; // expected-warning {{expression result unused}}
+vec4.rgbz; // expected-error {{illegal vector component name 'z'}}
+vec4.rgbc; // expected-error {{illegal vector component name 'c'}}
+vec4.xyzr; // expected-error {{illegal vector component name 'r'}}
+vec4.s01b; // expected-error {{vector component access exceeds type 'float4'}}
+
+vec3 = vec4.rgb; // legal, shorten
+f = vec2.r; // legal, shorten
+f = vec4.rg.r; // legal, shorten
+vec4_2.rgba = vec4.xyzw; // legal, no intermingling
+
+vec4_2.rgbr = vec4.rgba; // expected-error {{vector is not assignable (contains duplicate components)}}
+vec4_2.rgbb = vec4.rgba; // expected-error {{vector is not assignable (contains duplicate components)}}
+vec4_2.rgga = vec4.rgba; // expected-error {{vector is not assignable (contains duplicate components)}}
+vec2.x = f;
+vec2.rr = vec2_2.rg; // expected-error {{vector is not assignable (contains duplicate components)}}
+vec2.gr = vec2_2.rg;
+vec2.gr.g = vec2_2.r;
+vec4 = (float4){ 1,2,3,4 };
+vec4.rg.b; // expected-error {{vector component access exceeds type 'float2'}}
+vec4.r = vec16.sf;
+vec4.g = vec16.sF;
+
+vec4p->gb = vec4p->rg;
 }
 
 float2 lo(float3 x) { return x.lo; }
Index: test/CodeGen/ext-vector.c
===
--- test/CodeGen/ext-vector.c
+++ test/CodeGen/ext-vector.c
@@ -301,3 +301,40 @@
   char valC;
   char16 destVal = valC ? valA : valB;
 }
+
+typedef __attribute__(( ext_vector_type(16) )) float float16;
+
+float16 vec16, vec16_2;
+
+// CHECK: @test_rgba
+void test_rgba() {
+  // CHECK: fadd <4 x float>
+  vec4_2 = vec4.abgr + vec4;
+
+  // CHECK: shufflevector {{.*}} 
+  vec2 = vec4.rg;
+  // CHECK: shufflevector {{.*}} 
+  vec2_2 = vec4.ba;
+  // CHECK: extractelement {{.*}} 2
+  f = vec4.b;
+  // CHECK: shufflevector {{.*}} 
+  vec4_2 = vec4_2.;
+
+  // CHECK: insertelement {{.*}} 0
+  vec2.r = f;
+  // CHECK: shufflevector {{.*}} 
+  vec2.gr = vec2;
+
+  // CHECK: extractelement {{.*}} 0
+  f = vec4_2.rg.r;
+  // CHECK: shufflevector {{.*}} 
+  // CHECK: shufflevector {{.*}} 
+  // CHECK: shufflevector {{.*}} 
+  vec4.rgb = vec4.bgr;
+
+  // CHECK: extractelement {{.*}} 11
+  // CHECK: insertelement {{.*}} 2
+  vec4.b = vec16.sb;
+  // CHECK: shufflevector {{.*}} 
+  vec4_2 = vec16.sabcd;
+}
Index: lib/Sema/SemaExprMember.cpp
===
--- lib/Sema/SemaExprMember.cpp
+++ lib/Sema/SemaExprMember.cpp
@@ -268,6 +268,20 @@
   llvm_unreachable("unexpected instance member access kind");
 }
 
+/// Determine whether input char is from rgba component set.
+static bool
+IsRGBA(char c) {
+  switch (c) {
+  case 'r':
+  case 'g':
+  case 'b':
+  case 'a':
+return true;
+  default:
+return false;
+  }
+}
+
 /// Check an ext-vector component access expression.
 ///
 /// VK should be set in advance to the value kind of the base
@@ -307,11 +321,25 @@
 HalvingSwizzle = true;
   } else if (!HexSwizzle &&
  (Idx = vecType->getPointAccessorIdx(*compStr)) != -1) {
+bool HasRGBA = IsRGBA(*compStr);
 do {
+  // Ensure that xyzw and rgba components don't intermingle.
+  if (HasRGBA != IsRGBA(*compStr))
+break;
   if (HasIndex[Idx]) HasRepeated = true;
   HasIndex[Idx] = 

r271022 - [Headers] Remove redundant typedef. NFC.

2016-05-27 Thread Ahmed Bougacha via cfe-commits
Author: ab
Date: Fri May 27 12:57:23 2016
New Revision: 271022

URL: http://llvm.org/viewvc/llvm-project?rev=271022=rev
Log:
[Headers] Remove redundant typedef. NFC.

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

Modified: cfe/trunk/lib/Headers/smmintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/smmintrin.h?rev=271022=271021=271022=diff
==
--- cfe/trunk/lib/Headers/smmintrin.h (original)
+++ cfe/trunk/lib/Headers/smmintrin.h Fri May 27 12:57:23 2016
@@ -299,7 +299,6 @@ _mm_cvtepi8_epi64(__m128i __V)
 {
   /* This function always performs a signed extension, but __v16qi is a char
  which may be signed or unsigned, so use __v16qs. */
-  typedef signed char __v16qs __attribute__((__vector_size__(16)));
   return 
(__m128i)__builtin_convertvector(__builtin_shufflevector((__v16qs)__V, 
(__v16qs)__V, 0, 1), __v2di);
 }
 


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


Re: [PATCH] D20660: Remove `auto_ptr` in C++17.

2016-05-27 Thread David Blaikie via cfe-commits
ah, indeed :/

On Fri, May 27, 2016 at 10:55 AM, Eric Fiselier  wrote:

> > As for tests - XFAILing seems a bit general when there's really not
> much value in running any of the tests anyway. REQUIRES, perhaps?
>
> Unfortunately REQUIRES is a conjunction so the obvious "// REQUIRES:
> c++98, c++03, c++11, c++14" won't work.
>
> On Thu, May 26, 2016 at 11:32 AM, David Blaikie 
> wrote:
>
>> NO_REMOVE seems like a strange way of saying it - is there existing
>> precedent for that naming/description? (rather than something like
>> _LIBCPP_PROVIDE_AUTOPTR ?
>>
>> As for tests - XFAILing seems a bit general when there's really not much
>> value in running any of the tests anyway. REQUIRES, perhaps? (that does
>> bring the issue I assume Eric is alluding to forward a bit (I assume what
>> he's alluding to is that when we have c++2x then we'd have to say XFAIL
>> c++1z c++2x and so on - switching it around we /already/ have the problem
>> that we'd want the auto_ptr tests to REQUIRE c++11, c++14 or whatever)) &
>> maybe having an explicit test or two for the negative case (I would worry
>> that XFAIL would be too vague "this should fail somehow... "). But maybe
>> that's all unnecessary paranoia.
>>
>> - Dave
>>
>> On Wed, May 25, 2016 at 9:28 PM, Marshall Clow via cfe-commits <
>> cfe-commits@lists.llvm.org> wrote:
>>
>>> mclow.lists created this revision.
>>> mclow.lists added a reviewer: EricWF.
>>> mclow.lists added a subscriber: cfe-commits.
>>>
>>> [[ http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4190 |
>>> N4190 ]] removed `auto_ptr` from C++1z. (and other stuff)
>>>
>>> Wrap all the auto_ptr bits in an #ifdef so they disappear when compiling
>>> with `-std=c++1z` or later.
>>>
>>> Introduce a new configuration option, `_LIBCPP_NO_REMOVE_AUTOPTR` which
>>> allows user code to continue using `auto_ptr` in C++1z mode if desired.
>>>
>>> Add a test for `_LIBCPP_NO_REMOVE_AUTOPTR`, and mark all the rest of the
>>> `auto_ptr` tests to XFAIL for c++1z
>>>
>>> http://reviews.llvm.org/D20660
>>>
>>> Files:
>>>   include/memory
>>>   test/libcxx/depr/depr.auto.ptr/auto.ptr/auto_ptr.cxx1z.pass.cpp
>>>   test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/assignment.pass.cpp
>>>   test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/convert.pass.cpp
>>>
>>> test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/convert_assignment.pass.cpp
>>>   test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/copy.pass.cpp
>>>   test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/pointer.pass.cpp
>>>
>>> test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/assign_from_auto_ptr_ref.pass.cpp
>>>
>>> test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_from_auto_ptr_ref.pass.cpp
>>>
>>> test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_to_auto_ptr.pass.cpp
>>>
>>> test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_to_auto_ptr_ref.pass.cpp
>>>   test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/arrow.pass.cpp
>>>   test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/deref.pass.cpp
>>>   test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/release.pass.cpp
>>>   test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/reset.pass.cpp
>>>   test/std/depr/depr.auto.ptr/auto.ptr/element_type.pass.cpp
>>>
>>>
>>> ___
>>> cfe-commits mailing list
>>> cfe-commits@lists.llvm.org
>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>>
>>>
>>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20715: [docs] Document the source-based code coverage feature

2016-05-27 Thread Vedant Kumar via cfe-commits
vsk updated this revision to Diff 58810.
vsk marked 4 inline comments as done.
vsk added a comment.

Thanks for the feedback!

- Addressed Sean's review comments.
- Fixed the line count displayed in the summary view of `foo`.


http://reviews.llvm.org/D20715

Files:
  docs/SourceBasedCodeCoverage.rst

Index: docs/SourceBasedCodeCoverage.rst
===
--- /dev/null
+++ docs/SourceBasedCodeCoverage.rst
@@ -0,0 +1,187 @@
+==
+Source-based Code Coverage
+==
+
+.. contents::
+   :local:
+
+Introduction
+
+
+This document explains how to use clang's source-based code coverage feature.
+It's called "source-based" because it operates on AST and preprocessor
+information directly. This allows it to generate very precise coverage data.
+
+Clang ships two other code coverage implementations:
+
+* :doc:`SanitizerCoverage` - A low-overhead tool meant for use alongside the
+  various sanitizers. It can provide up to edge-level coverage.
+
+* gcov - A GCC-compatible coverage implementation which operates on DebugInfo.
+
+From this point onwards "code coverage" will refer to the source-based kind.
+
+The code coverage workflow
+==
+
+The code coverage workflow consists of three main steps:
+
+1. Compiling with coverage enabled.
+
+2. Running the instrumented program.
+
+3. Creating coverage reports.
+
+The next few sections work through a complete, copy-'n-paste friendly example
+based on this program:
+
+.. code-block:: console
+
+% cat < foo.cc
+#define BAR(x) ((x) || (x))
+template  void foo(T x) {
+  for (unsigned I = 0; I < 10; ++I) { BAR(I); }
+}
+int main() {
+  foo(0);
+  foo(0);
+  return 0;
+}
+EOF
+
+Compiling with coverage enabled
+===
+
+To compile code with coverage enabled pass ``-fprofile-instr-generate
+-fcoverage-mapping`` to the compiler:
+
+.. code-block:: console
+
+# Step 1: Compile with coverage enabled.
+% clang++ -fprofile-instr-generate -fcoverage-mapping foo.cc -o foo
+
+Note that linking together code with and without coverage instrumentation is
+supported: any uninstrumented code simply won't be accounted for.
+
+Running the instrumented program
+
+
+The next step is to run the instrumented program. When the program exits it
+will write a **raw profile** to the path specified by the ``LLVM_PROFILE_FILE``
+environment variable. If that variable does not exist the profile is written to
+``./default.profraw``.
+
+If ``LLVM_PROFILE_FILE`` contains a path to a non-existent directory the
+missing directory structure will be created.  Additionally, the following
+special **pattern strings** are replaced:
+
+* "%p" expands out to the PID.
+
+* "%h" expands out to the hostname of the machine running the program.
+
+.. code-block:: console
+
+# Step 2: Run the program.
+% LLVM_PROFILE_FILE="foo.profraw" ./foo
+
+Creating coverage reports
+=
+
+Raw profiles have to be **indexed** before they can be used to generated
+coverage reports:
+
+.. code-block:: console
+
+# Step 3(a): Index the raw profile.
+% llvm-profdata merge -sparse foo.profraw -o foo.profdata
+
+You may be wondering why raw profiles aren't indexed automatically. In
+real-world projects multiple profiles have to be merged together before a
+report can be generated. This merge step is inevitable, so it makes sense to
+handle the compute-intensive indexing process at that point. A separate
+indexing step has the added benefit of keeping the compiler runtime small and
+simple.
+
+There are multiple different ways to render coverage reports. One option is to
+generate a line-oriented report:
+
+.. code-block:: console
+
+# Step 3(b): Create a line-oriented coverage report.
+% llvm-cov show ./foo -instr-profile=foo.profdata
+
+This report includes a summary view as well as dedicated sub-views for
+templated functions and their instantiations. For our example program, we get
+distinct views for ``foo(...)`` and ``foo(...)``.  If
+``-show-line-counts-or-regions`` is enabled, ``llvm-cov`` displays nested
+region counts (even in macro expansions):
+
+.. code-block:: console
+
+   20|1|#define BAR(x) ((x) || (x))
+   ^20 ^2
+2|2|template  void foo(T x) {
+   22|3|  for (unsigned I = 0; I < 10; ++I) { BAR(I); }
+   ^22 ^20  ^20^20
+2|4|}
+--
+| _Z3fooIiEvT_:
+|  1|2|template  void foo(T x) {
+| 11|3|  for (unsigned I = 0; I < 10; ++I) { BAR(I); }
+| ^11 ^10  ^10^10
+|  1|4|}
+--
+| _Z3fooIfEvT_:
+|  1|2|template  void foo(T x) {
+| 11|3|  for (unsigned I = 0; I < 10; ++I) { BAR(I); }
+|  

Re: [PATCH] D20447: [OpenCL] Fixup extension list

2016-05-27 Thread Matt Arsenault via cfe-commits
arsenm added a subscriber: arsenm.


Comment at: test/SemaOpenCL/extension-version.cl:12
@@ +11,3 @@
+#ifndef cl_clang_storage_class_specifiers
+#error "Missing cl_clang_storage_class_specifiers define"
+#endif

When the AMD compiler added these warnings a long time ago I found them 
obnoxious and required adding more complicated ifdef combinations to silence 
them


Repository:
  rL LLVM

http://reviews.llvm.org/D20447



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


Re: [PATCH] D20737: clang-format: [JS] FormatToken.startsSequence/endsSequence.

2016-05-27 Thread Martin Probst via cfe-commits
mprobst updated this revision to Diff 58809.
mprobst added a comment.

- fix description


http://reviews.llvm.org/D20737

Files:
  lib/Format/FormatToken.h
  lib/Format/TokenAnnotator.h
  lib/Format/UnwrappedLineParser.cpp
  unittests/Format/FormatTestJS.cpp

Index: unittests/Format/FormatTestJS.cpp
===
--- unittests/Format/FormatTestJS.cpp
+++ unittests/Format/FormatTestJS.cpp
@@ -354,6 +354,10 @@
   verifyFormat("class X {\n"
"  async asyncMethod() { return fetch(1); }\n"
"}");
+  verifyFormat("function initialize() {\n"
+   "  // Comment.\n"
+   "  return async.then();\n"
+   "}\n");
 }
 
 TEST_F(FormatTestJS, ArrayLiterals) {
Index: lib/Format/UnwrappedLineParser.cpp
===
--- lib/Format/UnwrappedLineParser.cpp
+++ lib/Format/UnwrappedLineParser.cpp
@@ -1013,7 +1013,9 @@
   // Parse function literal unless 'function' is the first token in a line
   // in which case this should be treated as a free-standing function.
   if (Style.Language == FormatStyle::LK_JavaScript &&
-  FormatTok->isOneOf(Keywords.kw_async, Keywords.kw_function) &&
+  (FormatTok->is(Keywords.kw_function) ||
+   FormatTok->startsSequence(Keywords.kw_async,
+ Keywords.kw_function)) &&
   Line->Tokens.size() > 0) {
 tryToParseJSFunction();
 break;
@@ -1200,7 +1202,8 @@
 }
 
 void UnwrappedLineParser::tryToParseJSFunction() {
-  assert(FormatTok->isOneOf(Keywords.kw_async, Keywords.kw_function));
+  assert(FormatTok->is(Keywords.kw_function) ||
+ FormatTok->startsSequence(Keywords.kw_async, Keywords.kw_function));
   if (FormatTok->is(Keywords.kw_async))
 nextToken();
   // Consume "function".
@@ -1254,7 +1257,8 @@
   // replace this by using parseAssigmentExpression() inside.
   do {
 if (Style.Language == FormatStyle::LK_JavaScript) {
-  if (FormatTok->isOneOf(Keywords.kw_async, Keywords.kw_function)) {
+  if (FormatTok->is(Keywords.kw_function) ||
+  FormatTok->startsSequence(Keywords.kw_async, Keywords.kw_function)) {
 tryToParseJSFunction();
 continue;
   }
@@ -1352,7 +1356,8 @@
   break;
 case tok::identifier:
   if (Style.Language == FormatStyle::LK_JavaScript &&
-  FormatTok->isOneOf(Keywords.kw_async, Keywords.kw_function))
+  (FormatTok->is(Keywords.kw_function) ||
+   FormatTok->startsSequence(Keywords.kw_async, Keywords.kw_function)))
 tryToParseJSFunction();
   else
 nextToken();
Index: lib/Format/TokenAnnotator.h
===
--- lib/Format/TokenAnnotator.h
+++ lib/Format/TokenAnnotator.h
@@ -83,15 +83,15 @@
   /// \c true if this line starts with the given tokens in order, ignoring
   /// comments.
   template  bool startsWith(Ts... Tokens) const {
-return startsWithInternal(First, Tokens...);
+return First && First->startsSequence(Tokens...);
   }
 
   /// \c true if this line ends with the given tokens in reversed order,
   /// ignoring comments.
   /// For example, given tokens [T1, T2, T3, ...], the function returns true if
   /// this line is like "... T3 T2 T1".
   template  bool endsWith(Ts... Tokens) const {
-return endsWithInternal(Last, Tokens...);
+return Last && Last->endsSequence(Tokens...);
   }
 
   /// \c true if this line looks like a function definition instead of a
@@ -130,44 +130,6 @@
   // Disallow copying.
   AnnotatedLine(const AnnotatedLine &) = delete;
   void operator=(const AnnotatedLine &) = delete;
-
-  template 
-  bool startsWithInternal(const FormatToken *Tok, A K1) const {
-// Even though we skip comments in the outer `startWithInternal` function,
-// this loop is still necessary if it is invoked by the public interface
-// `startsWith`.
-while (Tok && Tok->is(tok::comment))
-  Tok = Tok->Next;
-return Tok && Tok->is(K1);
-  }
-
-  template 
-  bool startsWithInternal(const FormatToken *Tok, A K1, Ts... Tokens) const {
-// Skip comments before calling `startsWithInternal(Tok, K1)` so that  the
-// second call to `startsWithInternal` takes the correct `Tok->Next`, which
-// should be the next token of the token checked in the first call.
-while (Tok && Tok->is(tok::comment))
-  Tok = Tok->Next;
-return Tok && startsWithInternal(Tok, K1) &&
-   startsWithInternal(Tok->Next, Tokens...);
-  }
-
-  template 
-  bool endsWithInternal(const FormatToken *Tok, A K1) const {
-// See the comments above in `startsWithInternal(Tok, K1)`.
-while (Tok && Tok->is(tok::comment))
-  Tok = Tok->Previous;
-return Tok && Tok->is(K1);
-  }
-
-  template 
-  bool endsWithInternal(const FormatToken *Tok, A K1, Ts... Tokens) const {
-// See the comments above in 

[PATCH] D20737: clang-format: [JS] FormatToken.startsSequence/endsSequence.

2016-05-27 Thread Martin Probst via cfe-commits
mprobst created this revision.
mprobst added a reviewer: djasper.
mprobst added a subscriber: cfe-commits.
Herald added a subscriber: klimek.

Refactors AnnotatedLine.startsWith/endsWith by extracting the core functionality
into FormatToken.startsSequence/endsSequence. This allows checking tokens within
the pointered linked list structure with a lookahead, automatically ignoring
comments, which is useful in many places (e.g. see subsequent commit).

clang-format: [JS] fix async parsing.

Only treat the sequence `async function` as the start of a function expression,
as opposed to every occurrence of the token `async` (whoops).

http://reviews.llvm.org/D20737

Files:
  lib/Format/FormatToken.h
  lib/Format/TokenAnnotator.h
  lib/Format/UnwrappedLineParser.cpp
  unittests/Format/FormatTestJS.cpp

Index: unittests/Format/FormatTestJS.cpp
===
--- unittests/Format/FormatTestJS.cpp
+++ unittests/Format/FormatTestJS.cpp
@@ -354,6 +354,10 @@
   verifyFormat("class X {\n"
"  async asyncMethod() { return fetch(1); }\n"
"}");
+  verifyFormat("function initialize() {\n"
+   "  // Comment.\n"
+   "  return async.then();\n"
+   "}\n");
 }
 
 TEST_F(FormatTestJS, ArrayLiterals) {
Index: lib/Format/UnwrappedLineParser.cpp
===
--- lib/Format/UnwrappedLineParser.cpp
+++ lib/Format/UnwrappedLineParser.cpp
@@ -1013,7 +1013,9 @@
   // Parse function literal unless 'function' is the first token in a line
   // in which case this should be treated as a free-standing function.
   if (Style.Language == FormatStyle::LK_JavaScript &&
-  FormatTok->isOneOf(Keywords.kw_async, Keywords.kw_function) &&
+  (FormatTok->is(Keywords.kw_function) ||
+   FormatTok->startsSequence(Keywords.kw_async,
+ Keywords.kw_function)) &&
   Line->Tokens.size() > 0) {
 tryToParseJSFunction();
 break;
@@ -1200,7 +1202,8 @@
 }
 
 void UnwrappedLineParser::tryToParseJSFunction() {
-  assert(FormatTok->isOneOf(Keywords.kw_async, Keywords.kw_function));
+  assert(FormatTok->is(Keywords.kw_function) ||
+ FormatTok->startsSequence(Keywords.kw_async, Keywords.kw_function));
   if (FormatTok->is(Keywords.kw_async))
 nextToken();
   // Consume "function".
@@ -1254,7 +1257,8 @@
   // replace this by using parseAssigmentExpression() inside.
   do {
 if (Style.Language == FormatStyle::LK_JavaScript) {
-  if (FormatTok->isOneOf(Keywords.kw_async, Keywords.kw_function)) {
+  if (FormatTok->is(Keywords.kw_function) ||
+  FormatTok->startsSequence(Keywords.kw_async, Keywords.kw_function)) {
 tryToParseJSFunction();
 continue;
   }
@@ -1352,7 +1356,8 @@
   break;
 case tok::identifier:
   if (Style.Language == FormatStyle::LK_JavaScript &&
-  FormatTok->isOneOf(Keywords.kw_async, Keywords.kw_function))
+  (FormatTok->is(Keywords.kw_function) ||
+   FormatTok->startsSequence(Keywords.kw_async, Keywords.kw_function)))
 tryToParseJSFunction();
   else
 nextToken();
Index: lib/Format/TokenAnnotator.h
===
--- lib/Format/TokenAnnotator.h
+++ lib/Format/TokenAnnotator.h
@@ -83,15 +83,15 @@
   /// \c true if this line starts with the given tokens in order, ignoring
   /// comments.
   template  bool startsWith(Ts... Tokens) const {
-return startsWithInternal(First, Tokens...);
+return First && First->startsSequence(Tokens...);
   }
 
   /// \c true if this line ends with the given tokens in reversed order,
   /// ignoring comments.
   /// For example, given tokens [T1, T2, T3, ...], the function returns true if
   /// this line is like "... T3 T2 T1".
   template  bool endsWith(Ts... Tokens) const {
-return endsWithInternal(Last, Tokens...);
+return Last && Last->endsSequence(Tokens...);
   }
 
   /// \c true if this line looks like a function definition instead of a
@@ -130,44 +130,6 @@
   // Disallow copying.
   AnnotatedLine(const AnnotatedLine &) = delete;
   void operator=(const AnnotatedLine &) = delete;
-
-  template 
-  bool startsWithInternal(const FormatToken *Tok, A K1) const {
-// Even though we skip comments in the outer `startWithInternal` function,
-// this loop is still necessary if it is invoked by the public interface
-// `startsWith`.
-while (Tok && Tok->is(tok::comment))
-  Tok = Tok->Next;
-return Tok && Tok->is(K1);
-  }
-
-  template 
-  bool startsWithInternal(const FormatToken *Tok, A K1, Ts... Tokens) const {
-// Skip comments before calling `startsWithInternal(Tok, K1)` so that  the
-// second call to `startsWithInternal` takes the correct `Tok->Next`, which
-// should be the next token of the token checked in the first call.
-while (Tok && 

Re: [PATCH] D20447: [OpenCL] Fixup extension list

2016-05-27 Thread Jan Vesely via cfe-commits
jvesely updated this revision to Diff 58806.
jvesely added a comment.

add detection of extensions in early CL versions to test.


Repository:
  rL LLVM

http://reviews.llvm.org/D20447

Files:
  include/clang/Basic/OpenCLExtensions.def
  test/SemaOpenCL/extension-version.cl

Index: test/SemaOpenCL/extension-version.cl
===
--- /dev/null
+++ test/SemaOpenCL/extension-version.cl
@@ -0,0 +1,225 @@
+// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple spir-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple spir-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple spir-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL2.0 %s -verify -triple spir-unknown-unknown
+
+#if __OPENCL_C_VERSION__ >= 200
+// expected-no-diagnostics
+#endif
+
+// Extensions in all versions
+#ifndef cl_clang_storage_class_specifiers
+#error "Missing cl_clang_storage_class_specifiers define"
+#endif
+#pragma OPENCL EXTENSION cl_clang_storage_class_specifiers: enable
+
+#ifndef cl_khr_fp16
+#error "Missing cl_khr_fp16 define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_fp16: enable
+
+#ifndef cl_khr_int64_base_atomics
+#error "Missing cl_khr_int64_base_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_int64_base_atomics: enable
+
+#ifndef cl_khr_int64_extended_atomics
+#error "Missing cl_khr_int64_extended_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_int64_extended_atomics: enable
+
+#ifndef cl_khr_gl_sharing
+#error "Missing cl_khr_gl_sharing define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_gl_sharing: enable
+
+#ifndef cl_khr_icd
+#error "Missing cl_khr_icd define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_icd: enable
+
+// COre features in CL 1.1
+#if (__OPENCL_C_VERSION__ < 110)
+#ifndef cl_khr_byte_addressable_store
+#error "Missing cl_khr_byte_addressable_store define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_byte_addressable_store: enable
+
+#ifndef cl_khr_global_int32_base_atomics
+#error "Missing cl_khr_global_int32_base_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_global_int32_base_atomics: enable
+
+#ifndef cl_khr_global_int32_extended_atomics
+#error "Missing cl_khr_global_int32_extended_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_global_int32_extended_atomics: enable
+
+#ifndef cl_khr_local_int32_base_atomics
+#error "Missing cl_khr_local_int32_base_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_local_int32_base_atomics: enable
+
+#ifndef cl_khr_local_int32_extended_atomics
+#error "Missing cl_khr_local_int32_extended_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_local_int32_extended_atomics: enable
+
+#ifndef cl_khr_select_fprounding_mode
+#error "Missing cl_khr_select_fp_rounding_mode define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_select_fprounding_mode: enable
+
+#endif
+
+// Core feature in CL 1.2
+#if (__OPENCL_C_VERSION__ < 120)
+#ifndef cl_khr_fp64
+#error "Missing cl_khr_fp64 define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_fp64: enable
+#endif
+
+//Core feature in CL 2.0
+#if (__OPENCL_C_VERSION__ < 200)
+#ifndef cl_khr_3d_image_writes
+#error "Missing cl_khr_3d_image_writes define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_3d_image_writes: enable
+#endif
+
+
+#if (__OPENCL_C_VERSION__ >= 110)
+#ifndef cl_khr_gl_event
+#error "Missing cl_khr_gl_event define"
+#endif
+#else
+// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_gl_event' - ignoring}}
+#endif
+#pragma OPENCL EXTENSION cl_khr_gl_event: enable
+
+#if (__OPENCL_C_VERSION__ >= 110)
+#ifndef cl_khr_d3d10_sharing
+#error "Missing cl_khr_d3d10_sharing define"
+#endif
+#else
+// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_d3d10_sharing' - ignoring}}
+#endif
+#pragma OPENCL EXTENSION cl_khr_d3d10_sharing: enable
+
+#if (__OPENCL_C_VERSION__ >= 120)
+#ifndef cl_khr_context_abort
+#error "Missing cl_context_abort define"
+#endif
+#else
+// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_context_abort' - ignoring}}
+#endif
+#pragma OPENCL EXTENSION cl_khr_context_abort: enable
+
+#if (__OPENCL_C_VERSION__ >= 120)
+#ifndef cl_khr_d3d11_sharing
+#error "Missing cl_khr_d3d11_sharing define"
+#endif
+#else
+// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_d3d11_sharing' - ignoring}}
+#endif
+#pragma OPENCL EXTENSION cl_khr_d3d11_sharing: enable
+
+#if (__OPENCL_C_VERSION__ >= 120)
+#ifndef cl_khr_dx9_media_sharing
+#error "Missing cl_khr_dx9_media_sharing define"
+#endif
+#else
+// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_dx9_media_sharing' - ignoring}}
+#endif
+#pragma OPENCL EXTENSION cl_khr_dx9_media_sharing: enable
+
+#if (__OPENCL_C_VERSION__ >= 120)
+#ifndef cl_khr_image2d_from_buffer
+#error "Missing cl_khr_image2d_from_buffer define"
+#endif
+#else
+// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_image2d_from_buffer' - ignoring}}
+#endif
+#pragma OPENCL EXTENSION cl_khr_image2d_from_buffer: enable
+
+#if 

Re: [PATCH] D20730: [libcxx] Prefer UNSUPPORTED over conditional compilation for tests

2016-05-27 Thread Ben Craig via cfe-commits
bcraig added subscribers: mclow.lists, bcraig.
bcraig added a comment.

LGTM.  Add @mclow.lists as a reviewer.


http://reviews.llvm.org/D20730



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


Re: [PATCH] D20320: [libunwind] Improve unwinder stack usage - II

2016-05-27 Thread Ben Craig via cfe-commits
bcraig added a comment.

In http://reviews.llvm.org/D20320#442246, @rmaprath wrote:

> Do you know if there are clang / llvm passes that attempts to achieve some 
> sort of stack compaction? I couldn't find much.


I'm not sure if it belongs to its own pass, or if it is part of another pass, 
but the algorithm and discussion revolve around the term "stack coloring".  The 
code lives in llvm lib/CodeGen/StackColoring.  Here's a recent review that 
messed with it: http://reviews.llvm.org/D18827


Repository:
  rL LLVM

http://reviews.llvm.org/D20320



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


Re: [PATCH] D20428: Tracking exception specification source locations

2016-05-27 Thread don hinton via cfe-commits
hintonda added inline comments.


Comment at: lib/Parse/ParseDeclCXX.cpp:3403-3428
@@ -3402,6 +3402,7 @@
   // If we already had a dynamic specification, parse the noexcept for,
   // recovery, but emit a diagnostic and don't store the results.
-  SourceRange NoexceptRange;
+  SourceRange NoexceptRange(Tok.getLocation(),
+Tok.getEndLoc().getLocWithOffset(-1));
   ExceptionSpecificationType NoexceptType = EST_None;
 
   SourceLocation KeywordLoc = ConsumeToken();

@@ -3424,6 +3425,5 @@
   } else {
 // There is no argument.
 NoexceptType = EST_BasicNoexcept;
-NoexceptRange = SourceRange(KeywordLoc, KeywordLoc);
   }
 

hintonda wrote:
> aaron.ballman wrote:
> > hintonda wrote:
> > > The range for a single token is a single location.  The problem is your 
> > > test.  The range for "throw()" ends at the start of the ')' token.  For 
> > > "noexcept", the beginning and end are the same location, e.g., here's how 
> > > "int" is tested:
> > > 
> > > ```
> > > TEST(MatchVerifier, ParseError) {
> > >   LocationVerifier Verifier;
> > >   Verifier.expectLocation(1, 1);
> > >   EXPECT_FALSE(Verifier.match("int i", varDecl()));
> > > }
> > > ```
> > > 
> > > I think you should use this instead:
> > > 
> > > ```
> > > SourceRange NoexceptRange(Tok.getLocation());
> > > ```
> > Ah, how interesting; I would have assumed the range would be the full range 
> > of the source involved, but I forgot, that's what char ranges are for.
> Pasted the wrong test -- this one does the range:
> 
> ```
> TEST(RangeVerifier, WrongRange) {
>   RangeVerifier Verifier;
>   Verifier.expectRange(1, 1, 1, 1);
>   EXPECT_FALSE(Verifier.match("int i;", varDecl()));
> }
> ```
Sorry, looked at wrong tests -- should have looked at multi-character ending 
tokens. 

```
  NoexceptRange = SourceRange(
Tok.getLocation(), Tok.getLocation().getLocWithOffset(Tok.getLength()));
```


http://reviews.llvm.org/D20428



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


Re: [PATCH] D20632: clang-format: [JS] Support shebang lines on the very first line.

2016-05-27 Thread Alex Eagle via cfe-commits
alexeagle added a comment.

ping @djasper we need this fix in order to format angular 2 repo again


http://reviews.llvm.org/D20632



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


Re: [PATCH] D20428: Tracking exception specification source locations

2016-05-27 Thread Aaron Ballman via cfe-commits
aaron.ballman updated this revision to Diff 58804.
aaron.ballman marked 3 inline comments as done.
aaron.ballman added a comment.

Updating based on further review comments.


http://reviews.llvm.org/D20428

Files:
  include/clang/AST/Decl.h
  include/clang/AST/TypeLoc.h
  lib/AST/Decl.cpp
  lib/Sema/SemaType.cpp
  lib/Sema/TreeTransform.h
  lib/Serialization/ASTReader.cpp
  lib/Serialization/ASTWriter.cpp
  unittests/AST/SourceLocationTest.cpp

Index: unittests/AST/SourceLocationTest.cpp
===
--- unittests/AST/SourceLocationTest.cpp
+++ unittests/AST/SourceLocationTest.cpp
@@ -580,5 +580,72 @@
   Language::Lang_CXX11));
 }
 
+class ExceptionSpecRangeVerifier : public RangeVerifier {
+protected:
+  SourceRange getRange(const TypeLoc ) override {
+auto T =
+  Node.getUnqualifiedLoc().castAs();
+assert(!T.isNull());
+return T.getExceptionSpecRange();
+  }
+};
+
+class ParmVarExceptionSpecRangeVerifier : public RangeVerifier {
+protected:
+  SourceRange getRange(const ParmVarDecl ) override {
+if (const TypeSourceInfo *TSI = Node.getTypeSourceInfo()) {
+  TypeLoc TL = TSI->getTypeLoc();
+  if (TL.getType()->isPointerType()) {
+TL = TL.getNextTypeLoc().IgnoreParens();
+if (auto FPTL = TL.getAs()) {
+  return FPTL.getExceptionSpecRange();
+}
+  }
+}
+return SourceRange();
+  }
+};
+
+TEST(FunctionDecl, ExceptionSpecifications) {
+  ExceptionSpecRangeVerifier Verifier;
+
+  Verifier.expectRange(1, 10, 1, 16);
+  EXPECT_TRUE(Verifier.match("void f() throw();\n", loc(functionType(;
+
+  Verifier.expectRange(1, 10, 1, 34);
+  EXPECT_TRUE(Verifier.match("void f() throw(void(void) throw());\n",
+ loc(functionType(;
+
+  Verifier.expectRange(1, 10, 1, 19);
+  std::vector Args;
+  Args.push_back("-fms-extensions");
+  EXPECT_TRUE(Verifier.match("void f() throw(...);\n", loc(functionType()),
+ Args, Language::Lang_CXX));
+
+  Verifier.expectRange(1, 10, 1, 10);
+  EXPECT_TRUE(Verifier.match("void f() noexcept;\n", loc(functionType()),
+ Language::Lang_CXX11));
+
+  Verifier.expectRange(1, 10, 1, 24);
+  EXPECT_TRUE(Verifier.match("void f() noexcept(false);\n", loc(functionType()),
+ Language::Lang_CXX11));
+
+  Verifier.expectRange(1, 10, 1, 32);
+  EXPECT_TRUE(Verifier.match("void f() noexcept(noexcept(1+1));\n",
+ loc(functionType()), Language::Lang_CXX11));
+
+  ParmVarExceptionSpecRangeVerifier Verifier2;
+  Verifier2.expectRange(1, 25, 1, 31);
+  EXPECT_TRUE(Verifier2.match("void g(void (*fp)(void) throw());\n",
+  parmVarDecl(hasType(pointerType(pointee(
+  parenType(innerType(functionType();
+
+  Verifier2.expectRange(1, 25, 1, 38);
+  EXPECT_TRUE(Verifier2.match("void g(void (*fp)(void) noexcept(true));\n",
+  parmVarDecl(hasType(pointerType(pointee(
+  parenType(innerType(functionType())),
+  Language::Lang_CXX11));
+}
+
 } // end namespace ast_matchers
 } // end namespace clang
Index: lib/Serialization/ASTWriter.cpp
===
--- lib/Serialization/ASTWriter.cpp
+++ lib/Serialization/ASTWriter.cpp
@@ -572,6 +572,7 @@
   Record.AddSourceLocation(TL.getLocalRangeBegin());
   Record.AddSourceLocation(TL.getLParenLoc());
   Record.AddSourceLocation(TL.getRParenLoc());
+  Record.AddSourceRange(TL.getExceptionSpecRange());
   Record.AddSourceLocation(TL.getLocalRangeEnd());
   for (unsigned i = 0, e = TL.getNumParams(); i != e; ++i)
 Record.AddDeclRef(TL.getParam(i));
Index: lib/Serialization/ASTReader.cpp
===
--- lib/Serialization/ASTReader.cpp
+++ lib/Serialization/ASTReader.cpp
@@ -5812,6 +5812,8 @@
   TL.setLocalRangeBegin(ReadSourceLocation(Record, Idx));
   TL.setLParenLoc(ReadSourceLocation(Record, Idx));
   TL.setRParenLoc(ReadSourceLocation(Record, Idx));
+  TL.setExceptionSpecRange(SourceRange(ReadSourceLocation(Record, Idx),
+   ReadSourceLocation(Record, Idx)));
   TL.setLocalRangeEnd(ReadSourceLocation(Record, Idx));
   for (unsigned i = 0, e = TL.getNumParams(); i != e; ++i) {
 TL.setParam(i, ReadDeclAs(Record, Idx));
Index: lib/Sema/TreeTransform.h
===
--- lib/Sema/TreeTransform.h
+++ lib/Sema/TreeTransform.h
@@ -4942,6 +4942,7 @@
   NewTL.setLocalRangeBegin(TL.getLocalRangeBegin());
   NewTL.setLParenLoc(TL.getLParenLoc());
   NewTL.setRParenLoc(TL.getRParenLoc());
+  NewTL.setExceptionSpecRange(TL.getExceptionSpecRange());
   NewTL.setLocalRangeEnd(TL.getLocalRangeEnd());
   for (unsigned i = 0, e = NewTL.getNumParams(); i != e; ++i)
  

Re: [PATCH] D20428: Tracking exception specification source locations

2016-05-27 Thread Aaron Ballman via cfe-commits
aaron.ballman added inline comments.


Comment at: lib/Parse/ParseDeclCXX.cpp:3403-3428
@@ -3402,6 +3402,7 @@
   // If we already had a dynamic specification, parse the noexcept for,
   // recovery, but emit a diagnostic and don't store the results.
-  SourceRange NoexceptRange;
+  SourceRange NoexceptRange(Tok.getLocation(),
+Tok.getEndLoc().getLocWithOffset(-1));
   ExceptionSpecificationType NoexceptType = EST_None;
 
   SourceLocation KeywordLoc = ConsumeToken();

@@ -3424,6 +3425,5 @@
   } else {
 // There is no argument.
 NoexceptType = EST_BasicNoexcept;
-NoexceptRange = SourceRange(KeywordLoc, KeywordLoc);
   }
 

hintonda wrote:
> The range for a single token is a single location.  The problem is your test. 
>  The range for "throw()" ends at the start of the ')' token.  For "noexcept", 
> the beginning and end are the same location, e.g., here's how "int" is tested:
> 
> ```
> TEST(MatchVerifier, ParseError) {
>   LocationVerifier Verifier;
>   Verifier.expectLocation(1, 1);
>   EXPECT_FALSE(Verifier.match("int i", varDecl()));
> }
> ```
> 
> I think you should use this instead:
> 
> ```
> SourceRange NoexceptRange(Tok.getLocation());
> ```
Ah, how interesting; I would have assumed the range would be the full range of 
the source involved, but I forgot, that's what char ranges are for.


http://reviews.llvm.org/D20428



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


Re: [PATCH] D20714: [Clang-tidy] Fix some Include What You Use warnings; other minor fixes

2016-05-27 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko updated this revision to Diff 58803.
Eugene.Zelenko added a comment.

More diff content.


Repository:
  rL LLVM

http://reviews.llvm.org/D20714

Files:
  clang-tidy/ClangTidy.cpp
  clang-tidy/ClangTidy.h
  clang-tidy/ClangTidyDiagnosticConsumer.cpp
  clang-tidy/ClangTidyDiagnosticConsumer.h
  clang-tidy/ClangTidyModule.cpp
  clang-tidy/ClangTidyModule.h
  clang-tidy/ClangTidyOptions.cpp
  clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
  clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.h
  clang-tidy/llvm/HeaderGuardCheck.cpp
  clang-tidy/llvm/HeaderGuardCheck.h
  clang-tidy/tool/ClangTidyMain.cpp
  clang-tidy/utils/OptionsUtils.cpp
  clang-tidy/utils/OptionsUtils.h

Index: clang-tidy/tool/ClangTidyMain.cpp
===
--- clang-tidy/tool/ClangTidyMain.cpp
+++ clang-tidy/tool/ClangTidyMain.cpp
@@ -16,11 +16,26 @@
 //===--===//
 
 #include "../ClangTidy.h"
+#include "../ClangTidyDiagnosticConsumer.h"
+#include "../ClangTidyOptions.h"
 #include "clang/Tooling/CommonOptionsParser.h"
+#include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Compiler.h"
+#include "llvm/Support/ErrorOr.h"
+#include "llvm/Support/FileSystem.h"
 #include "llvm/Support/Process.h"
+#include "llvm/Support/raw_ostream.h"
+#include "llvm/Support/Timer.h"
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
 
 using namespace clang::ast_matchers;
-using namespace clang::driver;
 using namespace clang::tooling;
 using namespace llvm;
 
Index: clang-tidy/ClangTidyOptions.cpp
===
--- clang-tidy/ClangTidyOptions.cpp
+++ clang-tidy/ClangTidyOptions.cpp
@@ -10,13 +10,18 @@
 #include "ClangTidyOptions.h"
 #include "ClangTidyModuleRegistry.h"
 #include "clang/Basic/LLVM.h"
+#include "llvm/ADT/None.h"
 #include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/Twine.h"
 #include "llvm/Support/Debug.h"
-#include "llvm/Support/Errc.h"
 #include "llvm/Support/FileSystem.h"
+#include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/YAMLTraits.h"
 #include "llvm/Support/raw_ostream.h"
+#include 
+#include 
+#include 
 #include 
 
 #define DEBUG_TYPE "clang-tidy-options"
@@ -50,6 +55,7 @@
 IO.mapRequired("name", File.Name);
 IO.mapOptional("lines", File.LineRanges);
   }
+
   static StringRef validate(IO , FileFilter ) {
 if (File.Name.empty())
   return "No file name specified";
@@ -72,12 +78,14 @@
   NOptionMap(IO &) {}
   NOptionMap(IO &, const ClangTidyOptions::OptionMap )
   : Options(OptionMap.begin(), OptionMap.end()) {}
+
   ClangTidyOptions::OptionMap denormalize(IO &) {
 ClangTidyOptions::OptionMap Map;
 for (const auto  : Options)
   Map[KeyValue.first] = KeyValue.second;
 return Map;
   }
+
   std::vector Options;
 };
 
Index: clang-tidy/ClangTidyModule.h
===
--- clang-tidy/ClangTidyModule.h
+++ clang-tidy/ClangTidyModule.h
@@ -14,8 +14,10 @@
 #include "llvm/ADT/StringRef.h"
 #include 
 #include 
+#include 
 #include 
-#include 
+#include 
+#include "ClangTidyOptions.h"
 
 namespace clang {
 namespace tidy {
Index: clang-tidy/llvm/HeaderGuardCheck.cpp
===
--- clang-tidy/llvm/HeaderGuardCheck.cpp
+++ clang-tidy/llvm/HeaderGuardCheck.cpp
@@ -8,6 +8,10 @@
 //===--===//
 
 #include "HeaderGuardCheck.h"
+#include "clang/Tooling/Tooling.h"
+#include 
+#include 
+#include 
 
 namespace clang {
 namespace tidy {
Index: clang-tidy/llvm/HeaderGuardCheck.h
===
--- clang-tidy/llvm/HeaderGuardCheck.h
+++ clang-tidy/llvm/HeaderGuardCheck.h
@@ -11,6 +11,8 @@
 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_LLVM_HEADER_GUARD_CHECK_H
 
 #include "../utils/HeaderGuard.h"
+#include "llvm/ADT/StringRef.h"
+#include 
 
 namespace clang {
 namespace tidy {
Index: clang-tidy/ClangTidyModule.cpp
===
--- clang-tidy/ClangTidyModule.cpp
+++ clang-tidy/ClangTidyModule.cpp
@@ -12,6 +12,8 @@
 //===--===//
 
 #include "ClangTidyModule.h"
+#include "ClangTidy.h"
+#include "ClangTidyDiagnosticConsumer.h"
 
 namespace clang {
 namespace tidy {
Index: clang-tidy/ClangTidy.h
===
--- clang-tidy/ClangTidy.h
+++ clang-tidy/ClangTidy.h
@@ -14,12 +14,18 @@
 #include "ClangTidyOptions.h"
 #include "clang/ASTMatchers/ASTMatchFinder.h"
 #include "clang/Basic/Diagnostic.h"
-#include "clang/Basic/SourceManager.h"
-#include "clang/Tooling/Refactoring.h"
-#include 

Re: [PATCH] D20617: [X86][SSE] _mm_store1_ps/_mm_store1_pd should require an aligned pointer

2016-05-27 Thread Simon Pilgrim via cfe-commits
RKSimon added inline comments.


Comment at: lib/Headers/emmintrin.h:598
@@ -594,3 +597,3 @@
 static __inline__ void __DEFAULT_FN_ATTRS
-_mm_store_pd(double *__dp, __m128d __a)
+_mm_store_pd1(double *__dp, __m128d __a)
 {

majnemer wrote:
> You could use `__attribute__((align_value(16)))` no?
Technically yes but AFAICT there are no other users of this approach in the 
headers - is it something that we should be encouraging do you think?

Craig - I think you wrote in a commit about dropping the unaligned intrinsics, 
is that how you'd do it? 


Repository:
  rL LLVM

http://reviews.llvm.org/D20617



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


Re: [PATCH] D20428: Tracking exception specification source locations

2016-05-27 Thread don hinton via cfe-commits
hintonda added inline comments.


Comment at: lib/Parse/ParseDeclCXX.cpp:3403-3428
@@ -3402,6 +3402,7 @@
   // If we already had a dynamic specification, parse the noexcept for,
   // recovery, but emit a diagnostic and don't store the results.
-  SourceRange NoexceptRange;
+  SourceRange NoexceptRange(Tok.getLocation(),
+Tok.getEndLoc().getLocWithOffset(-1));
   ExceptionSpecificationType NoexceptType = EST_None;
 
   SourceLocation KeywordLoc = ConsumeToken();

@@ -3424,6 +3425,5 @@
   } else {
 // There is no argument.
 NoexceptType = EST_BasicNoexcept;
-NoexceptRange = SourceRange(KeywordLoc, KeywordLoc);
   }
 

hintonda wrote:
> The range for a single token is a single location.  The problem is your test. 
>  The range for "throw()" ends at the start of the ')' token.  For "noexcept", 
> the beginning and end are the same location, e.g., here's how "int" is tested:
> 
> ```
> TEST(MatchVerifier, ParseError) {
>   LocationVerifier Verifier;
>   Verifier.expectLocation(1, 1);
>   EXPECT_FALSE(Verifier.match("int i", varDecl()));
> }
> ```
> 
> I think you should use this instead:
> 
> ```
> SourceRange NoexceptRange(Tok.getLocation());
> ```
Pasted the wrong test -- this one does the range:

```
TEST(RangeVerifier, WrongRange) {
  RangeVerifier Verifier;
  Verifier.expectRange(1, 1, 1, 1);
  EXPECT_FALSE(Verifier.match("int i;", varDecl()));
}
```


http://reviews.llvm.org/D20428



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


[PATCH] D20734: [clang-format] insert new #includes into correct blocks when cleaning up Replacement with cleanupAroundReplacements().

2016-05-27 Thread Eric Liu via cfe-commits
ioeric created this revision.
ioeric added reviewers: djasper, klimek.
ioeric added subscribers: bkramer, cfe-commits.
Herald added a subscriber: klimek.

When a replacement's offset is set to UINT_MAX or -1U, it is treated as
a header insertion replacement by cleanupAroundReplacements(). The new #include
directive is then inserted into the correct block.

http://reviews.llvm.org/D20734

Files:
  include/clang/Format/Format.h
  lib/Format/Format.cpp
  unittests/Format/CleanupTest.cpp

Index: unittests/Format/CleanupTest.cpp
===
--- unittests/Format/CleanupTest.cpp
+++ unittests/Format/CleanupTest.cpp
@@ -281,6 +281,294 @@
   EXPECT_EQ(Expected, applyAllReplacements(Code, FinalReplaces));
 }
 
+TEST_F(CleanUpReplacementsTest, NoExistingIncludeWithoutDefine) {
+  std::string Code = "int main() {}";
+  std::string Expected = "#include \"a.h\"\n"
+ "int main() {}";
+  Context.createInMemoryFile("fix.cpp", Code);
+  tooling::Replacements Replaces;
+  Replaces.insert(tooling::Replacement("fix.cpp", -1U, 0, "#include \"a.h\""));
+  format::FormatStyle Style = format::getLLVMStyle();
+  auto NewReplaces = cleanupAroundReplacements(Code, Replaces, Style);
+  EXPECT_EQ(Expected, applyAllReplacements(Code, NewReplaces));
+}
+
+TEST_F(CleanUpReplacementsTest, NoExistingIncludeWithDefine) {
+  std::string Code = "#ifndef __A_H__\n"
+ "#define __A_H__\n"
+ "class A {};\n"
+ "#define MMM 123\n"
+ "#endif";
+  std::string Expected = "#ifndef __A_H__\n"
+ "#define __A_H__\n"
+ "\n"
+ "#include \"b.h\"\n"
+ "class A {};\n"
+ "#define MMM 123\n"
+ "#endif";
+
+  Context.createInMemoryFile("fix.cpp", Code);
+  tooling::Replacements Replaces;
+  Replaces.insert(tooling::Replacement("fix.cpp", -1U, 0, "#include \"b.h\""));
+  format::FormatStyle Style = format::getLLVMStyle();
+  auto NewReplaces = cleanupAroundReplacements(Code, Replaces, Style);
+  EXPECT_EQ(Expected, applyAllReplacements(Code, NewReplaces));
+}
+
+TEST_F(CleanUpReplacementsTest, InsertAfterMainHeader) {
+  std::string Code = "#include \"fix.h\"\n"
+ "\n"
+ "int main() {}";
+  std::string Expected = "#include \"fix.h\"\n"
+ "#include \n"
+ "\n"
+ "int main() {}";
+  Context.createInMemoryFile("fix.cpp", Code);
+  tooling::Replacements Replaces;
+  Replaces.insert(tooling::Replacement("fix.cpp", -1U, 0, "#include "));
+  format::FormatStyle Style =
+  format::getGoogleStyle(format::FormatStyle::LanguageKind::LK_Cpp);
+  auto NewReplaces = cleanupAroundReplacements(Code, Replaces, Style);
+  EXPECT_EQ(Expected, applyAllReplacements(Code, NewReplaces));
+}
+
+TEST_F(CleanUpReplacementsTest, InsertBeforeSystemHeaderLLVM) {
+  std::string Code = "#include \n"
+ "\n"
+ "int main() {}";
+  std::string Expected = "#include \"z.h\"\n"
+ "#include \n"
+ "\n"
+ "int main() {}";
+  Context.createInMemoryFile("fix.cpp", Code);
+  tooling::Replacements Replaces;
+  Replaces.insert(tooling::Replacement("fix.cpp", -1U, 0, "#include \"z.h\""));
+  format::FormatStyle Style = format::getLLVMStyle();
+  auto NewReplaces = cleanupAroundReplacements(Code, Replaces, Style);
+  EXPECT_EQ(Expected, applyAllReplacements(Code, NewReplaces));
+}
+
+TEST_F(CleanUpReplacementsTest, InsertAfterSystemHeaderGoogle) {
+  std::string Code = "#include \n"
+ "\n"
+ "int main() {}";
+  std::string Expected = "#include \n"
+ "#include \"z.h\"\n"
+ "\n"
+ "int main() {}";
+  Context.createInMemoryFile("fix.cpp", Code);
+  tooling::Replacements Replaces;
+  Replaces.insert(tooling::Replacement("fix.cpp", -1U, 0, "#include \"z.h\""));
+  format::FormatStyle Style =
+  format::getGoogleStyle(format::FormatStyle::LanguageKind::LK_Cpp);
+  auto NewReplaces = cleanupAroundReplacements(Code, Replaces, Style);
+  EXPECT_EQ(Expected, applyAllReplacements(Code, NewReplaces));
+}
+
+TEST_F(CleanUpReplacementsTest, InsertOneIncludeLLVMStyle) {
+  std::string Code = "#include \"x/fix.h\"\n"
+ "#include \"a.h\"\n"
+ "#include \"b.h\"\n"
+ "#include \"clang/Format/Format.h\"\n"
+ "#include \n";
+  std::string Expected = "#include \"x/fix.h\"\n"
+ "#include \"a.h\"\n"
+ "#include \"b.h\"\n"
+ "#include \"d.h\"\n"
+ "#include \"clang/Format/Format.h\"\n"
+ "#include 

r271010 - Add instcombine pass if sampleprofile pass is enabled.

2016-05-27 Thread Dehao Chen via cfe-commits
Author: dehao
Date: Fri May 27 11:14:35 2016
New Revision: 271010

URL: http://llvm.org/viewvc/llvm-project?rev=271010=rev
Log:
Add instcombine pass if sampleprofile pass is enabled.

Summary: Sample profile pass need to have instcombine pass. A related change is 
http://reviews.llvm.org/D17742. But we should not explicitly add dependency 
between to non-analysis passes. So we add the dependency here.

Reviewers: davidxl, dnovillo

Subscribers: llvm-commits

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

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

Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=271010=271009=271010=diff
==
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original)
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Fri May 27 11:14:35 2016
@@ -178,6 +178,11 @@ static void addAddDiscriminatorsPass(con
   PM.add(createAddDiscriminatorsPass());
 }
 
+static void addInstructionCombiningPass(const PassManagerBuilder ,
+legacy::PassManagerBase ) {
+  PM.add(createInstructionCombiningPass());
+}
+
 static void addBoundsCheckingPass(const PassManagerBuilder ,
 legacy::PassManagerBase ) {
   PM.add(createBoundsCheckingPass());
@@ -441,7 +446,6 @@ void EmitAssemblyHelper::CreatePasses(Mo
   legacy::FunctionPassManager *FPM = getPerFunctionPasses();
   if (CodeGenOpts.VerifyModule)
 FPM->add(createVerifierPass());
-  PMBuilder.populateFunctionPassManager(*FPM);
 
   // Set up the per-module pass manager.
   if (!CodeGenOpts.RewriteMapFiles.empty())
@@ -480,9 +484,13 @@ void EmitAssemblyHelper::CreatePasses(Mo
   if (CodeGenOpts.hasProfileIRUse())
 PMBuilder.PGOInstrUse = CodeGenOpts.ProfileInstrumentUsePath;
 
-  if (!CodeGenOpts.SampleProfileFile.empty())
+  if (!CodeGenOpts.SampleProfileFile.empty()) {
 MPM->add(createSampleProfileLoaderPass(CodeGenOpts.SampleProfileFile));
+PMBuilder.addExtension(PassManagerBuilder::EP_EarlyAsPossible,
+   addInstructionCombiningPass);
+  }
 
+  PMBuilder.populateFunctionPassManager(*FPM);
   PMBuilder.populateModulePassManager(*MPM);
 }
 


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


Re: [PATCH] D20428: Tracking exception specification source locations

2016-05-27 Thread don hinton via cfe-commits
hintonda added inline comments.


Comment at: lib/Parse/ParseDeclCXX.cpp:3403-3428
@@ -3402,6 +3402,7 @@
   // If we already had a dynamic specification, parse the noexcept for,
   // recovery, but emit a diagnostic and don't store the results.
-  SourceRange NoexceptRange;
+  SourceRange NoexceptRange(Tok.getLocation(),
+Tok.getEndLoc().getLocWithOffset(-1));
   ExceptionSpecificationType NoexceptType = EST_None;
 
   SourceLocation KeywordLoc = ConsumeToken();

@@ -3424,6 +3425,5 @@
   } else {
 // There is no argument.
 NoexceptType = EST_BasicNoexcept;
-NoexceptRange = SourceRange(KeywordLoc, KeywordLoc);
   }
 

The range for a single token is a single location.  The problem is your test.  
The range for "throw()" ends at the start of the ')' token.  For "noexcept", 
the beginning and end are the same location, e.g., here's how "int" is tested:

```
TEST(MatchVerifier, ParseError) {
  LocationVerifier Verifier;
  Verifier.expectLocation(1, 1);
  EXPECT_FALSE(Verifier.match("int i", varDecl()));
}
```

I think you should use this instead:

```
SourceRange NoexceptRange(Tok.getLocation());
```


http://reviews.llvm.org/D20428



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


r271005 - [msan] add a sentence about inline assembly

2016-05-27 Thread Kostya Serebryany via cfe-commits
Author: kcc
Date: Fri May 27 10:49:32 2016
New Revision: 271005

URL: http://llvm.org/viewvc/llvm-project?rev=271005=rev
Log:
[msan] add a sentence about inline assembly

Modified:
cfe/trunk/docs/MemorySanitizer.rst

Modified: cfe/trunk/docs/MemorySanitizer.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/MemorySanitizer.rst?rev=271005=271004=271005=diff
==
--- cfe/trunk/docs/MemorySanitizer.rst (original)
+++ cfe/trunk/docs/MemorySanitizer.rst Fri May 27 10:49:32 2016
@@ -171,6 +171,8 @@ Handling external code
 MemorySanitizer requires that all program code is instrumented. This
 also includes any libraries that the program depends on, even libc.
 Failing to achieve this may result in false reports.
+For the same reason you may need to replace all inline assembly code that 
writes to memory
+with a pure C/C++ code.
 
 Full MemorySanitizer instrumentation is very difficult to achieve. To
 make it easier, MemorySanitizer runtime library includes 70+


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


Re: [PATCH] D19780: Output OpenCL version in Clang diagnostics

2016-05-27 Thread Anastasia Stulova via cfe-commits
Anastasia added a comment.

In http://reviews.llvm.org/D19780#442305, @rivanvx wrote:

> @Anastasia I looked into introducing a separate getOpenCLVersion() function 
> (or perhaps three - major version, minor version and version string). This 
> would have to be used in lib/CodeGen/TargetInfo.cpp and 
> lib/Parse/ParseDecl.cpp, and I am undecided on where should one put this 
> code. One option would be in Parse/Parser.h inside class Parser, and then 
> TargetInfo.cpp would have to include Parser.h, unless we decide to declare it 
> inside AST/ASTContext.h.
>
> In any case, this has so far two usages, and they are different (major and 
> minor version in TargetInfo.cpp vs version string in ParseDecl.cpp). 
> Therefore, I would propose to leave this as is for now, and rethink it after 
> the same code has to be used in more places.


Sure! It seems to make sense to me to have more use cases first. ;) Thanks for 
looking at it!


http://reviews.llvm.org/D19780



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


Re: [PATCH] D18369: [OpenCL] Upstreaming khronos OpenCL header file.

2016-05-27 Thread Anastasia Stulova via cfe-commits
Anastasia added a comment.

Since it has been in review for quite a while, should we try to commit it ASAP? 
I think Richard can give us his feedback later as well.


http://reviews.llvm.org/D18369



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


Re: [PATCH] D20320: [libunwind] Improve unwinder stack usage - II

2016-05-27 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL271004: [libunwind] Improve unwinder stack usage - II 
(authored by asiri).

Changed prior to commit:
  http://reviews.llvm.org/D20320?vs=57452=58794#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20320

Files:
  libunwind/trunk/src/Unwind-EHABI.cpp

Index: libunwind/trunk/src/Unwind-EHABI.cpp
===
--- libunwind/trunk/src/Unwind-EHABI.cpp
+++ libunwind/trunk/src/Unwind-EHABI.cpp
@@ -438,23 +438,22 @@
 }
 
 static _Unwind_Reason_Code
-unwind_phase1(unw_context_t *uc, _Unwind_Exception *exception_object) {
+unwind_phase1(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception *exception_object) {
   // EHABI #7.3 discusses preserving the VRS in a "temporary VRS" during
   // phase 1 and then restoring it to the "primary VRS" for phase 2. The
   // effect is phase 2 doesn't see any of the VRS manipulations from phase 1.
   // In this implementation, the phases don't share the VRS backing store.
   // Instead, they are passed the original |uc| and they create a new VRS
   // from scratch thus achieving the same effect.
-  unw_cursor_t cursor1;
-  unw_init_local(, uc);
+  unw_init_local(cursor, uc);
 
   // Walk each frame looking for a place to stop.
   for (bool handlerNotFound = true; handlerNotFound;) {
 
 #if !_LIBUNWIND_ARM_EHABI
 // Ask libuwind to get next frame (skip over first which is
 // _Unwind_RaiseException).
-int stepResult = unw_step();
+int stepResult = unw_step(cursor);
 if (stepResult == 0) {
   _LIBUNWIND_TRACE_UNWINDING("unwind_phase1(ex_ojb=%p): unw_step() reached "
  "bottom => _URC_END_OF_STACK\n",
@@ -470,7 +469,7 @@
 
 // See if frame has code to run (has personality routine).
 unw_proc_info_t frameInfo;
-if (unw_get_proc_info(, ) != UNW_ESUCCESS) {
+if (unw_get_proc_info(cursor, ) != UNW_ESUCCESS) {
   _LIBUNWIND_TRACE_UNWINDING("unwind_phase1(ex_ojb=%p): unw_get_proc_info "
  "failed => _URC_FATAL_PHASE1_ERROR\n",
  static_cast(exception_object));
@@ -482,12 +481,12 @@
   char functionBuf[512];
   const char *functionName = functionBuf;
   unw_word_t offset;
-  if ((unw_get_proc_name(, functionBuf, sizeof(functionBuf),
+  if ((unw_get_proc_name(cursor, functionBuf, sizeof(functionBuf),
  ) != UNW_ESUCCESS) ||
   (frameInfo.start_ip + offset > frameInfo.end_ip))
 functionName = ".anonymous.";
   unw_word_t pc;
-  unw_get_reg(, UNW_REG_IP, );
+  unw_get_reg(cursor, UNW_REG_IP, );
   _LIBUNWIND_TRACE_UNWINDING(
   "unwind_phase1(ex_ojb=%p): pc=0x%llX, start_ip=0x%llX, func=%s, "
   "lsda=0x%llX, personality=0x%llX\n",
@@ -505,7 +504,7 @@
   "unwind_phase1(ex_ojb=%p): calling personality function %p\n",
   static_cast(exception_object),
   reinterpret_cast(reinterpret_cast(p)));
-  struct _Unwind_Context *context = (struct _Unwind_Context *)();
+  struct _Unwind_Context *context = (struct _Unwind_Context *)(cursor);
   exception_object->pr_cache.fnstart = frameInfo.start_ip;
   exception_object->pr_cache.ehtp =
   (_Unwind_EHT_Header *)frameInfo.unwind_info;
@@ -553,12 +552,11 @@
   return _URC_NO_REASON;
 }
 
-static _Unwind_Reason_Code unwind_phase2(unw_context_t *uc,
+static _Unwind_Reason_Code unwind_phase2(unw_context_t *uc, unw_cursor_t *cursor,
  _Unwind_Exception *exception_object,
  bool resume) {
   // See comment at the start of unwind_phase1 regarding VRS integrity.
-  unw_cursor_t cursor2;
-  unw_init_local(, uc);
+  unw_init_local(cursor, uc);
 
   _LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p)\n",
  static_cast(exception_object));
@@ -580,13 +578,13 @@
   // for. After this, continue unwinding as if normal.
   //
   // See #7.4.6 for details.
-  unw_set_reg(, UNW_REG_IP,
+  unw_set_reg(cursor, UNW_REG_IP,
   exception_object->unwinder_cache.reserved2);
   resume = false;
 }
 
 #if !_LIBUNWIND_ARM_EHABI
-int stepResult = unw_step();
+int stepResult = unw_step(cursor);
 if (stepResult == 0) {
   _LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): unw_step() reached "
  "bottom => _URC_END_OF_STACK\n",
@@ -603,8 +601,8 @@
 // Get info about this frame.
 unw_word_t sp;
 unw_proc_info_t frameInfo;
-unw_get_reg(, UNW_REG_SP, );
-if (unw_get_proc_info(, ) != UNW_ESUCCESS) {
+unw_get_reg(cursor, UNW_REG_SP, );
+if (unw_get_proc_info(cursor, ) != UNW_ESUCCESS) {
   _LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): unw_get_proc_info "
  "failed => 

[libunwind] r271004 - [libunwind] Improve unwinder stack usage - II

2016-05-27 Thread Asiri Rathnayake via cfe-commits
Author: asiri
Date: Fri May 27 10:41:45 2016
New Revision: 271004

URL: http://llvm.org/viewvc/llvm-project?rev=271004=rev
Log:
[libunwind] Improve unwinder stack usage - II

unwind_phase1 and unwind_phase2 allocate their own copies of unw_cursor_t 
buffers
on the stack. This can blow-up stack usage of the unwinder depending on how 
these
two functions get inlined into _Unwind_RaiseException. Clang seems to inline
unwind_phase1 into _Unwind_RaiseException but not unwind_phase2, thus creating
two unw_cursor_t buffers on the stack.

One way to work-around this problem is to mark both unwind_phase1 and
unwind_phase2 as noinline. This patch takes the less compiler-dependent approach
and explicitly allocate a unw_cursor_t buffer and pass that into unwind_phase1
and unwind_phase2 functions.

A follow-up patch will replicate this behavior for the non-EHABI and non-SJLJ
implementations.

Reviewers: jroelofs, bcraig.

Differential revision: http://reviews.llvm.org/D20320

Modified:
libunwind/trunk/src/Unwind-EHABI.cpp

Modified: libunwind/trunk/src/Unwind-EHABI.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/Unwind-EHABI.cpp?rev=271004=271003=271004=diff
==
--- libunwind/trunk/src/Unwind-EHABI.cpp (original)
+++ libunwind/trunk/src/Unwind-EHABI.cpp Fri May 27 10:41:45 2016
@@ -438,15 +438,14 @@ extern "C" _Unwind_Reason_Code __aeabi_u
 }
 
 static _Unwind_Reason_Code
-unwind_phase1(unw_context_t *uc, _Unwind_Exception *exception_object) {
+unwind_phase1(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception 
*exception_object) {
   // EHABI #7.3 discusses preserving the VRS in a "temporary VRS" during
   // phase 1 and then restoring it to the "primary VRS" for phase 2. The
   // effect is phase 2 doesn't see any of the VRS manipulations from phase 1.
   // In this implementation, the phases don't share the VRS backing store.
   // Instead, they are passed the original |uc| and they create a new VRS
   // from scratch thus achieving the same effect.
-  unw_cursor_t cursor1;
-  unw_init_local(, uc);
+  unw_init_local(cursor, uc);
 
   // Walk each frame looking for a place to stop.
   for (bool handlerNotFound = true; handlerNotFound;) {
@@ -454,7 +453,7 @@ unwind_phase1(unw_context_t *uc, _Unwind
 #if !_LIBUNWIND_ARM_EHABI
 // Ask libuwind to get next frame (skip over first which is
 // _Unwind_RaiseException).
-int stepResult = unw_step();
+int stepResult = unw_step(cursor);
 if (stepResult == 0) {
   _LIBUNWIND_TRACE_UNWINDING("unwind_phase1(ex_ojb=%p): unw_step() reached 
"
  "bottom => _URC_END_OF_STACK\n",
@@ -470,7 +469,7 @@ unwind_phase1(unw_context_t *uc, _Unwind
 
 // See if frame has code to run (has personality routine).
 unw_proc_info_t frameInfo;
-if (unw_get_proc_info(, ) != UNW_ESUCCESS) {
+if (unw_get_proc_info(cursor, ) != UNW_ESUCCESS) {
   _LIBUNWIND_TRACE_UNWINDING("unwind_phase1(ex_ojb=%p): unw_get_proc_info "
  "failed => _URC_FATAL_PHASE1_ERROR\n",
  static_cast(exception_object));
@@ -482,12 +481,12 @@ unwind_phase1(unw_context_t *uc, _Unwind
   char functionBuf[512];
   const char *functionName = functionBuf;
   unw_word_t offset;
-  if ((unw_get_proc_name(, functionBuf, sizeof(functionBuf),
+  if ((unw_get_proc_name(cursor, functionBuf, sizeof(functionBuf),
  ) != UNW_ESUCCESS) ||
   (frameInfo.start_ip + offset > frameInfo.end_ip))
 functionName = ".anonymous.";
   unw_word_t pc;
-  unw_get_reg(, UNW_REG_IP, );
+  unw_get_reg(cursor, UNW_REG_IP, );
   _LIBUNWIND_TRACE_UNWINDING(
   "unwind_phase1(ex_ojb=%p): pc=0x%llX, start_ip=0x%llX, func=%s, "
   "lsda=0x%llX, personality=0x%llX\n",
@@ -505,7 +504,7 @@ unwind_phase1(unw_context_t *uc, _Unwind
   "unwind_phase1(ex_ojb=%p): calling personality function %p\n",
   static_cast(exception_object),
   reinterpret_cast(reinterpret_cast(p)));
-  struct _Unwind_Context *context = (struct _Unwind_Context *)();
+  struct _Unwind_Context *context = (struct _Unwind_Context *)(cursor);
   exception_object->pr_cache.fnstart = frameInfo.start_ip;
   exception_object->pr_cache.ehtp =
   (_Unwind_EHT_Header *)frameInfo.unwind_info;
@@ -553,12 +552,11 @@ unwind_phase1(unw_context_t *uc, _Unwind
   return _URC_NO_REASON;
 }
 
-static _Unwind_Reason_Code unwind_phase2(unw_context_t *uc,
+static _Unwind_Reason_Code unwind_phase2(unw_context_t *uc, unw_cursor_t 
*cursor,
  _Unwind_Exception *exception_object,
  bool resume) {
   // See comment at the start of unwind_phase1 regarding VRS integrity.
-  unw_cursor_t cursor2;
-  unw_init_local(, uc);
+  unw_init_local(cursor, uc);
 
   

Re: [PATCH] D19780: Output OpenCL version in Clang diagnostics

2016-05-27 Thread Vedran Miletić via cfe-commits
rivanvx added a comment.

@Anastasia I looked into introducing a separate getOpenCLVersion() function (or 
perhaps three - major version, minor version and version string). This would 
have to be used in lib/CodeGen/TargetInfo.cpp and lib/Parse/ParseDecl.cpp, and 
I am undecided on where should one put this code. One option would be in 
Parse/Parser.h inside class Parser, and then TargetInfo.cpp would have to 
include Parser.h, unless we decide to declare it inside AST/ASTContext.h.

In any case, this has so far two usages, and they are different (major and 
minor version in TargetInfo.cpp vs version string in ParseDecl.cpp). Therefore, 
I would propose to leave this as is for now, and rethink it after the same code 
has to be used in more places.


http://reviews.llvm.org/D19780



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


Re: [PATCH] D20090: [OPENCL] Fix wrongly vla error for OpenCL array.

2016-05-27 Thread Anastasia Stulova via cfe-commits
Anastasia added inline comments.


Comment at: test/CodeGenOpenCL/vla.cl:1
@@ +1,2 @@
+// RUN: %clang_cc1 -emit-llvm -O0 -o - %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -O0 -cl-std=CL2.0 -DCL20 -o - %s | FileCheck %s 
--check-prefix=CL20

pxli168 wrote:
> Anastasia wrote:
> > pxli168 wrote:
> > > Anastasia wrote:
> > > > Could we have a Sema test instead where we accept the VLA if constant 
> > > > AS object is used and give an error otherwise?
> > > > 
> > > > Also do we need to test CL2.0? We don't seem to be doing anything 
> > > > different for that version. 
> > > In earier than OpenCL1.2  program scope variable must reside in constant 
> > > address space and no
> > > ```
> > > const global int
> > > ```
> > > can be here.
> > > But const global value should also not be seen as VLA either.
> > Why not? Could you write a complete example perhaps? I am not sure I 
> > understand your point.
> > 
> > Thanks!
> Oh, I mean that in OpenCL 1.2 there will be some error message with
> ```
> const global int
> ```
> But I want to have a test with something that not only with the constant 
> address space.
> Or what you suggest is that I make all the test in OpenCL 2.0?
Yes, I think this should be enough for testing your change.


http://reviews.llvm.org/D20090



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


r271001 - [OpenMP] Fix SEMA bug in the capture of global variables in template functions.

2016-05-27 Thread Samuel Antao via cfe-commits
Author: sfantao
Date: Fri May 27 10:21:27 2016
New Revision: 271001

URL: http://llvm.org/viewvc/llvm-project?rev=271001=rev
Log:
[OpenMP] Fix SEMA bug in the capture of global variables in template functions.

Summary:
Target regions require globals to be captured. This patch fixes a bug exposed 
when that happens in a template function.


Reviewers: hfinkel, arpith-jacob, kkwli0, carlo.bertolli, ABataev

Subscribers: guansong, ABataev, cfe-commits, caomhin, fraggamuffin

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

Modified:
cfe/trunk/lib/Sema/SemaOpenMP.cpp
cfe/trunk/test/OpenMP/target_codegen_global_capture.cpp

Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=271001=271000=271001=diff
==
--- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Fri May 27 10:21:27 2016
@@ -818,6 +818,9 @@ bool DSAStackTy::hasDirective(
   const DeclarationNameInfo &, SourceLocation)>
 ,
 bool FromParent) {
+  // We look only in the enclosing region.
+  if (Stack.size() < 2)
+return false;
   auto StartI = std::next(Stack.rbegin());
   auto EndI = std::prev(Stack.rend());
   if (FromParent && StartI != EndI) {
@@ -990,8 +993,7 @@ VarDecl *Sema::IsOpenMPCapturedDecl(Valu
 if (DSAStack->getCurrentDirective() == OMPD_target &&
 !DSAStack->isClauseParsingMode())
   return VD;
-if (DSAStack->getCurScope() &&
-DSAStack->hasDirective(
+if (DSAStack->hasDirective(
 [](OpenMPDirectiveKind K, const DeclarationNameInfo &,
SourceLocation) -> bool {
   return isOpenMPTargetExecutionDirective(K);

Modified: cfe/trunk/test/OpenMP/target_codegen_global_capture.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_codegen_global_capture.cpp?rev=271001=271000=271001=diff
==
--- cfe/trunk/test/OpenMP/target_codegen_global_capture.cpp (original)
+++ cfe/trunk/test/OpenMP/target_codegen_global_capture.cpp Fri May 27 10:21:27 
2016
@@ -21,6 +21,11 @@
 // CHECK-DAG: [[BB:@.+]] = internal global float 1.00e+01
 // CHECK-DAG: [[BC:@.+]] = internal global float 1.10e+01
 // CHECK-DAG: [[BD:@.+]] = internal global float 1.20e+01
+// CHECK-DAG: [[TBA:@.+]] = {{.*}}global float 1.70e+01
+// CHECK-DAG: [[TBB:@.+]] = {{.*}}global float 1.80e+01
+// CHECK-DAG: [[TBC:@.+]] = {{.*}}global float 1.90e+01
+// CHECK-DAG: [[TBD:@.+]] = {{.*}}global float 2.00e+01
+
 double Ga = 1.0;
 double Gb = 2.0;
 double Gc = 3.0;
@@ -42,14 +47,14 @@ int foo(short a, short b, short c, short
   static float Sd = 8.0;
 
   // CHECK-DAG:[[VALLB:%.+]] = load i16, i16* [[LB]],
-  // CHECK-64-DAG: [[VALGB:%.+]] = load double, double* @Gb,
-  // CHECK-DAG:[[VALFB:%.+]] = load float, float* @_ZZ3fooE2Sb,
-  // CHECK-64-DAG: [[VALGC:%.+]] = load double, double* @Gc,
+  // CHECK-64-DAG: [[VALGB:%.+]] = load double, double* [[GB]],
+  // CHECK-DAG:[[VALFB:%.+]] = load float, float* [[FB]],
+  // CHECK-64-DAG: [[VALGC:%.+]] = load double, double* [[GC]],
   // CHECK-DAG:[[VALLC:%.+]] = load i16, i16* [[LC]],
-  // CHECK-DAG:[[VALFC:%.+]] = load float, float* @_ZZ3fooE2Sc,
+  // CHECK-DAG:[[VALFC:%.+]] = load float, float* [[FC]],
   // CHECK-DAG:[[VALLD:%.+]] = load i16, i16* [[LD]],
-  // CHECK-64-DAG: [[VALGD:%.+]] = load double, double* @Gd,
-  // CHECK-DAG:[[VALFD:%.+]] = load float, float* @_ZZ3fooE2Sd,
+  // CHECK-64-DAG: [[VALGD:%.+]] = load double, double* [[GD]],
+  // CHECK-DAG:[[VALFD:%.+]] = load float, float* [[FD]],
 
   // 3 local vars being captured.
 
@@ -178,14 +183,156 @@ int bar(short a, short b, short c, short
   #pragma omp parallel
   {
 // CHECK-DAG:[[VALLB:%.+]] = load i16, i16* [[LLB]],
-// CHECK-64-DAG: [[VALGB:%.+]] = load double, double* @Gb,
-// CHECK-DAG:[[VALFB:%.+]] = load float, float* @_ZZ3barE2Sb,
-// CHECK-64-DAG: [[VALGC:%.+]] = load double, double* @Gc,
+// CHECK-64-DAG: [[VALGB:%.+]] = load double, double* [[GB]],
+// CHECK-DAG:[[VALFB:%.+]] = load float, float* [[BB]],
+// CHECK-64-DAG: [[VALGC:%.+]] = load double, double* [[GC]],
+// CHECK-DAG:[[VALLC:%.+]] = load i16, i16* [[LLC]],
+// CHECK-DAG:[[VALFC:%.+]] = load float, float* [[BC]],
+// CHECK-DAG:[[VALLD:%.+]] = load i16, i16* [[LLD]],
+// CHECK-64-DAG: [[VALGD:%.+]] = load double, double* [[GD]],
+// CHECK-DAG:[[VALFD:%.+]] = load float, float* [[BD]],
+
+// 3 local vars being captured.
+
+// CHECK-DAG: store i16 [[VALLB]], i16* [[CONVLB:%.+]],
+// CHECK-DAG: [[CONVLB]] = bitcast i[[sz:64|32]]* [[CADDRLB:%.+]] to i16*
+// CHECK-DAG: [[CVALLB:%.+]] = load i[[sz]], i[[sz]]* [[CADDRLB]],
+// CHECK-DAG: 

Re: [PATCH] D20729: [mips] Compact branch policy setting

2016-05-27 Thread Simon Dardis via cfe-commits
sdardis added a comment.

Thanks for the review.


Repository:
  rL LLVM

http://reviews.llvm.org/D20729



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


r271000 - [mips] Compact branch policy setting.

2016-05-27 Thread Simon Dardis via cfe-commits
Author: sdardis
Date: Fri May 27 10:13:31 2016
New Revision: 271000

URL: http://llvm.org/viewvc/llvm-project?rev=271000=rev
Log:
[mips] Compact branch policy setting.

This patch adds the commandline option 
-mcompact-branches={never,optimal,always),
which controls how LLVM generates compact branches for MIPSR6 targets. By 
default,
the compact branch policy is 'optimal' where LLVM will generate the most
appropriate branch for any situation. The 'never' and 'always' policy will 
disable
or always generate compact branches wherever possible respectfully.

Reviewers: dsanders, vkalintiris, atanasyan

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

Modified:
cfe/trunk/docs/UsersManual.rst
cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td
cfe/trunk/include/clang/Basic/DiagnosticGroups.td
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/lib/Driver/Tools.h
cfe/trunk/test/Driver/mips-features.c

Modified: cfe/trunk/docs/UsersManual.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/UsersManual.rst?rev=271000=270999=271000=diff
==
--- cfe/trunk/docs/UsersManual.rst (original)
+++ cfe/trunk/docs/UsersManual.rst Fri May 27 10:13:31 2016
@@ -1140,6 +1140,16 @@ are listed below.
This option restricts the generated code to use general registers
only. This only applies to the AArch64 architecture.
 
+.. option:: -mcompact-branches=[values]
+
+   Control the usage of compact branches for MIPSR6.
+
+   Valid values are: ``never``, ``optimal`` and ``always``.
+   The default value is ``optimal`` which generates compact branches
+   when a delay slot cannot be filled. ``never`` disables the usage of
+   compact branches and ``always`` generates compact branches whenever
+   possible.
+
 **-f[no-]max-type-align=[number]**
Instruct the code generator to not enforce a higher alignment than the given
number (of bytes) when accessing memory via an opaque pointer or reference.

Modified: cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td?rev=271000=270999=271000=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td Fri May 27 10:13:31 
2016
@@ -238,6 +238,9 @@ def warn_target_unsupported_nan2008 : Wa
 def warn_target_unsupported_nanlegacy : Warning<
   "ignoring '-mnan=legacy' option because the '%0' architecture does not 
support it">,
   InGroup;
+def warn_target_unsupported_compact_branches : Warning<
+  "ignoring '-mcompact-branches=' option because the '%0' architecture does 
not"
+  " support it">, InGroup;
 
 def warn_drv_unable_to_find_directory_expected : Warning<
   "unable to find %0 directory, expected to be in '%1'">,

Modified: cfe/trunk/include/clang/Basic/DiagnosticGroups.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticGroups.td?rev=271000=270999=271000=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticGroups.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticGroups.td Fri May 27 10:13:31 2016
@@ -56,6 +56,7 @@ def FloatConversion :
 def DoublePromotion : DiagGroup<"double-promotion">;
 def EnumTooLarge : DiagGroup<"enum-too-large">;
 def UnsupportedNan : DiagGroup<"unsupported-nan">;
+def UnsupportedCB : DiagGroup<"unsupported-cb">;
 def NonLiteralNullConversion : DiagGroup<"non-literal-null-conversion">;
 def NullConversion : DiagGroup<"null-conversion">;
 def ImplicitConversionFloatingPointToBool :

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=271000=270999=271000=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Fri May 27 10:13:31 2016
@@ -1621,6 +1621,7 @@ def mno_ldc1_sdc1 : Flag<["-"], "mno-ldc
 def mcheck_zero_division : Flag<["-"], "mcheck-zero-division">, Group;
 def mno_check_zero_division : Flag<["-"], "mno-check-zero-division">,
   Group;
+def mcompact_branches_EQ : Joined<["-"], "mcompact-branches=">, Group;
 def mdsp : Flag<["-"], "mdsp">, Group;
 def mno_dsp : Flag<["-"], "mno-dsp">, Group;
 def mdspr2 : Flag<["-"], "mdspr2">, Group;

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=271000=270999=271000=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Fri May 27 10:13:31 2016
@@ -1436,6 +1436,19 @@ void 

Re: [PATCH] D20320: [libunwind] Improve unwinder stack usage - II

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

Probably worth doing the same thing for the non-EHABI non-SJLJ implementation, 
too (that can of course go in a separate commit).

LGTM


http://reviews.llvm.org/D20320



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


[PATCH] D20732: Don't use static variables in LambdaCapture

2016-05-27 Thread John Brawn via cfe-commits
john.brawn created this revision.
john.brawn added reviewers: faisalv, rsmith, jyknight.
john.brawn added a subscriber: cfe-commits.
john.brawn set the repository for this revision to rL LLVM.

When static variables are used in inline functions in header files anything 
that uses that function ends up with a reference to the variable. Because 
RecursiveASTVisitor uses the inline functions in LambdaCapture that use static 
variables any AST plugin that uses RecursiveASTVisitor, such as the 
PrintFunctionNames example, ends up with a reference to these variables. This 
is bad on Windows when building with MSVC with 
LLVM_EXPORT_SYMBOLS_FOR_PLUGINS=ON as variables used across a DLL boundary need 
to be explicitly dllimported in the DLL using them.

This patch avoids that by adjusting LambdaCapture to be similar to before 
r263921, with a capture of either 'this' or a VLA represented by a null Decl 
pointer in DeclAndBits with an extra flag added to the bits to distinguish 
between the two. This requires the use of an extra bit, and while Decl does 
happen to be sufficiently aligned to allow this it's done in a way that means 
PointerIntPair doesn't realise it and gives an assertion failure. Therefore I 
also adjust Decl slightly to use LLVM_ALIGNAS to allow this.

Repository:
  rL LLVM

http://reviews.llvm.org/D20732

Files:
  include/clang/AST/DeclBase.h
  include/clang/AST/LambdaCapture.h
  lib/AST/DeclBase.cpp
  lib/AST/ExprCXX.cpp

Index: lib/AST/ExprCXX.cpp
===
--- lib/AST/ExprCXX.cpp
+++ lib/AST/ExprCXX.cpp
@@ -818,13 +818,10 @@
   }
 }
 
-LambdaCapture::OpaqueCapturedEntity LambdaCapture::ThisSentinel;
-LambdaCapture::OpaqueCapturedEntity LambdaCapture::VLASentinel;
-
 LambdaCapture::LambdaCapture(SourceLocation Loc, bool Implicit,
  LambdaCaptureKind Kind, VarDecl *Var,
  SourceLocation EllipsisLoc)
-  : CapturedEntityAndBits(Var, 0), Loc(Loc), EllipsisLoc(EllipsisLoc)
+  : DeclAndBits(Var, 0), Loc(Loc), EllipsisLoc(EllipsisLoc)
 {
   unsigned Bits = 0;
   if (Implicit)
@@ -836,7 +833,7 @@
 // Fall through
   case LCK_This:
 assert(!Var && "'this' capture cannot have a variable!");
-CapturedEntityAndBits.setPointer();
+Bits |= Capture_This;
 break;
 
   case LCK_ByCopy:
@@ -847,19 +844,16 @@
 break;
   case LCK_VLAType:
 assert(!Var && "VLA type capture cannot have a variable!");
-CapturedEntityAndBits.setPointer();
 break;
   }
-  CapturedEntityAndBits.setInt(Bits);
+  DeclAndBits.setInt(Bits);
 }
 
 LambdaCaptureKind LambdaCapture::getCaptureKind() const {
-  void *Ptr = CapturedEntityAndBits.getPointer();
-  if (Ptr == )
+  if (capturesVLAType())
 return LCK_VLAType;
-  const unsigned Bits = CapturedEntityAndBits.getInt();
-  bool CapByCopy = Bits & Capture_ByCopy;
-  if (Ptr == )
+  bool CapByCopy = DeclAndBits.getInt() & Capture_ByCopy;
+  if (capturesThis())
 return CapByCopy ? LCK_StarThis : LCK_This;
   return CapByCopy ? LCK_ByCopy : LCK_ByRef;
 }
Index: lib/AST/DeclBase.cpp
===
--- lib/AST/DeclBase.cpp
+++ lib/AST/DeclBase.cpp
@@ -46,7 +46,7 @@
 }
 
 #define DECL(DERIVED, BASE)\
-  static_assert(Decl::DeclObjAlignment >=  \
+  static_assert(llvm::AlignOf::Alignment >=  \
 llvm::AlignOf::Alignment,   \
 "Alignment sufficient after objects prepended to " #DERIVED);
 #define ABSTRACT_DECL(DECL)
@@ -56,7 +56,7 @@
  unsigned ID, std::size_t Extra) {
   // Allocate an extra 8 bytes worth of storage, which ensures that the
   // resulting pointer will still be 8-byte aligned.
-  static_assert(sizeof(unsigned) * 2 >= DeclObjAlignment,
+  static_assert(sizeof(unsigned) * 2 >= llvm::AlignOf::Alignment,
 "Decl won't be misaligned");
   void *Start = Context.Allocate(Size + Extra + 8);
   void *Result = (char*)Start + 8;
@@ -81,7 +81,8 @@
 // Ensure required alignment of the resulting object by adding extra
 // padding at the start if required.
 size_t ExtraAlign =
-llvm::OffsetToAlignment(sizeof(Module *), DeclObjAlignment);
+llvm::OffsetToAlignment(sizeof(Module *),
+llvm::AlignOf::Alignment);
 char *Buffer = reinterpret_cast(
 ::operator new(ExtraAlign + sizeof(Module *) + Size + Extra, Ctx));
 Buffer += ExtraAlign;
Index: include/clang/AST/LambdaCapture.h
===
--- include/clang/AST/LambdaCapture.h
+++ include/clang/AST/LambdaCapture.h
@@ -33,19 +33,21 @@
 /// given capture was by-copy.
 ///
 /// This includes the case of a non-reference init-capture.
-Capture_ByCopy = 0x02
+Capture_ByCopy = 0x02,
+
+ 

Re: [PATCH] D20320: [libunwind] Improve unwinder stack usage - II

2016-05-27 Thread Asiri Rathnayake via cfe-commits
rmaprath added a comment.

In http://reviews.llvm.org/D20320#439368, @bcraig wrote:

> LGTM.  You probably need to get an approval from someone else though, as I 
> haven't really established myself in the libunwind code base.
>
> As a side note... one of these days clang / llvm stack compaction may 
> actually work reasonably well, and tricks like this won't be necessary.  I 
> look forward to that day.


Thanks.

Do you know if there are clang / llvm passes that attempts to achieve some sort 
of stack compaction? I couldn't find much.

@jroelofs: Gentle ping.

/ Asiri


http://reviews.llvm.org/D20320



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


Re: [PATCH] D20447: [OpenCL] Fixup extension list

2016-05-27 Thread Yaxun Liu via cfe-commits
yaxunl added inline comments.


Comment at: test/SemaOpenCL/extension-version.cl:11
@@ +10,3 @@
+#endif
+#pragma OPENCL EXTENSION cl_clang_storage_class_specifiers: enable
+

Anastasia wrote:
> jvesely wrote:
> > Anastasia wrote:
> > > jvesely wrote:
> > > > Anastasia wrote:
> > > > > Could you use standard diagnostic check please:
> > > > >   expected-warning{{unknown OpenCL extension ...
> > > > > 
> > > > > Similarly to SemaOpenCL/extensions.cl
> > > > not sure I follow, the test does not trigger any diagnostics (by 
> > > > design).
> > > > are you saying that I should introduce negative checks to make sure 
> > > > extensions are not available outside of their respective context?
> > > > Is there a way to filter verifier tags based on clang invocation? 
> > > > (something like FileCheck prefix)
> > > Exactly, you should check that the extensions are enabled correctly based 
> > > on CL versions.
> > > 
> > > For example if you compile this without passing -cl-std=CL1.2:
> > >   #pragma OPENCL EXTENSION cl_khr_gl_msaa_sharing: enable
> > > the following error is produced:
> > >   unsupported OpenCL extension 'cl_khr_gl_msaa_sharing' - ignoring
> > > 
> > > You can condition error directives on CL version passed as it's done in 
> > > the example test SemaOpenCL/extensions.cl.
> > > 
> > > So what is the original intension of this tests? Not sure I understand 
> > > what you are trying to test.
> > it's a positive test that checks that extensions are available (both that 
> > the define is present, and that #pragma passes without error).
> > 
> > I did not include negative tests (check that extension is not available 
> > outside of its respective context), because I think it's a bit overzealous 
> > reading of the specs.
> > For example cl_khr_d3d10_sharing is first mentioned in OpenCL 1.1 specs, 
> > but the text of the extension says that it is written against OpenCL 1.0.48 
> > spec. (I moved cl_khr_icd to 1.0 for the same reason). I think if a vendor 
> > can add vendor specific extensions to the list of supported extensions, it 
> > should be possible to add extensions from higher CL versions.
> > 
> > similarly, I would argue against warnings for extensions promoted to core 
> > features (or at least hide the warning behind -pedantic). they are listed 
> > in CL_DEVICE_EXTENSIONS for backwards compatibility so I'd say it is OK to 
> > allow pragmas in higher CLC versions for backward compatibility.
> I agree with this:
>   "similarly, I would argue against warnings for extensions promoted to core 
> features (or at least hide the warning behind -pedantic). they are listed in 
> CL_DEVICE_EXTENSIONS for backwards compatibility so I'd say it is OK to allow 
> pragmas in higher CLC versions for backward compatibility."
> 
> @yaxunl, what's your opinion here?
> 
> Regarding the test, I think we should still check the diagnostics being given 
> correctly especially for the extensions unavailable in the earlier versions. 
> It should be quite straight forward to extend this test.
The warning is a reminder that this is no longer an extension and the user 
should remove that. However I do not have strong opinion on that.


Repository:
  rL LLVM

http://reviews.llvm.org/D20447



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


Re: [PATCH] D20428: Tracking exception specification source locations

2016-05-27 Thread Aaron Ballman via cfe-commits
aaron.ballman updated this revision to Diff 58784.
aaron.ballman marked an inline comment as done.
aaron.ballman added a comment.

Updated based on review comments.


http://reviews.llvm.org/D20428

Files:
  include/clang/AST/Decl.h
  include/clang/AST/TypeLoc.h
  lib/AST/Decl.cpp
  lib/Parse/ParseDeclCXX.cpp
  lib/Sema/SemaType.cpp
  lib/Sema/TreeTransform.h
  lib/Serialization/ASTReader.cpp
  lib/Serialization/ASTWriter.cpp
  unittests/AST/SourceLocationTest.cpp

Index: unittests/AST/SourceLocationTest.cpp
===
--- unittests/AST/SourceLocationTest.cpp
+++ unittests/AST/SourceLocationTest.cpp
@@ -580,5 +580,72 @@
   Language::Lang_CXX11));
 }
 
+class ExceptionSpecRangeVerifier : public RangeVerifier {
+protected:
+  SourceRange getRange(const TypeLoc ) override {
+auto T =
+  Node.getUnqualifiedLoc().castAs();
+assert(!T.isNull());
+return T.getExceptionSpecRange();
+  }
+};
+
+class ParmVarExceptionSpecRangeVerifier : public RangeVerifier {
+protected:
+  SourceRange getRange(const ParmVarDecl ) override {
+if (const TypeSourceInfo *TSI = Node.getTypeSourceInfo()) {
+  TypeLoc TL = TSI->getTypeLoc();
+  if (TL.getType()->isPointerType()) {
+TL = TL.getNextTypeLoc().IgnoreParens();
+if (auto FPTL = TL.getAs()) {
+  return FPTL.getExceptionSpecRange();
+}
+  }
+}
+return SourceRange();
+  }
+};
+
+TEST(FunctionDecl, ExceptionSpecifications) {
+  ExceptionSpecRangeVerifier Verifier;
+
+  Verifier.expectRange(1, 10, 1, 16);
+  EXPECT_TRUE(Verifier.match("void f() throw();\n", loc(functionType(;
+
+  Verifier.expectRange(1, 10, 1, 34);
+  EXPECT_TRUE(Verifier.match("void f() throw(void(void) throw());\n",
+ loc(functionType(;
+
+  Verifier.expectRange(1, 10, 1, 19);
+  std::vector Args;
+  Args.push_back("-fms-extensions");
+  EXPECT_TRUE(Verifier.match("void f() throw(...);\n", loc(functionType()),
+ Args, Language::Lang_CXX));
+
+  Verifier.expectRange(1, 10, 1, 17);
+  EXPECT_TRUE(Verifier.match("void f() noexcept;\n", loc(functionType()),
+ Language::Lang_CXX11));
+
+  Verifier.expectRange(1, 10, 1, 24);
+  EXPECT_TRUE(Verifier.match("void f() noexcept(false);\n", loc(functionType()),
+ Language::Lang_CXX11));
+
+  Verifier.expectRange(1, 10, 1, 32);
+  EXPECT_TRUE(Verifier.match("void f() noexcept(noexcept(1+1));\n",
+ loc(functionType()), Language::Lang_CXX11));
+
+  ParmVarExceptionSpecRangeVerifier Verifier2;
+  Verifier2.expectRange(1, 25, 1, 31);
+  EXPECT_TRUE(Verifier2.match("void g(void (*fp)(void) throw());\n",
+  parmVarDecl(hasType(pointerType(pointee(
+  parenType(innerType(functionType();
+
+  Verifier2.expectRange(1, 25, 1, 38);
+  EXPECT_TRUE(Verifier2.match("void g(void (*fp)(void) noexcept(true));\n",
+  parmVarDecl(hasType(pointerType(pointee(
+  parenType(innerType(functionType())),
+  Language::Lang_CXX11));
+}
+
 } // end namespace ast_matchers
 } // end namespace clang
Index: lib/Serialization/ASTWriter.cpp
===
--- lib/Serialization/ASTWriter.cpp
+++ lib/Serialization/ASTWriter.cpp
@@ -572,6 +572,7 @@
   Record.AddSourceLocation(TL.getLocalRangeBegin());
   Record.AddSourceLocation(TL.getLParenLoc());
   Record.AddSourceLocation(TL.getRParenLoc());
+  Record.AddSourceRange(TL.getExceptionSpecRange());
   Record.AddSourceLocation(TL.getLocalRangeEnd());
   for (unsigned i = 0, e = TL.getNumParams(); i != e; ++i)
 Record.AddDeclRef(TL.getParam(i));
Index: lib/Serialization/ASTReader.cpp
===
--- lib/Serialization/ASTReader.cpp
+++ lib/Serialization/ASTReader.cpp
@@ -5812,6 +5812,8 @@
   TL.setLocalRangeBegin(ReadSourceLocation(Record, Idx));
   TL.setLParenLoc(ReadSourceLocation(Record, Idx));
   TL.setRParenLoc(ReadSourceLocation(Record, Idx));
+  TL.setExceptionSpecRange(SourceRange(ReadSourceLocation(Record, Idx),
+   ReadSourceLocation(Record, Idx)));
   TL.setLocalRangeEnd(ReadSourceLocation(Record, Idx));
   for (unsigned i = 0, e = TL.getNumParams(); i != e; ++i) {
 TL.setParam(i, ReadDeclAs(Record, Idx));
Index: lib/Sema/TreeTransform.h
===
--- lib/Sema/TreeTransform.h
+++ lib/Sema/TreeTransform.h
@@ -4942,6 +4942,7 @@
   NewTL.setLocalRangeBegin(TL.getLocalRangeBegin());
   NewTL.setLParenLoc(TL.getLParenLoc());
   NewTL.setRParenLoc(TL.getRParenLoc());
+  NewTL.setExceptionSpecRange(TL.getExceptionSpecRange());
   NewTL.setLocalRangeEnd(TL.getLocalRangeEnd());
   for (unsigned i = 0, e = 

Re: [PATCH] D20428: Tracking exception specification source locations

2016-05-27 Thread Aaron Ballman via cfe-commits
aaron.ballman added inline comments.


Comment at: lib/Parse/ParseDeclCXX.cpp:3403-3427
@@ -3402,5 +3402,6 @@
   // recovery, but emit a diagnostic and don't store the results.
-  SourceRange NoexceptRange;
+  SourceRange NoexceptRange(Tok.getLocation(),
+Tok.getEndLoc().getLocWithOffset(-1));
   ExceptionSpecificationType NoexceptType = EST_None;
 
   SourceLocation KeywordLoc = ConsumeToken();

@@ -3423,6 +3424,5 @@
   } else {
 // There is no argument.
 NoexceptType = EST_BasicNoexcept;
-NoexceptRange = SourceRange(KeywordLoc, KeywordLoc);
   }
 

rsmith wrote:
> This change seems strange:
> 
>  1) We should be using normal token-based ranges here; the 
> `getEndLoc().getLocWithOffset(-1)` doesn't make sense.
>  2) This specifies a range for the error case, where we produce an exception 
> specification of `EST_None`. We should not have a `NoexceptRange` if we're 
> recovering as if there were no `noexcept`.
> 
> Can you revert the changes to this file?
I agree that this code is strange, what I found was that anything other than 
getLocWithOffset would produce the wrong range (the resulting range would be 
off-by-one). I found other code that does this, but it may be equally incorrect 
if there's a better way to get a range for a token.

As for #2, I don't think that's actually the case. This is the code path that 
parses a noexcept specifier with no arguments. (Result starts as EST_None, we 
aren't delayed, there is no dynamic exception spec, the next token is noexcept, 
there is no l_paren, and so we set SpecificationRange and Result before 
returning). Without tracking the source range, the following test case fails 
because the token range has no length:
``` 
  Verifier.expectRange(1, 10, 1, 17);
  EXPECT_TRUE(Verifier.match("void f() noexcept;\n", loc(functionType()),
 Language::Lang_CXX11));
```
Is there a better way for me to get the full source range of the token? I would 
have assumed that getEndLoc() would work, but it appears to give an 
inconsistent result with other ranges that we track. e.g., noexcept(false) the 
caret points at ), throw(...) the caret points at ), but without the -1 offset 
above for void f() noexcept; the caret points at ; instead of t.


http://reviews.llvm.org/D20428



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


[PATCH] D20730: [libcxx] Prefer UNSUPPORTED over conditional compilation for tests

2016-05-27 Thread Asiri Rathnayake via cfe-commits
rmaprath created this revision.
rmaprath added a reviewer: EricWF.
rmaprath added a subscriber: cfe-commits.

We seem to have quite a few tests where an entire test is conditionalized over 
some range of `_LIBCPP_STD_VER`. We should consider getting rid of these and 
using the UNSUPPORTED lit directive instead.

This is mostly cosmetic, but sometimes can create problems if there are also 
XFAIL conditions on the same test. The test will be reported as an 
unexpected-pass when run with a `std=` option not compatible with the 
`_LIBCPP_STD_VER` check (because the test is trivially empty, it will pass 
rather than XFAIL).

I've attached a sample patch for one of the cases. If this looks OK, I can 
commit the whole hog.

http://reviews.llvm.org/D20730

Files:
  
test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/at.pass.cpp

Index: 
test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/at.pass.cpp
===
--- 
test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/at.pass.cpp
+++ 
test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/at.pass.cpp
@@ -7,6 +7,7 @@
 //
 
//===--===//
 
+// UNSUPPORTED: c++98, c++03, c++11
 // XFAIL: libcpp-no-exceptions
 // dynarray.overview
 
@@ -15,8 +16,6 @@
   
 #include <__config>
 
-#if _LIBCPP_STD_VER > 11
-
 #include 
 #include 
 
@@ -90,6 +89,3 @@
 test ( {} );
 test ( {} );
 }
-#else
-int main() {}
-#endif


Index: test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/at.pass.cpp
===
--- test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/at.pass.cpp
+++ test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/at.pass.cpp
@@ -7,6 +7,7 @@
 //
 //===--===//
 
+// UNSUPPORTED: c++98, c++03, c++11
 // XFAIL: libcpp-no-exceptions
 // dynarray.overview
 
@@ -15,8 +16,6 @@
   
 #include <__config>
 
-#if _LIBCPP_STD_VER > 11
-
 #include 
 #include 
 
@@ -90,6 +89,3 @@
 test ( {} );
 test ( {} );
 }
-#else
-int main() {}
-#endif
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D18110: [OpenMP] Fix SEMA bug in the capture of global variables in template functions.

2016-05-27 Thread Samuel Antao via cfe-commits
sfantao added a comment.

In http://reviews.llvm.org/D18110#441959, @ABataev wrote:

> Hi Daniel,
>  Will fix it ASAP


Hi Alexey,

Just to make sure: the bug I am talking about is fixed by this patch, that's 
why I didn't abandon this patch, instead I just rebased it. Sorry if my comment 
was misleading.

Thanks,
Samuel


http://reviews.llvm.org/D18110



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


Re: [PATCH] D20679: [mips] Kill 'support' for untested EABI.

2016-05-27 Thread Daniel Sanders via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL270998: [mips] Kill 'support' for untested EABI. (authored 
by dsanders).

Changed prior to commit:
  http://reviews.llvm.org/D20679?vs=58772=58782#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20679

Files:
  cfe/trunk/lib/Basic/Targets.cpp
  cfe/trunk/lib/Driver/Tools.cpp
  cfe/trunk/test/Driver/freebsd-mips-as.c
  cfe/trunk/test/Driver/mips-abi.c
  cfe/trunk/test/Driver/mips-as.c

Index: cfe/trunk/test/Driver/freebsd-mips-as.c
===
--- cfe/trunk/test/Driver/freebsd-mips-as.c
+++ cfe/trunk/test/Driver/freebsd-mips-as.c
@@ -45,11 +45,6 @@
 // RUN:   | FileCheck -check-prefix=MIPS64-DEF-EL-AS %s
 // MIPS64-DEF-EL-AS: as{{(.exe)?}}" "-march" "mips64r2" "-mabi" "64" "-EL"
 //
-// RUN: %clang -target mips-unknown-freebsd -mabi=eabi -### \
-// RUN:   -no-integrated-as -c %s 2>&1 \
-// RUN:   | FileCheck -check-prefix=MIPS-EABI %s
-// MIPS-EABI: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "eabi" "-EB"
-//
 // RUN: %clang -target mips64-unknown-freebsd -mabi=n32 -### \
 // RUN:   -no-integrated-as -c %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=MIPS-N32 %s
Index: cfe/trunk/test/Driver/mips-abi.c
===
--- cfe/trunk/test/Driver/mips-abi.c
+++ cfe/trunk/test/Driver/mips-abi.c
@@ -45,12 +45,6 @@
 // RUN:   | FileCheck -check-prefix=MIPS-ABI-O64 %s
 // MIPS-ABI-O64: error: unknown target ABI 'o64'
 //
-// RUN: %clang -target mips-linux-gnu -### -c %s \
-// RUN:-mabi=eabi 2>&1 \
-// RUN:   | FileCheck -check-prefix=MIPS-ABI-EABI %s
-// MIPS-ABI-EABI: "-target-cpu" "mips32r2"
-// MIPS-ABI-EABI: "-target-abi" "eabi"
-//
 // RUN: not %clang -target mips-linux-gnu -c %s \
 // RUN:-mabi=unknown 2>&1 \
 // RUN:   | FileCheck -check-prefix=MIPS-ABI-UNKNOWN %s
Index: cfe/trunk/test/Driver/mips-as.c
===
--- cfe/trunk/test/Driver/mips-as.c
+++ cfe/trunk/test/Driver/mips-as.c
@@ -30,11 +30,6 @@
 // RUN:   | FileCheck -check-prefix=MIPS64R2-DEF-EL-AS %s
 // MIPS64R2-DEF-EL-AS: as{{(.exe)?}}" "-march" "mips64r2" "-mabi" "64"  "-mno-shared" "-KPIC" "-EL"
 //
-// RUN: %clang -target mips-linux-gnu -mabi=eabi -### \
-// RUN:   -no-integrated-as -c %s 2>&1 \
-// RUN:   | FileCheck -check-prefix=MIPS-EABI %s
-// MIPS-EABI: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "eabi" "-mno-shared" "-call_nonpic" "-EB"
-//
 // RUN: %clang -target mips64-linux-gnu -mabi=n32 -### \
 // RUN:   -no-integrated-as -c %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=MIPS-N32 %s
Index: cfe/trunk/lib/Basic/Targets.cpp
===
--- cfe/trunk/lib/Basic/Targets.cpp
+++ cfe/trunk/lib/Basic/Targets.cpp
@@ -7009,16 +7009,16 @@
 class MipsTargetInfo : public TargetInfo {
   void setDataLayout() {
 if (BigEndian) {
-  if (ABI == "o32" || ABI == "eabi")
+  if (ABI == "o32")
 resetDataLayout("E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64");
   else if (ABI == "n32")
 resetDataLayout("E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128");
   else if (ABI == "n64")
 resetDataLayout("E-m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128");
   else
 llvm_unreachable("Invalid ABI");
 } else {
-  if (ABI == "o32" || ABI == "eabi")
+  if (ABI == "o32")
 resetDataLayout("e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64");
   else if (ABI == "n32")
 resetDataLayout("e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128");
@@ -7100,7 +7100,7 @@
   bool setABI(const std::string ) override {
 if (getTriple().getArch() == llvm::Triple::mips ||
 getTriple().getArch() == llvm::Triple::mipsel) {
-  if (Name == "o32" || Name == "eabi") {
+  if (Name == "o32") {
 ABI = Name;
 return true;
   }
@@ -7217,9 +7217,7 @@
   Builder.defineMacro("__mips_o32");
   Builder.defineMacro("_ABIO32", "1");
   Builder.defineMacro("_MIPS_SIM", "_ABIO32");
-} else if (ABI == "eabi")
-  Builder.defineMacro("__mips_eabi");
-else if (ABI == "n32") {
+} else if (ABI == "n32") {
   Builder.defineMacro("__mips_n32");
   Builder.defineMacro("_ABIN32", "2");
   Builder.defineMacro("_MIPS_SIM", "_ABIN32");
Index: cfe/trunk/lib/Driver/Tools.cpp
===
--- cfe/trunk/lib/Driver/Tools.cpp
+++ cfe/trunk/lib/Driver/Tools.cpp
@@ -1233,7 +1233,7 @@
   if (CPUName.empty()) {
 // Deduce CPU name from ABI name.
 CPUName = llvm::StringSwitch(ABIName)
-  .Cases("o32", "eabi", DefMips32CPU)
+  .Case("o32", DefMips32CPU)
   .Cases("n32", "n64", DefMips64CPU)
   .Default("");
   }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org

r270998 - [mips] Kill 'support' for untested EABI.

2016-05-27 Thread Daniel Sanders via cfe-commits
Author: dsanders
Date: Fri May 27 09:30:23 2016
New Revision: 270998

URL: http://llvm.org/viewvc/llvm-project?rev=270998=rev
Log:
[mips] Kill 'support' for untested EABI.

Summary:
There are no llvm backend tests* for EABI and no EABI buildbots. There were only
three clang tests, all of which checked that -mabi=eabi was passed to the
assembler.

*There is a single backend test that specifies EABI but it actually tests 
MIPS16.

Reviewers: atanasyan

Subscribers: emaste, sdardis, atanasyan, cfe-commits

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

Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/freebsd-mips-as.c
cfe/trunk/test/Driver/mips-abi.c
cfe/trunk/test/Driver/mips-as.c

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=270998=270997=270998=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Fri May 27 09:30:23 2016
@@ -7009,7 +7009,7 @@ public:
 class MipsTargetInfo : public TargetInfo {
   void setDataLayout() {
 if (BigEndian) {
-  if (ABI == "o32" || ABI == "eabi")
+  if (ABI == "o32")
 resetDataLayout("E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64");
   else if (ABI == "n32")
 resetDataLayout("E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128");
@@ -7018,7 +7018,7 @@ class MipsTargetInfo : public TargetInfo
   else
 llvm_unreachable("Invalid ABI");
 } else {
-  if (ABI == "o32" || ABI == "eabi")
+  if (ABI == "o32")
 resetDataLayout("e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64");
   else if (ABI == "n32")
 resetDataLayout("e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128");
@@ -7100,7 +7100,7 @@ public:
   bool setABI(const std::string ) override {
 if (getTriple().getArch() == llvm::Triple::mips ||
 getTriple().getArch() == llvm::Triple::mipsel) {
-  if (Name == "o32" || Name == "eabi") {
+  if (Name == "o32") {
 ABI = Name;
 return true;
   }
@@ -7217,9 +7217,7 @@ public:
   Builder.defineMacro("__mips_o32");
   Builder.defineMacro("_ABIO32", "1");
   Builder.defineMacro("_MIPS_SIM", "_ABIO32");
-} else if (ABI == "eabi")
-  Builder.defineMacro("__mips_eabi");
-else if (ABI == "n32") {
+} else if (ABI == "n32") {
   Builder.defineMacro("__mips_n32");
   Builder.defineMacro("_ABIN32", "2");
   Builder.defineMacro("_MIPS_SIM", "_ABIN32");

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=270998=270997=270998=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Fri May 27 09:30:23 2016
@@ -1233,7 +1233,7 @@ void mips::getMipsCPUAndABI(const ArgLis
   if (CPUName.empty()) {
 // Deduce CPU name from ABI name.
 CPUName = llvm::StringSwitch(ABIName)
-  .Cases("o32", "eabi", DefMips32CPU)
+  .Case("o32", DefMips32CPU)
   .Cases("n32", "n64", DefMips64CPU)
   .Default("");
   }

Modified: cfe/trunk/test/Driver/freebsd-mips-as.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/freebsd-mips-as.c?rev=270998=270997=270998=diff
==
--- cfe/trunk/test/Driver/freebsd-mips-as.c (original)
+++ cfe/trunk/test/Driver/freebsd-mips-as.c Fri May 27 09:30:23 2016
@@ -45,11 +45,6 @@
 // RUN:   | FileCheck -check-prefix=MIPS64-DEF-EL-AS %s
 // MIPS64-DEF-EL-AS: as{{(.exe)?}}" "-march" "mips64r2" "-mabi" "64" "-EL"
 //
-// RUN: %clang -target mips-unknown-freebsd -mabi=eabi -### \
-// RUN:   -no-integrated-as -c %s 2>&1 \
-// RUN:   | FileCheck -check-prefix=MIPS-EABI %s
-// MIPS-EABI: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "eabi" "-EB"
-//
 // RUN: %clang -target mips64-unknown-freebsd -mabi=n32 -### \
 // RUN:   -no-integrated-as -c %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=MIPS-N32 %s

Modified: cfe/trunk/test/Driver/mips-abi.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mips-abi.c?rev=270998=270997=270998=diff
==
--- cfe/trunk/test/Driver/mips-abi.c (original)
+++ cfe/trunk/test/Driver/mips-abi.c Fri May 27 09:30:23 2016
@@ -45,12 +45,6 @@
 // RUN:   | FileCheck -check-prefix=MIPS-ABI-O64 %s
 // MIPS-ABI-O64: error: unknown target ABI 'o64'
 //
-// RUN: %clang -target mips-linux-gnu -### -c %s \
-// RUN:-mabi=eabi 2>&1 \
-// RUN:   | FileCheck -check-prefix=MIPS-ABI-EABI %s
-// MIPS-ABI-EABI: "-target-cpu" "mips32r2"
-// MIPS-ABI-EABI: "-target-abi" "eabi"
-//
 // RUN: not %clang -target mips-linux-gnu -c %s \
 // RUN:-mabi=unknown 2>&1 \
 // 

r270996 - Apply clang-tidy's misc-move-constructor-init throughout Clang.

2016-05-27 Thread Benjamin Kramer via cfe-commits
Author: d0k
Date: Fri May 27 09:27:13 2016
New Revision: 270996

URL: http://llvm.org/viewvc/llvm-project?rev=270996=rev
Log:
Apply clang-tidy's misc-move-constructor-init throughout Clang.

No functionality change intended, maybe a tiny performance improvement.

Modified:
cfe/trunk/include/clang/AST/DeclTemplate.h
cfe/trunk/include/clang/Basic/VirtualFileSystem.h
cfe/trunk/include/clang/Frontend/Utils.h
cfe/trunk/include/clang/Sema/CodeCompleteConsumer.h
cfe/trunk/include/clang/StaticAnalyzer/Core/CheckerManager.h
cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h
cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h
cfe/trunk/lib/ARCMigrate/ARCMT.cpp
cfe/trunk/lib/Basic/VirtualFileSystem.cpp
cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/lib/Frontend/CompilerInstance.cpp
cfe/trunk/lib/Frontend/PCHContainerOperations.cpp
cfe/trunk/lib/Frontend/Rewrite/FrontendActions.cpp
cfe/trunk/lib/Frontend/SerializedDiagnosticPrinter.cpp
cfe/trunk/lib/Lex/HeaderSearch.cpp
cfe/trunk/lib/Lex/Preprocessor.cpp
cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
cfe/trunk/lib/StaticAnalyzer/Checkers/MallocOverflowSecurityChecker.cpp
cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp
cfe/trunk/lib/StaticAnalyzer/Checkers/SimpleStreamChecker.cpp
cfe/trunk/lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp
cfe/trunk/lib/StaticAnalyzer/Core/RegionStore.cpp
cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
cfe/trunk/lib/Tooling/Tooling.cpp
cfe/trunk/tools/libclang/CIndexer.h
cfe/trunk/tools/libclang/Indexing.cpp
cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp
cfe/trunk/utils/TableGen/NeonEmitter.cpp

Modified: cfe/trunk/include/clang/AST/DeclTemplate.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclTemplate.h?rev=270996=270995=270996=diff
==
--- cfe/trunk/include/clang/AST/DeclTemplate.h (original)
+++ cfe/trunk/include/clang/AST/DeclTemplate.h Fri May 27 09:27:13 2016
@@ -22,6 +22,7 @@
 #include "llvm/Support/Compiler.h"
 #include "llvm/Support/TrailingObjects.h"
 #include 
+#include 
 
 namespace clang {
 
@@ -2332,9 +2333,9 @@ class ClassScopeFunctionSpecializationDe
   ClassScopeFunctionSpecializationDecl(DeclContext *DC, SourceLocation Loc,
CXXMethodDecl *FD, bool Args,
TemplateArgumentListInfo TemplArgs)
-: Decl(Decl::ClassScopeFunctionSpecialization, DC, Loc),
-  Specialization(FD), HasExplicitTemplateArgs(Args),
-  TemplateArgs(TemplArgs) {}
+  : Decl(Decl::ClassScopeFunctionSpecialization, DC, Loc),
+Specialization(FD), HasExplicitTemplateArgs(Args),
+TemplateArgs(std::move(TemplArgs)) {}
 
   ClassScopeFunctionSpecializationDecl(EmptyShell Empty)
 : Decl(Decl::ClassScopeFunctionSpecialization, Empty) {}

Modified: cfe/trunk/include/clang/Basic/VirtualFileSystem.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/VirtualFileSystem.h?rev=270996=270995=270996=diff
==
--- cfe/trunk/include/clang/Basic/VirtualFileSystem.h (original)
+++ cfe/trunk/include/clang/Basic/VirtualFileSystem.h Fri May 27 09:27:13 2016
@@ -20,6 +20,7 @@
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/SourceMgr.h"
 #include "llvm/Support/raw_ostream.h"
+#include 
 
 namespace llvm {
 class MemoryBuffer;
@@ -116,7 +117,8 @@ class directory_iterator {
   std::shared_ptr Impl; // Input iterator semantics on 
copy
 
 public:
-  directory_iterator(std::shared_ptr I) : Impl(I) {
+  directory_iterator(std::shared_ptr I)
+  : Impl(std::move(I)) {
 assert(Impl.get() != nullptr && "requires non-null implementation");
 if (!Impl->CurrentEntry.isStatusKnown())
   Impl.reset(); // Normalize the end iterator to Impl == nullptr.

Modified: cfe/trunk/include/clang/Frontend/Utils.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/Utils.h?rev=270996=270995=270996=diff
==
--- cfe/trunk/include/clang/Frontend/Utils.h (original)
+++ cfe/trunk/include/clang/Frontend/Utils.h Fri May 27 09:27:13 2016
@@ -20,6 +20,7 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/StringSet.h"
 #include "llvm/Option/OptSpecifier.h"
+#include 
 
 namespace llvm {
 class raw_fd_ostream;
@@ -141,7 +142,8 @@ public:
 
   void writeFileMap();
   bool hasErrors() { return HasErrors; }
-  ModuleDependencyCollector(std::string DestDir) : DestDir(DestDir) {}
+  ModuleDependencyCollector(std::string DestDir)
+  : DestDir(std::move(DestDir)) {}
   

Re: [PATCH] D20626: [Clang][AVX512][intrinsics] Adding missing intrinsics div_pd and div_ps

2016-05-27 Thread michael zuckerman via cfe-commits
m_zuckerman added inline comments.


Comment at: test/CodeGen/avx512f-builtins.c:1927
@@ +1926,3 @@
+  // check-label: @test_mm512_div_pd
+  // check: @llvm.x86.avx512.mask.div.pd.512
+  return _mm512_div_pd(__a,__b); 

craig.topper wrote:
> delena wrote:
> > I don't understand how do  you receive intrinsic if you issue IR.
> The word "check" being in lowercase causes filecheck to ignore it so it isn't 
> being checked.
You are right. 
Thanks I didn't saw it. I will fix it.


http://reviews.llvm.org/D20626



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


Re: [PATCH] D20010: [clang-tidy] UnnecessaryCopyInitialization - Extend to trigger on non-const "this" object argument if it is not modified

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

LG


http://reviews.llvm.org/D20010



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


Re: [PATCH] D20666: Fix a wrong check in misc-unused-using-decls

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

LG


http://reviews.llvm.org/D20666



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


Re: [PATCH] D20689: [clang-tidy] Suspicious Call Argument checker

2016-05-27 Thread Alexander Kornienko via cfe-commits
alexfh added a comment.

Thank you for the new check!

Before starting with the review, I'd like to clarify one important thing. It's 
not immediately obvious that the pattern the check detects is actually a good 
indicator of a programming mistake. Did you try to run the check on a large 
enough codebase (at least, on the whole LLVM project) and analyze the results? 
http://clang.llvm.org/extra/clang-tidy/#running-clang-tidy-on-llvm describes 
the recommended way to run clang-tidy on LLVM.


http://reviews.llvm.org/D20689



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


r270994 - Turn copies into references as suggested by clang-tidy's performance-unnecessary-copy-initialization.

2016-05-27 Thread Benjamin Kramer via cfe-commits
Author: d0k
Date: Fri May 27 08:36:58 2016
New Revision: 270994

URL: http://llvm.org/viewvc/llvm-project?rev=270994=rev
Log:
Turn copies into references as suggested by clang-tidy's 
performance-unnecessary-copy-initialization.

Modified:
cfe/trunk/lib/Analysis/CFG.cpp
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/lib/Frontend/DependencyFile.cpp
cfe/trunk/lib/Sema/SemaLookup.cpp
cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp

Modified: cfe/trunk/lib/Analysis/CFG.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CFG.cpp?rev=270994=270993=270994=diff
==
--- cfe/trunk/lib/Analysis/CFG.cpp (original)
+++ cfe/trunk/lib/Analysis/CFG.cpp Fri May 27 08:36:58 2016
@@ -825,7 +825,7 @@ private:
 // * Variable x is equal to the largest literal.
 // * Variable x is greater than largest literal.
 bool AlwaysTrue = true, AlwaysFalse = true;
-for (llvm::APSInt Value : Values) {
+for (const llvm::APSInt  : Values) {
   TryResult Res1, Res2;
   Res1 = analyzeLogicOperatorCondition(BO1, Value, L1);
   Res2 = analyzeLogicOperatorCondition(BO2, Value, L2);

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=270994=270993=270994=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Fri May 27 08:36:58 2016
@@ -6541,7 +6541,7 @@ void gcc::Common::ConstructJob(Compilati
 }
   }
 
-  const std::string customGCCName = D.getCCCGenericGCCName();
+  const std::string  = D.getCCCGenericGCCName();
   const char *GCCName;
   if (!customGCCName.empty())
 GCCName = customGCCName.c_str();

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=270994=270993=270994=diff
==
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Fri May 27 08:36:58 2016
@@ -2416,7 +2416,7 @@ std::string CompilerInvocation::getModul
 
   // Extend the signature with the module file extensions.
   const FrontendOptions  = getFrontendOpts();
-  for (auto ext : frontendOpts.ModuleFileExtensions) {
+  for (const auto  : frontendOpts.ModuleFileExtensions) {
 code = ext->hashExtension(code);
   }
 

Modified: cfe/trunk/lib/Frontend/DependencyFile.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/DependencyFile.cpp?rev=270994=270993=270994=diff
==
--- cfe/trunk/lib/Frontend/DependencyFile.cpp (original)
+++ cfe/trunk/lib/Frontend/DependencyFile.cpp Fri May 27 08:36:58 2016
@@ -177,7 +177,7 @@ public:
   SeenMissingHeader(false),
   IncludeModuleFiles(Opts.IncludeModuleFiles),
   OutputFormat(Opts.OutputFormat) {
-for (auto ExtraDep : Opts.ExtraDeps) {
+for (const auto  : Opts.ExtraDeps) {
   AddFilename(ExtraDep);
 }
   }

Modified: cfe/trunk/lib/Sema/SemaLookup.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=270994=270993=270994=diff
==
--- cfe/trunk/lib/Sema/SemaLookup.cpp (original)
+++ cfe/trunk/lib/Sema/SemaLookup.cpp Fri May 27 08:36:58 2016
@@ -4060,8 +4060,8 @@ retry_lookup:
 
 void TypoCorrectionConsumer::performQualifiedLookups() {
   unsigned TypoLen = Typo->getName().size();
-  for (auto QR : QualifiedResults) {
-for (auto NSI : Namespaces) {
+  for (const TypoCorrection  : QualifiedResults) {
+for (const auto  : Namespaces) {
   DeclContext *Ctx = NSI.DeclCtx;
   const Type *NSType = NSI.NameSpecifier->getAsType();
 

Modified: cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp?rev=270994=270993=270994=diff
==
--- cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp (original)
+++ cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp Fri May 27 08:36:58 2016
@@ -1449,9 +1449,9 @@ CreateSemanticSpellings(const std::vecto
   unsigned Idx = 0;
   for (auto I = Spellings.begin(), E = Spellings.end(); I != E; ++I, ++Idx) {
 const FlattenedSpelling  = *I;
-std::string Variety = S.variety();
-std::string Spelling = S.name();
-std::string Namespace = S.nameSpace();
+const std::string  = S.variety();
+const std::string  = S.name();
+const std::string  = S.nameSpace();
 std::string EnumName;
 
 EnumName += (Variety + "_");
@@ -2298,7 +2298,7 @@ void EmitClangAttrHasAttrImpl(RecordKeep
   for (auto *R : Attrs) {
 std::vector Spellings = 

Re: [PATCH] D20729: [mips] Compact branch policy setting

2016-05-27 Thread Simon Atanasyan via cfe-commits
atanasyan accepted this revision.
atanasyan added a comment.
This revision is now accepted and ready to land.

LGTM with some nits



Comment at: lib/Driver/Tools.cpp:1446
@@ +1445,3 @@
+CmdArgs.push_back(Args.MakeArgString("-mips-compact-branches=" + Val));
+
+  } else

Redundant empty line.


Comment at: lib/Driver/Tools.cpp:7084
@@ +7083,3 @@
+  // mips32r6 and mips64r6 have compact branches.
+
+  return (bool)llvm::StringSwitch(CPU)

Redundant empty line.


Comment at: lib/Driver/Tools.cpp:7085
@@ +7084,3 @@
+
+  return (bool)llvm::StringSwitch(CPU)
+  .Case("mips32r6", true)

Is it possible to re-write this line as:
```
return llvm::StringSwitch(CPU)
```


http://reviews.llvm.org/D20729



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


[PATCH] D20729: [mips] Compact branch policy setting

2016-05-27 Thread Simon Dardis via cfe-commits
sdardis created this revision.
sdardis added reviewers: dsanders, atanasyan.
sdardis added a subscriber: cfe-commits.
Herald added a reviewer: vkalintiris.
Herald added a subscriber: sdardis.

This patch adds the commandline option 
-mcompact-branches={never,optimal,always),
which controls how LLVM generates compact branches for MIPSR6 targets. By 
default,
the compact branch policy is 'optimal' where LLVM will generate the most
appropriate branch for any situation. The 'never' and 'always' policy will 
disable
or always generate compact branches wherever possible respectfully.

http://reviews.llvm.org/D20729

Files:
  docs/UsersManual.rst
  include/clang/Basic/DiagnosticDriverKinds.td
  include/clang/Basic/DiagnosticGroups.td
  include/clang/Driver/Options.td
  lib/Driver/Tools.cpp
  lib/Driver/Tools.h
  test/Driver/mips-features.c

Index: test/Driver/mips-features.c
===
--- test/Driver/mips-features.c
+++ test/Driver/mips-features.c
@@ -116,6 +116,24 @@
 // RUN:   | FileCheck --check-prefix=CHECK-NANLEGACY %s
 // CHECK-NANLEGACY: "-target-feature" "-nan2008"
 //
+// -mcompact-branches=never
+// RUN: %clang -target mips-linux-gnu -march=mips32r6 -### -c %s \
+// RUN: -mcompact-branches=never 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-CBNEVER %s
+// CHECK-CBNEVER: "-mllvm" "-mips-compact-branches=never"
+//
+// -mcompact-branches=optimal
+// RUN: %clang -target mips-linux-gnu -march=mips32r6 -### -c %s \
+// RUN: -mcompact-branches=optimal 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-CBOPTIMAL %s
+// CHECK-CBOPTIMAL: "-mllvm" "-mips-compact-branches=optimal"
+//
+// -mcompact-branches=always
+// RUN: %clang -target mips-linux-gnu -march=mips32r6 -### -c %s \
+// RUN: -mcompact-branches=always 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-CBALWAYS %s
+// CHECK-CBALWAYS: "-mllvm" "-mips-compact-branches=always"
+//
 // -mxgot
 // RUN: %clang -target mips-linux-gnu -### -c %s \
 // RUN: -mno-xgot -mxgot 2>&1 \
Index: lib/Driver/Tools.h
===
--- lib/Driver/Tools.h
+++ lib/Driver/Tools.h
@@ -291,6 +291,7 @@
 };
 
 NanEncoding getSupportedNanEncoding(StringRef );
+bool hasCompactBranches(StringRef );
 void getMipsCPUAndABI(const llvm::opt::ArgList ,
   const llvm::Triple , StringRef ,
   StringRef );
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -1436,6 +1436,20 @@
 CmdArgs.push_back(Args.MakeArgString("-mips-ssection-threshold=" + v));
 A->claim();
   }
+
+  if (Arg *A = Args.getLastArg(options::OPT_mcompact_branches_EQ)) {
+StringRef Val = StringRef(A->getValue());
+if (mips::hasCompactBranches(CPUName)) {
+  if (Val == "never" || Val == "always" || Val == "optimal") {
+CmdArgs.push_back("-mllvm");
+CmdArgs.push_back(Args.MakeArgString("-mips-compact-branches=" + Val));
+
+  } else
+D.Diag(diag::err_drv_unsupported_option_argument)
+<< A->getOption().getName() << Val;
+} else
+  D.Diag(diag::warn_target_unsupported_compact_branches) << CPUName;
+  }
 }
 
 /// getPPCTargetCPU - Get the (LLVM) name of the PowerPC cpu we are targeting.
@@ -7065,6 +7079,15 @@
   .Default(NanLegacy);
 }
 
+bool mips::hasCompactBranches(StringRef ) {
+  // mips32r6 and mips64r6 have compact branches.
+
+  return (bool)llvm::StringSwitch(CPU)
+  .Case("mips32r6", true)
+  .Case("mips64r6", true)
+  .Default(false);
+}
+
 bool mips::hasMipsAbiArg(const ArgList , const char *Value) {
   Arg *A = Args.getLastArg(options::OPT_mabi_EQ);
   return A && (A->getValue() == StringRef(Value));
Index: include/clang/Driver/Options.td
===
--- include/clang/Driver/Options.td
+++ include/clang/Driver/Options.td
@@ -1621,6 +1621,7 @@
 def mcheck_zero_division : Flag<["-"], "mcheck-zero-division">, Group;
 def mno_check_zero_division : Flag<["-"], "mno-check-zero-division">,
   Group;
+def mcompact_branches_EQ : Joined<["-"], "mcompact-branches=">, Group;
 def mdsp : Flag<["-"], "mdsp">, Group;
 def mno_dsp : Flag<["-"], "mno-dsp">, Group;
 def mdspr2 : Flag<["-"], "mdspr2">, Group;
Index: include/clang/Basic/DiagnosticGroups.td
===
--- include/clang/Basic/DiagnosticGroups.td
+++ include/clang/Basic/DiagnosticGroups.td
@@ -56,6 +56,7 @@
 def DoublePromotion : DiagGroup<"double-promotion">;
 def EnumTooLarge : DiagGroup<"enum-too-large">;
 def UnsupportedNan : DiagGroup<"unsupported-nan">;
+def UnsupportedCB : DiagGroup<"unsupported-cb">;
 def NonLiteralNullConversion : DiagGroup<"non-literal-null-conversion">;
 def NullConversion : DiagGroup<"null-conversion">;
 def ImplicitConversionFloatingPointToBool :
Index: 

r270991 - [Frontend] StringRefize and fix bad indentation.

2016-05-27 Thread Benjamin Kramer via cfe-commits
Author: d0k
Date: Fri May 27 07:52:19 2016
New Revision: 270991

URL: http://llvm.org/viewvc/llvm-project?rev=270991=rev
Log:
[Frontend] StringRefize and fix bad indentation.

NFC intended.

Modified:
cfe/trunk/lib/Frontend/HeaderIncludeGen.cpp

Modified: cfe/trunk/lib/Frontend/HeaderIncludeGen.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/HeaderIncludeGen.cpp?rev=270991=270990=270991=diff
==
--- cfe/trunk/lib/Frontend/HeaderIncludeGen.cpp (original)
+++ cfe/trunk/lib/Frontend/HeaderIncludeGen.cpp Fri May 27 07:52:19 2016
@@ -49,31 +49,31 @@ public:
 };
 }
 
-static void PrintHeaderInfo(raw_ostream *OutputFile, const char* Filename,
+static void PrintHeaderInfo(raw_ostream *OutputFile, StringRef Filename,
 bool ShowDepth, unsigned CurrentIncludeDepth,
 bool MSStyle) {
-// Write to a temporary string to avoid unnecessary flushing on errs().
-SmallString<512> Pathname(Filename);
-if (!MSStyle)
-  Lexer::Stringify(Pathname);
-
-SmallString<256> Msg;
-if (MSStyle)
-  Msg += "Note: including file:";
-
-if (ShowDepth) {
-  // The main source file is at depth 1, so skip one dot.
-  for (unsigned i = 1; i != CurrentIncludeDepth; ++i)
-Msg += MSStyle ? ' ' : '.';
+  // Write to a temporary string to avoid unnecessary flushing on errs().
+  SmallString<512> Pathname(Filename);
+  if (!MSStyle)
+Lexer::Stringify(Pathname);
+
+  SmallString<256> Msg;
+  if (MSStyle)
+Msg += "Note: including file:";
+
+  if (ShowDepth) {
+// The main source file is at depth 1, so skip one dot.
+for (unsigned i = 1; i != CurrentIncludeDepth; ++i)
+  Msg += MSStyle ? ' ' : '.';
 
-  if (!MSStyle)
-Msg += ' ';
-}
-Msg += Pathname;
-Msg += '\n';
+if (!MSStyle)
+  Msg += ' ';
+  }
+  Msg += Pathname;
+  Msg += '\n';
 
-OutputFile->write(Msg.data(), Msg.size());
-OutputFile->flush();
+  *OutputFile << Msg;
+  OutputFile->flush();
 }
 
 void clang::AttachHeaderIncludeGen(Preprocessor ,
@@ -104,8 +104,8 @@ void clang::AttachHeaderIncludeGen(Prepr
   // generation of Make / Ninja file dependencies for implicit includes, such
   // as sanitizer blacklists. It's only important for cl.exe compatibility,
   // the GNU way to generate rules is -M / -MM / -MD / -MMD.
-  for (auto Header : DepOpts.ExtraDeps)
-PrintHeaderInfo(OutputFile, Header.c_str(), ShowDepth, 2, MSStyle);
+  for (const auto  : DepOpts.ExtraDeps)
+PrintHeaderInfo(OutputFile, Header, ShowDepth, 2, MSStyle);
   PP.addPPCallbacks(llvm::make_unique(
   , ShowAllHeaders, OutputFile, DepOpts, OwnsOutputFile, ShowDepth,
   MSStyle));
@@ -132,7 +132,7 @@ void HeaderIncludesCallback::FileChanged
 // place where we drop back to a nesting depth of 1.
 if (CurrentIncludeDepth == 1 && !HasProcessedPredefines) {
   if (!DepOpts.ShowIncludesPretendHeader.empty()) {
-PrintHeaderInfo(OutputFile, DepOpts.ShowIncludesPretendHeader.c_str(),
+PrintHeaderInfo(OutputFile, DepOpts.ShowIncludesPretendHeader,
 ShowDepth, 2, MSStyle);
   }
   HasProcessedPredefines = true;


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


[clang-tools-extra] r270989 - [include-fixer] Add a missing .h.

2016-05-27 Thread Benjamin Kramer via cfe-commits
Author: d0k
Date: Fri May 27 07:49:58 2016
New Revision: 270989

URL: http://llvm.org/viewvc/llvm-project?rev=270989=rev
Log:
[include-fixer] Add a missing .h.

Modified:

clang-tools-extra/trunk/include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp

Modified: 
clang-tools-extra/trunk/include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp?rev=270989=270988=270989=diff
==
--- 
clang-tools-extra/trunk/include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp 
(original)
+++ 
clang-tools-extra/trunk/include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp 
Fri May 27 07:49:58 2016
@@ -59,7 +59,7 @@ const HeaderMapCollector::HeaderMap *get
   {"include/rdseedintrin.h", ""},
   {"include/rtmintrin.h", ""},
   {"include/shaintrin.h", ""},
-  {"include/smmintrin.h", ""},
+  {"include/smmintrin.h", ""},
   {"include/stdalign.h", ""},
   {"include/stdarg.h", ""},
   {"include/stdbool.h", ""},


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


Re: [PATCH] D20679: [mips] Kill 'support' for untested EABI.

2016-05-27 Thread Simon Atanasyan via cfe-commits
atanasyan added a comment.

In http://reviews.llvm.org/D20679#442121, @dsanders wrote:

> Just to double-check: Do you still agree we should kill this now that the 
> number of tests covering EABI-specific behaviour is non-zero?
>
> I think we should on the basis that we still have no backend tests and no 
> buildbots. The only tests we have check that the driver passes -mabi=eabi to 
> the assembler.


I agree.


http://reviews.llvm.org/D20679



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


Re: [PATCH] D20334: [libcxx] Fix a bug in strstreambuf::overflow

2016-05-27 Thread Ben Craig via cfe-commits
bcraig added a comment.

LGTM.  You may want to wait on Marshall's approval though.  Thanks for being 
patient with me, and thanks for the patch!


http://reviews.llvm.org/D20334



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


Re: [PATCH] D20679: [mips] Kill 'support' for untested EABI.

2016-05-27 Thread Daniel Sanders via cfe-commits
dsanders added a comment.

Just to double-check: Do you still agree we should kill this now that the 
number of tests covering EABI-specific behaviour is non-zero?

I think we should on the basis that we still have no backend tests and no 
buildbots. The only tests we have check that the driver passes -mabi=eabi to 
the assembler.


http://reviews.llvm.org/D20679



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


Re: [PATCH] D20679: [mips] Kill 'support' for untested EABI.

2016-05-27 Thread Daniel Sanders via cfe-commits
dsanders updated this revision to Diff 58772.
dsanders added a comment.
Herald added subscribers: sdardis, emaste.

Removed the 'eabi' from Tools.cpp this revealed three driver tests for passing
-mabi to the assembler but the ABI itself is still completely untested.


http://reviews.llvm.org/D20679

Files:
  lib/Basic/Targets.cpp
  lib/Driver/Tools.cpp
  test/Driver/freebsd-mips-as.c
  test/Driver/mips-abi.c
  test/Driver/mips-as.c

Index: test/Driver/mips-as.c
===
--- test/Driver/mips-as.c
+++ test/Driver/mips-as.c
@@ -30,11 +30,6 @@
 // RUN:   | FileCheck -check-prefix=MIPS64R2-DEF-EL-AS %s
 // MIPS64R2-DEF-EL-AS: as{{(.exe)?}}" "-march" "mips64r2" "-mabi" "64"  "-mno-shared" "-KPIC" "-EL"
 //
-// RUN: %clang -target mips-linux-gnu -mabi=eabi -### \
-// RUN:   -no-integrated-as -c %s 2>&1 \
-// RUN:   | FileCheck -check-prefix=MIPS-EABI %s
-// MIPS-EABI: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "eabi" "-mno-shared" "-call_nonpic" "-EB"
-//
 // RUN: %clang -target mips64-linux-gnu -mabi=n32 -### \
 // RUN:   -no-integrated-as -c %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=MIPS-N32 %s
Index: test/Driver/mips-abi.c
===
--- test/Driver/mips-abi.c
+++ test/Driver/mips-abi.c
@@ -45,12 +45,6 @@
 // RUN:   | FileCheck -check-prefix=MIPS-ABI-O64 %s
 // MIPS-ABI-O64: error: unknown target ABI 'o64'
 //
-// RUN: %clang -target mips-linux-gnu -### -c %s \
-// RUN:-mabi=eabi 2>&1 \
-// RUN:   | FileCheck -check-prefix=MIPS-ABI-EABI %s
-// MIPS-ABI-EABI: "-target-cpu" "mips32r2"
-// MIPS-ABI-EABI: "-target-abi" "eabi"
-//
 // RUN: not %clang -target mips-linux-gnu -c %s \
 // RUN:-mabi=unknown 2>&1 \
 // RUN:   | FileCheck -check-prefix=MIPS-ABI-UNKNOWN %s
Index: test/Driver/freebsd-mips-as.c
===
--- test/Driver/freebsd-mips-as.c
+++ test/Driver/freebsd-mips-as.c
@@ -45,11 +45,6 @@
 // RUN:   | FileCheck -check-prefix=MIPS64-DEF-EL-AS %s
 // MIPS64-DEF-EL-AS: as{{(.exe)?}}" "-march" "mips64r2" "-mabi" "64" "-EL"
 //
-// RUN: %clang -target mips-unknown-freebsd -mabi=eabi -### \
-// RUN:   -no-integrated-as -c %s 2>&1 \
-// RUN:   | FileCheck -check-prefix=MIPS-EABI %s
-// MIPS-EABI: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "eabi" "-EB"
-//
 // RUN: %clang -target mips64-unknown-freebsd -mabi=n32 -### \
 // RUN:   -no-integrated-as -c %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=MIPS-N32 %s
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -1233,7 +1233,7 @@
   if (CPUName.empty()) {
 // Deduce CPU name from ABI name.
 CPUName = llvm::StringSwitch(ABIName)
-  .Cases("o32", "eabi", DefMips32CPU)
+  .Case("o32", DefMips32CPU)
   .Cases("n32", "n64", DefMips64CPU)
   .Default("");
   }
Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -7009,16 +7009,16 @@
 class MipsTargetInfo : public TargetInfo {
   void setDataLayout() {
 if (BigEndian) {
-  if (ABI == "o32" || ABI == "eabi")
+  if (ABI == "o32")
 resetDataLayout("E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64");
   else if (ABI == "n32")
 resetDataLayout("E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128");
   else if (ABI == "n64")
 resetDataLayout("E-m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128");
   else
 llvm_unreachable("Invalid ABI");
 } else {
-  if (ABI == "o32" || ABI == "eabi")
+  if (ABI == "o32")
 resetDataLayout("e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64");
   else if (ABI == "n32")
 resetDataLayout("e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128");
@@ -7100,7 +7100,7 @@
   bool setABI(const std::string ) override {
 if (getTriple().getArch() == llvm::Triple::mips ||
 getTriple().getArch() == llvm::Triple::mipsel) {
-  if (Name == "o32" || Name == "eabi") {
+  if (Name == "o32") {
 ABI = Name;
 return true;
   }
@@ -7217,9 +7217,7 @@
   Builder.defineMacro("__mips_o32");
   Builder.defineMacro("_ABIO32", "1");
   Builder.defineMacro("_MIPS_SIM", "_ABIO32");
-} else if (ABI == "eabi")
-  Builder.defineMacro("__mips_eabi");
-else if (ABI == "n32") {
+} else if (ABI == "n32") {
   Builder.defineMacro("__mips_n32");
   Builder.defineMacro("_ABIN32", "2");
   Builder.defineMacro("_MIPS_SIM", "_ABIN32");
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r270985 - Update for following LLVM commit.

2016-05-27 Thread George Rimar via cfe-commits
Author: grimar
Date: Fri May 27 07:15:25 2016
New Revision: 270985

URL: http://llvm.org/viewvc/llvm-project?rev=270985=rev
Log:
Update for following LLVM commit.

It will be:
Recommit 270977 - [llvm-mc] - Teach llvm-mc to generate zlib styled compression 
sections.

Modified:
cfe/trunk/tools/driver/cc1as_main.cpp

Modified: cfe/trunk/tools/driver/cc1as_main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/cc1as_main.cpp?rev=270985=270984=270985=diff
==
--- cfe/trunk/tools/driver/cc1as_main.cpp (original)
+++ cfe/trunk/tools/driver/cc1as_main.cpp Fri May 27 07:15:25 2016
@@ -313,7 +313,7 @@ static bool ExecuteAssembler(AssemblerIn
   // Ensure MCAsmInfo initialization occurs before any use, otherwise sections
   // may be created with a combination of default and explicit settings.
   if (Opts.CompressDebugSections)
-MAI->setCompressDebugSections(true);
+MAI->setCompressDebugSections(DebugCompressionType::DCT_ZlibGnu);
 
   bool IsBinary = Opts.OutputType == AssemblerInvocation::FT_Obj;
   std::unique_ptr FDOS = getOutputStream(Opts, Diags, 
IsBinary);


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


Re: [PATCH] D20678: [mips] Fold MipsTargetInfoBase subclasses into MipsTargetInfoBase and rename to MipsTargetInfo. NFC

2016-05-27 Thread Daniel Sanders via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL270984: [mips] Fold MipsTargetInfoBase subclasses into 
MipsTargetInfoBase and rename… (authored by dsanders).

Changed prior to commit:
  http://reviews.llvm.org/D20678?vs=58604=58770#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20678

Files:
  cfe/trunk/lib/Basic/Targets.cpp

Index: cfe/trunk/lib/Basic/Targets.cpp
===
--- cfe/trunk/lib/Basic/Targets.cpp
+++ cfe/trunk/lib/Basic/Targets.cpp
@@ -7006,8 +7006,29 @@
   }
 };
 
-class MipsTargetInfoBase : public TargetInfo {
-  virtual void setDataLayout() = 0;
+class MipsTargetInfo : public TargetInfo {
+  void setDataLayout() {
+if (BigEndian) {
+  if (ABI == "o32" || ABI == "eabi")
+resetDataLayout("E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64");
+  else if (ABI == "n32")
+resetDataLayout("E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128");
+  else if (ABI == "n64")
+resetDataLayout("E-m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128");
+  else
+llvm_unreachable("Invalid ABI");
+} else {
+  if (ABI == "o32" || ABI == "eabi")
+resetDataLayout("e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64");
+  else if (ABI == "n32")
+resetDataLayout("e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128");
+  else if (ABI == "n64")
+resetDataLayout("e-m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128");
+  else
+llvm_unreachable("Invalid ABI");
+}
+  }
+
 
   static const Builtin::Info BuiltinInfo[];
   std::string CPU;
@@ -7028,12 +7049,39 @@
   std::string ABI;
 
 public:
-  MipsTargetInfoBase(const llvm::Triple , const TargetOptions &,
- const std::string , const std::string )
-  : TargetInfo(Triple), CPU(CPUStr), IsMips16(false), IsMicromips(false),
-IsNan2008(false), IsSingleFloat(false), FloatABI(HardFloat),
-DspRev(NoDSP), HasMSA(false), HasFP64(false), ABI(ABIStr) {
+  MipsTargetInfo(const llvm::Triple , const TargetOptions &)
+  : TargetInfo(Triple), CPU((getTriple().getArch() == llvm::Triple::mips ||
+ getTriple().getArch() == llvm::Triple::mipsel)
+? "mips32r2"
+: "mips64r2"),
+IsMips16(false), IsMicromips(false), IsNan2008(false),
+IsSingleFloat(false), FloatABI(HardFloat), DspRev(NoDSP), HasMSA(false),
+HasFP64(false), ABI((getTriple().getArch() == llvm::Triple::mips ||
+ getTriple().getArch() == llvm::Triple::mipsel)
+? "o32"
+: "n64") {
 TheCXXABI.set(TargetCXXABI::GenericMIPS);
+BigEndian = getTriple().getArch() == llvm::Triple::mips ||
+getTriple().getArch() == llvm::Triple::mips64;
+
+if (getTriple().getArch() == llvm::Triple::mips ||
+getTriple().getArch() == llvm::Triple::mipsel) {
+  SizeType = UnsignedInt;
+  PtrDiffType = SignedInt;
+  Int64Type = SignedLongLong;
+  IntMaxType = Int64Type;
+  MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 32;
+} else {
+  LongDoubleWidth = LongDoubleAlign = 128;
+  LongDoubleFormat = ::APFloat::IEEEquad;
+  if (getTriple().getOS() == llvm::Triple::FreeBSD) {
+LongDoubleWidth = LongDoubleAlign = 64;
+LongDoubleFormat = ::APFloat::IEEEdouble;
+  }
+  setN64ABITypes();
+  SuitableAlign = 128;
+  MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 64;
+}
   }
 
   bool isNaN2008Default() const {
@@ -7049,6 +7097,48 @@
   }
 
   StringRef getABI() const override { return ABI; }
+  bool setABI(const std::string ) override {
+if (getTriple().getArch() == llvm::Triple::mips ||
+getTriple().getArch() == llvm::Triple::mipsel) {
+  if (Name == "o32" || Name == "eabi") {
+ABI = Name;
+return true;
+  }
+}
+if (getTriple().getArch() == llvm::Triple::mips64 ||
+getTriple().getArch() == llvm::Triple::mips64el) {
+  if (Name == "n32") {
+setN32ABITypes();
+ABI = Name;
+return true;
+  }
+  if (Name == "n64") {
+setN64ABITypes();
+ABI = Name;
+return true;
+  }
+}
+return false;
+  }
+
+  void setN64ABITypes() {
+LongWidth = LongAlign = 64;
+PointerWidth = PointerAlign = 64;
+SizeType = UnsignedLong;
+PtrDiffType = SignedLong;
+Int64Type = SignedLong;
+IntMaxType = Int64Type;
+  }
+
+  void setN32ABITypes() {
+LongWidth = LongAlign = 32;
+PointerWidth = PointerAlign = 32;
+SizeType = UnsignedInt;
+PtrDiffType = SignedInt;
+Int64Type = SignedLongLong;
+IntMaxType = Int64Type;
+  }
+
   bool setCPU(const std::string ) override {
 bool IsMips32 = getTriple().getArch() == llvm::Triple::mips ||
 getTriple().getArch() == 

r270984 - [mips] Fold MipsTargetInfoBase subclasses into MipsTargetInfoBase and rename to MipsTargetInfo. NFC

2016-05-27 Thread Daniel Sanders via cfe-commits
Author: dsanders
Date: Fri May 27 06:51:02 2016
New Revision: 270984

URL: http://llvm.org/viewvc/llvm-project?rev=270984=rev
Log:
[mips] Fold MipsTargetInfoBase subclasses into MipsTargetInfoBase and rename to 
MipsTargetInfo. NFC

Summary:
This unifies mips/mipsel and mips64/mips64el into a single class so that we can
later support O32 on mips64/mips64el and N32/N64 on mips/mipsel (when an
appropriate CPU selected).

Reviewers: atanasyan

Subscribers: atanasyan, jfb, cfe-commits, dschuff

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

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=270984=270983=270984=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Fri May 27 06:51:02 2016
@@ -7006,8 +7006,29 @@ public:
   }
 };
 
-class MipsTargetInfoBase : public TargetInfo {
-  virtual void setDataLayout() = 0;
+class MipsTargetInfo : public TargetInfo {
+  void setDataLayout() {
+if (BigEndian) {
+  if (ABI == "o32" || ABI == "eabi")
+resetDataLayout("E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64");
+  else if (ABI == "n32")
+resetDataLayout("E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128");
+  else if (ABI == "n64")
+resetDataLayout("E-m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128");
+  else
+llvm_unreachable("Invalid ABI");
+} else {
+  if (ABI == "o32" || ABI == "eabi")
+resetDataLayout("e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64");
+  else if (ABI == "n32")
+resetDataLayout("e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128");
+  else if (ABI == "n64")
+resetDataLayout("e-m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128");
+  else
+llvm_unreachable("Invalid ABI");
+}
+  }
+
 
   static const Builtin::Info BuiltinInfo[];
   std::string CPU;
@@ -7028,12 +7049,39 @@ protected:
   std::string ABI;
 
 public:
-  MipsTargetInfoBase(const llvm::Triple , const TargetOptions &,
- const std::string , const std::string )
-  : TargetInfo(Triple), CPU(CPUStr), IsMips16(false), IsMicromips(false),
-IsNan2008(false), IsSingleFloat(false), FloatABI(HardFloat),
-DspRev(NoDSP), HasMSA(false), HasFP64(false), ABI(ABIStr) {
+  MipsTargetInfo(const llvm::Triple , const TargetOptions &)
+  : TargetInfo(Triple), CPU((getTriple().getArch() == llvm::Triple::mips ||
+ getTriple().getArch() == llvm::Triple::mipsel)
+? "mips32r2"
+: "mips64r2"),
+IsMips16(false), IsMicromips(false), IsNan2008(false),
+IsSingleFloat(false), FloatABI(HardFloat), DspRev(NoDSP), 
HasMSA(false),
+HasFP64(false), ABI((getTriple().getArch() == llvm::Triple::mips ||
+ getTriple().getArch() == llvm::Triple::mipsel)
+? "o32"
+: "n64") {
 TheCXXABI.set(TargetCXXABI::GenericMIPS);
+BigEndian = getTriple().getArch() == llvm::Triple::mips ||
+getTriple().getArch() == llvm::Triple::mips64;
+
+if (getTriple().getArch() == llvm::Triple::mips ||
+getTriple().getArch() == llvm::Triple::mipsel) {
+  SizeType = UnsignedInt;
+  PtrDiffType = SignedInt;
+  Int64Type = SignedLongLong;
+  IntMaxType = Int64Type;
+  MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 32;
+} else {
+  LongDoubleWidth = LongDoubleAlign = 128;
+  LongDoubleFormat = ::APFloat::IEEEquad;
+  if (getTriple().getOS() == llvm::Triple::FreeBSD) {
+LongDoubleWidth = LongDoubleAlign = 64;
+LongDoubleFormat = ::APFloat::IEEEdouble;
+  }
+  setN64ABITypes();
+  SuitableAlign = 128;
+  MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 64;
+}
   }
 
   bool isNaN2008Default() const {
@@ -7049,6 +7097,48 @@ public:
   }
 
   StringRef getABI() const override { return ABI; }
+  bool setABI(const std::string ) override {
+if (getTriple().getArch() == llvm::Triple::mips ||
+getTriple().getArch() == llvm::Triple::mipsel) {
+  if (Name == "o32" || Name == "eabi") {
+ABI = Name;
+return true;
+  }
+}
+if (getTriple().getArch() == llvm::Triple::mips64 ||
+getTriple().getArch() == llvm::Triple::mips64el) {
+  if (Name == "n32") {
+setN32ABITypes();
+ABI = Name;
+return true;
+  }
+  if (Name == "n64") {
+setN64ABITypes();
+ABI = Name;
+return true;
+  }
+}
+return false;
+  }
+
+  void setN64ABITypes() {
+LongWidth = LongAlign = 64;
+PointerWidth = PointerAlign = 64;
+SizeType = UnsignedLong;
+PtrDiffType = SignedLong;
+Int64Type = SignedLong;
+IntMaxType = Int64Type;
+  }
+

r270983 - Convert assert to static_assert. NFC.

2016-05-27 Thread Benjamin Kramer via cfe-commits
Author: d0k
Date: Fri May 27 06:48:53 2016
New Revision: 270983

URL: http://llvm.org/viewvc/llvm-project?rev=270983=rev
Log:
Convert assert to static_assert. NFC.

Modified:
cfe/trunk/include/clang/AST/Type.h

Modified: cfe/trunk/include/clang/AST/Type.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=270983=270982=270983=diff
==
--- cfe/trunk/include/clang/AST/Type.h (original)
+++ cfe/trunk/include/clang/AST/Type.h Fri May 27 06:48:53 2016
@@ -5357,7 +5357,8 @@ inline void QualType::removeLocalVolatil
 
 inline void QualType::removeLocalCVRQualifiers(unsigned Mask) {
   assert(!(Mask & ~Qualifiers::CVRMask) && "mask has non-CVR bits");
-  assert((int)Qualifiers::CVRMask == (int)Qualifiers::FastMask);
+  static_assert((int)Qualifiers::CVRMask == (int)Qualifiers::FastMask,
+"Fast bits differ from CVR bits!");
 
   // Fast path: we don't need to touch the slow qualifiers.
   removeLocalFastQualifiers(Mask);


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


Re: [PATCH] D20614: Remove trailing spaces in x86 intrinsic headers

2016-05-27 Thread michael zuckerman via cfe-commits
m_zuckerman accepted this revision.
m_zuckerman added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rL LLVM

http://reviews.llvm.org/D20614



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


  1   2   >