r266516 - Replace hardcoded comment at 'lit.site.cfg.in'

2016-04-16 Thread Alex Denisov via cfe-commits
Author: alexdenisov
Date: Sat Apr 16 01:54:46 2016
New Revision: 266516

URL: http://llvm.org/viewvc/llvm-project?rev=266516&view=rev
Log:
Replace hardcoded comment at 'lit.site.cfg.in'

At the moment almost every lit.site.cfg.in contains two lines comment:

  ## Autogenerated by LLVM/Clang configuration.
  # Do not edit!

The patch adds variable LIT_SITE_CFG_IN_HEADER, that is replaced from
configure_lit_site_cfg with the note and some useful information.


Modified:
cfe/trunk/test/Unit/lit.site.cfg.in
cfe/trunk/test/lit.site.cfg.in
cfe/trunk/utils/perf-training/lit.site.cfg.in
cfe/trunk/utils/perf-training/order-files.lit.site.cfg.in

Modified: cfe/trunk/test/Unit/lit.site.cfg.in
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Unit/lit.site.cfg.in?rev=266516&r1=266515&r2=266516&view=diff
==
--- cfe/trunk/test/Unit/lit.site.cfg.in (original)
+++ cfe/trunk/test/Unit/lit.site.cfg.in Sat Apr 16 01:54:46 2016
@@ -1,7 +1,7 @@
+@LIT_SITE_CFG_IN_HEADER@
+
 import sys
 
-## Autogenerated by LLVM/Clang configuration.
-# Do not edit!
 config.llvm_src_root = "@LLVM_SOURCE_DIR@"
 config.llvm_obj_root = "@LLVM_BINARY_DIR@"
 config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"

Modified: cfe/trunk/test/lit.site.cfg.in
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/lit.site.cfg.in?rev=266516&r1=266515&r2=266516&view=diff
==
--- cfe/trunk/test/lit.site.cfg.in (original)
+++ cfe/trunk/test/lit.site.cfg.in Sat Apr 16 01:54:46 2016
@@ -1,7 +1,7 @@
+@LIT_SITE_CFG_IN_HEADER@
+
 import sys
 
-## Autogenerated by LLVM/Clang configuration.
-# Do not edit!
 config.llvm_src_root = "@LLVM_SOURCE_DIR@"
 config.llvm_obj_root = "@LLVM_BINARY_DIR@"
 config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"

Modified: cfe/trunk/utils/perf-training/lit.site.cfg.in
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/perf-training/lit.site.cfg.in?rev=266516&r1=266515&r2=266516&view=diff
==
--- cfe/trunk/utils/perf-training/lit.site.cfg.in (original)
+++ cfe/trunk/utils/perf-training/lit.site.cfg.in Sat Apr 16 01:54:46 2016
@@ -1,7 +1,7 @@
+@LIT_SITE_CFG_IN_HEADER@
+
 import sys
 
-## Autogenerated by LLVM/Clang configuration.
-# Do not edit!
 config.clang_tools_dir = "@CLANG_TOOLS_DIR@"
 config.test_exec_root = "@CMAKE_CURRENT_BINARY_DIR@"
 config.test_source_root = "@CMAKE_CURRENT_SOURCE_DIR@"

Modified: cfe/trunk/utils/perf-training/order-files.lit.site.cfg.in
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/perf-training/order-files.lit.site.cfg.in?rev=266516&r1=266515&r2=266516&view=diff
==
--- cfe/trunk/utils/perf-training/order-files.lit.site.cfg.in (original)
+++ cfe/trunk/utils/perf-training/order-files.lit.site.cfg.in Sat Apr 16 
01:54:46 2016
@@ -1,7 +1,7 @@
+@LIT_SITE_CFG_IN_HEADER@
+
 import sys
 
-## Autogenerated by LLVM/Clang configuration.
-# Do not edit!
 config.clang_tools_dir = "@CLANG_TOOLS_DIR@"
 config.test_exec_root = "@CMAKE_CURRENT_BINARY_DIR@"
 config.test_source_root = "@CMAKE_CURRENT_SOURCE_DIR@"


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


