Re: r188037 - clang-cl: Support /showIncludes

2016-03-13 Thread Hans Wennborg via cfe-commits
On Sat, Mar 12, 2016 at 7:50 PM, Nico Weber via cfe-commits
 wrote:
> On Thu, Aug 8, 2013 at 8:32 PM, Hans Wennborg  wrote:
>>
>> Author: hans
>> Date: Thu Aug  8 19:32:23 2013
>> New Revision: 188037
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=188037&view=rev
>> Log:
>> clang-cl: Support /showIncludes
>>
>> This option prints information about #included files to stderr. Clang
>> could
>> already do it, this patch just teaches the existing code about the
>> /showIncludes
>> style and adds the flag.
>>
>> Differential Revision: http://llvm-reviews.chandlerc.com/D1333
[..]
>> --- cfe/trunk/test/Frontend/print-header-includes.c (original)
>> +++ cfe/trunk/test/Frontend/print-header-includes.c Thu Aug  8 19:32:23
>> 2013
>> @@ -5,4 +5,11 @@
>>  // CHECK: . {{.*test.h}}
>>  // CHECK: .. {{.*test2.h}}
>>
>> +// RUN: %clang_cc1 -include Inputs/test3.h -E --show-includes -o %t.out
>> %s 2> %t.err
>> +// RUN: FileCheck --check-prefix=MS < %t.err %s
>> +// MS-NOT: test3.h
>
>
> Do you remember why this is a -NOT? From what I can tell, `cl /c empty.cc
> /FItest.h /showIncludes` does print a Note line for test.h. I thought that
> was a bug, but when I wrote a fix I noticed that we have this test that
> explicitly checks that /FI arguments are omitted from /showIncludes output.

I don't remember, but I suspect I just took the non-CL test case,
adopted it to the CL style and didn't notice that they also print for
/FI.

>> +// MS: Note: including file: {{.*test.h}}
>> +// MS: Note: including file:  {{.*test2.h}}
>> +// MS-NOT: Note
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r263344 - clang-cl: Add a test for the interaction of /Yc and /showIncludes.

2016-03-13 Thread Renato Golin via cfe-commits
On 13 March 2016 at 02:56, Nico Weber via cfe-commits
 wrote:
> Author: nico
> Date: Sat Mar 12 13:55:59 2016
> New Revision: 263344
>
> URL: http://llvm.org/viewvc/llvm-project?rev=263344&view=rev
> Log:
> clang-cl: Add a test for the interaction of /Yc and /showIncludes.
>
> We almost get this right, but not completely (see FIXME).  It looks like /FI
> headers generally aren't included in /showIncludes yet, but they should be.
> But it seems good to have test coverage for the bits that already work.

Hi Nico,

This is segfaulting on all AArch64 bots:

http://lab.llvm.org:8011/builders/clang-cmake-aarch64-quick/builds/5433

http://lab.llvm.org:8011/builders/clang-cmake-aarch64-full/builds/1584

http://lab.llvm.org:8011/builders/clang-cmake-aarch64-42vma/builds/6668

And now that you have added more patches on the same area, it's not
easy to revert.

Can you please have a look?

Thanks!

--renato
___
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-03-13 Thread Alexander Droste via cfe-commits
Alexander_Droste marked 3 inline comments as done.
Alexander_Droste added a comment.

> I still have to do an overall pass over this checker, but it looks much 
> better than the first version!


:D



Comment at: lib/StaticAnalyzer/Checkers/MPI-Checker/MPIChecker.cpp:47
@@ +46,3 @@
+BReporter->reportDoubleNonblocking(PreCallEvent, *Req, MR, ExplNode);
+Ctx.addTransition(ErrorNode->getState(), ErrorNode);
+  }

zaks.anna wrote:
> Correct, it should be ErrorNode. Moreover, if you do not modify the State and 
> use the state from the predecessor node, which is the case here, you do not 
> need to pass a State to it. You do not need to pass the tag either in his 
> case - a page generated for your checker will be used. By default the 
> CheckerContext will use the state of the predecessor node and that default 
> tag. (If you want to pass your tag, it's fine.)
> 
> You do need to pass the state if you modify the state as in the next example.
Ah I see, this is covered by the default parameters.


Comment at: lib/StaticAnalyzer/Checkers/MPI-Checker/MPIChecker.cpp:135
@@ +134,3 @@
+
+void MPIChecker::checkMissingWaitsGlobals(ExplodedGraph &G) const {
+

zaks.anna wrote:
> I do not think I've seen this code before. If you add new functionality, 
> please submit it in a new commit. Otherwise, there is a high chance it will 
> go unnoticed. 
> 
> Are there examples of the new warnings it caught? 
> 
> checkEndAnalysis is rarely used by checkers, so you might not need it here. 
> Specifically, you should be notified by the checkDeadSymbols before a symbol 
> dies even if it dies because it's the end of path.
Yes, I added this at some point after the initial patch, after I realized that 
the following test case fails:

```
MPI_Request sendReq1;
void missingWait2() { // Check missing wait for global variable.
  int rank = 0;
  double buf = 0;
  MPI_Comm_rank(MPI_COMM_WORLD, &rank);
  MPI_Ireduce(MPI_IN_PLACE, &buf, 1, MPI_DOUBLE, MPI_SUM, 0, MPI_COMM_WORLD, 
&sendReq1);
} // expected-warning{{Request 'sendReq1' has no matching wait.}}
```
if the checker solely relies on `checkDeadSymbols`. I just rechecked this 
behavior by commenting out

```
BReporter->reportMissingWait(Req.second, Req.first, *NodeIt);
```
in `checkMissingWaitsGlobals` and the test still fails then. Are global 
variables really covered by `checkDeadSymbols`?


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] D12761: MPI-Checker patch for Clang Static Analyzer

2016-03-13 Thread Alexander Droste via cfe-commits
Alexander_Droste updated this revision to Diff 50548.
Alexander_Droste marked an inline comment as done.
Alexander_Droste added a comment.

- omit superfluous arguments passed to `generateNonFatalErrorNode`


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

Index: test/Analysis/MPIChecker.cpp
===
--- test/Analysis/MPIChecker.cpp
+++ test/Analysis/MPIChecker.cpp
@@ -0,0 +1,235 @@
+// RUN: %clang_cc1 -analyze -analyzer-checker=optin.mpi.MPI-Checker -verify %s
+
+// MPI-Checker makes no assumptions about details of an MPI implementation.
+// Typedefs and constants are compared as strings.
+
+#include "MPIMock.h"
+
+//integration tests
+
+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, 3, MPI_COMM_WORLD, &sendReq1);
+MPI_Irecv(&buf, 1, MPI_DOUBLE, rank - 1, 3, 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, 4, MPI_COMM_WORLD, &sendReq1);
+MPI_Irecv(&buf, 1, MPI_DOUBLE, rank - 1, 4, 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, 5, MPI_COMM_WORLD, &sendReq1);
+MPI_Irecv(&buf, 1, MPI_DOUBLE, rank - 1, 5, 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.
+  int rank = 0;
+  double buf = 0;
+  MPI_Request sendReq1;
+  MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+  MPI_Ireduce(MPI_IN_PLACE, &buf, 1, MPI_DOUBLE, MPI_SUM, 0, MPI_COMM_WORLD,
+  &sendReq1); // expected-note{{Request is previously used by nonblocking call here.}}
+} // expected-warning{{Request 'sendReq1' has no matching wait.}}
+
+
+MPI_Request sendReq1;
+void missingWait2() { // Check missing wait for global variable.
+  int rank = 0;
+  double buf = 0;
+  MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+  MPI_Ireduce(MPI_IN_PLACE, &buf, 1, MPI_DOUBLE, MPI_SUM, 0, MPI_COMM_WORLD,
+  &sendReq1); // expected-note{{Request is previously used by nonblocking call here.}}
+} // expected-warning{{Request 'sendReq1' has no matching wait.}}
+
+void missingWait3() {
+  int rank = 0;
+  double buf = 0;
+  MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+  if (rank == 0) {
+  } else {
+MPI_Request sendReq1, recvReq1;
+
+MPI_Isend(&buf, 1, MPI_DOUBLE, rank + 1, 2, MPI_COMM_WORLD, &sendReq1);
+MPI_Irecv(&buf, 1, MPI_DOUBLE, rank - 1, 2, MPI_COMM_WORLD, &recvReq1); // expected-warning{{Request 'sendReq1' has no matching wait.}}
+MPI_Wait(&recvReq1, MPI_STATUS_IGNORE);
+  }
+}
+
+void doubleNonblocking() {
+  int rank = 0;
+  double buf = 0;
+  MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+  if (rank == 1) {
+  } else {
+MPI_Request sendReq1;
+
+MPI_Isend(&buf, 1, MPI_DOUBLE, rank + 1, 6, MPI_COMM_WORLD, &sendReq1); // expected-note{{Request is previously used by nonblocking call here. }}
+MPI_Irecv(&buf, 1, MPI_DOUBLE, rank - 1, 6, MPI_COMM_WORLD, &sendReq1); // expected-warning{{Double nonblocking on request 'sendReq1'.}}
+MPI_Wait(&sendReq1, MPI_STATUS_IGNORE);
+  }
+}
+
+void doubleNonblocking2() {
+  int rank = 0;
+  double buf = 0;
+  MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+
+  MPI_Request req;
+  MPI_Ireduce(MPI_IN_PLACE, &buf, 1, MPI_DOUBLE, MPI_SUM, 0, MPI_COMM_WORLD, &req); // expected-note{{Request is previously used by nonblocking call here.}}
+  MPI_Ireduce(MPI_IN_PLACE, &buf, 1, MPI_DOUBLE, MPI_SUM, 0, MPI_COMM_WORLD, &req); // expected-warning{{Double nonblocking on request 'req'.}}
+  MPI_Wait(&req, MPI_STATUS_IGNORE);
+}
+
+void doubleNonblocking3() {
+  typedef struct { MPI_Request req; } ReqStruct;
+
+  ReqStru

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

2016-03-13 Thread Alexander Droste via cfe-commits
Alexander_Droste added inline comments.


Comment at: test/Analysis/MPIChecker.cpp:97
@@ +96,3 @@
+
+MPI_Isend(&buf, 1, MPI_DOUBLE, rank + 1, 6, MPI_COMM_WORLD, &sendReq1); // 
expected-note{{Request is previously used by nonblocking call here. }}
+MPI_Irecv(&buf, 1, MPI_DOUBLE, rank - 1, 6, MPI_COMM_WORLD, &sendReq1); // 
expected-warning{{Double nonblocking on request 'sendReq1'.}}

All the `expected-note`s still fail, even though the diagnostics are presented 
in a report.


http://reviews.llvm.org/D12761



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


r263380 - Added test that covers changes in r263379.

2016-03-13 Thread Amjad Aboud via cfe-commits
Author: aaboud
Date: Sun Mar 13 06:12:57 2016
New Revision: 263380

URL: http://llvm.org/viewvc/llvm-project?rev=263380&view=rev
Log:
Added test that covers changes in r263379.

Added:
cfe/trunk/test/CodeGen/debug-info-imported-entity.cpp

Added: cfe/trunk/test/CodeGen/debug-info-imported-entity.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/debug-info-imported-entity.cpp?rev=263380&view=auto
==
--- cfe/trunk/test/CodeGen/debug-info-imported-entity.cpp (added)
+++ cfe/trunk/test/CodeGen/debug-info-imported-entity.cpp Sun Mar 13 06:12:57 
2016
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -triple x86_64-unk-unk -o - -emit-llvm 
-debug-info-kind=limited %s | FileCheck %s
+
+namespace std { class A; }
+using std::A; using ::A;
+
+
+// CHECK: [[CompileUnit:![0-9]+]] = distinct !DICompileUnit({{.+}} imports: 
[[Imports:![0-9]+]])
+// CHECK: [[Imports]] = !{[[ImportedEntity:![0-9]+]]}
+// CHECK: [[ImportedEntity]] = !DIImportedEntity(tag: 
DW_TAG_imported_declaration, scope: [[CompileUnit]], entity: !"_ZTSSt1A", line: 
4)
+


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


Re: [PATCH] D18127: Remove compile time PreserveName in favor of a runtime cc1 -discard-value-names option

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

Looks good with the two test nits below fixed.



Comment at: test/CodeGen/mips-zero-sized-struct.c:8-10
@@ -7,5 +7,5 @@
 
-// O32: define void @fn28(%struct.T2* noalias sret %agg.result, i8 signext 
%arg0)
-// N32: define void @fn28(i8 signext %arg0)
-// N64: define void @fn28(i8 signext %arg0)
+// O32: define void @fn28(%struct.T2* noalias sret{{.*}}, i8 signext{{.*}})
+// N32: define void @fn28(i8 signext{{.*}})
+// N64: define void @fn28(i8 signext{{.*}})
 

No need for this part of the change now?


Comment at: test/CodeGenCXX/stack-reuse.cpp:1
@@ -1,2 +1,2 @@
-// RUN: %clang -target armv7l-unknown-linux-gnueabihf -S %s -o - -emit-llvm 
-O1 -disable-llvm-optzns | FileCheck %s
+// RUN: %clang -cc1 -triple armv7-unknown-linux-gnueabihf %s -o - -emit-llvm 
-O1 | FileCheck %s
 

Another place to use %clang_cc1 instead of '-cc1'.


http://reviews.llvm.org/D18127



___
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-03-13 Thread Alexander Droste via cfe-commits
Alexander_Droste updated this revision to Diff 50551.
Alexander_Droste added a comment.

- create `MemRegion.cpp`, in order to set up test cases for `getDescriptiveName`


http://reviews.llvm.org/D16044

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

Index: test/Analysis/MemRegion.cpp
===
--- test/Analysis/MemRegion.cpp
+++ 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 { MPI_Request req[2][2]; } ReqStruct;
+  ReqStruct rs;
+  MPI_Request *r = &rs.req[0][1];
+  MPI_Wait(r, MPI_STATUS_IGNORE); // expected-warning{{Request 'rs.req[0][1]' has no matching nonblocking call.}}
+}
+
+void testGetDescriptiveName5() {
+  int rank = 0;
+  MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+  typedef struct { MPI_Request req; } ReqStructInner;
+  typedef struct  { ReqStructInner req; } ReqStruct;
+  ReqStruct rs;
+  MPI_Request *r = &rs.req.req;
+  MPI_Wait(r, MPI_STATUS_IGNORE); // expected-warning{{Request 'rs.req.req' has no matching nonblocking call.}}
+}
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; }
+
+  /// Get desriptive 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;
 };
 
 /// 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,46 @@
   superRegion->printPrettyAsExpr(os);
 }
 
+std::string MemRegion::getDescriptiveName(bool UseQuotes) const {
+  std::string VariableName;
+  std::string ArrayIndices;
+  const MemRegion *R = this;
+  SmallString<50> buf;
+  llvm::raw_svector_ostream os(buf);
+
+  // Obtain array indices to add them to the variable name.
+  const ElementRegion *ER = nullptr;
+  while ((ER = R->getAs())) {
+// Index is a ConcreteInt.
+if (auto CI = ER->getIndex().getAs()) {
+  llvm::SmallString<2> Idx;
+  CI->getValue().toString(Idx);
+  ArrayIndices = (llvm::Twine("[") + Idx.str() + "]" + ArrayIndices).str();
+}
+// If not a ConcreteInt, try to obtain the variable
+// name by calling 'getDescriptiveName' recursively.
+else {
+  std::string Idx = ER->getDescriptiveName(false);
+  if (!Idx.empty()) {
+ArrayIndices = (llvm::Twine("[") + Idx + "]" + ArrayIndices).str();
+  }
+}
+R = ER->getSuperRegion();
+  }
+
+  // Get variable name.
+  if (R && R->canPrintPrettyAsExpr()) {
+R->printPrettyAsExpr(os);
+if (UseQuotes) {
+  return (llvm::Twine("'") + os.str() + ArrayIndices + "'").str();
+} else {
+  return (llvm::Twine(os.str()) + ArrayIndices).str();
+}
+  }
+
+  return VariableName;
+}
+
 //===--===//
 // MemRegionManager methods.
 //===--===//
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/

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

2016-03-13 Thread Alexander Droste via cfe-commits
Alexander_Droste added inline comments.


Comment at: test/Analysis/MemRegion.cpp:3
@@ +2,3 @@
+
+#include "MPIMock.h"
+

The problem about these tests is that they introduce a cyclic commit 
dependency. MPI-Checker depends on `getDescriptiveName`. `getDescriptiveName` 
depends on MPI-Checker because of the tests.

Further, MPI-Checker depends on this function:

```
SourceRange MemRegion::sourceRange() const {
  const VarRegion *const VR = dyn_cast(this->getBaseRegion());
  const FieldRegion *const FR = dyn_cast(this);
  const CXXBaseObjectRegion*const COR = dyn_cast(this);

  // Check for more specific regions first.
  // FieldRegion
  if (FR) {
return FR->getDecl()->getSourceRange();
  }
  // CXXBaseObjectRegion
  else if (COR) {
return COR->getDecl()->getSourceRange();
  }
  // VarRegion
  else if (VR) {
return VR->getDecl()->getSourceRange();
  }
  // Return invalid source range (can be checked by client).
  else {
return SourceRange{};
  }
}
```
Initially, my idea was to submit the `sourceRange` patch after 
`getDescriptiveName`. Maybe it would be most convenient, to include the 
`sourceRange` function into this patch and finally commit all connected patches 
in one go.


http://reviews.llvm.org/D16044



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


[ASTMatcher] builtinType matcher with returns

2016-03-13 Thread Piotr Padlewski via cfe-commits
Hi,

For code like:
namespace boost {
template 
T lexical_cast(const C&) {
return T();
}

}

int g();
long long f(int p);
using namespace boost;
int main() {
auto s = lexical_cast(5);
auto p = lexical_cast(6);
long long z = lexical_cast(7);
long long a2 = lexical_cast("1488");
long long a3 = lexical_cast("2137");

g();
int zda = g();
f(5);
}

why
does callExpr(hasDeclaration(functionDecl(returns(qualType(asString("long
long")) binds to:
long long z = lexical_cast(7);
  ^~
(and few others)

but callExpr(hasDeclaration(functionDecl(returns(qualType(builtinType())
binds to only calls of non template functions like:

   g();
^~~

int zda = g();
  ^~~

f(5);
^~~~

Is it a bug?

Piotr
___
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-03-13 Thread Anna Zaks via cfe-commits
zaks.anna added a comment.

I'd be fine if we test this function with the usual regression tests by 
observing the output of the MPI checker. We could update that test with more 
checks once the function is updated.

With that approach, you'd be committing both patches at the same time.


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-03-13 Thread Anna Zaks via cfe-commits
zaks.anna added inline comments.


Comment at: lib/StaticAnalyzer/Checkers/MPI-Checker/MPIChecker.cpp:136
@@ +135,3 @@
+  auto NodeIt = G.eop_begin();
+  const auto NodeEndIt = G.eop_end();
+

The analyzer does not do a good job tracking global variables. You might get 
false positives, specifically, where the variable is released in another 
translation unit or by calling function that the analyzer does not inline.



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] D12761: MPI-Checker patch for Clang Static Analyzer

2016-03-13 Thread Alexander Droste via cfe-commits
Alexander_Droste added inline comments.


Comment at: lib/StaticAnalyzer/Checkers/MPI-Checker/MPIChecker.cpp:136
@@ +135,3 @@
+  auto NodeIt = G.eop_begin();
+  const auto NodeEndIt = G.eop_end();
+

zaks.anna wrote:
> The analyzer does not do a good job tracking global variables. You might get 
> false positives, specifically, where the variable is released in another 
> translation unit or by calling function that the analyzer does not inline.
> 
So shall we remove or keep the function?


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] D16044: getDescriptiveName() for MemRegion

2016-03-13 Thread Alexander Droste via cfe-commits
Alexander_Droste added a comment.

> I'd be fine if we test this function with the usual regression tests by 
> observing the output of the MPI checker. We could update that test with more 
> checks once the function is updated.

> With that approach, you'd be committing both patches at the same time.


You mean to: 
Temporarily remove the  `MemRegion.cpp` testfile -> committing 
`getDescriptiveName` -> committing `sourceRange` -> committing MPI-Checker -> 
then readding the testfile; right?


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] D18123: Fix implicit copy ctor and copy assignment operator warnings when -Wdeprecated passed.

2016-03-13 Thread David Blaikie via cfe-commits
On Sat, Mar 12, 2016 at 3:42 PM, don hinton via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> hintonda created this revision.
> hintonda added a reviewer: rjmccall.
> hintonda added a subscriber: cfe-commits.
>
> Fix implicit copy ctor and copy assignment operator warnings
> when -Wdeprecated passed.
>
> http://reviews.llvm.org/D18123
>
> Files:
>   include/clang/AST/UnresolvedSet.h
>   include/clang/Sema/Lookup.h
>
> Index: include/clang/Sema/Lookup.h
> ===
> --- include/clang/Sema/Lookup.h
> +++ include/clang/Sema/Lookup.h
> @@ -185,6 +185,9 @@
>Shadowed(false)
>{}
>
> +  LookupResult(const LookupResult &) = default;
> +  LookupResult & operator=(const LookupResult &) = default;
>

Pretty sure LookupResult should not be copyable - I've been meaning to get
around to fixing this -Wdeprecated regression introduced by copinig
LookupResult

(if you look at LookupResult's dtor, you can see that it's not really
copyable - if it has paths, you'll cause double deletion if you copy it -
or double diagnosis, etc - in the one other place where I came across a
LookupResult copy, I just pulled uot all the lookup query parameters and
passed those into a new LookupResult - probably better off splitting it
into the query portion and the result portion and keeping the query portion
copyable)

If you check my commits related to this warning, you should find a change I
made to delayed typo correction that fixed a similar LookupResult copy
using the mechanism I described.

Thanks,
- Dave


> +
>~LookupResult() {
>  if (Diagnose) diagnose();
>  if (Paths) deletePaths(Paths);
> Index: include/clang/AST/UnresolvedSet.h
> ===
> --- include/clang/AST/UnresolvedSet.h
> +++ include/clang/AST/UnresolvedSet.h
> @@ -59,8 +59,9 @@
>// UnresolvedSet.
>  private:
>template  friend class UnresolvedSet;
> -  UnresolvedSetImpl() {}
> -  UnresolvedSetImpl(const UnresolvedSetImpl &) {}
> +  UnresolvedSetImpl() = default;
> +  UnresolvedSetImpl(const UnresolvedSetImpl &) = default;
> +  UnresolvedSetImpl& operator=(const UnresolvedSetImpl &) = default;
>
>  public:
>// We don't currently support assignment through this iterator, so we
> might
>
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D18127: Remove compile time PreserveName in favor of a runtime cc1 -discard-value-names option

2016-03-13 Thread David Blaikie via cfe-commits
Interesting question going forwards: We usually try to make test cases
+/-Asserts agnostic (not using named values), now that we have a flag for
it, should we not bother with that & just add the command line argument to
enable names when names make testing easier? Or do we think that'll make
tests more brittle/depend on unnecessary implementation details?

On Sat, Mar 12, 2016 at 6:00 PM, Mehdi AMINI via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> joker.eph created this revision.
> joker.eph added reviewers: echristo, chandlerc.
> joker.eph added a subscriber: cfe-commits.
>
> This flag is enabled by default in the driver when NDEBUG is set. It
> is forwarded on the LLVMContext to discard all value names (but
> GlobalValue) for performance purpose.
>
> This an improved version of D18024
>
> http://reviews.llvm.org/D18127
>
> Files:
>   include/clang/Driver/CC1Options.td
>   include/clang/Frontend/CodeGenOptions.def
>   lib/CodeGen/CGBuilder.h
>   lib/CodeGen/CGCall.cpp
>   lib/CodeGen/CGExpr.cpp
>   lib/CodeGen/CodeGenFunction.cpp
>   lib/CodeGen/ModuleBuilder.cpp
>   lib/Driver/Tools.cpp
>   lib/Frontend/CompilerInvocation.cpp
>   test/CodeGen/mips-byval-arg.c
>   test/CodeGen/mips-vector-arg.c
>   test/CodeGen/mips-zero-sized-struct.c
>   test/CodeGen/mips64-class-return.cpp
>   test/CodeGen/mips64-padding-arg.c
>   test/CodeGenCXX/debug-info-class.cpp
>   test/CodeGenCXX/stack-reuse.cpp
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D18123: Fix implicit copy ctor and copy assignment operator warnings when -Wdeprecated passed.

2016-03-13 Thread John McCall via cfe-commits
rjmccall added a comment.

It has side effects in the destructor.  It's not copyable.

It could reasonably be made movable, however, now that we require C++11 as a 
host requirement.  (It was written before that was true.)


http://reviews.llvm.org/D18123



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


Re: [PATCH] D18113: CodeGen: Use 32-bit gep offsets to address vtable address points.

2016-03-13 Thread John McCall via cfe-commits
rjmccall added a comment.

Yes, I guess this is fine.


http://reviews.llvm.org/D18113



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


Re: [PATCH] D18071: CodeGen: Mark functions used in vtables as unnamed_addr.

2016-03-13 Thread John McCall via cfe-commits
rjmccall added a comment.

I see, they weren't being set on declarations, just definitions.  Yes, this 
seems reasonable.


http://reviews.llvm.org/D18071



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


Re: [PATCH] D14737: Convert some ObjC msgSends to runtime calls

2016-03-13 Thread John McCall via cfe-commits
rjmccall added a comment.

In http://reviews.llvm.org/D14737#373532, @pete wrote:

> I stepped through this one in the debugger to make sure I had it right.
>
> So the reason the bit cast ends up not being needed is because we restricted 
> this optimization to cases where the result type "isObjCObjectPointerType()" 
> which conveniently ends up begin i8* and is exactly the same type as the 
> message receiver.  I guess if either the receiver type or the result type 
> wasn't represented as i8* then the IRBuilder would have crashed.
>
> If we permitted converting say messaging (int*)retain to a call to 
> objc_retain then the bit cast would be needed.  Would you like me to permit 
> this change on functions returning anything other than 
> isObjCObjectPointerType(), eg, change that to "isAnyPointerType()"?


The IR type for an AST type satisfying isObjCObjectPointerType() isn't always 
i8*; in particular, that's not true when the receiver has a concrete class type.

A test case here would be something like:

@interface Foo

- (id) retain;

@end

...

id test(Foo *foo) {

  return [foo retain];

}

Here the receiver type will be something like %struct.Foo* and the expected 
return type will be i8*.


http://reviews.llvm.org/D14737



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


Re: [PATCH] D18123: Fix implicit copy ctor and copy assignment operator warnings when -Wdeprecated passed.

2016-03-13 Thread don hinton via cfe-commits
hintonda added a comment.

LookupResult's copy ctor and assignment operator are used in 
Sema::LookupInlineAsmField().  Looks like these were added back in December.

I'll remove the defaults, from this patch, but not sure how to handle 
LookupInlineAsmField().  Will add author of that change.

OTOH, UnresolvedSetImpl requires an assignment operator since it's a base to 
UnresolvedSet which has an implicit assignment operator, so I think that change 
is correct.


http://reviews.llvm.org/D18123



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


r263394 - Remove compile time PreserveName in favor of a runtime cc1 -discard-value-names option

2016-03-13 Thread Mehdi Amini via cfe-commits
Author: mehdi_amini
Date: Sun Mar 13 16:05:23 2016
New Revision: 263394

URL: http://llvm.org/viewvc/llvm-project?rev=263394&view=rev
Log:
Remove compile time PreserveName in favor of a runtime cc1 -discard-value-names 
option

Summary:
This flag is enabled by default in the driver when NDEBUG is set. It
is forwarded on the LLVMContext to discard all value names (but
GlobalValue) for performance purpose.

This an improved version of D18024

Reviewers: echristo, chandlerc

Subscribers: cfe-commits

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

From: Mehdi Amini 

Added:
cfe/trunk/test/CodeGenCXX/discard-name-values.cpp
Modified:
cfe/trunk/include/clang/Driver/CC1Options.td
cfe/trunk/include/clang/Frontend/CodeGenOptions.def
cfe/trunk/lib/CodeGen/CGBuilder.h
cfe/trunk/lib/CodeGen/CGCall.cpp
cfe/trunk/lib/CodeGen/CGExpr.cpp
cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
cfe/trunk/lib/CodeGen/ModuleBuilder.cpp
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/test/CodeGen/mips-byval-arg.c
cfe/trunk/test/CodeGen/mips-vector-arg.c
cfe/trunk/test/CodeGen/mips-zero-sized-struct.c
cfe/trunk/test/CodeGen/mips64-class-return.cpp
cfe/trunk/test/CodeGen/mips64-padding-arg.c
cfe/trunk/test/CodeGenCXX/debug-info-class.cpp
cfe/trunk/test/CodeGenCXX/stack-reuse.cpp

Modified: cfe/trunk/include/clang/Driver/CC1Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=263394&r1=263393&r2=263394&view=diff
==
--- cfe/trunk/include/clang/Driver/CC1Options.td (original)
+++ cfe/trunk/include/clang/Driver/CC1Options.td Sun Mar 13 16:05:23 2016
@@ -367,6 +367,8 @@ def code_completion_brief_comments : Fla
   HelpText<"Include brief documentation comments in code-completion results.">;
 def disable_free : Flag<["-"], "disable-free">,
   HelpText<"Disable freeing of memory on exit">;
+def discard_value_names : Flag<["-"], "discard-value-names">,
+  HelpText<"Discard value names in LLVM IR">;
 def load : Separate<["-"], "load">, MetaVarName<"">,
   HelpText<"Load the named plugin (dynamic shared object)">;
 def plugin : Separate<["-"], "plugin">, MetaVarName<"">,

Modified: cfe/trunk/include/clang/Frontend/CodeGenOptions.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CodeGenOptions.def?rev=263394&r1=263393&r2=263394&view=diff
==
--- cfe/trunk/include/clang/Frontend/CodeGenOptions.def (original)
+++ cfe/trunk/include/clang/Frontend/CodeGenOptions.def Sun Mar 13 16:05:23 2016
@@ -43,6 +43,7 @@ CODEGENOPT(DataSections  , 1, 0) ///
 CODEGENOPT(UniqueSectionNames, 1, 1) ///< Set for -funique-section-names.
 CODEGENOPT(DisableFPElim , 1, 0) ///< Set when -fomit-frame-pointer is 
enabled.
 CODEGENOPT(DisableFree   , 1, 0) ///< Don't free memory.
+CODEGENOPT(DiscardValueNames , 1, 0) ///< Discard Value Names from the IR 
(LLVMContext flag)
 CODEGENOPT(DisableGCov   , 1, 0) ///< Don't run the GCov pass, for testing.
 CODEGENOPT(DisableLLVMOpts   , 1, 0) ///< Don't run any optimizations, for use 
in
  ///< getting .bc files that correspond to 
the

Modified: cfe/trunk/lib/CodeGen/CGBuilder.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuilder.h?rev=263394&r1=263393&r2=263394&view=diff
==
--- cfe/trunk/lib/CodeGen/CGBuilder.h (original)
+++ cfe/trunk/lib/CodeGen/CGBuilder.h Sun Mar 13 16:05:23 2016
@@ -23,9 +23,7 @@ class CodeGenFunction;
 /// \brief This is an IRBuilder insertion helper that forwards to
 /// CodeGenFunction::InsertHelper, which adds necessary metadata to
 /// instructions.
-template 
-class CGBuilderInserter
-: protected llvm::IRBuilderDefaultInserter {
+class CGBuilderInserter : protected llvm::IRBuilderDefaultInserter {
 public:
   CGBuilderInserter() = default;
   explicit CGBuilderInserter(CodeGenFunction *CGF) : CGF(CGF) {}
@@ -39,17 +37,10 @@ private:
   CodeGenFunction *CGF = nullptr;
 };
 
-// Don't preserve names on values in an optimized build.
-#ifdef NDEBUG
-#define PreserveNames false
-#else
-#define PreserveNames true
-#endif
+typedef CGBuilderInserter CGBuilderInserterTy;
 
-typedef CGBuilderInserter CGBuilderInserterTy;
-
-typedef llvm::IRBuilder CGBuilderBaseTy;
+typedef llvm::IRBuilder
+CGBuilderBaseTy;
 
 class CGBuilderTy : public CGBuilderBaseTy {
   /// Storing a reference to the type cache here makes it a lot easier
@@ -305,8 +296,6 @@ public:
   }
 };
 
-#undef PreserveNames
-
 }  // end namespace CodeGen
 }  // end namespace clang
 

Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=263394&r1=263393&r2=263394&view=diff

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

2016-03-13 Thread Piotr Padlewski via cfe-commits
Prazek created this revision.
Prazek added a reviewer: alexfh.
Prazek added a subscriber: cfe-commits.

todo fix docs.

Is there any better solution for the basic_string problem?

http://reviews.llvm.org/D18136

Files:
  clang-tidy/boost/BoostTidyModule.cpp
  clang-tidy/boost/CMakeLists.txt
  clang-tidy/boost/UseToStringCheck.cpp
  clang-tidy/boost/UseToStringCheck.h
  docs/clang-tidy/checks/boost-use-to-string.rst
  docs/clang-tidy/checks/list.rst
  test/clang-tidy/boost-use-to-string.cpp

Index: test/clang-tidy/boost-use-to-string.cpp
===
--- /dev/null
+++ test/clang-tidy/boost-use-to-string.cpp
@@ -0,0 +1,127 @@
+// RUN: %check_clang_tidy %s boost-use-to-string %t
+
+
+namespace std {
+
+template  class basic_string {};
+
+using string = basic_string;
+using wstring = basic_string;
+}
+
+namespace boost {
+template 
+T lexical_cast(const V&) {
+  return T();
+};
+}
+
+struct my_weird_type {};
+
+std::string fun(const std::string &) {}
+
+void test_to_string1() {
+
+  auto xa = boost::lexical_cast(5);
+// CHECK-MESSAGES: :[[@LINE-1]]:13: warning: use std::to_string instead of boost::lexical_cast [boost-use-to-string]
+// CHECK-FIXES: auto xa = std::to_string(5);
+
+  std::string y = boost::lexical_cast(xa);
+// CHECK-MESSAGES: :[[@LINE-1]]:19: warning: use std::to_string instead of boost::lexical_cast [boost-use-to-string]
+// CHECK-FIXES: std::string y = std::to_string(xa);
+
+
+ auto z = boost::lexical_cast(42LL);
+// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: use std::to_string instead of boost::lexical_cast [boost-use-to-string]
+// CHECK-FIXES: auto z = std::to_string(42LL);
+
+  fun(boost::lexical_cast(42.0));
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_string instead of boost::lexical_cast [boost-use-to-string]
+// CHECK-FIXES: fun(std::to_string(42.0));
+
+  // this should not trigger
+  auto non = boost::lexical_cast(42);
+  boost::lexical_cast("12");
+}
+
+void test_to_string2() {
+  int a;
+  long b;
+  long long c;
+  unsigned d;
+  unsigned long e;
+  unsigned long long f;
+  float g;
+  double h;
+  long double i;
+
+  fun(boost::lexical_cast(a));
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_string instead of boost::lexical_cast [boost-use-to-string]
+// CHECK-FIXES: fun(std::to_string(a));
+  fun(boost::lexical_cast(b));
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_string instead of boost::lexical_cast [boost-use-to-string]
+// CHECK-FIXES: fun(std::to_string(b));
+  fun(boost::lexical_cast(c));
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_string instead of boost::lexical_cast [boost-use-to-string]
+// CHECK-FIXES: fun(std::to_string(c));
+  fun(boost::lexical_cast(d));
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_string instead of boost::lexical_cast [boost-use-to-string]
+// CHECK-FIXES: fun(std::to_string(d));
+  fun(boost::lexical_cast(e));
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_string instead of boost::lexical_cast [boost-use-to-string]
+// CHECK-FIXES: fun(std::to_string(e));
+  fun(boost::lexical_cast(f));
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_string instead of boost::lexical_cast [boost-use-to-string]
+// CHECK-FIXES: fun(std::to_string(f));
+  fun(boost::lexical_cast(g));
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_string instead of boost::lexical_cast [boost-use-to-string]
+// CHECK-FIXES: fun(std::to_string(g));
+  fun(boost::lexical_cast(h));
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_string instead of boost::lexical_cast [boost-use-to-string]
+// CHECK-FIXES: fun(std::to_string(h));
+  fun(boost::lexical_cast(i));
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_string instead of boost::lexical_cast [boost-use-to-string]
+// CHECK-FIXES: fun(std::to_string(i));
+}
+
+std::string fun(const std::wstring &) {}
+
+void test_to_wstring() {
+  int a;
+  long b;
+  long long c;
+  unsigned d;
+  unsigned long e;
+  unsigned long long f;
+  float g;
+  double h;
+  long double i;
+
+  fun(boost::lexical_cast(a));
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_wstring instead of boost::lexical_cast [boost-use-to-string]
+// CHECK-FIXES: fun(std::to_wstring(a));
+  fun(boost::lexical_cast(b));
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_wstring instead of boost::lexical_cast [boost-use-to-string]
+// CHECK-FIXES: fun(std::to_wstring(b));
+  fun(boost::lexical_cast(c));
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_wstring instead of boost::lexical_cast [boost-use-to-string]
+// CHECK-FIXES: fun(std::to_wstring(c));
+  fun(boost::lexical_cast(d));
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_wstring instead of boost::lexical_cast [boost-use-to-string]
+// CHECK-FIXES: fun(std::to_wstring(d));
+  fun(boost::lexical_cast(e));
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_wstring instead of boost::lexical_cast [boost-use-to-string]
+// CHECK-

Re: [PATCH] D16376: clang-tidy check: misc-deprecated-special-member-functions

2016-03-13 Thread Jonathan B Coe via cfe-commits
jbcoe planned changes to this revision.
jbcoe added a comment.

I'll move this to `modernize` and update docs when I get over my cold. Thanks 
for the feedback.


http://reviews.llvm.org/D16376



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


r263400 - Try to get cl-pch-showincludes passing on AArch64 bots.

2016-03-13 Thread Nico Weber via cfe-commits
Author: nico
Date: Sun Mar 13 17:26:26 2016
New Revision: 263400

URL: http://llvm.org/viewvc/llvm-project?rev=263400&view=rev
Log:
Try to get cl-pch-showincludes passing on AArch64 bots.

Modified:
cfe/trunk/test/Driver/cl-pch-showincludes.cpp

Modified: cfe/trunk/test/Driver/cl-pch-showincludes.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cl-pch-showincludes.cpp?rev=263400&r1=263399&r2=263400&view=diff
==
--- cfe/trunk/test/Driver/cl-pch-showincludes.cpp (original)
+++ cfe/trunk/test/Driver/cl-pch-showincludes.cpp Sun Mar 13 17:26:26 2016
@@ -2,6 +2,7 @@
 // command-line option, e.g. on Mac where %s is commonly under /Users.
 
 // Tests interaction of /Yc / /Yu with /showIncludes
+// REQUIRES: x86-registered-target
 
 #include "header3.h"
 


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


Re: r263344 - clang-cl: Add a test for the interaction of /Yc and /showIncludes.

2016-03-13 Thread Nico Weber via cfe-commits
r263400 probably helps, sorry about the breakage.

As far as I can tell, ~all breakages of this bot are fixed by adding a `//
REQUIRES: x86-registered-target` to a new test, so that's something you
could add yourself to get your bots back green until whoever broke it comes
back online to take a look.

On Sun, Mar 13, 2016 at 5:26 AM, Renato Golin via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> On 13 March 2016 at 02:56, Nico Weber via cfe-commits
>  wrote:
> > Author: nico
> > Date: Sat Mar 12 13:55:59 2016
> > New Revision: 263344
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=263344&view=rev
> > Log:
> > clang-cl: Add a test for the interaction of /Yc and /showIncludes.
> >
> > We almost get this right, but not completely (see FIXME).  It looks like
> /FI
> > headers generally aren't included in /showIncludes yet, but they should
> be.
> > But it seems good to have test coverage for the bits that already work.
>
> Hi Nico,
>
> This is segfaulting on all AArch64 bots:
>
> http://lab.llvm.org:8011/builders/clang-cmake-aarch64-quick/builds/5433
>
> http://lab.llvm.org:8011/builders/clang-cmake-aarch64-full/builds/1584
>
> http://lab.llvm.org:8011/builders/clang-cmake-aarch64-42vma/builds/6668
>
> And now that you have added more patches on the same area, it's not
> easy to revert.
>
> Can you please have a look?
>
> Thanks!
>
> --renato
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D17286: Make FreeBSD and NetBSD use CLANG_DEFAULT_CXX_STDLIB

2016-03-13 Thread Ed Maste via cfe-commits
emaste added a comment.

Seems fine to me


http://reviews.llvm.org/D17286



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


Re: [PATCH] D12834: add gcc abi_tag support

2016-03-13 Thread Pavel Odintsov via cfe-commits
Pavel_Odintsov added a comment.

Hello, folks!

Sorry for bothering you because I'm just user of clang 3.8 and gcc 5.3 and 
haven't any experience in compiler development. But I've hit issue mentioned in 
this ticket.

I've C++ 11 enabled libraries (gRPC, protobuf, bson and mongodb c++ 11 client) 
in my project which are compiled with gcc 5.3. So I've tried to move to clang 
for this project for testing purposes (and awesome clang static analyzer!).

But actually it becoming nightmare because I need to rebuild each C++ 11 
library for both compilers because of this issue :(

Could you look on this issue and offer some workaround? Will be fine to have 
support of already created by gcc 5.3 tags.


Repository:
  rL LLVM

http://reviews.llvm.org/D12834



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


Re: [PATCH] D16749: [OpenMP] Map clause codegeneration.

2016-03-13 Thread Samuel Antao via cfe-commits
sfantao added a comment.

Ping!


http://reviews.llvm.org/D16749



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


[libcxx] r263405 - Mark exception-throwing test as XFAIL when exceptions are disabled

2016-03-13 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Sun Mar 13 21:51:50 2016
New Revision: 263405

URL: http://llvm.org/viewvc/llvm-project?rev=263405&view=rev
Log:
Mark exception-throwing test as XFAIL when exceptions are disabled

Modified:

libcxx/trunk/test/std/utilities/memory/default.allocator/allocator.members/allocate.size.pass.cpp

Modified: 
libcxx/trunk/test/std/utilities/memory/default.allocator/allocator.members/allocate.size.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/default.allocator/allocator.members/allocate.size.pass.cpp?rev=263405&r1=263404&r2=263405&view=diff
==
--- 
libcxx/trunk/test/std/utilities/memory/default.allocator/allocator.members/allocate.size.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/memory/default.allocator/allocator.members/allocate.size.pass.cpp
 Sun Mar 13 21:51:50 2016
@@ -7,6 +7,7 @@
 //
 
//===--===//
 
+// XFAIL: libcpp-no-exceptions
 // 
 
 // allocator:


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


[PATCH] D18138: Add -fnative-half-arguments-and-returns

2016-03-13 Thread Pirama Arumuga Nainar via cfe-commits
pirama created this revision.
pirama added reviewers: srhines, olista01.
pirama added a subscriber: cfe-commits.

r246764 handled __fp16 arguments and returns for AAPCS, but skipped this
handling for OpenCL.  Simlar to OpenCL, RenderScript also handles __fp16
type natively.

This patch adds the -fnative-half-arguments-and-returns command line
flag to allow such languages to skip this coercion of __fp16.

http://reviews.llvm.org/D18138

Files:
  include/clang/Basic/LangOptions.def
  include/clang/Driver/CC1Options.td
  lib/CodeGen/TargetInfo.cpp
  lib/Frontend/CompilerInvocation.cpp
  test/CodeGen/arm-fp16-arguments.c

Index: test/CodeGen/arm-fp16-arguments.c
===
--- test/CodeGen/arm-fp16-arguments.c
+++ test/CodeGen/arm-fp16-arguments.c
@@ -1,5 +1,6 @@
 // RUN: %clang_cc1 -triple armv7a--none-eabi -target-abi aapcs -mfloat-abi soft -fallow-half-arguments-and-returns -emit-llvm -o - -O1 %s | FileCheck %s --check-prefix=CHECK --check-prefix=SOFT
 // RUN: %clang_cc1 -triple armv7a--none-eabi -target-abi aapcs -mfloat-abi hard -fallow-half-arguments-and-returns -emit-llvm -o - -O1 %s | FileCheck %s --check-prefix=CHECK --check-prefix=HARD
+// RUN: %clang_cc1 -triple armv7a--none-eabi -target-abi aapcs -mfloat-abi soft -fnative-half-arguments-and-returns -emit-llvm -o - -O1 %s | FileCheck %s --check-prefix=NATIVE
 
 __fp16 g;
 
@@ -10,12 +11,17 @@
 // HARD: [[BITCAST:%.*]] = bitcast float [[PARAM]] to i32
 // HARD: [[TRUNC:%.*]] = trunc i32 [[BITCAST]] to i16
 // CHECK: store i16 [[TRUNC]], i16* bitcast (half* @g to i16*)
+// NATIVE: define void @t1(half [[PARAM:%.*]])
+// NATIVE: store half [[PARAM]], half* @g
 
 __fp16 t2() { return g; }
 // SOFT: define i32 @t2()
 // HARD: define arm_aapcs_vfpcc float @t2()
+// NATIVE: define half @t2()
 // CHECK: [[LOAD:%.*]] = load i16, i16* bitcast (half* @g to i16*)
 // CHECK: [[ZEXT:%.*]] = zext i16 [[LOAD]] to i32
 // SOFT: ret i32 [[ZEXT]]
 // HARD: [[BITCAST:%.*]] = bitcast i32 [[ZEXT]] to float
 // HARD: ret float [[BITCAST]]
+// NATIVE: [[LOAD:%.*]] = load half, half* @g
+// NATIVE: ret half [[LOAD]]
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -1439,6 +1439,7 @@
 Opts.LaxVectorConversions = 0;
 Opts.DefaultFPContract = 1;
 Opts.NativeHalfType = 1;
+Opts.NativeHalfArgsAndReturns = 1;
   }
 
   Opts.CUDA = IK == IK_CUDA || IK == IK_PreprocessedCuda ||
@@ -1800,7 +1801,11 @@
   Opts.ModuleFeatures = Args.getAllArgValues(OPT_fmodule_feature);
   std::sort(Opts.ModuleFeatures.begin(), Opts.ModuleFeatures.end());
   Opts.NativeHalfType |= Args.hasArg(OPT_fnative_half_type);
-  Opts.HalfArgsAndReturns = Args.hasArg(OPT_fallow_half_arguments_and_returns);
+  Opts.NativeHalfArgsAndReturns |= Args.hasArg(OPT_fnative_half_arguments_and_returns);
+  // Enable HalfArgsAndReturns if present in Args or if NativeHalfArgsAndReturns
+  // is enabled.
+  Opts.HalfArgsAndReturns = Args.hasArg(OPT_fallow_half_arguments_and_returns)
+| Opts.NativeHalfArgsAndReturns;
   Opts.GNUAsm = !Args.hasArg(OPT_fno_gnu_inline_asm);
 
   // __declspec is enabled by default for the PS4 by the driver, and also
Index: lib/CodeGen/TargetInfo.cpp
===
--- lib/CodeGen/TargetInfo.cpp
+++ lib/CodeGen/TargetInfo.cpp
@@ -5106,7 +5106,7 @@
   // __fp16 gets passed as if it were an int or float, but with the top 16 bits
   // unspecified. This is not done for OpenCL as it handles the half type
   // natively, and does not need to interwork with AAPCS code.
-  if (Ty->isHalfType() && !getContext().getLangOpts().OpenCL) {
+  if (Ty->isHalfType() && !getContext().getLangOpts().NativeHalfArgsAndReturns) {
 llvm::Type *ResType = IsEffectivelyAAPCS_VFP ?
   llvm::Type::getFloatTy(getVMContext()) :
   llvm::Type::getInt32Ty(getVMContext());
@@ -5298,7 +5298,7 @@
   // __fp16 gets returned as if it were an int or float, but with the top 16
   // bits unspecified. This is not done for OpenCL as it handles the half type
   // natively, and does not need to interwork with AAPCS code.
-  if (RetTy->isHalfType() && !getContext().getLangOpts().OpenCL) {
+  if (RetTy->isHalfType() && !getContext().getLangOpts().NativeHalfArgsAndReturns) {
 llvm::Type *ResType = IsEffectivelyAAPCS_VFP ?
   llvm::Type::getFloatTy(getVMContext()) :
   llvm::Type::getInt32Ty(getVMContext());
Index: include/clang/Driver/CC1Options.td
===
--- include/clang/Driver/CC1Options.td
+++ include/clang/Driver/CC1Options.td
@@ -603,6 +603,8 @@
   HelpText<"Control emission of RTTI data">;
 def fnative_half_type: Flag<["-"], "fnative-half-type">,
   HelpText<"Use the native half type for __fp16 instead of promoting to float">;
+def fnative_half_arguments_an

[PATCH] D18139: [Cxx1z] Implement Lambda Capture of *this by Value as [=, *this] (P0018R3)

2016-03-13 Thread Faisal Vali via cfe-commits
faisalv created this revision.
faisalv added a reviewer: rsmith.
faisalv added a subscriber: cfe-commits.

Implement lambda capture of *this.

struct A {
  int d = 10;
  auto foo() { return [*this] (auto a) mutable { d+=a; return d; }; }
};
auto L = A{}.foo(); // A{}'s lifetime is gone.

// Below is still ok, because *this was captured by value.
assert(L(10) == 20);
assert(L(100) == 120);




http://reviews.llvm.org/D18139

Files:
  README.txt
  include/clang/AST/LambdaCapture.h
  include/clang/Basic/Lambda.h
  include/clang/Sema/ScopeInfo.h
  include/clang/Sema/Sema.h
  lib/AST/ExprCXX.cpp
  lib/AST/StmtPrinter.cpp
  lib/AST/StmtProfile.cpp
  lib/CodeGen/CodeGenFunction.cpp
  lib/Parse/ParseExprCXX.cpp
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaExpr.cpp
  lib/Sema/SemaExprCXX.cpp
  lib/Sema/SemaLambda.cpp
  lib/Sema/TreeTransform.h
  lib/Serialization/ASTReaderDecl.cpp
  lib/Serialization/ASTWriter.cpp
  test/CodeGenCXX/cxx1z-lambda-star-this.cpp
  test/SemaCXX/cxx1z-lambda-star-this.cpp

Index: test/SemaCXX/cxx1z-lambda-star-this.cpp
===
--- /dev/null
+++ test/SemaCXX/cxx1z-lambda-star-this.cpp
@@ -0,0 +1,72 @@
+// RUN: %clang_cc1 -std=c++1z -verify -fsyntax-only -fblocks -emit-llvm-only %s
+// RUN: %clang_cc1 -std=c++1z -verify -fsyntax-only -fblocks -fdelayed-template-parsing %s -DDELAYED_TEMPLATE_PARSING
+// RUN: %clang_cc1 -std=c++1z -verify -fsyntax-only -fblocks -fms-extensions %s -DMS_EXTENSIONS
+// RUN: %clang_cc1 -std=c++1z -verify -fsyntax-only -fblocks -fdelayed-template-parsing -fms-extensions %s -DMS_EXTENSIONS -DDELAYED_TEMPLATE_PARSING
+
+
+namespace test_star_this {
+namespace ns1 {
+class A {
+  int x = 345;
+  auto foo() {
+(void) [*this, this] { };  //expected-error{{'this' can appear only once}}
+(void) [this] { ++x; };
+(void) [*this] { ++x; };  //expected-error{{read-only variable}}
+(void) [*this] () mutable { ++x; };
+(void) [=] { return x; };
+(void) [&, this] { return x; };
+(void) [=, *this] { return x; };
+(void) [&, *this] { return x; };
+  }
+};
+} // end ns1
+
+namespace ns2 {
+  class B {
+B(const B&) = delete; //expected-note{{deleted here}}
+int *x = (int *) 456;
+void foo() {
+  (void)[this] { return x; };
+  (void)[*this] { return x; }; //expected-error{{call to deleted}}
+}
+  };
+} // end ns2
+namespace ns3 {
+  class B {
+B(const B&) = delete; //expected-note2{{deleted here}}
+
+int *x = (int *) 456;
+public: 
+template
+void foo() {
+  (void)[this] { return x; };
+  (void)[*this] { return x; }; //expected-error2{{call to deleted}}
+}
+
+B() = default;
+  } b;
+  B *c = (b.foo(), nullptr); //expected-note{{in instantiation}}
+} // end ns3
+
+namespace ns4 {
+template
+class B {
+  B(const B&) = delete; //expected-note{{deleted here}}
+  double d = 3.14;
+  public: 
+  template
+  auto foo() {
+const auto &L = [*this] (auto a) mutable { //expected-error{{call to deleted}}
+  d += a; 
+  return [this] (auto b) { return d +=b; }; 
+}; 
+  }
+  
+  B() = default;
+};
+void main() {
+  B b;
+  b.foo(); //expected-note{{in instantiation}}
+} // end main  
+} // end ns4
+} //end ns test_star_this
Index: test/CodeGenCXX/cxx1z-lambda-star-this.cpp
===
--- /dev/null
+++ test/CodeGenCXX/cxx1z-lambda-star-this.cpp
@@ -0,0 +1,31 @@
+// RUN: %clang_cc1 -std=c++1y -triple i686-pc-windows-msvc -emit-llvm %s -o - | FileCheck %s
+//CHECK: %[[A_LAMBDA:.*]] = type { %struct.A }
+//CHECK: %[[B_LAMBDA:.*]] = type { %struct.B* }
+struct A {
+  double a = 111;
+  auto foo() { return [*this] { return a; }; }
+};
+
+namespace ns1 {
+int X = A{}.foo()();
+} //end ns1
+
+//CHECK: @"\01?foo@A@@QAE?A?@@XZ"(%struct.A* %this, %class.anon* noalias sret %[[A_LAMBDA_RETVAL:.*]])
+// get the first object with the closure type, which is of type 'struct.A'
+//CHECK: %0 = getelementptr inbounds %[[A_LAMBDA]], %[[A_LAMBDA]]* %[[A_LAMBDA_RETVAL]], i32 0, i32 0
+//CHECK: %1 = bitcast %struct.A* %0 to i8*
+//CHECK: %2 = bitcast %struct.A* %this1 to i8*
+// copy the contents ...
+//CHECK: call void @llvm.memcpy.p0i8.p0i8.i32(i8* %1, i8* %2, i32 8, i32 8, i1 false)
+
+struct B {
+  double b = 222;
+  auto bar() { return [this] { return b; }; };
+};
+
+namespace ns2 {
+int X = B{}.bar()();
+}
+//CHECK: @"\01?bar@B@@QAE?A?@@XZ"(%struct.B* %this, %class.anon.0* noalias sret %agg.result)
+//CHECK: %0 = getelementptr inbounds %class.anon.0, %class.anon.0* %agg.result, i32 0, i32 0
+//CHECK: store %struct.B* %this1, %struct.B** %0, align 4
\ No newline at end of file
Index: lib/Serialization/ASTWriter.cpp
===
--- lib/Serialization/ASTWriter.cpp
+++ lib/Serialization/ASTWriter.cpp
@@ -5631,6 +5631,7 @@
   Record.push_back(Capture.isImplicit());
   Record.push_back(Capture.getCaptureKind());
   switch (Captu

Re: [PATCH] D18112: [OpenMP] Replace offloading option that start with -o with -fo.

2016-03-13 Thread Alexey Bataev via cfe-commits
ABataev accepted this revision.
ABataev added a comment.
This revision is now accepted and ready to land.

LG


http://reviews.llvm.org/D18112



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


Re: [PATCH] D18105: [OPENMP] Support for codegen of private clause of target, host side

2016-03-13 Thread Alexey Bataev via cfe-commits
ABataev accepted this revision.
ABataev added a comment.
This revision is now accepted and ready to land.

LG


Repository:
  rL LLVM

http://reviews.llvm.org/D18105



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


r263410 - Give the test a temporary output so it can be cleaned up.

2016-03-13 Thread Eric Christopher via cfe-commits
Author: echristo
Date: Mon Mar 14 01:21:07 2016
New Revision: 263410

URL: http://llvm.org/viewvc/llvm-project?rev=263410&view=rev
Log:
Give the test a temporary output so it can be cleaned up.

Modified:
cfe/trunk/test/Driver/cl-pch-showincludes.cpp

Modified: cfe/trunk/test/Driver/cl-pch-showincludes.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cl-pch-showincludes.cpp?rev=263410&r1=263409&r2=263410&view=diff
==
--- cfe/trunk/test/Driver/cl-pch-showincludes.cpp (original)
+++ cfe/trunk/test/Driver/cl-pch-showincludes.cpp Mon Mar 14 01:21:07 2016
@@ -8,14 +8,14 @@
 
 // When building the pch, header1.h (included by header2.h), header2.h (the pch
 // input itself) and header3.h (included directly, above) should be printed.
-// RUN: %clang_cl -Werror /showIncludes /I%S/Inputs /Ycheader2.h /FIheader2.h 
/Fp%t.pch /c -- %s 2>&1 \
+// RUN: %clang_cl -Werror /showIncludes /I%S/Inputs /Ycheader2.h /FIheader2.h 
/Fp%t.pch /c /Fo%t -- %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHECK-YC %s
 // CHECK-YC: Note: including file: {{.+header2.h}}
 // CHECK-YC: Note: including file: {{.+header1.h}}
 // CHECK-YC: Note: including file: {{.+header3.h}}
 
 // When using the pch, only the direct include is printed.
-// RUN: %clang_cl -Werror /showIncludes /I%S/Inputs /Yuheader2.h /FIheader2.h 
/Fp%t.pch /c -- %s 2>&1 \
+// RUN: %clang_cl -Werror /showIncludes /I%S/Inputs /Yuheader2.h /FIheader2.h 
/Fp%t.pch /c /Fo%t -- %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHECK-YU %s
 // CHECK-YU-NOT: Note: including file: {{.*pch}}
 // CHECK-YU-NOT: Note: including file: {{.*header1.h}}


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