[libcxx] r274214 - Update status of already completed Oulu issues.

2016-06-30 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Thu Jun 30 01:59:29 2016
New Revision: 274214

URL: http://llvm.org/viewvc/llvm-project?rev=274214&view=rev
Log:
Update status of already completed Oulu issues.

* P0163r0: Implemented in r273839.

* LWG 2309: pthread_mutex_lock only returns this error if certain debug flags
  were passed during construction. libc++ does not pass these flags. There is
  nothing to do.

* LWG 2310: Wording fix. No impact on libc++'s implementation.

* LWG 2312: libc++'s std::tuple implementation already constrains the overloads
  based on the number of arguments.

* LWG 2549: libc++'s std::tuple already applied this fix.

* LWG 2674: libc++ already depends on this relaxed wording.

* LWG 2704, 2706, 2707, 2719, 2720, 2721, 2723, 2725, 2728: All of these 
filesystem were either
  submitted by me and fixed before submission, or have already been applied.

Modified:
libcxx/trunk/www/cxx1z_status.html

Modified: libcxx/trunk/www/cxx1z_status.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx1z_status.html?rev=274214&r1=274213&r2=274214&view=diff
==
--- libcxx/trunk/www/cxx1z_status.html (original)
+++ libcxx/trunk/www/cxx1z_status.html Thu Jun 30 01:59:29 2016
@@ -101,7 +101,7 @@
http://wg21.link/p0083r3";>p0083r3LWGSplicing Maps 
and SetsOulu
http://wg21.link/p0084r2";>p0084r2LWGEmplace Return 
TypeOulu
http://wg21.link/p0088r3";>p0088r3LWGVariant: a 
type-safe union for C++17Oulu
-   http://wg21.link/p0163r0";>p0163r0LWGshared_ptr::weak_typeOulu
+   http://wg21.link/p0163r0";>p0163r0LWGshared_ptr::weak_typeOuluComplete3.9
http://wg21.link/p0174r2";>p0174r2LWGDeprecating 
Vestigial Library Parts in C++17Oulu
http://wg21.link/p0175r1";>p0175r1LWGSynopses for 
the C libraryOulu
http://wg21.link/p0180r2";>p0180r2LWGReserve a New 
Library Namespace for Future 
StandardizationOulu
@@ -261,9 +261,9 @@
http://wg21.link/LWG2590";>2590Aggregate 
initialization for 
std::arrayJacksonvilleComplete

http://wg21.link/LWG2181";>2181Exceptions 
from seed sequence operationsOulu
-   http://wg21.link/LWG2309";>2309mutex::lock() should not throw 
device_or_resource_busyOulu
-   http://wg21.link/LWG2310";>2310Public 
exposition only member in std::arrayOulu
-   http://wg21.link/LWG2312";>2312tuple's 
constructor constraints need to be phrased more 
preciselyOulu
+   http://wg21.link/LWG2309";>2309mutex::lock() should not throw 
device_or_resource_busyOuluComplete
+   http://wg21.link/LWG2310";>2310Public 
exposition only member in std::arrayOuluComplete
+   http://wg21.link/LWG2312";>2312tuple's 
constructor constraints need to be phrased more 
preciselyOuluComplete
http://wg21.link/LWG2328";>2328Rvalue 
stream extraction should use perfect forwardingOulu
http://wg21.link/LWG2393";>2393std::function's Callable 
definition is brokenOulu
http://wg21.link/LWG2422";>2422std::numeric_limits::is_modulo
 description: "most machines" errataOulu
@@ -274,7 +274,7 @@
http://wg21.link/LWG2509";>2509[fund.ts.v2] any_cast doesn't 
work with rvalue reference targets and cannot move with a value 
targetOulu
http://wg21.link/LWG2516";>2516[fund.ts.v2] Public 
"exposition only" members in observer_ptrOulu
http://wg21.link/LWG2542";>2542Missing 
const requirements for associative containersOulu
-   http://wg21.link/LWG2549";>2549Tuple 
EXPLICIT constructor templates that take tuple parameters end up taking 
references to temporaries and will create dangling 
referencesOulu
+   http://wg21.link/LWG2549";>2549Tuple 
EXPLICIT constructor templates that take tuple parameters end up taking 
references to temporaries and will create dangling 
referencesOuluComplete
http://wg21.link/LWG2550";>2550Wording of 
unordered container's clear() method complexityOulu
http://wg21.link/LWG2551";>2551[fund.ts.v2] "Exception 
safety" cleanup in library fundamentals requiredOulu
http://wg21.link/LWG2555";>2555[fund.ts.v2] No handling for 
over-aligned types in optionalOulu
@@ -285,7 +285,7 @@
http://wg21.link/LWG2670";>2670system_complete refers to 
undefined variable 'base'Oulu
http://wg21.link/LWG2671";>2671Errors in 
CopyOulu
http://wg21.link/LWG2673";>2673status() 
effects cannot be implemented as specifiedOulu
-   http://wg21.link/LWG2674";>2674Bidirectional iterator 
requirement on path::iterator is very expensiveOulu
+   http://wg21.link/LWG2674";>2674Bidirectional iterator 
requirement on path::iterator is very 
expensiveOuluComplete
http://wg21.link/LWG2683";>2683filesystem::copy() says "no 
effects"Oulu
http://wg21.link/LWG2684";>2684priority_queue lacking 
comparator typedefOulu
http://wg21.link/LWG2685";>2685shared_ptr 
deleters must not throw on move constructionOulu
@@ -293,23 +293,23 @@
http://wg21.link/LWG

r274217 - [ASTMatcher] Add a node matcher for EnumType.

2016-06-30 Thread Haojian Wu via cfe-commits
Author: hokein
Date: Thu Jun 30 02:50:01 2016
New Revision: 274217

URL: http://llvm.org/viewvc/llvm-project?rev=274217&view=rev
Log:
[ASTMatcher] Add a node matcher for EnumType.

Reviewers: aaron.ballman

Subscribers: cfe-commits, klimek

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

Modified:
cfe/trunk/docs/LibASTMatchersReference.html
cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp
cfe/trunk/unittests/ASTMatchers/ASTMatchersNodeTest.cpp

Modified: cfe/trunk/docs/LibASTMatchersReference.html
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LibASTMatchersReference.html?rev=274217&r1=274216&r2=274217&view=diff
==
--- cfe/trunk/docs/LibASTMatchersReference.html (original)
+++ cfe/trunk/docs/LibASTMatchersReference.html Thu Jun 30 02:50:01 2016
@@ -1448,6 +1448,21 @@ c and d.
 
 
 
+MatcherType>enumTypeMatcherEnumType>...
+Matches enum types.
+
+Given
+  enum C { Green };
+  enum S { Red };
+
+  C c;
+  S s;
+
+enumType() matches the type of the variable declarations of both c and
+s.
+
+
+
 MatcherType>functionProtoTypeMatcherFunctionProtoType>...
 Matches 
FunctionProtoType nodes.
 

Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h?rev=274217&r1=274216&r2=274217&view=diff
==
--- cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h (original)
+++ cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h Thu Jun 30 02:50:01 2016
@@ -4654,6 +4654,21 @@ AST_TYPELOC_TRAVERSE_MATCHER(pointee, ge
 ///   matches "typedef int X"
 AST_TYPE_MATCHER(TypedefType, typedefType);
 
+/// \brief Matches enum types.
+///
+/// Given
+/// \code
+///   enum C { Green };
+///   enum class S { Red };
+///
+///   C c;
+///   S s;
+/// \endcode
+//
+/// \c enumType() matches the type of the variable declarations of both \c c 
and
+/// \c s.
+AST_TYPE_MATCHER(EnumType, enumType);
+
 /// \brief Matches template specialization types.
 ///
 /// Given

Modified: cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp?rev=274217&r1=274216&r2=274217&view=diff
==
--- cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp (original)
+++ cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp Thu Jun 30 02:50:01 2016
@@ -171,6 +171,7 @@ RegistryMaps::RegistryMaps() {
   REGISTER_MATCHER(elaboratedType);
   REGISTER_MATCHER(enumConstantDecl);
   REGISTER_MATCHER(enumDecl);
+  REGISTER_MATCHER(enumType);
   REGISTER_MATCHER(equalsBoundNode);
   REGISTER_MATCHER(equalsIntegralValue);
   REGISTER_MATCHER(explicitCastExpr);

Modified: cfe/trunk/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ASTMatchers/ASTMatchersNodeTest.cpp?rev=274217&r1=274216&r2=274217&view=diff
==
--- cfe/trunk/unittests/ASTMatchers/ASTMatchersNodeTest.cpp (original)
+++ cfe/trunk/unittests/ASTMatchers/ASTMatchersNodeTest.cpp Thu Jun 30 02:50:01 
2016
@@ -1299,6 +1299,13 @@ TEST(TypeMatching, AutoRefTypes) {
 hasType(rValueReferenceType();
 }
 
+TEST(TypeMatching, MatchesEnumTypes) {
+  EXPECT_TRUE(matches("enum Color { Green }; Color color;",
+  loc(enumType(;
+  EXPECT_TRUE(matches("enum class Color { Green }; Color color;",
+  loc(enumType(;
+}
+
 TEST(TypeMatching, MatchesPointersToConstTypes) {
   EXPECT_TRUE(matches("int b; int * const a = &b;",
   loc(pointerType(;


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


Re: [PATCH] D21860: [ASTMatcher] Add a node matcher for EnumType.

2016-06-30 Thread Haojian Wu via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL274217: [ASTMatcher] Add a node matcher for EnumType. 
(authored by hokein).

Changed prior to commit:
  http://reviews.llvm.org/D21860?vs=62277&id=62340#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D21860

Files:
  cfe/trunk/docs/LibASTMatchersReference.html
  cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
  cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp
  cfe/trunk/unittests/ASTMatchers/ASTMatchersNodeTest.cpp

Index: cfe/trunk/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
===
--- cfe/trunk/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
+++ cfe/trunk/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
@@ -1299,6 +1299,13 @@
 hasType(rValueReferenceType();
 }
 
+TEST(TypeMatching, MatchesEnumTypes) {
+  EXPECT_TRUE(matches("enum Color { Green }; Color color;",
+  loc(enumType(;
+  EXPECT_TRUE(matches("enum class Color { Green }; Color color;",
+  loc(enumType(;
+}
+
 TEST(TypeMatching, MatchesPointersToConstTypes) {
   EXPECT_TRUE(matches("int b; int * const a = &b;",
   loc(pointerType(;
Index: cfe/trunk/docs/LibASTMatchersReference.html
===
--- cfe/trunk/docs/LibASTMatchersReference.html
+++ cfe/trunk/docs/LibASTMatchersReference.html
@@ -1448,6 +1448,21 @@
 
 
 
+MatcherType>enumTypeMatcherEnumType>...
+Matches enum types.
+
+Given
+  enum C { Green };
+  enum S { Red };
+
+  C c;
+  S s;
+
+enumType() matches the type of the variable declarations of both c and
+s.
+
+
+
 MatcherType>functionProtoTypeMatcherFunctionProtoType>...
 Matches 
FunctionProtoType nodes.
 
Index: cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
===
--- cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
+++ cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
@@ -4654,6 +4654,21 @@
 ///   matches "typedef int X"
 AST_TYPE_MATCHER(TypedefType, typedefType);
 
+/// \brief Matches enum types.
+///
+/// Given
+/// \code
+///   enum C { Green };
+///   enum class S { Red };
+///
+///   C c;
+///   S s;
+/// \endcode
+//
+/// \c enumType() matches the type of the variable declarations of both \c c 
and
+/// \c s.
+AST_TYPE_MATCHER(EnumType, enumType);
+
 /// \brief Matches template specialization types.
 ///
 /// Given
Index: cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp
===
--- cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp
+++ cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp
@@ -171,6 +171,7 @@
   REGISTER_MATCHER(elaboratedType);
   REGISTER_MATCHER(enumConstantDecl);
   REGISTER_MATCHER(enumDecl);
+  REGISTER_MATCHER(enumType);
   REGISTER_MATCHER(equalsBoundNode);
   REGISTER_MATCHER(equalsIntegralValue);
   REGISTER_MATCHER(explicitCastExpr);


Index: cfe/trunk/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
===
--- cfe/trunk/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
+++ cfe/trunk/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
@@ -1299,6 +1299,13 @@
 hasType(rValueReferenceType();
 }
 
+TEST(TypeMatching, MatchesEnumTypes) {
+  EXPECT_TRUE(matches("enum Color { Green }; Color color;",
+  loc(enumType(;
+  EXPECT_TRUE(matches("enum class Color { Green }; Color color;",
+  loc(enumType(;
+}
+
 TEST(TypeMatching, MatchesPointersToConstTypes) {
   EXPECT_TRUE(matches("int b; int * const a = &b;",
   loc(pointerType(;
Index: cfe/trunk/docs/LibASTMatchersReference.html
===
--- cfe/trunk/docs/LibASTMatchersReference.html
+++ cfe/trunk/docs/LibASTMatchersReference.html
@@ -1448,6 +1448,21 @@
 
 
 
+MatcherType>enumTypeMatcherEnumType>...
+Matches enum types.
+
+Given
+  enum C { Green };
+  enum S { Red };
+
+  C c;
+  S s;
+
+enumType() matches the type of the variable declarations of both c and
+s.
+
+
+
 MatcherType>functionProtoTypeMatcherFunctionProtoType>...
 Matches FunctionProtoType nodes.
 
Index: cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
===
--- cfe/trunk/include/clang/ASTMatcher

Re: [PATCH] D21836: [AVX512][BUILTIN][vpermilps][intrinsics] Fixing two incorrect IMM check.

2016-06-30 Thread michael zuckerman via cfe-commits
m_zuckerman added a comment.

No problem


http://reviews.llvm.org/D21836



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


r274218 - [Clang][Intrinsics][AVX512][BuiltIn] adding intrinsics for vrangesd instruction set

2016-06-30 Thread Michael Zuckerman via cfe-commits
Author: mzuckerm
Date: Thu Jun 30 03:05:46 2016
New Revision: 274218

URL: http://llvm.org/viewvc/llvm-project?rev=274218&view=rev
Log:
[Clang][Intrinsics][AVX512][BuiltIn] adding intrinsics for vrangesd instruction 
set

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

Modified:
cfe/trunk/lib/Headers/avx512dqintrin.h
cfe/trunk/test/CodeGen/avx512dq-builtins.c

Modified: cfe/trunk/lib/Headers/avx512dqintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512dqintrin.h?rev=274218&r1=274217&r2=274218&view=diff
==
--- cfe/trunk/lib/Headers/avx512dqintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512dqintrin.h Thu Jun 30 03:05:46 2016
@@ -792,6 +792,8 @@ _mm512_maskz_cvtepu64_ps (__mmask8 __U,
(__mmask8) -1, (int)(C),\
(int)(R)); })
 
+#define _mm_range_ss(A ,B , C) _mm_range_round_ss(A, B, C 
,_MM_FROUND_CUR_DIRECTION)
+
 #define _mm_mask_range_round_ss(W, U, A, B, C, R) __extension__ ({ \
   (__m128)__builtin_ia32_rangess128_round_mask((__v4sf)(__m128)(A), \
(__v4sf)(__m128)(B), \
@@ -799,6 +801,8 @@ _mm512_maskz_cvtepu64_ps (__mmask8 __U,
(__mmask8)(U), (int)(C),\
(int)(R)); })
 
+#define _mm_mask_range_ss(W , U, A, B, C) _mm_mask_range_round_ss(W, U, A, B, 
C , _MM_FROUND_CUR_DIRECTION)
+
 #define _mm_maskz_range_round_ss(U, A, B, C, R) __extension__ ({ \
   (__m128)__builtin_ia32_rangess128_round_mask((__v4sf)(__m128)(A), \
(__v4sf)(__m128)(B), \
@@ -806,6 +810,8 @@ _mm512_maskz_cvtepu64_ps (__mmask8 __U,
(__mmask8)(U), (int)(C),\
(int)(R)); })
 
+#define _mm_maskz_range_ss(U, A ,B , C) _mm_maskz_range_round_ss(U, A, B, C 
,_MM_FROUND_CUR_DIRECTION)
+
 #define _mm_range_round_sd(A, B, C, R) __extension__ ({   \
   (__m128d)__builtin_ia32_rangesd128_round_mask((__v2df)(__m128d)(A), \
 (__v2df)(__m128d)(B), \
@@ -813,6 +819,8 @@ _mm512_maskz_cvtepu64_ps (__mmask8 __U,
 (__mmask8) -1, (int)(C),\
 (int)(R)); })
 
+#define _mm_range_sd(A ,B , C) _mm_range_round_sd(A, B, C 
,_MM_FROUND_CUR_DIRECTION)
+
 #define _mm_mask_range_round_sd(W, U, A, B, C, R) __extension__ ({ \
   (__m128d)__builtin_ia32_rangesd128_round_mask((__v2df)(__m128d)(A), \
 (__v2df)(__m128d)(B), \
@@ -820,6 +828,8 @@ _mm512_maskz_cvtepu64_ps (__mmask8 __U,
 (__mmask8)(U), (int)(C),\
 (int)(R)); })
 
+#define _mm_mask_range_sd(W, U, A, B, C) _mm_mask_range_round_sd(W, U, A, B, C 
,_MM_FROUND_CUR_DIRECTION)
+
 #define _mm_maskz_range_round_sd(U, A, B, C, R) __extension__ ({ \
   (__m128d)__builtin_ia32_rangesd128_round_mask((__v2df)(__m128d)(A), \
 (__v2df)(__m128d)(B), \
@@ -827,6 +837,8 @@ _mm512_maskz_cvtepu64_ps (__mmask8 __U,
 (__mmask8)(U), (int)(C),\
 (int)(R)); })
 
+#define _mm_maskz_range_sd(U, A, B, C) _mm_maskz_range_round_sd(U, A, B, C 
,_MM_FROUND_CUR_DIRECTION)
+
 #define _mm512_reduce_pd(A, B) __extension__ ({ \
   (__m512d)__builtin_ia32_reducepd512_mask((__v8df)(__m512d)(A), (int)(B), \
(__v8df)_mm512_setzero_pd(), \

Modified: cfe/trunk/test/CodeGen/avx512dq-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx512dq-builtins.c?rev=274218&r1=274217&r2=274218&view=diff
==
--- cfe/trunk/test/CodeGen/avx512dq-builtins.c (original)
+++ cfe/trunk/test/CodeGen/avx512dq-builtins.c Thu Jun 30 03:05:46 2016
@@ -671,6 +671,42 @@ __m128 test_mm512_maskz_range_round_ss(_
   return _mm_maskz_range_round_ss(__U, __A, __B, 4, 8); 
 }
 
+__m128d test_mm_range_sd(__m128d __A, __m128d __B) {
+  // CHECK-LABEL: @test_mm_range_sd
+  // CHECK: @llvm.x86.avx512.mask.range.sd
+  return _mm_range_sd(__A, __B, 4); 
+}
+
+__m128d test_mm_mask_range_sd(__m128d __W, __mmask8 __U, __m128d __A, __m128d 
__B) {
+  // CHECK-LABEL: test_mm_mask_range_sd
+  // CHECK: @llvm.x86.avx512.mask.range.sd
+  return _mm_mask_range_sd(__W, __U, __A, __B, 4); 
+}
+
+__m128d test_mm_maskz_range_sd(__mmask8 __U, __m128d __A, __m128d __B) {
+  // CHECK-LABEL: @test_mm_maskz_range_sd
+  // CHECK: @llvm.x86.avx512.mask.range.sd
+  return _mm_maskz_range_sd(__U, __A, __B, 4); 
+}
+
+__m128d test_mm_range

Re: [PATCH] D21734: [Intrinsics][AVX512][BuiltIn] adding intrinsics for vrangesd instruction set

2016-06-30 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL274218: [Clang][Intrinsics][AVX512][BuiltIn] adding 
intrinsics for vrangesd… (authored by mzuckerm).

Changed prior to commit:
  http://reviews.llvm.org/D21734?vs=61907&id=62342#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D21734

Files:
  cfe/trunk/lib/Headers/avx512dqintrin.h
  cfe/trunk/test/CodeGen/avx512dq-builtins.c

Index: cfe/trunk/test/CodeGen/avx512dq-builtins.c
===
--- cfe/trunk/test/CodeGen/avx512dq-builtins.c
+++ cfe/trunk/test/CodeGen/avx512dq-builtins.c
@@ -671,6 +671,42 @@
   return _mm_maskz_range_round_ss(__U, __A, __B, 4, 8); 
 }
 
+__m128d test_mm_range_sd(__m128d __A, __m128d __B) {
+  // CHECK-LABEL: @test_mm_range_sd
+  // CHECK: @llvm.x86.avx512.mask.range.sd
+  return _mm_range_sd(__A, __B, 4); 
+}
+
+__m128d test_mm_mask_range_sd(__m128d __W, __mmask8 __U, __m128d __A, __m128d __B) {
+  // CHECK-LABEL: test_mm_mask_range_sd
+  // CHECK: @llvm.x86.avx512.mask.range.sd
+  return _mm_mask_range_sd(__W, __U, __A, __B, 4); 
+}
+
+__m128d test_mm_maskz_range_sd(__mmask8 __U, __m128d __A, __m128d __B) {
+  // CHECK-LABEL: @test_mm_maskz_range_sd
+  // CHECK: @llvm.x86.avx512.mask.range.sd
+  return _mm_maskz_range_sd(__U, __A, __B, 4); 
+}
+
+__m128d test_mm_range_ss(__m128d __A, __m128d __B) {
+  // CHECK-LABEL: @test_mm_range_ss
+  // CHECK: @llvm.x86.avx512.mask.range.ss
+  return _mm_range_ss(__A, __B, 4); 
+}
+
+__m128d test_mm_mask_range_ss(__m128 __W, __mmask8 __U, __m128 __A, __m128 __B) {
+  // CHECK-LABEL: @test_mm_mask_range_ss
+  // CHECK: @llvm.x86.avx512.mask.range.ss
+  return _mm_mask_range_ss(__W, __U, __A, __B, 4); 
+}
+
+__m128 test_mm_maskz_range_ss(__mmask8 __U, __m128 __A, __m128 __B) {
+  // CHECK-LABEL: @test_mm_maskz_range_ss
+  // CHECK: @llvm.x86.avx512.mask.range.ss
+  return _mm_maskz_range_ss(__U, __A, __B, 4); 
+}
+
 __m512 test_mm512_range_ps(__m512 __A, __m512 __B) {
   // CHECK-LABEL: @test_mm512_range_ps
   // CHECK: @llvm.x86.avx512.mask.range.ps.512
Index: cfe/trunk/lib/Headers/avx512dqintrin.h
===
--- cfe/trunk/lib/Headers/avx512dqintrin.h
+++ cfe/trunk/lib/Headers/avx512dqintrin.h
@@ -792,41 +792,53 @@
(__mmask8) -1, (int)(C),\
(int)(R)); })
 
+#define _mm_range_ss(A ,B , C) _mm_range_round_ss(A, B, C ,_MM_FROUND_CUR_DIRECTION)
+
 #define _mm_mask_range_round_ss(W, U, A, B, C, R) __extension__ ({ \
   (__m128)__builtin_ia32_rangess128_round_mask((__v4sf)(__m128)(A), \
(__v4sf)(__m128)(B), \
(__v4sf)(__m128)(W),\
(__mmask8)(U), (int)(C),\
(int)(R)); })
 
+#define _mm_mask_range_ss(W , U, A, B, C) _mm_mask_range_round_ss(W, U, A, B, C , _MM_FROUND_CUR_DIRECTION)
+
 #define _mm_maskz_range_round_ss(U, A, B, C, R) __extension__ ({ \
   (__m128)__builtin_ia32_rangess128_round_mask((__v4sf)(__m128)(A), \
(__v4sf)(__m128)(B), \
(__v4sf)_mm_setzero_ps(), \
(__mmask8)(U), (int)(C),\
(int)(R)); })
 
+#define _mm_maskz_range_ss(U, A ,B , C) _mm_maskz_range_round_ss(U, A, B, C ,_MM_FROUND_CUR_DIRECTION)
+
 #define _mm_range_round_sd(A, B, C, R) __extension__ ({   \
   (__m128d)__builtin_ia32_rangesd128_round_mask((__v2df)(__m128d)(A), \
 (__v2df)(__m128d)(B), \
 (__v2df)_mm_setzero_pd(), \
 (__mmask8) -1, (int)(C),\
 (int)(R)); })
 
+#define _mm_range_sd(A ,B , C) _mm_range_round_sd(A, B, C ,_MM_FROUND_CUR_DIRECTION)
+
 #define _mm_mask_range_round_sd(W, U, A, B, C, R) __extension__ ({ \
   (__m128d)__builtin_ia32_rangesd128_round_mask((__v2df)(__m128d)(A), \
 (__v2df)(__m128d)(B), \
 (__v2df)(__m128d)(W),\
 (__mmask8)(U), (int)(C),\
 (int)(R)); })
 
+#define _mm_mask_range_sd(W, U, A, B, C) _mm_mask_range_round_sd(W, U, A, B, C ,_MM_FROUND_CUR_DIRECTION)
+
 #define _mm_maskz_range_round_sd(U, A, B, C, R) __extension__ ({ \
   (__m128d)__builtin_ia32_rangesd128_round_mask((__v2df)(__m128d)(A), \
 (__v2df)(__m128d)(B), \
 (__v2df)_mm_setzero_pd(), \
   

Re: [cfe-dev] RFC: Default language standard mode policy

2016-06-30 Thread David Chisnall via cfe-commits
On 29 Jun 2016, at 23:07, Richard Smith via cfe-dev  
wrote:
> 
> Yes, those are real problems, but it's not reasonable for us to keep the 
> default at C++98/03 forever. GCC has already taken the plunge here, so a lot 
> of open-source code that doesn't work in C++11 onwards already explicitly 
> specifies an appropriate -std= flag.
> 

Could you clarify exactly what the issue is?  Currently, if I have some legacy 
C++98 code, the odds are that it just compiles with ${CXX}.  If I have new 
C++11 or C++14 code, then its build system likely sticks on the required -std= 
flag and it builds independent of what the compiler default is.

What code would be broken by keeping the default at the language version 
accepted by code that didn’t know about newer standards?  As long as we’re 
keeping support for C++98 in the front end, keeping the default there doesn’t 
seem particularly arduous for us and will avoid breaking third-party code.

David



smime.p7s
Description: S/MIME cryptographic signature
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2016-06-30 Thread Nikolay Haustov via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL274220: AMDGPU: Set amdgpu_kernel calling convention for 
OpenCL kernels. (authored by nhaustov).

Changed prior to commit:
  http://reviews.llvm.org/D21367?vs=62198&id=62343#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D21367

Files:
  cfe/trunk/include/clang/Basic/Specifiers.h
  cfe/trunk/lib/AST/ItaniumMangle.cpp
  cfe/trunk/lib/AST/Type.cpp
  cfe/trunk/lib/AST/TypePrinter.cpp
  cfe/trunk/lib/Basic/Targets.cpp
  cfe/trunk/lib/CodeGen/CGCall.cpp
  cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
  cfe/trunk/lib/CodeGen/CodeGenTypes.h
  cfe/trunk/lib/CodeGen/TargetInfo.cpp
  cfe/trunk/lib/CodeGen/TargetInfo.h
  cfe/trunk/lib/Sema/SemaType.cpp
  cfe/trunk/test/CodeGenOpenCL/amdgpu-call-kernel.cl
  cfe/trunk/test/CodeGenOpenCL/amdgpu-calling-conv.cl
  cfe/trunk/test/CodeGenOpenCL/amdgpu-num-gpr-attr.cl
  cfe/trunk/tools/libclang/CXType.cpp

Index: cfe/trunk/include/clang/Basic/Specifiers.h
===
--- cfe/trunk/include/clang/Basic/Specifiers.h
+++ cfe/trunk/include/clang/Basic/Specifiers.h
@@ -241,7 +241,7 @@
 CC_AAPCS_VFP,   // __attribute__((pcs("aapcs-vfp")))
 CC_IntelOclBicc, // __attribute__((intel_ocl_bicc))
 CC_SpirFunction, // default for OpenCL functions on SPIR target
-CC_SpirKernel,   // inferred for OpenCL kernels on SPIR target
+CC_OpenCLKernel, // inferred for OpenCL kernels
 CC_Swift,// __attribute__((swiftcall))
 CC_PreserveMost, // __attribute__((preserve_most))
 CC_PreserveAll,  // __attribute__((preserve_all))
@@ -257,7 +257,7 @@
 case CC_X86Pascal:
 case CC_X86VectorCall:
 case CC_SpirFunction:
-case CC_SpirKernel:
+case CC_OpenCLKernel:
 case CC_Swift:
   return false;
 default:
Index: cfe/trunk/test/CodeGenOpenCL/amdgpu-calling-conv.cl
===
--- cfe/trunk/test/CodeGenOpenCL/amdgpu-calling-conv.cl
+++ cfe/trunk/test/CodeGenOpenCL/amdgpu-calling-conv.cl
@@ -0,0 +1,12 @@
+// REQUIRES: amdgpu-registered-target
+// RUN: %clang_cc1 -triple amdgcn-unknown-unknown -S -emit-llvm -o - %s | FileCheck %s
+
+// CHECK: define amdgpu_kernel void @calling_conv_amdgpu_kernel()
+kernel void calling_conv_amdgpu_kernel()
+{
+}
+
+// CHECK: define void @calling_conv_none()
+void calling_conv_none()
+{
+}
Index: cfe/trunk/test/CodeGenOpenCL/amdgpu-num-gpr-attr.cl
===
--- cfe/trunk/test/CodeGenOpenCL/amdgpu-num-gpr-attr.cl
+++ cfe/trunk/test/CodeGenOpenCL/amdgpu-num-gpr-attr.cl
@@ -5,23 +5,23 @@
 
 __attribute__((amdgpu_num_vgpr(64))) // expected-no-diagnostics
 kernel void test_num_vgpr64() {
-// CHECK: define void @test_num_vgpr64() [[ATTR_VGPR64:#[0-9]+]]
+// CHECK: define amdgpu_kernel void @test_num_vgpr64() [[ATTR_VGPR64:#[0-9]+]]
 }
 
 __attribute__((amdgpu_num_sgpr(32))) // expected-no-diagnostics
 kernel void test_num_sgpr32() {
-// CHECK: define void @test_num_sgpr32() [[ATTR_SGPR32:#[0-9]+]]
+// CHECK: define amdgpu_kernel void @test_num_sgpr32() [[ATTR_SGPR32:#[0-9]+]]
 }
 
 __attribute__((amdgpu_num_vgpr(64), amdgpu_num_sgpr(32))) // expected-no-diagnostics
 kernel void test_num_vgpr64_sgpr32() {
-// CHECK: define void @test_num_vgpr64_sgpr32() [[ATTR_VGPR64_SGPR32:#[0-9]+]]
+// CHECK: define amdgpu_kernel void @test_num_vgpr64_sgpr32() [[ATTR_VGPR64_SGPR32:#[0-9]+]]
 
 }
 
 __attribute__((amdgpu_num_sgpr(20), amdgpu_num_vgpr(40))) // expected-no-diagnostics
 kernel void test_num_sgpr20_vgpr40() {
-// CHECK: define void @test_num_sgpr20_vgpr40() [[ATTR_SGPR20_VGPR40:#[0-9]+]]
+// CHECK: define amdgpu_kernel void @test_num_sgpr20_vgpr40() [[ATTR_SGPR20_VGPR40:#[0-9]+]]
 }
 
 __attribute__((amdgpu_num_vgpr(0))) // expected-no-diagnostics
Index: cfe/trunk/test/CodeGenOpenCL/amdgpu-call-kernel.cl
===
--- cfe/trunk/test/CodeGenOpenCL/amdgpu-call-kernel.cl
+++ cfe/trunk/test/CodeGenOpenCL/amdgpu-call-kernel.cl
@@ -0,0 +1,14 @@
+// REQUIRES: amdgpu-registered-target
+// RUN: %clang_cc1 -triple amdgcn-unknown-unknown -S -emit-llvm -o - %s | FileCheck %s
+// CHECK: define amdgpu_kernel void @test_call_kernel(i32 addrspace(1)* nocapture %out)
+// CHECK: store i32 4, i32 addrspace(1)* %out, align 4
+
+kernel void test_kernel(global int *out)
+{
+  out[0] = 4;
+}
+
+__kernel void test_call_kernel(__global int *out)
+{
+  test_kernel(out);
+}
Index: cfe/trunk/lib/AST/Type.cpp
===
--- cfe/trunk/lib/AST/Type.cpp
+++ cfe/trunk/lib/AST/Type.cpp
@@ -2642,7 +2642,7 @@
   case CC_AAPCS_VFP: return "aapcs-vfp";
   case CC_IntelOclBicc: return "intel_ocl_bicc";
   case CC_SpirFunction: return "spir_function";
-  case CC_SpirKernel: return "spir_kernel";
+  case CC_OpenCLKernel: return "opencl_kernel";
   case CC_Swift: return "swiftcall";
   case CC_P

r274221 - Enable opencl driver tests, which never ran.

2016-06-30 Thread Benjamin Kramer via cfe-commits
Author: d0k
Date: Thu Jun 30 04:17:46 2016
New Revision: 274221

URL: http://llvm.org/viewvc/llvm-project?rev=274221&view=rev
Log:
Enable opencl driver tests, which never ran.

Then mark it as XFAIL because it always fails. I'll let OpenCL people
figure this out.

Modified:
cfe/trunk/test/Driver/lit.local.cfg
cfe/trunk/test/Driver/opencl.cl

Modified: cfe/trunk/test/Driver/lit.local.cfg
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/lit.local.cfg?rev=274221&r1=274220&r2=274221&view=diff
==
--- cfe/trunk/test/Driver/lit.local.cfg (original)
+++ cfe/trunk/test/Driver/lit.local.cfg Thu Jun 30 04:17:46 2016
@@ -1,5 +1,5 @@
 config.suffixes = ['.c', '.cpp', '.h', '.m', '.mm', '.S', '.s', '.f90', '.f95',
-   '.cu', '.rs']
+   '.cu', '.rs', '.cl']
 config.substitutions = list(config.substitutions)
 config.substitutions.insert(0,
 ('%clang_cc1',

Modified: cfe/trunk/test/Driver/opencl.cl
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/opencl.cl?rev=274221&r1=274220&r2=274221&view=diff
==
--- cfe/trunk/test/Driver/opencl.cl (original)
+++ cfe/trunk/test/Driver/opencl.cl Thu Jun 30 04:17:46 2016
@@ -1,3 +1,4 @@
+// XFAIL: *
 // RUN: %clang -S -### -cl-std=CL %s | FileCheck --check-prefix=CHECK-CL %s
 // RUN: %clang -S -### -cl-std=CL1.1 %s | FileCheck --check-prefix=CHECK-CL11 
%s
 // RUN: %clang -S -### -cl-std=CL1.2 %s | FileCheck --check-prefix=CHECK-CL12 
%s


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


Re: r274150 - [OpenCL] Allow -cl-std and other standard -cl- options in driver

2016-06-30 Thread Benjamin Kramer via cfe-commits
The opencl.cl test never ran due to a lit misconfiguration (see
r274221). Now that's fixed but the test doesn't pass, so I marked it
as XFAIL. Can you take a look?

On Wed, Jun 29, 2016 at 9:39 PM, Yaxun Liu via cfe-commits
 wrote:
> Author: yaxunl
> Date: Wed Jun 29 14:39:32 2016
> New Revision: 274150
>
> URL: http://llvm.org/viewvc/llvm-project?rev=274150&view=rev
> Log:
> [OpenCL] Allow -cl-std and other standard -cl- options in driver
>
> Allow -cl-std and other standard -cl- options from cc1 to driver.
>
> Added a test for the options moved.
>
> Patch by Aaron En Ye Shi.
>
> Differential Revision: http://reviews.llvm.org/D21031
>
> Modified:
> cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td
> cfe/trunk/include/clang/Driver/CC1Options.td
> cfe/trunk/include/clang/Driver/Options.td
> cfe/trunk/lib/Driver/Tools.cpp
> cfe/trunk/lib/Frontend/CompilerInvocation.cpp
> cfe/trunk/test/Driver/opencl.cl
>
> Modified: cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td?rev=274150&r1=274149&r2=274150&view=diff
> ==
> --- cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td Wed Jun 29 
> 14:39:32 2016
> @@ -214,4 +214,7 @@ def err_missing_vfs_overlay_file : Error
>"virtual filesystem overlay file '%0' not found">, DefaultFatal;
>  def err_invalid_vfs_overlay : Error<
>"invalid virtual filesystem overlay file '%0'">, DefaultFatal;
> -}
> +
> +def warn_option_invalid_ocl_version : Warning<
> +  "OpenCL version %0 does not support the option '%1'">, InGroup;
> +}
> \ No newline at end of file
>
> Modified: cfe/trunk/include/clang/Driver/CC1Options.td
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=274150&r1=274149&r2=274150&view=diff
> ==
> --- cfe/trunk/include/clang/Driver/CC1Options.td (original)
> +++ cfe/trunk/include/clang/Driver/CC1Options.td Wed Jun 29 14:39:32 2016
> @@ -664,31 +664,6 @@ def detailed_preprocessing_record : Flag
>HelpText<"include a detailed record of preprocessing actions">;
>
>  
> //===--===//
> -// OpenCL Options
> -//===--===//
> -
> -def cl_opt_disable : Flag<["-"], "cl-opt-disable">,
> -  HelpText<"OpenCL only. This option disables all optimizations. The default 
> is optimizations are enabled.">;
> -def cl_strict_aliasing : Flag<["-"], "cl-strict-aliasing">,
> -  HelpText<"OpenCL only. This option does nothing and is for compatibility 
> with OpenCL 1.0">;
> -def cl_single_precision_constant : Flag<["-"], 
> "cl-single-precision-constant">,
> -  HelpText<"OpenCL only. Treat double precision floating-point constant as 
> single precision constant.">;
> -def cl_finite_math_only : Flag<["-"], "cl-finite-math-only">,
> -  HelpText<"OpenCL only. Allow floating-point optimizations that assume 
> arguments and results are not NaNs or +-Inf.">;
> -def cl_kernel_arg_info : Flag<["-"], "cl-kernel-arg-info">,
> -  HelpText<"OpenCL only. Generate kernel argument metadata.">;
> -def cl_unsafe_math_optimizations : Flag<["-"], 
> "cl-unsafe-math-optimizations">,
> -  HelpText<"OpenCL only. Allow unsafe floating-point optimizations.  Also 
> implies -cl-no-signed-zeros and -cl-mad-enable">;
> -def cl_fast_relaxed_math : Flag<["-"], "cl-fast-relaxed-math">,
> -  HelpText<"OpenCL only. Sets -cl-finite-math-only and 
> -cl-unsafe-math-optimizations, and defines __FAST_RELAXED_MATH__">;
> -def cl_mad_enable : Flag<["-"], "cl-mad-enable">,
> -  HelpText<"OpenCL only. Enable less precise MAD instructions to be 
> generated.">;
> -def cl_std_EQ : Joined<["-"], "cl-std=">,
> -  HelpText<"OpenCL language standard to compile for">;
> -def cl_denorms_are_zero : Flag<["-"], "cl-denorms-are-zero">,
> -  HelpText<"OpenCL only. Allow denormals to be flushed to zero">;
> -
> -//===--===//
>  // CUDA Options
>  
> //===--===//
>
>
> Modified: cfe/trunk/include/clang/Driver/Options.td
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=274150&r1=274149&r2=274150&view=diff
> ==
> --- cfe/trunk/include/clang/Driver/Options.td (original)
> +++ cfe/trunk/include/clang/Driver/Options.td Wed Jun 29 14:39:32 2016
> @@ -78,6 +78,7 @@ def g_flags_Group : OptionGroup<
>  def i_Group   : OptionGroup<"">, 
> Group;
>  def clang_i_Group : OptionGroup<"">, Group;
>  def m_Group   : OptionGr

Re: [PATCH] D21637: [libcxx] Don't use pthread initializers in constexpr constructors

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

LGTM.


http://reviews.llvm.org/D21637



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


Re: [PATCH] D21601: Make tooling::applyAllReplacements return llvm::Expected instead of empty string to indicate potential error.

2016-06-30 Thread Eric Liu via cfe-commits
ioeric added a comment.

Ping


http://reviews.llvm.org/D21601



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


Re: [PATCH] D21602: Changes related to tooling::applyAllReplacements interface change in D21601.

2016-06-30 Thread Eric Liu via cfe-commits
ioeric added a comment.

Ping


http://reviews.llvm.org/D21602



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


r274222 - [GCC] PR23529 Mangler part of attrbute abi_tag support

2016-06-30 Thread Dmitry Polukhin via cfe-commits
Author: dpolukhin
Date: Thu Jun 30 04:40:38 2016
New Revision: 274222

URL: http://llvm.org/viewvc/llvm-project?rev=274222&view=rev
Log:
[GCC] PR23529 Mangler part of attrbute abi_tag support

Original patch by Stefan Bühler http://reviews.llvm.org/D12834

Difference between original and this one:
- fixed all failing tests
- fixed mangling for global variable outside namespace
- emit ABI tags for guards and local names
- clang-format + other stylistic changes
- significantly reworked patch according to Richard's suggestions

Sema part, committed before http://reviews.llvm.org/D17567

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

Added:
cfe/trunk/test/CodeGenCXX/mangle-abi-tag.cpp   (with props)
Modified:
cfe/trunk/lib/AST/ItaniumMangle.cpp
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
cfe/trunk/test/PCH/attrs.c
cfe/trunk/test/SemaCXX/attr-abi-tag-syntax.cpp

Modified: cfe/trunk/lib/AST/ItaniumMangle.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ItaniumMangle.cpp?rev=274222&r1=274221&r2=274222&view=diff
==
--- cfe/trunk/lib/AST/ItaniumMangle.cpp (original)
+++ cfe/trunk/lib/AST/ItaniumMangle.cpp Thu Jun 30 04:40:38 2016
@@ -214,6 +214,12 @@ public:
 class CXXNameMangler {
   ItaniumMangleContextImpl &Context;
   raw_ostream &Out;
+  bool NullOut = false;
+  /// In the "DisableDerivedAbiTags" mode derived ABI tags are not calculated.
+  /// This mode is used when mangler creates another mangler recursively to
+  /// calculate ABI tags for the function return value or the variable type.
+  /// Also it is required to avoid infinite recursion in some cases.
+  bool DisableDerivedAbiTags = false;
 
   /// The "structor" is the top-level declaration being mangled, if
   /// that's not a template specialization; otherwise it's the pattern
@@ -263,15 +269,126 @@ class CXXNameMangler {
 
   } FunctionTypeDepth;
 
+  // abi_tag is a gcc attribute, taking one or more strings called "tags".
+  // The goal is to annotate against which version of a library an object was
+  // built and to be able to provide backwards compatibility ("dual abi").
+  // For more information see docs/ItaniumMangleAbiTags.rst.
+  typedef SmallVector AbiTagList;
+
+  // State to gather all implicit and explicit tags used in a mangled name.
+  // Must always have an instance of this while emitting any name to keep
+  // track.
+  class AbiTagState final {
+  public:
+explicit AbiTagState(AbiTagState *&Head) : LinkHead(Head) {
+  Parent = LinkHead;
+  LinkHead = this;
+}
+
+// No copy, no move.
+AbiTagState(const AbiTagState &) = delete;
+AbiTagState &operator=(const AbiTagState &) = delete;
+
+~AbiTagState() { pop(); }
+
+void write(raw_ostream &Out, const NamedDecl *ND,
+   const AbiTagList *AdditionalAbiTags) {
+  ND = cast(ND->getCanonicalDecl());
+  if (!isa(ND) && !isa(ND)) {
+assert(
+!AdditionalAbiTags &&
+"only function and variables need a list of additional abi tags");
+if (const auto *NS = dyn_cast(ND)) {
+  if (const auto *AbiTag = NS->getAttr()) {
+UsedAbiTags.insert(UsedAbiTags.end(), AbiTag->tags().begin(),
+   AbiTag->tags().end());
+  }
+  // Don't emit abi tags for namespaces.
+  return;
+}
+  }
+
+  AbiTagList TagList;
+  if (const auto *AbiTag = ND->getAttr()) {
+UsedAbiTags.insert(UsedAbiTags.end(), AbiTag->tags().begin(),
+   AbiTag->tags().end());
+TagList.insert(TagList.end(), AbiTag->tags().begin(),
+   AbiTag->tags().end());
+  }
+
+  if (AdditionalAbiTags) {
+UsedAbiTags.insert(UsedAbiTags.end(), AdditionalAbiTags->begin(),
+   AdditionalAbiTags->end());
+TagList.insert(TagList.end(), AdditionalAbiTags->begin(),
+   AdditionalAbiTags->end());
+  }
+
+  std::sort(TagList.begin(), TagList.end());
+  TagList.erase(std::unique(TagList.begin(), TagList.end()), 
TagList.end());
+
+  writeSortedUniqueAbiTags(Out, TagList);
+}
+
+const AbiTagList &getUsedAbiTags() const { return UsedAbiTags; }
+void setUsedAbiTags(const AbiTagList &AbiTags) {
+  UsedAbiTags = AbiTags;
+}
+
+const AbiTagList &getEmittedAbiTags() const {
+  return EmittedAbiTags;
+}
+
+const AbiTagList &getSortedUniqueUsedAbiTags() {
+  std::sort(UsedAbiTags.begin(), UsedAbiTags.end());
+  UsedAbiTags.erase(std::unique(UsedAbiTags.begin(), UsedAbiTags.end()),
+UsedAbiTags.end());
+  return UsedAbiTags;
+}
+
+  private:
+//! All abi tags used implicitly or explicitly.
+AbiTagList UsedAbiTags;
+//! All explicit abi tags (i.e. not from namespace).
+AbiTagList EmittedAbiTags;
+
+AbiTagState *&LinkHead;
+AbiTagState *Parent = nullp

Re: [PATCH] D21637: [libcxx] Don't use pthread initializers in constexpr constructors

2016-06-30 Thread Asiri Rathnayake via cfe-commits
rmaprath added a subscriber: rmaprath.
rmaprath added a comment.

Small side question: so how are `__m_` and `__cv_` initialized in this setup? 
is it that `pthread_mutex_lock()` and the like would be able to handle an 
un-initialized blob of memory (in a thread-safe way)? Because I don't see a 
call to `pthread_mutex_init()` anywhere in the code-path.


http://reviews.llvm.org/D21637



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


Re: [PATCH] D21637: [libcxx] Don't use pthread initializers in constexpr constructors

2016-06-30 Thread Eric Fiselier via cfe-commits
EricWF added a comment.

In http://reviews.llvm.org/D21637#471151, @rmaprath wrote:

> Small side question: so how are `__m_` and `__cv_` initialized in this setup? 
> is it that `pthread_mutex_lock()` and the like would be able to handle an 
> un-initialized blob of memory (in a thread-safe way)? Because I don't see a 
> call to `pthread_mutex_init()` anywhere in the code-path.


`__m_` and `__cv_` are initialized during  non-static data member 
initialization. They didn't previously call pthread_mutex_lock(), instead they 
directly initialized '__m_' and '__cv_' in the constructors initializer list.

And according to the current spec we are allowed to use 
PTHREAD_MUTEX_INITIALIZER to initialize non-static mutexes.
http://pubs.opengroup.org/onlinepubs/9699919799/

> In cases where default mutex attributes are appropriate, the macro 
> PTHREAD_MUTEX_INITIALIZER can be used to initialize mutexes.

>  The effect shall be equivalent to dynamic initialization by a call to 
> pthread_mutex_init() with parameter attr specified as NULL, except that no 
> error checks are performed.





http://reviews.llvm.org/D21637



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


Re: [PATCH] D21637: [libcxx] Don't use pthread initializers in constexpr constructors

2016-06-30 Thread Asiri Rathnayake via cfe-commits
rmaprath added a comment.

In http://reviews.llvm.org/D21637#471154, @EricWF wrote:

> In http://reviews.llvm.org/D21637#471151, @rmaprath wrote:
>
> > Small side question: so how are `__m_` and `__cv_` initialized in this 
> > setup? is it that `pthread_mutex_lock()` and the like would be able to 
> > handle an un-initialized blob of memory (in a thread-safe way)? Because I 
> > don't see a call to `pthread_mutex_init()` anywhere in the code-path.
>
>
> `__m_` and `__cv_` are initialized during  non-static data member 
> initialization. They didn't previously call pthread_mutex_lock(), instead 
> they directly initialized '__m_' and '__cv_' in the constructors initializer 
> list.
>
> And according to the current spec we are allowed to use 
> PTHREAD_MUTEX_INITIALIZER to initialize non-static mutexes.
>  http://pubs.opengroup.org/onlinepubs/9699919799/
>
> > In cases where default mutex attributes are appropriate, the macro 
> > PTHREAD_MUTEX_INITIALIZER can be used to initialize mutexes.
>
> >  The effect shall be equivalent to dynamic initialization by a call to 
> > pthread_mutex_init() with parameter attr specified as NULL, except that no 
> > error checks are performed.
>


Ah! I've misread the patch - missed the assignment in the constructor (for the 
`_LIBCPP_HAS_NO_CONSTEXPR` case). Sorted now.

Thanks.

/ Asiri


http://reviews.llvm.org/D21637



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


r274223 - Fix CodeGenCXX/mangle-abi-tag.cpp on clang-ppc64le-linux bot

2016-06-30 Thread Dmitry Polukhin via cfe-commits
Author: dpolukhin
Date: Thu Jun 30 06:15:52 2016
New Revision: 274223

URL: http://llvm.org/viewvc/llvm-project?rev=274223&view=rev
Log:
Fix CodeGenCXX/mangle-abi-tag.cpp on clang-ppc64le-linux bot

Modified:
cfe/trunk/test/CodeGenCXX/mangle-abi-tag.cpp

Modified: cfe/trunk/test/CodeGenCXX/mangle-abi-tag.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/mangle-abi-tag.cpp?rev=274223&r1=274222&r2=274223&view=diff
==
--- cfe/trunk/test/CodeGenCXX/mangle-abi-tag.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/mangle-abi-tag.cpp Thu Jun 30 06:15:52 2016
@@ -1,6 +1,7 @@
 // RUN: %clang_cc1 %s -emit-llvm -triple %itanium_abi_triple -std=c++11 -o - | 
FileCheck %s
 // RUN: %clang_cc1 %s -emit-llvm -triple i686-linux-gnu -std=c++11 -o - | 
FileCheck %s
 // RUN: %clang_cc1 %s -emit-llvm -triple x86_64-linux-gnu -std=c++11 -o - | 
FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -triple powerpc64le-unknown-linux-gnu 
-std=c++11 -o - | FileCheck %s
 
 struct __attribute__((abi_tag("A", "B"))) A { };
 
@@ -159,7 +160,7 @@ A14 A14::f14() {
   return A14();
 }
 // A14[abi:TAG]::f14()
-// CHECK-DAG: define void @_ZN3A14B3TAG3f14Ev(
+// CHECK-DAG: define {{.+}} @_ZN3A14B3TAG3f14Ev(
 
 template
 T f15() {
@@ -169,7 +170,7 @@ void f15_test() {
   f15();
 }
 // A14[abi:TAG] f15()
-// CHECK-DAG: define linkonce_odr void @_Z3f15I3A14B3TAGET_v(
+// CHECK-DAG: define linkonce_odr {{.+}} @_Z3f15I3A14B3TAGET_v(
 
 template
 A14 f16() {
@@ -179,7 +180,7 @@ void f16_test() {
   f16();
 }
 // A14[abi:TAG] f16()
-// CHECK-DAG: define linkonce_odr void @_Z3f16IiE3A14B3TAGv(
+// CHECK-DAG: define linkonce_odr {{.+}} @_Z3f16IiE3A14B3TAGv(
 
 template
 struct __attribute__((abi_tag("TAG"))) A17 {
@@ -192,7 +193,7 @@ void f17_test() {
   a + b;
 }
 // A17[abi:TAG]::operator+(A17[abi:TAG] const&)
-// CHECK-DAG: define linkonce_odr void @_ZN3A17B3TAGIiEplERKS0_(
+// CHECK-DAG: define linkonce_odr {{.+}} @_ZN3A17B3TAGIiEplERKS0_(
 
 struct A18 {
   operator A() { return A(); }
@@ -201,4 +202,4 @@ void f18_test() {
   A a = A18();
 }
 // A18::operator A[abi:A][abi:B]() but GCC adds the same tags twice!
-// CHECK-DAG: define linkonce_odr void @_ZN3A18cv1AB1AB1BEv(
+// CHECK-DAG: define linkonce_odr {{.+}} @_ZN3A18cv1AB1AB1BEv(


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


Re: [PATCH] D21385: Adjust Registry interface to not require plugins to export a registry

2016-06-30 Thread John Brawn via cfe-commits
john.brawn added a comment.

Ping


Repository:
  rL LLVM

http://reviews.llvm.org/D21385



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


Re: [PATCH] D21603: [include-fixer] Fix namespace after inserting a missing header.

2016-06-30 Thread Daniel Jasper via cfe-commits
djasper added inline comments.


Comment at: include-fixer/IncludeFixer.cpp:234
@@ +233,3 @@
+  std::string MinimizedFilePath = minimizeInclude(
+  ((FilePath[0] == '"' || FilePath[0] == '<') ? FilePath
+  : "\"" + FilePath + 
"\""),

How is this change related?


Comment at: include-fixer/IncludeFixer.cpp:238
@@ +237,3 @@
+  SymbolCandidates.emplace_back(Symbol.getName(), Symbol.getSymbolKind(),
+   MinimizedFilePath, Symbol.getLineNumber(),
+   Symbol.getContexts(),

Indentation is off.


Comment at: include-fixer/tool/ClangIncludeFixer.cpp:88
@@ -86,1 +87,3 @@
 
+cl::opt FixNamespace("fix-namespace",
+   cl::desc("Add missing namespace prefix to the "

Do we really want this? Should we just always do it? Who is going to use this 
flag?

If we want it, maybe call it "fix-namespace-qualifiers"? This renaming might 
also make sense of the patch itself, the test case, ...


Comment at: unittests/include-fixer/IncludeFixerTest.cpp:235
@@ -223,1 +234,3 @@
 
+TEST(IncludeFixer, FixNamespace) {
+  EXPECT_EQ("#include \"bar.h\"\na::b::bar b;\n",

All the tests in here test with an existing NestedNameSpecifier (i.e. b::bar). 
Is there a reason to not also have tests with a plain identifier (e.g. bar)?


Comment at: unittests/include-fixer/IncludeFixerTest.cpp:253
@@ +252,3 @@
+
+  // FIXME: Fix-namespace should not add the missing namespace prefix to the
+  // unidentified symbol which is already in that namespace.

I think we should address this part from the start. Otherwise, we are making 
the current behavior worse for a significant amount of cases. I suspect that 
frequently people use types from their own projects (and thus in the same 
namespace they are already in) and we don't want to add nested name specifiers 
for those.


http://reviews.llvm.org/D21603



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


Re: [PATCH] D21602: Changes related to tooling::applyAllReplacements interface change in D21601.

2016-06-30 Thread Eric Liu via cfe-commits
ioeric updated this revision to Diff 62352.
ioeric added a comment.

- Always handle error.


http://reviews.llvm.org/D21602

Files:
  include-fixer/IncludeFixer.cpp
  include-fixer/IncludeFixer.h
  include-fixer/tool/ClangIncludeFixer.cpp
  unittests/clang-tidy/ClangTidyTest.h
  unittests/include-fixer/IncludeFixerTest.cpp

Index: unittests/include-fixer/IncludeFixerTest.cpp
===
--- unittests/include-fixer/IncludeFixerTest.cpp
+++ unittests/include-fixer/IncludeFixerTest.cpp
@@ -85,12 +85,15 @@
   runOnCode(&Factory, Code, "input.cc", ExtraArgs);
   if (FixerContext.Headers.empty())
 return Code;
-  tooling::Replacements Replacements =
-  clang::include_fixer::createInsertHeaderReplacements(
-  Code, "input.cc", FixerContext.Headers.front());
+  auto Replaces = clang::include_fixer::createInsertHeaderReplacements(
+  Code, "input.cc", FixerContext.Headers.front());
+  EXPECT_TRUE(static_cast(Replaces))
+  << llvm::toString(Replaces.takeError()) << "\n";
+  if (!Replaces)
+return "";
   clang::RewriterTestContext Context;
   clang::FileID ID = Context.createInMemoryFile("input.cc", Code);
-  clang::tooling::applyAllReplacements(Replacements, Context.Rewrite);
+  clang::tooling::applyAllReplacements(*Replaces, Context.Rewrite);
   return Context.getRewrittenText(ID);
 }
 
Index: unittests/clang-tidy/ClangTidyTest.h
===
--- unittests/clang-tidy/ClangTidyTest.h
+++ unittests/clang-tidy/ClangTidyTest.h
@@ -17,6 +17,7 @@
 #include "clang/Frontend/FrontendActions.h"
 #include "clang/Tooling/Refactoring.h"
 #include "clang/Tooling/Tooling.h"
+#include "llvm/ADT/Optional.h"
 #include 
 #include 
 
@@ -121,7 +122,13 @@
 Fixes.insert(Error.Fix.begin(), Error.Fix.end());
   if (Errors)
 *Errors = Context.getErrors();
-  return tooling::applyAllReplacements(Code, Fixes);
+  auto Result = tooling::applyAllReplacements(Code, Fixes);
+  if (!Result) {
+// FIXME: propogate the error.
+llvm::consumeError(Result.takeError());
+return "";
+  }
+  return *Result;
 }
 
 #define EXPECT_NO_CHANGES(Check, Code) \
Index: include-fixer/tool/ClangIncludeFixer.cpp
===
--- include-fixer/tool/ClangIncludeFixer.cpp
+++ include-fixer/tool/ClangIncludeFixer.cpp
@@ -208,12 +208,21 @@
   return 1;
 }
 
-tooling::Replacements Replacements =
+auto Replacements =
 clang::include_fixer::createInsertHeaderReplacements(
 Code->getBuffer(), FilePath, Context.Headers[0], InsertStyle);
-std::string ChangedCode =
-tooling::applyAllReplacements(Code->getBuffer(), Replacements);
-llvm::outs() << ChangedCode;
+if (!Replacements) {
+  errs() << "Failed to create header insertion replacement: "
+ << llvm::toString(Replacements.takeError()) << "\n";
+  return 1;
+}
+auto ChangedCode =
+tooling::applyAllReplacements(Code->getBuffer(), *Replacements);
+if (!ChangedCode) {
+  llvm::errs() << llvm::toString(ChangedCode.takeError()) << "\n";
+  return 1;
+}
+llvm::outs() << *ChangedCode;
 return 0;
   }
 
@@ -249,10 +258,14 @@
   }
 
   // FIXME: Rank the results and pick the best one instead of the first one.
-  tooling::Replacements Replacements =
-  clang::include_fixer::createInsertHeaderReplacements(
-  /*Code=*/Buffer.get()->getBuffer(), FilePath, Context.Headers.front(),
-  InsertStyle);
+  auto Replacements = clang::include_fixer::createInsertHeaderReplacements(
+  /*Code=*/Buffer.get()->getBuffer(), FilePath, Context.Headers.front(),
+  InsertStyle);
+  if (!Replacements) {
+errs() << "Failed to create header insertion replacement: "
+   << llvm::toString(Replacements.takeError()) << "\n";
+return 1;
+  }
 
   if (!Quiet)
 llvm::errs() << "Added #include" << Context.Headers.front();
@@ -265,15 +278,19 @@
   Diagnostics.setClient(&DiagnosticPrinter, false);
 
   if (STDINMode) {
-std::string ChangedCode =
-tooling::applyAllReplacements(Code->getBuffer(), Replacements);
-llvm::outs() << ChangedCode;
+auto ChangedCode =
+tooling::applyAllReplacements(Code->getBuffer(), *Replacements);
+if (!ChangedCode) {
+  llvm::errs() << llvm::toString(ChangedCode.takeError()) << "\n";
+  return 1;
+}
+llvm::outs() << *ChangedCode;
 return 0;
   }
 
   // Write replacements to disk.
   Rewriter Rewrites(SM, LangOptions());
-  tooling::applyAllReplacements(Replacements, Rewrites);
+  tooling::applyAllReplacements(*Replacements, Rewrites);
   return Rewrites.overwriteChangedFiles();
 }
 
Index: include-fixer/IncludeFixer.h
===
--- include-fixer/IncludeFixer.h
+++ include-fixer/IncludeFixer.h
@@ -68,8 +68,9 @@
 /// \param 

Re: r264008 - [sema] [CUDA] Use std algorithms in EraseUnwantedCUDAMatchesImpl.

2016-06-30 Thread Benjamin Kramer via cfe-commits
On Tue, Mar 22, 2016 at 1:09 AM, Justin Lebar via cfe-commits
 wrote:
> Author: jlebar
> Date: Mon Mar 21 19:09:25 2016
> New Revision: 264008
>
> URL: http://llvm.org/viewvc/llvm-project?rev=264008&view=rev
> Log:
> [sema] [CUDA] Use std algorithms in EraseUnwantedCUDAMatchesImpl.
>
> Summary: NFC
>
> Reviewers: tra
>
> Subscribers: cfe-commits
>
> Differential Revision: http://reviews.llvm.org/D18327
>
> Modified:
> cfe/trunk/lib/Sema/SemaCUDA.cpp
>
> Modified: cfe/trunk/lib/Sema/SemaCUDA.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCUDA.cpp?rev=264008&r1=264007&r2=264008&view=diff
> ==
> --- cfe/trunk/lib/Sema/SemaCUDA.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaCUDA.cpp Mon Mar 21 19:09:25 2016
> @@ -210,31 +210,28 @@ bool Sema::CheckCUDATarget(const Functio
>return false;
>  }
>
> -template 
> -static void EraseUnwantedCUDAMatchesImpl(Sema &S, const FunctionDecl *Caller,
> - llvm::SmallVectorImpl &Matches,
> - FetchDeclFn FetchDecl) {
> +template 
> +static void EraseUnwantedCUDAMatchesImpl(
> +Sema &S, const FunctionDecl *Caller, llvm::SmallVectorImpl &Matches,
> +std::function FetchDecl) {
>assert(S.getLangOpts().CUDATargetOverloads &&
>   "Should not be called w/o enabled target overloads.");
>if (Matches.size() <= 1)
>  return;
>
> +  // Gets the CUDA function preference for a call from Caller to Match.
> +  auto GetCFP = [&](const T &Match) {
> +return S.IdentifyCUDAPreference(Caller, FetchDecl(Match));
> +  };
> +
>// Find the best call preference among the functions in Matches.
> -  Sema::CUDAFunctionPreference P, BestCFP = Sema::CFP_Never;
> -  for (auto const &Match : Matches) {
> -P = S.IdentifyCUDAPreference(Caller, FetchDecl(Match));
> -if (P > BestCFP)
> -  BestCFP = P;
> -  }
> +  Sema::CUDAFunctionPreference BestCFP = GetCFP(*std::max_element(
> +  Matches.begin(), Matches.end(),
> +  [&](const T &M1, const T &M2) { return GetCFP(M1) < GetCFP(M2); }));
>
>// Erase all functions with lower priority.
> -  for (unsigned I = 0, N = Matches.size(); I != N;)
> -if (S.IdentifyCUDAPreference(Caller, FetchDecl(Matches[I])) < BestCFP) {
> -  Matches[I] = Matches[--N];
> -  Matches.resize(N);
> -} else {
> -  ++I;
> -}
> +  Matches.erase(llvm::remove_if(
> +  Matches, [&](const T &Match) { return GetCFP(Match) < BestCFP; }));

This is the single-element form of SmallVector::erase, so it won't
remove ALL functions with lower priority. I sense a lack of test case
here.

>  }
>
>  void Sema::EraseUnwantedCUDAMatches(const FunctionDecl *Caller,
>
>
> ___
> 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] D21836: [AVX512][BUILTIN][vpermilps][intrinsics] Fixing two incorrect IMM check.

2016-06-30 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL274224: [AVX512][BUILTIN][vpermilps][intrinsics] Fixing two 
incorrect IMM check. (authored by mzuckerm).

Changed prior to commit:
  http://reviews.llvm.org/D21836?vs=62212&id=62353#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D21836

Files:
  cfe/trunk/lib/Sema/SemaChecking.cpp

Index: cfe/trunk/lib/Sema/SemaChecking.cpp
===
--- cfe/trunk/lib/Sema/SemaChecking.cpp
+++ cfe/trunk/lib/Sema/SemaChecking.cpp
@@ -1389,7 +1389,6 @@
   case X86::BI__builtin_ia32_extractf32x4_mask:
   case X86::BI__builtin_ia32_extracti32x4_mask:
   case X86::BI__builtin_ia32_vpermilpd_mask:
-  case X86::BI__builtin_ia32_vpermilps_mask:
   case X86::BI__builtin_ia32_extractf64x2_512_mask:
   case X86::BI__builtin_ia32_extracti64x2_512_mask:
 i = 1; l = 0; u = 3;
@@ -1461,7 +1460,6 @@
   case X86::BI__builtin_ia32_roundps256:
   case X86::BI__builtin_ia32_roundpd256:
   case X86::BI__builtin_ia32_vpermilpd256_mask:
-  case X86::BI__builtin_ia32_vpermilps256_mask:
 i = 1; l = 0; u = 15;
 break;
   case X86::BI__builtin_ia32_roundss:
@@ -1541,7 +1539,6 @@
   case X86::BI__builtin_ia32_psrlwi128_mask:
   case X86::BI__builtin_ia32_psrlwi256_mask:
   case X86::BI__builtin_ia32_vpermilpd512_mask:
-  case X86::BI__builtin_ia32_vpermilps512_mask:
   case X86::BI__builtin_ia32_psradi128_mask:
   case X86::BI__builtin_ia32_psradi256_mask:
   case X86::BI__builtin_ia32_psradi512_mask:
@@ -1566,6 +1563,9 @@
   case X86::BI__builtin_ia32_fpclasspd512_mask:
   case X86::BI__builtin_ia32_fpclasssd_mask:
   case X86::BI__builtin_ia32_fpcla_mask:
+  case X86::BI__builtin_ia32_vpermilps_mask:
+  case X86::BI__builtin_ia32_vpermilps256_mask:
+  case X86::BI__builtin_ia32_vpermilps512_mask:
 i = 1; l = 0; u = 255;
 break;
   case X86::BI__builtin_ia32_palignr:


Index: cfe/trunk/lib/Sema/SemaChecking.cpp
===
--- cfe/trunk/lib/Sema/SemaChecking.cpp
+++ cfe/trunk/lib/Sema/SemaChecking.cpp
@@ -1389,7 +1389,6 @@
   case X86::BI__builtin_ia32_extractf32x4_mask:
   case X86::BI__builtin_ia32_extracti32x4_mask:
   case X86::BI__builtin_ia32_vpermilpd_mask:
-  case X86::BI__builtin_ia32_vpermilps_mask:
   case X86::BI__builtin_ia32_extractf64x2_512_mask:
   case X86::BI__builtin_ia32_extracti64x2_512_mask:
 i = 1; l = 0; u = 3;
@@ -1461,7 +1460,6 @@
   case X86::BI__builtin_ia32_roundps256:
   case X86::BI__builtin_ia32_roundpd256:
   case X86::BI__builtin_ia32_vpermilpd256_mask:
-  case X86::BI__builtin_ia32_vpermilps256_mask:
 i = 1; l = 0; u = 15;
 break;
   case X86::BI__builtin_ia32_roundss:
@@ -1541,7 +1539,6 @@
   case X86::BI__builtin_ia32_psrlwi128_mask:
   case X86::BI__builtin_ia32_psrlwi256_mask:
   case X86::BI__builtin_ia32_vpermilpd512_mask:
-  case X86::BI__builtin_ia32_vpermilps512_mask:
   case X86::BI__builtin_ia32_psradi128_mask:
   case X86::BI__builtin_ia32_psradi256_mask:
   case X86::BI__builtin_ia32_psradi512_mask:
@@ -1566,6 +1563,9 @@
   case X86::BI__builtin_ia32_fpclasspd512_mask:
   case X86::BI__builtin_ia32_fpclasssd_mask:
   case X86::BI__builtin_ia32_fpcla_mask:
+  case X86::BI__builtin_ia32_vpermilps_mask:
+  case X86::BI__builtin_ia32_vpermilps256_mask:
+  case X86::BI__builtin_ia32_vpermilps512_mask:
 i = 1; l = 0; u = 255;
 break;
   case X86::BI__builtin_ia32_palignr:
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r274224 - [AVX512][BUILTIN][vpermilps][intrinsics] Fixing two incorrect IMM check.

2016-06-30 Thread Michael Zuckerman via cfe-commits
Author: mzuckerm
Date: Thu Jun 30 07:12:20 2016
New Revision: 274224

URL: http://llvm.org/viewvc/llvm-project?rev=274224&view=rev
Log:
[AVX512][BUILTIN][vpermilps][intrinsics] Fixing two incorrect IMM check.

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


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

Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=274224&r1=274223&r2=274224&view=diff
==
--- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
+++ cfe/trunk/lib/Sema/SemaChecking.cpp Thu Jun 30 07:12:20 2016
@@ -1389,7 +1389,6 @@ bool Sema::CheckX86BuiltinFunctionCall(u
   case X86::BI__builtin_ia32_extractf32x4_mask:
   case X86::BI__builtin_ia32_extracti32x4_mask:
   case X86::BI__builtin_ia32_vpermilpd_mask:
-  case X86::BI__builtin_ia32_vpermilps_mask:
   case X86::BI__builtin_ia32_extractf64x2_512_mask:
   case X86::BI__builtin_ia32_extracti64x2_512_mask:
 i = 1; l = 0; u = 3;
@@ -1461,7 +1460,6 @@ bool Sema::CheckX86BuiltinFunctionCall(u
   case X86::BI__builtin_ia32_roundps256:
   case X86::BI__builtin_ia32_roundpd256:
   case X86::BI__builtin_ia32_vpermilpd256_mask:
-  case X86::BI__builtin_ia32_vpermilps256_mask:
 i = 1; l = 0; u = 15;
 break;
   case X86::BI__builtin_ia32_roundss:
@@ -1541,7 +1539,6 @@ bool Sema::CheckX86BuiltinFunctionCall(u
   case X86::BI__builtin_ia32_psrlwi128_mask:
   case X86::BI__builtin_ia32_psrlwi256_mask:
   case X86::BI__builtin_ia32_vpermilpd512_mask:
-  case X86::BI__builtin_ia32_vpermilps512_mask:
   case X86::BI__builtin_ia32_psradi128_mask:
   case X86::BI__builtin_ia32_psradi256_mask:
   case X86::BI__builtin_ia32_psradi512_mask:
@@ -1566,6 +1563,9 @@ bool Sema::CheckX86BuiltinFunctionCall(u
   case X86::BI__builtin_ia32_fpclasspd512_mask:
   case X86::BI__builtin_ia32_fpclasssd_mask:
   case X86::BI__builtin_ia32_fpcla_mask:
+  case X86::BI__builtin_ia32_vpermilps_mask:
+  case X86::BI__builtin_ia32_vpermilps256_mask:
+  case X86::BI__builtin_ia32_vpermilps512_mask:
 i = 1; l = 0; u = 255;
 break;
   case X86::BI__builtin_ia32_palignr:


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


Re: [PATCH] D21637: [libcxx] Don't use pthread initializers in constexpr constructors

2016-06-30 Thread Joerg Sonnenberger via cfe-commits
On Thu, Jun 30, 2016 at 06:37:59AM +, Eric Fiselier wrote:
> EricWF requested changes to this revision.
> EricWF added a comment.
> This revision now requires changes to proceed.
> 
> C++03 does not support default member initializers but libc++ provides both 
> of these classes an extensions in C++03.
> C++03 also does not support defaulted special members.

The bigger question for me would be whether Clang (and/or GCC) supports
them in (extended) C++03 mode.

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


Re: [PATCH] D21833: [clang-tidy] Fix more enum declaration cases in misc-unused-using-decls check.

2016-06-30 Thread Haojian Wu via cfe-commits
hokein updated this revision to Diff 62354.
hokein added a comment.

enumType is already in ASTMatcher now.


http://reviews.llvm.org/D21833

Files:
  clang-tidy/misc/UnusedUsingDeclsCheck.cpp
  test/clang-tidy/misc-unused-using-decls.cpp

Index: test/clang-tidy/misc-unused-using-decls.cpp
===
--- test/clang-tidy/misc-unused-using-decls.cpp
+++ test/clang-tidy/misc-unused-using-decls.cpp
@@ -44,11 +44,13 @@
 extern ostream cout;
 ostream &endl(ostream &os);
 
-enum Color {
-  Green,
-  Red,
-  Yellow
-};
+enum Color1 { Green };
+
+enum Color2 { Red };
+
+enum Color3 { Yellow };
+
+enum Color4 { Blue };
 
 }  // namespace n
 
@@ -126,11 +128,13 @@
 using n::H;
 }
 
-using n::Color;
-// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: using decl 'Color' is unused
+using n::Color1;
+// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: using decl 'Color1' is unused
 using n::Green;
 // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: using decl 'Green' is unused
-using n::Red;
+using n::Color2;
+using n::Color3;
+using n::Blue;
 
 // - Usages -
 void f(B b);
@@ -144,5 +148,7 @@
   UsedFunc();
   UsedTemplateFunc();
   cout << endl;
-  int t = Red;
+  Color2 color2;
+  int t1 = Color3::Yellow;
+  int t2 = Blue;
 }
Index: clang-tidy/misc/UnusedUsingDeclsCheck.cpp
===
--- clang-tidy/misc/UnusedUsingDeclsCheck.cpp
+++ clang-tidy/misc/UnusedUsingDeclsCheck.cpp
@@ -31,6 +31,7 @@
 void UnusedUsingDeclsCheck::registerMatchers(MatchFinder *Finder) {
   Finder->addMatcher(usingDecl(isExpansionInMainFile()).bind("using"), this);
   auto DeclMatcher = hasDeclaration(namedDecl().bind("used"));
+  Finder->addMatcher(loc(enumType(DeclMatcher)), this);
   Finder->addMatcher(loc(recordType(DeclMatcher)), this);
   Finder->addMatcher(loc(templateSpecializationType(DeclMatcher)), this);
   Finder->addMatcher(declRefExpr().bind("used"), this);
@@ -94,6 +95,8 @@
   removeFromFoundDecls(VD);
 } else if (const auto *ECD = dyn_cast(DRE->getDecl())) {
   removeFromFoundDecls(ECD);
+  if (const auto *ET = ECD->getType()->getAs())
+removeFromFoundDecls(ET->getDecl());
 }
   }
   // Check the uninstantiated template function usage.


Index: test/clang-tidy/misc-unused-using-decls.cpp
===
--- test/clang-tidy/misc-unused-using-decls.cpp
+++ test/clang-tidy/misc-unused-using-decls.cpp
@@ -44,11 +44,13 @@
 extern ostream cout;
 ostream &endl(ostream &os);
 
-enum Color {
-  Green,
-  Red,
-  Yellow
-};
+enum Color1 { Green };
+
+enum Color2 { Red };
+
+enum Color3 { Yellow };
+
+enum Color4 { Blue };
 
 }  // namespace n
 
@@ -126,11 +128,13 @@
 using n::H;
 }
 
-using n::Color;
-// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: using decl 'Color' is unused
+using n::Color1;
+// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: using decl 'Color1' is unused
 using n::Green;
 // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: using decl 'Green' is unused
-using n::Red;
+using n::Color2;
+using n::Color3;
+using n::Blue;
 
 // - Usages -
 void f(B b);
@@ -144,5 +148,7 @@
   UsedFunc();
   UsedTemplateFunc();
   cout << endl;
-  int t = Red;
+  Color2 color2;
+  int t1 = Color3::Yellow;
+  int t2 = Blue;
 }
Index: clang-tidy/misc/UnusedUsingDeclsCheck.cpp
===
--- clang-tidy/misc/UnusedUsingDeclsCheck.cpp
+++ clang-tidy/misc/UnusedUsingDeclsCheck.cpp
@@ -31,6 +31,7 @@
 void UnusedUsingDeclsCheck::registerMatchers(MatchFinder *Finder) {
   Finder->addMatcher(usingDecl(isExpansionInMainFile()).bind("using"), this);
   auto DeclMatcher = hasDeclaration(namedDecl().bind("used"));
+  Finder->addMatcher(loc(enumType(DeclMatcher)), this);
   Finder->addMatcher(loc(recordType(DeclMatcher)), this);
   Finder->addMatcher(loc(templateSpecializationType(DeclMatcher)), this);
   Finder->addMatcher(declRefExpr().bind("used"), this);
@@ -94,6 +95,8 @@
   removeFromFoundDecls(VD);
 } else if (const auto *ECD = dyn_cast(DRE->getDecl())) {
   removeFromFoundDecls(ECD);
+  if (const auto *ET = ECD->getType()->getAs())
+removeFromFoundDecls(ET->getDecl());
 }
   }
   // Check the uninstantiated template function usage.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21833: [clang-tidy] Fix more enum declaration cases in misc-unused-using-decls check.

2016-06-30 Thread Haojian Wu via cfe-commits
hokein marked an inline comment as done.
hokein added a comment.

http://reviews.llvm.org/D21833



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


Re: [PATCH] D20857: [clang-tidy] Add modernize-explicit-operator-bool check.

2016-06-30 Thread Murray Cumming via cfe-commits
murrayc updated this revision to Diff 62355.
murrayc marked an inline comment as done.
murrayc added a comment.

Same as previous patch, but with a tiny suggested whitespace corretion.


http://reviews.llvm.org/D20857

Files:
  clang-tidy/modernize/CMakeLists.txt
  clang-tidy/modernize/ExplicitOperatorBoolCheck.cpp
  clang-tidy/modernize/ExplicitOperatorBoolCheck.h
  clang-tidy/modernize/ModernizeTidyModule.cpp
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/modernize-explicit-operator-bool.rst
  test/clang-tidy/modernize-explicit-operator-bool-void-pointer.cpp
  test/clang-tidy/modernize-explicit-operator-bool.cpp

Index: test/clang-tidy/modernize-explicit-operator-bool.cpp
===
--- /dev/null
+++ test/clang-tidy/modernize-explicit-operator-bool.cpp
@@ -0,0 +1,19 @@
+// RUN: %check_clang_tidy %s modernize-explicit-operator-bool %t -- -- -std=c++11
+
+// This should trigger the check:
+class SomethingBad {
+  operator bool() const {
+// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: operator bool declaration is not explicit [modernize-explicit-operator-bool]
+return something != 0;
+  }
+
+  int something = 0;
+};
+
+class SomethingGood {
+  explicit operator bool() const {
+return something != 0;
+  }
+
+  int something = 0;
+};
Index: test/clang-tidy/modernize-explicit-operator-bool-void-pointer.cpp
===
--- /dev/null
+++ test/clang-tidy/modernize-explicit-operator-bool-void-pointer.cpp
@@ -0,0 +1,46 @@
+// RUN: %check_clang_tidy %s modernize-explicit-operator-bool %t -- -- -std=c++11
+
+// This should trigger the check:
+class SomethingBad {
+  operator const void *() const {
+// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: implicit operator const void* declaration should probably be explicit operator bool [modernize-explicit-operator-bool]
+return reinterpret_cast(something != 0);
+  }
+
+  int something = 0;
+};
+
+class SomethingGood {
+  // Note: Use modernize-explicit-operator-bool to check for implicit operator bool.
+  explicit operator bool() const {
+return something != 0;
+  }
+
+  int something = 0;
+};
+
+class SomethingGoodExplicitConstVoidPtr {
+  explicit operator const void *() const {
+return &something;
+  }
+
+  const int something = 0;
+};
+
+class SomethingGoodExplicitNonConstVoidPtr {
+  explicit operator void *() {
+return &something;
+  }
+
+  int something = 0;
+};
+
+class SomethingGoodNonConstVoidPtr {
+  // A non-const void* is unlikely to to be meant as operator bool before C++11
+  // let us use explicit.
+  operator void *() {
+return &something;
+  }
+
+  int something = 0;
+};
Index: docs/clang-tidy/checks/modernize-explicit-operator-bool.rst
===
--- /dev/null
+++ docs/clang-tidy/checks/modernize-explicit-operator-bool.rst
@@ -0,0 +1,28 @@
+.. title:: clang-tidy - modernize-explicit-operator-bool
+
+modernize-explicit-operator-bool
+
+
+This check finds implicit ``operator bool`` overloads and inserts the
+``explicit`` keyword, which is available since C++11.
+
+Without the ``explicit`` keyword, the implicit ``bool`` overload can allow
+objects to be compared accidentally. For instance, even when objects `a` and
+`b` have no ``operator ==`` overloads, an implicit ``operator bool`` would allow
+`a == b` to compile because both `a` and `b` can be implictly converted to
+``bool``.
+
+This check also finds implicit ``operator const void*`` overloads. These were
+often used before C++11 to avoid implicit conversions to ``bool`` when providing
+an ``operator bool`` overload.
+
+To disable the check for ``operator const void*`` overloads, you may set
+The :option:`WarnOnOperatorVoidPointer` option to 1.
+
+.. code-block:: c++
+
+  operator bool () const;
+
+  // becomes
+
+  explicit operator bool () const;
Index: docs/clang-tidy/checks/list.rst
===
--- docs/clang-tidy/checks/list.rst
+++ docs/clang-tidy/checks/list.rst
@@ -93,6 +93,7 @@
misc-virtual-near-miss
modernize-avoid-bind
modernize-deprecated-headers
+   modernize-explicit-operator-bool
modernize-loop-convert
modernize-make-shared
modernize-make-unique
Index: docs/ReleaseNotes.rst
===
--- docs/ReleaseNotes.rst
+++ docs/ReleaseNotes.rst
@@ -204,6 +204,13 @@
 
   Replaces C standard library headers with their C++ alternatives.
 
+- New `modernize-explicit-operator-bool
+  `_ check
+
+  Adds the ``explicit`` keyword to ``operator bool`` overloads.
+  Also finds ``operator const void*`` overloads, which should often be
+  ``explicit operator bool`` overloads.
+
 - New `modernize-make-shared
   

Re: [PATCH] D20857: [clang-tidy] Add modernize-explicit-operator-bool check.

2016-06-30 Thread Murray Cumming via cfe-commits
murrayc added a comment.

I'd still be perfectly happy if just the simple check for implicit operator 
bool was accepted.


http://reviews.llvm.org/D20857



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


Re: [PATCH] D21803: [libcxxabi] Provide a fallback __cxa_thread_atexit() implementation

2016-06-30 Thread Ben Craig via cfe-commits
bcraig added a comment.

In http://reviews.llvm.org/D21803#470564, @joerg wrote:

> On the topic of __cxa_thread_atexit, was it ever specified how it interacts 
> with things like thread cancellation?


I don't think it's officially specified anywhere.  C++ threads don't have a 
cancel method.  The POSIX spec doesn't speak about the C++ ABI.  The Itanium 
ABI could talk about this, but hasn't yet.

I think this implementation does the right thing with regards to cancellation 
though.  POSIX says that first cancellation cleanup handlers are called, then 
thread-specific data destructors are called.  pthread_cancel is still a really 
bad idea due to how it (doesn't) interact with RAII, but at least TLS data 
won't get leaked.



Comment at: src/cxa_thread_atexit.cpp:46
@@ +45,3 @@
+  pthread_key_delete(key_);
+}
+

dimitry wrote:
> run_dtors() is called when/if libc++.so gets unloaded... but only for the 
> thread calling dlclose()?
Most of the dtor magic is on the pthread_key_create side.  pthreads lets you 
register a per-thread destructor.

This destructor is only run on process termination (I think).


http://reviews.llvm.org/D21803



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


r274220 - AMDGPU: Set amdgpu_kernel calling convention for OpenCL kernels.

2016-06-30 Thread Nikolay Haustov via cfe-commits
Author: nhaustov
Date: Thu Jun 30 04:06:33 2016
New Revision: 274220

URL: http://llvm.org/viewvc/llvm-project?rev=274220&view=rev
Log:
AMDGPU: Set amdgpu_kernel calling convention for OpenCL kernels.

Summary:
Summary:
Change Clang calling convention SpirKernel to OpenCLKernel.
Set calling convention OpenCLKernel for amdgcn as well.
Add virtual method .getOpenCLKernelCallingConv() to TargetCodeGenInfo
and use it to set target calling convention for AMDGPU and SPIR.
Update tests.

Reviewers: rsmith, tstellarAMD, Anastasia, yaxunl

Subscribers: kzhuravl, cfe-commits

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

Added:
cfe/trunk/test/CodeGenOpenCL/amdgpu-call-kernel.cl   (with props)
cfe/trunk/test/CodeGenOpenCL/amdgpu-calling-conv.cl
Modified:
cfe/trunk/include/clang/Basic/Specifiers.h
cfe/trunk/lib/AST/ItaniumMangle.cpp
cfe/trunk/lib/AST/Type.cpp
cfe/trunk/lib/AST/TypePrinter.cpp
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/lib/CodeGen/CGCall.cpp
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
cfe/trunk/lib/CodeGen/CodeGenTypes.h
cfe/trunk/lib/CodeGen/TargetInfo.cpp
cfe/trunk/lib/CodeGen/TargetInfo.h
cfe/trunk/lib/Sema/SemaType.cpp
cfe/trunk/test/CodeGenOpenCL/amdgpu-num-gpr-attr.cl
cfe/trunk/tools/libclang/CXType.cpp

Modified: cfe/trunk/include/clang/Basic/Specifiers.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Specifiers.h?rev=274220&r1=274219&r2=274220&view=diff
==
--- cfe/trunk/include/clang/Basic/Specifiers.h (original)
+++ cfe/trunk/include/clang/Basic/Specifiers.h Thu Jun 30 04:06:33 2016
@@ -241,7 +241,7 @@ namespace clang {
 CC_AAPCS_VFP,   // __attribute__((pcs("aapcs-vfp")))
 CC_IntelOclBicc, // __attribute__((intel_ocl_bicc))
 CC_SpirFunction, // default for OpenCL functions on SPIR target
-CC_SpirKernel,   // inferred for OpenCL kernels on SPIR target
+CC_OpenCLKernel, // inferred for OpenCL kernels
 CC_Swift,// __attribute__((swiftcall))
 CC_PreserveMost, // __attribute__((preserve_most))
 CC_PreserveAll,  // __attribute__((preserve_all))
@@ -257,7 +257,7 @@ namespace clang {
 case CC_X86Pascal:
 case CC_X86VectorCall:
 case CC_SpirFunction:
-case CC_SpirKernel:
+case CC_OpenCLKernel:
 case CC_Swift:
   return false;
 default:

Modified: cfe/trunk/lib/AST/ItaniumMangle.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ItaniumMangle.cpp?rev=274220&r1=274219&r2=274220&view=diff
==
--- cfe/trunk/lib/AST/ItaniumMangle.cpp (original)
+++ cfe/trunk/lib/AST/ItaniumMangle.cpp Thu Jun 30 04:06:33 2016
@@ -2161,7 +2161,7 @@ StringRef CXXNameMangler::getCallingConv
   case CC_AAPCS_VFP:
   case CC_IntelOclBicc:
   case CC_SpirFunction:
-  case CC_SpirKernel:
+  case CC_OpenCLKernel:
   case CC_PreserveMost:
   case CC_PreserveAll:
 // FIXME: we should be mangling all of the above.

Modified: cfe/trunk/lib/AST/Type.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Type.cpp?rev=274220&r1=274219&r2=274220&view=diff
==
--- cfe/trunk/lib/AST/Type.cpp (original)
+++ cfe/trunk/lib/AST/Type.cpp Thu Jun 30 04:06:33 2016
@@ -2642,7 +2642,7 @@ StringRef FunctionType::getNameForCallCo
   case CC_AAPCS_VFP: return "aapcs-vfp";
   case CC_IntelOclBicc: return "intel_ocl_bicc";
   case CC_SpirFunction: return "spir_function";
-  case CC_SpirKernel: return "spir_kernel";
+  case CC_OpenCLKernel: return "opencl_kernel";
   case CC_Swift: return "swiftcall";
   case CC_PreserveMost: return "preserve_most";
   case CC_PreserveAll: return "preserve_all";

Modified: cfe/trunk/lib/AST/TypePrinter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/TypePrinter.cpp?rev=274220&r1=274219&r2=274220&view=diff
==
--- cfe/trunk/lib/AST/TypePrinter.cpp (original)
+++ cfe/trunk/lib/AST/TypePrinter.cpp Thu Jun 30 04:06:33 2016
@@ -725,7 +725,7 @@ void TypePrinter::printFunctionProtoAfte
   OS << " __attribute__((sysv_abi))";
   break;
 case CC_SpirFunction:
-case CC_SpirKernel:
+case CC_OpenCLKernel:
   // Do nothing. These CCs are not available as attributes.
   break;
 case CC_Swift:

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=274220&r1=274219&r2=274220&view=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Thu Jun 30 04:06:33 2016
@@ -2137,6 +2137,16 @@ public:
   Opts.cl_khr_3d_image_writes = 1;
 }
   }
+
+  CallingConvCheckResult checkCallingConvention(CallingConv CC) const override 
{
+switch (CC) {

Re: [PATCH] D18035: [GCC] PR23529 Mangler part of attrbute abi_tag support

2016-06-30 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL274222: [GCC] PR23529 Mangler part of attrbute abi_tag 
support (authored by dpolukhin).

Changed prior to commit:
  http://reviews.llvm.org/D18035?vs=62213&id=62344#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D18035

Files:
  cfe/trunk/lib/AST/ItaniumMangle.cpp
  cfe/trunk/lib/Sema/SemaDeclAttr.cpp
  cfe/trunk/test/CodeGenCXX/mangle-abi-tag.cpp
  cfe/trunk/test/PCH/attrs.c
  cfe/trunk/test/SemaCXX/attr-abi-tag-syntax.cpp

Index: cfe/trunk/test/PCH/attrs.c
===
--- cfe/trunk/test/PCH/attrs.c
+++ cfe/trunk/test/PCH/attrs.c
@@ -9,7 +9,7 @@
 #define HEADER
 
 int f(int) __attribute__((visibility("default"), overloadable));
-int g(int) __attribute__((abi_tag("foo", "bar", "baz"), no_sanitize("address", "memory"))); // expected-warning {{ignored}}
+int g(int) __attribute__((abi_tag("foo", "bar", "baz"), no_sanitize("address", "memory")));
 
 #else
 
Index: cfe/trunk/test/SemaCXX/attr-abi-tag-syntax.cpp
===
--- cfe/trunk/test/SemaCXX/attr-abi-tag-syntax.cpp
+++ cfe/trunk/test/SemaCXX/attr-abi-tag-syntax.cpp
@@ -16,28 +16,18 @@
 // expected-warning@-1 {{'abi_tag' attribute on anonymous namespace ignored}}
 
 inline namespace N __attribute__((__abi_tag__)) {}
-// FIXME: remove this warning as soon as attribute fully supported.
-// expected-warning@-2 {{'__abi_tag__' attribute ignored}}
 
 } // namespcace N2
 
 __attribute__((abi_tag("B", "A"))) extern int a1;
-// FIXME: remove this warning as soon as attribute fully supported.
-// expected-warning@-2 {{'abi_tag' attribute ignored}}
 
 __attribute__((abi_tag("A", "B"))) extern int a1;
 // expected-note@-1 {{previous declaration is here}}
-// FIXME: remove this warning as soon as attribute fully supported.
-// expected-warning@-3 {{'abi_tag' attribute ignored}}
 
 __attribute__((abi_tag("A", "C"))) extern int a1;
 // expected-error@-1 {{'abi_tag' C missing in original declaration}}
-// FIXME: remove this warning as soon as attribute fully supported.
-// expected-warning@-3 {{'abi_tag' attribute ignored}}
 
 extern int a2;
 // expected-note@-1 {{previous declaration is here}}
 __attribute__((abi_tag("A")))extern int a2;
 // expected-error@-1 {{cannot add 'abi_tag' attribute in a redeclaration}}
-// FIXME: remove this warning as soon as attribute fully supported.
-// expected-warning@-3 {{'abi_tag' attribute ignored}}
Index: cfe/trunk/test/CodeGenCXX/mangle-abi-tag.cpp
===
--- cfe/trunk/test/CodeGenCXX/mangle-abi-tag.cpp
+++ cfe/trunk/test/CodeGenCXX/mangle-abi-tag.cpp
@@ -0,0 +1,204 @@
+// RUN: %clang_cc1 %s -emit-llvm -triple %itanium_abi_triple -std=c++11 -o - | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -triple i686-linux-gnu -std=c++11 -o - | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -triple x86_64-linux-gnu -std=c++11 -o - | FileCheck %s
+
+struct __attribute__((abi_tag("A", "B"))) A { };
+
+struct B: A { };
+
+template
+
+struct C {
+};
+
+struct D { A* p; };
+
+template
+struct __attribute__((abi_tag("C", "D"))) E {
+};
+
+struct __attribute__((abi_tag("A", "B"))) F { };
+
+A a1;
+// CHECK-DAG: @_Z2a1B1AB1B =
+
+__attribute__((abi_tag("C", "D")))
+A a2;
+// CHECK-DAG: @_Z2a2B1AB1BB1CB1D =
+
+B a3;
+// CHECK-DAG: @a3 =
+
+C a4;
+// CHECK-DAG: @_Z2a4B1AB1B =
+
+D a5;
+// CHECK-DAG: @a5 =
+
+E a6;
+// CHECK-DAG: @_Z2a6B1CB1D =
+
+E a7;
+// CHECK-DAG: @_Z2a7B1AB1BB1CB1D =
+
+template<>
+struct E {
+  static float a8;
+};
+float E::a8;
+// CHECK-DAG: @_ZN1EB1CB1DIfE2a8E =
+
+template<>
+struct E {
+  static bool a9;
+};
+bool E::a9;
+// CHECK-DAG: @_ZN1EB1CB1DI1FB1AB1BE2a9E =
+
+struct __attribute__((abi_tag("A", "B"))) A10 {
+  virtual ~A10() {}
+} a10;
+// vtable
+// CHECK-DAG: @_ZTV3A10B1AB1B =
+// typeinfo
+// CHECK-DAG: @_ZTI3A10B1AB1B =
+
+struct __attribute__((abi_tag("A"))) B11 {
+  static A10 b;
+};
+A10 B11::b;
+// B11[abi:A]::b[abi:B]
+// CHECK-DAG: @_ZN3B11B1A1bB1BE =
+
+__attribute__ ((abi_tag("C", "D")))
+void* f1() {
+  return 0;
+}
+// CHECK-DAG: define {{.*}} @_Z2f1B1CB1Dv(
+
+__attribute__ ((abi_tag("C", "D")))
+A* f2() {
+  return 0;
+}
+// CHECK-DAG: define {{.*}} @_Z2f2B1AB1BB1CB1Dv(
+
+B* f3() {
+  return 0;
+}
+// CHECK-DAG: define {{.*}} @_Z2f3v(
+
+C* f4() {
+  return 0;
+}
+// CHECK-DAG: define {{.*}} @_Z2f4B1AB1Bv(
+
+D* f5() {
+  return 0;
+}
+// CHECK-DAG: define {{.*}} @_Z2f5v(
+
+E* f6() {
+  return 0;
+}
+// CHECK-DAG: define {{.*}} @_Z2f6B1CB1Dv(
+
+E* f7() {
+  return 0;
+}
+// CHECK-DAG: define {{.*}} @_Z2f7B1AB1BB1CB1Dv(
+
+void f8(E*) {
+}
+// CHECK-DAG: define {{.*}} @_Z2f8P1EB1CB1DI1AB1AB1BE(
+
+inline namespace Names1 __attribute__((__abi_tag__)) {
+class C1 {};
+}
+C1 f9() { return C1(); }
+// CHECK-DAG: @_Z2f9B6Names1v(
+
+inline namespace Names2 __attribute__((__abi_tag__("Tag1", "Tag2"))) {
+class C2 {};
+}
+C2 f10() {

Re: [PATCH] D21678: Fix For pr28288 - Error message in shift of vector values

2016-06-30 Thread Vladimir Yakovlev via cfe-commits
vbyakovl updated this revision to Diff 62345.

http://reviews.llvm.org/D21678

Files:
  llvm/tools/clang/lib/Sema/SemaExpr.cpp
  llvm/tools/clang/test/Sema/shift.c

Index: llvm/tools/clang/lib/Sema/SemaExpr.cpp
===
--- llvm/tools/clang/lib/Sema/SemaExpr.cpp
+++ llvm/tools/clang/lib/Sema/SemaExpr.cpp
@@ -8592,11 +8592,10 @@
 << RHS.get()->getSourceRange();
 }
 
-/// \brief Return the resulting type when an OpenCL vector is shifted
+/// \brief Return the resulting type when an vector is shifted
 ///by a scalar or vector shift amount.
-static QualType checkOpenCLVectorShift(Sema &S,
-   ExprResult &LHS, ExprResult &RHS,
-   SourceLocation Loc, bool IsCompAssign) {
+static QualType checkVectorShift(Sema &S, ExprResult &LHS, ExprResult &RHS,
+ SourceLocation Loc, bool IsCompAssign) {
   // OpenCL v1.1 s6.3.j says RHS can be a vector only if LHS is a vector.
   if (!LHS.get()->getType()->isVectorType()) {
 S.Diag(Loc, diag::err_shift_rhs_only_vector)
@@ -8636,9 +8635,8 @@
   }
 
   if (RHSVecTy) {
-// OpenCL v1.1 s6.3.j says that for vector types, the operators
-// are applied component-wise. So if RHS is a vector, then ensure
-// that the number of elements is the same as LHS...
+// For vector types, the operators are applied component-wise. So if RHS is
+// a vector, then ensure that the number of elements is the same as LHS...
 if (RHSVecTy->getNumElements() != LHSVecTy->getNumElements()) {
   S.Diag(Loc, diag::err_typecheck_vector_lengths_not_equal)
 << LHS.get()->getType() << RHS.get()->getType()
@@ -8664,23 +8662,19 @@
   // Vector shifts promote their scalar inputs to vector type.
   if (LHS.get()->getType()->isVectorType() ||
   RHS.get()->getType()->isVectorType()) {
-if (LangOpts.OpenCL)
-  return checkOpenCLVectorShift(*this, LHS, RHS, Loc, IsCompAssign);
 if (LangOpts.ZVector) {
   // The shift operators for the z vector extensions work basically
-  // like OpenCL shifts, except that neither the LHS nor the RHS is
+  // like general shifts, except that neither the LHS nor the RHS is
   // allowed to be a "vector bool".
   if (auto LHSVecType = LHS.get()->getType()->getAs())
 if (LHSVecType->getVectorKind() == VectorType::AltiVecBool)
   return InvalidOperands(Loc, LHS, RHS);
   if (auto RHSVecType = RHS.get()->getType()->getAs())
 if (RHSVecType->getVectorKind() == VectorType::AltiVecBool)
   return InvalidOperands(Loc, LHS, RHS);
-  return checkOpenCLVectorShift(*this, LHS, RHS, Loc, IsCompAssign);
+  return checkVectorShift(*this, LHS, RHS, Loc, IsCompAssign);
 }
-return CheckVectorOperands(LHS, RHS, Loc, IsCompAssign,
-   /*AllowBothBool*/true,
-   /*AllowBoolConversions*/false);
+return checkVectorShift(*this, LHS, RHS, Loc, IsCompAssign);
   }
 
   // Shifts don't perform usual arithmetic conversions, they just do integer
Index: llvm/tools/clang/test/Sema/shift.c
===
--- llvm/tools/clang/test/Sema/shift.c
+++ llvm/tools/clang/test/Sema/shift.c
@@ -67,3 +67,24 @@
 (void) (x >> 80); // no-warning
   (void) (x >> 80); // expected-warning {{shift count >= width of type}}
 }
+
+typedef unsigned vec16 __attribute__ ((vector_size (16)));
+typedef unsigned vec8 __attribute__ ((vector_size (8)));
+
+void
+vect_shift_1 (vec16 *x)
+{
+   *x = *x << 4 ;
+}
+
+void
+vect_shift_2 (vec16 *x,vec16 y)
+{
+   *x = *x << y ;
+}
+
+void
+vect_shift_3 (vec16 *x,vec8 y)
+{
+   *x = *x << y ; // expected-error {{vector operands do not have the same 
number of elements}}
+}


Index: llvm/tools/clang/lib/Sema/SemaExpr.cpp
===
--- llvm/tools/clang/lib/Sema/SemaExpr.cpp
+++ llvm/tools/clang/lib/Sema/SemaExpr.cpp
@@ -8592,11 +8592,10 @@
 << RHS.get()->getSourceRange();
 }
 
-/// \brief Return the resulting type when an OpenCL vector is shifted
+/// \brief Return the resulting type when an vector is shifted
 ///by a scalar or vector shift amount.
-static QualType checkOpenCLVectorShift(Sema &S,
-   ExprResult &LHS, ExprResult &RHS,
-   SourceLocation Loc, bool IsCompAssign) {
+static QualType checkVectorShift(Sema &S, ExprResult &LHS, ExprResult &RHS,
+ SourceLocation Loc, bool IsCompAssign) {
   // OpenCL v1.1 s6.3.j says RHS can be a vector only if LHS is a vector.
   if (!LHS.get()->getType()->isVectorType()) {
 S.Diag(Loc, diag::err_shift_rhs_only_vector)
@@ -8636,9 +8635,8 @@
   }
 
   if (RHSVecTy) {
-// OpenCL v1.1 s6.3.j says that for vector types, the operators
-// are applied component-wise. So if 

Re: [PATCH] D18035: [GCC] PR23529 Mangler part of attrbute abi_tag support

2016-06-30 Thread Dmitry Polukhin via cfe-commits
DmitryPolukhin added a comment.

Richard, thank you for the review!

I decided to commit this patch without waiting for GCC response to 
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71712 (that is last compatibility 
issues in comparison with GCC6) so more people could test Clang implementation 
of ABI tags on real apps and report issues if any. All, please let me know 
(file bug and add me in CC) if you observe any issues with abi_tag 
implementation in Clang.


Repository:
  rL LLVM

http://reviews.llvm.org/D18035



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


Re: [PATCH] D21637: [libcxx] Don't use pthread initializers in constexpr constructors

2016-06-30 Thread Julien Ramseier via cfe-commits
elram updated this revision to Diff 62339.

http://reviews.llvm.org/D21637

Files:
  include/__mutex_base

Index: include/__mutex_base
===
--- include/__mutex_base
+++ include/__mutex_base
@@ -34,16 +34,20 @@
 
 class _LIBCPP_TYPE_VIS _LIBCPP_THREAD_SAFETY_ANNOTATION(capability("mutex")) 
mutex
 {
+#ifndef _LIBCPP_HAS_NO_CONSTEXPR
+__libcpp_mutex_t __m_ = _LIBCPP_MUTEX_INITIALIZER;
+#else
 __libcpp_mutex_t __m_;
+#endif
 
 public:
 _LIBCPP_INLINE_VISIBILITY
 #ifndef _LIBCPP_HAS_NO_CONSTEXPR
-constexpr mutex() _NOEXCEPT : __m_(_LIBCPP_MUTEX_INITIALIZER) {}
+constexpr mutex() _NOEXCEPT _LIBCPP_DEFAULT
 #else
 mutex() _NOEXCEPT {__m_ = (__libcpp_mutex_t)_LIBCPP_MUTEX_INITIALIZER;}
 #endif
- ~mutex();
+~mutex();
 
 private:
 mutex(const mutex&);// = delete;
@@ -287,13 +291,18 @@
 
 class _LIBCPP_TYPE_VIS condition_variable
 {
-__libcpp_condvar_t  __cv_;
+#ifndef _LIBCPP_HAS_NO_CONSTEXPR
+__libcpp_condvar_t __cv_ = _LIBCPP_CONDVAR_INITIALIZER;
+#else
+__libcpp_condvar_t __cv_;
+#endif
+
 public:
 _LIBCPP_INLINE_VISIBILITY
 #ifndef _LIBCPP_HAS_NO_CONSTEXPR
-constexpr condition_variable() : __cv_(_LIBCPP_CONDVAR_INITIALIZER) {}
+constexpr condition_variable() _NOEXCEPT _LIBCPP_DEFAULT
 #else
-condition_variable() {__cv_ = 
(__libcpp_condvar_t)_LIBCPP_CONDVAR_INITIALIZER;}
+condition_variable() _NOEXCEPT {__cv_ = 
(__libcpp_condvar_t)_LIBCPP_CONDVAR_INITIALIZER;}
 #endif
 ~condition_variable();
 


Index: include/__mutex_base
===
--- include/__mutex_base
+++ include/__mutex_base
@@ -34,16 +34,20 @@
 
 class _LIBCPP_TYPE_VIS _LIBCPP_THREAD_SAFETY_ANNOTATION(capability("mutex")) mutex
 {
+#ifndef _LIBCPP_HAS_NO_CONSTEXPR
+__libcpp_mutex_t __m_ = _LIBCPP_MUTEX_INITIALIZER;
+#else
 __libcpp_mutex_t __m_;
+#endif
 
 public:
 _LIBCPP_INLINE_VISIBILITY
 #ifndef _LIBCPP_HAS_NO_CONSTEXPR
-constexpr mutex() _NOEXCEPT : __m_(_LIBCPP_MUTEX_INITIALIZER) {}
+constexpr mutex() _NOEXCEPT _LIBCPP_DEFAULT
 #else
 mutex() _NOEXCEPT {__m_ = (__libcpp_mutex_t)_LIBCPP_MUTEX_INITIALIZER;}
 #endif
- ~mutex();
+~mutex();
 
 private:
 mutex(const mutex&);// = delete;
@@ -287,13 +291,18 @@
 
 class _LIBCPP_TYPE_VIS condition_variable
 {
-__libcpp_condvar_t  __cv_;
+#ifndef _LIBCPP_HAS_NO_CONSTEXPR
+__libcpp_condvar_t __cv_ = _LIBCPP_CONDVAR_INITIALIZER;
+#else
+__libcpp_condvar_t __cv_;
+#endif
+
 public:
 _LIBCPP_INLINE_VISIBILITY
 #ifndef _LIBCPP_HAS_NO_CONSTEXPR
-constexpr condition_variable() : __cv_(_LIBCPP_CONDVAR_INITIALIZER) {}
+constexpr condition_variable() _NOEXCEPT _LIBCPP_DEFAULT
 #else
-condition_variable() {__cv_ = (__libcpp_condvar_t)_LIBCPP_CONDVAR_INITIALIZER;}
+condition_variable() _NOEXCEPT {__cv_ = (__libcpp_condvar_t)_LIBCPP_CONDVAR_INITIALIZER;}
 #endif
 ~condition_variable();
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D21895: CFGBuilder: Fix crash when visiting a range-based for over a dependent type

2016-06-30 Thread Martin Böhme via cfe-commits
mboehme created this revision.
mboehme added a reviewer: klimek.
mboehme added a subscriber: cfe-commits.

CFG generation is expected to fail in this case, but it should not crash.

Also added a test that reproduces the crash.

http://reviews.llvm.org/D21895

Files:
  lib/Analysis/CFG.cpp
  unittests/Analysis/CFGTest.cpp
  unittests/Analysis/CMakeLists.txt
  unittests/CMakeLists.txt

Index: unittests/CMakeLists.txt
===
--- unittests/CMakeLists.txt
+++ unittests/CMakeLists.txt
@@ -13,6 +13,7 @@
 add_subdirectory(Lex)
 add_subdirectory(Driver)
 if(CLANG_ENABLE_STATIC_ANALYZER)
+  add_subdirectory(Analysis)
   add_subdirectory(StaticAnalyzer)
   add_subdirectory(Frontend)
 endif()
Index: unittests/Analysis/CMakeLists.txt
===
--- /dev/null
+++ unittests/Analysis/CMakeLists.txt
@@ -0,0 +1,13 @@
+set(LLVM_LINK_COMPONENTS
+  Support
+  )
+
+add_clang_unittest(CFGTests
+  CFGTest.cpp
+  )
+
+target_link_libraries(CFGTests
+  clangAnalysis
+  clangASTMatchers
+  clangTooling
+  )
Index: unittests/Analysis/CFGTest.cpp
===
--- /dev/null
+++ unittests/Analysis/CFGTest.cpp
@@ -0,0 +1,54 @@
+//===- unittests/Analysis/CFGTest.cpp - CFG tests -===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "clang/ASTMatchers/ASTMatchFinder.h"
+#include "clang/Analysis/CFG.h"
+#include "clang/Tooling/Tooling.h"
+#include "gtest/gtest.h"
+#include 
+#include 
+
+namespace clang {
+namespace analysis {
+namespace {
+
+// Constructing a CFG for a range-based for over a dependent type fails (but
+// should not crash).
+TEST(CFG, RangeBasedForOverDependentType) {
+  const char *Code = "class Foo;\n"
+ "template \n"
+ "void f(const T &Range) {\n"
+ "  for (const Foo *TheFoo : Range) {\n"
+ "  }\n"
+ "}\n";
+
+  class CFGCallback : public ast_matchers::MatchFinder::MatchCallback {
+  public:
+void run(const ast_matchers::MatchFinder::MatchResult &Result) override {
+  const auto *Func = Result.Nodes.getNodeAs("func");
+  Stmt *Body = Func->getBody();
+  if (!Body)
+return;
+  std::unique_ptr cfg =
+  CFG::buildCFG(nullptr, Body, Result.Context, CFG::BuildOptions());
+  EXPECT_EQ(nullptr, cfg);
+}
+  } Callback;
+
+  ast_matchers::MatchFinder Finder;
+  Finder.addMatcher(ast_matchers::functionDecl().bind("func"), &Callback);
+  std::unique_ptr Factory(
+  tooling::newFrontendActionFactory(&Finder));
+  std::vector Args = {"-std=c++11"};
+  ASSERT_TRUE(tooling::runToolOnCodeWithArgs(Factory->create(), Code, Args));
+}
+
+} // namespace
+} // namespace analysis
+} // namespace clang
Index: lib/Analysis/CFG.cpp
===
--- lib/Analysis/CFG.cpp
+++ lib/Analysis/CFG.cpp
@@ -3457,6 +3457,8 @@
 // continue statements.
 Block = nullptr;
 Succ = addStmt(S->getInc());
+if (badCFG)
+  return nullptr;
 ContinueJumpTarget = JumpTarget(Succ, ContinueScopePos);
 
 // The starting block for the loop increment is the block that should
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21895: CFGBuilder: Fix crash when visiting a range-based for over a dependent type

2016-06-30 Thread Manuel Klimek via cfe-commits
klimek added inline comments.


Comment at: unittests/Analysis/CFGTest.cpp:49
@@ +48,3 @@
+  std::vector Args = {"-std=c++11"};
+  ASSERT_TRUE(tooling::runToolOnCodeWithArgs(Factory->create(), Code, Args));
+}

I think we want to assert that we at least found func once with a body.


http://reviews.llvm.org/D21895



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


[libcxx] r274235 - Implement LWG#2436: 'Comparators for associative containers should always be CopyConstructible'

2016-06-30 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Thu Jun 30 10:11:53 2016
New Revision: 274235

URL: http://llvm.org/viewvc/llvm-project?rev=274235&view=rev
Log:
Implement LWG#2436: 'Comparators for associative containers should always be 
CopyConstructible'

Added:

libcxx/trunk/test/std/containers/associative/map/map.cons/compare_copy_constructible.fail.cpp

libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/compare_copy_constructible.fail.cpp

libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/compare_copy_constructible.fail.cpp

libcxx/trunk/test/std/containers/associative/set/set.cons/compare_copy_constructible.fail.cpp

libcxx/trunk/test/std/containers/unord/unord.map/unord.map.cnstr/compare_copy_constructible.fail.cpp

libcxx/trunk/test/std/containers/unord/unord.map/unord.map.cnstr/hash_copy_constructible.fail.cpp

libcxx/trunk/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/compare_copy_constructible.fail.cpp

libcxx/trunk/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/hash_copy_constructible.fail.cpp

libcxx/trunk/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/compare_copy_constructible.fail.cpp

libcxx/trunk/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/hash_copy_constructible.fail.cpp

libcxx/trunk/test/std/containers/unord/unord.set/unord.set.cnstr/compare_copy_constructible.fail.cpp

libcxx/trunk/test/std/containers/unord/unord.set/unord.set.cnstr/hash_copy_constructible.fail.cpp
Modified:
libcxx/trunk/include/__hash_table
libcxx/trunk/include/__tree
libcxx/trunk/www/cxx1z_status.html

Modified: libcxx/trunk/include/__hash_table
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__hash_table?rev=274235&r1=274234&r2=274235&view=diff
==
--- libcxx/trunk/include/__hash_table (original)
+++ libcxx/trunk/include/__hash_table Thu Jun 30 10:11:53 2016
@@ -938,6 +938,10 @@ private:
 typedef allocator_traits<__node_base_allocator> __node_base_traits;
 static_assert((is_same<__node_base_pointer, typename 
__node_base_traits::pointer>::value),
  "Allocator does not rebind pointers in a sane manner.");
+static_assert((is_copy_constructible::value),
+ "Predicate must be copy-constructible.");
+static_assert((is_copy_constructible::value),
+ "Hasher must be copy-constructible.");
 
 private:
 

Modified: libcxx/trunk/include/__tree
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__tree?rev=274235&r1=274234&r2=274235&view=diff
==
--- libcxx/trunk/include/__tree (original)
+++ libcxx/trunk/include/__tree Thu Jun 30 10:11:53 2016
@@ -946,6 +946,8 @@ private:
 typedef allocator_traits<__node_base_allocator> __node_base_traits;
 static_assert((is_same<__node_base_pointer, typename 
__node_base_traits::pointer>::value),
  "Allocator does not rebind pointers in a sane manner.");
+static_assert((is_copy_constructible::value),
+ "Comparator must be copy-constructible.");
 
 private:
 __node_pointer __begin_node_;

Added: 
libcxx/trunk/test/std/containers/associative/map/map.cons/compare_copy_constructible.fail.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/map.cons/compare_copy_constructible.fail.cpp?rev=274235&view=auto
==
--- 
libcxx/trunk/test/std/containers/associative/map/map.cons/compare_copy_constructible.fail.cpp
 (added)
+++ 
libcxx/trunk/test/std/containers/associative/map/map.cons/compare_copy_constructible.fail.cpp
 Thu Jun 30 10:11:53 2016
@@ -0,0 +1,29 @@
+//===--===//
+//
+// 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.
+//
+//===--===//
+
+// 
+
+// Check that std::map fails to instantiate if the comparison predicate is 
+// not copy-constructible. This is LWG issue 2436
+
+#include 
+
+template 
+struct Comp {
+   bool operator () (const T& lhs, const T& rhs) const { return lhs < rhs; 
}
+
+   Comp () {}
+private:
+   Comp (const Comp &); // declared but not defined
+   };
+
+
+int main() {
+   std::map > m;
+}

Added: 
libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/compare_copy_constructible.fail.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/compare_copy_constructible.fail.cpp?rev=274235&view=auto

Re: [PATCH] D21705: Include debug info for nested structs and classes

2016-06-30 Thread Reid Kleckner via cfe-commits
rnk accepted this revision.
rnk added a comment.
This revision is now accepted and ready to land.

lgtm


http://reviews.llvm.org/D21705



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


Re: [PATCH] D21337: [CUDA] Give templated device functions internal linkage, templated kernels external linkage.

2016-06-30 Thread Reid Kleckner via cfe-commits
rnk accepted this revision.
rnk added a comment.
This revision is now accepted and ready to land.

lgtm Doing this in CodeGen seems right.


http://reviews.llvm.org/D21337



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


[libcxx] r274236 - Implement LWG#2441: 'Exact-width atomic typedefs should be provided'

2016-06-30 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Thu Jun 30 10:28:38 2016
New Revision: 274236

URL: http://llvm.org/viewvc/llvm-project?rev=274236&view=rev
Log:
Implement LWG#2441: 'Exact-width atomic typedefs should be provided'

Modified:
libcxx/trunk/include/atomic
libcxx/trunk/test/std/atomics/atomics.types.generic/integral.pass.cpp

libcxx/trunk/test/std/atomics/atomics.types.generic/integral_typedefs.pass.cpp

libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_helpers.h
libcxx/trunk/www/cxx1z_status.html

Modified: libcxx/trunk/include/atomic
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/atomic?rev=274236&r1=274235&r2=274236&view=diff
==
--- libcxx/trunk/include/atomic (original)
+++ libcxx/trunk/include/atomic Thu Jun 30 10:28:38 2016
@@ -515,6 +515,15 @@ typedef atomic atomic_uin
 typedef atomic  atomic_int_fast64_t;
 typedef atomic atomic_uint_fast64_t;
 
+typedef atomic   atomic_int8_t;
+typedef atomic  atomic_uint8_t;
+typedef atomic  atomic_int16_t;
+typedef atomic atomic_uint16_t;
+typedef atomic  atomic_int32_t;
+typedef atomic atomic_uint32_t;
+typedef atomic  atomic_int64_t;
+typedef atomic atomic_uint64_t;
+
 typedef atomic  atomic_intptr_t;
 typedef atomic atomic_uintptr_t;
 typedef atomicatomic_size_t;
@@ -1811,6 +1820,15 @@ typedef atomic atomic_uin
 typedef atomic  atomic_int_fast64_t;
 typedef atomic atomic_uint_fast64_t;
 
+typedef atomic< int8_t>  atomic_int8_t;
+typedef atomic  atomic_uint8_t;
+typedef atomic< int16_t> atomic_int16_t;
+typedef atomic atomic_uint16_t;
+typedef atomic< int32_t> atomic_int32_t;
+typedef atomic atomic_uint32_t;
+typedef atomic< int64_t> atomic_int64_t;
+typedef atomic atomic_uint64_t;
+
 typedef atomic  atomic_intptr_t;
 typedef atomic atomic_uintptr_t;
 typedef atomicatomic_size_t;

Modified: libcxx/trunk/test/std/atomics/atomics.types.generic/integral.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.types.generic/integral.pass.cpp?rev=274236&r1=274235&r2=274236&view=diff
==
--- libcxx/trunk/test/std/atomics/atomics.types.generic/integral.pass.cpp 
(original)
+++ libcxx/trunk/test/std/atomics/atomics.types.generic/integral.pass.cpp Thu 
Jun 30 10:28:38 2016
@@ -185,6 +185,15 @@ int main()
 #endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
 test();
 
+   test();
+   test();
+   test();
+   test();
+   test();
+   test();
+   test();
+   test();
+   
 test();
 test();
 test();
@@ -201,4 +210,13 @@ int main()
 test();
 #endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
 test();
+
+   test();
+   test();
+   test();
+   test();
+   test();
+   test();
+   test();
+   test();
 }

Modified: 
libcxx/trunk/test/std/atomics/atomics.types.generic/integral_typedefs.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.types.generic/integral_typedefs.pass.cpp?rev=274236&r1=274235&r2=274236&view=diff
==
--- 
libcxx/trunk/test/std/atomics/atomics.types.generic/integral_typedefs.pass.cpp 
(original)
+++ 
libcxx/trunk/test/std/atomics/atomics.types.generic/integral_typedefs.pass.cpp 
Thu Jun 30 10:28:38 2016
@@ -25,6 +25,18 @@
 // typedef atomic   atomic_char16_t;
 // typedef atomic   atomic_char32_t;
 // typedef atomicatomic_wchar_t;
+//
+// typedef atomic   atomic_intptr_t;
+// typedef atomic  atomic_uintptr_t;
+//
+// typedef atomic atomic_int8_t;
+// typedef atomicatomic_uint8_t;
+// typedef atomicatomic_int16_t;
+// typedef atomic   atomic_uint16_t;
+// typedef atomicatomic_int32_t;
+// typedef atomic   atomic_uint32_t;
+// typedef atomicatomic_int64_t;
+// typedef atomic   atomic_uint64_t;
 
 #include 
 #include 
@@ -47,4 +59,17 @@ int main()
 static_assert((std::is_same, 
std::atomic_char16_t>::value), "");
 static_assert((std::is_same, 
std::atomic_char32_t>::value), "");
 #endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
+
+//  Added by LWG 2441
+static_assert((std::is_same,  
std::atomic_intptr_t>::value), "");
+static_assert((std::is_same, 
std::atomic_uintptr_t>::value), "");
+
+static_assert((std::is_same,
std::atomic_int8_t>::value), "");
+static_assert((std::is_same,   
std::atomic_uint8_t>::value), "");
+static_assert((std::is_same,   
std::atomic_int16_t>::value), "");
+static_assert((std::is_same,  
std::atomic_uint16_t>::value), "");
+static_assert((std::is_same,   
std::atomic_int32_t>::value), "");
+static_assert((std::is_same,  
std::atomic_uint32_t>::value), "");
+static_assert((std::is_same,   
std::atomic_int64_t>::value), "");
+static_assert((std::i

RE: r274150 - [OpenCL] Allow -cl-std and other standard -cl- options in driver

2016-06-30 Thread Liu, Yaxun (Sam) via cfe-commits
We will take a look. Thanks.

Sam

-Original Message-
From: Benjamin Kramer [mailto:benny@gmail.com] 
Sent: Thursday, June 30, 2016 5:27 AM
To: Liu, Yaxun (Sam) ; Shi, Aaron (en ye) 
; anastasia.stul...@arm.com
Cc: cfe-commits 
Subject: Re: r274150 - [OpenCL] Allow -cl-std and other standard -cl- options 
in driver

The opencl.cl test never ran due to a lit misconfiguration (see r274221). Now 
that's fixed but the test doesn't pass, so I marked it as XFAIL. Can you take a 
look?

On Wed, Jun 29, 2016 at 9:39 PM, Yaxun Liu via cfe-commits 
 wrote:
> Author: yaxunl
> Date: Wed Jun 29 14:39:32 2016
> New Revision: 274150
>
> URL: http://llvm.org/viewvc/llvm-project?rev=274150&view=rev
> Log:
> [OpenCL] Allow -cl-std and other standard -cl- options in driver
>
> Allow -cl-std and other standard -cl- options from cc1 to driver.
>
> Added a test for the options moved.
>
> Patch by Aaron En Ye Shi.
>
> Differential Revision: http://reviews.llvm.org/D21031
>
> Modified:
> cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td
> cfe/trunk/include/clang/Driver/CC1Options.td
> cfe/trunk/include/clang/Driver/Options.td
> cfe/trunk/lib/Driver/Tools.cpp
> cfe/trunk/lib/Frontend/CompilerInvocation.cpp
> cfe/trunk/test/Driver/opencl.cl
>
> Modified: cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Diag
> nosticFrontendKinds.td?rev=274150&r1=274149&r2=274150&view=diff
> ==
> 
> --- cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td 
> (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td Wed Jun 
> +++ 29 14:39:32 2016
> @@ -214,4 +214,7 @@ def err_missing_vfs_overlay_file : Error
>"virtual filesystem overlay file '%0' not found">, DefaultFatal;  
> def err_invalid_vfs_overlay : Error<
>"invalid virtual filesystem overlay file '%0'">, DefaultFatal; -}
> +
> +def warn_option_invalid_ocl_version : Warning<
> +  "OpenCL version %0 does not support the option '%1'">, 
> +InGroup; }
> \ No newline at end of file
>
> Modified: cfe/trunk/include/clang/Driver/CC1Options.td
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1
> Options.td?rev=274150&r1=274149&r2=274150&view=diff
> ==
> 
> --- cfe/trunk/include/clang/Driver/CC1Options.td (original)
> +++ cfe/trunk/include/clang/Driver/CC1Options.td Wed Jun 29 14:39:32 
> +++ 2016
> @@ -664,31 +664,6 @@ def detailed_preprocessing_record : Flag
>HelpText<"include a detailed record of preprocessing actions">;
>
>  
> //===-
> -===//
> -// OpenCL Options
> -//===
> --===//
> -
> -def cl_opt_disable : Flag<["-"], "cl-opt-disable">,
> -  HelpText<"OpenCL only. This option disables all optimizations. The 
> default is optimizations are enabled.">; -def cl_strict_aliasing : 
> Flag<["-"], "cl-strict-aliasing">,
> -  HelpText<"OpenCL only. This option does nothing and is for 
> compatibility with OpenCL 1.0">; -def cl_single_precision_constant : 
> Flag<["-"], "cl-single-precision-constant">,
> -  HelpText<"OpenCL only. Treat double precision floating-point 
> constant as single precision constant.">; -def cl_finite_math_only : 
> Flag<["-"], "cl-finite-math-only">,
> -  HelpText<"OpenCL only. Allow floating-point optimizations that 
> assume arguments and results are not NaNs or +-Inf.">; -def 
> cl_kernel_arg_info : Flag<["-"], "cl-kernel-arg-info">,
> -  HelpText<"OpenCL only. Generate kernel argument metadata.">; -def 
> cl_unsafe_math_optimizations : Flag<["-"], 
> "cl-unsafe-math-optimizations">,
> -  HelpText<"OpenCL only. Allow unsafe floating-point optimizations.  
> Also implies -cl-no-signed-zeros and -cl-mad-enable">; -def 
> cl_fast_relaxed_math : Flag<["-"], "cl-fast-relaxed-math">,
> -  HelpText<"OpenCL only. Sets -cl-finite-math-only and 
> -cl-unsafe-math-optimizations, and defines __FAST_RELAXED_MATH__">; 
> -def cl_mad_enable : Flag<["-"], "cl-mad-enable">,
> -  HelpText<"OpenCL only. Enable less precise MAD instructions to be 
> generated.">; -def cl_std_EQ : Joined<["-"], "cl-std=">,
> -  HelpText<"OpenCL language standard to compile for">; -def 
> cl_denorms_are_zero : Flag<["-"], "cl-denorms-are-zero">,
> -  HelpText<"OpenCL only. Allow denormals to be flushed to zero">;
> -
> -//===
> --===//
>  // CUDA Options
>  
> //===-
> -===//
>
>
> Modified: cfe/trunk/include/clang/Driver/Options.td
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Opt
> ions.td?rev=274150&r1=274149&r2=274150&view=diff
> ===

Re: [PATCH] D21895: CFGBuilder: Fix crash when visiting a range-based for over a dependent type

2016-06-30 Thread Martin Böhme via cfe-commits
mboehme updated this revision to Diff 62374.

http://reviews.llvm.org/D21895

Files:
  lib/Analysis/CFG.cpp
  unittests/Analysis/CFGTest.cpp
  unittests/Analysis/CMakeLists.txt
  unittests/CMakeLists.txt

Index: unittests/CMakeLists.txt
===
--- unittests/CMakeLists.txt
+++ unittests/CMakeLists.txt
@@ -13,6 +13,7 @@
 add_subdirectory(Lex)
 add_subdirectory(Driver)
 if(CLANG_ENABLE_STATIC_ANALYZER)
+  add_subdirectory(Analysis)
   add_subdirectory(StaticAnalyzer)
   add_subdirectory(Frontend)
 endif()
Index: unittests/Analysis/CMakeLists.txt
===
--- /dev/null
+++ unittests/Analysis/CMakeLists.txt
@@ -0,0 +1,13 @@
+set(LLVM_LINK_COMPONENTS
+  Support
+  )
+
+add_clang_unittest(CFGTests
+  CFGTest.cpp
+  )
+
+target_link_libraries(CFGTests
+  clangAnalysis
+  clangASTMatchers
+  clangTooling
+  )
Index: unittests/Analysis/CFGTest.cpp
===
--- /dev/null
+++ unittests/Analysis/CFGTest.cpp
@@ -0,0 +1,58 @@
+//===- unittests/Analysis/CFGTest.cpp - CFG tests -===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "clang/ASTMatchers/ASTMatchFinder.h"
+#include "clang/Analysis/CFG.h"
+#include "clang/Tooling/Tooling.h"
+#include "gtest/gtest.h"
+#include 
+#include 
+
+namespace clang {
+namespace analysis {
+namespace {
+
+// Constructing a CFG for a range-based for over a dependent type fails (but
+// should not crash).
+TEST(CFG, RangeBasedForOverDependentType) {
+  const char *Code = "class Foo;\n"
+ "template \n"
+ "void f(const T &Range) {\n"
+ "  for (const Foo *TheFoo : Range) {\n"
+ "  }\n"
+ "}\n";
+
+  class CFGCallback : public ast_matchers::MatchFinder::MatchCallback {
+  public:
+bool SawFunctionBody = false;
+
+void run(const ast_matchers::MatchFinder::MatchResult &Result) override {
+  const auto *Func = Result.Nodes.getNodeAs("func");
+  Stmt *Body = Func->getBody();
+  if (!Body)
+return;
+  SawFunctionBody = true;
+  std::unique_ptr cfg =
+  CFG::buildCFG(nullptr, Body, Result.Context, CFG::BuildOptions());
+  EXPECT_EQ(nullptr, cfg);
+}
+  } Callback;
+
+  ast_matchers::MatchFinder Finder;
+  Finder.addMatcher(ast_matchers::functionDecl().bind("func"), &Callback);
+  std::unique_ptr Factory(
+  tooling::newFrontendActionFactory(&Finder));
+  std::vector Args = {"-std=c++11"};
+  ASSERT_TRUE(tooling::runToolOnCodeWithArgs(Factory->create(), Code, Args));
+  EXPECT_TRUE(Callback.SawFunctionBody);
+}
+
+} // namespace
+} // namespace analysis
+} // namespace clang
Index: lib/Analysis/CFG.cpp
===
--- lib/Analysis/CFG.cpp
+++ lib/Analysis/CFG.cpp
@@ -3457,6 +3457,8 @@
 // continue statements.
 Block = nullptr;
 Succ = addStmt(S->getInc());
+if (badCFG)
+  return nullptr;
 ContinueJumpTarget = JumpTarget(Succ, ContinueScopePos);
 
 // The starting block for the loop increment is the block that should
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21895: CFGBuilder: Fix crash when visiting a range-based for over a dependent type

2016-06-30 Thread Martin Böhme via cfe-commits
mboehme marked an inline comment as done.
mboehme added a comment.

http://reviews.llvm.org/D21895



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


[libcxx] r274241 - Implement LWG#2596: 'vector::data() should use addressof'

2016-06-30 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Thu Jun 30 10:50:55 2016
New Revision: 274241

URL: http://llvm.org/viewvc/llvm-project?rev=274241&view=rev
Log:
Implement LWG#2596: 'vector::data() should use addressof'

Modified:
libcxx/trunk/test/std/containers/sequences/vector/vector.data/data.pass.cpp

libcxx/trunk/test/std/containers/sequences/vector/vector.data/data_const.pass.cpp
libcxx/trunk/www/cxx1z_status.html

Modified: 
libcxx/trunk/test/std/containers/sequences/vector/vector.data/data.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/vector/vector.data/data.pass.cpp?rev=274241&r1=274240&r2=274241&view=diff
==
--- libcxx/trunk/test/std/containers/sequences/vector/vector.data/data.pass.cpp 
(original)
+++ libcxx/trunk/test/std/containers/sequences/vector/vector.data/data.pass.cpp 
Thu Jun 30 10:50:55 2016
@@ -17,6 +17,15 @@
 #include "min_allocator.h"
 #include "asan_testing.h"
 
+struct Nasty {
+   Nasty() : i_(0) {}
+   Nasty(int i) : i_(i) {}
+   ~Nasty() {}
+   
+   Nasty * operator&() const { assert(false); return nullptr; }
+   int i_;
+   };
+
 int main()
 {
 {
@@ -26,7 +35,12 @@ int main()
 }
 {
 std::vector v(100);
-assert(v.data() == &v.front());
+assert(v.data() == std::addressof(v.front()));
+assert(is_contiguous_container_asan_correct(v));
+}
+{
+std::vector v(100);
+assert(v.data() == std::addressof(v.front()));
 assert(is_contiguous_container_asan_correct(v));
 }
 #if TEST_STD_VER >= 11
@@ -37,7 +51,12 @@ int main()
 }
 {
 std::vector> v(100);
-assert(v.data() == &v.front());
+assert(v.data() == std::addressof(v.front()));
+assert(is_contiguous_container_asan_correct(v));
+}
+{
+std::vector> v(100);
+assert(v.data() == std::addressof(v.front()));
 assert(is_contiguous_container_asan_correct(v));
 }
 #endif

Modified: 
libcxx/trunk/test/std/containers/sequences/vector/vector.data/data_const.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/vector/vector.data/data_const.pass.cpp?rev=274241&r1=274240&r2=274241&view=diff
==
--- 
libcxx/trunk/test/std/containers/sequences/vector/vector.data/data_const.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/containers/sequences/vector/vector.data/data_const.pass.cpp
 Thu Jun 30 10:50:55 2016
@@ -17,6 +17,15 @@
 #include "min_allocator.h"
 #include "asan_testing.h"
 
+struct Nasty {
+   Nasty() : i_(0) {}
+   Nasty(int i) : i_(i) {}
+   ~Nasty() {}
+   
+   Nasty * operator&() const { assert(false); return nullptr; }
+   int i_;
+   };
+
 int main()
 {
 {
@@ -26,7 +35,12 @@ int main()
 }
 {
 const std::vector v(100);
-assert(v.data() == &v.front());
+assert(v.data() == std::addressof(v.front()));
+assert(is_contiguous_container_asan_correct(v));
+}
+{
+std::vector v(100);
+assert(v.data() == std::addressof(v.front()));
 assert(is_contiguous_container_asan_correct(v));
 }
 #if TEST_STD_VER >= 11
@@ -40,5 +54,10 @@ int main()
 assert(v.data() == &v.front());
 assert(is_contiguous_container_asan_correct(v));
 }
+{
+std::vector> v(100);
+assert(v.data() == std::addressof(v.front()));
+assert(is_contiguous_container_asan_correct(v));
+}
 #endif
 }

Modified: libcxx/trunk/www/cxx1z_status.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx1z_status.html?rev=274241&r1=274240&r2=274241&view=diff
==
--- libcxx/trunk/www/cxx1z_status.html (original)
+++ libcxx/trunk/www/cxx1z_status.html Thu Jun 30 10:50:55 2016
@@ -279,7 +279,7 @@
http://wg21.link/LWG2551";>2551[fund.ts.v2] "Exception 
safety" cleanup in library fundamentals requiredOulu
http://wg21.link/LWG2555";>2555[fund.ts.v2] No handling for 
over-aligned types in optionalOulu
http://wg21.link/LWG2573";>2573[fund.ts.v2] 
std::hash does not work for 
arraysOulu
-   http://wg21.link/LWG2596";>2596vector::data() should use 
addressofOulu
+   http://wg21.link/LWG2596";>2596vector::data() should use 
addressofOuluComplete
http://wg21.link/LWG2667";>2667path::root_directory() 
description is confusingOulu
http://wg21.link/LWG2669";>2669recursive_directory_iterator 
effects refers to non-existent functionsOulu
http://wg21.link/LWG2670";>2670system_complete refers to 
undefined variable 'base'Oulu


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


[libcxx] r274243 - Implement LWG#2684: 'priority_queue lacking comparator typedef'. We already did this, just added tests

2016-06-30 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Thu Jun 30 11:03:50 2016
New Revision: 274243

URL: http://llvm.org/viewvc/llvm-project?rev=274243&view=rev
Log:
Implement LWG#2684: 'priority_queue lacking comparator typedef'. We already did 
this, just added tests

Modified:

libcxx/trunk/test/std/containers/container.adaptors/priority.queue/types.pass.cpp
libcxx/trunk/www/cxx1z_status.html

Modified: 
libcxx/trunk/test/std/containers/container.adaptors/priority.queue/types.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/priority.queue/types.pass.cpp?rev=274243&r1=274242&r2=274243&view=diff
==
--- 
libcxx/trunk/test/std/containers/container.adaptors/priority.queue/types.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/containers/container.adaptors/priority.queue/types.pass.cpp
 Thu Jun 30 11:03:50 2016
@@ -15,6 +15,7 @@
 // {
 // public:
 // typedef Containercontainer_type;
+// typedef Compare  value_compare; // 
LWG#2684
 // typedef typename container_type::value_type  value_type;
 // typedef typename container_type::reference   reference;
 // typedef typename container_type::const_reference const_reference;
@@ -54,6 +55,9 @@ int main()
 static_assert(( std::is_same::reference, 
std::vector::reference>::value), "");
 static_assert(( std::is_same::const_reference, 
std::vector::const_reference>::value), "");
 static_assert(( std::is_same::size_type, 
std::vector::size_type>::value), "");
+static_assert(( std::is_same::value_compare, 
std::less >::value), "");
+static_assert(( std::is_same 
>::value_compare, std::less >::value), "");
+static_assert(( std::is_same, 
std::greater >::value_compare, std::greater >::value), "");
 static_assert(( std::uses_allocator, 
std::allocator >::value), "");
 static_assert((!std::uses_allocator, 
std::allocator >::value), "");
 test t;

Modified: libcxx/trunk/www/cxx1z_status.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx1z_status.html?rev=274243&r1=274242&r2=274243&view=diff
==
--- libcxx/trunk/www/cxx1z_status.html (original)
+++ libcxx/trunk/www/cxx1z_status.html Thu Jun 30 11:03:50 2016
@@ -287,7 +287,7 @@
http://wg21.link/LWG2673";>2673status() 
effects cannot be implemented as specifiedOulu
http://wg21.link/LWG2674";>2674Bidirectional iterator 
requirement on path::iterator is very 
expensiveOuluComplete
http://wg21.link/LWG2683";>2683filesystem::copy() says "no 
effects"Oulu
-   http://wg21.link/LWG2684";>2684priority_queue lacking 
comparator typedefOulu
+   http://wg21.link/LWG2684";>2684priority_queue lacking 
comparator typedefOuluComplete
http://wg21.link/LWG2685";>2685shared_ptr 
deleters must not throw on move constructionOulu
http://wg21.link/LWG2687";>2687{inclusive,exclusive}_scan 
misspecifiedOulu
http://wg21.link/LWG2688";>2688clamp 
misses preconditions and has extraneous condition on 
resultOulu


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


Re: [PATCH] D20249: [OpenCL] Hierarchical/dynamic parallelism - enqueue kernel in OpenCL 2.0

2016-06-30 Thread Anastasia Stulova via cfe-commits
Anastasia updated this revision to Diff 62376.
Anastasia added a comment.

- Fixed style issues
- Added warning diagnostics for conversions of integer types


http://reviews.llvm.org/D20249

Files:
  include/clang/AST/Type.h
  include/clang/Basic/Builtins.def
  include/clang/Basic/Builtins.h
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/Basic/Builtins.cpp
  lib/CodeGen/CGBuiltin.cpp
  lib/Headers/opencl-c.h
  lib/Sema/SemaChecking.cpp
  lib/Sema/SemaInit.cpp
  test/CodeGenOpenCL/cl20-device-side-enqueue.cl
  test/SemaOpenCL/cl20-device-side-enqueue.cl
  test/SemaOpenCL/clang-builtin-version.cl
  test/SemaOpenCL/to_addr_builtin.cl

Index: test/SemaOpenCL/to_addr_builtin.cl
===
--- test/SemaOpenCL/to_addr_builtin.cl
+++ test/SemaOpenCL/to_addr_builtin.cl
@@ -10,43 +10,44 @@
 
   glob = to_global(glob, loc);
 #if __OPENCL_C_VERSION__ < CL_VERSION_2_0
-  // expected-error@-2{{'to_global' requires OpenCL version 2.0 or above}}
+  // expected-warning@-2{{implicit declaration of function 'to_global' is invalid in C99}}
+  // expected-warning@-3{{incompatible integer to pointer conversion assigning to '__global int *' from 'int'}}
 #else
-  // expected-error@-4{{invalid number of arguments to function: 'to_global'}}
+  // expected-error@-5{{invalid number of arguments to function: 'to_global'}}
 #endif
 
   int x;
   glob = to_global(x);
 #if __OPENCL_C_VERSION__ < CL_VERSION_2_0
-  // expected-error@-2{{'to_global' requires OpenCL version 2.0 or above}}
+  // expected-warning@-2{{incompatible integer to pointer conversion assigning to '__global int *' from 'int'}}
 #else
   // expected-error@-4{{invalid argument x to function: 'to_global', expecting a generic pointer argument}}
 #endif
 
   glob = to_global(con);
 #if __OPENCL_C_VERSION__ < CL_VERSION_2_0
-  // expected-error@-2{{'to_global' requires OpenCL version 2.0 or above}}
+  // expected-warning@-2{{incompatible integer to pointer conversion assigning to '__global int *' from 'int'}}
 #else
   // expected-error@-4{{invalid argument con to function: 'to_global', expecting a generic pointer argument}}
 #endif
 
   glob = to_global(con_typedef);
 #if __OPENCL_C_VERSION__ < CL_VERSION_2_0
-  // expected-error@-2{{'to_global' requires OpenCL version 2.0 or above}}
+  // expected-warning@-2{{incompatible integer to pointer conversion assigning to '__global int *' from 'int'}}
 #else
   // expected-error@-4{{invalid argument con_typedef to function: 'to_global', expecting a generic pointer argument}}
 #endif
 
   loc = to_global(glob);
 #if __OPENCL_C_VERSION__ < CL_VERSION_2_0
-  // expected-error@-2{{'to_global' requires OpenCL version 2.0 or above}}
+  // expected-warning@-2{{incompatible integer to pointer conversion assigning to '__local int *' from 'int'}}
 #else
   // expected-error@-4{{assigning '__global int *' to '__local int *' changes address space of pointer}}
 #endif
 
   global char *glob_c = to_global(loc);
 #if __OPENCL_C_VERSION__ < CL_VERSION_2_0
-  // expected-error@-2{{'to_global' requires OpenCL version 2.0 or above}}
+  // expected-warning@-2{{incompatible integer to pointer conversion initializing '__global char *' with an expression of type 'int'}}
 #else
   // expected-warning@-4{{incompatible pointer types initializing '__global char *' with an expression of type '__global int *'}}
 #endif
Index: test/SemaOpenCL/clang-builtin-version.cl
===
--- /dev/null
+++ test/SemaOpenCL/clang-builtin-version.cl
@@ -0,0 +1,44 @@
+// RUN: %clang_cc1 %s -fblocks -verify -pedantic -fsyntax-only -ferror-limit 100
+
+// Confirm CL2.0 Clang builtins are not available in earlier versions
+
+kernel void dse_builtins() {
+  int tmp;
+  enqueue_kernel(tmp, tmp, tmp, ^(void) { // expected-warning{{implicit declaration of function 'enqueue_kernel' is invalid in C99}}
+return;
+  });
+  unsigned size = get_kernel_work_group_size(^(void) { // expected-warning{{implicit declaration of function 'get_kernel_work_group_size' is invalid in C99}}
+return;
+  });
+  size = get_kernel_preferred_work_group_size_multiple(^(void) { // expected-warning{{implicit declaration of function 'get_kernel_preferred_work_group_size_multiple' is invalid in C99}}
+return;
+  });
+}
+
+void pipe_builtins() {
+  int tmp;
+
+  read_pipe(tmp, tmp);  // expected-warning{{implicit declaration of function 'read_pipe' is invalid in C99}}
+  write_pipe(tmp, tmp); // expected-warning{{implicit declaration of function 'write_pipe' is invalid in C99}}
+
+  reserve_read_pipe(tmp, tmp);  // expected-warning{{implicit declaration of function 'reserve_read_pipe' is invalid in C99}}
+  reserve_write_pipe(tmp, tmp); // expected-warning{{implicit declaration of function 'reserve_write_pipe' is invalid in C99}}
+
+  work_group_reserve_read_pipe(tmp, tmp);  // expected-warning{{implicit declaration of function 'work_group_reserve_read_pipe' is invalid in C99}}
+  w

Re: [PATCH] D21803: [libcxxabi] Provide a fallback __cxa_thread_atexit() implementation

2016-06-30 Thread Dimitry Ivanov via cfe-commits
dimitry added inline comments.


Comment at: src/cxa_thread_atexit.cpp:46
@@ +45,3 @@
+  pthread_key_delete(key_);
+}
+

bcraig wrote:
> dimitry wrote:
> > run_dtors() is called when/if libc++.so gets unloaded... but only for the 
> > thread calling dlclose()?
> Most of the dtor magic is on the pthread_key_create side.  pthreads lets you 
> register a per-thread destructor.
> 
> This destructor is only run on process termination (I think).
I meant the call from ~DtorListHolder()


http://reviews.llvm.org/D21803



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


Re: [PATCH] D20249: [OpenCL] Hierarchical/dynamic parallelism - enqueue kernel in OpenCL 2.0

2016-06-30 Thread Anastasia Stulova via cfe-commits
Anastasia marked 12 inline comments as done.


Comment at: lib/CodeGen/CGBuiltin.cpp:2180-2181
@@ +2179,4 @@
+}
+// Could have events and/or vaargs.
+if (NumArgs >= 5) {
+  if (E->getArg(3)->getType()->isBlockPointerType()) {

bader wrote:
> [Style] Minor suggestion to consider.
> To avoid indentation of almost 100 lines of code inside if statement this can 
> be implemented as:
> if (NumArgs < 5) llvm_unreachable("Unhandled enqueue_kernel signature");
> 
> There is no else branch for that condition anyway.
Would assertion be more appropriate even?


Comment at: lib/Sema/SemaChecking.cpp:145
@@ +144,3 @@
+}
+// Potentially emit standard warnings for implicit conversions if enabled
+// using -Wconversion.

I am reusing C diagnostics functionality here now to keep consistency!


http://reviews.llvm.org/D20249



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


Re: [PATCH] D18286: [OPENMP] private and firstprivate clauses of teams code generation for nvptx

2016-06-30 Thread Jonas Hahnfeld via cfe-commits
Hahnfeld added a comment.

Hi Carlo,

I think these tests are not yet committed, right?

Thanks,
Jonas


Repository:
  rL LLVM

http://reviews.llvm.org/D18286



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


Re: [PATCH] D21867: [CUDA] Add utility functions for dealing with CUDA versions / architectures.

2016-06-30 Thread Artem Belevich via cfe-commits
tra accepted this revision.
tra added a comment.
This revision is now accepted and ready to land.

LGTM.



Comment at: lib/Basic/Cuda.cpp:8-19
@@ +7,14 @@
+
+const char *CudaVersionToString(CudaVersion V) {
+  switch (V) {
+  case CudaVersion::UNKNOWN:
+return "unknown";
+  case CudaVersion::CUDA_70:
+return "7.0";
+  case CudaVersion::CUDA_75:
+return "7.5";
+  case CudaVersion::CUDA_80:
+return "8.0";
+  }
+}
+

We seem to do a lot of enum->string and string->enum mapping in this file. 
Is there something comparable to Boost.bimap in standard c++ library or in LLVM?



Comment at: lib/Driver/Driver.cpp:1026-1028
@@ -1024,4 +1025,5 @@
   } else if (CudaDeviceAction *CDA = dyn_cast(A)) {
-os << '"'
-   << (CDA->getGpuArchName() ? CDA->getGpuArchName() : "(multiple archs)")
+os << '"' << (CDA->getGpuArch() != CudaArch::UNKNOWN
+  ? CudaArchToString(CDA->getGpuArch())
+  : "(multiple archs)")
<< '"' << ", {" << PrintActions1(C, *CDA->input_begin(), Ids) << "}";

I think this could be collapsed to just CudaArchToString(CDA->getGpuArch()).
"(multiple archs)" is as informative as (and indistinguishable from) "unknown" 
here.




http://reviews.llvm.org/D21867



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


Re: [PATCH] D21678: Fix For pr28288 - Error message in shift of vector values

2016-06-30 Thread Anastasia Stulova via cfe-commits
Anastasia added a subscriber: Anastasia.


Comment at: llvm/tools/clang/lib/Sema/SemaExpr.cpp:8595
@@ -8594,3 +8594,3 @@
 
-/// \brief Return the resulting type when an OpenCL vector is shifted
+/// \brief Return the resulting type when an vector is shifted
 ///by a scalar or vector shift amount.

an vector -> a vector


Comment at: llvm/tools/clang/lib/Sema/SemaExpr.cpp:8675
@@ -8678,3 +8674,3 @@
   return InvalidOperands(Loc, LHS, RHS);
-  return checkOpenCLVectorShift(*this, LHS, RHS, Loc, IsCompAssign);
+  return checkVectorShift(*this, LHS, RHS, Loc, IsCompAssign);
 }

it seems like you don't need this statement as the next one is exactly the same!


http://reviews.llvm.org/D21678



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


Re: [PATCH] D21753: Comprehensive Static Instrumentation (2/2): Clang flag

2016-06-30 Thread Derek Bruening via cfe-commits
bruening added inline comments.


Comment at: docs/CSI.rst:75
@@ +74,3 @@
+  % clang++ -c -O3 -g -fcsi -emit-llvm bar.cpp -o bar.o
+  % clang++ foo.o bar.o my-tool.o libclang_rt.csi-x86_64.a -fuse-ld=gold -flto 
-lrt -ldl -o foo
+

See below: the sanitizers pass the -f flag (-fcsi here) to the link line and 
have the library automatically linked in, which is a simpler usage model than 
the user having to name this static library explicitly.


Comment at: docs/CSI.rst:78
@@ +77,3 @@
+Notice that in the final stage of linking, the tool user also needs to link in
+the static library of the CSI runtime to produce the final TIX.  The runtime
+archive is distributed under the ``build/lib/clang//lib/``

This should not be necessary: as mentioned above, if -fcsi is passed to the 
link line you should be able to have clang automatically add the static csi 
library, just like is done for the sanitizers.


Comment at: docs/CSI.rst:81
@@ +80,3 @@
+directory. We plan to investigate means of linking with the runtime
+automatically in the future, but for the time being, the tool user should link
+it in explicitly.

Hmm, see above comments: is this already implemented and was deliberately split 
from this one for simplicity?


Comment at: docs/CSI.rst:97
@@ +96,3 @@
+* functions,
+* function exits,
+* basic blocks,

Wouldn't the after-hook here be the same as the after-hook for the function 
category?  Generally the reason to have a post-function or function-exit hook 
would be to view or change the return value: couldn't that be done equally 
easily from a post-function hook at the instruction after the call site?  I 
guess I'm asking why this is a separate category.


Comment at: docs/CSI.rst:99
@@ +98,3 @@
+* basic blocks,
+* call sites,
+* loads, and

It seems like there is some redundancy here?  This seems very similar to the 
"functions" category: I'm curious as to why they are separate?


Comment at: docs/CSI.rst:164
@@ +163,3 @@
+library loads.
+
+

Some tools also need thread-local handling: do you plan to provide thread 
initialization and exit hooks in the future?


Comment at: docs/CSI.rst:164
@@ +163,3 @@
+library loads.
+
+

bruening wrote:
> Some tools also need thread-local handling: do you plan to provide thread 
> initialization and exit hooks in the future?
What about a fini or destructor function called at program exit?  Many 
profiling or analysis tools gather data and want to report it or dump it to a 
file at program exit.


Comment at: docs/CSI.rst:173
@@ +172,3 @@
+
+  void __csi_func_entry(const csi_id_t func_id);
+  void __csi_func_exit(const csi_id_t func_exit_id, const csi_id_t func_id);

Generally, tools that hook application functions want to examine the arguments. 
 How does a hook access (or modify) the application function's arguments?


Comment at: docs/CSI.rst:174
@@ +173,3 @@
+  void __csi_func_entry(const csi_id_t func_id);
+  void __csi_func_exit(const csi_id_t func_exit_id, const csi_id_t func_id);
+

Similarly, how does a hook access or change the return value?


Comment at: docs/CSI.rst:181
@@ +180,3 @@
+hook ``__csi_func_exit`` is invoked just before the function returns
+normally).  (We have not yet defined the API for exceptions.)
+The ``func_exit_id`` parameter allows the tool writer to distinguish the

s/normally)/normally/


Comment at: docs/CSI.rst:189
@@ +188,3 @@
+
+CSI also provide instrumentation hooks basic block entry and exit.
+A basic block consists of strands of instructions with no incoming branches

Grammar: provides, for


Comment at: docs/CSI.rst:212
@@ +211,3 @@
+
+CSI provides the following hooks for call sites:
+

See above: I'm not sure why both call sites and function entry hooks are 
needed?  Perhaps there could be some explanation of that here.


Comment at: docs/CSI.rst:221
@@ +220,3 @@
+parameter identifies the called function.  Note that it may not always be
+possible to CSI to produce the function ID corresponds to the called function
+statically --- for example, if a function is called indirectly

Grammar: s/to CSI/for CSI/; s/ID/ID that/


Comment at: docs/CSI.rst:258
@@ +257,3 @@
+plan to extend the CSI to include more property values and incorporate property
+into other types of hooks.
+

Hmm, there seems to be a missing feature in this interface design in general: 
static analysis or static operation of some kind.  Tools often want to take one 
action if a memory address is aligned, but a different one if it's not aligned 
(usually a fastpath when aligned and a slowpath when unaligned).  The compiler 
ofte

Re: [PATCH] D21706: [libcxx] refactor for throw or assert

2016-06-30 Thread Weiming Zhao via cfe-commits
weimingz added a comment.

In http://reviews.llvm.org/D21706#471091, @EricWF wrote:

> Please make the changes in the above comment.


Sure. I'm working on it. Just got interrupted/distracted by other tasks time to 
time. :(


http://reviews.llvm.org/D21706



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


r274245 - Port some more debug info tests on Windows

2016-06-30 Thread Reid Kleckner via cfe-commits
Author: rnk
Date: Thu Jun 30 12:41:27 2016
New Revision: 274245

URL: http://llvm.org/viewvc/llvm-project?rev=274245&view=rev
Log:
Port some more debug info tests on Windows

Modified:
cfe/trunk/test/CodeGenCXX/debug-info-line.cpp
cfe/trunk/test/CodeGenCXX/debug-info-namespace.cpp
cfe/trunk/test/lit.cfg

Modified: cfe/trunk/test/CodeGenCXX/debug-info-line.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-line.cpp?rev=274245&r1=274244&r2=274245&view=diff
==
--- cfe/trunk/test/CodeGenCXX/debug-info-line.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-line.cpp Thu Jun 30 12:41:27 2016
@@ -1,8 +1,6 @@
-// RUN: %clang_cc1 -w -debug-info-kind=line-tables-only -std=c++11 
-fexceptions -fcxx-exceptions -S -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -w -debug-info-kind=line-tables-only -std=c++11 
-fexceptions -fcxx-exceptions -S -emit-llvm %s -o - -triple %itanium_abi_triple 
| FileCheck %s
 // RUN: %clang_cc1 -w -debug-info-kind=line-tables-only -std=c++11 
-fexceptions -fcxx-exceptions -S -emit-llvm %s -o - -triple i686-linux-gnu | 
FileCheck %s
 
-// XFAIL: win32
-
 int &src();
 int *sink();
 extern "C" __complex float complex_src();

Modified: cfe/trunk/test/CodeGenCXX/debug-info-namespace.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-namespace.cpp?rev=274245&r1=274244&r2=274245&view=diff
==
--- cfe/trunk/test/CodeGenCXX/debug-info-namespace.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-namespace.cpp Thu Jun 30 12:41:27 2016
@@ -95,7 +95,7 @@ void B::func_fwd() {}
 // CHECK: [[M11]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, name: 
"X", scope: [[FUNC]], entity: [[CTXT]]
 // CHECK: [[M12]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, name: 
"Y", scope: [[FUNC]], entity: [[M11]]
 // CHECK: [[M13]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: 
[[FUNC]], entity: [[VAR_DECL:![0-9]+]]
-// CHECK: [[VAR_DECL]] = !DIGlobalVariable(name: "var_decl", linkageName: 
"_ZN1A1B8var_declE", scope: [[NS]],{{.*}} line: 8,
+// CHECK: [[VAR_DECL]] = !DIGlobalVariable(name: "var_decl", linkageName: 
"{{[^"]*var_decl[^"]*}}", scope: [[NS]],{{.*}} line: 8,
 // CHECK: [[M14]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: 
[[FUNC]], entity: [[FUNC_DECL:![0-9]+]]
 // CHECK: [[FUNC_DECL]] = !DISubprogram(name: "func_decl",
 // CHECK-SAME:  scope: [[NS]], file: [[FOOCPP]], line: 
9
@@ -111,5 +111,3 @@ void B::func_fwd() {}
 // CHECK-NOLIMIT: !DICompositeType(tag: DW_TAG_structure_type, name: 
"bar",{{.*}} line: 6,
 // CHECK-NOLIMIT-NOT:  DIFlagFwdDecl
 // CHECK-NOLIMIT-SAME: ){{$}}
-
-// REQUIRES: dw2

Modified: cfe/trunk/test/lit.cfg
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/lit.cfg?rev=274245&r1=274244&r2=274245&view=diff
==
--- cfe/trunk/test/lit.cfg (original)
+++ cfe/trunk/test/lit.cfg Thu Jun 30 12:41:27 2016
@@ -397,10 +397,6 @@ if is_filesystem_case_insensitive():
 if os.path.exists("/dev/fd/0") and sys.platform not in ['cygwin']:
 config.available_features.add('dev-fd-fs')
 
-# DW2 Target
-if not re.match(r'.*-win32$', config.target_triple):
-config.available_features.add('dw2')
-
 # Not set on native MS environment.
 if not re.match(r'.*-win32$', config.target_triple):
 config.available_features.add('non-ms-sdk')


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


Re: [PATCH] D21810: Don't instantiate a full host toolchain in ASTMatchersTest.

2016-06-30 Thread Justin Lebar via cfe-commits
jlebar added a comment.

> But I think this is a reasonable workaround until such an API can be provided.


Should I take that as an LG, or are we waiting for someone else to approve this?


http://reviews.llvm.org/D21810



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


r274246 - [codeview] Emit qualified display names if -gline-tables-only is on

2016-06-30 Thread Reid Kleckner via cfe-commits
Author: rnk
Date: Thu Jun 30 12:41:31 2016
New Revision: 274246

URL: http://llvm.org/viewvc/llvm-project?rev=274246&view=rev
Log:
[codeview] Emit qualified display names if -gline-tables-only is on

When -gmlt is on, we don't emit namespace or class scope information,
and the CodeView emission code in LLVM can't compute the fully qualified
name. If we know LLVM won't be able to get the name right, go ahead and
emit the qualified name in the frontend.

We could change our -gmlt emission strategy to include those scopes when
emitting codeview, but that would increase memory usage and slow down
LTO and add more complexity to debug info emission.

The same problem exists when you debug a -gmlt binary with GDB, so we
should consider removing '&& EmitCodeView' from the condition here at
some point in the future after evaluating the impact on object file
size.

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

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=274246&r1=274245&r2=274246&view=diff
==
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Thu Jun 30 12:41:31 2016
@@ -185,17 +185,27 @@ StringRef CGDebugInfo::getFunctionName(c
   FunctionTemplateSpecializationInfo *Info =
   FD->getTemplateSpecializationInfo();
 
-  if (!Info && FII)
+  // Emit the unqualified name in normal operation. LLVM and the debugger can
+  // compute the fully qualified name from the scope chain. If we're only
+  // emitting line table info, there won't be any scope chains, so emit the
+  // fully qualified name here so that stack traces are more accurate.
+  // FIXME: Do this when emitting DWARF as well as when emitting CodeView after
+  // evaluating the size impact.
+  bool UseQualifiedName = DebugKind == codegenoptions::DebugLineTablesOnly &&
+  CGM.getCodeGenOpts().EmitCodeView;
+
+  if (!Info && FII && !UseQualifiedName)
 return FII->getName();
 
-  // Otherwise construct human readable name for debug info.
   SmallString<128> NS;
   llvm::raw_svector_ostream OS(NS);
   PrintingPolicy Policy(CGM.getLangOpts());
   Policy.MSVCFormatting = CGM.getCodeGenOpts().EmitCodeView;
+  if (!UseQualifiedName)
+FD->printName(OS);
+  else
+FD->printQualifiedName(OS, Policy);
 
-  // Print the unqualified name with some template arguments.
-  FD->printName(OS);
   // Add any template specialization args.
   if (Info) {
 const TemplateArgumentList *TArgs = Info->TemplateArguments;

Modified: cfe/trunk/test/CodeGenCXX/debug-info-codeview-display-name.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-codeview-display-name.cpp?rev=274246&r1=274245&r2=274246&view=diff
==
--- cfe/trunk/test/CodeGenCXX/debug-info-codeview-display-name.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-codeview-display-name.cpp Thu Jun 30 
12:41:31 2016
@@ -1,14 +1,22 @@
-// RUN: %clang_cc1 -fblocks -debug-info-kind=limited -gcodeview -emit-llvm %s 
-o - -triple=x86_64-pc-win32 -std=c++98 | \
-// RUN:  grep 'DISubprogram' | sed -e 's/.*name: "\([^"]*\)".*/"\1"/' | 
FileCheck %s
+// RUN: %clang_cc1 -fblocks -debug-info-kind=limited -gcodeview -emit-llvm %s \
+// RUN:   -o - -triple=x86_64-pc-win32 -std=c++98 | \
+// RUN:grep 'DISubprogram' | sed -e 's/.*name: "\([^"]*\)".*/"\1"/' | \
+// RUN:FileCheck %s --check-prefix=CHECK --check-prefix=UNQUAL
+// RUN: %clang_cc1 -fblocks -debug-info-kind=line-tables-only -gcodeview 
-emit-llvm %s \
+// RUN:   -o - -triple=x86_64-pc-win32 -std=c++98 | \
+// RUN:grep 'DISubprogram' | sed -e 's/.*name: "\([^"]*\)".*/"\1"/' | \
+// RUN:FileCheck %s --check-prefix=CHECK --check-prefix=QUAL
 
 void freefunc() { }
 // CHECK-DAG: "freefunc"
 
 namespace N {
   int b() { return 0; }
-// CHECK-DAG: "b"
+// UNQUAL-DAG: "b"
+// QUAL-DAG: "N::b"
   namespace { void func() { } }
-// CHECK-DAG: "func"
+// UNQUAL-DAG: "func"
+// QUAL-DAG: "N::`anonymous namespace'::func"
 }
 
 void _c(void) {
@@ -19,19 +27,24 @@ void _c(void) {
 struct foo {
   int operator+(int);
   foo(){}
-// CHECK-DAG: "foo"
+// UNQUAL-DAG: "foo"
+// QUAL-DAG: "foo::foo"
 
   ~foo(){}
-// CHECK-DAG: "~foo"
+// UNQUAL-DAG: "~foo"
+// QUAL-DAG: "foo::~foo"
 
   foo(int i){}
-// CHECK-DAG: "foo"
+// UNQUAL-DAG: "foo"
+// QUAL-DAG: "foo::foo"
 
   foo(char *q){}
-// CHECK-DAG: "foo"
+// UNQUAL-DAG: "foo"
+// QUAL-DAG: "foo::foo"
 
   static foo* static_method() { return 0; }
-// CHECK-DAG: "static_method"
+// UNQUAL-DAG: "static_method"
+// QUAL-DAG: "foo::static_method"
 
 };
 
@@ -40,7 +53,8 @@ void use_foo() {
   foo::static_method();
 }
 
-// CHECK-DAG: "operator+"
+// UNQUAL-DAG: "operator+"
+// QUAL-DAG: "foo::operator+"
 in

Re: [PATCH] D21603: [include-fixer] Add missing namespace qualifiers after inserting a missing header.

2016-06-30 Thread Haojian Wu via cfe-commits
hokein added inline comments.


Comment at: include-fixer/IncludeFixer.cpp:234
@@ +233,3 @@
+  std::string MinimizedFilePath = minimizeInclude(
+  ((FilePath[0] == '"' || FilePath[0] == '<') ? FilePath
+  : "\"" + FilePath + 
"\""),

djasper wrote:
> How is this change related?
We need to check whether the `FilePath` contains `"` here because the 
`FilePath` in symbol indexer doesn't contains `<`, but for standard headers, it 
contains "<".


Comment at: include-fixer/tool/ClangIncludeFixer.cpp:88
@@ -86,1 +87,3 @@
 
+cl::opt FixNamespace("fix-namespace",
+   cl::desc("Add missing namespace prefix to the "

djasper wrote:
> Do we really want this? Should we just always do it? Who is going to use this 
> flag?
> 
> If we want it, maybe call it "fix-namespace-qualifiers"? This renaming might 
> also make sense of the patch itself, the test case, ...
I don't have many ideas about this, but I'd like to add this option at the 
moment, so that user can enable/disable this feature freely. If we want, we 
could remove it in the future.


http://reviews.llvm.org/D21603



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


[libcxx] r274252 - Implement LWG#2688: 'clamp misses preconditions and has extraneous condition on result'. We already did this, just added tests

2016-06-30 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Thu Jun 30 12:52:51 2016
New Revision: 274252

URL: http://llvm.org/viewvc/llvm-project?rev=274252&view=rev
Log:
Implement LWG#2688: 'clamp misses preconditions and has extraneous condition on 
result'. We already did this, just added tests

Modified:
libcxx/trunk/test/std/algorithms/alg.sorting/alg.clamp/clamp.comp.pass.cpp
libcxx/trunk/test/std/algorithms/alg.sorting/alg.clamp/clamp.pass.cpp
libcxx/trunk/www/cxx1z_status.html

Modified: 
libcxx/trunk/test/std/algorithms/alg.sorting/alg.clamp/clamp.comp.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.clamp/clamp.comp.pass.cpp?rev=274252&r1=274251&r2=274252&view=diff
==
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.clamp/clamp.comp.pass.cpp 
(original)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.clamp/clamp.comp.pass.cpp 
Thu Jun 30 12:52:51 2016
@@ -18,6 +18,20 @@
 #include 
 #include 
 
+struct Tag {
+Tag() : val(0), tag("Default") {}
+Tag(int a, const char *b) : val(a), tag(b) {}
+~Tag() {}
+
+int val;
+const char *tag;
+};
+
+bool eq(const Tag& rhs, const Tag& lhs) { return rhs.val == lhs.val && rhs.tag 
== lhs.tag; }
+// bool operator==(const Tag& rhs, const Tag& lhs) { return rhs.val == 
lhs.val; }
+bool comp (const Tag& rhs, const Tag& lhs) { return rhs.val <  lhs.val; }
+
+
 template 
 void
 test(const T& v, const T& lo, const T& hi, C c, const T& x)
@@ -48,7 +62,60 @@ int main()
 test(x, y, z, std::greater(), y);
 test(y, x, z, std::greater(), y);
 }
-#if _LIBCPP_STD_VER > 11
+
+{
+//  If they're all the same, we should get the value back.
+Tag x{0, "Zero-x"};
+Tag y{0, "Zero-y"};
+Tag z{0, "Zero-z"};
+assert(eq(std::clamp(x, y, z, comp), x));
+assert(eq(std::clamp(y, x, z, comp), y));
+}
+
+{
+//  If it's the same as the lower bound, we get the value back.
+Tag x{0, "Zero-x"};
+Tag y{0, "Zero-y"};
+Tag z{1, "One-z"};
+assert(eq(std::clamp(x, y, z, comp), x));
+assert(eq(std::clamp(y, x, z, comp), y));
+}
+
+{
+//  If it's the same as the upper bound, we get the value back.
+Tag x{1, "One-x"};
+Tag y{0, "Zero-y"};
+Tag z{1, "One-z"};
+assert(eq(std::clamp(x, y, z, comp), x));
+assert(eq(std::clamp(z, y, x, comp), z));
+}
+
+{
+//  If the value is between, we should get the value back
+Tag x{1, "One-x"};
+Tag y{0, "Zero-y"};
+Tag z{2, "Two-z"};
+assert(eq(std::clamp(x, y, z, comp), x));
+assert(eq(std::clamp(y, x, z, comp), x));
+}
+
+{
+//  If the value is less than the 'lo', we should get the lo back.
+Tag x{0, "Zero-x"};
+Tag y{1, "One-y"};
+Tag z{2, "Two-z"};
+assert(eq(std::clamp(x, y, z, comp), y));
+assert(eq(std::clamp(y, x, z, comp), y));
+}
+{
+//  If the value is greater than 'hi', we should get hi back.
+Tag x{2, "Two-x"};
+Tag y{0, "Zero-y"};
+Tag z{1, "One-z"};
+assert(eq(std::clamp(x, y, z, comp), z));
+assert(eq(std::clamp(y, z, x, comp), z));
+}
+
 {
 typedef int T;
 constexpr T x = 1;
@@ -57,5 +124,4 @@ int main()
 static_assert(std::clamp(x, y, z, std::greater()) == y, "" );
 static_assert(std::clamp(y, x, z, std::greater()) == y, "" );
 }
-#endif
 }

Modified: libcxx/trunk/test/std/algorithms/alg.sorting/alg.clamp/clamp.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.clamp/clamp.pass.cpp?rev=274252&r1=274251&r2=274252&view=diff
==
--- libcxx/trunk/test/std/algorithms/alg.sorting/alg.clamp/clamp.pass.cpp 
(original)
+++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.clamp/clamp.pass.cpp Thu 
Jun 30 12:52:51 2016
@@ -17,6 +17,19 @@
 #include 
 #include 
 
+struct Tag {
+   Tag() : val(0), tag("Default") {}
+   Tag(int a, const char *b) : val(a), tag(b) {}
+   ~Tag() {}
+   
+   int val;
+   const char *tag;
+   };
+   
+bool eq(const Tag& rhs, const Tag& lhs) { return rhs.val == lhs.val && rhs.tag 
== lhs.tag; }
+// bool operator==(const Tag& rhs, const Tag& lhs) { return rhs.val == 
lhs.val; }
+bool operator< (const Tag& rhs, const Tag& lhs) { return rhs.val <  lhs.val; }
+
 template 
 void
 test(const T& a, const T& lo, const T& hi, const T& x)
@@ -47,7 +60,60 @@ int main()
 test(x, y, z, x);
 test(y, x, z, x);
 }
-#if _LIBCPP_STD_VER > 11
+
+{
+//  If they're all the same, we should get the value back.
+Tag x{0, "Zero-x"};
+Tag y{0, "Zero-y"};
+Tag z{0, "Zero-z"};
+assert(eq(std::clamp(x, y, z), x));
+assert(eq(std::clamp(y, x, z), y));
+}
+
+{
+//  If it's the same as the lower bound, we get the value back.
+Tag x{0, "Zero-x"};
+Tag y{0, "Zero-y"};
+Tag z{1, "One-z"};
+assert(eq(std::clamp(

Re: [PATCH] D21603: [include-fixer] Add missing namespace qualifiers after inserting a missing header.

2016-06-30 Thread Haojian Wu via cfe-commits
hokein updated this revision to Diff 62383.
hokein marked 4 inline comments as done.
hokein added a comment.

Address review comments.


http://reviews.llvm.org/D21603

Files:
  include-fixer/IncludeFixer.cpp
  include-fixer/IncludeFixerContext.h
  include-fixer/SymbolIndexManager.cpp
  include-fixer/SymbolIndexManager.h
  include-fixer/find-all-symbols/SymbolInfo.cpp
  include-fixer/find-all-symbols/SymbolInfo.h
  include-fixer/tool/ClangIncludeFixer.cpp
  unittests/include-fixer/IncludeFixerTest.cpp

Index: unittests/include-fixer/IncludeFixerTest.cpp
===
--- unittests/include-fixer/IncludeFixerTest.cpp
+++ unittests/include-fixer/IncludeFixerTest.cpp
@@ -50,7 +50,7 @@
 }
 
 static std::string runIncludeFixer(
-StringRef Code,
+StringRef Code, bool FixNamespaceQualifiers = false,
 const std::vector &ExtraArgs = std::vector()) {
   std::vector Symbols = {
   SymbolInfo("string", SymbolInfo::SymbolKind::Class, "", 1,
@@ -82,14 +82,17 @@
   IncludeFixerContext FixerContext;
   IncludeFixerActionFactory Factory(*SymbolIndexMgr, FixerContext, "llvm");
 
-  runOnCode(&Factory, Code, "input.cc", ExtraArgs);
-  if (FixerContext.Headers.empty())
+  std::string FakeFileName = "input.cc";
+  runOnCode(&Factory, Code, FakeFileName, ExtraArgs);
+  if (FixerContext.getMatchedSymbols().empty())
 return Code;
   tooling::Replacements Replacements =
   clang::include_fixer::createInsertHeaderReplacements(
-  Code, "input.cc", FixerContext.Headers.front());
+  Code, FakeFileName, FixerContext.getHeaders().front());
   clang::RewriterTestContext Context;
-  clang::FileID ID = Context.createInMemoryFile("input.cc", Code);
+  clang::FileID ID = Context.createInMemoryFile(FakeFileName, Code);
+  if (FixNamespaceQualifiers && FixerContext.getSymbolRange().getLength() > 0)
+Replacements.insert(FixerContext.createSymbolReplacement(FakeFileName, 0));
   clang::tooling::applyAllReplacements(Replacements, Context.Rewrite);
   return Context.getRewrittenText(ID);
 }
@@ -137,19 +140,23 @@
 TEST(IncludeFixer, MinimizeInclude) {
   std::vector IncludePath = {"-Idir/"};
   EXPECT_EQ("#include \"otherdir/qux.h\"\na::b::foo bar;\n",
-runIncludeFixer("a::b::foo bar;\n", IncludePath));
+runIncludeFixer("a::b::foo bar;\n",
+/*FixNamespaceQualifiers=*/false, IncludePath));
 
   IncludePath = {"-isystemdir"};
   EXPECT_EQ("#include \na::b::foo bar;\n",
-runIncludeFixer("a::b::foo bar;\n", IncludePath));
+runIncludeFixer("a::b::foo bar;\n",
+/*FixNamespaceQualifiers=*/false, IncludePath));
 
   IncludePath = {"-iquotedir"};
   EXPECT_EQ("#include \"otherdir/qux.h\"\na::b::foo bar;\n",
-runIncludeFixer("a::b::foo bar;\n", IncludePath));
+runIncludeFixer("a::b::foo bar;\n",
+/*FixNamespaceQualifiers=*/false, IncludePath));
 
   IncludePath = {"-Idir", "-Idir/otherdir"};
   EXPECT_EQ("#include \"qux.h\"\na::b::foo bar;\n",
-runIncludeFixer("a::b::foo bar;\n", IncludePath));
+runIncludeFixer("a::b::foo bar;\n",
+/*FixNamespaceQualifiers=*/false, IncludePath));
 }
 
 TEST(IncludeFixer, NestedName) {
@@ -221,6 +228,44 @@
 runIncludeFixer("a::Vector v;"));
 }
 
+TEST(IncludeFixer, FixNamespaceQualifiers) {
+  EXPECT_EQ("#include \"bar.h\"\na::b::bar b;\n",
+runIncludeFixer("b::bar b;\n", /*FixNamespaceQualifiers=*/true));
+  EXPECT_EQ("#include \"bar.h\"\na::b::bar b;\n",
+runIncludeFixer("a::b::bar b;\n", /*FixNamespaceQualifiers=*/true));
+  EXPECT_EQ("#include \"bar.h\"\na::b::bar b;\n",
+runIncludeFixer("bar b;\n", /*FixNamespaceQualifiers=*/true));
+  EXPECT_EQ("#include \"bar.h\"\nnamespace a {\nb::bar b;\n}\n",
+runIncludeFixer("namespace a {\nb::bar b;\n}\n",
+/*FixNamespaceQualifiers==*/true));
+  EXPECT_EQ("#include \"bar.h\"\nnamespace a {\nb::bar b;\n}\n",
+runIncludeFixer("namespace a {\nbar b;\n}\n",
+/*FixNamespaceQualifiers==*/true));
+  EXPECT_EQ("#include \"bar.h\"\nnamespace a {\nnamespace b{\nbar b;\n}\n}\n",
+runIncludeFixer("namespace a {\nnamespace b{\nbar b;\n}\n}\n",
+/*FixNamespaceQualifiers==*/true));
+  EXPECT_EQ("c::b::bar b;\n",
+runIncludeFixer("c::b::bar b;\n", /*FixNamespaceQualifiers=*/true));
+  EXPECT_EQ("#include \"bar.h\"\nnamespace c {\na::b::bar b;\n}\n",
+runIncludeFixer("namespace c {\nbar b;\n}\n",
+/*FixNamespaceQualifiers=*/true));
+
+  EXPECT_EQ(
+  "#include \"color.h\"\nint test = a::b::Green;\n",
+  runIncludeFixer("int test = Green;\n", /*FixNamespaceQualifiers=*/true));
+  EXPECT_EQ("#include \"color.h\"\nnamespace d {\nint test = a::b::Green;\n}\n",
+runI

[libcxx] r274250 - Temporarily XFAIL the incomplete type tests for GCC while I figure out why adding a static_assert in r274235 broken them

2016-06-30 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Thu Jun 30 12:49:36 2016
New Revision: 274250

URL: http://llvm.org/viewvc/llvm-project?rev=274250&view=rev
Log:
Temporarily XFAIL the incomplete type tests for GCC while I figure out why 
adding a static_assert in r274235 broken them

Modified:
libcxx/trunk/test/std/containers/associative/map/incomplete_type.pass.cpp

libcxx/trunk/test/std/containers/associative/map/map.cons/default_recursive.pass.cpp

libcxx/trunk/test/std/containers/associative/multimap/incomplete_type.pass.cpp

libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/default_recursive.pass.cpp
libcxx/trunk/test/std/containers/unord/unord.map/incomplete_type.pass.cpp
libcxx/trunk/test/std/containers/unord/unord.multimap/incomplete.pass.cpp

Modified: 
libcxx/trunk/test/std/containers/associative/map/incomplete_type.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/incomplete_type.pass.cpp?rev=274250&r1=274249&r2=274250&view=diff
==
--- libcxx/trunk/test/std/containers/associative/map/incomplete_type.pass.cpp 
(original)
+++ libcxx/trunk/test/std/containers/associative/map/incomplete_type.pass.cpp 
Thu Jun 30 12:49:36 2016
@@ -12,6 +12,8 @@
 // Check that std::map and it's iterators can be instantiated with an 
incomplete
 // type.
 
+// XFAIL: gcc
+
 #include 
 
 struct A {

Modified: 
libcxx/trunk/test/std/containers/associative/map/map.cons/default_recursive.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/map.cons/default_recursive.pass.cpp?rev=274250&r1=274249&r2=274250&view=diff
==
--- 
libcxx/trunk/test/std/containers/associative/map/map.cons/default_recursive.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/containers/associative/map/map.cons/default_recursive.pass.cpp
 Thu Jun 30 12:49:36 2016
@@ -13,6 +13,8 @@
 
 // map();
 
+// XFAIL: gcc
+
 #include 
 
 struct X

Modified: 
libcxx/trunk/test/std/containers/associative/multimap/incomplete_type.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multimap/incomplete_type.pass.cpp?rev=274250&r1=274249&r2=274250&view=diff
==
--- 
libcxx/trunk/test/std/containers/associative/multimap/incomplete_type.pass.cpp 
(original)
+++ 
libcxx/trunk/test/std/containers/associative/multimap/incomplete_type.pass.cpp 
Thu Jun 30 12:49:36 2016
@@ -12,6 +12,8 @@
 // Check that std::multimap and it's iterators can be instantiated with an 
incomplete
 // type.
 
+// XFAIL: gcc
+
 #include 
 
 struct A {

Modified: 
libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/default_recursive.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/default_recursive.pass.cpp?rev=274250&r1=274249&r2=274250&view=diff
==
--- 
libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/default_recursive.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/default_recursive.pass.cpp
 Thu Jun 30 12:49:36 2016
@@ -13,6 +13,8 @@
 
 // multimap();
 
+// XFAIL: gcc
+
 #include 
 
 struct X

Modified: 
libcxx/trunk/test/std/containers/unord/unord.map/incomplete_type.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/unord/unord.map/incomplete_type.pass.cpp?rev=274250&r1=274249&r2=274250&view=diff
==
--- libcxx/trunk/test/std/containers/unord/unord.map/incomplete_type.pass.cpp 
(original)
+++ libcxx/trunk/test/std/containers/unord/unord.map/incomplete_type.pass.cpp 
Thu Jun 30 12:49:36 2016
@@ -13,6 +13,8 @@
 // Check that std::unordered_map and it's iterators can be instantiated with 
an incomplete
 // type.
 
+// XFAIL: gcc
+
 #include 
 
 template 

Modified: 
libcxx/trunk/test/std/containers/unord/unord.multimap/incomplete.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/unord/unord.multimap/incomplete.pass.cpp?rev=274250&r1=274249&r2=274250&view=diff
==
--- libcxx/trunk/test/std/containers/unord/unord.multimap/incomplete.pass.cpp 
(original)
+++ libcxx/trunk/test/std/containers/unord/unord.multimap/incomplete.pass.cpp 
Thu Jun 30 12:49:36 2016
@@ -13,6 +13,8 @@
 // Check that std::unordered_multimap and it's iterators can be instantiated 
with an incomplete
 // type.
 
+// XFAIL: gcc
+
 #include 
 
 template 


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


Re: r274246 - [codeview] Emit qualified display names if -gline-tables-only is on

2016-06-30 Thread Reid Kleckner via cfe-commits
David and Paul,

Do you think I should enable this behavior for DWARF as well? We only emit
a DW_TAG_subprogram when a function is inlined or contains inlined
functions, which might not be that many. IIRC Paul did something similar
with DW_AT_linkage_name, and the object file size cost wasn't that bad.

Reid

On Thu, Jun 30, 2016 at 10:41 AM, Reid Kleckner via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: rnk
> Date: Thu Jun 30 12:41:31 2016
> New Revision: 274246
>
> URL: http://llvm.org/viewvc/llvm-project?rev=274246&view=rev
> Log:
> [codeview] Emit qualified display names if -gline-tables-only is on
>
> When -gmlt is on, we don't emit namespace or class scope information,
> and the CodeView emission code in LLVM can't compute the fully qualified
> name. If we know LLVM won't be able to get the name right, go ahead and
> emit the qualified name in the frontend.
>
> We could change our -gmlt emission strategy to include those scopes when
> emitting codeview, but that would increase memory usage and slow down
> LTO and add more complexity to debug info emission.
>
> The same problem exists when you debug a -gmlt binary with GDB, so we
> should consider removing '&& EmitCodeView' from the condition here at
> some point in the future after evaluating the impact on object file
> size.
>
> Modified:
> cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
> cfe/trunk/test/CodeGenCXX/debug-info-codeview-display-name.cpp
>
> Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=274246&r1=274245&r2=274246&view=diff
>
> ==
> --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Thu Jun 30 12:41:31 2016
> @@ -185,17 +185,27 @@ StringRef CGDebugInfo::getFunctionName(c
>FunctionTemplateSpecializationInfo *Info =
>FD->getTemplateSpecializationInfo();
>
> -  if (!Info && FII)
> +  // Emit the unqualified name in normal operation. LLVM and the debugger
> can
> +  // compute the fully qualified name from the scope chain. If we're only
> +  // emitting line table info, there won't be any scope chains, so emit
> the
> +  // fully qualified name here so that stack traces are more accurate.
> +  // FIXME: Do this when emitting DWARF as well as when emitting CodeView
> after
> +  // evaluating the size impact.
> +  bool UseQualifiedName = DebugKind ==
> codegenoptions::DebugLineTablesOnly &&
> +  CGM.getCodeGenOpts().EmitCodeView;
> +
> +  if (!Info && FII && !UseQualifiedName)
>  return FII->getName();
>
> -  // Otherwise construct human readable name for debug info.
>SmallString<128> NS;
>llvm::raw_svector_ostream OS(NS);
>PrintingPolicy Policy(CGM.getLangOpts());
>Policy.MSVCFormatting = CGM.getCodeGenOpts().EmitCodeView;
> +  if (!UseQualifiedName)
> +FD->printName(OS);
> +  else
> +FD->printQualifiedName(OS, Policy);
>
> -  // Print the unqualified name with some template arguments.
> -  FD->printName(OS);
>// Add any template specialization args.
>if (Info) {
>  const TemplateArgumentList *TArgs = Info->TemplateArguments;
>
> Modified: cfe/trunk/test/CodeGenCXX/debug-info-codeview-display-name.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-codeview-display-name.cpp?rev=274246&r1=274245&r2=274246&view=diff
>
> ==
> --- cfe/trunk/test/CodeGenCXX/debug-info-codeview-display-name.cpp
> (original)
> +++ cfe/trunk/test/CodeGenCXX/debug-info-codeview-display-name.cpp Thu Jun
> 30 12:41:31 2016
> @@ -1,14 +1,22 @@
> -// RUN: %clang_cc1 -fblocks -debug-info-kind=limited -gcodeview
> -emit-llvm %s -o - -triple=x86_64-pc-win32 -std=c++98 | \
> -// RUN:  grep 'DISubprogram' | sed -e 's/.*name: "\([^"]*\)".*/"\1"/' |
> FileCheck %s
> +// RUN: %clang_cc1 -fblocks -debug-info-kind=limited -gcodeview
> -emit-llvm %s \
> +// RUN:   -o - -triple=x86_64-pc-win32 -std=c++98 | \
> +// RUN:grep 'DISubprogram' | sed -e 's/.*name: "\([^"]*\)".*/"\1"/' |
> \
> +// RUN:FileCheck %s --check-prefix=CHECK --check-prefix=UNQUAL
> +// RUN: %clang_cc1 -fblocks -debug-info-kind=line-tables-only -gcodeview
> -emit-llvm %s \
> +// RUN:   -o - -triple=x86_64-pc-win32 -std=c++98 | \
> +// RUN:grep 'DISubprogram' | sed -e 's/.*name: "\([^"]*\)".*/"\1"/' |
> \
> +// RUN:FileCheck %s --check-prefix=CHECK --check-prefix=QUAL
>
>  void freefunc() { }
>  // CHECK-DAG: "freefunc"
>
>  namespace N {
>int b() { return 0; }
> -// CHECK-DAG: "b"
> +// UNQUAL-DAG: "b"
> +// QUAL-DAG: "N::b"
>namespace { void func() { } }
> -// CHECK-DAG: "func"
> +// UNQUAL-DAG: "func"
> +// QUAL-DAG: "N::`anonymous namespace'::func"
>  }
>
>  void _c(void) {
> @@ -19,19 +27,24 @@ void _c(void) {
>  struct foo {
>int operator+(int);
>foo(){}
> -// CHECK-DA

[libcxx] r274253 - Mark issues 2667, 2669, 2670, 2671, 2673 as complete. These issues are wording clarifications; no code changes required.

2016-06-30 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Thu Jun 30 12:59:01 2016
New Revision: 274253

URL: http://llvm.org/viewvc/llvm-project?rev=274253&view=rev
Log:
Mark issues 2667, 2669, 2670, 2671, 2673 as complete. These issues are wording 
clarifications; no code changes required.

Modified:
libcxx/trunk/www/cxx1z_status.html

Modified: libcxx/trunk/www/cxx1z_status.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx1z_status.html?rev=274253&r1=274252&r2=274253&view=diff
==
--- libcxx/trunk/www/cxx1z_status.html (original)
+++ libcxx/trunk/www/cxx1z_status.html Thu Jun 30 12:59:01 2016
@@ -280,11 +280,11 @@
http://wg21.link/LWG2555";>2555[fund.ts.v2] No handling for 
over-aligned types in optionalOulu
http://wg21.link/LWG2573";>2573[fund.ts.v2] 
std::hash does not work for 
arraysOulu
http://wg21.link/LWG2596";>2596vector::data() should use 
addressofOuluComplete
-   http://wg21.link/LWG2667";>2667path::root_directory() 
description is confusingOulu
-   http://wg21.link/LWG2669";>2669recursive_directory_iterator 
effects refers to non-existent functionsOulu
-   http://wg21.link/LWG2670";>2670system_complete refers to 
undefined variable 'base'Oulu
-   http://wg21.link/LWG2671";>2671Errors in 
CopyOulu
-   http://wg21.link/LWG2673";>2673status() 
effects cannot be implemented as specifiedOulu
+   http://wg21.link/LWG2667";>2667path::root_directory() 
description is confusingOuluComplete
+   http://wg21.link/LWG2669";>2669recursive_directory_iterator 
effects refers to non-existent functionsOuluComplete
+   http://wg21.link/LWG2670";>2670system_complete refers to 
undefined variable 'base'OuluComplete
+   http://wg21.link/LWG2671";>2671Errors in 
CopyOuluComplete
+   http://wg21.link/LWG2673";>2673status() 
effects cannot be implemented as 
specifiedOuluComplete
http://wg21.link/LWG2674";>2674Bidirectional iterator 
requirement on path::iterator is very 
expensiveOuluComplete
http://wg21.link/LWG2683";>2683filesystem::copy() says "no 
effects"Oulu
http://wg21.link/LWG2684";>2684priority_queue lacking 
comparator typedefOuluComplete


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


[libcxx] r274255 - Mark issues 2550, 2551, 2555, 2685, 2698 as complete. These issues are wording clarifications; no code changes required.

2016-06-30 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Thu Jun 30 13:05:19 2016
New Revision: 274255

URL: http://llvm.org/viewvc/llvm-project?rev=274255&view=rev
Log:
Mark issues 2550, 2551, 2555, 2685, 2698 as complete. These issues are wording 
clarifications; no code changes required.

Modified:
libcxx/trunk/www/cxx1z_status.html

Modified: libcxx/trunk/www/cxx1z_status.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx1z_status.html?rev=274255&r1=274254&r2=274255&view=diff
==
--- libcxx/trunk/www/cxx1z_status.html (original)
+++ libcxx/trunk/www/cxx1z_status.html Thu Jun 30 13:05:19 2016
@@ -275,9 +275,9 @@
http://wg21.link/LWG2516";>2516[fund.ts.v2] Public 
"exposition only" members in observer_ptrOulu
http://wg21.link/LWG2542";>2542Missing 
const requirements for associative containersOulu
http://wg21.link/LWG2549";>2549Tuple 
EXPLICIT constructor templates that take tuple parameters end up taking 
references to temporaries and will create dangling 
referencesOuluComplete
-   http://wg21.link/LWG2550";>2550Wording of 
unordered container's clear() method complexityOulu
-   http://wg21.link/LWG2551";>2551[fund.ts.v2] "Exception 
safety" cleanup in library fundamentals requiredOulu
-   http://wg21.link/LWG2555";>2555[fund.ts.v2] No handling for 
over-aligned types in optionalOulu
+   http://wg21.link/LWG2550";>2550Wording of 
unordered container's clear() method 
complexityOuluComplete
+   http://wg21.link/LWG2551";>2551[fund.ts.v2] "Exception 
safety" cleanup in library fundamentals 
requiredOuluComplete
+   http://wg21.link/LWG2555";>2555[fund.ts.v2] No handling for 
over-aligned types in optionalOuluComplete
http://wg21.link/LWG2573";>2573[fund.ts.v2] 
std::hash does not work for 
arraysOulu
http://wg21.link/LWG2596";>2596vector::data() should use 
addressofOuluComplete
http://wg21.link/LWG2667";>2667path::root_directory() 
description is confusingOuluComplete
@@ -288,16 +288,16 @@
http://wg21.link/LWG2674";>2674Bidirectional iterator 
requirement on path::iterator is very 
expensiveOuluComplete
http://wg21.link/LWG2683";>2683filesystem::copy() says "no 
effects"Oulu
http://wg21.link/LWG2684";>2684priority_queue lacking 
comparator typedefOuluComplete
-   http://wg21.link/LWG2685";>2685shared_ptr 
deleters must not throw on move constructionOulu
+   http://wg21.link/LWG2685";>2685shared_ptr 
deleters must not throw on move 
constructionOuluComplete
http://wg21.link/LWG2687";>2687{inclusive,exclusive}_scan 
misspecifiedOulu
http://wg21.link/LWG2688";>2688clamp 
misses preconditions and has extraneous condition on 
resultOuluComplete
http://wg21.link/LWG2689";>2689Parallel 
versions of std::copy and std::move shouldn't be in 
orderOulu
-   http://wg21.link/LWG2698";>2698Effect of 
assign() on iterators/pointers/referencesOulu
+   http://wg21.link/LWG2698";>2698Effect of 
assign() on 
iterators/pointers/referencesOuluComplete
http://wg21.link/LWG2704";>2704recursive_directory_iterator's 
members should require '*this is 
dereferenceable'OuluComplete
http://wg21.link/LWG2706";>2706Error 
reporting for recursive_directory_iterator::pop() is 
under-specifiedOuluComplete
http://wg21.link/LWG2707";>2707path 
construction and assignment should have "string_type&&" 
overloadsOuluComplete
http://wg21.link/LWG2709";>2709offsetof is 
unnecessarily impreciseOulu
-   http://wg21.link/LWG2710";>2710"Effects: 
Equivalent to ..." doesn't count "Synchronization:" as determined 
semanticsOulu
+   http://wg21.link/LWG2710";>2710"Effects: 
Equivalent to ..." doesn't count "Synchronization:" as determined 
semanticsOuluComplete
http://wg21.link/LWG2711";>2711path is 
convertible from approximately everything under the 
sunOulu
http://wg21.link/LWG2716";>2716Specification of shuffle and 
sample disallows lvalue URNGsOulu
http://wg21.link/LWG2718";>2718Parallelism 
bug in [algorithms.parallel.exec] p2Oulu
@@ -317,7 +317,7 @@
 
   
 
-  Last Updated: 28-Jun-2016
+  Last Updated: 30-Jun-2016
 
 
 


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


Re: [PATCH] D21810: Don't instantiate a full host toolchain in ASTMatchersTest.

2016-06-30 Thread Chandler Carruth via cfe-commits
chandlerc accepted this revision.
chandlerc added a comment.
This revision is now accepted and ready to land.

In http://reviews.llvm.org/D21810#471486, @jlebar wrote:

> > But I think this is a reasonable workaround until such an API can be 
> > provided.
>
>
> Should I take that as an LG, or are we waiting for someone else to approve 
> this?


Lacking a more detailed response from Manuel, yea, I think you should check 
this in... I wrote most of the toolchain search logic you're turning off so I'm 
happy to provide an LGTM here. I think this is fine for now, fixes an immediate 
issue, and can be revisited and improved later easily. So yes, LG.


http://reviews.llvm.org/D21810



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


r274257 - Don't instantiate a full host toolchain in ASTMatchersTest.

2016-06-30 Thread Justin Lebar via cfe-commits
Author: jlebar
Date: Thu Jun 30 13:12:25 2016
New Revision: 274257

URL: http://llvm.org/viewvc/llvm-project?rev=274257&view=rev
Log:
Don't instantiate a full host toolchain in ASTMatchersTest.

Summary:
This test was stat()'ing large swaths of /usr/lib hundreds of times, as
every invocation of matchesConditionally*() created a new Linux
toolchain.

In addition to being slow, perf indicated this was causing substantial
contention in the kernel.

Something is...interesting in the kernel, as without this patch I
sometimes see ~11m spent in the kernel, and sometimes ~5m.  This
corresponds to bimodal ninja check-clang times of ~30s and ~20s.

It's not clear to me exactly what causes the bimodality.  In any case,
this change makes this test run in 2.5s, down from 17s, and it seems to
cause us to get the 20s ninja check-clang time unconditionally.

Reviewers: chandlerc

Subscribers: cfe-commits, klimek

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

Modified:
cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h

Modified: cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h?rev=274257&r1=274256&r2=274257&view=diff
==
--- cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h (original)
+++ cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h Thu Jun 30 13:12:25 2016
@@ -73,12 +73,16 @@ testing::AssertionResult matchesConditio
 return testing::AssertionFailure() << "Could not add dynamic matcher";
   std::unique_ptr Factory(
   newFrontendActionFactory(&Finder));
-  // Some tests use typeof, which is a gnu extension.
-  std::vector Args;
-  Args.push_back(CompileArg);
-  // Some tests need rtti/exceptions on
-  Args.push_back("-frtti");
-  Args.push_back("-fexceptions");
+  // Some tests need rtti/exceptions on.  Use an unknown-unknown triple so we
+  // don't instantiate the full system toolchain.  On Linux, instantiating the
+  // toolchain involves stat'ing large portions of /usr/lib, and this slows 
down
+  // not only this test, but all other tests, via contention in the kernel.
+  //
+  // FIXME: This is a hack to work around the fact that there's no way to do 
the
+  // equivalent of runToolOnCodeWithArgs without instantiating a full Driver.
+  // We should consider having a function, at least for tests, that invokes 
cc1.
+  std::vector Args = {CompileArg, "-frtti", "-fexceptions",
+   "-target", "i386-unknown-unknown"};
   if (!runToolOnCodeWithArgs(
   Factory->create(), Code, Args, Filename, "clang-tool",
   std::make_shared(), VirtualMappedFiles)) {
@@ -180,13 +184,12 @@ testing::AssertionResult matchesConditio
 return testing::AssertionFailure() << "Could not add dynamic matcher";
   std::unique_ptr Factory(
   newFrontendActionFactory(&Finder));
-  // Some tests use typeof, which is a gnu extension.
-  std::vector Args;
-  Args.push_back("-xcuda");
-  Args.push_back("-fno-ms-extensions");
-  Args.push_back("--cuda-host-only");
-  Args.push_back("-nocudainc");
-  Args.push_back(CompileArg);
+  // Some tests use typeof, which is a gnu extension.  Using an explicit
+  // unknown-unknown triple is good for a large speedup, because it lets us
+  // avoid constructing a full system triple.
+  std::vector Args = {
+  "-xcuda",  "-fno-ms-extensions",  "--cuda-host-only", "-nocudainc",
+  "-target", "nvptx64-unknown-unknown", CompileArg};
   if (!runToolOnCodeWithArgs(Factory->create(),
  CudaHeader + Code, Args)) {
 return testing::AssertionFailure() << "Parsing error in \"" << Code << 
"\"";
@@ -230,8 +233,11 @@ matchAndVerifyResultConditionally(const
   Finder.addMatcher(AMatcher, &VerifyVerifiedResult);
   std::unique_ptr Factory(
   newFrontendActionFactory(&Finder));
-  // Some tests use typeof, which is a gnu extension.
-  std::vector Args(1, "-std=gnu++98");
+  // Some tests use typeof, which is a gnu extension.  Using an explicit
+  // unknown-unknown triple is good for a large speedup, because it lets us
+  // avoid constructing a full system triple.
+  std::vector Args = {"-std=gnu++98", "-target",
+   "i386-unknown-unknown"};
   if (!runToolOnCodeWithArgs(Factory->create(), Code, Args)) {
 return testing::AssertionFailure() << "Parsing error in \"" << Code << 
"\"";
   }


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


Re: [PATCH] D21810: Don't instantiate a full host toolchain in ASTMatchersTest.

2016-06-30 Thread Justin Lebar via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL274257: Don't instantiate a full host toolchain in 
ASTMatchersTest. (authored by jlebar).

Changed prior to commit:
  http://reviews.llvm.org/D21810?vs=62132&id=62385#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D21810

Files:
  cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h

Index: cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h
===
--- cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h
+++ cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h
@@ -73,12 +73,16 @@
 return testing::AssertionFailure() << "Could not add dynamic matcher";
   std::unique_ptr Factory(
   newFrontendActionFactory(&Finder));
-  // Some tests use typeof, which is a gnu extension.
-  std::vector Args;
-  Args.push_back(CompileArg);
-  // Some tests need rtti/exceptions on
-  Args.push_back("-frtti");
-  Args.push_back("-fexceptions");
+  // Some tests need rtti/exceptions on.  Use an unknown-unknown triple so we
+  // don't instantiate the full system toolchain.  On Linux, instantiating the
+  // toolchain involves stat'ing large portions of /usr/lib, and this slows 
down
+  // not only this test, but all other tests, via contention in the kernel.
+  //
+  // FIXME: This is a hack to work around the fact that there's no way to do 
the
+  // equivalent of runToolOnCodeWithArgs without instantiating a full Driver.
+  // We should consider having a function, at least for tests, that invokes 
cc1.
+  std::vector Args = {CompileArg, "-frtti", "-fexceptions",
+   "-target", "i386-unknown-unknown"};
   if (!runToolOnCodeWithArgs(
   Factory->create(), Code, Args, Filename, "clang-tool",
   std::make_shared(), VirtualMappedFiles)) {
@@ -180,13 +184,12 @@
 return testing::AssertionFailure() << "Could not add dynamic matcher";
   std::unique_ptr Factory(
   newFrontendActionFactory(&Finder));
-  // Some tests use typeof, which is a gnu extension.
-  std::vector Args;
-  Args.push_back("-xcuda");
-  Args.push_back("-fno-ms-extensions");
-  Args.push_back("--cuda-host-only");
-  Args.push_back("-nocudainc");
-  Args.push_back(CompileArg);
+  // Some tests use typeof, which is a gnu extension.  Using an explicit
+  // unknown-unknown triple is good for a large speedup, because it lets us
+  // avoid constructing a full system triple.
+  std::vector Args = {
+  "-xcuda",  "-fno-ms-extensions",  "--cuda-host-only", "-nocudainc",
+  "-target", "nvptx64-unknown-unknown", CompileArg};
   if (!runToolOnCodeWithArgs(Factory->create(),
  CudaHeader + Code, Args)) {
 return testing::AssertionFailure() << "Parsing error in \"" << Code << 
"\"";
@@ -230,8 +233,11 @@
   Finder.addMatcher(AMatcher, &VerifyVerifiedResult);
   std::unique_ptr Factory(
   newFrontendActionFactory(&Finder));
-  // Some tests use typeof, which is a gnu extension.
-  std::vector Args(1, "-std=gnu++98");
+  // Some tests use typeof, which is a gnu extension.  Using an explicit
+  // unknown-unknown triple is good for a large speedup, because it lets us
+  // avoid constructing a full system triple.
+  std::vector Args = {"-std=gnu++98", "-target",
+   "i386-unknown-unknown"};
   if (!runToolOnCodeWithArgs(Factory->create(), Code, Args)) {
 return testing::AssertionFailure() << "Parsing error in \"" << Code << 
"\"";
   }


Index: cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h
===
--- cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h
+++ cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h
@@ -73,12 +73,16 @@
 return testing::AssertionFailure() << "Could not add dynamic matcher";
   std::unique_ptr Factory(
   newFrontendActionFactory(&Finder));
-  // Some tests use typeof, which is a gnu extension.
-  std::vector Args;
-  Args.push_back(CompileArg);
-  // Some tests need rtti/exceptions on
-  Args.push_back("-frtti");
-  Args.push_back("-fexceptions");
+  // Some tests need rtti/exceptions on.  Use an unknown-unknown triple so we
+  // don't instantiate the full system toolchain.  On Linux, instantiating the
+  // toolchain involves stat'ing large portions of /usr/lib, and this slows down
+  // not only this test, but all other tests, via contention in the kernel.
+  //
+  // FIXME: This is a hack to work around the fact that there's no way to do the
+  // equivalent of runToolOnCodeWithArgs without instantiating a full Driver.
+  // We should consider having a function, at least for tests, that invokes cc1.
+  std::vector Args = {CompileArg, "-frtti", "-fexceptions",
+   "-target", "i386-unknown-unknown"};
   if (!runToolOnCodeWithArgs(
   Factory->create(), Code, Args, Filename, "clang-tool",
   std::make_shared(), VirtualMappedFiles)) {
@@ -180,13 +184,1

Re: [PATCH] D21803: [libcxxabi] Provide a fallback __cxa_thread_atexit() implementation

2016-06-30 Thread Tavian Barnes via cfe-commits
tavianator updated this revision to Diff 62386.
tavianator added a comment.

Fixed some corner cases regarding destruction order and very-late-initialized 
thread_locals.  Explicitly documented the known limitations compared to 
__cxa_thread_atexit_impl().


http://reviews.llvm.org/D21803

Files:
  cmake/config-ix.cmake
  src/CMakeLists.txt
  src/cxa_thread_atexit.cpp
  test/CMakeLists.txt
  test/cxa_thread_atexit_test.pass.cpp
  test/libcxxabi/test/config.py
  test/lit.site.cfg.in

Index: test/lit.site.cfg.in
===
--- test/lit.site.cfg.in
+++ test/lit.site.cfg.in
@@ -13,7 +13,6 @@
 config.enable_32bit = "@LIBCXXABI_BUILD_32_BITS@"
 config.target_info  = "@LIBCXXABI_TARGET_INFO@"
 config.executor = "@LIBCXXABI_EXECUTOR@"
-config.thread_atexit= "@LIBCXXABI_HAS_CXA_THREAD_ATEXIT_IMPL@"
 config.libcxxabi_shared = "@LIBCXXABI_ENABLE_SHARED@"
 config.enable_shared= "@LIBCXX_ENABLE_SHARED@"
 config.enable_exceptions= "@LIBCXXABI_ENABLE_EXCEPTIONS@"
Index: test/libcxxabi/test/config.py
===
--- test/libcxxabi/test/config.py
+++ test/libcxxabi/test/config.py
@@ -37,8 +37,6 @@
 super(Configuration, self).configure_features()
 if not self.get_lit_bool('enable_exceptions', True):
 self.config.available_features.add('libcxxabi-no-exceptions')
-if self.get_lit_bool('thread_atexit', True):
-self.config.available_features.add('thread_atexit')
 
 def configure_compile_flags(self):
 self.cxx.compile_flags += ['-DLIBCXXABI_NO_TIMER']
Index: test/cxa_thread_atexit_test.pass.cpp
===
--- test/cxa_thread_atexit_test.pass.cpp
+++ test/cxa_thread_atexit_test.pass.cpp
@@ -8,7 +8,6 @@
 //===--===//
 
 // REQUIRES: linux
-// REQUIRES: thread_atexit
 
 #include 
 #include 
Index: test/CMakeLists.txt
===
--- test/CMakeLists.txt
+++ test/CMakeLists.txt
@@ -16,7 +16,6 @@
 pythonize_bool(LIBCXXABI_ENABLE_THREADS)
 pythonize_bool(LIBCXXABI_ENABLE_EXCEPTIONS)
 pythonize_bool(LIBCXXABI_USE_LLVM_UNWINDER)
-pythonize_bool(LIBCXXABI_HAS_CXA_THREAD_ATEXIT_IMPL)
 set(LIBCXXABI_TARGET_INFO "libcxx.test.target_info.LocalTI" CACHE STRING
 "TargetInfo to use when setting up test environment.")
 set(LIBCXXABI_EXECUTOR "None" CACHE STRING
Index: src/cxa_thread_atexit.cpp
===
--- src/cxa_thread_atexit.cpp
+++ src/cxa_thread_atexit.cpp
@@ -7,20 +7,134 @@
 //
 //===--===//
 
+#include "abort_message.h"
 #include "cxxabi.h"
+#include 
+#include 
 
 namespace __cxxabiv1 {
+namespace {
+  // This implementation is used if the C library does not provide
+  // __cxa_thread_atexit_impl() for us.  It has a number of limitations that are
+  // difficult to impossible to address without ..._impl():
+  //
+  // - dso_symbol is ignored.  This means that a shared library may be unloaded
+  //   (via dlclose()) before its thread_local destructors have run.
+  //
+  // - thread_local destructors for the main thread are run with __cxa_atexit().
+  //   This is later than expected; they should run before the destructors of
+  //   any objects with static storage duration.
+  //
+  // - thread_local destructors on other threads run on the first iteration
+  //   through the pthread_key destructors.  std::notify_all_at_thread_exit()
+  //   and similar functions must be careful to wait until the second iteration
+  //   to provide their indended ordering guarantees.
+
+  typedef void (*Dtor)(void*);
+
+  struct DtorList {
+Dtor dtor;
+void* obj;
+DtorList* next;
+  };
+
+  pthread_key_t dtors;
+  pthread_once_t dtors_once = PTHREAD_ONCE_INIT;
+  bool dtors_ready = false;
+  bool dtors_atexit = false;
+
+  void run_dtors(void* ptr) {
+if (pthread_setspecific(dtors, ptr) != 0) {
+  abort_message("pthread_setspecific() failed during thread_local destruction");
+}
+
+// Rather than iterate over the list directly, use the pthread_key to get
+// the head of the list every time.  This gives the correct ordering if
+// __cxa_thread_atexit() is called during the loop.
+while (auto elem = static_cast(pthread_getspecific(dtors))) {
+  if (pthread_setspecific(dtors, ptr) != 0) {
+abort_message("pthread_setspecific() failed during thread_local destruction");
+  }
+  elem->dtor(elem->obj);
+  std::free(elem);
+}
+  }
+
+  void run_dtors_atexit(void*) {
+// Signify that we need to re-register this function if any new
+// thread_locals are created.
+dtors_atexit = false;
+
+auto ptr = pthread_getspecific(dtors);
+r

Re: [PATCH] D21803: [libcxxabi] Provide a fallback __cxa_thread_atexit() implementation

2016-06-30 Thread Tavian Barnes via cfe-commits
tavianator marked 3 inline comments as done.
tavianator added a comment.

In http://reviews.llvm.org/D21803#470448, @bcraig wrote:

> What that means for this implementation is that I think that 
> _cxa_thread_atexit is allowed to be called during run_dtors.  If running the 
> dtor for a thread local variable 'cat', we encounter a previously unseen 
> thread_local 'dog', the compiler will call the ctor, then register the dtor 
> with _cxa_thread_atexit.  Since it is the most recently constructed thread 
> local object, I would expect the 'dog' dtor to be the next dtor to be run.  
> You may be able to support this just by moving "elem = elem->next" below the 
> dtor invocation.


It wasn't quite that easy (have to re-look at the pthread_key to get newly 
added thread_locals), but that's done in the latest patch.



Comment at: src/cxa_thread_atexit.cpp:115
@@ +114,3 @@
+if (!dtors_atexit) {
+  if (__cxa_atexit(run_dtors_atexit, NULL, __dso_handle) != 0) {
+return -1;

See http://stackoverflow.com/q/38130185/502399 for a test case that would 
trigger this.  This may not be necessary depending on the answer to that 
question.


Comment at: src/cxa_thread_atexit.cpp:122
@@ +121,3 @@
+auto head = static_cast(std::malloc(sizeof(DtorList)));
+if (!head) {
+  return -1;

This has changed somewhat in the latest patch, but the gist is similar.  If 
libc++abi.so is dlclose()d, there had better not be any still-running threads 
that expect to execute thread_local destructors (or any other C++ code, for 
that matter).  In the usual case (libc++abi.so loaded at startup, not by a 
later dlopen()), the last run_dtors() call happens as the final thread is 
exiting.


http://reviews.llvm.org/D21803



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


Re: [PATCH] D21803: [libcxxabi] Provide a fallback __cxa_thread_atexit() implementation

2016-06-30 Thread Tavian Barnes via cfe-commits
tavianator updated this revision to Diff 62388.
tavianator added a comment.

Added missing __dso_handle declaration.


http://reviews.llvm.org/D21803

Files:
  cmake/config-ix.cmake
  src/CMakeLists.txt
  src/cxa_thread_atexit.cpp
  test/CMakeLists.txt
  test/cxa_thread_atexit_test.pass.cpp
  test/libcxxabi/test/config.py
  test/lit.site.cfg.in

Index: test/lit.site.cfg.in
===
--- test/lit.site.cfg.in
+++ test/lit.site.cfg.in
@@ -13,7 +13,6 @@
 config.enable_32bit = "@LIBCXXABI_BUILD_32_BITS@"
 config.target_info  = "@LIBCXXABI_TARGET_INFO@"
 config.executor = "@LIBCXXABI_EXECUTOR@"
-config.thread_atexit= "@LIBCXXABI_HAS_CXA_THREAD_ATEXIT_IMPL@"
 config.libcxxabi_shared = "@LIBCXXABI_ENABLE_SHARED@"
 config.enable_shared= "@LIBCXX_ENABLE_SHARED@"
 config.enable_exceptions= "@LIBCXXABI_ENABLE_EXCEPTIONS@"
Index: test/libcxxabi/test/config.py
===
--- test/libcxxabi/test/config.py
+++ test/libcxxabi/test/config.py
@@ -37,8 +37,6 @@
 super(Configuration, self).configure_features()
 if not self.get_lit_bool('enable_exceptions', True):
 self.config.available_features.add('libcxxabi-no-exceptions')
-if self.get_lit_bool('thread_atexit', True):
-self.config.available_features.add('thread_atexit')
 
 def configure_compile_flags(self):
 self.cxx.compile_flags += ['-DLIBCXXABI_NO_TIMER']
Index: test/cxa_thread_atexit_test.pass.cpp
===
--- test/cxa_thread_atexit_test.pass.cpp
+++ test/cxa_thread_atexit_test.pass.cpp
@@ -8,7 +8,6 @@
 //===--===//
 
 // REQUIRES: linux
-// REQUIRES: thread_atexit
 
 #include 
 #include 
Index: test/CMakeLists.txt
===
--- test/CMakeLists.txt
+++ test/CMakeLists.txt
@@ -16,7 +16,6 @@
 pythonize_bool(LIBCXXABI_ENABLE_THREADS)
 pythonize_bool(LIBCXXABI_ENABLE_EXCEPTIONS)
 pythonize_bool(LIBCXXABI_USE_LLVM_UNWINDER)
-pythonize_bool(LIBCXXABI_HAS_CXA_THREAD_ATEXIT_IMPL)
 set(LIBCXXABI_TARGET_INFO "libcxx.test.target_info.LocalTI" CACHE STRING
 "TargetInfo to use when setting up test environment.")
 set(LIBCXXABI_EXECUTOR "None" CACHE STRING
Index: src/cxa_thread_atexit.cpp
===
--- src/cxa_thread_atexit.cpp
+++ src/cxa_thread_atexit.cpp
@@ -7,20 +7,137 @@
 //
 //===--===//
 
+#include "abort_message.h"
 #include "cxxabi.h"
+#include 
+#include 
 
 namespace __cxxabiv1 {
+namespace {
+  // This implementation is used if the C library does not provide
+  // __cxa_thread_atexit_impl() for us.  It has a number of limitations that are
+  // difficult to impossible to address without ..._impl():
+  //
+  // - dso_symbol is ignored.  This means that a shared library may be unloaded
+  //   (via dlclose()) before its thread_local destructors have run.
+  //
+  // - thread_local destructors for the main thread are run with __cxa_atexit().
+  //   This is later than expected; they should run before the destructors of
+  //   any objects with static storage duration.
+  //
+  // - thread_local destructors on other threads run on the first iteration
+  //   through the pthread_key destructors.  std::notify_all_at_thread_exit()
+  //   and similar functions must be careful to wait until the second iteration
+  //   to provide their indended ordering guarantees.
+
+  typedef void (*Dtor)(void*);
+
+  struct DtorList {
+Dtor dtor;
+void* obj;
+DtorList* next;
+  };
+
+  pthread_key_t dtors;
+  pthread_once_t dtors_once = PTHREAD_ONCE_INIT;
+  bool dtors_ready = false;
+  bool dtors_atexit = false;
+
+  void run_dtors(void* ptr) {
+if (pthread_setspecific(dtors, ptr) != 0) {
+  abort_message("pthread_setspecific() failed during thread_local destruction");
+}
+
+// Rather than iterate over the list directly, use the pthread_key to get
+// the head of the list every time.  This gives the correct ordering if
+// __cxa_thread_atexit() is called during the loop.
+while (auto elem = static_cast(pthread_getspecific(dtors))) {
+  if (pthread_setspecific(dtors, ptr) != 0) {
+abort_message("pthread_setspecific() failed during thread_local destruction");
+  }
+  elem->dtor(elem->obj);
+  std::free(elem);
+}
+  }
+
+  void run_dtors_atexit(void*) {
+// Signify that we need to re-register this function if any new
+// thread_locals are created.
+dtors_atexit = false;
+
+auto ptr = pthread_getspecific(dtors);
+run_dtors(ptr);
+  }
+
+  // This is the DSO handle for libc++abi.so itself
+  extern "C" void* __dso_handle;
+
+  void dtors_init() {
+/

r274260 - PR28373: fix crash-on-invalid if the condition of an if-statement fails typo-correction.

2016-06-30 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Thu Jun 30 13:36:34 2016
New Revision: 274260

URL: http://llvm.org/viewvc/llvm-project?rev=274260&view=rev
Log:
PR28373: fix crash-on-invalid if the condition of an if-statement fails 
typo-correction.

Modified:
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/test/SemaCXX/condition.cpp

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=274260&r1=274259&r2=274260&view=diff
==
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Thu Jun 30 13:36:34 2016
@@ -14394,7 +14394,12 @@ Sema::ConditionResult Sema::ActOnConditi
   if (Cond.isInvalid())
 return ConditionError();
 
-  return ConditionResult(*this, nullptr, MakeFullExpr(Cond.get(), Loc),
+  // FIXME: FullExprArg doesn't have an invalid bit, so check nullness instead.
+  FullExprArg FullExpr = MakeFullExpr(Cond.get(), Loc);
+  if (!FullExpr.get())
+return ConditionError();
+
+  return ConditionResult(*this, nullptr, FullExpr,
  CK == ConditionKind::ConstexprIf);
 }
 

Modified: cfe/trunk/test/SemaCXX/condition.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/condition.cpp?rev=274260&r1=274259&r2=274260&view=diff
==
--- cfe/trunk/test/SemaCXX/condition.cpp (original)
+++ cfe/trunk/test/SemaCXX/condition.cpp Thu Jun 30 13:36:34 2016
@@ -65,3 +65,7 @@ void test5() {
 void test5_inst() {
test5();
 }
+
+void PR28373() {
+  if (!x) {} // expected-error {{undeclared}}
+}


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


Re: [PATCH] D21337: [CUDA] Give templated device functions internal linkage, templated kernels external linkage.

2016-06-30 Thread Justin Lebar via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL274261: [CUDA] Give templated device functions internal 
linkage, templated kernels… (authored by jlebar).

Changed prior to commit:
  http://reviews.llvm.org/D21337?vs=60728&id=62391#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D21337

Files:
  cfe/trunk/lib/CodeGen/CodeGenModule.cpp
  cfe/trunk/test/CodeGenCUDA/ptx-kernels.cu

Index: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
===
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp
@@ -2671,9 +2671,18 @@
   // explicit instantiations can occur in multiple translation units
   // and must all be equivalent. However, we are not allowed to
   // throw away these explicit instantiations.
-  if (Linkage == GVA_StrongODR)
-return !Context.getLangOpts().AppleKext ? llvm::Function::WeakODRLinkage
-: llvm::Function::ExternalLinkage;
+  //
+  // We don't currently support CUDA device code spread out across multiple 
TUs,
+  // so say that CUDA templates are either external (for kernels) or internal.
+  // This lets llvm perform aggressive inter-procedural optimizations.
+  if (Linkage == GVA_StrongODR) {
+if (Context.getLangOpts().AppleKext)
+  return llvm::Function::ExternalLinkage;
+if (Context.getLangOpts().CUDA && Context.getLangOpts().CUDAIsDevice)
+  return D->hasAttr() ? llvm::Function::ExternalLinkage
+  : llvm::Function::InternalLinkage;
+return llvm::Function::WeakODRLinkage;
+  }
 
   // C++ doesn't have tentative definitions and thus cannot have common
   // linkage.
Index: cfe/trunk/test/CodeGenCUDA/ptx-kernels.cu
===
--- cfe/trunk/test/CodeGenCUDA/ptx-kernels.cu
+++ cfe/trunk/test/CodeGenCUDA/ptx-kernels.cu
@@ -19,11 +19,11 @@
 
 // Make sure host-instantiated kernels are preserved on device side.
 template  __global__ void templated_kernel(T param) {}
-// CHECK-DAG: define weak_odr void @_Z16templated_kernelIiEvT_(
+// CHECK-DAG: define void @_Z16templated_kernelIiEvT_(
 
 namespace {
 __global__ void anonymous_ns_kernel() {}
-// CHECK-DAG: define weak_odr void @_ZN12_GLOBAL__N_119anonymous_ns_kernelEv(
+// CHECK-DAG: define void @_ZN12_GLOBAL__N_119anonymous_ns_kernelEv(
 }
 
 void host_function() {


Index: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
===
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp
@@ -2671,9 +2671,18 @@
   // explicit instantiations can occur in multiple translation units
   // and must all be equivalent. However, we are not allowed to
   // throw away these explicit instantiations.
-  if (Linkage == GVA_StrongODR)
-return !Context.getLangOpts().AppleKext ? llvm::Function::WeakODRLinkage
-: llvm::Function::ExternalLinkage;
+  //
+  // We don't currently support CUDA device code spread out across multiple TUs,
+  // so say that CUDA templates are either external (for kernels) or internal.
+  // This lets llvm perform aggressive inter-procedural optimizations.
+  if (Linkage == GVA_StrongODR) {
+if (Context.getLangOpts().AppleKext)
+  return llvm::Function::ExternalLinkage;
+if (Context.getLangOpts().CUDA && Context.getLangOpts().CUDAIsDevice)
+  return D->hasAttr() ? llvm::Function::ExternalLinkage
+  : llvm::Function::InternalLinkage;
+return llvm::Function::WeakODRLinkage;
+  }
 
   // C++ doesn't have tentative definitions and thus cannot have common
   // linkage.
Index: cfe/trunk/test/CodeGenCUDA/ptx-kernels.cu
===
--- cfe/trunk/test/CodeGenCUDA/ptx-kernels.cu
+++ cfe/trunk/test/CodeGenCUDA/ptx-kernels.cu
@@ -19,11 +19,11 @@
 
 // Make sure host-instantiated kernels are preserved on device side.
 template  __global__ void templated_kernel(T param) {}
-// CHECK-DAG: define weak_odr void @_Z16templated_kernelIiEvT_(
+// CHECK-DAG: define void @_Z16templated_kernelIiEvT_(
 
 namespace {
 __global__ void anonymous_ns_kernel() {}
-// CHECK-DAG: define weak_odr void @_ZN12_GLOBAL__N_119anonymous_ns_kernelEv(
+// CHECK-DAG: define void @_ZN12_GLOBAL__N_119anonymous_ns_kernelEv(
 }
 
 void host_function() {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r274261 - [CUDA] Give templated device functions internal linkage, templated kernels external linkage.

2016-06-30 Thread Justin Lebar via cfe-commits
Author: jlebar
Date: Thu Jun 30 13:41:33 2016
New Revision: 274261

URL: http://llvm.org/viewvc/llvm-project?rev=274261&view=rev
Log:
[CUDA] Give templated device functions internal linkage, templated kernels 
external linkage.

Summary:
This lets LLVM perform IPO over these functions.  In particular, it
allows LLVM to emit ld.global.nc for loads to __restrict pointers in
kernels that are never written to.

Reviewers: rsmith

Subscribers: cfe-commits, tra

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

Modified:
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/test/CodeGenCUDA/ptx-kernels.cu

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=274261&r1=274260&r2=274261&view=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Thu Jun 30 13:41:33 2016
@@ -2671,9 +2671,18 @@ llvm::GlobalValue::LinkageTypes CodeGenM
   // explicit instantiations can occur in multiple translation units
   // and must all be equivalent. However, we are not allowed to
   // throw away these explicit instantiations.
-  if (Linkage == GVA_StrongODR)
-return !Context.getLangOpts().AppleKext ? llvm::Function::WeakODRLinkage
-: llvm::Function::ExternalLinkage;
+  //
+  // We don't currently support CUDA device code spread out across multiple 
TUs,
+  // so say that CUDA templates are either external (for kernels) or internal.
+  // This lets llvm perform aggressive inter-procedural optimizations.
+  if (Linkage == GVA_StrongODR) {
+if (Context.getLangOpts().AppleKext)
+  return llvm::Function::ExternalLinkage;
+if (Context.getLangOpts().CUDA && Context.getLangOpts().CUDAIsDevice)
+  return D->hasAttr() ? llvm::Function::ExternalLinkage
+  : llvm::Function::InternalLinkage;
+return llvm::Function::WeakODRLinkage;
+  }
 
   // C++ doesn't have tentative definitions and thus cannot have common
   // linkage.

Modified: cfe/trunk/test/CodeGenCUDA/ptx-kernels.cu
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCUDA/ptx-kernels.cu?rev=274261&r1=274260&r2=274261&view=diff
==
--- cfe/trunk/test/CodeGenCUDA/ptx-kernels.cu (original)
+++ cfe/trunk/test/CodeGenCUDA/ptx-kernels.cu Thu Jun 30 13:41:33 2016
@@ -19,11 +19,11 @@ __global__ void global_function() {
 
 // Make sure host-instantiated kernels are preserved on device side.
 template  __global__ void templated_kernel(T param) {}
-// CHECK-DAG: define weak_odr void @_Z16templated_kernelIiEvT_(
+// CHECK-DAG: define void @_Z16templated_kernelIiEvT_(
 
 namespace {
 __global__ void anonymous_ns_kernel() {}
-// CHECK-DAG: define weak_odr void @_ZN12_GLOBAL__N_119anonymous_ns_kernelEv(
+// CHECK-DAG: define void @_ZN12_GLOBAL__N_119anonymous_ns_kernelEv(
 }
 
 void host_function() {


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


Re: [PATCH] D21803: [libcxxabi] Provide a fallback __cxa_thread_atexit() implementation

2016-06-30 Thread Tavian Barnes via cfe-commits
tavianator updated this revision to Diff 62394.
tavianator added a comment.

Fix copy-pasta that result in an infinite loop.


http://reviews.llvm.org/D21803

Files:
  cmake/config-ix.cmake
  src/CMakeLists.txt
  src/cxa_thread_atexit.cpp
  test/CMakeLists.txt
  test/cxa_thread_atexit_test.pass.cpp
  test/libcxxabi/test/config.py
  test/lit.site.cfg.in

Index: test/lit.site.cfg.in
===
--- test/lit.site.cfg.in
+++ test/lit.site.cfg.in
@@ -13,7 +13,6 @@
 config.enable_32bit = "@LIBCXXABI_BUILD_32_BITS@"
 config.target_info  = "@LIBCXXABI_TARGET_INFO@"
 config.executor = "@LIBCXXABI_EXECUTOR@"
-config.thread_atexit= "@LIBCXXABI_HAS_CXA_THREAD_ATEXIT_IMPL@"
 config.libcxxabi_shared = "@LIBCXXABI_ENABLE_SHARED@"
 config.enable_shared= "@LIBCXX_ENABLE_SHARED@"
 config.enable_exceptions= "@LIBCXXABI_ENABLE_EXCEPTIONS@"
Index: test/libcxxabi/test/config.py
===
--- test/libcxxabi/test/config.py
+++ test/libcxxabi/test/config.py
@@ -37,8 +37,6 @@
 super(Configuration, self).configure_features()
 if not self.get_lit_bool('enable_exceptions', True):
 self.config.available_features.add('libcxxabi-no-exceptions')
-if self.get_lit_bool('thread_atexit', True):
-self.config.available_features.add('thread_atexit')
 
 def configure_compile_flags(self):
 self.cxx.compile_flags += ['-DLIBCXXABI_NO_TIMER']
Index: test/cxa_thread_atexit_test.pass.cpp
===
--- test/cxa_thread_atexit_test.pass.cpp
+++ test/cxa_thread_atexit_test.pass.cpp
@@ -8,7 +8,6 @@
 //===--===//
 
 // REQUIRES: linux
-// REQUIRES: thread_atexit
 
 #include 
 #include 
Index: test/CMakeLists.txt
===
--- test/CMakeLists.txt
+++ test/CMakeLists.txt
@@ -16,7 +16,6 @@
 pythonize_bool(LIBCXXABI_ENABLE_THREADS)
 pythonize_bool(LIBCXXABI_ENABLE_EXCEPTIONS)
 pythonize_bool(LIBCXXABI_USE_LLVM_UNWINDER)
-pythonize_bool(LIBCXXABI_HAS_CXA_THREAD_ATEXIT_IMPL)
 set(LIBCXXABI_TARGET_INFO "libcxx.test.target_info.LocalTI" CACHE STRING
 "TargetInfo to use when setting up test environment.")
 set(LIBCXXABI_EXECUTOR "None" CACHE STRING
Index: src/cxa_thread_atexit.cpp
===
--- src/cxa_thread_atexit.cpp
+++ src/cxa_thread_atexit.cpp
@@ -7,20 +7,137 @@
 //
 //===--===//
 
+#include "abort_message.h"
 #include "cxxabi.h"
+#include 
+#include 
 
 namespace __cxxabiv1 {
+namespace {
+  // This implementation is used if the C library does not provide
+  // __cxa_thread_atexit_impl() for us.  It has a number of limitations that are
+  // difficult to impossible to address without ..._impl():
+  //
+  // - dso_symbol is ignored.  This means that a shared library may be unloaded
+  //   (via dlclose()) before its thread_local destructors have run.
+  //
+  // - thread_local destructors for the main thread are run with __cxa_atexit().
+  //   This is later than expected; they should run before the destructors of
+  //   any objects with static storage duration.
+  //
+  // - thread_local destructors on other threads run on the first iteration
+  //   through the pthread_key destructors.  std::notify_all_at_thread_exit()
+  //   and similar functions must be careful to wait until the second iteration
+  //   to provide their indended ordering guarantees.
+
+  typedef void (*Dtor)(void*);
+
+  struct DtorList {
+Dtor dtor;
+void* obj;
+DtorList* next;
+  };
+
+  pthread_key_t dtors;
+  pthread_once_t dtors_once = PTHREAD_ONCE_INIT;
+  bool dtors_ready = false;
+  bool dtors_atexit = false;
+
+  void run_dtors(void* ptr) {
+if (pthread_setspecific(dtors, ptr) != 0) {
+  abort_message("pthread_setspecific() failed during thread_local destruction");
+}
+
+// Rather than iterate over the list directly, use the pthread_key to get
+// the head of the list every time.  This gives the correct ordering if
+// __cxa_thread_atexit() is called during the loop.
+while (auto elem = static_cast(pthread_getspecific(dtors))) {
+  if (pthread_setspecific(dtors, elem->next) != 0) {
+abort_message("pthread_setspecific() failed during thread_local destruction");
+  }
+  elem->dtor(elem->obj);
+  std::free(elem);
+}
+  }
+
+  void run_dtors_atexit(void*) {
+// Signify that we need to re-register this function if any new
+// thread_locals are created.
+dtors_atexit = false;
+
+auto ptr = pthread_getspecific(dtors);
+run_dtors(ptr);
+  }
+
+  // This is the DSO handle for libc++abi.so itself
+  extern "C" void* __dso_handle;
+
+  void dtors_

Re: [PATCH] D21834: Implementing 'If statement with Initializer'

2016-06-30 Thread Richard Smith via cfe-commits
rsmith added a comment.

There are a few missing pieces here:

1. Analysis/CFG.cpp needs to be taught to build a correct CFG for these. You 
can test this with an example like 'if (bool b; b)' which should give a 
-Wuninitialized warning.
2. AST/ExprConstant.cpp needs to be taught to perform constant evaluation for 
these properly.
3. More test coverage. In addition for test cases for the above two cases, 
please also add some tests to test/CodeGenCXX to test that we emit correct code 
for the expression and declaration form of these constructs, for both `if` and 
`switch`, and add a test that checks that the extra statement round-trips 
through an AST file properly (see test/PCH for some examples).


http://reviews.llvm.org/D21834



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


Re: [PATCH] D18286: [OPENMP] private and firstprivate clauses of teams code generation for nvptx

2016-06-30 Thread Carlo Bertolli via cfe-commits
carlo.bertolli added a comment.

Hi

Yes, the purpose of these patches was to check correctness of code gen for the 
related clauses when targeting nvptx exclusively.
Since I wrote these tests, the base support changed to generate same code on 
host and any device type, and it seemed to me that the need for a 
differentiated regression test was not there any more (happy to be told 
otherwise).

Of course, there are things that we would like to do a bit different on nvptx, 
especially for firstprivate, but I have not yet had time to work on this and to 
reflect this into this regression test. If I do, I would like to update this 
patch, but it seemed too early to just abandon this.

Thanks and please do let me know what is your viewpoint on this

- Carlo


Repository:
  rL LLVM

http://reviews.llvm.org/D18286



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


Re: [PATCH] D21867: [CUDA] Add utility functions for dealing with CUDA versions / architectures.

2016-06-30 Thread Justin Lebar via cfe-commits
jlebar marked an inline comment as done.


Comment at: lib/Basic/Cuda.cpp:8-19
@@ +7,14 @@
+
+const char *CudaVersionToString(CudaVersion V) {
+  switch (V) {
+  case CudaVersion::UNKNOWN:
+return "unknown";
+  case CudaVersion::CUDA_70:
+return "7.0";
+  case CudaVersion::CUDA_75:
+return "7.5";
+  case CudaVersion::CUDA_80:
+return "8.0";
+  }
+}
+

tra wrote:
> We seem to do a lot of enum->string and string->enum mapping in this file. 
> Is there something comparable to Boost.bimap in standard c++ library or in 
> LLVM?
> 
Not to my knowledge.


Comment at: lib/Driver/Driver.cpp:1026-1028
@@ -1024,4 +1025,5 @@
   } else if (CudaDeviceAction *CDA = dyn_cast(A)) {
-os << '"'
-   << (CDA->getGpuArchName() ? CDA->getGpuArchName() : "(multiple archs)")
+os << '"' << (CDA->getGpuArch() != CudaArch::UNKNOWN
+  ? CudaArchToString(CDA->getGpuArch())
+  : "(multiple archs)")
<< '"' << ", {" << PrintActions1(C, *CDA->input_begin(), Ids) << "}";

tra wrote:
> I think this could be collapsed to just CudaArchToString(CDA->getGpuArch()).
> "(multiple archs)" is as informative as (and indistinguishable from) 
> "unknown" here.
> 
> 
I'm not crazy about "unknown", since it *is* actually known.  How about we just 
not output anything?


http://reviews.llvm.org/D21867



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


Re: [PATCH] D21803: [libcxxabi] Provide a fallback __cxa_thread_atexit() implementation

2016-06-30 Thread Ben Craig via cfe-commits
bcraig added inline comments.


Comment at: src/cxa_thread_atexit.cpp:47
@@ +46,3 @@
+  void run_dtors(void* ptr) {
+if (pthread_setspecific(dtors, ptr) != 0) {
+  abort_message("pthread_setspecific() failed during thread_local 
destruction");

Why are we doing this?  I can see it being a little useful when debugging / 
developing, so that you get an early warning that something has gone wrong, but 
it seems like this will always be setting a value to the value it already has.


Comment at: src/cxa_thread_atexit.cpp:54
@@ +53,3 @@
+// __cxa_thread_atexit() is called during the loop.
+while (auto elem = static_cast(pthread_getspecific(dtors))) {
+  if (pthread_setspecific(dtors, elem->next) != 0) {

Maybe this concern is unfounded, but I'm not overly fond of pthread_getspecific 
and setspecific in a loop.  I've always been under the impression that those 
functions are rather slow.  Could we add a layer of indirection so that we 
don't need to call getspecific and setspecific so often?  Basically make the 
pointer that is directly stored in TLS an immutable pointer to pointer.


http://reviews.llvm.org/D21803



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


Re: r274257 - Don't instantiate a full host toolchain in ASTMatchersTest.

2016-06-30 Thread Yaron Keren via cfe-commits
Seems this commit broke a builder,
http://bb.pgr.jp/builders/ninja-x64-msvc-RA-centos6

http://bb.pgr.jp/builders/ninja-x64-msvc-RA-centos6/builds/26133
http://bb.pgr.jp/builders/ninja-x64-msvc-RA-centos6/builds/26134

 TEST 'Clang-Unit ::
ASTMatchers/ASTMatchersTests/DeclarationMatcher.MatchClass' FAILED

Note: Google Test filter = DeclarationMatcher.MatchClass
[==] Running 1 test from 1 test case.
[--] Global test environment set-up.
[--] 1 test from DeclarationMatcher
[ RUN  ] DeclarationMatcher.MatchClass
/home/bb/ninja-x64-msvc-RA-centos6/llvm-project/clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp:91:
Failure
Value of: matches("", ClassMatcher)
  Actual: false (Could not find match in "")
Expected: true
[  FAILED  ] DeclarationMatcher.MatchClass (20 ms)
[--] 1 test from DeclarationMatcher (20 ms total)

[--] Global test environment tear-down
[==] 1 test from 1 test case ran. (20 ms total)
[  PASSED  ] 0 tests.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] DeclarationMatcher.MatchClass

 1 FAILED TEST





2016-06-30 21:12 GMT+03:00 Justin Lebar via cfe-commits <
cfe-commits@lists.llvm.org>:

> Author: jlebar
> Date: Thu Jun 30 13:12:25 2016
> New Revision: 274257
>
> URL: http://llvm.org/viewvc/llvm-project?rev=274257&view=rev
> Log:
> Don't instantiate a full host toolchain in ASTMatchersTest.
>
> Summary:
> This test was stat()'ing large swaths of /usr/lib hundreds of times, as
> every invocation of matchesConditionally*() created a new Linux
> toolchain.
>
> In addition to being slow, perf indicated this was causing substantial
> contention in the kernel.
>
> Something is...interesting in the kernel, as without this patch I
> sometimes see ~11m spent in the kernel, and sometimes ~5m.  This
> corresponds to bimodal ninja check-clang times of ~30s and ~20s.
>
> It's not clear to me exactly what causes the bimodality.  In any case,
> this change makes this test run in 2.5s, down from 17s, and it seems to
> cause us to get the 20s ninja check-clang time unconditionally.
>
> Reviewers: chandlerc
>
> Subscribers: cfe-commits, klimek
>
> Differential Revision: http://reviews.llvm.org/D21810
>
> Modified:
> cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h
>
> Modified: cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h?rev=274257&r1=274256&r2=274257&view=diff
>
> ==
> --- cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h (original)
> +++ cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h Thu Jun 30 13:12:25
> 2016
> @@ -73,12 +73,16 @@ testing::AssertionResult matchesConditio
>  return testing::AssertionFailure() << "Could not add dynamic matcher";
>std::unique_ptr Factory(
>newFrontendActionFactory(&Finder));
> -  // Some tests use typeof, which is a gnu extension.
> -  std::vector Args;
> -  Args.push_back(CompileArg);
> -  // Some tests need rtti/exceptions on
> -  Args.push_back("-frtti");
> -  Args.push_back("-fexceptions");
> +  // Some tests need rtti/exceptions on.  Use an unknown-unknown triple
> so we
> +  // don't instantiate the full system toolchain.  On Linux,
> instantiating the
> +  // toolchain involves stat'ing large portions of /usr/lib, and this
> slows down
> +  // not only this test, but all other tests, via contention in the
> kernel.
> +  //
> +  // FIXME: This is a hack to work around the fact that there's no way to
> do the
> +  // equivalent of runToolOnCodeWithArgs without instantiating a full
> Driver.
> +  // We should consider having a function, at least for tests, that
> invokes cc1.
> +  std::vector Args = {CompileArg, "-frtti", "-fexceptions",
> +   "-target", "i386-unknown-unknown"};
>if (!runToolOnCodeWithArgs(
>Factory->create(), Code, Args, Filename, "clang-tool",
>std::make_shared(),
> VirtualMappedFiles)) {
> @@ -180,13 +184,12 @@ testing::AssertionResult matchesConditio
>  return testing::AssertionFailure() << "Could not add dynamic matcher";
>std::unique_ptr Factory(
>newFrontendActionFactory(&Finder));
> -  // Some tests use typeof, which is a gnu extension.
> -  std::vector Args;
> -  Args.push_back("-xcuda");
> -  Args.push_back("-fno-ms-extensions");
> -  Args.push_back("--cuda-host-only");
> -  Args.push_back("-nocudainc");
> -  Args.push_back(CompileArg);
> +  // Some tests use typeof, which is a gnu extension.  Using an explicit
> +  // unknown-unknown triple is good for a large speedup, because it lets
> us
> +  // avoid constructing a full system triple.
> +  std::vector Args = {
> +  "-xcuda",  "-fno-ms-extensions",  "--cuda-host-only",
> "-nocudainc",
> +  "-target", "nvptx64-unknown-unknown", CompileArg};
>if (!runToolOnCodeWithArgs(Factory->create(),
>   

Re: [PATCH] D21803: [libcxxabi] Provide a fallback __cxa_thread_atexit() implementation

2016-06-30 Thread Tavian Barnes via cfe-commits
tavianator added inline comments.


Comment at: src/cxa_thread_atexit.cpp:47
@@ +46,3 @@
+  void run_dtors(void* ptr) {
+if (pthread_setspecific(dtors, ptr) != 0) {
+  abort_message("pthread_setspecific() failed during thread_local 
destruction");

bcraig wrote:
> Why are we doing this?  I can see it being a little useful when debugging / 
> developing, so that you get an early warning that something has gone wrong, 
> but it seems like this will always be setting a value to the value it already 
> has.
pthread_key destructors run after the key is set to null.  I re-set it here 
since the loop reads the key.


Comment at: src/cxa_thread_atexit.cpp:54
@@ +53,3 @@
+// __cxa_thread_atexit() is called during the loop.
+while (auto elem = static_cast(pthread_getspecific(dtors))) {
+  if (pthread_setspecific(dtors, elem->next) != 0) {

bcraig wrote:
> Maybe this concern is unfounded, but I'm not overly fond of 
> pthread_getspecific and setspecific in a loop.  I've always been under the 
> impression that those functions are rather slow.  Could we add a layer of 
> indirection so that we don't need to call getspecific and setspecific so 
> often?  Basically make the pointer that is directly stored in TLS an 
> immutable pointer to pointer.
Sure, I can do that.  Would reduce the number of setspecific() calls in 
__cxa_thread_atexit too.


http://reviews.llvm.org/D21803



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


Re: [PATCH] D21803: [libcxxabi] Provide a fallback __cxa_thread_atexit() implementation

2016-06-30 Thread Ben Craig via cfe-commits
bcraig added a comment.

Also, can you add test cases for a lot of these things?  I don't expect test 
cases for the DSO side of things, but a lot of the tricky atexit cases should 
be covered.


http://reviews.llvm.org/D21803



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


Re: [PATCH] D21867: [CUDA] Add utility functions for dealing with CUDA versions / architectures.

2016-06-30 Thread Artem Belevich via cfe-commits
tra added inline comments.


Comment at: lib/Driver/Driver.cpp:1026-1028
@@ -1024,4 +1025,5 @@
   } else if (CudaDeviceAction *CDA = dyn_cast(A)) {
-os << '"'
-   << (CDA->getGpuArchName() ? CDA->getGpuArchName() : "(multiple archs)")
+os << '"' << (CDA->getGpuArch() != CudaArch::UNKNOWN
+  ? CudaArchToString(CDA->getGpuArch())
+  : "(multiple archs)")
<< '"' << ", {" << PrintActions1(C, *CDA->input_begin(), Ids) << "}";

jlebar wrote:
> tra wrote:
> > I think this could be collapsed to just CudaArchToString(CDA->getGpuArch()).
> > "(multiple archs)" is as informative as (and indistinguishable from) 
> > "unknown" here.
> > 
> > 
> I'm not crazy about "unknown", since it *is* actually known.  How about we 
> just not output anything?
It's a debugging output so it would be good to accurately reflect our internal 
state.
In this case if we for some reason end up with CudaArch::UNKNOWN, I'd want to 
know that. 
If we really use UNKNOWN to represent multiple archs, perhaps it needs an enum 
for multiple-archs.


http://reviews.llvm.org/D21867



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


Re: [PATCH] D21867: [CUDA] Add utility functions for dealing with CUDA versions / architectures.

2016-06-30 Thread Justin Lebar via cfe-commits
jlebar marked an inline comment as done.


Comment at: lib/Driver/Driver.cpp:1026-1028
@@ -1024,4 +1025,5 @@
   } else if (CudaDeviceAction *CDA = dyn_cast(A)) {
-os << '"'
-   << (CDA->getGpuArchName() ? CDA->getGpuArchName() : "(multiple archs)")
+os << '"' << (CDA->getGpuArch() != CudaArch::UNKNOWN
+  ? CudaArchToString(CDA->getGpuArch())
+  : "(multiple archs)")
<< '"' << ", {" << PrintActions1(C, *CDA->input_begin(), Ids) << "}";

tra wrote:
> jlebar wrote:
> > tra wrote:
> > > I think this could be collapsed to just 
> > > CudaArchToString(CDA->getGpuArch()).
> > > "(multiple archs)" is as informative as (and indistinguishable from) 
> > > "unknown" here.
> > > 
> > > 
> > I'm not crazy about "unknown", since it *is* actually known.  How about we 
> > just not output anything?
> It's a debugging output so it would be good to accurately reflect our 
> internal state.
> In this case if we for some reason end up with CudaArch::UNKNOWN, I'd want to 
> know that. 
> If we really use UNKNOWN to represent multiple archs, perhaps it needs an 
> enum for multiple-archs.
We really do use UNKNOWN here to represent multiple architectures.  It is used 
for the architecture of the Action corresponding to the call to fatbin.

I think adding an enum value for multiple-archs is going to be more harmful 
than useful, because it means that everywhere that we switch() on arch, we're 
going to have to handle (and assert) MULTIPLE_ARCHs.


http://reviews.llvm.org/D21867



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


r274267 - Fix typo-correction crash if a typo occurs within the operand of a

2016-06-30 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Thu Jun 30 15:24:30 2016
New Revision: 274267

URL: http://llvm.org/viewvc/llvm-project?rev=274267&view=rev
Log:
Fix typo-correction crash if a typo occurs within the operand of a
function-style cast to a non-dependent type which is then used in an invalid
way. We'd lose the "type dependent" bit here, and downstream Sema processing
would then discard the expression if it was used in a context where its type
rendered it invalid.

Modified:
cfe/trunk/lib/Sema/SemaExprCXX.cpp
cfe/trunk/test/Parser/cxx1z-init-statement.cpp
cfe/trunk/test/SemaCXX/return.cpp
cfe/trunk/test/SemaCXX/typo-correction-crash.cpp

Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=274267&r1=274266&r2=274267&view=diff
==
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Thu Jun 30 15:24:30 2016
@@ -1222,7 +1222,14 @@ Sema::ActOnCXXTypeConstructExpr(ParsedTy
   if (!TInfo)
 TInfo = Context.getTrivialTypeSourceInfo(Ty, SourceLocation());
 
-  return BuildCXXTypeConstructExpr(TInfo, LParenLoc, exprs, RParenLoc);
+  auto Result = BuildCXXTypeConstructExpr(TInfo, LParenLoc, exprs, RParenLoc);
+  // Avoid creating a non-type-dependent expression that contains typos.
+  // Non-type-dependent expressions are liable to be discarded without
+  // checking for embedded typos.
+  if (!Result.isInvalid() && Result.get()->isInstantiationDependent() &&
+  !Result.get()->isTypeDependent())
+Result = CorrectDelayedTyposInExpr(Result.get());
+  return Result;
 }
 
 /// ActOnCXXTypeConstructExpr - Parse construction of a specified type.

Modified: cfe/trunk/test/Parser/cxx1z-init-statement.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/cxx1z-init-statement.cpp?rev=274267&r1=274266&r2=274267&view=diff
==
--- cfe/trunk/test/Parser/cxx1z-init-statement.cpp (original)
+++ cfe/trunk/test/Parser/cxx1z-init-statement.cpp Thu Jun 30 15:24:30 2016
@@ -10,6 +10,7 @@ int f() {
   if (T(f()), g, h; f()) {} // expected-error {{not yet supported}}
   if (T f(); f()) {} // expected-error {{not yet supported}}
   if (T f(), g, h; f()) {} // expected-error {{not yet supported}}
+  if (T(n) = 0; n) {} // expected-error {{not yet supported}}
 
   // init-statement expressions
   if (T{f()}; f()) {} // expected-error {{not yet supported}}
@@ -20,6 +21,7 @@ int f() {
   if (T(n){g}) {}
   if (T f()) {} // expected-error {{function type}}
   if (T f(), g, h) {} // expected-error {{function type}}
+  if (T(n) = 0) {}
 
   // condition expressions
   if (T(f())) {}
@@ -27,9 +29,9 @@ int f() {
   if (T(f()), g, h) {} // expected-warning 2{{unused}}
   if (T{f()}, g, h) {} // expected-warning 2{{unused}}
 
-  // none of the above
-  // FIXME: This causes a typo-correction crash, as does "void f() { +T(n)(g); 
}"
-  //if (T(n)(g)) {} // expected-err-FIXME {{not a function}}
+  // none of the above, disambiguated as expression (can't be a declaration)
+  if (T(n)(g)) {} // expected-error {{undeclared identifier 'n'}}
+  if (T(n)(int())) {} // expected-error {{undeclared identifier 'n'}}
 
   // Likewise for 'switch'
   switch (int n; n) {} // expected-error {{not yet supported}}

Modified: cfe/trunk/test/SemaCXX/return.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/return.cpp?rev=274267&r1=274266&r2=274267&view=diff
==
--- cfe/trunk/test/SemaCXX/return.cpp (original)
+++ cfe/trunk/test/SemaCXX/return.cpp Thu Jun 30 15:24:30 2016
@@ -118,5 +118,5 @@ void cxx_unresolved_expr() {
   // CXXUnresolvedConstructExpr, and the missing ')' gives it an invalid source
   // location for its rparen.  Check that emitting a diag on the range of the
   // expr doesn't assert.
-  return int(undeclared, 4; // expected-error {{expected ')'}} 
expected-note{{to match this '('}} expected-error {{void function 
'cxx_unresolved_expr' should not return a value}} expected-error {{use of 
undeclared identifier 'undeclared'}}
+  return int(undeclared, 4; // expected-error {{expected ')'}} 
expected-note{{to match this '('}} expected-error {{use of undeclared 
identifier 'undeclared'}}
 }

Modified: cfe/trunk/test/SemaCXX/typo-correction-crash.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/typo-correction-crash.cpp?rev=274267&r1=274266&r2=274267&view=diff
==
--- cfe/trunk/test/SemaCXX/typo-correction-crash.cpp (original)
+++ cfe/trunk/test/SemaCXX/typo-correction-crash.cpp Thu Jun 30 15:24:30 2016
@@ -17,3 +17,5 @@ typedef int type;
 }
 struct FooRecord { };
 FooRecord::NestedNamespace::type x; // expected-error {{no member named 
'NestedNamespace' in 'FooRecord'; did you mean 
'BarNamesp

r274269 - Fix ASTMatchersNodeTest to work on Windows.

2016-06-30 Thread Justin Lebar via cfe-commits
Author: jlebar
Date: Thu Jun 30 15:29:29 2016
New Revision: 274269

URL: http://llvm.org/viewvc/llvm-project?rev=274269&view=rev
Log:
Fix ASTMatchersNodeTest to work on Windows.

It was failing because it had an explicit check for whether we're on
Windows.

There are a few other similar explicit checks in this file which I
didn't remove because they serve as reasonable documentation that the
test doesn't work with a Windows triple.

Modified:
cfe/trunk/unittests/ASTMatchers/ASTMatchersNodeTest.cpp

Modified: cfe/trunk/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ASTMatchers/ASTMatchersNodeTest.cpp?rev=274269&r1=274268&r2=274269&view=diff
==
--- cfe/trunk/unittests/ASTMatchers/ASTMatchersNodeTest.cpp (original)
+++ cfe/trunk/unittests/ASTMatchers/ASTMatchersNodeTest.cpp Thu Jun 30 15:29:29 
2016
@@ -82,13 +82,11 @@ TEST(NameableDeclaration, REMatchesVario
 
 TEST(DeclarationMatcher, MatchClass) {
   DeclarationMatcher ClassMatcher(recordDecl());
-  llvm::Triple Triple(llvm::sys::getDefaultTargetTriple());
-  if (Triple.getOS() != llvm::Triple::Win32 ||
-Triple.getEnvironment() != llvm::Triple::MSVC)
-EXPECT_FALSE(matches("", ClassMatcher));
-  else
-// Matches class type_info.
-EXPECT_TRUE(matches("", ClassMatcher));
+
+  // This passes on Windows only because we explicitly pass -target
+  // i386-unknown-unknown.  If we were to compile with the default target
+  // triple, we'd want to EXPECT_TRUE if it's Win32 or MSVC.
+  EXPECT_FALSE(matches("", ClassMatcher));
 
   DeclarationMatcher ClassX = recordDecl(recordDecl(hasName("X")));
   EXPECT_TRUE(matches("class X;", ClassX));


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


Re: [cfe-dev] RFC: Default language standard mode policy

2016-06-30 Thread Richard Smith via cfe-commits
On Thu, Jun 30, 2016 at 2:02 AM, David Chisnall  wrote:

> On 29 Jun 2016, at 23:07, Richard Smith via cfe-dev <
> cfe-...@lists.llvm.org> wrote:
> >
> > Yes, those are real problems, but it's not reasonable for us to keep the
> default at C++98/03 forever. GCC has already taken the plunge here, so a
> lot of open-source code that doesn't work in C++11 onwards already
> explicitly specifies an appropriate -std= flag.
> >
>
> Could you clarify exactly what the issue is?  Currently, if I have some
> legacy C++98 code, the odds are that it just compiles with ${CXX}.  If I
> have new C++11 or C++14 code, then its build system likely sticks on the
> required -std= flag and it builds independent of what the compiler default
> is.
>

Why should new C++ code pay this tax to use the language that is currently
called C++, that is taught as C++, that is covered by books on C++, and so
on? C++98 is increasingly the odd one out, and it's the one where an
explicit -std= flag should be required.

What code would be broken by keeping the default at the language version
> accepted by code that didn’t know about newer standards?


Any code written for modern GCC. Any code written for modern MSVC.

As long as we’re keeping support for C++98 in the front end, keeping the
> default there doesn’t seem particularly arduous for us and will avoid
> breaking third-party code.


At some point (although probably not for at least a decade) I expect we
will want to remove C++98 support from Clang.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20499: [Temporary, Lifetime] Add lifetime marks for temporaries

2016-06-30 Thread Richard Smith via cfe-commits
rsmith added inline comments.


Comment at: lib/CodeGen/CGExpr.cpp:438
@@ -426,1 +437,3 @@
+}
 EmitAnyExprToMem(E, Object, Qualifiers(), /*IsInit*/true);
+if (Size) {

Seems like you should push the cleanup before you emit the initializer; the 
cleanup should run if the initializer throws.


http://reviews.llvm.org/D20499



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


Re: [PATCH] D21867: [CUDA] Add utility functions for dealing with CUDA versions / architectures.

2016-06-30 Thread Artem Belevich via cfe-commits
tra added inline comments.


Comment at: lib/Driver/Driver.cpp:1026-1028
@@ -1024,4 +1025,5 @@
   } else if (CudaDeviceAction *CDA = dyn_cast(A)) {
-os << '"'
-   << (CDA->getGpuArchName() ? CDA->getGpuArchName() : "(multiple archs)")
+os << '"' << (CDA->getGpuArch() != CudaArch::UNKNOWN
+  ? CudaArchToString(CDA->getGpuArch())
+  : "(multiple archs)")
<< '"' << ", {" << PrintActions1(C, *CDA->input_begin(), Ids) << "}";

jlebar wrote:
> tra wrote:
> > jlebar wrote:
> > > tra wrote:
> > > > I think this could be collapsed to just 
> > > > CudaArchToString(CDA->getGpuArch()).
> > > > "(multiple archs)" is as informative as (and indistinguishable from) 
> > > > "unknown" here.
> > > > 
> > > > 
> > > I'm not crazy about "unknown", since it *is* actually known.  How about 
> > > we just not output anything?
> > It's a debugging output so it would be good to accurately reflect our 
> > internal state.
> > In this case if we for some reason end up with CudaArch::UNKNOWN, I'd want 
> > to know that. 
> > If we really use UNKNOWN to represent multiple archs, perhaps it needs an 
> > enum for multiple-archs.
> We really do use UNKNOWN here to represent multiple architectures.  It is 
> used for the architecture of the Action corresponding to the call to fatbin.
> 
> I think adding an enum value for multiple-archs is going to be more harmful 
> than useful, because it means that everywhere that we switch() on arch, we're 
> going to have to handle (and assert) MULTIPLE_ARCHs.
OK. No output is fine with me.


http://reviews.llvm.org/D21867



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


Re: [PATCH] D21619: [Sema] Implement C++14's DR1579: Prefer moving id-expression out of functions

2016-06-30 Thread Erik Pilkington via cfe-commits
erik.pilkington updated this revision to Diff 62405.
erik.pilkington added a comment.

This new patch addresses all of Richard's comments.


http://reviews.llvm.org/D21619

Files:
  include/clang/Sema/Initialization.h
  include/clang/Sema/Sema.h
  lib/Sema/SemaStmt.cpp
  test/CXX/drs/dr15xx.cpp
  test/SemaCXX/rval-references.cpp

Index: test/SemaCXX/rval-references.cpp
===
--- test/SemaCXX/rval-references.cpp
+++ test/SemaCXX/rval-references.cpp
@@ -72,23 +72,17 @@
 // Test the return dance. This also tests IsReturnCopyElidable.
 struct MoveOnly {
   MoveOnly();
-  MoveOnly(const MoveOnly&) = delete;	// expected-note {{candidate constructor}} \
-  // expected-note 3{{explicitly marked deleted here}}
-  MoveOnly(MoveOnly&&);	// expected-note {{candidate constructor}}
-  MoveOnly(int&&);	// expected-note {{candidate constructor}}
+  MoveOnly(const MoveOnly&) = delete;	// expected-note 3{{explicitly marked deleted here}}
 };
 
 MoveOnly gmo;
 MoveOnly returningNonEligible() {
-  int i;
   static MoveOnly mo;
   MoveOnly &r = mo;
   if (0) // Copy from global can't be elided
 return gmo; // expected-error {{call to deleted constructor}}
   else if (0) // Copy from local static can't be elided
 return mo; // expected-error {{call to deleted constructor}}
-  else if (0) // Copy from reference can't be elided
+  else // Copy from reference can't be elided
 return r; // expected-error {{call to deleted constructor}}
-  else // Construction from different type can't be elided
-return i; // expected-error {{no viable conversion from returned value of type 'int' to function return type 'MoveOnly'}}
 }
Index: test/CXX/drs/dr15xx.cpp
===
--- test/CXX/drs/dr15xx.cpp
+++ test/CXX/drs/dr15xx.cpp
@@ -62,6 +62,62 @@
 
 } // std
 
+namespace dr1579 { // dr1579: 3.9
+template
+struct GenericMoveOnly {
+  GenericMoveOnly();
+  template GenericMoveOnly(const GenericMoveOnly &) = delete; // expected-note 5 {{marked deleted here}}
+  GenericMoveOnly(const int &) = delete; // expected-note 2 {{marked deleted here}}
+  template GenericMoveOnly(GenericMoveOnly &&);
+  GenericMoveOnly(int &&);
+};
+
+GenericMoveOnly DR1579_Eligible(GenericMoveOnly CharMO) {
+  int i;
+  GenericMoveOnly GMO;
+
+  if (0)
+return i;
+  else if (0)
+return GMO;
+  else if (0)
+return ((GMO));
+  else
+return CharMO;
+}
+
+GenericMoveOnly GlobalMO;
+
+GenericMoveOnly DR1579_Ineligible(int &AnInt,
+  GenericMoveOnly &CharMO) {
+  static GenericMoveOnly StaticMove;
+  extern GenericMoveOnly ExternMove;
+
+  if (0)
+return AnInt; // expected-error{{invokes a deleted function}}
+  else if (0)
+return GlobalMO; // expected-error{{invokes a deleted function}}
+  else if (0)
+return StaticMove; // expected-error{{invokes a deleted function}}
+  else if (0)
+return ExternMove; // expected-error{{invokes a deleted function}}
+  else if (0)
+return AnInt; // expected-error{{invokes a deleted function}}
+  else
+return CharMO; // expected-error{{invokes a deleted function}}
+}
+
+auto DR1579_lambda_valid = [](GenericMoveOnly mo) ->
+  GenericMoveOnly {
+  return mo;
+};
+
+auto DR1579_lambda_invalid = []() -> GenericMoveOnly {
+  static GenericMoveOnly mo;
+  return mo; // expected-error{{invokes a deleted function}}
+};
+} // end namespace dr1579
+
 namespace dr1589 {   // dr1589: 3.7 c++11
   // Ambiguous ranking of list-initialization sequences
 
Index: lib/Sema/SemaStmt.cpp
===
--- lib/Sema/SemaStmt.cpp
+++ lib/Sema/SemaStmt.cpp
@@ -2717,16 +2717,16 @@
 /// \param E The expression being returned from the function or block, or
 /// being thrown.
 ///
-/// \param AllowFunctionParameter Whether we allow function parameters to
-/// be considered NRVO candidates. C++ prohibits this for NRVO itself, but
-/// we re-use this logic to determine whether we should try to move as part of
-/// a return or throw (which does allow function parameters).
+/// \param AllowParamOrMoveConstructible Whether we allow function parameters or
+/// id-expressions that could be moved out of the function to be considered NRVO
+/// candidates. C++ prohibits these for NRVO itself, but we re-use this logic to
+/// determine whether we should try to move as part of a return or throw (which
+/// does allow function parameters).
 ///
 /// \returns The NRVO candidate variable, if the return statement may use the
 /// NRVO, or NULL if there is no such candidate.
-VarDecl *Sema::getCopyElisionCandidate(QualType ReturnType,
-   Expr *E,
-   bool AllowFunctionParameter) {
+VarDecl *Sema::getCopyElisionCandidate(QualType ReturnType, Expr *E,
+   bool AllowParamOrMoveConstructible) {
   if (!getLangOpts().CPlusPlu

Re: r264008 - [sema] [CUDA] Use std algorithms in EraseUnwantedCUDAMatchesImpl.

2016-06-30 Thread Justin Lebar via cfe-commits
Interestingly all the clang tests pass with that whole line commented
out.  So something *really* seems missing here.

Thank you for finding this.

On Thu, Jun 30, 2016 at 5:08 AM, Benjamin Kramer  wrote:
> On Tue, Mar 22, 2016 at 1:09 AM, Justin Lebar via cfe-commits
>  wrote:
>> Author: jlebar
>> Date: Mon Mar 21 19:09:25 2016
>> New Revision: 264008
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=264008&view=rev
>> Log:
>> [sema] [CUDA] Use std algorithms in EraseUnwantedCUDAMatchesImpl.
>>
>> Summary: NFC
>>
>> Reviewers: tra
>>
>> Subscribers: cfe-commits
>>
>> Differential Revision: http://reviews.llvm.org/D18327
>>
>> Modified:
>> cfe/trunk/lib/Sema/SemaCUDA.cpp
>>
>> Modified: cfe/trunk/lib/Sema/SemaCUDA.cpp
>> URL: 
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCUDA.cpp?rev=264008&r1=264007&r2=264008&view=diff
>> ==
>> --- cfe/trunk/lib/Sema/SemaCUDA.cpp (original)
>> +++ cfe/trunk/lib/Sema/SemaCUDA.cpp Mon Mar 21 19:09:25 2016
>> @@ -210,31 +210,28 @@ bool Sema::CheckCUDATarget(const Functio
>>return false;
>>  }
>>
>> -template 
>> -static void EraseUnwantedCUDAMatchesImpl(Sema &S, const FunctionDecl 
>> *Caller,
>> - llvm::SmallVectorImpl &Matches,
>> - FetchDeclFn FetchDecl) {
>> +template 
>> +static void EraseUnwantedCUDAMatchesImpl(
>> +Sema &S, const FunctionDecl *Caller, llvm::SmallVectorImpl &Matches,
>> +std::function FetchDecl) {
>>assert(S.getLangOpts().CUDATargetOverloads &&
>>   "Should not be called w/o enabled target overloads.");
>>if (Matches.size() <= 1)
>>  return;
>>
>> +  // Gets the CUDA function preference for a call from Caller to Match.
>> +  auto GetCFP = [&](const T &Match) {
>> +return S.IdentifyCUDAPreference(Caller, FetchDecl(Match));
>> +  };
>> +
>>// Find the best call preference among the functions in Matches.
>> -  Sema::CUDAFunctionPreference P, BestCFP = Sema::CFP_Never;
>> -  for (auto const &Match : Matches) {
>> -P = S.IdentifyCUDAPreference(Caller, FetchDecl(Match));
>> -if (P > BestCFP)
>> -  BestCFP = P;
>> -  }
>> +  Sema::CUDAFunctionPreference BestCFP = GetCFP(*std::max_element(
>> +  Matches.begin(), Matches.end(),
>> +  [&](const T &M1, const T &M2) { return GetCFP(M1) < GetCFP(M2); }));
>>
>>// Erase all functions with lower priority.
>> -  for (unsigned I = 0, N = Matches.size(); I != N;)
>> -if (S.IdentifyCUDAPreference(Caller, FetchDecl(Matches[I])) < BestCFP) {
>> -  Matches[I] = Matches[--N];
>> -  Matches.resize(N);
>> -} else {
>> -  ++I;
>> -}
>> +  Matches.erase(llvm::remove_if(
>> +  Matches, [&](const T &Match) { return GetCFP(Match) < BestCFP; }));
>
> This is the single-element form of SmallVector::erase, so it won't
> remove ALL functions with lower priority. I sense a lack of test case
> here.
>
>>  }
>>
>>  void Sema::EraseUnwantedCUDAMatches(const FunctionDecl *Caller,
>>
>>
>> ___
>> 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] D21867: [CUDA] Add utility functions for dealing with CUDA versions / architectures.

2016-06-30 Thread Justin Lebar via cfe-commits
jlebar updated this revision to Diff 62409.
jlebar added a comment.

Address Art's review.


http://reviews.llvm.org/D21867

Files:
  include/clang/Basic/Cuda.h
  include/clang/Driver/Action.h
  lib/Basic/CMakeLists.txt
  lib/Basic/Cuda.cpp
  lib/Basic/Targets.cpp
  lib/Driver/Action.cpp
  lib/Driver/Driver.cpp
  lib/Driver/Tools.cpp

Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -11213,9 +11213,10 @@
 auto* A = cast(II.getAction());
 // We need to pass an Arch of the form "sm_XX" for cubin files and
 // "compute_XX" for ptx.
-const char *Arch = (II.getType() == types::TY_PP_Asm)
-   ? A->getComputeArchName()
-   : A->getGpuArchName();
+const char *Arch =
+(II.getType() == types::TY_PP_Asm)
+? CudaVirtualArchToString(VirtualArchForCudaArch(A->getGpuArch()))
+: CudaArchToString(A->getGpuArch());
 CmdArgs.push_back(Args.MakeArgString(llvm::Twine("--image=profile=") +
  Arch + ",file=" + II.getFilename()));
   }
Index: lib/Driver/Driver.cpp
===
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -23,6 +23,7 @@
 #include "clang/Driver/ToolChain.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/SmallSet.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringSet.h"
 #include "llvm/ADT/StringSwitch.h"
@@ -1022,9 +1023,10 @@
 os << '"' << BIA->getArchName() << '"' << ", {"
<< PrintActions1(C, *BIA->input_begin(), Ids) << "}";
   } else if (CudaDeviceAction *CDA = dyn_cast(A)) {
-os << '"'
-   << (CDA->getGpuArchName() ? CDA->getGpuArchName() : "(multiple archs)")
-   << '"' << ", {" << PrintActions1(C, *CDA->input_begin(), Ids) << "}";
+CudaArch Arch = CDA->getGpuArch();
+if (Arch != CudaArch::UNKNOWN)
+  os << "'" << CudaArchToString(Arch) << "', ";
+os << "{" << PrintActions1(C, *CDA->input_begin(), Ids) << "}";
   } else {
 const ActionList *AL;
 if (CudaHostAction *CHA = dyn_cast(A)) {
@@ -1380,24 +1382,25 @@
 return C.MakeAction(HostAction, ActionList());
 
   // Collect all cuda_gpu_arch parameters, removing duplicates.
-  SmallVector GpuArchList;
-  llvm::StringSet<> GpuArchNames;
+  SmallVector GpuArchList;
+  llvm::SmallSet GpuArchs;
   for (Arg *A : Args) {
 if (!A->getOption().matches(options::OPT_cuda_gpu_arch_EQ))
   continue;
 A->claim();
 
-const auto& Arch = A->getValue();
-if (!CudaDeviceAction::IsValidGpuArchName(Arch))
-  C.getDriver().Diag(clang::diag::err_drv_cuda_bad_gpu_arch) << Arch;
-else if (GpuArchNames.insert(Arch).second)
+const auto &ArchStr = A->getValue();
+CudaArch Arch = StringToCudaArch(ArchStr);
+if (Arch == CudaArch::UNKNOWN)
+  C.getDriver().Diag(clang::diag::err_drv_cuda_bad_gpu_arch) << ArchStr;
+else if (GpuArchs.insert(Arch).second)
   GpuArchList.push_back(Arch);
   }
 
   // Default to sm_20 which is the lowest common denominator for supported GPUs.
   // sm_20 code should work correctly, if suboptimally, on all newer GPUs.
   if (GpuArchList.empty())
-GpuArchList.push_back("sm_20");
+GpuArchList.push_back(CudaArch::SM_20);
 
   // Replicate inputs for each GPU architecture.
   Driver::InputList CudaDeviceInputs;
@@ -1463,7 +1466,7 @@
   }
   auto FatbinAction = C.MakeAction(
   C.MakeAction(DeviceActions, types::TY_CUDA_FATBIN),
-  /* GpuArchName = */ nullptr,
+  CudaArch::UNKNOWN,
   /* AtTopLevel = */ false);
   // Return a new host action that incorporates original host action and all
   // device actions.
@@ -2047,8 +2050,8 @@
 // Call BuildJobsForAction() again, now with correct device parameters.
 InputInfo II = BuildJobsForAction(
 C, *CDA->input_begin(), C.getSingleOffloadToolChain(),
-CDA->getGpuArchName(), CDA->isAtTopLevel(), /*MultipleArchs=*/true,
-LinkingOutput, CachedResults);
+CudaArchToString(CDA->getGpuArch()), CDA->isAtTopLevel(),
+/*MultipleArchs=*/true, LinkingOutput, CachedResults);
 // Currently II's Action is *CDA->input_begin().  Set it to CDA instead, so
 // that one can retrieve II's GPU arch.
 II.setAction(A);
Index: lib/Driver/Action.cpp
===
--- lib/Driver/Action.cpp
+++ lib/Driver/Action.cpp
@@ -51,43 +51,11 @@
 BindArchAction::BindArchAction(Action *Input, const char *_ArchName)
 : Action(BindArchClass, Input), ArchName(_ArchName) {}
 
-// Converts CUDA GPU architecture, e.g. "sm_21", to its corresponding virtual
-// compute arch, e.g. "compute_20".  Returns null if the input arch is null or
-// doesn't match an existing arch.
-static const char* GpuArchToComputeName(const char *ArchName) {
-  if (!ArchName)
-return nullptr;
-  r

Re: [PATCH] D21867: [CUDA] Add utility functions for dealing with CUDA versions / architectures.

2016-06-30 Thread Justin Lebar via cfe-commits
jlebar marked 4 inline comments as done.
jlebar added a comment.

http://reviews.llvm.org/D21867



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


Re: [PATCH] D21619: [Sema] Implement C++14's DR1579: Prefer moving id-expression out of functions

2016-06-30 Thread Richard Smith via cfe-commits
rsmith accepted this revision.
rsmith added a comment.
This revision is now accepted and ready to land.

LGTM, thank you!


http://reviews.llvm.org/D21619



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


Re: r274257 - Don't instantiate a full host toolchain in ASTMatchersTest.

2016-06-30 Thread Justin Lebar via cfe-commits
Thank you, fix in r274269.

On Thu, Jun 30, 2016 at 12:57 PM, Yaron Keren  wrote:
> Seems this commit broke a builder,
> http://bb.pgr.jp/builders/ninja-x64-msvc-RA-centos6
>
> http://bb.pgr.jp/builders/ninja-x64-msvc-RA-centos6/builds/26133
> http://bb.pgr.jp/builders/ninja-x64-msvc-RA-centos6/builds/26134
>
>  TEST 'Clang-Unit ::
> ASTMatchers/ASTMatchersTests/DeclarationMatcher.MatchClass' FAILED
> 
> Note: Google Test filter = DeclarationMatcher.MatchClass
> [==] Running 1 test from 1 test case.
> [--] Global test environment set-up.
> [--] 1 test from DeclarationMatcher
> [ RUN  ] DeclarationMatcher.MatchClass
> /home/bb/ninja-x64-msvc-RA-centos6/llvm-project/clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp:91:
> Failure
> Value of: matches("", ClassMatcher)
>   Actual: false (Could not find match in "")
> Expected: true
> [  FAILED  ] DeclarationMatcher.MatchClass (20 ms)
> [--] 1 test from DeclarationMatcher (20 ms total)
>
> [--] Global test environment tear-down
> [==] 1 test from 1 test case ran. (20 ms total)
> [  PASSED  ] 0 tests.
> [  FAILED  ] 1 test, listed below:
> [  FAILED  ] DeclarationMatcher.MatchClass
>
>  1 FAILED TEST
>
> 
>
>
>
> 2016-06-30 21:12 GMT+03:00 Justin Lebar via cfe-commits
> :
>>
>> Author: jlebar
>> Date: Thu Jun 30 13:12:25 2016
>> New Revision: 274257
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=274257&view=rev
>> Log:
>> Don't instantiate a full host toolchain in ASTMatchersTest.
>>
>> Summary:
>> This test was stat()'ing large swaths of /usr/lib hundreds of times, as
>> every invocation of matchesConditionally*() created a new Linux
>> toolchain.
>>
>> In addition to being slow, perf indicated this was causing substantial
>> contention in the kernel.
>>
>> Something is...interesting in the kernel, as without this patch I
>> sometimes see ~11m spent in the kernel, and sometimes ~5m.  This
>> corresponds to bimodal ninja check-clang times of ~30s and ~20s.
>>
>> It's not clear to me exactly what causes the bimodality.  In any case,
>> this change makes this test run in 2.5s, down from 17s, and it seems to
>> cause us to get the 20s ninja check-clang time unconditionally.
>>
>> Reviewers: chandlerc
>>
>> Subscribers: cfe-commits, klimek
>>
>> Differential Revision: http://reviews.llvm.org/D21810
>>
>> Modified:
>> cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h
>>
>> Modified: cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h?rev=274257&r1=274256&r2=274257&view=diff
>>
>> ==
>> --- cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h (original)
>> +++ cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h Thu Jun 30 13:12:25
>> 2016
>> @@ -73,12 +73,16 @@ testing::AssertionResult matchesConditio
>>  return testing::AssertionFailure() << "Could not add dynamic
>> matcher";
>>std::unique_ptr Factory(
>>newFrontendActionFactory(&Finder));
>> -  // Some tests use typeof, which is a gnu extension.
>> -  std::vector Args;
>> -  Args.push_back(CompileArg);
>> -  // Some tests need rtti/exceptions on
>> -  Args.push_back("-frtti");
>> -  Args.push_back("-fexceptions");
>> +  // Some tests need rtti/exceptions on.  Use an unknown-unknown triple
>> so we
>> +  // don't instantiate the full system toolchain.  On Linux,
>> instantiating the
>> +  // toolchain involves stat'ing large portions of /usr/lib, and this
>> slows down
>> +  // not only this test, but all other tests, via contention in the
>> kernel.
>> +  //
>> +  // FIXME: This is a hack to work around the fact that there's no way to
>> do the
>> +  // equivalent of runToolOnCodeWithArgs without instantiating a full
>> Driver.
>> +  // We should consider having a function, at least for tests, that
>> invokes cc1.
>> +  std::vector Args = {CompileArg, "-frtti", "-fexceptions",
>> +   "-target", "i386-unknown-unknown"};
>>if (!runToolOnCodeWithArgs(
>>Factory->create(), Code, Args, Filename, "clang-tool",
>>std::make_shared(),
>> VirtualMappedFiles)) {
>> @@ -180,13 +184,12 @@ testing::AssertionResult matchesConditio
>>  return testing::AssertionFailure() << "Could not add dynamic
>> matcher";
>>std::unique_ptr Factory(
>>newFrontendActionFactory(&Finder));
>> -  // Some tests use typeof, which is a gnu extension.
>> -  std::vector Args;
>> -  Args.push_back("-xcuda");
>> -  Args.push_back("-fno-ms-extensions");
>> -  Args.push_back("--cuda-host-only");
>> -  Args.push_back("-nocudainc");
>> -  Args.push_back(CompileArg);
>> +  // Some tests use typeof, which is a gnu extension.  Using an explicit
>> +  // unknown-unknown triple is good for a large speedup, because it lets
>> us
>> +  // avoid constructing a full system triple.
>> +  std::vecto

[libcxx] r274274 - Fix C++03 build.

2016-06-30 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Thu Jun 30 15:46:58 2016
New Revision: 274274

URL: http://llvm.org/viewvc/llvm-project?rev=274274&view=rev
Log:
Fix C++03 build.

Modified:

libcxx/trunk/test/std/containers/unord/unord.map/unord.map.cnstr/compare_copy_constructible.fail.cpp

libcxx/trunk/test/std/containers/unord/unord.map/unord.map.cnstr/hash_copy_constructible.fail.cpp

libcxx/trunk/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/compare_copy_constructible.fail.cpp

libcxx/trunk/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/hash_copy_constructible.fail.cpp
libcxx/trunk/test/std/thread/futures/futures.overview/future_errc.pass.cpp

Modified: 
libcxx/trunk/test/std/containers/unord/unord.map/unord.map.cnstr/compare_copy_constructible.fail.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/unord/unord.map/unord.map.cnstr/compare_copy_constructible.fail.cpp?rev=274274&r1=274273&r2=274274&view=diff
==
--- 
libcxx/trunk/test/std/containers/unord/unord.map/unord.map.cnstr/compare_copy_constructible.fail.cpp
 (original)
+++ 
libcxx/trunk/test/std/containers/unord/unord.map/unord.map.cnstr/compare_copy_constructible.fail.cpp
 Thu Jun 30 15:46:58 2016
@@ -7,6 +7,9 @@
 //
 
//===--===//
 
+// UNSUPPORTED: c++98, c++03
+// The test requires access control SFINAE.
+
 // 
 
 // Check that std::unordered_map fails to instantiate if the comparison 
predicate is 

Modified: 
libcxx/trunk/test/std/containers/unord/unord.map/unord.map.cnstr/hash_copy_constructible.fail.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/unord/unord.map/unord.map.cnstr/hash_copy_constructible.fail.cpp?rev=274274&r1=274273&r2=274274&view=diff
==
--- 
libcxx/trunk/test/std/containers/unord/unord.map/unord.map.cnstr/hash_copy_constructible.fail.cpp
 (original)
+++ 
libcxx/trunk/test/std/containers/unord/unord.map/unord.map.cnstr/hash_copy_constructible.fail.cpp
 Thu Jun 30 15:46:58 2016
@@ -7,6 +7,9 @@
 //
 
//===--===//
 
+// UNSUPPORTED: c++98, c++03
+// The test requires access control SFINAE.
+
 // 
 
 // Check that std::unordered_map fails to instantiate if the hash function is 
@@ -21,7 +24,7 @@ struct Hash {
Hash () {}
 private:
Hash (const Hash &); // declared but not defined
-   };
+};
 
 
 int main() {

Modified: 
libcxx/trunk/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/compare_copy_constructible.fail.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/compare_copy_constructible.fail.cpp?rev=274274&r1=274273&r2=274274&view=diff
==
--- 
libcxx/trunk/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/compare_copy_constructible.fail.cpp
 (original)
+++ 
libcxx/trunk/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/compare_copy_constructible.fail.cpp
 Thu Jun 30 15:46:58 2016
@@ -7,6 +7,9 @@
 //
 
//===--===//
 
+// UNSUPPORTED: c++98, c++03
+// The test requires access control SFINAE.
+
 // 
 
 // Check that std::unordered_multimap fails to instantiate if the comparison 
predicate is 

Modified: 
libcxx/trunk/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/hash_copy_constructible.fail.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/hash_copy_constructible.fail.cpp?rev=274274&r1=274273&r2=274274&view=diff
==
--- 
libcxx/trunk/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/hash_copy_constructible.fail.cpp
 (original)
+++ 
libcxx/trunk/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/hash_copy_constructible.fail.cpp
 Thu Jun 30 15:46:58 2016
@@ -7,6 +7,9 @@
 //
 
//===--===//
 
+// UNSUPPORTED: c++98, c++03
+// The test requires access control SFINAE.
+
 // 
 
 // Check that std::unordered_multimap fails to instantiate if the hash 
function is 

Modified: 
libcxx/trunk/test/std/thread/futures/futures.overview/future_errc.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/thread/futures/futures.overview/future_errc.pass.cpp?rev=274274&r1=274273&r2=274274&view=diff
==
--- libcxx/trunk/test/std/thread/futures/futures.overview/future_errc.pass.cpp 
(original)
+++ libcxx/trunk/test/std/thread/futures/futures.overview/future_errc.pass.cpp 
Thu Jun 30 

[PATCH] D21907: [AArch64] fix profiling with GNU LINUX on Aarch64

2016-06-30 Thread Brian Rzycki via cfe-commits
brzycki created this revision.
brzycki added reviewers: abdulras, rengolin, jmolloy.
brzycki added subscribers: cfe-commits, sebpop, evandro.
Herald added subscribers: rengolin, aemerson.

The GNU profiling support indicates that the interface is `_mcount` rather than 
`mcount` on GLIBC Linux for AArch64.

http://reviews.llvm.org/D21907

Files:
  clang/lib/Basic/Targets.cpp
  clang/test/Frontend/gnu-mcount.c

Index: clang/test/Frontend/gnu-mcount.c
===
--- clang/test/Frontend/gnu-mcount.c
+++ clang/test/Frontend/gnu-mcount.c
@@ -6,6 +6,7 @@
 // RUN: %clang -target armv7-unknown-linux-gnueabi -meabi gnu -pg -S 
-emit-llvm -o - %s | FileCheck %s -check-prefix CHECK -check-prefix 
CHECK-ARM-EABI-MEABI-GNU
 // RUN: %clang -target aarch64-unknown-linux-gnueabi -pg -S -emit-llvm -o - %s 
| FileCheck %s -check-prefix CHECK -check-prefix CHECK-ARM64-EABI
 // RUN: %clang -target aarch64-unknown-linux-gnueabi -meabi gnu -pg -S 
-emit-llvm -o - %s | FileCheck %s -check-prefix CHECK -check-prefix 
CHECK-ARM64-EABI-MEABI-GNU
+// RUN: %clang -target aarch64-unknown-linux-gnu -pg -S -emit-llvm -o - %s | 
FileCheck %s -check-prefix CHECK -check-prefix CHECK-ARM64-LINUX-GNU
 // RUN: %clang -target armv7-unknown-linux-gnueabihf -pg -S -emit-llvm -o - %s 
| FileCheck %s -check-prefix CHECK -check-prefix CHECK-ARM-EABI
 // RUN: %clang -target armv7-unknown-linux-gnueabihf -meabi gnu -pg -S 
-emit-llvm -o - %s | FileCheck %s -check-prefix CHECK -check-prefix 
CHECK-ARM-EABI-MEABI-GNU
 // RUN: %clang -target aarch64-unknown-linux-gnueabihf -pg -S -emit-llvm -o - 
%s | FileCheck %s -check-prefix CHECK -check-prefix CHECK-ARM64-EABI
@@ -44,6 +45,7 @@
 }
 
 // CHECK-LABEL: f
+// CHECK-ARM64-LINUX-GNU: call void @_mcount()
 // CHECK-ARM-IOS-NOT: call void @_mcount()
 // CHECK-ARM-IOS-NOT: call void @"\01__gnu_mcount_nc"()
 // CHECK-ARM-EABI: call void @"\01mcount"()
Index: clang/lib/Basic/Targets.cpp
===
--- clang/lib/Basic/Targets.cpp
+++ clang/lib/Basic/Targets.cpp
@@ -471,6 +471,7 @@
 case llvm::Triple::ppc:
 case llvm::Triple::ppc64:
 case llvm::Triple::ppc64le:
+case llvm::Triple::aarch64:
   this->MCountName = "_mcount";
   break;
 case llvm::Triple::x86:


Index: clang/test/Frontend/gnu-mcount.c
===
--- clang/test/Frontend/gnu-mcount.c
+++ clang/test/Frontend/gnu-mcount.c
@@ -6,6 +6,7 @@
 // RUN: %clang -target armv7-unknown-linux-gnueabi -meabi gnu -pg -S -emit-llvm -o - %s | FileCheck %s -check-prefix CHECK -check-prefix CHECK-ARM-EABI-MEABI-GNU
 // RUN: %clang -target aarch64-unknown-linux-gnueabi -pg -S -emit-llvm -o - %s | FileCheck %s -check-prefix CHECK -check-prefix CHECK-ARM64-EABI
 // RUN: %clang -target aarch64-unknown-linux-gnueabi -meabi gnu -pg -S -emit-llvm -o - %s | FileCheck %s -check-prefix CHECK -check-prefix CHECK-ARM64-EABI-MEABI-GNU
+// RUN: %clang -target aarch64-unknown-linux-gnu -pg -S -emit-llvm -o - %s | FileCheck %s -check-prefix CHECK -check-prefix CHECK-ARM64-LINUX-GNU
 // RUN: %clang -target armv7-unknown-linux-gnueabihf -pg -S -emit-llvm -o - %s | FileCheck %s -check-prefix CHECK -check-prefix CHECK-ARM-EABI
 // RUN: %clang -target armv7-unknown-linux-gnueabihf -meabi gnu -pg -S -emit-llvm -o - %s | FileCheck %s -check-prefix CHECK -check-prefix CHECK-ARM-EABI-MEABI-GNU
 // RUN: %clang -target aarch64-unknown-linux-gnueabihf -pg -S -emit-llvm -o - %s | FileCheck %s -check-prefix CHECK -check-prefix CHECK-ARM64-EABI
@@ -44,6 +45,7 @@
 }
 
 // CHECK-LABEL: f
+// CHECK-ARM64-LINUX-GNU: call void @_mcount()
 // CHECK-ARM-IOS-NOT: call void @_mcount()
 // CHECK-ARM-IOS-NOT: call void @"\01__gnu_mcount_nc"()
 // CHECK-ARM-EABI: call void @"\01mcount"()
Index: clang/lib/Basic/Targets.cpp
===
--- clang/lib/Basic/Targets.cpp
+++ clang/lib/Basic/Targets.cpp
@@ -471,6 +471,7 @@
 case llvm::Triple::ppc:
 case llvm::Triple::ppc64:
 case llvm::Triple::ppc64le:
+case llvm::Triple::aarch64:
   this->MCountName = "_mcount";
   break;
 case llvm::Triple::x86:
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r274278 - fix typo; NFC

2016-06-30 Thread Sanjay Patel via cfe-commits
Author: spatel
Date: Thu Jun 30 16:02:40 2016
New Revision: 274278

URL: http://llvm.org/viewvc/llvm-project?rev=274278&view=rev
Log:
fix typo; NFC

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

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=274278&r1=274277&r2=274278&view=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Thu Jun 30 16:02:40 2016
@@ -2610,7 +2610,7 @@ static bool isVarDeclStrongDefinition(co
   if (shouldBeInCOMDAT(CGM, *D))
 return true;
 
-  // Declarations with a required alignment do not have common linakge in MSVC
+  // Declarations with a required alignment do not have common linkage in MSVC
   // mode.
   if (Context.getTargetInfo().getCXXABI().isMicrosoft()) {
 if (D->hasAttr())


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


Re: [PATCH] D21907: [AArch64] fix profiling with GNU LINUX on Aarch64

2016-06-30 Thread Sebastian Pop via cfe-commits
sebpop added a comment.

LGTM.


http://reviews.llvm.org/D21907



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


[libcxx] r274285 - Fix static assert problem on gcc; remove XFAILs that I put in in r274250

2016-06-30 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Thu Jun 30 17:05:45 2016
New Revision: 274285

URL: http://llvm.org/viewvc/llvm-project?rev=274285&view=rev
Log:
Fix static assert problem on gcc; remove XFAILs that I put in in r274250

Modified:
libcxx/trunk/include/__hash_table
libcxx/trunk/include/__tree
libcxx/trunk/test/std/containers/associative/map/incomplete_type.pass.cpp

libcxx/trunk/test/std/containers/associative/map/map.cons/default_recursive.pass.cpp

libcxx/trunk/test/std/containers/associative/multimap/incomplete_type.pass.cpp

libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/default_recursive.pass.cpp
libcxx/trunk/test/std/containers/unord/unord.map/incomplete_type.pass.cpp
libcxx/trunk/test/std/containers/unord/unord.multimap/incomplete.pass.cpp

Modified: libcxx/trunk/include/__hash_table
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__hash_table?rev=274285&r1=274284&r2=274285&view=diff
==
--- libcxx/trunk/include/__hash_table (original)
+++ libcxx/trunk/include/__hash_table Thu Jun 30 17:05:45 2016
@@ -938,10 +938,6 @@ private:
 typedef allocator_traits<__node_base_allocator> __node_base_traits;
 static_assert((is_same<__node_base_pointer, typename 
__node_base_traits::pointer>::value),
  "Allocator does not rebind pointers in a sane manner.");
-static_assert((is_copy_constructible::value),
- "Predicate must be copy-constructible.");
-static_assert((is_copy_constructible::value),
- "Hasher must be copy-constructible.");
 
 private:
 
@@ -1479,6 +1475,10 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>
 template 
 __hash_table<_Tp, _Hash, _Equal, _Alloc>::~__hash_table()
 {
+static_assert((is_copy_constructible::value),
+ "Predicate must be copy-constructible.");
+static_assert((is_copy_constructible::value),
+ "Hasher must be copy-constructible.");
 __deallocate(__p1_.first().__next_);
 #if _LIBCPP_DEBUG_LEVEL >= 2
 __get_db()->__erase_c(this);

Modified: libcxx/trunk/include/__tree
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__tree?rev=274285&r1=274284&r2=274285&view=diff
==
--- libcxx/trunk/include/__tree (original)
+++ libcxx/trunk/include/__tree Thu Jun 30 17:05:45 2016
@@ -946,8 +946,6 @@ private:
 typedef allocator_traits<__node_base_allocator> __node_base_traits;
 static_assert((is_same<__node_base_pointer, typename 
__node_base_traits::pointer>::value),
  "Allocator does not rebind pointers in a sane manner.");
-static_assert((is_copy_constructible::value),
- "Comparator must be copy-constructible.");
 
 private:
 __node_pointer __begin_node_;
@@ -1707,6 +1705,8 @@ __tree<_Tp, _Compare, _Allocator>::opera
 template 
 __tree<_Tp, _Compare, _Allocator>::~__tree()
 {
+static_assert((is_copy_constructible::value),
+ "Comparator must be copy-constructible.");
 destroy(__root());
 }
 

Modified: 
libcxx/trunk/test/std/containers/associative/map/incomplete_type.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/incomplete_type.pass.cpp?rev=274285&r1=274284&r2=274285&view=diff
==
--- libcxx/trunk/test/std/containers/associative/map/incomplete_type.pass.cpp 
(original)
+++ libcxx/trunk/test/std/containers/associative/map/incomplete_type.pass.cpp 
Thu Jun 30 17:05:45 2016
@@ -12,8 +12,6 @@
 // Check that std::map and it's iterators can be instantiated with an 
incomplete
 // type.
 
-// XFAIL: gcc
-
 #include 
 
 struct A {

Modified: 
libcxx/trunk/test/std/containers/associative/map/map.cons/default_recursive.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/map.cons/default_recursive.pass.cpp?rev=274285&r1=274284&r2=274285&view=diff
==
--- 
libcxx/trunk/test/std/containers/associative/map/map.cons/default_recursive.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/containers/associative/map/map.cons/default_recursive.pass.cpp
 Thu Jun 30 17:05:45 2016
@@ -13,8 +13,6 @@
 
 // map();
 
-// XFAIL: gcc
-
 #include 
 
 struct X

Modified: 
libcxx/trunk/test/std/containers/associative/multimap/incomplete_type.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multimap/incomplete_type.pass.cpp?rev=274285&r1=274284&r2=274285&view=diff
==
--- 
libcxx/trunk/test/std/containers/associative/multimap/incomplete_type.pass.cpp 
(original)
+++ 
libcxx/trunk/test/std/containers/associative/multimap/incomplete_type.pass.cp

Re: [PATCH] D20499: [Temporary, Lifetime] Add lifetime marks for temporaries

2016-06-30 Thread Tim Shen via cfe-commits
timshen updated this revision to Diff 62433.
timshen added a comment.

Done. Added a new testcase to ensure the correct behavior with exceptions 
turned on.


http://reviews.llvm.org/D20499

Files:
  lib/CodeGen/CGCleanup.cpp
  lib/CodeGen/CGDecl.cpp
  lib/CodeGen/CGExpr.cpp
  lib/CodeGen/CodeGenFunction.h
  lib/CodeGen/EHScopeStack.h
  test/CodeGen/temporary-lifetime-exceptions.cpp
  test/CodeGen/temporary-lifetime.cpp
  test/CodeGenCXX/microsoft-abi-eh-cleanups.cpp

Index: test/CodeGenCXX/microsoft-abi-eh-cleanups.cpp
===
--- test/CodeGenCXX/microsoft-abi-eh-cleanups.cpp
+++ test/CodeGenCXX/microsoft-abi-eh-cleanups.cpp
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o - -triple=i386-pc-win32 -mconstructor-aliases -fexceptions -fcxx-exceptions -fno-rtti | FileCheck -check-prefix WIN32 %s
-// RUN: %clang_cc1 -std=c++11 -emit-llvm -O3 -disable-llvm-optzns %s -o - -triple=i386-pc-win32 -mconstructor-aliases -fexceptions -fcxx-exceptions -fno-rtti | FileCheck -check-prefix WIN32 -check-prefix WIN32-LIFETIME %s
+// RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o - -triple=i386-pc-win32 -mconstructor-aliases -fexceptions -fcxx-exceptions -fno-rtti | FileCheck -check-prefix WIN32 -check-prefix WIN32-O0 %s
+// RUN: %clang_cc1 -std=c++11 -emit-llvm -O3 -disable-llvm-optzns %s -o - -triple=i386-pc-win32 -mconstructor-aliases -fexceptions -fcxx-exceptions -fno-rtti | FileCheck -check-prefix WIN32 -check-prefix WIN32-O3 -check-prefix WIN32-LIFETIME %s
 
 struct A {
   A();
@@ -95,40 +95,78 @@
   return (cond ? TakesTwo((TakeRef(A()), A()), (TakeRef(A()), A())) : CouldThrow());
 }
 
-// WIN32-LABEL: define i32 @"\01?HasConditionalDeactivatedCleanups@@YAH_N@Z"{{.*}} {
-// WIN32:   alloca i1
-// WIN32:   %[[arg1_cond:.*]] = alloca i1
+// WIN32-O0-LABEL: define i32 @"\01?HasConditionalDeactivatedCleanups@@YAH_N@Z"{{.*}} {
+// WIN32-O0:   alloca i1
+// WIN32-O0:   %[[arg1_cond:.*]] = alloca i1
 //Start all four cleanups as deactivated.
-// WIN32:   store i1 false
-// WIN32:   store i1 false
-// WIN32:   store i1 false
-// WIN32:   store i1 false
-// WIN32:   br i1
+// WIN32-O0:   store i1 false
+// WIN32-O0:   store i1 false
+// WIN32-O0:   store i1 false
+// WIN32-O0:   store i1 false
+// WIN32-O0:   br i1
 //True condition.
-// WIN32:   call x86_thiscallcc %struct.A* @"\01??0A@@QAE@XZ"
-// WIN32:   store i1 true
-// WIN32:   invoke void @"\01?TakeRef@@YAXABUA@@@Z"
-// WIN32:   invoke x86_thiscallcc %struct.A* @"\01??0A@@QAE@XZ"
-// WIN32:   store i1 true, i1* %[[arg1_cond]]
-// WIN32:   invoke x86_thiscallcc %struct.A* @"\01??0A@@QAE@XZ"
-// WIN32:   store i1 true
-// WIN32:   invoke void @"\01?TakeRef@@YAXABUA@@@Z"
-// WIN32:   invoke x86_thiscallcc %struct.A* @"\01??0A@@QAE@XZ"
-// WIN32:   store i1 true
-// WIN32:   store i1 false, i1* %[[arg1_cond]]
-// WIN32:   invoke i32 @"\01?TakesTwo@@YAHUA@@0@Z"
+// WIN32-O0:   call x86_thiscallcc %struct.A* @"\01??0A@@QAE@XZ"
+// WIN32-O0:   store i1 true
+// WIN32-O0:   invoke void @"\01?TakeRef@@YAXABUA@@@Z"
+// WIN32-O0:   invoke x86_thiscallcc %struct.A* @"\01??0A@@QAE@XZ"
+// WIN32-O0:   store i1 true, i1* %[[arg1_cond]]
+// WIN32-O0:   invoke x86_thiscallcc %struct.A* @"\01??0A@@QAE@XZ"
+// WIN32-O0:   store i1 true
+// WIN32-O0:   invoke void @"\01?TakeRef@@YAXABUA@@@Z"
+// WIN32-O0:   invoke x86_thiscallcc %struct.A* @"\01??0A@@QAE@XZ"
+// WIN32-O0:   store i1 true
+// WIN32-O0:   store i1 false, i1* %[[arg1_cond]]
+// WIN32-O0:   invoke i32 @"\01?TakesTwo@@YAHUA@@0@Z"
 //False condition.
-// WIN32:   invoke i32 @"\01?CouldThrow@@YAHXZ"()
+// WIN32-O0:   invoke i32 @"\01?CouldThrow@@YAHXZ"()
 //Two normal cleanups for TakeRef args.
-// WIN32:   call x86_thiscallcc void @"\01??1A@@QAE@XZ"({{.*}})
-// WIN32-NOT:   invoke x86_thiscallcc void @"\01??1A@@QAE@XZ"
-// WIN32:   ret i32
+// WIN32-O0:   call x86_thiscallcc void @"\01??1A@@QAE@XZ"({{.*}})
+// WIN32-O0-NOT:   invoke x86_thiscallcc void @"\01??1A@@QAE@XZ"
+// WIN32-O0:   ret i32
 //
 //Somewhere in the landing pad soup, we conditionally destroy arg1.
-// WIN32:   %[[isactive:.*]] = load i1, i1* %[[arg1_cond]]
-// WIN32:   br i1 %[[isactive]]
-// WIN32:   call x86_thiscallcc void @"\01??1A@@QAE@XZ"({{.*}})
-// WIN32: }
+// WIN32-O0:   %[[isactive:.*]] = load i1, i1* %[[arg1_cond]]
+// WIN32-O0:   br i1 %[[isactive]]
+// WIN32-O0:   call x86_thiscallcc void @"\01??1A@@QAE@XZ"({{.*}})
+// WIN32-O0: }
+
+// WIN32-O3-LABEL: define i32 @"\01?HasConditionalDeactivatedCleanups@@YAH_N@Z"{{.*}} {
+// WIN32-O3:   alloca i1
+// WIN32-O3:   alloca i1
+// WIN32-O3:   %[[arg1_cond:.*]] = alloca i1
+//Start all four cleanups as deactivated.
+// WIN32-O3:   store i1 false
+// WIN32-O3:   store i1 false
+// WIN32-O3:   store i1 false
+// WIN32-O3:   store i1 false
+// WIN32-O3:   store i1 false
+// WIN32-O3:   store i1 false
+// WIN32-O3:   br i1
+//True condition.
+// WIN32-O3:   call x86_thiscallcc %st

  1   2   >