[clang-tools-extra] r266518 - Replace hardcoded comment at 'lit.site.cfg.in'

2016-04-16 Thread Alex Denisov via cfe-commits
Author: alexdenisov
Date: Sat Apr 16 02:01:42 2016
New Revision: 266518

URL: http://llvm.org/viewvc/llvm-project?rev=266518&view=rev
Log:
Replace hardcoded comment at 'lit.site.cfg.in'

At the moment almost every lit.site.cfg.in contains two lines comment:

  ## Autogenerated by LLVM/Clang configuration.
  # Do not edit!

The patch adds variable LIT_SITE_CFG_IN_HEADER, that is replaced from
configure_lit_site_cfg with the note and some useful information.


Modified:
clang-tools-extra/trunk/test/Unit/lit.site.cfg.in
clang-tools-extra/trunk/test/lit.site.cfg.in

Modified: clang-tools-extra/trunk/test/Unit/lit.site.cfg.in
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/Unit/lit.site.cfg.in?rev=266518&r1=266517&r2=266518&view=diff
==
--- clang-tools-extra/trunk/test/Unit/lit.site.cfg.in (original)
+++ clang-tools-extra/trunk/test/Unit/lit.site.cfg.in Sat Apr 16 02:01:42 2016
@@ -1,5 +1,5 @@
-## Autogenerated by LLVM/Clang configuration.
-# Do not edit!
+@LIT_SITE_CFG_IN_HEADER@
+
 config.extra_tools_obj_dir = "@CLANG_TOOLS_BINARY_DIR@/unittests"
 config.extra_tools_src_dir = "@CLANG_TOOLS_SOURCE_DIR@/unittests"
 config.llvm_libs_dir = "@LLVM_LIBS_DIR@"

Modified: clang-tools-extra/trunk/test/lit.site.cfg.in
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/lit.site.cfg.in?rev=266518&r1=266517&r2=266518&view=diff
==
--- clang-tools-extra/trunk/test/lit.site.cfg.in (original)
+++ clang-tools-extra/trunk/test/lit.site.cfg.in Sat Apr 16 02:01:42 2016
@@ -1,7 +1,7 @@
+@LIT_SITE_CFG_IN_HEADER@
+
 import sys
 
-## Autogenerated by LLVM/Clang configuration.
-# Do not edit!
 config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
 config.llvm_libs_dir = "@LLVM_LIBS_DIR@"
 config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@"


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


Re: [PATCH] D11781: Refactored pthread usage in libcxx

2016-04-16 Thread Asiri Rathnayake via cfe-commits
rmaprath added a comment.

Hi Eric, Thanks for the comments!

I'll wait a bit for @espositofulvio in case if he wants to push this, otherwise 
I'll create a new diff with the suggested changes.

For us (ARM), a threads porting layer is important on several RTOSes (where a 
full-blown pthreads implementations is not available). I will see if I can 
publish one of those porting layer implementations, but perhaps a windows 
porting layer is more interesting to the community, in which case I'll look 
into hacking one up (unless of course, if @espositofulvio has already got one).

Cheers,

/ Asiri


Repository:
  rL LLVM

http://reviews.llvm.org/D11781



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


r266525 - Add missing headers (fix build after headers cleanup in LLVM)

2016-04-16 Thread Mehdi Amini via cfe-commits
Author: mehdi_amini
Date: Sat Apr 16 03:14:10 2016
New Revision: 266525

URL: http://llvm.org/viewvc/llvm-project?rev=266525&view=rev
Log:
Add missing headers (fix build after headers cleanup in LLVM)

From: Mehdi Amini 

Modified:
cfe/trunk/include/clang/Lex/LiteralSupport.h

Modified: cfe/trunk/include/clang/Lex/LiteralSupport.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/LiteralSupport.h?rev=266525&r1=266524&r2=266525&view=diff
==
--- cfe/trunk/include/clang/Lex/LiteralSupport.h (original)
+++ cfe/trunk/include/clang/Lex/LiteralSupport.h Sat Apr 16 03:14:10 2016
@@ -19,6 +19,7 @@
 #include "clang/Basic/LLVM.h"
 #include "clang/Basic/TokenKinds.h"
 #include "llvm/ADT/APFloat.h"
+#include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/DataTypes.h"


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


Re: [PATCH] D11781: Refactored pthread usage in libcxx

2016-04-16 Thread David Chisnall via cfe-commits
theraven added a comment.

In http://reviews.llvm.org/D11781#403335, @rmaprath wrote:

> For us (ARM), a threads porting layer is important on several RTOSes (where a 
> full-blown pthreads implementations is not available). I will see if I can 
> publish one of those porting layer implementations, but perhaps a windows 
> porting layer is more interesting to the community, in which case I'll look 
> into hacking one up (unless of course, if @espositofulvio has already got 
> one).


I'd be equally interested (and willing to review) an mbed implementation.


Repository:
  rL LLVM

http://reviews.llvm.org/D11781



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


Re: [PATCH] D19165: [clang-tidy] Add modernize-increment-bool check.

2016-04-16 Thread Piotr Padlewski via cfe-commits
Prazek added a comment.

In http://reviews.llvm.org/D19165#403243, @alexfh wrote:

> In http://reviews.llvm.org/D19165#403099, @Prazek wrote:
>
> > In http://reviews.llvm.org/D19165#402657, @aaron.ballman wrote:
> >
> > > This strikes me as something the compiler should diagnose instead of a 
> > > clang-tidy check. Incrementing a bool has been deprecated for some time, 
> > > but it is outright removed in C++17, so I think giving users a migration 
> > > path as part of the compiler would be far more beneficial. What do you 
> > > think?
> >
> >
> > clang already warns about it, but I don't think it has good fixits.
>
>
> What clang diagnostic flags this issue? I'd rather make sure it provides good 
> fixits than as a clang-tidy check that does almost the same. Clang-tidy can 
> be configured to run Clang diagnostics and it will happily apply fixes if 
> asked to.


-Wdeprecated-increment-bool does it. But what I see from SemaExpr.cpp in 
CheckIncrementDecrementOperand, it doesn't have any fixits.


http://reviews.llvm.org/D19165



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


Re: [PATCH] D11781: Refactored pthread usage in libcxx

2016-04-16 Thread Asiri Rathnayake via cfe-commits
rmaprath added a comment.

In http://reviews.llvm.org/D11781#403343, @theraven wrote:

> In http://reviews.llvm.org/D11781#403335, @rmaprath wrote:
>
> > For us (ARM), a threads porting layer is important on several RTOSes (where 
> > a full-blown pthreads implementations is not available). I will see if I 
> > can publish one of those porting layer implementations, but perhaps a 
> > windows porting layer is more interesting to the community, in which case 
> > I'll look into hacking one up (unless of course, if @espositofulvio has 
> > already got one).
>
>
> I'd be equally interested (and willing to review) an mbed implementation.


Thanks!

If you meant the mbed OS [1], I think it is still single-threaded (although 
that might change in the near future [2]). Most of our customers (of armclang) 
have proprietary RTOSes, but we might be able upstream a sample implementation 
(I'm thinking Keil RTX [3], but need to double check a few things), if it seems 
generally useful to the community.

Cheers,

/ Asiri

[1] https://www.mbed.com/
[2] https://www.mbed.com/en/development/software/mbed-os/ ("...we intend to 
re-introduce it in 2016")
[3] http://www.keil.com/rl-arm/kernel.asp


Repository:
  rL LLVM

http://reviews.llvm.org/D11781



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


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

2016-04-16 Thread Alexander Droste via cfe-commits
Alexander_Droste updated this revision to Diff 53982.
Alexander_Droste added a comment.

- added test file to test for note diagnostics
- changed BugReportVisitor to detect request usage purely based on state and 
existence of a request
- added test that showcases a triple nonblocking usage of a request


http://reviews.llvm.org/D12761

Files:
  lib/StaticAnalyzer/Checkers/CMakeLists.txt
  lib/StaticAnalyzer/Checkers/Checkers.td
  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
  test/Analysis/MPIChecker.cpp
  test/Analysis/MPICheckerNotes.cpp

Index: test/Analysis/MPICheckerNotes.cpp
===
--- test/Analysis/MPICheckerNotes.cpp
+++ 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
===
--- test/Analysis/MPIChecker.cpp
+++ 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_COMM_WORLD, &sendReq1);
+MPI_Irecv(&buf, 1, MPI_DOUBLE, rank - 1, 0, MPI_COMM_WORLD, &recvReq1);
+
+if (rank > 1000) {
+  MPI_Wait(&sendReq1, MPI_STATUS_IGNORE);
+  MPI_Wait(&recvReq1, MPI_STATUS_IGNORE);
+} else {
+  MPI_Wait(&sendReq1, MPI_STATUS_IGNORE);
+  MPI_Wait(&recvReq1, MPI_STATUS_IGNORE);
+}
+  }
+} // no error
+
+void missingWait1() { // Check missing wait for dead region.
+  double buf = 0;
+  MPI_Request sendReq1;
+  MPI_Ireduce(MPI_IN_PLACE, &buf, 1, MPI_DOUBLE, MPI_SUM, 0, MPI_COMM_WORLD, &sendReq1);
+} // expected-warning{{Request 'sendReq1' has no matching wait.}}
+
+void missingWait2() {
+  int rank = 

Re: [PATCH] D18309: sourceRange function for MemRegion

2016-04-16 Thread Alexander Droste via cfe-commits
Alexander_Droste updated this revision to Diff 53983.
Alexander_Droste added a comment.

- remove superflous '\param' from header comment


http://reviews.llvm.org/D18309

Files:
  include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h
  lib/StaticAnalyzer/Core/MemRegion.cpp

Index: include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h
===
--- include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h
+++ include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h
@@ -150,6 +150,16 @@
   template const RegionTy* getAs() const;
 
   virtual bool isBoundable() const { return false; }
+
+  /// 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: lib/StaticAnalyzer/Core/MemRegion.cpp
===
--- lib/StaticAnalyzer/Core/MemRegion.cpp
+++ lib/StaticAnalyzer/Core/MemRegion.cpp
@@ -632,6 +632,25 @@
   superRegion->printPrettyAsExpr(os);
 }
 
+SourceRange MemRegion::sourceRange() const {
+  const VarRegion *const VR = dyn_cast(this->getBaseRegion());
+  const FieldRegion *const FR = dyn_cast(this);
+
+  // Check for more specific regions first.
+  // FieldRegion
+  if (FR) {
+return FR->getDecl()->getSourceRange();
+  }
+  // VarRegion
+  else if (VR) {
+return VR->getDecl()->getSourceRange();
+  }
+  // Return invalid source range (can be checked by client).
+  else {
+return SourceRange{};
+  }
+}
+
 
//===--===//
 // MemRegionManager methods.
 
//===--===//


Index: include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h
===
--- include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h
+++ include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h
@@ -150,6 +150,16 @@
   template const RegionTy* getAs() const;
 
   virtual bool isBoundable() const { return false; }
+
+  /// 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: lib/StaticAnalyzer/Core/MemRegion.cpp
===
--- lib/StaticAnalyzer/Core/MemRegion.cpp
+++ lib/StaticAnalyzer/Core/MemRegion.cpp
@@ -632,6 +632,25 @@
   superRegion->printPrettyAsExpr(os);
 }
 
+SourceRange MemRegion::sourceRange() const {
+  const VarRegion *const VR = dyn_cast(this->getBaseRegion());
+  const FieldRegion *const FR = dyn_cast(this);
+
+  // Check for more specific regions first.
+  // FieldRegion
+  if (FR) {
+return FR->getDecl()->getSourceRange();
+  }
+  // VarRegion
+  else if (VR) {
+return VR->getDecl()->getSourceRange();
+  }
+  // Return invalid source range (can be checked by client).
+  else {
+return SourceRange{};
+  }
+}
+
 //===--===//
 // MemRegionManager methods.
 //===--===//
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D16044: getDescriptiveName() for MemRegion

2016-04-16 Thread Alexander Droste via cfe-commits
Alexander_Droste added a comment.

> The memory region for the va_list that was obtained from the analyzer in same 
> case was indeed an element region in the va_list checker. I fixed this issue, 
> and now it works properly.


Then this patch might be ready to commit. :)


http://reviews.llvm.org/D16044



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


Re: [PATCH] D16044: getDescriptiveName() for MemRegion

2016-04-16 Thread Alexander Droste via cfe-commits
Alexander_Droste marked 18 inline comments as done.
Alexander_Droste added a comment.

http://reviews.llvm.org/D16044



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


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

2016-04-16 Thread Alexander Droste via cfe-commits
Alexander_Droste marked 20 inline comments as done.
Alexander_Droste added a comment.

http://reviews.llvm.org/D12761



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


Re: [PATCH] D11781: Refactored pthread usage in libcxx

2016-04-16 Thread Fulvio Esposito via cfe-commits
espositofulvio added a comment.

In http://reviews.llvm.org/D11781#400968, @rmaprath wrote:

> Hi, could I know the status of this? I'd like to push this forward.
>
> @espositofulvio: Are you working on this? (just checking since this has gone 
> stale for a while). @EricWF: I can create a separate diff for further review 
> if this one is too cluttered.


Unfortunately I don't have much spare time at the moment, and that being 
something I was doing to learn about libc++ and not something I needed, it got 
sidetracked. So go ahead with your work.
Best regards,
Fulvio


Repository:
  rL LLVM

http://reviews.llvm.org/D11781



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


Re: [PATCH] D11781: Refactored pthread usage in libcxx

2016-04-16 Thread Asiri Rathnayake via cfe-commits
rmaprath added a comment.

In http://reviews.llvm.org/D11781#403378, @espositofulvio wrote:

> In http://reviews.llvm.org/D11781#400968, @rmaprath wrote:
>
> > Hi, could I know the status of this? I'd like to push this forward.
> >
> > @espositofulvio: Are you working on this? (just checking since this has 
> > gone stale for a while). @EricWF: I can create a separate diff for further 
> > review if this one is too cluttered.
>
>
> Unfortunately I don't have much spare time at the moment, and that being 
> something I was doing to learn about libc++ and not something I needed, it 
> got sidetracked. So go ahead with your work.
>  Best regards,
> Fulvio


I think you've done all the difficult bits already :) I'll polish it up and 
address the remaining comments.

Thanks!!

/ Asiri


Repository:
  rL LLVM

http://reviews.llvm.org/D11781



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


Re: [PATCH] D18745: [clang-tidy] Adds modernize-use-bool-literals check.

2016-04-16 Thread Jakub StaroĊ„ via cfe-commits
staronj updated the summary for this revision.
staronj updated this revision to Diff 53984.
staronj added a comment.

Check now finds implicit and explicit conversions from integer literal to bool.


http://reviews.llvm.org/D18745

Files:
  clang-tidy/modernize/CMakeLists.txt
  clang-tidy/modernize/ModernizeTidyModule.cpp
  clang-tidy/modernize/UseBoolLiteralsCheck.cpp
  clang-tidy/modernize/UseBoolLiteralsCheck.h
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/modernize-use-bool-literals.rst
  test/clang-tidy/modernize-use-bool-literals.cpp

Index: test/clang-tidy/modernize-use-bool-literals.cpp
===
--- /dev/null
+++ test/clang-tidy/modernize-use-bool-literals.cpp
@@ -0,0 +1,118 @@
+// RUN: %check_clang_tidy %s modernize-use-bool-literals %t
+
+bool IntToTrue = 1;
+// CHECK-MESSAGES: :[[@LINE-1]]:18: warning: converting integer literal to bool, use bool literal instead [modernize-use-bool-literals]
+// CHECK-FIXES: {{^}}bool IntToTrue = true;{{$}}
+
+bool IntToFalse(0);
+// CHECK-MESSAGES: :[[@LINE-1]]:17: warning: {{.*}}
+// CHECK-FIXES: {{^}}bool IntToFalse(false);{{$}}
+
+bool LongLongToTrue{0x1LL};
+// CHECK-MESSAGES: :[[@LINE-1]]:21: warning: {{.*}}
+// CHECK-FIXES: {{^}}bool LongLongToTrue{true};{{$}}
+
+bool ExplicitCStyleIntToFalse = (bool)0;
+// CHECK-MESSAGES: :[[@LINE-1]]:39: warning: {{.*}}
+// CHECK-FIXES: {{^}}bool ExplicitCStyleIntToFalse = false;{{$}}
+
+bool ExplicitFunctionalIntToFalse = bool(0);
+// CHECK-MESSAGES: :[[@LINE-1]]:42: warning: {{.*}}
+// CHECK-FIXES: {{^}}bool ExplicitFunctionalIntToFalse = false;{{$}}
+
+bool ExplicitStaticIntToFalse = static_cast(0);
+// CHECK-MESSAGES: :[[@LINE-1]]:51: warning: {{.*}}
+// CHECK-FIXES: {{^}}bool ExplicitStaticIntToFalse = false;{{$}}
+
+#define TRUE_MACRO 1
+// CHECK-FIXES: {{^}}#define TRUE_MACRO 1{{$}}
+
+bool MacroIntToTrue = TRUE_MACRO;
+// CHECK-MESSAGES: :[[@LINE-1]]:23: warning: converting integer literal to bool inside a macro, use bool literal instead [modernize-use-bool-literals]
+// CHECK-FIXES: {{^}}bool MacroIntToTrue = TRUE_MACRO;{{$}}
+
+#define FALSE_MACRO bool(0)
+// CHECK-FIXES: {{^}}#define FALSE_MACRO bool(0){{$}}
+
+
+bool TrueBool = true; // OK
+
+bool FalseBool = FALSE_MACRO;
+// CHECK-MESSAGES: :[[@LINE-1]]:18: warning: {{.*}}
+// CHECK-FIXES: {{^}}bool FalseBool = FALSE_MACRO;{{$}}
+
+void boolFunction(bool bar) {
+
+}
+
+char Character = 0; // OK
+
+unsigned long long LongInteger = 1; // OK
+
+#define MACRO_DEPENDENT_CAST(x) static_cast(x)
+// CHECK-FIXES: {{^}}#define MACRO_DEPENDENT_CAST(x) static_cast(x){{$}}
+
+bool MacroDependentBool = MACRO_DEPENDENT_CAST(0);
+// CHECK-MESSAGES: :[[@LINE-1]]:48: warning: {{.*}}
+// CHECK-FIXES: {{^}}bool MacroDependentBool = MACRO_DEPENDENT_CAST(0);{{$}}
+
+class FooClass {
+  public:
+  FooClass() : JustBool(0) {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: {{.*}}
+  // CHECK-FIXES: {{^ *}}FooClass() : JustBool(false) {}{{$}}
+  FooClass(int) : JustBool{0} {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:28: warning: {{.*}}
+  // CHECK-FIXES: {{^ *}}FooClass(int) : JustBool{false} {}{{$}}
+  private:
+  bool JustBool;
+  bool BoolWithBraces{0};
+  // CHECK-MESSAGES: :[[@LINE-1]]:23: warning: {{.*}}
+  // CHECK-FIXES: {{^ *}}bool BoolWithBraces{false};{{$}}
+  bool BoolFromInt = 0;
+  // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: {{.*}}
+  // CHECK-FIXES: {{^ *}}bool BoolFromInt = false;{{$}}
+  bool SimpleBool = true; // OK
+};
+
+template
+void templateFunction(type) {
+  type TemplateType = 0;
+  // CHECK-FIXES: {{^ *}}type TemplateType = 0;{{$}}
+  return;
+}
+
+template
+void valueDependentTemplateFunction() {
+  bool Boolean = c;
+  // CHECK-FIXES: {{^ *}}bool Boolean = c;{{$}}
+  return;
+}
+
+template
+void anotherTemplateFunction(type) {
+  bool JustBool = 0;
+  // CHECK-MESSAGES: :[[@LINE-1]]:19: warning: {{.*}}
+  // CHECK-FIXES: {{^ *}}bool JustBool = false;{{$}}
+  return;
+}
+
+int main() {
+  boolFunction(1);
+  // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: {{.*}}
+  // CHECK-FIXES: {{^ *}}boolFunction(true);{{$}}
+
+  boolFunction(false);
+
+  templateFunction(0);
+
+  templateFunction(false);
+
+  valueDependentTemplateFunction<1>();
+
+  anotherTemplateFunction(1);
+
+  IntToTrue = 1;
+  // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: {{.*}}
+  // CHECK-FIXES: {{^ *}}IntToTrue = true;{{$}}
+}
Index: docs/clang-tidy/checks/modernize-use-bool-literals.rst
===
--- /dev/null
+++ docs/clang-tidy/checks/modernize-use-bool-literals.rst
@@ -0,0 +1,18 @@
+.. title:: clang-tidy - modernize-use-bool-literals
+
+modernize-use-bool-literals
+===
+
+Finds integer literals which are cast to bool.
+
+.. code-block:: c++
+
+  bool p = 1;
+  bool f = static_cast(1);
+  std::ios_base::sync_with_stdio(0);
+
+  // transforms to
+
+  bool p = true;
+  bool f = true;
+  std::ios_base::sync_with_stdio(false

Re: [PATCH] D18136: boost-use-to-string check

2016-04-16 Thread Piotr Padlewski via cfe-commits
Prazek added inline comments.


Comment at: clang-tidy/boost/UseToStringCheck.cpp:59
@@ +58,3 @@
+
+  if (CharType.isNull())
+return;

alexfh wrote:
> When can `CharType` be `isNull()`? Do you have a test case for this?
I think it's because of some libstdc++ implementation, but without it it was 
crashing.


http://reviews.llvm.org/D18136



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


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

2016-04-16 Thread Anna Zaks via cfe-commits
zaks.anna accepted this revision.
zaks.anna added a comment.
This revision is now accepted and ready to land.

Awesome!

Thank you for investing SO MUCH time into improving the checker and addressing 
the review comments.
Do you have commit access?

Nit: Please, use lower case letters for test names to be consistent with the 
rest.


http://reviews.llvm.org/D12761



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


Re: [PATCH] D18073: Add memory allocating functions

2016-04-16 Thread Alexander Riccio via cfe-commits
ariccio updated this revision to Diff 53995.
ariccio added a comment.

So, duh, it turns out I //can// use `_WIN32` to conditionally test.


http://reviews.llvm.org/D18073

Files:
  llvm/tools/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
  llvm/tools/clang/test/Analysis/alternative-malloc-api.c
  llvm/tools/clang/test/Analysis/malloc.c

Index: llvm/tools/clang/test/Analysis/alternative-malloc-api.c
===
--- llvm/tools/clang/test/Analysis/alternative-malloc-api.c
+++ llvm/tools/clang/test/Analysis/alternative-malloc-api.c
@@ -0,0 +1,100 @@
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,alpha.deadcode.UnreachableCode,alpha.core.CastSize,unix.Malloc,debug.ExprInspection -analyzer-store=region -verify %s
+
+#include "Inputs/system-header-simulator.h"
+
+// Without -fms-compatibility, wchar_t isn't a builtin type. MSVC defines
+// _WCHAR_T_DEFINED if wchar_t is available. Microsoft recommends that you use
+// the builtin type: "Using the typedef version can cause portability
+// problems", but we're ok here because we're not actually running anything.
+// Also of note is this cryptic warning: "The wchar_t type is not supported
+// when you compile C code".
+//
+// See the docs for more:
+// https://msdn.microsoft.com/en-us/library/dh8che7s.aspx
+#if !defined(_WCHAR_T_DEFINED)
+// "Microsoft implements wchar_t as a two-byte unsigned value"
+typedef unsigned short wchar_t;
+#define _WCHAR_T_DEFINED
+#endif // !defined(_WCHAR_T_DEFINED)
+
+void free(void *);
+
+char *tempnam(const char *dir, const char *pfx);
+
+void testTempnamLeak(const char* dir, const char* prefix) {
+  char* fileName = tempnam(dir, prefix);
+}// expected-warning {{Potential leak of memory pointed to by}}
+
+void testTempnamNoLeak(const char* dir, const char* prefix) {
+  char* fileName = tempnam(dir, prefix);
+  free(fileName);// no warning
+}
+
+
+// What does "ContentIsDefined" refer to?
+void testTempnamNoLeakContentIsDefined(const char* dir, const char* prefix) {
+  char* fileName = tempnam(dir, prefix);
+  char result = fileName[0];// no warning
+  free(fileName);
+}
+
+#if defined(_WIN32)
+char *_tempnam(const char *dir, const char *prefix);
+wchar_t *_wtempnam(const wchar_t *dir, const wchar_t *prefix);
+
+char *_tempnam_dbg(const char *dir, const char *prefix, int blockType,
+   const char *filename, int linenumber);
+
+wchar_t *_wtempnam_dbg(const wchar_t *dir, const wchar_t *prefix,
+   int blockType, const char *filename, int linenumber);
+
+void testWinTempnamLeak(const char* dir, const char* prefix) {
+  char* fileName = _tempnam(dir, prefix);
+}// expected-warning {{Potential leak of memory pointed to by}}
+
+void testWinTempnamDbgLeak(const char* dir, const char* prefix) {
+  char* fileName = _tempnam_dbg(dir, prefix, 0, __FILE__, __LINE__);
+}// expected-warning {{Potential leak of memory pointed to by}}
+
+void testWinWideTempnamLeak(const wchar_t* dir, const wchar_t* prefix) {
+  wchar_t* fileName = _wtempnam(dir, prefix);
+}// expected-warning {{Potential leak of memory pointed to by}}
+
+void testWinWideTempnaDbgmLeak(const wchar_t* dir, const wchar_t* prefix) {
+  wchar_t* fileName = _wtempnam_dbg(dir, prefix, 0, __FILE__, __LINE__);
+}// expected-warning {{Potential leak of memory pointed to by}}
+
+void testWinTempnamNoLeak(const char* dir, const char* prefix) {
+  char* fileName = _tempnam(dir, prefix);
+  free(fileName);// no warning
+}
+
+void testWinTempnamDbgNoLeak(const char* dir, const char* prefix) {
+  char* fileName = _tempnam_dbg(dir, prefix, 0, __FILE__, __LINE__);
+  free(fileName);// no warning
+}
+
+void testWinWideTempnamNoLeak(const wchar_t* dir, const wchar_t* prefix) {
+  wchar_t* fileName = _wtempnam(dir, prefix);
+  free(fileName);// no warning
+}
+
+void testWinWideTempnamDbgNoLeak(const wchar_t* dir, const wchar_t* prefix) {
+  wchar_t* fileName = _wtempnam_dbg(dir, prefix, 0, __FILE__, __LINE__);
+  free(fileName);// no warning
+}
+
+// What does "ContentIsDefined" refer to?
+void testWinTempnamNoLeakContentIsDefined(const char* dir, const char* prefix) {
+  char* fileName = _tempnam(dir, prefix);
+  char result = fileName[0];// no warning
+  free(fileName);
+}
+
+// What does "ContentIsDefined" refer to?
+void testWinWideTempnamNoLeakContentIsDefined(const wchar_t* dir, const wchar_t* prefix) {
+  wchar_t* fileName = _wtempnam(dir, prefix);
+  wchar_t result = fileName[0];// no warning
+  free(fileName);
+}
+#endif //defined(_WIN32)
Index: llvm/tools/clang/test/Analysis/malloc.c
===
--- llvm/tools/clang/test/Analysis/malloc.c
+++ llvm/tools/clang/test/Analysis/malloc.c
@@ -32,11 +32,37 @@
 char *strndup(const char *s, size_t n);
 int memcmp(const void *s1, const void *s2, size_t n);
 
+
 // Windows variants
+#if defined(_WIN32)
 char *_strdup(const char *strSource);
 wchar_t *_wcsdup(const wchar_t *strSource);
+unsigned cha