Re: [PATCH] D19260: [analyzer][scan-build-py] subprocess output handling reviewed in clang module

2016-06-12 Thread Laszlo Nagy via cfe-commits
rizsotto.mailinglist added a comment.

hey Devin, thanks for looking to it.



Comment at: tools/scan-build-py/libscanbuild/clang.py:90
@@ -89,2 +89,3 @@
 
-{: (, )} """
+predicate.patterns = [re.compile(r'^' + a + r'(\.|$)') for a in checkers]
+return predicate

dcoughlin wrote:
> What's the benefit of using a function attribute here rather than simply 
> closing over a local variable?
there is no difference between the two. (it even can be written in the same 
order.) i guess, just wanted to decorate the name of the variable. i have no 
preference.


http://reviews.llvm.org/D19260



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


Re: [PATCH] D21081: MPI-Checker patch for Clang Static Analyzer

2016-06-12 Thread Alexander Droste via cfe-commits
Alexander_Droste added a comment.

F2057622: MPI-Checker.diff 

Hi,

I now solved this, by using a `small_vector` of `MPIBugReporter`s (MPIChecker.h 
line: 101).
So each time a report is generated, a new `MPIBugReporter` is added to that 
vector,
in order to refer to the correct `ExprEngine` and keep them available for the 
report flush.
I attached the updated patch, as part of this comment.


http://reviews.llvm.org/D21081



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


Re: [PATCH] D3243: Fix PR19195

2016-06-12 Thread Karthik Bhat via cfe-commits
karthikthecool abandoned this revision.
karthikthecool added a comment.

Abandon old review as im no longer working on the same.
Thanks


http://reviews.llvm.org/D3243



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


[PATCH] D21268: [x86] translate SSE packed FP comparison builtins to IR

2016-06-12 Thread Sanjay Patel via cfe-commits
spatel created this revision.
spatel added reviewers: craig.topper, RKSimon, ab.
spatel added a subscriber: cfe-commits.
Herald added a subscriber: mcrosier.

As noted in the code comment, a potential follow-on would be to remove the 
builtins themselves. Other than ord/unord, this already works as expected. Eg:
  typedef float v4sf __attribute__((__vector_size__(16)));
  v4sf fcmpgt(v4sf a, v4sf b) { return a > b; }

I'll link a patch for the corresponding LLVM codegen tests next. A follow-on 
for that side would be to auto-upgrade and remove the LLVM intrinsics.

http://reviews.llvm.org/D21268

Files:
  lib/CodeGen/CGBuiltin.cpp
  test/CodeGen/avx2-builtins.c
  test/CodeGen/sse-builtins.c
  test/CodeGen/sse2-builtins.c

Index: test/CodeGen/sse2-builtins.c
===
--- test/CodeGen/sse2-builtins.c
+++ test/CodeGen/sse2-builtins.c
@@ -183,7 +183,10 @@
 
 __m128d test_mm_cmpeq_pd(__m128d A, __m128d B) {
   // CHECK-LABEL: test_mm_cmpeq_pd
-  // CHECK: call <2 x double> @llvm.x86.sse2.cmp.pd(<2 x double> %{{.*}}, <2 x double> %{{.*}}, i8 0)
+  // CHECK: [[CMP:%.*]] = fcmp oeq <2 x double>
+  // CHECK-NEXT:[[SEXT:%.*]] = sext <2 x i1> [[CMP]] to <2 x i64>
+  // CHECK-NEXT:[[BC:%.*]] = bitcast <2 x i64> [[SEXT]] to <2 x double>
+  // CHECK-NEXT:ret <2 x double> [[BC]]
   return _mm_cmpeq_pd(A, B);
 }
 
@@ -195,7 +198,10 @@
 
 __m128d test_mm_cmpge_pd(__m128d A, __m128d B) {
   // CHECK-LABEL: test_mm_cmpge_pd
-  // CHECK: call <2 x double> @llvm.x86.sse2.cmp.pd(<2 x double> %{{.*}}, <2 x double> %{{.*}}, i8 2)
+  // CHECK: [[CMP:%.*]] = fcmp ole <2 x double>
+  // CHECK-NEXT:[[SEXT:%.*]] = sext <2 x i1> [[CMP]] to <2 x i64>
+  // CHECK-NEXT:[[BC:%.*]] = bitcast <2 x i64> [[SEXT]] to <2 x double>
+  // CHECK-NEXT:ret <2 x double> [[BC]]
   return _mm_cmpge_pd(A, B);
 }
 
@@ -229,7 +235,10 @@
 
 __m128d test_mm_cmpgt_pd(__m128d A, __m128d B) {
   // CHECK-LABEL: test_mm_cmpgt_pd
-  // CHECK: call <2 x double> @llvm.x86.sse2.cmp.pd(<2 x double> %{{.*}}, <2 x double> %{{.*}}, i8 1)
+  // CHECK: [[CMP:%.*]] = fcmp olt <2 x double>
+  // CHECK-NEXT:[[SEXT:%.*]] = sext <2 x i1> [[CMP]] to <2 x i64>
+  // CHECK-NEXT:[[BC:%.*]] = bitcast <2 x i64> [[SEXT]] to <2 x double>
+  // CHECK-NEXT:ret <2 x double> [[BC]]
   return _mm_cmpgt_pd(A, B);
 }
 
@@ -245,7 +254,10 @@
 
 __m128d test_mm_cmple_pd(__m128d A, __m128d B) {
   // CHECK-LABEL: test_mm_cmple_pd
-  // CHECK: call <2 x double> @llvm.x86.sse2.cmp.pd(<2 x double> %{{.*}}, <2 x double> %{{.*}}, i8 2)
+  // CHECK: [[CMP:%.*]] = fcmp ole <2 x double>
+  // CHECK-NEXT:[[SEXT:%.*]] = sext <2 x i1> [[CMP]] to <2 x i64>
+  // CHECK-NEXT:[[BC:%.*]] = bitcast <2 x i64> [[SEXT]] to <2 x double>
+  // CHECK-NEXT:ret <2 x double> [[BC]]
   return _mm_cmple_pd(A, B);
 }
 
@@ -275,7 +287,10 @@
 
 __m128d test_mm_cmplt_pd(__m128d A, __m128d B) {
   // CHECK-LABEL: test_mm_cmplt_pd
-  // CHECK: call <2 x double> @llvm.x86.sse2.cmp.pd(<2 x double> %{{.*}}, <2 x double> %{{.*}}, i8 1)
+  // CHECK: [[CMP:%.*]] = fcmp olt <2 x double>
+  // CHECK-NEXT:[[SEXT:%.*]] = sext <2 x i1> [[CMP]] to <2 x i64>
+  // CHECK-NEXT:[[BC:%.*]] = bitcast <2 x i64> [[SEXT]] to <2 x double>
+  // CHECK-NEXT:ret <2 x double> [[BC]]
   return _mm_cmplt_pd(A, B);
 }
 
@@ -287,7 +302,10 @@
 
 __m128d test_mm_cmpneq_pd(__m128d A, __m128d B) {
   // CHECK-LABEL: test_mm_cmpneq_pd
-  // CHECK: call <2 x double> @llvm.x86.sse2.cmp.pd(<2 x double> %{{.*}}, <2 x double> %{{.*}}, i8 4)
+  // CHECK: [[CMP:%.*]] = fcmp une <2 x double>
+  // CHECK-NEXT:[[SEXT:%.*]] = sext <2 x i1> [[CMP]] to <2 x i64>
+  // CHECK-NEXT:[[BC:%.*]] = bitcast <2 x i64> [[SEXT]] to <2 x double>
+  // CHECK-NEXT:ret <2 x double> [[BC]]
   return _mm_cmpneq_pd(A, B);
 }
 
@@ -299,7 +317,10 @@
 
 __m128d test_mm_cmpnge_pd(__m128d A, __m128d B) {
   // CHECK-LABEL: test_mm_cmpnge_pd
-  // CHECK: call <2 x double> @llvm.x86.sse2.cmp.pd(<2 x double> %{{.*}}, <2 x double> %{{.*}}, i8 6)
+  // CHECK: [[CMP:%.*]] = fcmp ugt <2 x double>
+  // CHECK-NEXT:[[SEXT:%.*]] = sext <2 x i1> [[CMP]] to <2 x i64>
+  // CHECK-NEXT:[[BC:%.*]] = bitcast <2 x i64> [[SEXT]] to <2 x double>
+  // CHECK-NEXT:ret <2 x double> [[BC]]
   return _mm_cmpnge_pd(A, B);
 }
 
@@ -315,7 +336,10 @@
 
 __m128d test_mm_cmpngt_pd(__m128d A, __m128d B) {
   // CHECK-LABEL: test_mm_cmpngt_pd
-  // CHECK: call <2 x double> @llvm.x86.sse2.cmp.pd(<2 x double> %{{.*}}, <2 x double> %{{.*}}, i8 5)
+  // CHECK: [[CMP:%.*]] = fcmp uge <2 x double>
+  // CHECK-NEXT:[[SEXT:%.*]] = sext <2 x i1> [[CMP]] to <2 x i64>
+  // CHECK-NEXT:[[BC:%.*]] = bitcast <2 x i64> [[SEXT]] to <2 x double>
+  // CHECK-NEXT:ret <2 x double> [[BC]]
   return _mm_cmpngt_pd(A, B);
 }
 
@@ -331,7 +355,10 @@
 
 __m128d test_mm_cmpnle_pd(__m128d A, __m128d B) {
   // CHECK-LABEL: test_mm_cmpnle_pd
-

Re: [PATCH] D21081: MPI-Checker patch for Clang Static Analyzer

2016-06-12 Thread Devin Coughlin via cfe-commits
dcoughlin updated this revision to Diff 60472.
dcoughlin added a comment.

Alexander, a drawback with using keeping a vector of MPIBugReporters in the 
checker is that this will essentially "leak" all the created bug reporters.

How about this instead:

- Remove MPIBugReporter's MPIFunctionClassifier constructor parameter (it 
doesn't use it anyway)
- Have MPIBugReporter be a value-level field of MPIChecker (that is, not a 
pointer). This ties the lifetime of its contained BugTypes to the checker, 
which fixes the ASan issue you were seeing and matches the behavior of other 
checkers.
- Pass the clang::ento::BugReporter instance for the reporting context to 
MPIBugReporter's reporting methods rather storing it in MPIBugReporter (this 
should fix the ASan issue I was seeing).

I've updated with a proposed diff. What do you think?


http://reviews.llvm.org/D21081

Files:
  include/clang/StaticAnalyzer/Checkers/Checkers.td
  include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h
  lib/StaticAnalyzer/Checkers/CMakeLists.txt
  lib/StaticAnalyzer/Checkers/MPI-Checker/MPIBugReporter.cpp
  lib/StaticAnalyzer/Checkers/MPI-Checker/MPIBugReporter.h
  lib/StaticAnalyzer/Checkers/MPI-Checker/MPIChecker.cpp
  lib/StaticAnalyzer/Checkers/MPI-Checker/MPIChecker.h
  lib/StaticAnalyzer/Checkers/MPI-Checker/MPIFunctionClassifier.cpp
  lib/StaticAnalyzer/Checkers/MPI-Checker/MPIFunctionClassifier.h
  lib/StaticAnalyzer/Checkers/MPI-Checker/MPITypes.h
  lib/StaticAnalyzer/Core/MemRegion.cpp
  test/Analysis/MPIMock.h
  test/Analysis/MemRegion.cpp
  test/Analysis/mpichecker.cpp
  test/Analysis/mpicheckernotes.cpp

Index: test/Analysis/mpicheckernotes.cpp
===
--- /dev/null
+++ test/Analysis/mpicheckernotes.cpp
@@ -0,0 +1,34 @@
+// RUN: %clang_cc1 -analyze -analyzer-checker=optin.mpi.MPI-Checker -analyzer-output=text -verify %s
+
+// MPI-Checker test file to test note diagnostics.
+
+#include "MPIMock.h"
+
+void doubleNonblocking() {
+  double buf = 0;
+  MPI_Request sendReq;
+  MPI_Isend(&buf, 1, MPI_DOUBLE, 0, 0, MPI_COMM_WORLD, &sendReq); // expected-note{{Request is previously used by nonblocking call here.}}
+  MPI_Irecv(&buf, 1, MPI_DOUBLE, 0, 0, MPI_COMM_WORLD, &sendReq); // expected-warning{{Double nonblocking on request 'sendReq'.}} expected-note{{Double nonblocking on request 'sendReq'.}}
+  MPI_Wait(&sendReq, MPI_STATUS_IGNORE);
+}
+
+void missingWait() {
+  double buf = 0;
+  MPI_Request sendReq;
+  MPI_Ireduce(MPI_IN_PLACE, &buf, 1, MPI_DOUBLE, MPI_SUM, 0, MPI_COMM_WORLD, &sendReq); // expected-note{{Request is previously used by nonblocking call here.}}
+} // expected-warning{{Request 'sendReq' has no matching wait.}} expected-note{{Request 'sendReq' has no matching wait.}}
+
+// If more than 2 nonblocking calls are using a request in a sequence, they all
+// point to the first call as the 'previous' call. This is because the
+// BugReporterVisitor only checks for differences in state or existence of an
+// entity.
+void tripleNonblocking() {
+  double buf = 0;
+  MPI_Request sendReq;
+  MPI_Isend(&buf, 1, MPI_DOUBLE, 0, 0, MPI_COMM_WORLD, &sendReq); // expected-note 2{{Request is previously used by nonblocking call here.}}
+  MPI_Irecv(&buf, 1, MPI_DOUBLE, 0, 0, MPI_COMM_WORLD, &sendReq); // expected-warning{{Double nonblocking on request 'sendReq'.}} expected-note{{Double nonblocking on request 'sendReq'.}}
+
+  MPI_Isend(&buf, 1, MPI_DOUBLE, 0, 0, MPI_COMM_WORLD, &sendReq); // expected-warning{{Double nonblocking on request 'sendReq'.}} expected-note{{Double nonblocking on request 'sendReq'.}}
+
+  MPI_Wait(&sendReq, MPI_STATUS_IGNORE);
+}
Index: test/Analysis/mpichecker.cpp
===
--- /dev/null
+++ test/Analysis/mpichecker.cpp
@@ -0,0 +1,342 @@
+// RUN: %clang_cc1 -analyze -analyzer-checker=optin.mpi.MPI-Checker -verify %s
+
+#include "MPIMock.h"
+
+void matchedWait1() {
+  int rank = 0;
+  double buf = 0;
+  MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+  if (rank >= 0) {
+MPI_Request sendReq1, recvReq1;
+MPI_Isend(&buf, 1, MPI_DOUBLE, rank + 1, 0, MPI_COMM_WORLD, &sendReq1);
+MPI_Irecv(&buf, 1, MPI_DOUBLE, rank - 1, 0, MPI_COMM_WORLD, &recvReq1);
+
+MPI_Wait(&sendReq1, MPI_STATUS_IGNORE);
+MPI_Wait(&recvReq1, MPI_STATUS_IGNORE);
+  }
+} // no error
+
+void matchedWait2() {
+  int rank = 0;
+  double buf = 0;
+  MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+  if (rank >= 0) {
+MPI_Request sendReq1, recvReq1;
+MPI_Isend(&buf, 1, MPI_DOUBLE, rank + 1, 0, MPI_COMM_WORLD, &sendReq1);
+MPI_Irecv(&buf, 1, MPI_DOUBLE, rank - 1, 0, MPI_COMM_WORLD, &recvReq1);
+MPI_Wait(&sendReq1, MPI_STATUS_IGNORE);
+MPI_Wait(&recvReq1, MPI_STATUS_IGNORE);
+  }
+} // no error
+
+void matchedWait3() {
+  int rank = 0;
+  double buf = 0;
+  MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+  if (rank >= 0) {
+MPI_Request sendReq1, recvReq1;
+MPI_Isend(&buf, 1, MPI_DOUBLE, rank + 1, 0, MPI

r272518 - Rudimentary support for Visual Studio Stmt visualizer

2016-06-12 Thread Mike Spertus via cfe-commits
Author: mps
Date: Sun Jun 12 13:42:04 2016
New Revision: 272518

URL: http://llvm.org/viewvc/llvm-project?rev=272518&view=rev
Log:
Rudimentary support for Visual Studio Stmt visualizer

Better than nothing...

Modified:
cfe/trunk/utils/ClangVisualizers/clang.natvis

Modified: cfe/trunk/utils/ClangVisualizers/clang.natvis
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/ClangVisualizers/clang.natvis?rev=272518&r1=272517&r2=272518&view=diff
==
--- cfe/trunk/utils/ClangVisualizers/clang.natvis (original)
+++ cfe/trunk/utils/ClangVisualizers/clang.natvis Sun Jun 12 13:42:04 2016
@@ -491,6 +491,12 @@ For later versions of Visual Studio, no
   
 
   
+  
+{(clang::Stmt::StmtClass)StmtBits.sClass,en}
+
+  (clang::Stmt::StmtClass)StmtBits.sClass,en
+
+  
   
 Expression of class 
{(clang::Stmt::StmtClass)StmtBits.sClass,en} and type 
{TR,view(cpp)}
   


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


Re: Add support for musl-libc on Linux

2016-06-12 Thread Joerg Sonnenberger via cfe-commits
On Sun, Jun 12, 2016 at 10:51:11AM +0800, Lei Zhang via llvm-commits wrote:
> Hi,
> 
> I'm replying to this thread; sorry I wasn't subscribed to the list,
> thus cannot reply to it directly.
> 
> http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20160606/161733.html
> 
> Joerg, thanks for your reply. Could you please tell me what kind of
> test cases I should prepare?

The target/triple parser has a unit test in
unittests/ADT/TripleTest.cpp. The rest should get output validation in
clang's test/Driver directory. Not sure which one is the primary
GNU/Linux test.

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


Re: [PATCH] D21268: [x86] translate SSE packed FP comparison builtins to IR

2016-06-12 Thread Simon Pilgrim via cfe-commits
RKSimon added a comment.

Is there any reason that we shouldn't include the avxintrin.h 
__builtin_ia32_cmppd/__builtin_ia32_cmpps/__builtin_ia32_cmppd256/__builtin_ia32_cmpps256
 packed intrinsics in this CGBuiltin.cpp patch? Since we're heading towards 
nixing them anyhow.


http://reviews.llvm.org/D21268



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


Re: [PATCH] D21113: Add support for case-insensitive header lookup

2016-06-12 Thread Joerg Sonnenberger via cfe-commits
On Fri, Jun 10, 2016 at 10:35:26AM -0700, Hans Wennborg wrote:
> On Thu, Jun 9, 2016 at 5:31 PM, Joerg Sonnenberger via cfe-commits
>  wrote:
> > On Wed, Jun 08, 2016 at 01:12:31AM +, Hans Wennborg via cfe-commits 
> > wrote:
> >> There has been a patch for this before (http://reviews.llvm.org/D2972),
> >> but this one is more general, as it works on the virtual filesystem
> >> layer, and also supports case-insensitive lookups of parent directories
> >> not just the filename.
> >
> > What happens if two files / directories end up with the same mangling?
> 
> You'd get one of them :-)

Yeah, but how stable is the choice? I think if we want to go with this kind of
option, it should also produce a warning on collisions.

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


Re: [PATCH] D21268: [x86] translate SSE packed FP comparison builtins to IR

2016-06-12 Thread Sanjay Patel via cfe-commits
spatel added a comment.

In http://reviews.llvm.org/D21268#455668, @RKSimon wrote:

> Is there any reason that we shouldn't include the avxintrin.h 
> __builtin_ia32_cmppd/__builtin_ia32_cmpps/__builtin_ia32_cmppd256/__builtin_ia32_cmpps256
>  packed intrinsics in this CGBuiltin.cpp patch? Since we're heading towards 
> nixing them anyhow.


AVX is complicated by the enhancement to 32 compare ops (for Intel AVX). Note 
that avxintrin.h currently has conflicting comments about the immediate value 
meanings:

/* Compare */
#define _CMP_EQ_OQ0x00 /* Equal (ordered, non-signaling)  */
#define _CMP_LT_OS0x01 /* Less-than (ordered, signaling)  */
#define _CMP_LE_OS0x02 /* Less-than-or-equal (ordered, signaling)  */
#define _CMP_UNORD_Q  0x03 /* Unordered (non-signaling)  */
#define _CMP_NEQ_UQ   0x04 /* Not-equal (unordered, non-signaling)  */
#define _CMP_NLT_US   0x05 /* Not-less-than (unordered, signaling)  */
#define _CMP_NLE_US   0x06 /* Not-less-than-or-equal (unordered, signaling)  */
#define _CMP_ORD_Q0x07 /* Ordered (nonsignaling)   */
#define _CMP_EQ_UQ0x08 /* Equal (unordered, non-signaling)  */
#define _CMP_NGE_US   0x09 /* Not-greater-than-or-equal (unord, signaling)  */
#define _CMP_NGT_US   0x0a /* Not-greater-than (unordered, signaling)  */
#define _CMP_FALSE_OQ 0x0b /* False (ordered, non-signaling)  */
#define _CMP_NEQ_OQ   0x0c /* Not-equal (ordered, non-signaling)  */
#define _CMP_GE_OS0x0d /* Greater-than-or-equal (ordered, signaling)  */
#define _CMP_GT_OS0x0e /* Greater-than (ordered, signaling)  */
#define _CMP_TRUE_UQ  0x0f /* True (unordered, non-signaling)  */
#define _CMP_EQ_OS0x10 /* Equal (ordered, signaling)  */
#define _CMP_LT_OQ0x11 /* Less-than (ordered, non-signaling)  */
#define _CMP_LE_OQ0x12 /* Less-than-or-equal (ordered, non-signaling)  */
#define _CMP_UNORD_S  0x13 /* Unordered (signaling)  */
#define _CMP_NEQ_US   0x14 /* Not-equal (unordered, signaling)  */
#define _CMP_NLT_UQ   0x15 /* Not-less-than (unordered, non-signaling)  */
#define _CMP_NLE_UQ   0x16 /* Not-less-than-or-equal (unord, non-signaling)  */
#define _CMP_ORD_S0x17 /* Ordered (signaling)  */
#define _CMP_EQ_US0x18 /* Equal (unordered, signaling)  */
#define _CMP_NGE_UQ   0x19 /* Not-greater-than-or-equal (unord, non-sign)  */
#define _CMP_NGT_UQ   0x1a /* Not-greater-than (unordered, non-signaling)  */
#define _CMP_FALSE_OS 0x1b /* False (ordered, signaling)  */
#define _CMP_NEQ_OS   0x1c /* Not-equal (ordered, signaling)  */
#define _CMP_GE_OQ0x1d /* Greater-than-or-equal (ordered, non-signaling)  */
#define _CMP_GT_OQ0x1e /* Greater-than (ordered, non-signaling)  */
#define _CMP_TRUE_US  0x1f /* True (unordered, signaling)  */

/// \brief Compares each of the corresponding double-precision values of two
///128-bit vectors of [2 x double], using the operation specified by the
///immediate integer operand. Returns a [2 x double] vector consisting of
///two doubles corresponding to the two comparison results: zero if the
///comparison is false, and all 1's if the comparison is true.
///
/// \headerfile 
///
/// \code
/// __m128d _mm_cmp_pd(__m128d a, __m128d b, const int c);
/// \endcode
///
/// This intrinsic corresponds to the \c VCMPPD / CMPPD instruction.
///
/// \param a
///A 128-bit vector of [2 x double].
/// \param b
///A 128-bit vector of [2 x double].
/// \param c
///An immediate integer operand, with bits [4:0] specifying which comparison
///operation to use:
///00h, 08h, 10h, 18h: Equal
///01h, 09h, 11h, 19h: Less than
///02h, 0Ah, 12h, 1Ah: Less than or equal / Greater than or equal (swapped
///operands)
///03h, 0Bh, 13h, 1Bh: Unordered
///04h, 0Ch, 14h, 1Ch: Not equal
///05h, 0Dh, 15h, 1Dh: Not less than / Not greater than (swapped operands)
///06h, 0Eh, 16h, 1Eh: Not less than or equal / Not greater than or equal
///(swapped operands)
///07h, 0Fh, 17h, 1Fh: Ordered
/// \returns A 128-bit vector of [2 x double] containing the comparison results.


http://reviews.llvm.org/D21268



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


Re: [PATCH] D21145: [Sema] Fix crash on valid where instantiation of lambda cannot access type of 'this'

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

This new patch changes `Sema::getCurrentThisType` to recover the `this` type 
when a lambda initializer is being transformed. This is done with the same code 
as when instantiating a generic lambda initializer. I also added a loop that 
finds the enclosing record, in the case where we need to access the `this` type 
through a nested lambda.

Thanks for the feedback!


http://reviews.llvm.org/D21145

Files:
  lib/Sema/SemaExprCXX.cpp
  test/SemaCXX/lambda-expressions.cpp

Index: test/SemaCXX/lambda-expressions.cpp
===
--- test/SemaCXX/lambda-expressions.cpp
+++ test/SemaCXX/lambda-expressions.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++11 -Wno-unused-value -fsyntax-only -verify -fblocks 
%s
+// RUN: %clang_cc1 -std=c++14 -Wno-unused-value -fsyntax-only -verify -fblocks 
%s
 // RUN: %clang_cc1 -std=c++1y -Wno-unused-value -fsyntax-only -verify -fblocks 
%s
 
 namespace std { class type_info; };
@@ -499,3 +499,30 @@
   };
 }
 }
+
+namespace PR27994 {
+struct A { template  A(T); };
+
+template 
+struct B {
+  int x;
+  A a = [&] { int y = x; };
+  A b = [&] { [&] { [&] { int y = x; }; }; };
+  A d = [&](auto param) { int y = x; };
+  A e = [&](auto param) { [&] { [&](auto param2) { int y = x; }; }; };
+};
+
+B b;
+
+template  struct C {
+  struct D {
+int x;
+A f = [&] { int y = x; };
+  };
+};
+
+int func() {
+  C a;
+  decltype(a)::D b;
+}
+}
Index: lib/Sema/SemaExprCXX.cpp
===
--- lib/Sema/SemaExprCXX.cpp
+++ lib/Sema/SemaExprCXX.cpp
@@ -965,28 +965,33 @@
 if (method && method->isInstance())
   ThisTy = method->getThisType(Context);
   }
-  if (ThisTy.isNull()) {
-if (isGenericLambdaCallOperatorSpecialization(CurContext) &&
-CurContext->getParent()->getParent()->isRecord()) {
-  // This is a generic lambda call operator that is being instantiated
-  // within a default initializer - so use the enclosing class as 'this'.
-  // There is no enclosing member function to retrieve the 'this' pointer
-  // from.
-
-  // FIXME: This looks wrong. If we're in a lambda within a lambda within a
-  // default member initializer, we need to recurse up more parents to find
-  // the right context. Looks like we should be walking up to the parent of
-  // the closure type, checking whether that is itself a lambda, and if so,
-  // recursing, until we reach a class or a function that isn't a lambda
-  // call operator. And we should accumulate the constness of *this on the
-  // way.
-
-  QualType ClassTy = Context.getTypeDeclType(
-  cast(CurContext->getParent()->getParent()));
-  // There are no cv-qualifiers for 'this' within default initializers, 
-  // per [expr.prim.general]p4.
-  ThisTy = Context.getPointerType(ClassTy);
+
+  if (ThisTy.isNull() && isLambdaCallOperator(CurContext) &&
+  !ActiveTemplateInstantiations.empty()) {
+
+// This is a lambda call operator that is being instantiated as a default
+// initializer. We need to iterate through the potential list of parent
+// lambda contexts to reach the enclosing class, from which we can recover
+// the 'this' pointer type, as there is no enclosing member function.
+
+DeclContext *IterCtx = CurContext;
+for (;;) {
+  // Jump over both the lambda call operator and the lambda class.
+  IterCtx = IterCtx->getParent()->getParent();
+
+  if (IterCtx->isRecord())
+break;
+
+  // FIXME: Is this possible?
+  if (!(isa(IterCtx) &&
+cast(IterCtx->getParent())->isLambda()))
+return QualType();
 }
+
+QualType ClassTy = Context.getTypeDeclType(cast(IterCtx));
+// There are no cv-qualifiers for 'this' within default initializers,
+// per [expr.prim.general]p4.
+ThisTy = Context.getPointerType(ClassTy);
   }
 
   // If we are within a lambda's call operator, the cv-qualifiers of 'this'


Index: test/SemaCXX/lambda-expressions.cpp
===
--- test/SemaCXX/lambda-expressions.cpp
+++ test/SemaCXX/lambda-expressions.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++11 -Wno-unused-value -fsyntax-only -verify -fblocks %s
+// RUN: %clang_cc1 -std=c++14 -Wno-unused-value -fsyntax-only -verify -fblocks %s
 // RUN: %clang_cc1 -std=c++1y -Wno-unused-value -fsyntax-only -verify -fblocks %s
 
 namespace std { class type_info; };
@@ -499,3 +499,30 @@
   };
 }
 }
+
+namespace PR27994 {
+struct A { template  A(T); };
+
+template 
+struct B {
+  int x;
+  A a = [&] { int y = x; };
+  A b = [&] { [&] { [&] { int y = x; }; }; };
+  A d = [&](auto param) { int y = x; };
+  A e = [&](auto param) { [&] { [&](auto param2) { int y = x; }; }; };
+};
+
+B b;
+
+template  struct C {
+  struct D {
+int x;
+A f = [&] { int y = x; };
+  };

Re: [PATCH] D21241: Add an ASTMatcher for ignoring ExprWithCleanups.

2016-06-12 Thread Manuel Klimek via cfe-commits
klimek added a comment.

Please add a test.


http://reviews.llvm.org/D21241



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


Re: [PATCH] D21268: [x86] translate SSE packed FP comparison builtins to IR

2016-06-12 Thread Simon Pilgrim via cfe-commits
RKSimon added a comment.

Eeep that's certainly a lot more work than just adding a few extra cases! 
Please add a TODO explaining what we need to do?

If there is a problem with the header documentation please can you raise a 
bugzilla and CC Katya Romanova.


http://reviews.llvm.org/D21268



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


r272520 - Add some std::move where the value is only read otherwise.

2016-06-12 Thread Benjamin Kramer via cfe-commits
Author: d0k
Date: Sun Jun 12 15:05:23 2016
New Revision: 272520

URL: http://llvm.org/viewvc/llvm-project?rev=272520&view=rev
Log:
Add some std::move where the value is only read otherwise.

This mostly affects smart pointers. No functionality change intended.

Modified:
cfe/trunk/include/clang/AST/DeclTemplate.h
cfe/trunk/include/clang/Driver/Driver.h
cfe/trunk/include/clang/Frontend/CompilerInstance.h
cfe/trunk/include/clang/Frontend/TextDiagnosticPrinter.h
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/lib/Basic/VirtualFileSystem.cpp
cfe/trunk/lib/Frontend/ASTUnit.cpp
cfe/trunk/lib/Frontend/CompilerInstance.cpp
cfe/trunk/lib/Tooling/Tooling.cpp

Modified: cfe/trunk/include/clang/AST/DeclTemplate.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclTemplate.h?rev=272520&r1=272519&r2=272520&view=diff
==
--- cfe/trunk/include/clang/AST/DeclTemplate.h (original)
+++ cfe/trunk/include/clang/AST/DeclTemplate.h Sun Jun 12 15:05:23 2016
@@ -2356,7 +2356,7 @@ public:
bool 
HasExplicitTemplateArgs,
 TemplateArgumentListInfo TemplateArgs) 
{
 return new (C, DC) ClassScopeFunctionSpecializationDecl(
-DC, Loc, FD, HasExplicitTemplateArgs, TemplateArgs);
+DC, Loc, FD, HasExplicitTemplateArgs, std::move(TemplateArgs));
   }
 
   static ClassScopeFunctionSpecializationDecl *

Modified: cfe/trunk/include/clang/Driver/Driver.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Driver.h?rev=272520&r1=272519&r2=272520&view=diff
==
--- cfe/trunk/include/clang/Driver/Driver.h (original)
+++ cfe/trunk/include/clang/Driver/Driver.h Sun Jun 12 15:05:23 2016
@@ -248,7 +248,7 @@ public:
   void setCheckInputsExist(bool Value) { CheckInputsExist = Value; }
 
   const std::string &getTitle() { return DriverTitle; }
-  void setTitle(std::string Value) { DriverTitle = Value; }
+  void setTitle(std::string Value) { DriverTitle = std::move(Value); }
 
   /// \brief Get the path to the main clang executable.
   const char *getClangProgramPath() const {

Modified: cfe/trunk/include/clang/Frontend/CompilerInstance.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CompilerInstance.h?rev=272520&r1=272519&r2=272520&view=diff
==
--- cfe/trunk/include/clang/Frontend/CompilerInstance.h (original)
+++ cfe/trunk/include/clang/Frontend/CompilerInstance.h Sun Jun 12 15:05:23 2016
@@ -380,7 +380,7 @@ public:
   /// \note Most clients should use setFileManager, which will implicitly reset
   /// the virtual file system to the one contained in the file manager.
   void setVirtualFileSystem(IntrusiveRefCntPtr FS) {
-VirtualFileSystem = FS;
+VirtualFileSystem = std::move(FS);
   }
 
   /// }

Modified: cfe/trunk/include/clang/Frontend/TextDiagnosticPrinter.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/TextDiagnosticPrinter.h?rev=272520&r1=272519&r2=272520&view=diff
==
--- cfe/trunk/include/clang/Frontend/TextDiagnosticPrinter.h (original)
+++ cfe/trunk/include/clang/Frontend/TextDiagnosticPrinter.h Sun Jun 12 
15:05:23 2016
@@ -45,7 +45,7 @@ public:
   /// setPrefix - Set the diagnostic printer prefix string, which will be
   /// printed at the start of any diagnostics. If empty, no prefix string is
   /// used.
-  void setPrefix(std::string Value) { Prefix = Value; }
+  void setPrefix(std::string Value) { Prefix = std::move(Value); }
 
   void BeginSourceFile(const LangOptions &LO, const Preprocessor *PP) override;
   void EndSourceFile() override;

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=272520&r1=272519&r2=272520&view=diff
==
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Sun Jun 12 15:05:23 2016
@@ -816,7 +816,7 @@ void ASTContext::AddDeallocation(void (*
 
 void
 ASTContext::setExternalSource(IntrusiveRefCntPtr Source) {
-  ExternalSource = Source;
+  ExternalSource = std::move(Source);
 }
 
 void ASTContext::PrintStats() const {

Modified: cfe/trunk/lib/Basic/VirtualFileSystem.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/VirtualFileSystem.cpp?rev=272520&r1=272519&r2=272520&view=diff
==
--- cfe/trunk/lib/Basic/VirtualFileSystem.cpp (original)
+++ cfe/trunk/lib/Basic/VirtualFileSystem.cpp Sun Jun 12 15:05:23 2016
@@ -280,7 +280,7 @@ directory_iterator RealFileSystem::dir_b
 // OverlayFileSystem implementation
 
//

[PATCH] D21270: clang-rename: implement handling of remaining named casts

2016-06-12 Thread Miklos Vajna via cfe-commits
vmiklos created this revision.
vmiklos added a reviewer: klimek.
vmiklos added a subscriber: cfe-commits.

const_cast<> and reinterpret_cast<>.

http://reviews.llvm.org/D21270

Files:
  clang-rename/USRLocFinder.cpp
  test/clang-rename/ConstCastExpr.cpp
  test/clang-rename/ReinterpretCastExpr.cpp

Index: test/clang-rename/ReinterpretCastExpr.cpp
===
--- /dev/null
+++ test/clang-rename/ReinterpretCastExpr.cpp
@@ -0,0 +1,17 @@
+// RUN: cat %s > %t.cpp
+// RUN: clang-rename -offset=133 -new-name=X %t.cpp -i --
+// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s
+class Cla {
+public:
+  int getValue() const {
+return 0;
+  }
+};
+
+int main() {
+  void *C = new Cla();
+  reinterpret_cast(C)->getValue(); // CHECK: 
reinterpret_cast
+}
+
+// Use grep -FUbo 'Cla'  to get the correct offset of foo when changing
+// this file.
Index: test/clang-rename/ConstCastExpr.cpp
===
--- /dev/null
+++ test/clang-rename/ConstCastExpr.cpp
@@ -0,0 +1,17 @@
+// RUN: cat %s > %t.cpp
+// RUN: clang-rename -offset=133 -new-name=X %t.cpp -i --
+// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s
+class Cla {
+public:
+  int getValue() {
+return 0;
+  }
+};
+
+int main() {
+  const Cla *C = new Cla();
+  const_cast(C)->getValue(); // CHECK: const_cast
+}
+
+// Use grep -FUbo 'Cla'  to get the correct offset of foo when changing
+// this file.
Index: clang-rename/USRLocFinder.cpp
===
--- clang-rename/USRLocFinder.cpp
+++ clang-rename/USRLocFinder.cpp
@@ -131,6 +131,14 @@
 return handleCXXNamedCastExpr(Expr);
   }
 
+  bool VisitCXXReinterpretCastExpr(clang::CXXReinterpretCastExpr *Expr) {
+return handleCXXNamedCastExpr(Expr);
+  }
+
+  bool VisitCXXConstCastExpr(clang::CXXConstCastExpr *Expr) {
+return handleCXXNamedCastExpr(Expr);
+  }
+
   // Non-visitors:
 
   // \brief Returns a list of unique locations. Duplicate or overlapping


Index: test/clang-rename/ReinterpretCastExpr.cpp
===
--- /dev/null
+++ test/clang-rename/ReinterpretCastExpr.cpp
@@ -0,0 +1,17 @@
+// RUN: cat %s > %t.cpp
+// RUN: clang-rename -offset=133 -new-name=X %t.cpp -i --
+// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s
+class Cla {
+public:
+  int getValue() const {
+return 0;
+  }
+};
+
+int main() {
+  void *C = new Cla();
+  reinterpret_cast(C)->getValue(); // CHECK: reinterpret_cast
+}
+
+// Use grep -FUbo 'Cla'  to get the correct offset of foo when changing
+// this file.
Index: test/clang-rename/ConstCastExpr.cpp
===
--- /dev/null
+++ test/clang-rename/ConstCastExpr.cpp
@@ -0,0 +1,17 @@
+// RUN: cat %s > %t.cpp
+// RUN: clang-rename -offset=133 -new-name=X %t.cpp -i --
+// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s
+class Cla {
+public:
+  int getValue() {
+return 0;
+  }
+};
+
+int main() {
+  const Cla *C = new Cla();
+  const_cast(C)->getValue(); // CHECK: const_cast
+}
+
+// Use grep -FUbo 'Cla'  to get the correct offset of foo when changing
+// this file.
Index: clang-rename/USRLocFinder.cpp
===
--- clang-rename/USRLocFinder.cpp
+++ clang-rename/USRLocFinder.cpp
@@ -131,6 +131,14 @@
 return handleCXXNamedCastExpr(Expr);
   }
 
+  bool VisitCXXReinterpretCastExpr(clang::CXXReinterpretCastExpr *Expr) {
+return handleCXXNamedCastExpr(Expr);
+  }
+
+  bool VisitCXXConstCastExpr(clang::CXXConstCastExpr *Expr) {
+return handleCXXNamedCastExpr(Expr);
+  }
+
   // Non-visitors:
 
   // \brief Returns a list of unique locations. Duplicate or overlapping
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21081: MPI-Checker patch for Clang Static Analyzer

2016-06-12 Thread Alexander Droste via cfe-commits
Alexander_Droste added a comment.

Hi Devin,

this is much cleaner. Looks good for me!


http://reviews.llvm.org/D21081



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


[PATCH] D21272: [Clang][X86] Convert non-temporal store builtins to generic __builtin_nontemporal_store in headers

2016-06-12 Thread Simon Pilgrim via cfe-commits
RKSimon created this revision.
RKSimon added reviewers: craig.topper, ab, spatel, andreadb.
RKSimon added a subscriber: cfe-commits.
RKSimon set the repository for this revision to rL LLVM.

As discussed on D20358, we can now use __builtin_nontemporal_store instead of 
target specific builtins for naturally aligned nontemporal stores which avoids 
the need for handling in CGBuiltin.cpp

The scalar integer nontemporal (unaligned) store builtins will have to wait as 
__builtin_nontemporal_store currently assumes natural alignment and doesn't 
accept the 'packed struct' trick that we use for normal unaligned load/stores.

NOTE: The nontemporal loads require further backend support before we can 
safely convert them to __builtin_nontemporal_load

Repository:
  rL LLVM

http://reviews.llvm.org/D21272

Files:
  include/clang/Basic/BuiltinsX86.def
  lib/CodeGen/CGBuiltin.cpp
  lib/Headers/avx512fintrin.h
  lib/Headers/avxintrin.h
  lib/Headers/emmintrin.h
  lib/Headers/xmmintrin.h
  test/CodeGen/avx512f-builtins.c
  test/CodeGen/builtins-x86.c

Index: test/CodeGen/builtins-x86.c
===
--- test/CodeGen/builtins-x86.c
+++ test/CodeGen/builtins-x86.c
@@ -300,7 +300,6 @@
   (void) __builtin_ia32_storelps(tmp_V2ip, tmp_V4f);
   tmp_i = __builtin_ia32_movmskps(tmp_V4f);
   tmp_i = __builtin_ia32_pmovmskb(tmp_V8c);
-  (void) __builtin_ia32_movntps(tmp_fp, tmp_V4f);
   (void) __builtin_ia32_movntq(tmp_V1LLip, tmp_V1LLi);
   (void) __builtin_ia32_sfence();
 
@@ -318,8 +317,6 @@
 #ifdef USE_64
   (void) __builtin_ia32_movnti64(tmp_LLip, tmp_LLi);
 #endif
-  (void) __builtin_ia32_movntpd(tmp_dp, tmp_V2d);
-  (void) __builtin_ia32_movntdq(tmp_V2LLip, tmp_V2LLi);
   tmp_V2LLi = __builtin_ia32_psadbw128(tmp_V16c, tmp_V16c);
   tmp_V2d = __builtin_ia32_sqrtpd(tmp_V2d);
   tmp_V2d = __builtin_ia32_sqrtsd(tmp_V2d);
@@ -446,9 +443,6 @@
   tmp_V4d = __builtin_ia32_vbroadcastf128_pd256(tmp_V2dCp);
   tmp_V8f = __builtin_ia32_vbroadcastf128_ps256(tmp_V4fCp);
   tmp_V32c = __builtin_ia32_lddqu256(tmp_cCp);
-  __builtin_ia32_movntdq256(tmp_V4LLip, tmp_V4LLi);
-  __builtin_ia32_movntpd256(tmp_dp, tmp_V4d);
-  __builtin_ia32_movntps256(tmp_fp, tmp_V8f);
   tmp_V2d = __builtin_ia32_maskloadpd(tmp_V2dCp, tmp_V2LLi);
   tmp_V4f = __builtin_ia32_maskloadps(tmp_V4fCp, tmp_V4i);
   tmp_V4d = __builtin_ia32_maskloadpd256(tmp_V4dCp, tmp_V4LLi);
Index: test/CodeGen/avx512f-builtins.c
===
--- test/CodeGen/avx512f-builtins.c
+++ test/CodeGen/avx512f-builtins.c
@@ -5800,7 +5800,7 @@
 
 void test_mm512_stream_si512(__m512i * __P, __m512i __A) {
   // CHECK-LABEL: @test_mm512_stream_si512
-  // CHECK: @llvm.x86.avx512.storent.q.512
+  // CHECK: store <8 x i64> %{{.*}}, <8 x i64>* %{{.*}}, align 64, !nontemporal
   _mm512_stream_si512(__P, __A); 
 }
 
@@ -5812,13 +5812,13 @@
 
 void test_mm512_stream_pd(double *__P, __m512d __A) {
   // CHECK-LABEL: @test_mm512_stream_pd
-  // CHECK: @llvm.x86.avx512.storent.pd.512
+  // CHECK: store <8 x double> %{{.*}}, <8 x double>* %{{.*}}, align 64, !nontemporal
   return _mm512_stream_pd(__P, __A); 
 }
 
 void test_mm512_stream_ps(float *__P, __m512 __A) {
   // CHECK-LABEL: @test_mm512_stream_ps
-  // CHECK: @llvm.x86.avx512.storent.ps.512
+  // CHECK: store <16 x float> %{{.*}}, <16 x float>* %{{.*}}, align 64, !nontemporal
   _mm512_stream_ps(__P, __A); 
 }
 
Index: lib/Headers/xmmintrin.h
===
--- lib/Headers/xmmintrin.h
+++ lib/Headers/xmmintrin.h
@@ -2080,7 +2080,7 @@
 static __inline__ void __DEFAULT_FN_ATTRS
 _mm_stream_ps(float *__p, __m128 __a)
 {
-  __builtin_ia32_movntps(__p, (__v4sf)__a);
+  __builtin_nontemporal_store((__v4sf)__a, (__v4sf*)__p);
 }
 
 /// \brief Forces strong memory ordering (serialization) between store
Index: lib/Headers/emmintrin.h
===
--- lib/Headers/emmintrin.h
+++ lib/Headers/emmintrin.h
@@ -2210,13 +2210,13 @@
 static __inline__ void __DEFAULT_FN_ATTRS
 _mm_stream_pd(double *__p, __m128d __a)
 {
-  __builtin_ia32_movntpd(__p, (__v2df)__a);
+  __builtin_nontemporal_store((__v2df)__a, (__v2df*)__p);
 }
 
 static __inline__ void __DEFAULT_FN_ATTRS
 _mm_stream_si128(__m128i *__p, __m128i __a)
 {
-  __builtin_ia32_movntdq(__p, (__v2di)__a);
+  __builtin_nontemporal_store((__v2di)__a, (__v2di*)__p);
 }
 
 static __inline__ void __DEFAULT_FN_ATTRS
Index: lib/Headers/avxintrin.h
===
--- lib/Headers/avxintrin.h
+++ lib/Headers/avxintrin.h
@@ -2496,19 +2496,19 @@
 static __inline void __DEFAULT_FN_ATTRS
 _mm256_stream_si256(__m256i *__a, __m256i __b)
 {
-  __builtin_ia32_movntdq256((__v4di *)__a, (__v4di)__b);
+  __builtin_nontemporal_store((__v4di)__b, (__v4di*)__a);
 }
 
 static __inline void __DEFAULT_FN_ATTRS
 _mm256_stream_pd(double *__a, __m256d __b)
 {
-  __builtin_ia

Re: [PATCH] D20358: [Clang][AVX512][Intrinsics]Convert AVX non-temporal store builtins to LLVM-native IR.

2016-06-12 Thread Simon Pilgrim via cfe-commits
RKSimon added a comment.

In http://reviews.llvm.org/D20358#446241, @RKSimon wrote:

> In http://reviews.llvm.org/D20358#446220, @ab wrote:
>
> > In http://reviews.llvm.org/D20358#446218, @ab wrote:
> >
> > > In http://reviews.llvm.org/D20358#446210, @RKSimon wrote:
> > >
> > > > Is there any reason why we can't just get rid of all the SSE movnt 
> > > > builtins and use __builtin_nontemporal_store instead 
> > > > (http://reviews.llvm.org/D12313)?
> > >
> > >
> > > I wanted to suggest that too, but I think you'd have problems with the 
> > > (natural?) alignment requirement of __builtin_nontemporal_store (whereas 
> > > IIRC, movnti & friends accept unaligned pointers).
> >
> >
> > But now that I look at this again, I suppose we could have some 
> > __attribute__((aligned(1))), or something like r271214.
>
>
> True, luckily that only affects _mm_stream_si32 and _mm_stream_si64 - the 
> 'real' vector movnt stores all require type alignment. The _mm_stream_load_* 
> (movntdqa) loads cases should be trivial as well.


I've created http://reviews.llvm.org/D21272 that covers the conversion of 
SSE/SSE2/AVX/AVX512 non-temporal aligned vector stores to use 
__builtin_nontemporal_store in headers


http://reviews.llvm.org/D20358



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


r272521 - Visual Studio native visualizer for ParsedTemplateArgument

2016-06-12 Thread Mike Spertus via cfe-commits
Author: mps
Date: Sun Jun 12 17:21:56 2016
New Revision: 272521

URL: http://llvm.org/viewvc/llvm-project?rev=272521&view=rev
Log:
Visual Studio native visualizer for ParsedTemplateArgument

Does a good job with type and non-type template arguments
and lays the groundwork for template template arguments to
visualize well once there is a TemplateName visualizer.
Also fixed what looks like an incorrect comment in the
header for ParsedTemplate.h.

Modified:
cfe/trunk/include/clang/Sema/ParsedTemplate.h
cfe/trunk/utils/ClangVisualizers/clang.natvis

Modified: cfe/trunk/include/clang/Sema/ParsedTemplate.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/ParsedTemplate.h?rev=272521&r1=272520&r2=272521&view=diff
==
--- cfe/trunk/include/clang/Sema/ParsedTemplate.h (original)
+++ cfe/trunk/include/clang/Sema/ParsedTemplate.h Sun Jun 12 17:21:56 2016
@@ -121,8 +121,8 @@ namespace clang {
 KindType Kind;
 
 /// \brief The actual template argument representation, which may be
-/// an \c ActionBase::TypeTy* (for a type), an Expr* (for an
-/// expression), or an ActionBase::TemplateTy (for a template).
+/// an \c Sema::TypeTy* (for a type), an Expr* (for an
+/// expression), or an Sema::TemplateTy (for a template).
 void *Arg;
 
 /// \brief The nested-name-specifier that can accompany a template template

Modified: cfe/trunk/utils/ClangVisualizers/clang.natvis
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/ClangVisualizers/clang.natvis?rev=272521&r1=272520&r2=272521&view=diff
==
--- cfe/trunk/utils/ClangVisualizers/clang.natvis (original)
+++ cfe/trunk/utils/ClangVisualizers/clang.natvis Sun Jun 12 17:21:56 2016
@@ -309,6 +309,17 @@ For later versions of Visual Studio, no
   TemplateArgumentLists
 
   
+  
+Type 
template argument: {*(clang::QualType *)Arg}
+Non-type template 
argument: {*(clang::Expr *)Arg}
+Template template 
argument: {*(clang::TemplateName *)Arg
+
+  Kind,en
+  (clang::QualType 
*)Arg
+  (clang::Expr 
*)Arg
+  (clang::TemplateName 
*)Arg
+
+  
   
   
 void


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


r272522 - Visual Studio Visualizer for PackExpansionType

2016-06-12 Thread Mike Spertus via cfe-commits
Author: mps
Date: Sun Jun 12 17:54:46 2016
New Revision: 272522

URL: http://llvm.org/viewvc/llvm-project?rev=272522&view=rev
Log:
Visual Studio Visualizer for PackExpansionType

Modified:
cfe/trunk/utils/ClangVisualizers/clang.natvis

Modified: cfe/trunk/utils/ClangVisualizers/clang.natvis
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/ClangVisualizers/clang.natvis?rev=272522&r1=272521&r2=272522&view=diff
==
--- cfe/trunk/utils/ClangVisualizers/clang.natvis (original)
+++ cfe/trunk/utils/ClangVisualizers/clang.natvis Sun Jun 12 17:54:46 2016
@@ -35,6 +35,7 @@ For later versions of Visual Studio, no
 {*(clang::FunctionProtoType *)this}
 {*(clang::TemplateSpecializationType *)this}
 {*(clang::InjectedClassNameType *)this}
+{*(clang::PackExpansionType *)this}
 {*(clang::LocInfoType *)this}
 {*this,view(poly)}
 {*this,view(cmn)} 
@@ -54,6 +55,7 @@ For later versions of Visual Studio, no
   (clang::FunctionProtoType
 *)this
   (clang::TemplateSpecializationType
 *)this
   (clang::InjectedClassNameType
 *)this
+  (clang::PackExpansionType
 *)this
   (clang::LocInfoType 
*)this
 
   
@@ -208,6 +210,14 @@ For later versions of Visual Studio, no
   *(clang::Type *)this, view(cmn)
 
   
+  
+{Pattern}
+
+  Pattern
+  NumExpansions
+  *(clang::Type *)this, view(cmn)
+
+  
   
 
 {*((clang::ExtQualsTypeCommonBase 
*)(((uintptr_t)Value.Value) & ~(uintptr_t)((1 << 4) - 
1)))->BaseType,view(poly)}{*this,view(fastQuals)}


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


Re: [PATCH] D21241: Add an ASTMatcher for ignoring ExprWithCleanups.

2016-06-12 Thread Aaron Ballman via cfe-commits
aaron.ballman added a subscriber: aaron.ballman.
aaron.ballman added a reviewer: aaron.ballman.
aaron.ballman added a comment.

Also, please add documentation to the matcher definition and regenerate the 
documentation.


http://reviews.llvm.org/D21241



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


Re: [PATCH] D21145: [Sema] Fix crash on valid where instantiation of lambda cannot access type of 'this'

2016-06-12 Thread Faisal Vali via cfe-commits
faisalv added a comment.

Hmm - after having given this some more thought - I'm not as confident about 
the best approach.  Should we leverage the CXXThisTypeOverride mechanism (as 
you had done in your initial patch) - and remove the computation entirely from 
getCurrentThisType - or just remove CXXThisTypeOverride entirely and have 
getCurrentThisType be smart enough to always figure out the 'this' type? 
Admittedly, my slight bias is to smarty-pantify getCurrentThisType (and just 
remove CXXThisTypeOverride if we can do it for all cases) - but I'd be 
interested in the counterarguments against that.  Does it really make sense to 
leverage and maintain both approaches within the code-base?

Richard you have any thoughts on this (pun ;)?

Apologies Erik, for the waffle here - and thanks again for putting time into it.



Comment at: lib/Sema/SemaExprCXX.cpp:971
@@ +970,3 @@
+  !ActiveTemplateInstantiations.empty()) {
+
+// This is a lambda call operator that is being instantiated as a default

I wonder if we could just check that 'DC' is a CXXRecordDecl  and just use it 
(so avoid computing it again below)?


http://reviews.llvm.org/D21145



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


r272524 - clang-format: [JS] post-fix non-null assertion operator.

2016-06-12 Thread Martin Probst via cfe-commits
Author: mprobst
Date: Sun Jun 12 19:49:54 2016
New Revision: 272524

URL: http://llvm.org/viewvc/llvm-project?rev=272524&view=rev
Log:
clang-format: [JS] post-fix non-null assertion operator.

Summary:
Do not insert whitespace preceding the "!" postfix operator. This is an
incomplete fix, but should cover common usage.

Reviewers: djasper

Subscribers: cfe-commits, klimek

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

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

Modified: cfe/trunk/lib/Format/TokenAnnotator.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/TokenAnnotator.cpp?rev=272524&r1=272523&r2=272524&view=diff
==
--- cfe/trunk/lib/Format/TokenAnnotator.cpp (original)
+++ cfe/trunk/lib/Format/TokenAnnotator.cpp Sun Jun 12 19:49:54 2016
@@ -2126,6 +2126,11 @@ bool TokenAnnotator::spaceRequiredBefore
   // locations that should have whitespace following are identified by the
   // above set of follower tokens.
   return false;
+// Postfix non-null assertion operator, as in `foo!.bar()`.
+if (Right.is(tok::exclaim) && (Left.isOneOf(tok::identifier, tok::r_paren,
+tok::r_square, tok::r_brace) ||
+   Left.Tok.isLiteral()))
+  return false;
   } else if (Style.Language == FormatStyle::LK_Java) {
 if (Left.is(tok::r_square) && Right.is(tok::l_brace))
   return true;

Modified: cfe/trunk/unittests/Format/FormatTestJS.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTestJS.cpp?rev=272524&r1=272523&r2=272524&view=diff
==
--- cfe/trunk/unittests/Format/FormatTestJS.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTestJS.cpp Sun Jun 12 19:49:54 2016
@@ -1293,5 +1293,14 @@ TEST_F(FormatTestJS, SupportShebangLines
"var x   =  hello();");
 }
 
+TEST_F(FormatTestJS, NonNullAssertionOperator) {
+  verifyFormat("let x = foo!.bar();\n");
+  verifyFormat("let x = foo ? bar! : baz;\n");
+  verifyFormat("let x = !foo;\n");
+  verifyFormat("let x = foo[0]!;\n");
+  verifyFormat("let x = (foo)!;\n");
+  verifyFormat("let x = {foo: 1}!;\n");
+}
+
 } // end namespace tooling
 } // end namespace clang


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


Re: [PATCH] D21204: clang-format: [JS] post-fix non-null assertion operator.

2016-06-12 Thread Martin Probst via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL272524: clang-format: [JS] post-fix non-null assertion 
operator. (authored by mprobst).

Changed prior to commit:
  http://reviews.llvm.org/D21204?vs=60311&id=60482#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D21204

Files:
  cfe/trunk/lib/Format/TokenAnnotator.cpp
  cfe/trunk/unittests/Format/FormatTestJS.cpp

Index: cfe/trunk/lib/Format/TokenAnnotator.cpp
===
--- cfe/trunk/lib/Format/TokenAnnotator.cpp
+++ cfe/trunk/lib/Format/TokenAnnotator.cpp
@@ -2126,6 +2126,11 @@
   // locations that should have whitespace following are identified by the
   // above set of follower tokens.
   return false;
+// Postfix non-null assertion operator, as in `foo!.bar()`.
+if (Right.is(tok::exclaim) && (Left.isOneOf(tok::identifier, tok::r_paren,
+tok::r_square, tok::r_brace) ||
+   Left.Tok.isLiteral()))
+  return false;
   } else if (Style.Language == FormatStyle::LK_Java) {
 if (Left.is(tok::r_square) && Right.is(tok::l_brace))
   return true;
Index: cfe/trunk/unittests/Format/FormatTestJS.cpp
===
--- cfe/trunk/unittests/Format/FormatTestJS.cpp
+++ cfe/trunk/unittests/Format/FormatTestJS.cpp
@@ -1293,5 +1293,14 @@
"var x   =  hello();");
 }
 
+TEST_F(FormatTestJS, NonNullAssertionOperator) {
+  verifyFormat("let x = foo!.bar();\n");
+  verifyFormat("let x = foo ? bar! : baz;\n");
+  verifyFormat("let x = !foo;\n");
+  verifyFormat("let x = foo[0]!;\n");
+  verifyFormat("let x = (foo)!;\n");
+  verifyFormat("let x = {foo: 1}!;\n");
+}
+
 } // end namespace tooling
 } // end namespace clang


Index: cfe/trunk/lib/Format/TokenAnnotator.cpp
===
--- cfe/trunk/lib/Format/TokenAnnotator.cpp
+++ cfe/trunk/lib/Format/TokenAnnotator.cpp
@@ -2126,6 +2126,11 @@
   // locations that should have whitespace following are identified by the
   // above set of follower tokens.
   return false;
+// Postfix non-null assertion operator, as in `foo!.bar()`.
+if (Right.is(tok::exclaim) && (Left.isOneOf(tok::identifier, tok::r_paren,
+tok::r_square, tok::r_brace) ||
+   Left.Tok.isLiteral()))
+  return false;
   } else if (Style.Language == FormatStyle::LK_Java) {
 if (Left.is(tok::r_square) && Right.is(tok::l_brace))
   return true;
Index: cfe/trunk/unittests/Format/FormatTestJS.cpp
===
--- cfe/trunk/unittests/Format/FormatTestJS.cpp
+++ cfe/trunk/unittests/Format/FormatTestJS.cpp
@@ -1293,5 +1293,14 @@
"var x   =  hello();");
 }
 
+TEST_F(FormatTestJS, NonNullAssertionOperator) {
+  verifyFormat("let x = foo!.bar();\n");
+  verifyFormat("let x = foo ? bar! : baz;\n");
+  verifyFormat("let x = !foo;\n");
+  verifyFormat("let x = foo[0]!;\n");
+  verifyFormat("let x = (foo)!;\n");
+  verifyFormat("let x = {foo: 1}!;\n");
+}
+
 } // end namespace tooling
 } // end namespace clang
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21256: Improved Visual Studio 2015 visualization of SmallVectorImpl

2016-06-12 Thread Mike Spertus via cfe-commits
mspertus accepted this revision.
mspertus added a reviewer: mspertus.
mspertus added a comment.
This revision is now accepted and ready to land.

No adverse (or otherwise) comments received, so committing as revision 272525


http://reviews.llvm.org/D21256



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


[PATCH] D21273: clang-format: [JS] Introduce WrapJavaScriptImports option.

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

When turned on, clang-format wraps JavaScript imports (and importing exports),
instead of forcing the entire import statement onto one line.

http://reviews.llvm.org/D21273

Files:
  include/clang/Format/Format.h
  lib/Format/Format.cpp
  lib/Format/TokenAnnotator.cpp
  unittests/Format/FormatTestJS.cpp

Index: unittests/Format/FormatTestJS.cpp
===
--- unittests/Format/FormatTestJS.cpp
+++ unittests/Format/FormatTestJS.cpp
@@ -1078,6 +1078,27 @@
"}");
 }
 
+TEST_F(FormatTestJS, ImportWrapping) {
+  FormatStyle Style = getGoogleJSStyleWithColumns(80);
+  Style.WrapJavaScriptImports = true;
+  verifyFormat("import {\n"
+   "  VeryLongImportsAreAnnoying,\n"
+   "  VeryLongImportsAreAnnoying,\n"
+   "  VeryLongImportsAreAnnoying,\n"
+   "} from 'some/module.js';",
+   Style);
+  verifyFormat("import {\n"
+   "  A,\n"
+   "  A,\n"
+   "} from 'some/module.js';",
+   Style);
+  verifyFormat("export {\n"
+   "  A,\n"
+   "  A,\n"
+   "} from 'some/module.js';",
+   Style);
+}
+
 TEST_F(FormatTestJS, TemplateStrings) {
   // Keeps any whitespace/indentation within the template string.
   verifyFormat("var x = `hello\n"
Index: lib/Format/TokenAnnotator.cpp
===
--- lib/Format/TokenAnnotator.cpp
+++ lib/Format/TokenAnnotator.cpp
@@ -786,7 +786,7 @@
 
 // import {...} from '...';
 if (Style.Language == FormatStyle::LK_JavaScript &&
-CurrentToken->is(Keywords.kw_import))
+CurrentToken->is(Keywords.kw_import) && !Style.WrapJavaScriptImports)
   return LT_ImportStatement;
 
 bool KeywordVirtualFound = false;
@@ -804,7 +804,7 @@
 if (Line.First->is(tok::kw_export) &&
 CurrentToken->is(Keywords.kw_from) && CurrentToken->Next &&
 CurrentToken->Next->isStringLiteral())
-  ImportStatement = true;
+  ImportStatement = !Style.WrapJavaScriptImports;
 if (isClosureImportStatement(*CurrentToken))
   ImportStatement = true;
   }
Index: lib/Format/Format.cpp
===
--- lib/Format/Format.cpp
+++ lib/Format/Format.cpp
@@ -354,6 +354,7 @@
 IO.mapOptional("TabWidth", Style.TabWidth);
 IO.mapOptional("UseTab", Style.UseTab);
 IO.mapOptional("JavaScriptQuotes", Style.JavaScriptQuotes);
+IO.mapOptional("WrapJavaScriptImports", Style.WrapJavaScriptImports);
   }
 };
 
@@ -613,6 +614,7 @@
 GoogleStyle.MaxEmptyLinesToKeep = 3;
 GoogleStyle.SpacesInContainerLiterals = false;
 GoogleStyle.JavaScriptQuotes = FormatStyle::JSQS_Single;
+GoogleStyle.WrapJavaScriptImports = false;
   } else if (Language == FormatStyle::LK_Proto) {
 GoogleStyle.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_None;
 GoogleStyle.SpacesInContainerLiterals = false;
Index: include/clang/Format/Format.h
===
--- include/clang/Format/Format.h
+++ include/clang/Format/Format.h
@@ -627,6 +627,9 @@
   /// \brief The JavaScriptQuoteStyle to use for JavaScript strings.
   JavaScriptQuoteStyle JavaScriptQuotes;
 
+  /// \brief Whether to wrap JavaScript import/export statements.
+  bool WrapJavaScriptImports;
+
   bool operator==(const FormatStyle &R) const {
 return AccessModifierOffset == R.AccessModifierOffset &&
AlignAfterOpenBracket == R.AlignAfterOpenBracket &&


Index: unittests/Format/FormatTestJS.cpp
===
--- unittests/Format/FormatTestJS.cpp
+++ unittests/Format/FormatTestJS.cpp
@@ -1078,6 +1078,27 @@
"}");
 }
 
+TEST_F(FormatTestJS, ImportWrapping) {
+  FormatStyle Style = getGoogleJSStyleWithColumns(80);
+  Style.WrapJavaScriptImports = true;
+  verifyFormat("import {\n"
+   "  VeryLongImportsAreAnnoying,\n"
+   "  VeryLongImportsAreAnnoying,\n"
+   "  VeryLongImportsAreAnnoying,\n"
+   "} from 'some/module.js';",
+   Style);
+  verifyFormat("import {\n"
+   "  A,\n"
+   "  A,\n"
+   "} from 'some/module.js';",
+   Style);
+  verifyFormat("export {\n"
+   "  A,\n"
+   "  A,\n"
+   "} from 'some/module.js';",
+   Style);
+}
+
 TEST_F(FormatTestJS, TemplateStrings) {
   // Keeps any whitespace/indentation within the template string.
   verifyFormat("var x = `hello\n"
Index: lib/Format/TokenAnnotator.cpp
===
--- lib/Format/TokenAnnotator.cpp
+++ lib/Format/TokenAnn

Re: [PATCH] D21256: Improved Visual Studio 2015 visualization of SmallVectorImpl

2016-06-12 Thread Mike Spertus via cfe-commits
mspertus closed this revision.
mspertus added a comment.

revision 272525


http://reviews.llvm.org/D21256



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


r272529 - [analyzer] Add checker to verify the correct usage of the MPI API

2016-06-12 Thread Devin Coughlin via cfe-commits
Author: dcoughlin
Date: Sun Jun 12 22:22:41 2016
New Revision: 272529

URL: http://llvm.org/viewvc/llvm-project?rev=272529&view=rev
Log:
[analyzer] Add checker to verify the correct usage of the MPI API

This commit adds a static analysis checker to verify the correct usage of the 
MPI API in C
and C++. This version updates the reverted r271981 to fix a memory corruption 
found by the
ASan bots.

Three path-sensitive checks are included:
- Double nonblocking: Double request usage by nonblocking calls without 
intermediate wait
- Missing wait: Nonblocking call without matching wait.
- Unmatched wait: Waiting for a request that was never used by a nonblocking 
call

Examples of how to use the checker can be found at 
https://github.com/0ax1/MPI-Checker

A patch by Alexander Droste!

Reviewers: zaks.anna, dcoughlin

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

Added:
cfe/trunk/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIBugReporter.cpp
cfe/trunk/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIBugReporter.h
cfe/trunk/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIChecker.cpp
cfe/trunk/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIChecker.h
cfe/trunk/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIFunctionClassifier.cpp
cfe/trunk/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIFunctionClassifier.h
cfe/trunk/lib/StaticAnalyzer/Checkers/MPI-Checker/MPITypes.h
cfe/trunk/test/Analysis/MPIMock.h
cfe/trunk/test/Analysis/MemRegion.cpp
cfe/trunk/test/Analysis/mpichecker.cpp
cfe/trunk/test/Analysis/mpicheckernotes.cpp
Modified:
cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td
cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h
cfe/trunk/lib/StaticAnalyzer/Checkers/CMakeLists.txt
cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp

Modified: cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td?rev=272529&r1=272528&r2=272529&view=diff
==
--- cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td Sun Jun 12 
22:22:41 2016
@@ -72,6 +72,8 @@ def Containers : Package<"containers">,
 def LocalizabilityAlpha : Package<"localizability">, InPackage;
 def LocalizabilityOptIn : Package<"localizability">, InPackage;
 
+def MPI : Package<"mpi">, InPackage;
+
 def LLVM : Package<"llvm">;
 def Debug : Package<"debug">;
 
@@ -577,6 +579,12 @@ def PluralMisuseChecker : Checker<"Plura
   DescFile<"LocalizationChecker.cpp">;
 }
 
+let ParentPackage = MPI in {
+  def MPIChecker : Checker<"MPI-Checker">,
+  HelpText<"Checks MPI code">,
+  DescFile<"MPIChecker.cpp">;
+}
+
 
//===--===//
 // Checkers for LLVM development.
 
//===--===//

Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h?rev=272529&r1=272528&r2=272529&view=diff
==
--- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h 
(original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h Sun 
Jun 12 22:22:41 2016
@@ -150,6 +150,28 @@ public:
   template const RegionTy* getAs() const;
 
   virtual bool isBoundable() const { return false; }
+
+
+  /// Get descriptive name for memory region. The name is obtained from
+  /// the variable/field declaration retrieved from the memory region.
+  /// Regions that point to an element of an array are returned as: "arr[0]".
+  /// Regions that point to a struct are returned as: "st.var".
+  //
+  /// \param UseQuotes Set if the name should be quoted.
+  ///
+  /// \returns variable name for memory region
+  std::string getDescriptiveName(bool UseQuotes = true) const;
+
+
+  /// Retrieve source range from memory region. The range retrieval
+  /// is based on the decl obtained from the memory region.
+  /// For a VarRegion the range of the base region is returned.
+  /// For a FieldRegion the range of the field is returned.
+  /// If no declaration is found, an empty source range is returned.
+  /// The client is responsible for checking if the returned range is valid.
+  ///
+  /// \returns source range for declaration retrieved from memory region
+  clang::SourceRange sourceRange() const;
 };
 
 /// MemSpaceRegion - A memory region that represents a "memory space";

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/CMakeLists.txt?rev=272529&r1=272528&r2=272529&view=diff

Re: [PATCH] D21081: MPI-Checker patch for Clang Static Analyzer

2016-06-12 Thread Devin Coughlin via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL272529: [analyzer] Add checker to verify the correct usage 
of the MPI API (authored by dcoughlin).

Changed prior to commit:
  http://reviews.llvm.org/D21081?vs=60472&id=60486#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D21081

Files:
  cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td
  cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h
  cfe/trunk/lib/StaticAnalyzer/Checkers/CMakeLists.txt
  cfe/trunk/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIBugReporter.cpp
  cfe/trunk/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIBugReporter.h
  cfe/trunk/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIChecker.cpp
  cfe/trunk/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIChecker.h
  cfe/trunk/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIFunctionClassifier.cpp
  cfe/trunk/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIFunctionClassifier.h
  cfe/trunk/lib/StaticAnalyzer/Checkers/MPI-Checker/MPITypes.h
  cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp
  cfe/trunk/test/Analysis/MPIMock.h
  cfe/trunk/test/Analysis/MemRegion.cpp
  cfe/trunk/test/Analysis/mpichecker.cpp
  cfe/trunk/test/Analysis/mpicheckernotes.cpp

Index: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h
===
--- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h
@@ -150,6 +150,28 @@
   template const RegionTy* getAs() const;
 
   virtual bool isBoundable() const { return false; }
+
+
+  /// Get descriptive name for memory region. The name is obtained from
+  /// the variable/field declaration retrieved from the memory region.
+  /// Regions that point to an element of an array are returned as: "arr[0]".
+  /// Regions that point to a struct are returned as: "st.var".
+  //
+  /// \param UseQuotes Set if the name should be quoted.
+  ///
+  /// \returns variable name for memory region
+  std::string getDescriptiveName(bool UseQuotes = true) const;
+
+
+  /// Retrieve source range from memory region. The range retrieval
+  /// is based on the decl obtained from the memory region.
+  /// For a VarRegion the range of the base region is returned.
+  /// For a FieldRegion the range of the field is returned.
+  /// If no declaration is found, an empty source range is returned.
+  /// The client is responsible for checking if the returned range is valid.
+  ///
+  /// \returns source range for declaration retrieved from memory region
+  clang::SourceRange sourceRange() const;
 };
 
 /// MemSpaceRegion - A memory region that represents a "memory space";
Index: cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td
===
--- cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td
+++ cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td
@@ -72,6 +72,8 @@
 def LocalizabilityAlpha : Package<"localizability">, InPackage;
 def LocalizabilityOptIn : Package<"localizability">, InPackage;
 
+def MPI : Package<"mpi">, InPackage;
+
 def LLVM : Package<"llvm">;
 def Debug : Package<"debug">;
 
@@ -577,6 +579,12 @@
   DescFile<"LocalizationChecker.cpp">;
 }
 
+let ParentPackage = MPI in {
+  def MPIChecker : Checker<"MPI-Checker">,
+  HelpText<"Checks MPI code">,
+  DescFile<"MPIChecker.cpp">;
+}
+
 //===--===//
 // Checkers for LLVM development.
 //===--===//
Index: cfe/trunk/test/Analysis/MemRegion.cpp
===
--- cfe/trunk/test/Analysis/MemRegion.cpp
+++ cfe/trunk/test/Analysis/MemRegion.cpp
@@ -0,0 +1,47 @@
+// RUN: %clang_cc1 -analyze -analyzer-checker=optin.mpi.MPI-Checker -verify %s
+
+#include "MPIMock.h"
+
+// Use MPI-Checker to test 'getDescriptiveName', as the checker uses the
+// function for diagnostics.
+void testGetDescriptiveName() {
+  int rank = 0;
+  MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+  MPI_Request sendReq1;
+  MPI_Wait(&sendReq1, MPI_STATUS_IGNORE); // expected-warning{{Request 'sendReq1' has no matching nonblocking call.}}
+}
+
+void testGetDescriptiveName2() {
+  int rank = 0;
+  MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+  MPI_Request sendReq1[10][10][10];
+  MPI_Wait(&sendReq1[1][7][9], MPI_STATUS_IGNORE); // expected-warning{{Request 'sendReq1[1][7][9]' has no matching nonblocking call.}}
+}
+
+void testGetDescriptiveName3() {
+  int rank = 0;
+  MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+  typedef struct { MPI_Request req; } ReqStruct;
+  ReqStruct rs;
+  MPI_Request *r = &rs.req;
+  MPI_Wait(r, MPI_STATUS_IGNORE); // expected-warning{{Request 'rs.req' has no matching nonblocking call.}}
+}
+
+void testGetDescriptiveName4() {
+  int rank = 0;
+  MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+  typedef struct { 

r272530 - [analyzer] Remove some list initialization from MPI Checker to make MSVC bots happy.

2016-06-12 Thread Devin Coughlin via cfe-commits
Author: dcoughlin
Date: Sun Jun 12 22:58:58 2016
New Revision: 272530

URL: http://llvm.org/viewvc/llvm-project?rev=272530&view=rev
Log:
[analyzer] Remove some list initialization from MPI Checker to make MSVC bots 
happy.

This is a speculative attempt to fix the compiler error: "list initialization 
inside
member initializer list or non-static data member initializer is not 
implemented" with
r272529.

Modified:
cfe/trunk/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIBugReporter.h
cfe/trunk/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIFunctionClassifier.h

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIBugReporter.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIBugReporter.h?rev=272530&r1=272529&r2=272530&view=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIBugReporter.h 
(original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIBugReporter.h Sun Jun 
12 22:58:58 2016
@@ -71,7 +71,7 @@ public:
BugReporter &BReporter) const;
 
 private:
-  const std::string MPIError{"MPI Error"};
+  const std::string MPIError = "MPI Error";
 
   // path-sensitive bug types
   std::unique_ptr UnmatchedWaitBugType;
@@ -84,7 +84,7 @@ private:
   public:
 RequestNodeVisitor(const MemRegion *const MemoryRegion,
const std::string &ErrText)
-: RequestRegion(MemoryRegion), ErrorText{ErrText} {}
+: RequestRegion(MemoryRegion), ErrorText(ErrText) {}
 
 void Profile(llvm::FoldingSetNodeID &ID) const override {
   static int X = 0;
@@ -99,7 +99,7 @@ private:
 
   private:
 const MemRegion *const RequestRegion;
-bool IsNodeFound{false};
+bool IsNodeFound = false;
 std::string ErrorText;
   };
 };

Modified: 
cfe/trunk/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIFunctionClassifier.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIFunctionClassifier.h?rev=272530&r1=272529&r2=272530&view=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIFunctionClassifier.h 
(original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIFunctionClassifier.h 
Sun Jun 12 22:58:58 2016
@@ -68,26 +68,26 @@ private:
   llvm::SmallVector MPIType;
 
   // point-to-point functions
-  IdentifierInfo *IdentInfo_MPI_Send{nullptr}, *IdentInfo_MPI_Isend{nullptr},
-  *IdentInfo_MPI_Ssend{nullptr}, *IdentInfo_MPI_Issend{nullptr},
-  *IdentInfo_MPI_Bsend{nullptr}, *IdentInfo_MPI_Ibsend{nullptr},
-  *IdentInfo_MPI_Rsend{nullptr}, *IdentInfo_MPI_Irsend{nullptr},
-  *IdentInfo_MPI_Recv{nullptr}, *IdentInfo_MPI_Irecv{nullptr};
+  IdentifierInfo *IdentInfo_MPI_Send = nullptr, *IdentInfo_MPI_Isend = nullptr,
+  *IdentInfo_MPI_Ssend = nullptr, *IdentInfo_MPI_Issend = nullptr,
+  *IdentInfo_MPI_Bsend = nullptr, *IdentInfo_MPI_Ibsend = nullptr,
+  *IdentInfo_MPI_Rsend = nullptr, *IdentInfo_MPI_Irsend = nullptr,
+  *IdentInfo_MPI_Recv = nullptr, *IdentInfo_MPI_Irecv = nullptr;
 
   // collective functions
-  IdentifierInfo *IdentInfo_MPI_Scatter{nullptr},
-  *IdentInfo_MPI_Iscatter{nullptr}, *IdentInfo_MPI_Gather{nullptr},
-  *IdentInfo_MPI_Igather{nullptr}, *IdentInfo_MPI_Allgather{nullptr},
-  *IdentInfo_MPI_Iallgather{nullptr}, *IdentInfo_MPI_Bcast{nullptr},
-  *IdentInfo_MPI_Ibcast{nullptr}, *IdentInfo_MPI_Reduce{nullptr},
-  *IdentInfo_MPI_Ireduce{nullptr}, *IdentInfo_MPI_Allreduce{nullptr},
-  *IdentInfo_MPI_Iallreduce{nullptr}, *IdentInfo_MPI_Alltoall{nullptr},
-  *IdentInfo_MPI_Ialltoall{nullptr}, *IdentInfo_MPI_Barrier{nullptr};
+  IdentifierInfo *IdentInfo_MPI_Scatter = nullptr,
+  *IdentInfo_MPI_Iscatter = nullptr, *IdentInfo_MPI_Gather = nullptr,
+  *IdentInfo_MPI_Igather = nullptr, *IdentInfo_MPI_Allgather = nullptr,
+  *IdentInfo_MPI_Iallgather = nullptr, *IdentInfo_MPI_Bcast = nullptr,
+  *IdentInfo_MPI_Ibcast = nullptr, *IdentInfo_MPI_Reduce = nullptr,
+  *IdentInfo_MPI_Ireduce = nullptr, *IdentInfo_MPI_Allreduce = nullptr,
+  *IdentInfo_MPI_Iallreduce = nullptr, *IdentInfo_MPI_Alltoall = nullptr,
+  *IdentInfo_MPI_Ialltoall = nullptr, *IdentInfo_MPI_Barrier = nullptr;
 
   // additional functions
-  IdentifierInfo *IdentInfo_MPI_Comm_rank{nullptr},
-  *IdentInfo_MPI_Comm_size{nullptr}, *IdentInfo_MPI_Wait{nullptr},
-  *IdentInfo_MPI_Waitall{nullptr};
+  IdentifierInfo *IdentInfo_MPI_Comm_rank = nullptr,
+  *IdentInfo_MPI_Comm_size = nullptr, *IdentInfo_MPI_Wait = nullptr,
+  *IdentInfo_MPI_Waitall = nullptr;
 };
 
 } // end of namespace: mpi


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


r272531 - Improved Visual Studio visualization of OpaquePtr

2016-06-12 Thread Mike Spertus via cfe-commits
Author: mps
Date: Sun Jun 12 23:02:35 2016
New Revision: 272531

URL: http://llvm.org/viewvc/llvm-project?rev=272531&view=rev
Log:
Improved Visual Studio visualization of OpaquePtr

Create a special visualizer for OpaquePtr because the 
standard visualizer doesn't work with OpaquePtr
due to QualType being heavily dependent on traits to be pointer-like.

Also, created an identical visualizer for UnionOpaquePtr

Modified:
cfe/trunk/utils/ClangVisualizers/clang.natvis

Modified: cfe/trunk/utils/ClangVisualizers/clang.natvis
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/ClangVisualizers/clang.natvis?rev=272531&r1=272530&r2=272531&view=diff
==
--- cfe/trunk/utils/ClangVisualizers/clang.natvis (original)
+++ cfe/trunk/utils/ClangVisualizers/clang.natvis Sun Jun 12 23:02:35 2016
@@ -485,10 +485,28 @@ For later versions of Visual Studio, no
   *(clang::Type *)this, view(cmn)
 
   
+  
+{*(clang::QualType *)this}
+
+  *(clang::QualType *)this
+
+  
+  
+{*(clang::QualType *)this}
+
+  *(clang::QualType *)this
+
+  
   
 {($T1 *)Ptr}
 
   ($T1 *)Ptr
+
+  
+  
+{($T1 *)Ptr}
+
+  ($T1 *)Ptr
 
   
   


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


r272532 - [AVX512] Masked pcmpeqd, pcmpeqq, pcmpgtd, and pcmpgtq don't require avx512bw, just avx512vl.

2016-06-12 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Sun Jun 12 23:15:11 2016
New Revision: 272532

URL: http://llvm.org/viewvc/llvm-project?rev=272532&view=rev
Log:
[AVX512] Masked pcmpeqd, pcmpeqq, pcmpgtd, and pcmpgtq don't require avx512bw, 
just avx512vl.

Modified:
cfe/trunk/include/clang/Basic/BuiltinsX86.def
cfe/trunk/lib/Headers/avx512vlintrin.h
cfe/trunk/test/CodeGen/avx512vl-builtins.c

Modified: cfe/trunk/include/clang/Basic/BuiltinsX86.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsX86.def?rev=272532&r1=272531&r2=272532&view=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Sun Jun 12 23:15:11 2016
@@ -939,12 +939,12 @@ TARGET_BUILTIN(__builtin_ia32_pcmpeqq512
 TARGET_BUILTIN(__builtin_ia32_pcmpeqw512_mask, "iV32sV32si", "", "avx512bw")
 
 TARGET_BUILTIN(__builtin_ia32_pcmpeqb256_mask, "iV32cV32ci", "", 
"avx512vl,avx512bw")
-TARGET_BUILTIN(__builtin_ia32_pcmpeqd256_mask, "cV8iV8ic", "", 
"avx512vl,avx512bw")
-TARGET_BUILTIN(__builtin_ia32_pcmpeqq256_mask, "cV4LLiV4LLic", "", 
"avx512vl,avx512bw")
+TARGET_BUILTIN(__builtin_ia32_pcmpeqd256_mask, "cV8iV8ic", "", "avx512vl")
+TARGET_BUILTIN(__builtin_ia32_pcmpeqq256_mask, "cV4LLiV4LLic", "", "avx512vl")
 TARGET_BUILTIN(__builtin_ia32_pcmpeqw256_mask, "sV16sV16ss", "", 
"avx512vl,avx512bw")
 TARGET_BUILTIN(__builtin_ia32_pcmpeqb128_mask, "sV16cV16cs", "", 
"avx512vl,avx512bw")
-TARGET_BUILTIN(__builtin_ia32_pcmpeqd128_mask, "cV4iV4ic", "", 
"avx512vl,avx512bw")
-TARGET_BUILTIN(__builtin_ia32_pcmpeqq128_mask, "cV2LLiV2LLic", "", 
"avx512vl,avx512bw")
+TARGET_BUILTIN(__builtin_ia32_pcmpeqd128_mask, "cV4iV4ic", "", "avx512vl")
+TARGET_BUILTIN(__builtin_ia32_pcmpeqq128_mask, "cV2LLiV2LLic", "", "avx512vl")
 TARGET_BUILTIN(__builtin_ia32_pcmpeqw128_mask, "cV8sV8sc", "", 
"avx512vl,avx512bw")
 
 TARGET_BUILTIN(__builtin_ia32_pcmpgtb512_mask, "LLiV64cV64cLLi", "", 
"avx512bw")
@@ -953,12 +953,12 @@ TARGET_BUILTIN(__builtin_ia32_pcmpgtq512
 TARGET_BUILTIN(__builtin_ia32_pcmpgtw512_mask, "iV32sV32si", "", "avx512bw")
 
 TARGET_BUILTIN(__builtin_ia32_pcmpgtb256_mask, "iV32cV32ci", "", 
"avx512vl,avx512bw")
-TARGET_BUILTIN(__builtin_ia32_pcmpgtd256_mask, "cV8iV8ic", "", 
"avx512vl,avx512bw")
-TARGET_BUILTIN(__builtin_ia32_pcmpgtq256_mask, "cV4LLiV4LLic", "", 
"avx512vl,avx512bw")
+TARGET_BUILTIN(__builtin_ia32_pcmpgtd256_mask, "cV8iV8ic", "", "avx512vl")
+TARGET_BUILTIN(__builtin_ia32_pcmpgtq256_mask, "cV4LLiV4LLic", "", "avx512vl")
 TARGET_BUILTIN(__builtin_ia32_pcmpgtw256_mask, "sV16sV16ss", "", 
"avx512vl,avx512bw")
 TARGET_BUILTIN(__builtin_ia32_pcmpgtb128_mask, "sV16cV16cs", "", 
"avx512vl,avx512bw")
-TARGET_BUILTIN(__builtin_ia32_pcmpgtd128_mask, "cV4iV4ic", "", 
"avx512vl,avx512bw")
-TARGET_BUILTIN(__builtin_ia32_pcmpgtq128_mask, "cV2LLiV2LLic", "", 
"avx512vl,avx512bw")
+TARGET_BUILTIN(__builtin_ia32_pcmpgtd128_mask, "cV4iV4ic", "", "avx512vl")
+TARGET_BUILTIN(__builtin_ia32_pcmpgtq128_mask, "cV2LLiV2LLic", "", "avx512vl")
 TARGET_BUILTIN(__builtin_ia32_pcmpgtw128_mask, "cV8sV8sc", "", 
"avx512vl,avx512bw")
 
 TARGET_BUILTIN(__builtin_ia32_cmppd512_mask, "UcV8dV8dIiUcIi", "", "avx512f")

Modified: cfe/trunk/lib/Headers/avx512vlintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512vlintrin.h?rev=272532&r1=272531&r2=272532&view=diff
==
--- cfe/trunk/lib/Headers/avx512vlintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512vlintrin.h Sun Jun 12 23:15:11 2016
@@ -29,7 +29,6 @@
 #define __AVX512VLINTRIN_H
 
 #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, 
__target__("avx512vl")))
-#define __DEFAULT_FN_ATTRS_BOTH __attribute__((__always_inline__, __nodebug__, 
__target__("avx512vl, avx512bw")))
 
 static  __inline __v2di __DEFAULT_FN_ATTRS
 _mm_setzero_di(void) {
@@ -38,13 +37,13 @@ _mm_setzero_di(void) {
 
 /* Integer compare */
 
-static __inline__ __mmask8 __DEFAULT_FN_ATTRS_BOTH
+static __inline__ __mmask8 __DEFAULT_FN_ATTRS
 _mm_cmpeq_epi32_mask(__m128i __a, __m128i __b) {
   return (__mmask8)__builtin_ia32_pcmpeqd128_mask((__v4si)__a, (__v4si)__b,
   (__mmask8)-1);
 }
 
-static __inline__ __mmask8 __DEFAULT_FN_ATTRS_BOTH
+static __inline__ __mmask8 __DEFAULT_FN_ATTRS
 _mm_mask_cmpeq_epi32_mask(__mmask8 __u, __m128i __a, __m128i __b) {
   return (__mmask8)__builtin_ia32_pcmpeqd128_mask((__v4si)__a, (__v4si)__b,
   __u);
@@ -62,13 +61,13 @@ _mm_mask_cmpeq_epu32_mask(__mmask8 __u,
 __u);
 }
 
-static __inline__ __mmask8 __DEFAULT_FN_ATTRS_BOTH
+static __inline__ __mmask8 __DEFAULT_FN_ATTRS
 _mm256_cmpeq_epi32_mask(__m256i __a, __m256i __b) {
   return (__mmask8)__builtin_ia32_pcmpeqd256_mask((__v8si)__a, (__v8si)__b,
   

r272534 - MPIBugReporter.h: Fix a warning. [-Wdocumentation]

2016-06-12 Thread NAKAMURA Takumi via cfe-commits
Author: chapuni
Date: Mon Jun 13 00:46:35 2016
New Revision: 272534

URL: http://llvm.org/viewvc/llvm-project?rev=272534&view=rev
Log:
MPIBugReporter.h: Fix a warning. [-Wdocumentation]

Modified:
cfe/trunk/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIBugReporter.h

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIBugReporter.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIBugReporter.h?rev=272534&r1=272533&r2=272534&view=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIBugReporter.h 
(original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIBugReporter.h Mon Jun 
13 00:46:35 2016
@@ -62,7 +62,7 @@ public:
   /// Report a wait on a request that has not been used at all before.
   ///
   /// \param CE wait call that uses the request
-  /// \param ReqRegion memory region of the request
+  /// \param RequestRegion memory region of the request
   /// \param ExplNode node in the graph the bug appeared at
   /// \param BReporter bug reporter for current context
   void reportUnmatchedWait(const CallEvent &CE,


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


[PATCH] D21275: clang-format: [JS] Indent namespaces in JavaScript/TS by default.

2016-06-12 Thread Martin Probst via cfe-commits
mprobst created this revision.
mprobst added a reviewer: djasper.
mprobst added subscribers: cfe-commits, alexeagle.
Herald added a subscriber: klimek.

There's no convention of avoiding the nested indentation.

http://reviews.llvm.org/D21275

Files:
  lib/Format/Format.cpp
  unittests/Format/FormatTestJS.cpp

Index: unittests/Format/FormatTestJS.cpp
===
--- unittests/Format/FormatTestJS.cpp
+++ unittests/Format/FormatTestJS.cpp
@@ -315,6 +315,15 @@
   "
goog.module.get('my.long.module.name.followedBy.MyLongClassName');");
 }
 
+TEST_F(FormatTestJS, FormatsNamespaces) {
+  verifyFormat("namespace Foo {\n"
+   "  export let x = 1;\n"
+   "}\n");
+  verifyFormat("declare namespace Foo {\n"
+   "  export let x: number;\n"
+   "}\n");
+}
+
 TEST_F(FormatTestJS, FormatsFreestandingFunctions) {
   verifyFormat("function outer1(a, b) {\n"
"  function inner1(a, b) { return a; }\n"
Index: lib/Format/Format.cpp
===
--- lib/Format/Format.cpp
+++ lib/Format/Format.cpp
@@ -611,6 +611,7 @@
 GoogleStyle.BreakBeforeTernaryOperators = false;
 GoogleStyle.CommentPragmas = "@(export|return|see|visibility) ";
 GoogleStyle.MaxEmptyLinesToKeep = 3;
+GoogleStyle.NamespaceIndentation = FormatStyle::NI_All;
 GoogleStyle.SpacesInContainerLiterals = false;
 GoogleStyle.JavaScriptQuotes = FormatStyle::JSQS_Single;
   } else if (Language == FormatStyle::LK_Proto) {


Index: unittests/Format/FormatTestJS.cpp
===
--- unittests/Format/FormatTestJS.cpp
+++ unittests/Format/FormatTestJS.cpp
@@ -315,6 +315,15 @@
   "goog.module.get('my.long.module.name.followedBy.MyLongClassName');");
 }
 
+TEST_F(FormatTestJS, FormatsNamespaces) {
+  verifyFormat("namespace Foo {\n"
+   "  export let x = 1;\n"
+   "}\n");
+  verifyFormat("declare namespace Foo {\n"
+   "  export let x: number;\n"
+   "}\n");
+}
+
 TEST_F(FormatTestJS, FormatsFreestandingFunctions) {
   verifyFormat("function outer1(a, b) {\n"
"  function inner1(a, b) { return a; }\n"
Index: lib/Format/Format.cpp
===
--- lib/Format/Format.cpp
+++ lib/Format/Format.cpp
@@ -611,6 +611,7 @@
 GoogleStyle.BreakBeforeTernaryOperators = false;
 GoogleStyle.CommentPragmas = "@(export|return|see|visibility) ";
 GoogleStyle.MaxEmptyLinesToKeep = 3;
+GoogleStyle.NamespaceIndentation = FormatStyle::NI_All;
 GoogleStyle.SpacesInContainerLiterals = false;
 GoogleStyle.JavaScriptQuotes = FormatStyle::JSQS_Single;
   } else if (Language == FormatStyle::LK_Proto) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21270: clang-rename: implement handling of remaining named casts

2016-06-12 Thread Manuel Klimek via cfe-commits
klimek accepted this revision.
klimek added a comment.
This revision is now accepted and ready to land.

LG, although I believe the recent history of changes indicates that the 
approach is suboptimal, and we should address this on a higher level. But for 
now fixing the bugs seems like the right short-term approach.


http://reviews.llvm.org/D21270



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


Re: [llvm-dev] [RFC] Embedded bitcode and related upstream (Part II)

2016-06-12 Thread Eric Christopher via cfe-commits
Hi Steven,

Great to see the commentary and updates here. I've got a few questions
about some of this work. It might be nice to see some separate RFCs for a
couple of things, but we'll figure that out after you send out patches
probably :)

What needs to be improved:
> 1. Whitelist for command line options that can be used with bitcode:
> Current trunk implementation embeds all the cc1 command line options (that
> includes header include paths, warning flags and other front-end options)
> in the command line section. That is lot of redundant information. To
> re-create the object file from the embedded optimized bitcode, most of
> these options are useless. On the other hand, they can leak information of
> the source code. One solution will be keeping a list of all the options
> that can affect code generation but not encoded in the bitcode. I have
> internally prototyped with disallowing these options explicitly and allowed
> only the reminder of the  options to be embedded (
> http://reviews.llvm.org/D17394). A better solution might be encoding that
> information in "Options.td" as specific group.
>

This is really interesting. I'm not a particularly security minded person
so I don't have a lot of commentary there. An explicit whitelist sounds a
bit painful to keep maintained, explicitly having a group in Options.td
sounds pretty nice. You'll need to add them to multiple groups, but it
seems pretty nice.


> 2. Assembly input handling:
> This is a workaround to allow source code written in assembly to work with
> "-fembed-bitcode" options. When compiling assembly source code with
> "-fembed-bitcode", clang-as creates an empty section "__LLVM, __asm" in the
> object file. That is just a way to distinguish object files compiled from
> assembly source from those compiled from higher level source code but
> forgot to use "-fembed-bitcode" options. Linker can use this section to
> diagnose if "-fembed-bitcode" is consistently used on all the object files
> participated in the linking.
>

I'm surprised you want a separate and empty section and not a header flag
as those are easier to keep around and won't take up a precious mach-o
section. There are probably other options here as well. There are probably
other options or concerns that someone shipping bitcode might have here as
well, but I'm sure those are being talked about - doesn't have too much
affect on the community though.

3. Bitcode symbol hiding:
> There was some concerns for leaking source code information when using
> bitcode feature. One approach to avoid the leak is to add a pass which
> renames all the globals and metadata strings. The also keeps a reverse map
> in case the original name needs to be recovered. The final bitcode should
> contain no more symbols or debug info than a stripped binary. To make sure
> modified bitcode can still be linked correctly, the renaming need to be
> consistent across all bitcode participated in the linking and everything
> that is external of the linkage unit need to be preserved. This means the
> pass can only be run during the linking and requires some LTO api.
>

How are you planning to ensure the safety of the reverse map? Seems that
requiring linking is a bit icky, but might work. Are you mostly worried
about function names that could be stripped out? What LTO api are you
envisioning here?


> 4. Debug info strip to line-tables pass:
> As the name suggested, this pass strip down the full debug info to
> line-tables only. This is also one of the steps we took to prevent the leak
> of source code information in bitcode.
>

I'm very curious about what's going on here. Could you elaborate? :)

Thanks a ton for the update - glad to see this being worked on!

-eric


>
> Please let me know what do you think about the pieces above or if you have
> any concerns about the methodology. I will put up patches for review soon.
>
> Thanks
>
> Steven
> ___
> LLVM Developers mailing list
> llvm-...@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits