r283657 - Un-tabify source files, NFC.

2016-10-07 Thread Yaron Keren via cfe-commits
Author: yrnkrn
Date: Sat Oct  8 01:45:10 2016
New Revision: 283657

URL: http://llvm.org/viewvc/llvm-project?rev=283657&view=rev
Log:
Un-tabify source files, NFC.


Modified:
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/lib/AST/ExprConstant.cpp
cfe/trunk/lib/AST/NestedNameSpecifier.cpp
cfe/trunk/lib/AST/TypeLoc.cpp

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=283657&r1=283656&r2=283657&view=diff
==
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Sat Oct  8 01:45:10 2016
@@ -6557,9 +6557,8 @@ CreateX86_64ABIBuiltinVaListDecl(const A
 static TypedefDecl *CreatePNaClABIBuiltinVaListDecl(const ASTContext *Context) 
{
   // typedef int __builtin_va_list[4];
   llvm::APInt Size(Context->getTypeSize(Context->getSizeType()), 4);
-  QualType IntArrayType
-= Context->getConstantArrayType(Context->IntTy,
-   Size, ArrayType::Normal, 0);
+  QualType IntArrayType =
+  Context->getConstantArrayType(Context->IntTy, Size, ArrayType::Normal, 
0);
   return Context->buildImplicitTypedef(IntArrayType, "__builtin_va_list");
 }
 

Modified: cfe/trunk/lib/AST/ExprConstant.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=283657&r1=283656&r2=283657&view=diff
==
--- cfe/trunk/lib/AST/ExprConstant.cpp (original)
+++ cfe/trunk/lib/AST/ExprConstant.cpp Sat Oct  8 01:45:10 2016
@@ -5294,8 +5294,8 @@ bool PointerExprEvaluator::VisitCallExpr
 
   if (BaseAlignment < Align) {
 Result.Designator.setInvalid();
-   // FIXME: Quantities here cast to integers because the plural modifier
-   // does not work on APSInts yet.
+// FIXME: Quantities here cast to integers because the plural modifier
+// does not work on APSInts yet.
 CCEDiag(E->getArg(0),
 diag::note_constexpr_baa_insufficient_alignment) << 0
   << (int) BaseAlignment.getQuantity()

Modified: cfe/trunk/lib/AST/NestedNameSpecifier.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/NestedNameSpecifier.cpp?rev=283657&r1=283656&r2=283657&view=diff
==
--- cfe/trunk/lib/AST/NestedNameSpecifier.cpp (original)
+++ cfe/trunk/lib/AST/NestedNameSpecifier.cpp Sat Oct  8 01:45:10 2016
@@ -155,7 +155,7 @@ NestedNameSpecifier::SpecifierKind Neste
 
 /// \brief Retrieve the namespace stored in this nested name specifier.
 NamespaceDecl *NestedNameSpecifier::getAsNamespace() const {
-   if (Prefix.getInt() == StoredDecl)
+  if (Prefix.getInt() == StoredDecl)
 return dyn_cast(static_cast(Specifier));
 
   return nullptr;
@@ -163,7 +163,7 @@ NamespaceDecl *NestedNameSpecifier::getA
 
 /// \brief Retrieve the namespace alias stored in this nested name specifier.
 NamespaceAliasDecl *NestedNameSpecifier::getAsNamespaceAlias() const {
-   if (Prefix.getInt() == StoredDecl)
+  if (Prefix.getInt() == StoredDecl)
 return dyn_cast(static_cast(Specifier));
 
   return nullptr;

Modified: cfe/trunk/lib/AST/TypeLoc.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/TypeLoc.cpp?rev=283657&r1=283656&r2=283657&view=diff
==
--- cfe/trunk/lib/AST/TypeLoc.cpp (original)
+++ cfe/trunk/lib/AST/TypeLoc.cpp Sat Oct  8 01:45:10 2016
@@ -210,7 +210,7 @@ SourceLocation TypeLoc::getEndLoc() cons
 switch (Cur.getTypeLocClass()) {
 default:
   if (!Last)
-   Last = Cur;
+Last = Cur;
   return Last.getLocalSourceRange().getEnd();
 case Paren:
 case ConstantArray:


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


[PATCH] D25389: Fix std::pair on FreeBSD

2016-10-07 Thread Eric Fiselier via cfe-commits
EricWF created this revision.
EricWF added reviewers: emaste, dim, theraven, rsmith.
EricWF added a subscriber: cfe-commits.

FreeBSD ships an old ABI for std::pair which requires that it have non-trivial 
copy/move constructors. Currently the non-trivial copy/move is achieved by 
providing explicit definitions of the constructors. This is problematic because 
it means the constructors don't SFINAE properly. In order to SFINAE copy/move 
constructors they have to be explicitly defaulted and hense non-trivial.

This patch attempts to provide SFINAE'ing copy/move constructors for std::pair 
while still making them non-trivial. It does this by adding a base class with a 
non-trivial copy constructor and then allowing pair's constructors to be 
generated by the compiler. This also allows the constructors to be constexpr.


https://reviews.llvm.org/D25389

Files:
  include/utility
  
test/libcxx/utilities/utility/pairs/pairs.pair/non_trivial_copy_move_ABI.pass.cpp

Index: test/libcxx/utilities/utility/pairs/pairs.pair/non_trivial_copy_move_ABI.pass.cpp
===
--- test/libcxx/utilities/utility/pairs/pairs.pair/non_trivial_copy_move_ABI.pass.cpp
+++ test/libcxx/utilities/utility/pairs/pairs.pair/non_trivial_copy_move_ABI.pass.cpp
@@ -7,49 +7,142 @@
 //
 //===--===//
 
+// The test fails due to the missing is_trivially_constructible intrinsic.
+// XFAIL: gcc-4.9
+
 // 
 
 // template  struct pair
 
-// Test that we properly provide the old non-trivial copy operations
-// when the ABI macro is defined.
+// Test that we properly provide the trivial copy operations by default.
 
+// FreeBSD provides the old ABI. This test checks the new ABI so we need
+// to manually turn it on.
+#undef _LIBCPP_ABI_UNSTABLE
+#undef _LIBCPP_ABI_VERSION
+#define _LIBCPP_ABI_VERSION 1
 #define _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR
+
 #include 
+#include 
+#include 
 #include 
 
 #include "test_macros.h"
 
+#if !defined(_LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR)
+#error trivial ctor ABI macro defined
+#endif
+
+template 
+struct HasNonTrivialABI : std::integral_constant::value
+|| (std::is_copy_constructible::value && !std::is_trivially_copy_constructible::value)
+#if TEST_STD_VER >= 11
+   || (std::is_move_constructible::value && !std::is_trivially_move_constructible::value)
+#endif
+> {};
+
 #if TEST_STD_VER >= 11
-struct Dummy {
-  Dummy(Dummy const&) = delete;
-  Dummy(Dummy &&) = default;
+struct NonTrivialDtor {
+NonTrivialDtor(NonTrivialDtor const&) = default;
+~NonTrivialDtor();
+};
+NonTrivialDtor::~NonTrivialDtor() {}
+static_assert(HasNonTrivialABI::value, "");
+
+struct NonTrivialCopy {
+NonTrivialCopy(NonTrivialCopy const&);
+};
+NonTrivialCopy::NonTrivialCopy(NonTrivialCopy const&) {}
+static_assert(HasNonTrivialABI::value, "");
+
+struct NonTrivialMove {
+NonTrivialMove(NonTrivialMove const&) = default;
+NonTrivialMove(NonTrivialMove&&);
+};
+NonTrivialMove::NonTrivialMove(NonTrivialMove&&) {}
+static_assert(HasNonTrivialABI::value, "");
+
+struct DeletedCopy {
+DeletedCopy(DeletedCopy const&) = delete;
+DeletedCopy(DeletedCopy&&) = default;
 };
+static_assert(!HasNonTrivialABI::value, "");
+
+struct TrivialMove {
+  TrivialMove(TrivialMove &&) = default;
+};
+static_assert(!HasNonTrivialABI::value, "");
+
+struct Trivial {
+Trivial(Trivial const&) = default;
+};
+static_assert(!HasNonTrivialABI::value, "");
 #endif
 
+
 int main()
 {
-typedef std::pair P;
 {
+typedef std::pair P;
 static_assert(std::is_copy_constructible::value, "");
-static_assert(!std::is_trivially_copy_constructible::value, "");
-static_assert(!std::is_trivially_copyable::value, "");
+static_assert(HasNonTrivialABI::value, "");
 }
 #if TEST_STD_VER >= 11
 {
+typedef std::pair P;
+static_assert(std::is_move_constructible::value, "");
+static_assert(HasNonTrivialABI::value, "");
+}
+{
+using P = std::pair;
+static_assert(!std::is_trivially_destructible::value, "");
+static_assert(std::is_copy_constructible::value, "");
+static_assert(!std::is_trivially_copy_constructible::value, "");
+static_assert(std::is_move_constructible::value, "");
+static_assert(!std::is_trivially_move_constructible::value, "");
+static_assert(HasNonTrivialABI::value, "");
+}
+{
+using P = std::pair;
+static_assert(std::is_copy_constructible::value, "");
+static_assert(!std::is_trivially_copy_constructible::value, "");
 static_assert(std::is_move_constructible::value, "");
 static_assert(!std::is_trivially_move_constructible::value, "");
-static_assert(!std::is_trivially_copyable::value, "");
+static_assert(HasNonTrivialABI::value, "");
 }
 {
-using P1 = std::pair;
- 

r283645 - Use StringRef in Command::printArg() instead of raw pointer (NFC)

2016-10-07 Thread Mehdi Amini via cfe-commits
Author: mehdi_amini
Date: Fri Oct  7 20:38:43 2016
New Revision: 283645

URL: http://llvm.org/viewvc/llvm-project?rev=283645&view=rev
Log:
Use StringRef in Command::printArg() instead of raw pointer (NFC)

Modified:
cfe/trunk/include/clang/Driver/Job.h
cfe/trunk/lib/Driver/Job.cpp

Modified: cfe/trunk/include/clang/Driver/Job.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Job.h?rev=283645&r1=283644&r2=283645&view=diff
==
--- cfe/trunk/include/clang/Driver/Job.h (original)
+++ cfe/trunk/include/clang/Driver/Job.h Fri Oct  7 20:38:43 2016
@@ -116,7 +116,7 @@ public:
   const llvm::opt::ArgStringList &getArguments() const { return Arguments; }
 
   /// Print a command argument, and optionally quote it.
-  static void printArg(llvm::raw_ostream &OS, const char *Arg, bool Quote);
+  static void printArg(llvm::raw_ostream &OS, StringRef Arg, bool Quote);
 };
 
 /// Like Command, but with a fallback which is executed in case

Modified: cfe/trunk/lib/Driver/Job.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Job.cpp?rev=283645&r1=283644&r2=283645&view=diff
==
--- cfe/trunk/lib/Driver/Job.cpp (original)
+++ cfe/trunk/lib/Driver/Job.cpp Fri Oct  7 20:38:43 2016
@@ -80,8 +80,8 @@ static int skipArgs(const char *Flag, bo
   return 0;
 }
 
-void Command::printArg(raw_ostream &OS, const char *Arg, bool Quote) {
-  const bool Escape = std::strpbrk(Arg, "\"\\$");
+void Command::printArg(raw_ostream &OS, StringRef Arg, bool Quote) {
+  const bool Escape = Arg.find_first_of("\"\\$") != StringRef::npos;
 
   if (!Quote && !Escape) {
 OS << Arg;
@@ -90,7 +90,7 @@ void Command::printArg(raw_ostream &OS,
 
   // Quote and escape. This isn't really complete, but good enough.
   OS << '"';
-  while (const char c = *Arg++) {
+  for (const char c : Arg) {
 if (c == '"' || c == '\\' || c == '$')
   OS << '\\';
 OS << c;


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


[libcxx] r283644 - Remove all _LIBCPP_VERSION tests from under test/std

2016-10-07 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Oct  7 20:32:56 2016
New Revision: 283644

URL: http://llvm.org/viewvc/llvm-project?rev=283644&view=rev
Log:
Remove all _LIBCPP_VERSION tests from under test/std

Added:
libcxx/trunk/test/libcxx/depr/depr.c.headers/ciso646.pass.cpp
libcxx/trunk/test/libcxx/depr/depr.c.headers/complex.h.pass.cpp
libcxx/trunk/test/libcxx/depr/depr.c.headers/tgmath_h.pass.cpp
libcxx/trunk/test/libcxx/numerics/c.math/
libcxx/trunk/test/libcxx/numerics/c.math/ctgmath.pass.cpp
libcxx/trunk/test/libcxx/numerics/c.math/tgmath_h.pass.cpp
libcxx/trunk/test/libcxx/numerics/c.math/version_cmath.pass.cpp
libcxx/trunk/test/libcxx/numerics/complex.number/ccmplx/
libcxx/trunk/test/libcxx/numerics/complex.number/ccmplx/ccomplex.pass.cpp
Removed:
libcxx/trunk/test/std/numerics/c.math/version_cmath.pass.cpp
Modified:
libcxx/trunk/test/std/depr/depr.c.headers/ciso646.pass.cpp
libcxx/trunk/test/std/depr/depr.c.headers/complex.h.pass.cpp
libcxx/trunk/test/std/depr/depr.c.headers/tgmath_h.pass.cpp
libcxx/trunk/test/std/numerics/c.math/ctgmath.pass.cpp
libcxx/trunk/test/std/numerics/c.math/tgmath_h.pass.cpp
libcxx/trunk/test/std/numerics/complex.number/ccmplx/ccomplex.pass.cpp

Added: libcxx/trunk/test/libcxx/depr/depr.c.headers/ciso646.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/depr/depr.c.headers/ciso646.pass.cpp?rev=283644&view=auto
==
--- libcxx/trunk/test/libcxx/depr/depr.c.headers/ciso646.pass.cpp (added)
+++ libcxx/trunk/test/libcxx/depr/depr.c.headers/ciso646.pass.cpp Fri Oct  7 
20:32:56 2016
@@ -0,0 +1,20 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// 
+
+#include 
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}

Added: libcxx/trunk/test/libcxx/depr/depr.c.headers/complex.h.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/depr/depr.c.headers/complex.h.pass.cpp?rev=283644&view=auto
==
--- libcxx/trunk/test/libcxx/depr/depr.c.headers/complex.h.pass.cpp (added)
+++ libcxx/trunk/test/libcxx/depr/depr.c.headers/complex.h.pass.cpp Fri Oct  7 
20:32:56 2016
@@ -0,0 +1,21 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// 
+
+#include 
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+std::complex d;
+}

Added: libcxx/trunk/test/libcxx/depr/depr.c.headers/tgmath_h.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/depr/depr.c.headers/tgmath_h.pass.cpp?rev=283644&view=auto
==
--- libcxx/trunk/test/libcxx/depr/depr.c.headers/tgmath_h.pass.cpp (added)
+++ libcxx/trunk/test/libcxx/depr/depr.c.headers/tgmath_h.pass.cpp Fri Oct  7 
20:32:56 2016
@@ -0,0 +1,23 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// 
+
+#include 
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+std::complex cd;
+double x = sin(1.0);
+(void)x; // to placate scan-build
+}

Added: libcxx/trunk/test/libcxx/numerics/c.math/ctgmath.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/numerics/c.math/ctgmath.pass.cpp?rev=283644&view=auto
==
--- libcxx/trunk/test/libcxx/numerics/c.math/ctgmath.pass.cpp (added)
+++ libcxx/trunk/test/libcxx/numerics/c.math/ctgmath.pass.cpp Fri Oct  7 
20:32:56 2016
@@ -0,0 +1,22 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// 
+
+#include 
+
+#ifndef _LI

[libcxx] r283643 - Purge all usages of _LIBCPP_STD_VER under test/std/algorithm

2016-10-07 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Oct  7 20:25:23 2016
New Revision: 283643

URL: http://llvm.org/viewvc/llvm-project?rev=283643&view=rev
Log:
Purge all usages of _LIBCPP_STD_VER under test/std/algorithm

Modified:
libcxx/trunk/test/std/algorithms/alg.nonmodifying/alg.equal/equal.pass.cpp

libcxx/trunk/test/std/algorithms/alg.nonmodifying/alg.equal/equal_pred.pass.cpp

libcxx/trunk/test/std/algorithms/alg.nonmodifying/alg.is_permutation/is_permutation.pass.cpp

libcxx/trunk/test/std/algorithms/alg.nonmodifying/alg.is_permutation/is_permutation_pred.pass.cpp

libcxx/trunk/test/std/algorithms/alg.nonmodifying/mismatch/mismatch_pred.pass.cpp
libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/max.pass.cpp
libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/max_comp.pass.cpp

libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/max_init_list.pass.cpp

libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/max_init_list_comp.pass.cpp
libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/min.pass.cpp
libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/min_comp.pass.cpp

libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/min_init_list.pass.cpp

libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/min_init_list_comp.pass.cpp
libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/minmax.pass.cpp

libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/minmax_comp.pass.cpp

libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/minmax_init_list.pass.cpp

libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/minmax_init_list_comp.pass.cpp

Modified: 
libcxx/trunk/test/std/algorithms/alg.nonmodifying/alg.equal/equal.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.nonmodifying/alg.equal/equal.pass.cpp?rev=283643&r1=283642&r2=283643&view=diff
==
--- libcxx/trunk/test/std/algorithms/alg.nonmodifying/alg.equal/equal.pass.cpp 
(original)
+++ libcxx/trunk/test/std/algorithms/alg.nonmodifying/alg.equal/equal.pass.cpp 
Fri Oct  7 20:25:23 2016
@@ -17,11 +17,9 @@
 #include 
 #include 
 
+#include "test_macros.h"
 #include "test_iterators.h"
 
-#if _LIBCPP_STD_VER > 11
-#define HAS_FOUR_ITERATOR_VERSION
-#endif
 
 int main()
 {
@@ -31,7 +29,7 @@ int main()
 assert(std::equal(input_iterator(ia),
   input_iterator(ia+s),
   input_iterator(ia)));
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
 assert(std::equal(input_iterator(ia),
   input_iterator(ia+s),
   input_iterator(ia),
@@ -44,7 +42,7 @@ int main()
 assert(!std::equal(input_iterator(ia),
input_iterator(ia+s),
input_iterator(ib)));
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
 assert(!std::equal(input_iterator(ia),
input_iterator(ia+s),
input_iterator(ib),

Modified: 
libcxx/trunk/test/std/algorithms/alg.nonmodifying/alg.equal/equal_pred.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.nonmodifying/alg.equal/equal_pred.pass.cpp?rev=283643&r1=283642&r2=283643&view=diff
==
--- 
libcxx/trunk/test/std/algorithms/alg.nonmodifying/alg.equal/equal_pred.pass.cpp 
(original)
+++ 
libcxx/trunk/test/std/algorithms/alg.nonmodifying/alg.equal/equal_pred.pass.cpp 
Fri Oct  7 20:25:23 2016
@@ -19,12 +19,9 @@
 #include 
 #include 
 
+#include "test_macros.h"
 #include "test_iterators.h"
 
-#if _LIBCPP_STD_VER > 11
-#define HAS_FOUR_ITERATOR_VERSION
-#endif
-
 int comparison_count = 0;
 template 
 bool counting_equals ( const T &a, const T &b ) {
@@ -41,7 +38,7 @@ int main()
   input_iterator(ia+s),
   input_iterator(ia),
   std::equal_to()));
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
 assert(std::equal(input_iterator(ia),
   input_iterator(ia+s),
   input_iterator(ia),
@@ -72,7 +69,7 @@ int main()
input_iterator(ia+s),
input_iterator(ib),
std::equal_to()));
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
 assert(!std::equal(input_iterator(ia),
input_iterator(ia+s),
input_iterator(ib),

Modified: 
libcxx/trunk/test/std/algorithms/alg.nonmodifying/alg.is_permutation/is_permutation.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.nonmodifying/alg.is_permutation/is_permutation.pass.cpp?rev=283643&r1=283642&r2=283643&view=diff
==
--- 
libcxx/trunk/test/std/algorithms/alg.nonmodifying/alg.is_perm

[PATCH] D25387: When optimizing for size, enable loop rerolling by default.

2016-10-07 Thread Hal Finkel via cfe-commits
hfinkel created this revision.
hfinkel added a reviewer: jmolloy.
hfinkel added a subscriber: cfe-commits.
Herald added a subscriber: mcrosier.

We have a loop-rerolling optimization which can be enabled by using 
-freroll-loops. While sometimes loops are hand-unrolled for performance 
reasons, when optimizing for size, we should always undo this manual 
optimization to produce smaller code (our optimizer's unroller will still 
unroll the rerolled loops if it thinks that is a good idea).


https://reviews.llvm.org/D25387

Files:
  lib/Driver/Tools.cpp
  test/Driver/clang_f_opts.c


Index: test/Driver/clang_f_opts.c
===
--- test/Driver/clang_f_opts.c
+++ test/Driver/clang_f_opts.c
@@ -47,7 +47,12 @@
 // CHECK-NO-UNROLL-LOOPS: "-fno-unroll-loops"
 
 // RUN: %clang -### -S -freroll-loops %s 2>&1 | FileCheck 
-check-prefix=CHECK-REROLL-LOOPS %s
+// RUN: %clang -### -S -Os %s 2>&1 | FileCheck 
-check-prefix=CHECK-REROLL-LOOPS %s
+// RUN: %clang -### -S -Oz %s 2>&1 | FileCheck 
-check-prefix=CHECK-REROLL-LOOPS %s
 // RUN: %clang -### -S -fno-reroll-loops %s 2>&1 | FileCheck 
-check-prefix=CHECK-NO-REROLL-LOOPS %s
+// RUN: %clang -### -S -Os -fno-reroll-loops %s 2>&1 | FileCheck 
-check-prefix=CHECK-NO-REROLL-LOOPS %s
+// RUN: %clang -### -S -Oz -fno-reroll-loops %s 2>&1 | FileCheck 
-check-prefix=CHECK-NO-REROLL-LOOPS %s
+// RUN: %clang -### -S -O1 %s 2>&1 | FileCheck 
-check-prefix=CHECK-NO-REROLL-LOOPS %s
 // RUN: %clang -### -S -fno-reroll-loops -freroll-loops %s 2>&1 | FileCheck 
-check-prefix=CHECK-REROLL-LOOPS %s
 // RUN: %clang -### -S -freroll-loops -fno-reroll-loops %s 2>&1 | FileCheck 
-check-prefix=CHECK-NO-REROLL-LOOPS %s
 // CHECK-REROLL-LOOPS: "-freroll-loops"
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -5226,9 +5226,18 @@
   }
 
   if (Arg *A = Args.getLastArg(options::OPT_freroll_loops,
-   options::OPT_fno_reroll_loops))
+   options::OPT_fno_reroll_loops)) {
 if (A->getOption().matches(options::OPT_freroll_loops))
   CmdArgs.push_back("-freroll-loops");
+  } else if (Arg *A = Args.getLastArg(options::OPT_O_Group)) {
+// If rerolling is not explicitly enabled or disabled, then enable when
+// optimizing for size.
+if (A->getOption().matches(options::OPT_O)) {
+  StringRef S(A->getValue());
+  if (S == "s" || S == "z")
+CmdArgs.push_back("-freroll-loops");
+}
+  }
 
   Args.AddLastArg(CmdArgs, options::OPT_fwritable_strings);
   Args.AddLastArg(CmdArgs, options::OPT_funroll_loops,


Index: test/Driver/clang_f_opts.c
===
--- test/Driver/clang_f_opts.c
+++ test/Driver/clang_f_opts.c
@@ -47,7 +47,12 @@
 // CHECK-NO-UNROLL-LOOPS: "-fno-unroll-loops"
 
 // RUN: %clang -### -S -freroll-loops %s 2>&1 | FileCheck -check-prefix=CHECK-REROLL-LOOPS %s
+// RUN: %clang -### -S -Os %s 2>&1 | FileCheck -check-prefix=CHECK-REROLL-LOOPS %s
+// RUN: %clang -### -S -Oz %s 2>&1 | FileCheck -check-prefix=CHECK-REROLL-LOOPS %s
 // RUN: %clang -### -S -fno-reroll-loops %s 2>&1 | FileCheck -check-prefix=CHECK-NO-REROLL-LOOPS %s
+// RUN: %clang -### -S -Os -fno-reroll-loops %s 2>&1 | FileCheck -check-prefix=CHECK-NO-REROLL-LOOPS %s
+// RUN: %clang -### -S -Oz -fno-reroll-loops %s 2>&1 | FileCheck -check-prefix=CHECK-NO-REROLL-LOOPS %s
+// RUN: %clang -### -S -O1 %s 2>&1 | FileCheck -check-prefix=CHECK-NO-REROLL-LOOPS %s
 // RUN: %clang -### -S -fno-reroll-loops -freroll-loops %s 2>&1 | FileCheck -check-prefix=CHECK-REROLL-LOOPS %s
 // RUN: %clang -### -S -freroll-loops -fno-reroll-loops %s 2>&1 | FileCheck -check-prefix=CHECK-NO-REROLL-LOOPS %s
 // CHECK-REROLL-LOOPS: "-freroll-loops"
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -5226,9 +5226,18 @@
   }
 
   if (Arg *A = Args.getLastArg(options::OPT_freroll_loops,
-   options::OPT_fno_reroll_loops))
+   options::OPT_fno_reroll_loops)) {
 if (A->getOption().matches(options::OPT_freroll_loops))
   CmdArgs.push_back("-freroll-loops");
+  } else if (Arg *A = Args.getLastArg(options::OPT_O_Group)) {
+// If rerolling is not explicitly enabled or disabled, then enable when
+// optimizing for size.
+if (A->getOption().matches(options::OPT_O)) {
+  StringRef S(A->getValue());
+  if (S == "s" || S == "z")
+CmdArgs.push_back("-freroll-loops");
+}
+  }
 
   Args.AddLastArg(CmdArgs, options::OPT_fwritable_strings);
   Args.AddLastArg(CmdArgs, options::OPT_funroll_loops,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r283637 - [CUDA] Do a better job at detecting wrong-side calls.

2016-10-07 Thread Justin Lebar via cfe-commits
Author: jlebar
Date: Fri Oct  7 20:07:11 2016
New Revision: 283637

URL: http://llvm.org/viewvc/llvm-project?rev=283637&view=rev
Log:
[CUDA] Do a better job at detecting wrong-side calls.

Summary:
Move CheckCUDACall from ActOnCallExpr and BuildDeclRefExpr to
DiagnoseUseOfDecl.  This lets us catch some edge cases we were missing,
specifically around class operators.

This necessitates a few other changes:

 - Avoid emitting duplicate deferred diags in CheckCUDACall.

   Previously we'd carefully placed our call to CheckCUDACall such that
   it would only ever run once for a particular callsite.  But now this
   isn't the case.

 - Emit deferred diagnostics from a template
   specialization/instantiation's primary template, in addition to from
   the specialization/instantiation itself.  DiagnoseUseOfDecl ends up
   putting the deferred diagnostics on the template, rather than the
   specialization, so we need to check both.

Reviewers: rsmith

Subscribers: cfe-commits, tra

Differential Revision: https://reviews.llvm.org/D24573

Modified:
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/lib/Sema/SemaCUDA.cpp
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/test/SemaCUDA/Inputs/cuda.h
cfe/trunk/test/SemaCUDA/call-host-fn-from-device.cu

Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=283637&r1=283636&r2=283637&view=diff
==
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Fri Oct  7 20:07:11 2016
@@ -9267,16 +9267,27 @@ public:
   void maybeAddCUDAHostDeviceAttrs(Scope *S, FunctionDecl *FD,
const LookupResult &Previous);
 
+private:
+  /// Raw encodings of SourceLocations for which CheckCUDACall has emitted a
+  /// deferred "bad call" diagnostic.  We use this to avoid emitting the same
+  /// deferred diag twice.
+  llvm::DenseSet LocsWithCUDACallDeferredDiags;
+
+public:
   /// Check whether we're allowed to call Callee from the current context.
   ///
-  /// If the call is never allowed in a semantically-correct program
-  /// (CFP_Never), emits an error and returns false.
+  /// - If the call is never allowed in a semantically-correct program
+  ///   (CFP_Never), emits an error and returns false.
+  ///
+  /// - If the call is allowed in semantically-correct programs, but only if
+  ///   it's never codegen'ed (CFP_WrongSide), creates a deferred diagnostic to
+  ///   be emitted if and when the caller is codegen'ed, and returns true.
   ///
-  /// If the call is allowed in semantically-correct programs, but only if it's
-  /// never codegen'ed (CFP_WrongSide), creates a deferred diagnostic to be
-  /// emitted if and when the caller is codegen'ed, and returns true.
+  ///   Will only create deferred diagnostics for a given SourceLocation once,
+  ///   so you can safely call this multiple times without generating duplicate
+  ///   deferred errors.
   ///
-  /// Otherwise, returns true without emitting any diagnostics.
+  /// - Otherwise, returns true without emitting any diagnostics.
   bool CheckCUDACall(SourceLocation Loc, FunctionDecl *Callee);
 
   /// Check whether a 'try' or 'throw' expression is allowed within the current

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=283637&r1=283636&r2=283637&view=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Fri Oct  7 20:07:11 2016
@@ -2923,6 +2923,10 @@ void CodeGenModule::EmitGlobalFunctionDe
   // non-error diags here, because order can be significant, e.g. with notes
   // that follow errors.)
   auto Diags = D->takeDeferredDiags();
+  if (auto *Templ = D->getPrimaryTemplate()) {
+auto TemplDiags = Templ->getAsFunction()->takeDeferredDiags();
+Diags.insert(Diags.end(), TemplDiags.begin(), TemplDiags.end());
+  }
   bool HasError = llvm::any_of(Diags, [this](const PartialDiagnosticAt &PDAt) {
 return getDiags().getDiagnosticLevel(PDAt.second.getDiagID(), PDAt.first) 
>=
DiagnosticsEngine::Error;

Modified: cfe/trunk/lib/Sema/SemaCUDA.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCUDA.cpp?rev=283637&r1=283636&r2=283637&view=diff
==
--- cfe/trunk/lib/Sema/SemaCUDA.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCUDA.cpp Fri Oct  7 20:07:11 2016
@@ -495,7 +495,13 @@ bool Sema::CheckCUDACall(SourceLocation
 Diag(Callee->getLocation(), diag::note_previous_decl) << Callee;
 return false;
   }
-  if (Pref == Sema::CFP_WrongSide) {
+
+  // Insert into LocsWithCUDADeferredDiags to avoid emitting duplicate deferred
+  // diagnostics for 

[PATCH] D15075: No error for conflict between inputs\outputs and clobber list

2016-10-07 Thread Akira Hatanaka via cfe-commits
ahatanak added a comment.

I have a couple of minor comments, but patch looks good to me.




Comment at: lib/Sema/SemaStmtAsm.cpp:141
 
+// Extracting the register name from the Expression value,
+// if there is no register name to extract, returns ""

Please remove all trailing spaces and "^M" characters in this patch. Also, run 
clang-format and fix indentations.



Comment at: lib/Sema/SemaStmtAsm.cpp:151
+  if (AsmLabelAttr *Attr = Variable->getAttr())
+return Target.isValidGCCRegisterName(Attr->getLabel())
+? Target.getNormalizedGCCRegisterName(Attr->getLabel(), true)

You can  just return getNormalizedGCCRegisterName() if 
Target.isValidGCCRegisterName() is true here.


https://reviews.llvm.org/D15075



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


[libcxx] r283633 - Add missing include in test

2016-10-07 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Oct  7 19:59:16 2016
New Revision: 283633

URL: http://llvm.org/viewvc/llvm-project?rev=283633&view=rev
Log:
Add missing  include in test

Modified:
libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.assign/copy.pass.cpp

Modified: 
libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.assign/copy.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.assign/copy.pass.cpp?rev=283633&r1=283632&r2=283633&view=diff
==
--- 
libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.assign/copy.pass.cpp 
(original)
+++ 
libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.assign/copy.pass.cpp 
Fri Oct  7 19:59:16 2016
@@ -16,6 +16,7 @@
 // UNSUPPORTED: c++98, c++03
 
 #include 
+#include 
 #include 
 #include 
 


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


[libcxx] r283632 - Add missing include in test_allocator.h

2016-10-07 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Oct  7 19:57:56 2016
New Revision: 283632

URL: http://llvm.org/viewvc/llvm-project?rev=283632&view=rev
Log:
Add missing include in test_allocator.h

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

Modified: libcxx/trunk/test/support/test_allocator.h
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/test_allocator.h?rev=283632&r1=283631&r2=283632&view=diff
==
--- libcxx/trunk/test/support/test_allocator.h (original)
+++ libcxx/trunk/test/support/test_allocator.h Fri Oct  7 19:57:56 2016
@@ -10,10 +10,11 @@
 #ifndef TEST_ALLOCATOR_H
 #define TEST_ALLOCATOR_H
 
-#include 
 #include 
-#include 
 #include 
+#include 
+#include 
+#include 
 #include 
 #include 
 


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


[libcxx] r283631 - [libc++] Fix stack_allocator

2016-10-07 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Oct  7 19:56:22 2016
New Revision: 283631

URL: http://llvm.org/viewvc/llvm-project?rev=283631&view=rev
Log:
[libc++] Fix stack_allocator

Summary:
To quote STL the problems with stack allocator are"

>"stack_allocator is seriously nonconformant to N4582 17.6.3.5 
>[allocator.requirements].
> First, it lacks a rebinding constructor. (The nested "struct rebind" isn't 
> sufficient.)
> Second, it lacks templated equality/inequality.
> Third, it completely ignores alignment.
> Finally, and most severely, the Standard forbids its existence. Allocators 
> are forbidden from returning memory "inside themselves". This requirement is 
> implied by the Standard's requirements for rebinding and equality. It's 
> permitted to return memory from a separate buffer object on the stack, 
> though."

This patch attempts to address all of those issues.

First, instead of storing the buffer inside the allocator I've change 
`stack_allocator` to accept the buffer as an argument.

Second, in order to fix rebinding I changed the parameter list from `` to ``. This allows allocator 
rebinding
between types that have different sizes. 

Third, I added copy and rebinding constructors and assignment operators.

And finally I fixed the allocation logic to always return properly aligned 
storage.



Reviewers: mclow.lists, howard.hinnant, STL_MSFT

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D25154

Removed:
libcxx/trunk/test/std/containers/stack_allocator.h
Modified:

libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp.pass.cpp

libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_default.pass.cpp

libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons/ctor_default.pass.cpp

libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/ctor_default.pass.cpp
libcxx/trunk/test/std/containers/sequences/deque/deque.cons/default.pass.cpp

libcxx/trunk/test/std/containers/sequences/deque/deque.cons/iter_iter.pass.cpp
libcxx/trunk/test/std/containers/sequences/deque/deque.cons/size.pass.cpp

libcxx/trunk/test/std/containers/sequences/deque/deque.cons/size_value.pass.cpp

libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/insert_iter_iter.pass.cpp

libcxx/trunk/test/std/containers/sequences/list/list.cons/default_stack_alloc.pass.cpp

libcxx/trunk/test/std/containers/sequences/list/list.cons/input_iterator.pass.cpp
libcxx/trunk/test/std/containers/sequences/list/list.cons/size_type.pass.cpp

libcxx/trunk/test/std/containers/sequences/list/list.cons/size_value_alloc.pass.cpp

libcxx/trunk/test/std/containers/sequences/vector/vector.capacity/reserve.pass.cpp

libcxx/trunk/test/std/containers/sequences/vector/vector.capacity/resize_size.pass.cpp

libcxx/trunk/test/std/containers/sequences/vector/vector.capacity/resize_size_value.pass.cpp

libcxx/trunk/test/std/containers/sequences/vector/vector.capacity/shrink_to_fit.pass.cpp

libcxx/trunk/test/std/containers/sequences/vector/vector.cons/construct_default.pass.cpp

libcxx/trunk/test/std/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp

libcxx/trunk/test/std/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp

libcxx/trunk/test/std/containers/sequences/vector/vector.cons/construct_size_value.pass.cpp

libcxx/trunk/test/std/containers/sequences/vector/vector.modifiers/emplace.pass.cpp

libcxx/trunk/test/std/containers/sequences/vector/vector.modifiers/emplace_back.pass.cpp

libcxx/trunk/test/std/containers/sequences/vector/vector.modifiers/insert_iter_iter_iter.pass.cpp

libcxx/trunk/test/std/containers/sequences/vector/vector.modifiers/insert_iter_rvalue.pass.cpp

libcxx/trunk/test/std/containers/sequences/vector/vector.modifiers/insert_iter_size_value.pass.cpp

libcxx/trunk/test/std/containers/sequences/vector/vector.modifiers/insert_iter_value.pass.cpp

libcxx/trunk/test/std/containers/sequences/vector/vector.modifiers/pop_back.pass.cpp

libcxx/trunk/test/std/containers/sequences/vector/vector.modifiers/push_back.pass.cpp

libcxx/trunk/test/std/containers/sequences/vector/vector.modifiers/push_back_rvalue.pass.cpp
libcxx/trunk/test/support/test_allocator.h

Modified: 
libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp.pass.cpp?rev=283631&r1=283630&r2=283631&view=diff
==
--- 
libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp.pass.cpp
 Fri Oct  7 19:56:22 2016

[PATCH] D25154: [libc++] Fix stack_allocator

2016-10-07 Thread Eric Fiselier via cfe-commits
EricWF updated this revision to Diff 74006.
EricWF added a comment.

Rewrite the patch entirely. Instead of using an actual "stack buffer" I've 
transformed `stack_allocator` into `limited_allocator` which allows at 
most `N` elements to be allocated from it. This resolves the issues about stack 
usage but it doesn't help with the MSVC debug extra allocations.


https://reviews.llvm.org/D25154

Files:
  
test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp.pass.cpp
  
test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_default.pass.cpp
  test/std/containers/container.adaptors/queue/queue.cons/ctor_default.pass.cpp
  test/std/containers/container.adaptors/stack/stack.cons/ctor_default.pass.cpp
  test/std/containers/sequences/deque/deque.cons/default.pass.cpp
  test/std/containers/sequences/deque/deque.cons/iter_iter.pass.cpp
  test/std/containers/sequences/deque/deque.cons/size.pass.cpp
  test/std/containers/sequences/deque/deque.cons/size_value.pass.cpp
  test/std/containers/sequences/deque/deque.modifiers/insert_iter_iter.pass.cpp
  test/std/containers/sequences/list/list.cons/default_stack_alloc.pass.cpp
  test/std/containers/sequences/list/list.cons/input_iterator.pass.cpp
  test/std/containers/sequences/list/list.cons/size_type.pass.cpp
  test/std/containers/sequences/list/list.cons/size_value_alloc.pass.cpp
  test/std/containers/sequences/vector/vector.capacity/reserve.pass.cpp
  test/std/containers/sequences/vector/vector.capacity/resize_size.pass.cpp
  
test/std/containers/sequences/vector/vector.capacity/resize_size_value.pass.cpp
  test/std/containers/sequences/vector/vector.capacity/shrink_to_fit.pass.cpp
  test/std/containers/sequences/vector/vector.cons/construct_default.pass.cpp
  test/std/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp
  
test/std/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp
  test/std/containers/sequences/vector/vector.cons/construct_size_value.pass.cpp
  test/std/containers/sequences/vector/vector.modifiers/emplace.pass.cpp
  test/std/containers/sequences/vector/vector.modifiers/emplace_back.pass.cpp
  
test/std/containers/sequences/vector/vector.modifiers/insert_iter_iter_iter.pass.cpp
  
test/std/containers/sequences/vector/vector.modifiers/insert_iter_rvalue.pass.cpp
  
test/std/containers/sequences/vector/vector.modifiers/insert_iter_size_value.pass.cpp
  
test/std/containers/sequences/vector/vector.modifiers/insert_iter_value.pass.cpp
  test/std/containers/sequences/vector/vector.modifiers/pop_back.pass.cpp
  test/std/containers/sequences/vector/vector.modifiers/push_back.pass.cpp
  
test/std/containers/sequences/vector/vector.modifiers/push_back_rvalue.pass.cpp
  test/std/containers/stack_allocator.h
  test/support/test_allocator.h

Index: test/support/test_allocator.h
===
--- test/support/test_allocator.h
+++ test/support/test_allocator.h
@@ -302,5 +302,78 @@
 { return false; }
 #endif
 
+template 
+struct limited_alloc_handle {
+  std::size_t outstanding_;
+  void* last_alloc_;
+
+  limited_alloc_handle() : outstanding_(0), last_alloc_(nullptr) {}
+
+  template 
+  T *allocate(std::size_t N) {
+if (N + outstanding_ > MaxAllocs)
+  TEST_THROW(std::bad_alloc());
+last_alloc_ = ::operator new(N*sizeof(T));
+outstanding_ += N;
+return static_cast(last_alloc_);
+  }
+
+  void deallocate(void* ptr, std::size_t N) {
+if (ptr == last_alloc_) {
+  last_alloc_ = nullptr;
+  assert(outstanding_ >= N);
+  outstanding_ -= N;
+}
+::operator delete(ptr);
+  }
+};
+
+template 
+class limited_allocator
+{
+typedef limited_alloc_handle BuffT;
+std::shared_ptr handle_;
+public:
+typedef T value_type;
+typedef value_type*   pointer;
+typedef const value_type* const_pointer;
+typedef value_type&   reference;
+typedef const value_type& const_reference;
+typedef std::size_t   size_type;
+typedef std::ptrdiff_tdifference_type;
+
+template  struct rebind { typedef limited_allocator other; };
+
+limited_allocator() : handle_(new BuffT) {}
+
+limited_allocator(limited_allocator const& other) : handle_(other.handle_) {}
+
+template 
+explicit limited_allocator(limited_allocator const& other)
+: handle_(other.handle_) {}
+
+private:
+limited_allocator& operator=(const limited_allocator&);// = delete;
+
+public:
+pointer allocate(size_type n) { return handle_->template allocate(n); }
+void deallocate(pointer p, size_type n) { handle_->deallocate(p, n); }
+size_type max_size() const {return N;}
+
+BuffT* getHandle() const { return handle_.get(); }
+};
+
+template 
+inline bool operator==(limited_allocator const& LHS,
+   limited_allocator const& RHS) {
+  return LHS.getHandle() == RHS.getHandle();
+}
+
+template 
+inline bool operator!=(limited_allocator const& 

[PATCH] D25361: [libcxx] Add the missing limits.h header

2016-10-07 Thread Richard Smith via cfe-commits
rsmith added a comment.

I only skipped this one because it seemed pointless to me. I have no objection 
to providing it, and this change makes perfect sense if libc++ wants to 
guarantee that `<__config>` is included whenever any standard C++ header is 
included.


https://reviews.llvm.org/D25361



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


[PATCH] D25361: [libcxx] Add the missing limits.h header

2016-10-07 Thread Marshall Clow via cfe-commits
mclow.lists added a comment.

This looks fine to me, but since @rsmith added all the other C headers, I'd 
like him to weigh in.


https://reviews.llvm.org/D25361



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


[PATCH] D24371: Add diagnostics to require_constant_initialization

2016-10-07 Thread Eric Fiselier via cfe-commits
EricWF added a comment.

@rsmith ping. Any more comments on this patch?


Repository:
  rL LLVM

https://reviews.llvm.org/D24371



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


[PATCH] D25154: [libc++] Fix stack_allocator

2016-10-07 Thread Stephan T. Lavavej via cfe-commits
STL_MSFT added a comment.

F2472251: msvc_warnings.txt 

- The attached patch on top of your patch fixes two simple MSVC warnings - 
unreferenced formal parameter and class/struct mismatch.

- Three tests are emitting stack consumption warnings (since MSVC /analyze 
tries to understand what's going on in the stack):

test\std\containers\sequences\deque\deque.cons\iter_iter.pass.cpp
iter_iter.pass.cpp(50) : warning C6262: Function uses '32868' bytes of stack:  
exceeds /analyze:stacksize '16384'.  Consider moving some data to heap.

test\std\containers\sequences\deque\deque.cons\size.pass.cpp
size.pass.cpp(85) : warning C6262: Function uses '800032' bytes of stack:  
exceeds /analyze:stacksize '16384'.  Consider moving some data to heap.

test\std\containers\sequences\deque\deque.cons\size_value_alloc.pass.cpp
size_value_alloc.pass.cpp(34) : warning C6262: Function uses '80044' bytes of 
stack:  exceeds /analyze:stacksize '16384'.  Consider moving some data to heap.

The 800KB consumption seems especially egregious. Changing these tests to 
dynamically allocate these huge objects will silence the warning.

- Finally, the following tests are asserting:

test\std\containers\sequences\vector\vector.capacity\reserve.pass.cpp
test\std\containers\sequences\vector\vector.capacity\resize_size.pass.cpp
test\std\containers\sequences\vector\vector.capacity\resize_size_value.pass.cpp
test\std\containers\sequences\vector\vector.cons\construct_iter_iter_alloc.pass.cpp
test\std\containers\sequences\vector\vector.cons\construct_size_value_alloc.pass.cpp
test\std\containers\sequences\vector\vector.modifiers\push_back.pass.cpp
test\std\containers\sequences\vector\vector.modifiers\push_back_rvalue.pass.cpp

This is because of the exact-space-consumption issue I feared/predicted - 
you're constructing stack_allocators with a small fixed amount of space, but 
our debug object occupies space, and that makes the allocator run out of memory.

A possible fix would be to increase the amount of space (two pointers should be 
sufficient).


https://reviews.llvm.org/D25154



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


[PATCH] D25008: [cmake] Split linked libraries into private & public, for linker script

2016-10-07 Thread Eric Fiselier via cfe-commits
EricWF added inline comments.



Comment at: lib/CMakeLists.txt:41
+else()
+  list(APPEND LIBCXX_LIBRARIES_PUBLIC "${LIBCXX_CXX_ABI_LIBRARY}")
+endif()

Please handle the special case for Apple here, where it manually re-exports the 
ABI lib.



Comment at: lib/CMakeLists.txt:86
+elseif (LIBCXX_HAS_GCC_S_LIB)
+  list(APPEND LIBCXX_LIBRARIES_PUBLIC gcc_s)
+endif()

I don't think `libgcc_s` should be considered a public library like `libunwind` 
because both Clang and GCC link it as a default system library.



Comment at: lib/CMakeLists.txt:179
   add_library(cxx_static STATIC $)
-  target_link_libraries(cxx_static ${LIBCXX_LIBRARIES})
+  target_link_libraries(cxx_static ${LIBCXX_LIBRARIES} 
${LIBCXX_LIBRARIES_PUBLIC})
   set_target_properties(cxx_static

Should the libraries be added using `target_link_libraries(foo PRIVATE ...)` 
and `target_link_libraries(foo PUBLIC ...)` now? 


https://reviews.llvm.org/D25008



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


[PATCH] D25225: Add an option to save the backend-produced YAML optimization record to a file

2016-10-07 Thread Adam Nemet via cfe-commits
anemet added a comment.

LGTM, thanks.  I also like the option name but will let the the other reviewers 
official approve that part.


https://reviews.llvm.org/D25225



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


[PATCH] D25225: Add an option to save the backend-produced YAML optimization record to a file

2016-10-07 Thread Hal Finkel via cfe-commits
hfinkel updated this revision to Diff 74001.
hfinkel added a comment.
Herald added a subscriber: mehdi_amini.

Addressed review comments (DebugLoc is tested, and we enable hotness 
computation when saving the optimization record and also using PGO).


https://reviews.llvm.org/D25225

Files:
  include/clang/Driver/CC1Options.td
  include/clang/Driver/Options.td
  include/clang/Frontend/CodeGenOptions.h
  lib/CodeGen/CodeGenAction.cpp
  lib/Driver/Tools.cpp
  lib/Frontend/CompilerInvocation.cpp
  test/CodeGen/Inputs/opt-record.proftext
  test/CodeGen/opt-record.c
  test/Driver/opt-record.c

Index: test/Driver/opt-record.c
===
--- /dev/null
+++ test/Driver/opt-record.c
@@ -0,0 +1,18 @@
+// RUN: %clang -### -S -o FOO -fsave-optimization-record %s 2>&1 | FileCheck %s
+// RUN: %clang -### -c -o FOO -fsave-optimization-record %s 2>&1 | FileCheck %s
+// RUN: %clang -### -c -fsave-optimization-record %s 2>&1 | FileCheck %s -check-prefix=CHECK-NO-O
+// RUN: %clang -### -fsave-optimization-record %s 2>&1 | FileCheck %s -check-prefix=CHECK-NO-O
+// RUN: %clang -### -S -fsave-optimization-record -x cuda -nocudainc -nocudalib %s 2>&1 | FileCheck %s -check-prefix=CHECK-NO-O -check-prefix=CHECK-CUDA-DEV
+// RUN: %clang -### -fsave-optimization-record -x cuda -nocudainc -nocudalib %s 2>&1 | FileCheck %s -check-prefix=CHECK-NO-O -check-prefix=CHECK-CUDA-DEV
+// RUN: %clang -### -S -o FOO -fsave-optimization-record=BAR.txt %s 2>&1 | FileCheck %s -check-prefix=CHECK-EQ
+
+// CHECK: "-cc1"
+// CHECK: "-opt-record-file" "FOO.opt.yaml"
+
+// CHECK-NO-O: "-cc1"
+// CHECK-NO-O-DAG: "-opt-record-file" "opt-record.opt.yaml"
+// CHECK-CUDA-DEV-DAG: "-opt-record-file" "opt-record-device-cuda-nvptx64-nvidia-cuda-sm_20.opt.yaml"
+
+// CHECK-EQ: "-cc1"
+// CHECK-EQ: "-opt-record-file" "BAR.txt"
+
Index: test/CodeGen/opt-record.c
===
--- /dev/null
+++ test/CodeGen/opt-record.c
@@ -0,0 +1,33 @@
+// RUN: %clang_cc1 -O3 -triple x86_64-unknown-linux-gnu -target-cpu x86-64 %s -o %t -dwarf-column-info -opt-record-file %t.yaml -emit-obj
+// RUN: cat %t.yaml | FileCheck %s
+// RUN: llvm-profdata merge %S/Inputs/opt-record.proftext -o %t.profdata
+// RUN: %clang_cc1 -O3 -triple x86_64-unknown-linux-gnu -target-cpu x86-64 -fprofile-instrument-use-path=%t.profdata %s -o %t -dwarf-column-info -opt-record-file %t.yaml -emit-obj
+// RUN: cat %t.yaml | FileCheck -check-prefix=CHECK -check-prefix=CHECK-PGO %s
+// REQUIRES: x86-registered-target
+
+void bar();
+void foo() { bar(); }
+
+void Test(int *res, int *c, int *d, int *p, int n) {
+  int i;
+
+#pragma clang loop vectorize(assume_safety)
+  for (i = 0; i < 1600; i++) {
+res[i] = (p[i] == 0) ? res[i] : res[i] + d[i];
+  }
+}
+
+// CHECK: --- !Missed
+// CHECK: Pass:inline
+// CHECK: Name:NoDefinition
+// CHECK: DebugLoc:
+// CHECK: Function:foo
+// CHECK-PGO: Hotness:
+
+// CHECK: --- !Passed
+// CHECK: Pass:loop-vectorize
+// CHECK: Name:Vectorized
+// CHECK: DebugLoc:
+// CHECK: Function:Test
+// CHECK-PGO: Hotness:
+
Index: test/CodeGen/Inputs/opt-record.proftext
===
--- /dev/null
+++ test/CodeGen/Inputs/opt-record.proftext
@@ -0,0 +1,26 @@
+foo
+# Func Hash:
+0
+# Num Counters:
+1
+# Counter Values:
+30
+
+bar
+# Func Hash:
+0
+# Num Counters:
+1
+# Counter Values:
+30
+
+Test
+# Func Hash:
+269
+# Num Counters:
+3
+# Counter Values:
+1
+30
+15
+
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -823,6 +823,10 @@
   Opts.LinkerOptions = Args.getAllArgValues(OPT_linker_option);
   bool NeedLocTracking = false;
 
+  Opts.OptRecordFile = Args.getLastArgValue(OPT_opt_record_file);
+  if (!Opts.OptRecordFile.empty())
+NeedLocTracking = true;
+
   if (Arg *A = Args.getLastArg(OPT_Rpass_EQ)) {
 Opts.OptimizationRemarkPattern =
 GenerateOptimizationRemarkRegex(Diags, Args, A);
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -6068,6 +6068,40 @@
 CmdArgs.push_back("-fno-math-builtin");
   }
 
+  if (Args.hasFlag(options::OPT_fsave_optimization_record,
+   options::OPT_fsave_optimization_record_EQ,
+   options::OPT_fno_save_optimization_record, false)) {
+CmdArgs.push_back("-opt-record-file");
+
+const Arg *A = Args.getLastArg(options::OPT_fsave_optimization_record_EQ);
+if (A) {
+  CmdArgs.push_back(A->getValue());
+} else {
+  SmallString<128> F;
+  if (Output.isFilename() && (Args.hasArg(options::OPT_c) ||
+  Args.hasArg(options::OPT_S))) {
+F = Output.getFilename();
+  } else {
+   

[PATCH] D14259: The maximum alignment of std::aligned_storage applies to all Windows compilers

2016-10-07 Thread Marshall Clow via cfe-commits
mclow.lists closed this revision.
mclow.lists added a comment.

This duplicates @D25053, and I've landed this change as revision 283621.


https://reviews.llvm.org/D14259



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


[libcxx] r283621 - Disable alignment support of 0x4000 for Win32. https://reviews.llvm.org/D25053

2016-10-07 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Fri Oct  7 18:19:04 2016
New Revision: 283621

URL: http://llvm.org/viewvc/llvm-project?rev=283621&view=rev
Log:
Disable alignment support of 0x4000 for Win32. https://reviews.llvm.org/D25053

Modified:
libcxx/trunk/include/type_traits

Modified: libcxx/trunk/include/type_traits
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/type_traits?rev=283621&r1=283620&r2=283621&view=diff
==
--- libcxx/trunk/include/type_traits (original)
+++ libcxx/trunk/include/type_traits Fri Oct  7 18:19:04 2016
@@ -1675,10 +1675,10 @@ _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0
 _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x800);
 _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x1000);
 _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x2000);
-// MSDN says that MSVC does not support alignment beyond 8192 (=0x2000)
-#if !defined(_LIBCPP_MSVC)
+// PE/COFF does not support alignment beyond 8192 (=0x2000)
+#if !defined(_WIN32)
 _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x4000);
-#endif // !_LIBCPP_MSVC
+#endif // !_WIN32
 
 #undef _CREATE_ALIGNED_STORAGE_SPECIALIZATION
 


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


[PATCH] D25053: [libc++] Correct alignment condition

2016-10-07 Thread Marshall Clow via cfe-commits
mclow.lists closed this revision.
mclow.lists added a comment.

Committed as revision 283621


https://reviews.llvm.org/D25053



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


[PATCH] D24975: [CUDA] Add #pragma clang force_cuda_host_device_{begin, end} pragmas.

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

Please add a test to test/PCH for the serialization code.  Otherwise, LGTM.




Comment at: clang/include/clang/Basic/DiagnosticParseKinds.td:1032
+  "force_cuda_host_device end pragma without matching "
+  "force_cuda_host_device begin.">;
 } // end of Parse Issue category.

Diagnostics should not end with a period. =)



Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:6701-6702
   "conflicting __device__ function declared here">;
+def err_pragma_unmatched_force_cuda_host_device : Error<
+  "%0 unmatched force_cuda_host_device begin pragmas">;
 def err_dynamic_var_init : Error<

This appears to be unused.


https://reviews.llvm.org/D24975



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


[PATCH] D25249: [libc++] Many any test fixes

2016-10-07 Thread Eric Fiselier via cfe-commits
EricWF added a comment.

Addressed the issues about `in_place` SFINAE constraints in an inline comment.




Comment at: test/libcxx/utilities/any/any.class/any.assign/value.pass.cpp:25
+// Test that any& operator=(ValueType&&) is *never* selected for:
+// * std::in_place type.
+{

EricWF wrote:
> CaseyCarter wrote:
> > This behavior is not required by N4606, so I moved this test to the libcxx 
> > tree.
> I thought this behavior was subject to a LWG PR, but I can't seem to find one.
> 
> I'll either create a LWG issue to standardize this behavior or remove the 
> tests and fix libc++.
OK, so the `ValueType` ctor was constrained by 
http://cplusplus.github.io/LWG/lwg-active.html#2744 but that didn't touch the 
assignment operator. I think that's a mistake, and I'll look into adjusting the 
PR for 2744.


https://reviews.llvm.org/D25249



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


[libcxx] r283620 - Fix PR30642 - libc++ leaks always-visible symbols into programs

2016-10-07 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Oct  7 18:07:59 2016
New Revision: 283620

URL: http://llvm.org/viewvc/llvm-project?rev=283620&view=rev
Log:
Fix PR30642 -  libc++ leaks always-visible symbols into programs

This was caused by r281673, specifically changing 
`_LIBCPP_EXTERN_TEMPLATE_TYPE_VIS`
from `__attribute__((__type_visibility__("default")))` to
`__attribute__((__visibility("default")))`.

I made that change because I thought the external instantiations needed
their members to have default visibility. However since libc++ never builds
with -fvisibility=hidden this appears not to be needed. Instead this change
caused previously hidden inline methods to become un-hidden, which is a 
regression.

This patch reverts the problematic change and fixes PR30642.

Modified:
libcxx/trunk/include/__config

Modified: libcxx/trunk/include/__config
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=283620&r1=283619&r2=283620&view=diff
==
--- libcxx/trunk/include/__config (original)
+++ libcxx/trunk/include/__config Fri Oct  7 18:07:59 2016
@@ -589,7 +589,7 @@ namespace std {
 
 #ifndef _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
 #  if __has_attribute(__type_visibility__)
-#define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __attribute__ 
((__visibility__("default")))
+#define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __attribute__ 
((__type_visibility__("default")))
 #  else
 #define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
 #  endif


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


Re: r283537 - Revert "[analyzer] Try to re-apply r283092 "Extend bug reports with extra notes"

2016-10-07 Thread Artem Dergachev via cfe-commits
Yep, should be fixed already.

I had to split the commit into senseless parts because microsoft compiler was 
crashing and it wasn't obvious (to anybody who tried to look into this) which 
part of the commit might have caused that. Now the complete commit has finally 
landed.

Sorry for the trouble.

7 октября 2016 г. 23:33:39 GMT+03:00, Bill Seurer  
пишет:
>On 10/07/16 05:56, Artem Dergachev via cfe-commits wrote:
> > Author: dergachev
> > Date: Fri Oct  7 05:56:44 2016
> > New Revision: 283537
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=283537&view=rev
>
>One of these recent changes introduced a problem in sanitizer testing.
>
>
>/home/seurer/llvm/build/llvm-test2/bin/clang++   -DCLANG_ENABLE_ARCMT 
>-DCLANG_ENABLE_OBJC_REWRITER -DCLANG_ENABLE_STATIC_ANALYZER 
>-DGTEST_HAS_RTTI=0 -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS 
>-D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS 
>-I/home/seurer/llvm/build/llvm-test/tools/clang/lib/StaticAnalyzer/Core
>
>-I/home/seurer/llvm/llvm-test/tools/clang/lib/StaticAnalyzer/Core 
>-I/home/seurer/llvm/llvm-test/tools/clang/include 
>-I/home/seurer/llvm/build/llvm-test/tools/clang/include 
>-I/home/seurer/llvm/build/llvm-test/include 
>-I/home/seurer/llvm/llvm-test/include  -gmlt -fPIC 
>-fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter 
>-Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic 
>-Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor 
>-Wdelete-non-virtual-dtor -Werror -Werror=date-time -std=c++11 
>-ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual 
>-Wno-nested-anon-types -O3-UNDEBUG  -fno-exceptions -fno-rtti -o 
>CMakeFiles/clangStaticAnalyzerCore.dir/HTMLDiagnostics.cpp.o -c 
>/home/seurer/llvm/llvm-test/tools/clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
>/home/seurer/llvm/llvm-test/tools/clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp:388:11:
>
>error: enumeration value 'Note' not handled in switch
>[-Werror,-Wswitch]
>   switch (P.getKind()) {
>   ^
>1 error generated.

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


[PATCH] D25145: [libc++] Correct explanation of _LIBCPP_NEW_DELETE_VIS

2016-10-07 Thread Marshall Clow via cfe-commits
mclow.lists added a comment.

Sigh. Make an expedient choice that you don't really agree with, and you get 
immediately reminded of it.   I suggested on an earlier review (not this patch) 
that I really didn't want to see `_WIN32` in any files other than ``, 
that we should have a libc++-specific one.  I let that slide because we had a 
couple other instances of `_WIN32` in the source base.

About three days later, this pops up. :-(
Not your fault, but it makes me sad.


https://reviews.llvm.org/D25145



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


[PATCH] D25225: Add an option to save the backend-produced YAML optimization record to a file

2016-10-07 Thread Hal Finkel via cfe-commits
hfinkel added inline comments.



Comment at: lib/CodeGen/CodeGenAction.cpp:198
+
+Ctx.setDiagnosticsOutputFile(new yaml::Output(OptRecordFile->os()));
+  }

anemet wrote:
> Sorry, one more thing: if PGO is available, I think we want to set 
> Ctx.setDiagnosticHotnessRequested as well.  Without that, you'd have to pass 
> -fsave-optimization-record and -fdiagnostics-show-hotness to get hotness info 
> into the YAML file which feels strange.  I am certainly fine if we do this 
> later but I wanted to bring it up since it's seems related.
I agree. We shouldn't require -fdiagnostics-show-hotness for that to work.



Comment at: test/CodeGen/opt-record.c:17-25
+// CHECK: --- !Missed
+// CHECK: Pass:inline
+// CHECK: Name:NoDefinition
+// CHECK: Function:foo
+
+// CHECK: --- !Passed
+// CHECK: Pass:loop-vectorize

anemet wrote:
> Wouldn't this be a good place to also check that we have -gline-tables-only 
> properly hooked up, i.e. CHECK for DebugLoc: as well?
Yes; will do.


https://reviews.llvm.org/D25225



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


[PATCH] D25225: Add an option to save the backend-produced YAML optimization record to a file

2016-10-07 Thread Adam Nemet via cfe-commits
anemet added inline comments.



Comment at: lib/CodeGen/CodeGenAction.cpp:198
+
+Ctx.setDiagnosticsOutputFile(new yaml::Output(OptRecordFile->os()));
+  }

Sorry, one more thing: if PGO is available, I think we want to set 
Ctx.setDiagnosticHotnessRequested as well.  Without that, you'd have to pass 
-fsave-optimization-record and -fdiagnostics-show-hotness to get hotness info 
into the YAML file which feels strange.  I am certainly fine if we do this 
later but I wanted to bring it up since it's seems related.


https://reviews.llvm.org/D25225



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


Re: [libcxx] r281673 - [libc++] Fix and document visibility attributes for Clang, GCC and Windows.

2016-10-07 Thread Nico Weber via cfe-commits
This caused https://llvm.org/bugs/show_bug.cgi?id=30642

On Thu, Sep 15, 2016 at 6:27 PM, Eric Fiselier via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: ericwf
> Date: Thu Sep 15 17:27:07 2016
> New Revision: 281673
>
> URL: http://llvm.org/viewvc/llvm-project?rev=281673&view=rev
> Log:
> [libc++] Fix and document visibility attributes for Clang, GCC and Windows.
>
> Summary:
> This patch fixes a number of problems with the visibility macros across
> GCC (on Unix) and Windows (DLL import/export semantics). All of the
> visibility macros are now documented under `DesignDocs/VisibilityMacros.rst`.
> Now I'll no longer forget the subtleties of each!
>
> This patch adds two new visibility macros:
>
> * `_LIBCPP_ENUM_VIS` for controlling the typeinfo of enum types. Only
> Clang supports this.
> * `_LIBCPP_EXTERN_TEMPLATE_TYPE_VIS` for redefining visibility on
> explicit instantiation declarations. Clang and Windows require this.
>
> After applying this patch GCC only emits one -Wattribute warning opposed
> to 30+.
>
>
> Reviewers: mclow.lists, EricWF
>
> Subscribers: beanz, mgorny, cfe-commits
>
> Differential Revision: https://reviews.llvm.org/D24602
>
> Added:
> libcxx/trunk/docs/DesignDocs/VisibilityMacros.rst
> Modified:
> libcxx/trunk/CMakeLists.txt
> libcxx/trunk/docs/index.rst
> libcxx/trunk/include/__config
> libcxx/trunk/include/__locale
> libcxx/trunk/include/__string
> libcxx/trunk/include/experimental/filesystem
> libcxx/trunk/include/istream
> libcxx/trunk/include/locale
> libcxx/trunk/include/ostream
> libcxx/trunk/include/streambuf
> libcxx/trunk/include/string
> libcxx/trunk/include/vector
>
> Modified: libcxx/trunk/CMakeLists.txt
> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/
> CMakeLists.txt?rev=281673&r1=281672&r2=281673&view=diff
> 
> ==
> --- libcxx/trunk/CMakeLists.txt (original)
> +++ libcxx/trunk/CMakeLists.txt Thu Sep 15 17:27:07 2016
> @@ -342,7 +342,6 @@ if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "
>  -Wno-covered-switch-default)
>  elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
>  add_compile_flags_if_supported(
> --Wno-attributes # FIXME: Fix -Wattribute warnings.
>  -Wno-literal-suffix
>  -Wno-c++14-compat)
>  endif()
>
> Added: libcxx/trunk/docs/DesignDocs/VisibilityMacros.rst
> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/docs/
> DesignDocs/VisibilityMacros.rst?rev=281673&view=auto
> 
> ==
> --- libcxx/trunk/docs/DesignDocs/VisibilityMacros.rst (added)
> +++ libcxx/trunk/docs/DesignDocs/VisibilityMacros.rst Thu Sep 15 17:27:07
> 2016
> @@ -0,0 +1,85 @@
> +
> +Symbol Visibility Macros
> +
> +
> +.. contents::
> +   :local:
> +
> +Overview
> +
> +
> +Libc++ uses various "visibility" macros in order to provide a stable ABI
> in
> +both the library and the headers. These macros work by changing the
> +visibility and inlining characteristics of the symbols they are applied
> to.
> +
> +Visibility Macros
> +=
> +
> +**_LIBCPP_HIDDEN**
> +  Mark a symbol as hidden so it will not be exported from shared
> libraries.
> +
> +**_LIBCPP_FUNC_VIS**
> +  Mark a symbol as being exported by the libc++ library. This attribute
> must
> +  be applied to the declaration of all functions exported by the libc++
> dylib.
> +
> +**_LIBCPP_INLINE_VISIBILITY**
> +  Mark a function as hidden and force inlining whenever possible.
> +
> +**_LIBCPP_ALWAYS_INLINE**
> +  A synonym for `_LIBCPP_INLINE_VISIBILITY`
> +
> +**_LIBCPP_TYPE_VIS**
> +  Mark a type's typeinfo and vtable as having default visibility.
> +  `_LIBCPP_TYPE_VIS`. This macro has no effect on the visibility of the
> +  type's member functions. This attribute cannot be used on class
> templates.
> +
> +  **GCC Behavior**: GCC does not support Clang's `type_visibility(...)`
> +  attribute. With GCC the `visibility(...)` attribute is used and member
> +  functions are affected.
> +
> +**_LIBCPP_TYPE_VIS_ONLY**
> +  The same as `_LIBCPP_TYPE_VIS` except that it may be applied to
> templates.
> +
> +  **Windows Behavior**: DLLs do not support dllimport/export on class
> templates.
> +  The macro has an empty definition on this platform.
> +
> +  Note: This macro should be renamed `_LIBCPP_TEMPLATE_TYPE_VIS`.
> +
> +**_LIBCPP_ENUM_VIS**
> +  Mark the typeinfo of an enum as having default visibility. This
> attribute
> +  should be applied to all enum declarations.
> +
> +  **Windows Behavior**: DLLs do not support importing or exporting
> enumeration
> +  typeinfo. The macro has an empty definition on this platform.
> +
> +  **GCC Behavior**: GCC un-hides the typeinfo for enumerations by
> default, even
> +  if `-fvisibility=hidden` is specified. Additionally applying a
> visibility
> +  attribute to an enum clas

[PATCH] D25225: Add an option to save the backend-produced YAML optimization record to a file

2016-10-07 Thread Adam Nemet via cfe-commits
anemet added inline comments.



Comment at: test/CodeGen/opt-record.c:17-25
+// CHECK: --- !Missed
+// CHECK: Pass:inline
+// CHECK: Name:NoDefinition
+// CHECK: Function:foo
+
+// CHECK: --- !Passed
+// CHECK: Pass:loop-vectorize

Wouldn't this be a good place to also check that we have -gline-tables-only 
properly hooked up, i.e. CHECK for DebugLoc: as well?


https://reviews.llvm.org/D25225



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


[PATCH] D25248: [libcxx] [test] Fix shadow warnings.

2016-10-07 Thread Eric Fiselier via cfe-commits
EricWF closed this revision.
EricWF added a comment.

r283618.


https://reviews.llvm.org/D25248



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


[libcxx] r283618 - Fix shadow warnings. Patch from s...@microsoft.com

2016-10-07 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Oct  7 17:10:35 2016
New Revision: 283618

URL: http://llvm.org/viewvc/llvm-project?rev=283618&view=rev
Log:
Fix shadow warnings. Patch from s...@microsoft.com

Modified:
libcxx/trunk/test/std/utilities/utility/forward/move.pass.cpp

Modified: libcxx/trunk/test/std/utilities/utility/forward/move.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/utility/forward/move.pass.cpp?rev=283618&r1=283617&r2=283618&view=diff
==
--- libcxx/trunk/test/std/utilities/utility/forward/move.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/utility/forward/move.pass.cpp Fri Oct  7 
17:10:35 2016
@@ -52,12 +52,12 @@ struct A {
 
 constexpr bool test_constexpr_move() {
 #if TEST_STD_VER > 11
-int x = 42;
-const int cx = x;
-return std::move(x) == 42
-&& std::move(cx) == 42
-&& std::move(static_cast(x)) == 42
-&& std::move(static_cast(x)) == 42;
+int y = 42;
+const int cy = y;
+return std::move(y) == 42
+&& std::move(cy) == 42
+&& std::move(static_cast(y)) == 42
+&& std::move(static_cast(y)) == 42;
 #else
 return true;
 #endif
@@ -105,8 +105,8 @@ int main()
 }
 #if TEST_STD_VER > 11
 {
-constexpr int x = 42;
-static_assert(std::move(x) == 42, "");
+constexpr int y = 42;
+static_assert(std::move(y) == 42, "");
 static_assert(test_constexpr_move(), "");
 }
 #endif
@@ -114,8 +114,8 @@ int main()
 // Test that std::forward is constexpr in C++11. This is an extension
 // provided by both libc++ and libstdc++.
 {
-constexpr int x = 42;
-static_assert(std::move(x) == 42, "");
+constexpr int y = 42;
+static_assert(std::move(y) == 42, "");
 }
 #endif
 }


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


[PATCH] D25154: [libc++] Fix stack_allocator

2016-10-07 Thread Eric Fiselier via cfe-commits
EricWF added a comment.

In https://reviews.llvm.org/D25154#564980, @STL_MSFT wrote:

> Seems plausible to me. I haven't tested this against MSVC yet, but at most I 
> expect to have minor issues with space consumption (as we allocate helper 
> objects and sentinel nodes, so any exactly-sized buffers may run out of 
> room). In any event the existing stuff is totally broken, so I have no 
> objections to you checking this in. Thanks!


Please let me know if any of your tests remain broken, so I can fix this 
further.


https://reviews.llvm.org/D25154



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


[PATCH] D25154: [libc++] Fix stack_allocator

2016-10-07 Thread Stephan T. Lavavej via cfe-commits
STL_MSFT accepted this revision.
STL_MSFT added a comment.
This revision is now accepted and ready to land.

Seems plausible to me. I haven't tested this against MSVC yet, but at most I 
expect to have minor issues with space consumption (as we allocate helper 
objects and sentinel nodes, so any exactly-sized buffers may run out of room). 
In any event the existing stuff is totally broken, so I have no objections to 
you checking this in. Thanks!


https://reviews.llvm.org/D25154



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


[PATCH] D25154: [libc++] Fix stack_allocator

2016-10-07 Thread Eric Fiselier via cfe-commits
EricWF updated this revision to Diff 73995.
EricWF added a comment.

Address @STL_MSFT's comments.


https://reviews.llvm.org/D25154

Files:
  
test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp.pass.cpp
  
test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_default.pass.cpp
  test/std/containers/container.adaptors/queue/queue.cons/ctor_default.pass.cpp
  test/std/containers/container.adaptors/stack/stack.cons/ctor_default.pass.cpp
  test/std/containers/sequences/deque/deque.cons/alloc.pass.cpp
  test/std/containers/sequences/deque/deque.cons/default.pass.cpp
  test/std/containers/sequences/deque/deque.cons/iter_iter.pass.cpp
  test/std/containers/sequences/deque/deque.cons/size.pass.cpp
  test/std/containers/sequences/deque/deque.cons/size_value.pass.cpp
  test/std/containers/sequences/deque/deque.cons/size_value_alloc.pass.cpp
  test/std/containers/sequences/deque/deque.modifiers/insert_iter_iter.pass.cpp
  test/std/containers/sequences/list/list.cons/default_stack_alloc.pass.cpp
  test/std/containers/sequences/list/list.cons/input_iterator.pass.cpp
  test/std/containers/sequences/list/list.cons/size_type.pass.cpp
  test/std/containers/sequences/list/list.cons/size_value_alloc.pass.cpp
  test/std/containers/sequences/vector/vector.capacity/reserve.pass.cpp
  test/std/containers/sequences/vector/vector.capacity/resize_size.pass.cpp
  
test/std/containers/sequences/vector/vector.capacity/resize_size_value.pass.cpp
  test/std/containers/sequences/vector/vector.capacity/shrink_to_fit.pass.cpp
  test/std/containers/sequences/vector/vector.cons/construct_default.pass.cpp
  test/std/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp
  
test/std/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp
  test/std/containers/sequences/vector/vector.cons/construct_size_value.pass.cpp
  
test/std/containers/sequences/vector/vector.cons/construct_size_value_alloc.pass.cpp
  test/std/containers/sequences/vector/vector.modifiers/emplace.pass.cpp
  test/std/containers/sequences/vector/vector.modifiers/emplace_back.pass.cpp
  
test/std/containers/sequences/vector/vector.modifiers/insert_iter_iter_iter.pass.cpp
  
test/std/containers/sequences/vector/vector.modifiers/insert_iter_rvalue.pass.cpp
  
test/std/containers/sequences/vector/vector.modifiers/insert_iter_size_value.pass.cpp
  
test/std/containers/sequences/vector/vector.modifiers/insert_iter_value.pass.cpp
  test/std/containers/sequences/vector/vector.modifiers/pop_back.pass.cpp
  test/std/containers/sequences/vector/vector.modifiers/push_back.pass.cpp
  
test/std/containers/sequences/vector/vector.modifiers/push_back_rvalue.pass.cpp
  test/std/containers/stack_allocator.h
  test/support/stack_allocator.h
  test/support/test.support/test_stack_allocator.pass.cpp
  test/support/test_macros.h

Index: test/support/test_macros.h
===
--- test/support/test_macros.h
+++ test/support/test_macros.h
@@ -120,6 +120,25 @@
 #define TEST_NORETURN [[noreturn]]
 #endif
 
+#if TEST_STD_VER < 11
+#ifdef __clang__
+#define TEST_ALIGNOF(X) __alignof(X)
+#define TEST_ALIGNAS(X) __attribute__((__aligned__(X)))
+#elif defined(__GNUC__)
+#define TEST_ALIGNOF(X) __alignof(X)
+#define TEST_ALIGNAS(X) __attribute__((__aligned__(X)))
+#elif defined(_MSC_VER)
+#define TEST_ALIGNOF(X) __alignof__(X)
+#define TEST_ALIGNAS(X) __declspec(align(X))
+#else
+#error Unsupported compiler
+#endif
+#else // TEST_STD_VER >= 11
+#define TEST_ALIGNOF(X) alignof(X)
+#define TEST_ALIGNAS(X) alignas(X)
+#endif
+
+
 /* Macros for testing libc++ specific behavior and extensions */
 #if defined(_LIBCPP_VERSION)
 #define LIBCPP_ASSERT(...) assert(__VA_ARGS__)
Index: test/support/test.support/test_stack_allocator.pass.cpp
===
--- /dev/null
+++ test/support/test.support/test_stack_allocator.pass.cpp
@@ -0,0 +1,87 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// "support/stack_allocator.h"
+
+#include "stack_allocator.h"
+
+#include "test_macros.h"
+
+template 
+struct TEST_ALIGNAS(A) AlignedType {
+  char buff[S];
+};
+
+static const size_t MA = TEST_ALIGNOF(std::max_align_t);
+
+typedef AlignedType<1, 1>  S1;
+typedef AlignedType<2, 2>  S2;
+typedef AlignedType<17, 1>  S17;
+typedef AlignedType  SPtr;
+typedef AlignedType  SMA;
+typedef AlignedType  SMA2;
+
+template 
+void test_basic() {
+  typedef stack_buffer BuffT;
+  typedef typename BuffT::allocator_type AllocT;
+  typedef std::allocator_traits ATraits;
+  BuffT SB;
+  AllocT SA(SB);
+  uintptr_t lastVal = 0;
+  for (size_t i=0; i <

r283615 - Fix MSVC build: requires namespace in front of StringRef (NFC)

2016-10-07 Thread Mehdi Amini via cfe-commits
Author: mehdi_amini
Date: Fri Oct  7 17:02:59 2016
New Revision: 283615

URL: http://llvm.org/viewvc/llvm-project?rev=283615&view=rev
Log:
Fix MSVC build: requires namespace in front of StringRef (NFC)

Modified:
cfe/trunk/lib/Driver/Action.cpp

Modified: cfe/trunk/lib/Driver/Action.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Action.cpp?rev=283615&r1=283614&r2=283615&view=diff
==
--- cfe/trunk/lib/Driver/Action.cpp (original)
+++ cfe/trunk/lib/Driver/Action.cpp Fri Oct  7 17:02:59 2016
@@ -125,7 +125,7 @@ InputAction::InputAction(const Arg &_Inp
 
 void BindArchAction::anchor() {}
 
-BindArchAction::BindArchAction(Action *Input, StringRef _ArchName)
+BindArchAction::BindArchAction(Action *Input, llvm::StringRef _ArchName)
 : Action(BindArchClass, Input), ArchName(_ArchName) {}
 
 void OffloadAction::anchor() {}


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


[PATCH] D25154: [libc++] Fix stack_allocator

2016-10-07 Thread Eric Fiselier via cfe-commits
EricWF added a comment.

> Why does test_stack_allocator.pass.cpp line 11 have a commented-out path?

Typically tests name the header they test in a comment.

> Why is 
> test/std/containers/sequences/deque/deque.cons/size_value_alloc.pass.cpp 
> 84-85 gaining totally empty braces?

Mass-translation fatigue. I've removed the empty braces.

All of the comments have been addressed.


https://reviews.llvm.org/D25154



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


r283616 - Rename variable to not use C++ reserved name (leading underscore + capital) (NFC)

2016-10-07 Thread Mehdi Amini via cfe-commits
Author: mehdi_amini
Date: Fri Oct  7 17:03:03 2016
New Revision: 283616

URL: http://llvm.org/viewvc/llvm-project?rev=283616&view=rev
Log:
Rename variable to not use C++ reserved name (leading underscore + capital) 
(NFC)

Modified:
cfe/trunk/lib/Driver/Action.cpp

Modified: cfe/trunk/lib/Driver/Action.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Action.cpp?rev=283616&r1=283615&r2=283616&view=diff
==
--- cfe/trunk/lib/Driver/Action.cpp (original)
+++ cfe/trunk/lib/Driver/Action.cpp Fri Oct  7 17:03:03 2016
@@ -125,8 +125,8 @@ InputAction::InputAction(const Arg &_Inp
 
 void BindArchAction::anchor() {}
 
-BindArchAction::BindArchAction(Action *Input, llvm::StringRef _ArchName)
-: Action(BindArchClass, Input), ArchName(_ArchName) {}
+BindArchAction::BindArchAction(Action *Input, llvm::StringRef ArchName)
+: Action(BindArchClass, Input), ArchName(ArchName) {}
 
 void OffloadAction::anchor() {}
 


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


[PATCH] D22221: Decide whether to enable plugin tests based on cmake variables

2016-10-07 Thread Philip Reames via cfe-commits
reames resigned from this revision.
reames removed a reviewer: reames.
reames added a comment.

I know very little about our cmake infrastructure.


Repository:
  rL LLVM

https://reviews.llvm.org/D1



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


[PATCH] D25001: [Module] Merge function prototype with a non-prototype function declaration

2016-10-07 Thread Richard Smith via cfe-commits
rsmith added a comment.

I'm concerned that name lookup will find an inappropriate declaration after 
this merging. If we have two visible declarations of a function in the same 
scope, and one has a prototype but the other does not, the user should be able 
to rely on the prototype being used. `isPreferredLookupResult` in 
SemaLookup.cpp picks the most recent declaration in an attempt to handle this, 
but that won't do the right thing here, so you should also teach it to prefer a 
prototyped function over an unprototyped one.

You should be able to test for this case by trying to pass a pointer to the 
wrong type to `func1`. (You may need a different testcase that provides the 
prototype in the .c file and the declaration without prototype in the header in 
order to hit this, depending on which result name lookup ends up preferring.)




Comment at: lib/Serialization/ASTReaderDecl.cpp:2715
 return (FuncX->getLinkageInternal() == FuncY->getLinkageInternal()) &&
   FuncX->getASTContext().hasSameType(FuncX->getType(), FuncY->getType());
   }

Instead of your change, can we change this to use `typesAreCompatible` instead 
of `hasSameType`?


https://reviews.llvm.org/D25001



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


[PATCH] D25248: [libcxx] [test] Fix shadow warnings.

2016-10-07 Thread Stephan T. Lavavej via cfe-commits
STL_MSFT added a comment.

Thanks Marshall. Can either you or Eric commit this?


https://reviews.llvm.org/D25248



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


[PATCH] D25208: [libc++] Make _LIBCPP_TYPE_VIS export members

2016-10-07 Thread Eric Fiselier via cfe-commits
EricWF added a comment.

Why do you want to build `libc++.so` with hidden visibility? What's wrong with 
the existing way  we build `libc++.so`?


https://reviews.llvm.org/D25208



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


r283611 - Driver: use StringRef instead of raw pointer in lookupTypeForExtension() (NFC)

2016-10-07 Thread Mehdi Amini via cfe-commits
Author: mehdi_amini
Date: Fri Oct  7 16:41:00 2016
New Revision: 283611

URL: http://llvm.org/viewvc/llvm-project?rev=283611&view=rev
Log:
Driver: use StringRef instead of raw pointer in lookupTypeForExtension() (NFC)

Modified:
cfe/trunk/include/clang/Driver/ToolChain.h
cfe/trunk/include/clang/Driver/Types.h
cfe/trunk/lib/Driver/ToolChain.cpp
cfe/trunk/lib/Driver/ToolChains.cpp
cfe/trunk/lib/Driver/ToolChains.h
cfe/trunk/lib/Driver/Types.cpp

Modified: cfe/trunk/include/clang/Driver/ToolChain.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/ToolChain.h?rev=283611&r1=283610&r2=283611&view=diff
==
--- cfe/trunk/include/clang/Driver/ToolChain.h (original)
+++ cfe/trunk/include/clang/Driver/ToolChain.h Fri Oct  7 16:41:00 2016
@@ -233,7 +233,7 @@ public:
 
   /// LookupTypeForExtension - Return the default language type to use for the
   /// given extension.
-  virtual types::ID LookupTypeForExtension(const char *Ext) const;
+  virtual types::ID LookupTypeForExtension(StringRef Ext) const;
 
   /// IsBlocksDefault - Does this tool chain enable -fblocks by default.
   virtual bool IsBlocksDefault() const { return false; }

Modified: cfe/trunk/include/clang/Driver/Types.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Types.h?rev=283611&r1=283610&r2=283611&view=diff
==
--- cfe/trunk/include/clang/Driver/Types.h (original)
+++ cfe/trunk/include/clang/Driver/Types.h Fri Oct  7 16:41:00 2016
@@ -13,6 +13,9 @@
 #include "clang/Driver/Phases.h"
 #include "llvm/ADT/SmallVector.h"
 
+namespace llvm {
+class StringRef;
+}
 namespace clang {
 namespace driver {
 namespace types {
@@ -79,7 +82,7 @@ namespace types {
 
   /// lookupTypeForExtension - Lookup the type to use for the file
   /// extension \p Ext.
-  ID lookupTypeForExtension(const char *Ext);
+  ID lookupTypeForExtension(llvm::StringRef Ext);
 
   /// lookupTypeForTypSpecifier - Lookup the type to use for a user
   /// specified type name.

Modified: cfe/trunk/lib/Driver/ToolChain.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=283611&r1=283610&r2=283611&view=diff
==
--- cfe/trunk/lib/Driver/ToolChain.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChain.cpp Fri Oct  7 16:41:00 2016
@@ -370,7 +370,7 @@ std::string ToolChain::GetLinkerPath() c
   return GetProgramPath(DefaultLinker);
 }
 
-types::ID ToolChain::LookupTypeForExtension(const char *Ext) const {
+types::ID ToolChain::LookupTypeForExtension(StringRef Ext) const {
   return types::lookupTypeForExtension(Ext);
 }
 

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=283611&r1=283610&r2=283611&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Fri Oct  7 16:41:00 2016
@@ -54,7 +54,7 @@ MachO::MachO(const Driver &D, const llvm
 Darwin::Darwin(const Driver &D, const llvm::Triple &Triple, const ArgList 
&Args)
 : MachO(D, Triple, Args), TargetInitialized(false) {}
 
-types::ID MachO::LookupTypeForExtension(const char *Ext) const {
+types::ID MachO::LookupTypeForExtension(StringRef Ext) const {
   types::ID Ty = types::lookupTypeForExtension(Ext);
 
   // Darwin always preprocesses assembly files (unless -x is used explicitly).

Modified: cfe/trunk/lib/Driver/ToolChains.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.h?rev=283611&r1=283610&r2=283611&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains.h (original)
+++ cfe/trunk/lib/Driver/ToolChains.h Fri Oct  7 16:41:00 2016
@@ -312,7 +312,7 @@ public:
   /// @name ToolChain Implementation
   /// {
 
-  types::ID LookupTypeForExtension(const char *Ext) const override;
+  types::ID LookupTypeForExtension(StringRef Ext) const override;
 
   bool HasNativeLLVMSupport() const override;
 

Modified: cfe/trunk/lib/Driver/Types.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Types.cpp?rev=283611&r1=283610&r2=283611&view=diff
==
--- cfe/trunk/lib/Driver/Types.cpp (original)
+++ cfe/trunk/lib/Driver/Types.cpp Fri Oct  7 16:41:00 2016
@@ -170,7 +170,7 @@ bool types::isCuda(ID Id) {
   }
 }
 
-types::ID types::lookupTypeForExtension(const char *Ext) {
+types::ID types::lookupTypeForExtension(llvm::StringRef Ext) {
   return llvm::StringSwitch(Ext)
.Case("c", TY_C)
.Case("C", TY_CXX)


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

[PATCH] D25249: [libc++] Many any test fixes

2016-10-07 Thread Eric Fiselier via cfe-commits
EricWF added a comment.

@CaseyCarter Thank you for the patch. I fixed most of your issues in r283606 
{as well as a bunch of libc++ bugs).

I'm still deciding what to do about the `in_place` SFINAE tests, but I'll 
follow up on that shortly. As for this patch please update it if there are any 
fixes I missed, otherwise please close it.




Comment at: test/libcxx/utilities/any/any.class/any.assign/value.pass.cpp:25
+// Test that any& operator=(ValueType&&) is *never* selected for:
+// * std::in_place type.
+{

CaseyCarter wrote:
> This behavior is not required by N4606, so I moved this test to the libcxx 
> tree.
I thought this behavior was subject to a LWG PR, but I can't seem to find one.

I'll either create a LWG issue to standardize this behavior or remove the tests 
and fix libc++.



Comment at: test/libcxx/utilities/any/any.class/any.cons/value.pass.cpp:23
+int main() {
+// test construction from INSANE copy-but-not-movable types.
+using Type = deleted_move;

CaseyCarter wrote:
> Again, not required behavior (I am, of course, totally unbiased about whether 
> this behavior is a good idea.)
I'm removing these tests all together.



Comment at: 
test/libcxx/utilities/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp:34
+
+// Test that I can retrieve INSANE copy-but-not-movable type from an any
+void test_cast_to_value_deleted_move()

CaseyCarter wrote:
> ibid.
I'm removing these tests all together.



Comment at: test/std/utilities/any/any.class/any.assign/value.pass.cpp:172
 void test_sfinae_constraints() {
-{
-using Tag = std::in_place_type_t;

CaseyCarter wrote:
> I split out these non-portable tests into 
> test/libcxx/utilities/any.class/any.assign/value.pass.cpp
Same comment as above in regards to the `in_place` SFINAE tests.





Comment at: test/std/utilities/any/any.class/any.cons/copy.pass.cpp:74
 assertContains(a, 42);
-assertContains(a, 42);
+assertContains(a2, 42);
 

CaseyCarter wrote:
> Typo in the original test.
Ack. Fixing.



Comment at: 
test/std/utilities/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp:146
-// Check getting a type by reference from a non-const rvalue
-{
-Type& v = any_cast(std::move(a));

CaseyCarter wrote:
> This code becomes ill-formed with the above proposed change.
I'm removing these tests.


https://reviews.llvm.org/D25249



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


r283605 - Turn ArchName/BoundArch in Driver from raw pointer to StringRef (NFC)

2016-10-07 Thread Mehdi Amini via cfe-commits
Author: mehdi_amini
Date: Fri Oct  7 16:27:26 2016
New Revision: 283605

URL: http://llvm.org/viewvc/llvm-project?rev=283605&view=rev
Log:
Turn ArchName/BoundArch in Driver from raw pointer to StringRef (NFC)

Modified:
cfe/trunk/include/clang/Driver/Action.h
cfe/trunk/include/clang/Driver/Compilation.h
cfe/trunk/include/clang/Driver/Driver.h
cfe/trunk/include/clang/Driver/ToolChain.h
cfe/trunk/lib/Driver/Action.cpp
cfe/trunk/lib/Driver/Compilation.cpp
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/lib/Driver/MSVCToolChain.cpp
cfe/trunk/lib/Driver/ToolChains.cpp
cfe/trunk/lib/Driver/ToolChains.h

Modified: cfe/trunk/include/clang/Driver/Action.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Action.h?rev=283605&r1=283604&r2=283605&view=diff
==
--- cfe/trunk/include/clang/Driver/Action.h (original)
+++ cfe/trunk/include/clang/Driver/Action.h Fri Oct  7 16:27:26 2016
@@ -190,12 +190,12 @@ class BindArchAction : public Action {
   virtual void anchor();
   /// The architecture to bind, or 0 if the default architecture
   /// should be bound.
-  const char *ArchName;
+  StringRef ArchName;
 
 public:
-  BindArchAction(Action *Input, const char *ArchName);
+  BindArchAction(Action *Input, StringRef ArchName);
 
-  const char *getArchName() const { return ArchName; }
+  StringRef getArchName() const { return ArchName; }
 
   static bool classof(const Action *A) {
 return A->getKind() == BindArchClass;

Modified: cfe/trunk/include/clang/Driver/Compilation.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Compilation.h?rev=283605&r1=283604&r2=283605&view=diff
==
--- cfe/trunk/include/clang/Driver/Compilation.h (original)
+++ cfe/trunk/include/clang/Driver/Compilation.h Fri Oct  7 16:27:26 2016
@@ -69,8 +69,9 @@ class Compilation {
 
   /// Cache of translated arguments for a particular tool chain and bound
   /// architecture.
-  llvm::DenseMap,
- llvm::opt::DerivedArgList *> TCArgs;
+  llvm::DenseMap,
+ llvm::opt::DerivedArgList *>
+  TCArgs;
 
   /// Temporary files which should be removed on exit.
   llvm::opt::ArgStringList TempFiles;
@@ -184,7 +185,7 @@ public:
   ///
   /// \param BoundArch - The bound architecture name, or 0.
   const llvm::opt::DerivedArgList &getArgsForToolChain(const ToolChain *TC,
-   const char *BoundArch);
+   StringRef BoundArch);
 
   /// addTempFile - Add a file to remove on exit, and returns its
   /// argument.

Modified: cfe/trunk/include/clang/Driver/Driver.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Driver.h?rev=283605&r1=283604&r2=283605&view=diff
==
--- cfe/trunk/include/clang/Driver/Driver.h (original)
+++ cfe/trunk/include/clang/Driver/Driver.h Fri Oct  7 16:27:26 2016
@@ -397,7 +397,7 @@ public:
   /// jobs for a given (Action, ToolChain, BoundArch) tuple once.
   InputInfo
   BuildJobsForAction(Compilation &C, const Action *A, const ToolChain *TC,
- const char *BoundArch, bool AtTopLevel, bool 
MultipleArchs,
+ StringRef BoundArch, bool AtTopLevel, bool MultipleArchs,
  const char *LinkingOutput,
  std::map, 
InputInfo>
  &CachedResults,
@@ -419,7 +419,7 @@ public:
   /// \param MultipleArchs - Whether multiple -arch options were supplied.
   /// \param NormalizedTriple - The normalized triple of the relevant target.
   const char *GetNamedOutputPath(Compilation &C, const JobAction &JA,
- const char *BaseInput, const char *BoundArch,
+ const char *BaseInput, StringRef BoundArch,
  bool AtTopLevel, bool MultipleArchs,
  StringRef NormalizedTriple) const;
 
@@ -468,9 +468,8 @@ private:
   /// jobs specifically for the given action, but will use the cache when
   /// building jobs for the Action's inputs.
   InputInfo BuildJobsForActionNoCache(
-  Compilation &C, const Action *A, const ToolChain *TC,
-  const char *BoundArch, bool AtTopLevel, bool MultipleArchs,
-  const char *LinkingOutput,
+  Compilation &C, const Action *A, const ToolChain *TC, StringRef 
BoundArch,
+  bool AtTopLevel, bool MultipleArchs, const char *LinkingOutput,
   std::map, InputInfo>
   &CachedResults,
   bool BuildForOffloadDevice) const;

Modified: cfe/trunk/include/clang/Driver/ToolChain.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/ToolChain.h?rev=283605&r1=283604&r2=283605&view=diff
=

[libcxx] r283606 - Fix various issues in std::any and the related tests.

2016-10-07 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Oct  7 16:27:45 2016
New Revision: 283606

URL: http://llvm.org/viewvc/llvm-project?rev=283606&view=rev
Log:
Fix various issues in std::any and the related tests.

* Fix self-swap. Patch from Casey Carter.

* Remove workarounds and tests for types with deleted move constructors. This
  was originally added as part of a LWG proposed resolution that has since
  changed.

* Re-apply most recent PR for LWG 2769.

* Re-apply most recent PR for LWG 2754. Specifically fix the SFINAE checks to
  use the decayed type.

* Fix tests to allow moved-from std::any's to have a non-empty state. This is
  the behavior of MSVC's std::any.

* Various whitespace and test fixes.

Added:

libcxx/trunk/test/std/utilities/any/any.nonmembers/any.cast/rvalue_any_cast_request_lvalue.fail.cpp
Modified:
libcxx/trunk/include/any
libcxx/trunk/include/type_traits
libcxx/trunk/test/std/utilities/any/any.class/any.assign/move.pass.cpp
libcxx/trunk/test/std/utilities/any/any.class/any.assign/value.pass.cpp
libcxx/trunk/test/std/utilities/any/any.class/any.cons/copy.pass.cpp

libcxx/trunk/test/std/utilities/any/any.class/any.cons/in_place_type.pass.cpp
libcxx/trunk/test/std/utilities/any/any.class/any.cons/move.pass.cpp
libcxx/trunk/test/std/utilities/any/any.class/any.cons/value.pass.cpp
libcxx/trunk/test/std/utilities/any/any.class/any.modifiers/emplace.pass.cpp
libcxx/trunk/test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp

libcxx/trunk/test/std/utilities/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp

libcxx/trunk/test/std/utilities/any/any.nonmembers/any.cast/const_correctness.fail.cpp

libcxx/trunk/test/std/utilities/any/any.nonmembers/any.cast/not_copy_constructible.fail.cpp
libcxx/trunk/test/std/utilities/any/any.nonmembers/make_any.pass.cpp
libcxx/trunk/test/support/any_helpers.h
libcxx/trunk/test/support/test_macros.h

Modified: libcxx/trunk/include/any
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/any?rev=283606&r1=283605&r2=283606&view=diff
==
--- libcxx/trunk/include/any (original)
+++ libcxx/trunk/include/any Fri Oct  7 16:27:45 2016
@@ -197,30 +197,33 @@ public:
 
   template <
   class _ValueType
+, class _Tp = decay_t<_ValueType>
 , class = enable_if_t<
-!is_same, any>::value &&
+!is_same<_Tp, any>::value &&
 !__is_inplace_type<_ValueType>::value &&
-is_copy_constructible<_ValueType>::value>
+is_copy_constructible<_Tp>::value>
 >
   _LIBCPP_INLINE_VISIBILITY
   any(_ValueType && __value);
 
-  template ,
 class = enable_if_t<
 is_constructible<_Tp, _Args...>::value &&
 is_copy_constructible<_Tp>::value
 >
   >
   _LIBCPP_INLINE_VISIBILITY
-  explicit any(in_place_type_t<_Tp>, _Args&&... __args);
+  explicit any(in_place_type_t<_ValueType>, _Args&&... __args);
 
-  template ,
 class = enable_if_t<
 is_constructible<_Tp, initializer_list<_Up>&, _Args...>::value &&
 is_copy_constructible<_Tp>::value>
   >
   _LIBCPP_INLINE_VISIBILITY
-  explicit any(in_place_type_t<_Tp>, initializer_list<_Up>, _Args&&... __args);
+  explicit any(in_place_type_t<_ValueType>, initializer_list<_Up>, _Args&&... 
__args);
 
   _LIBCPP_INLINE_VISIBILITY
   ~any() { this->reset(); }
@@ -242,15 +245,17 @@ public:
   // ValueType constructor?
   template <
   class _ValueType
+, class _Tp = decay_t<_ValueType>
 , class = enable_if_t<
-  !is_same, any>::value
-  && is_copy_constructible<_ValueType>::value
+  !is_same<_Tp, any>::value
+  && is_copy_constructible<_Tp>::value
   && !__is_inplace_type<_ValueType>::value>
 >
   _LIBCPP_INLINE_VISIBILITY
   any & operator=(_ValueType && __rhs);
 
-  template ,
 class = enable_if_t<
 is_constructible<_Tp, _Args...>::value &&
 is_copy_constructible<_Tp>::value>
@@ -258,7 +263,8 @@ public:
   _LIBCPP_INLINE_VISIBILITY
   void emplace(_Args&&... args);
 
-  template ,
 class = enable_if_t<
 is_constructible<_Tp, initializer_list<_Up>&, _Args...>::value &&
 is_copy_constructible<_Tp>::value>
@@ -490,60 +496,49 @@ namespace __any_imp
 } // namespace __any_imp
 
 
-template 
+template 
 any::any(_ValueType && __v) : __h(nullptr)
 {
-  typedef typename decay<_ValueType>::type _Tp;
-  static_assert(is_copy_constructible<_Tp>::value,
-"_ValueType must be CopyConstructible.");
-  using _ForwardTp = conditional_t<
-  is_move_constructible<_Tp>::value, _ValueType, _ValueType&>;
-  typedef __any_imp::_Handler<_Tp> _HandlerType;
-  _HandlerType::__create(*this, _VSTD::forward<_ForwardTp>(__v));
+  __any_imp::_Handler<_Tp>::__create(*this, _VSTD::forward<_ValueType>(__v));
 }
 
-template 
-any::any(in_place_type_t<_Tp>, _Args&&... __args) {
-  using _Hp = __any_imp::_Handler<_Tp>;
-  _Hp::__create(*this, _VSTD::

r283601 - Visually align table def with respective enum. NFC

2016-10-07 Thread Douglas Katzman via cfe-commits
Author: dougk
Date: Fri Oct  7 16:02:38 2016
New Revision: 283601

URL: http://llvm.org/viewvc/llvm-project?rev=283601&view=rev
Log:
Visually align table def with respective enum. NFC

'warn_attribute_wrong_decl_type' has to stay in sync with
'enum AttributeDeclKind' which is much easier when they line up.

Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=283601&r1=283600&r2=283601&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Fri Oct  7 16:02:38 
2016
@@ -2567,25 +2567,49 @@ def err_ifunc_resolver_return : Error<
 def err_ifunc_resolver_params : Error<
   "ifunc resolver function must have no parameters">;
 def warn_attribute_wrong_decl_type : Warning<
-  "%0 attribute only applies to %select{functions|unions|"
-  "variables and functions|"
-  "functions, variables, and Objective-C interfaces|"
-  "functions and methods|parameters|"
-  "functions, methods and blocks|functions, methods, and classes|"
-  "functions, methods, and parameters|classes|enums|variables|methods|"
-  "fields and global variables|structs|parameters and typedefs|variables and 
typedefs|"
-  "thread-local variables|variables and fields|variables, data members and tag 
types|"
-  "types and namespaces|Objective-C interfaces|methods and properties|"
-  "struct or union|struct, union or class|types|"
-  "Objective-C instance methods|init methods of interface or class extension 
declarations|"
-  "variables, functions and classes|"
-  "functions, variables, classes, and Objective-C interfaces|"
-  "Objective-C protocols|variables with static or thread storage duration|"
-  "functions and global variables|structs, unions, and typedefs|structs and 
typedefs|"
-  "interface or protocol declarations|kernel functions|non-K&R-style 
functions|"
-  "variables, enums, fields and typedefs|functions, methods, enums, and 
classes|"
-  "structs, classes, variables, functions, and inline namespaces|"
-  "variables, functions, methods, types, enumerations, enumerators, labels, 
and non-static data members}1">,
+  "%0 attribute only applies to %select{"
+  "functions"
+  "|unions"
+  "|variables and functions"
+  "|functions, variables, and Objective-C interfaces"
+  "|functions and methods"
+  "|parameters"
+  "|functions, methods and blocks"
+  "|functions, methods, and classes"
+  "|functions, methods, and parameters"
+  "|classes"
+  "|enums"
+  "|variables"
+  "|methods"
+  "|fields and global variables"
+  "|structs"
+  "|parameters and typedefs"
+  "|variables and typedefs"
+  "|thread-local variables"
+  "|variables and fields"
+  "|variables, data members and tag types"
+  "|types and namespaces"
+  "|Objective-C interfaces"
+  "|methods and properties"
+  "|struct or union"
+  "|struct, union or class"
+  "|types"
+  "|Objective-C instance methods"
+  "|init methods of interface or class extension declarations"
+  "|variables, functions and classes"
+  "|functions, variables, classes, and Objective-C interfaces"
+  "|Objective-C protocols"
+  "|variables with static or thread storage duration"
+  "|functions and global variables"
+  "|structs, unions, and typedefs"
+  "|structs and typedefs"
+  "|interface or protocol declarations"
+  "|kernel functions"
+  "|non-K&R-style functions"
+  "|variables, enums, fields and typedefs"
+  "|functions, methods, enums, and classes"
+  "|structs, classes, variables, functions, and inline namespaces"
+  "|variables, functions, methods, types, enumerations, enumerators, labels, 
and non-static data members}1">,
   InGroup;
 def err_attribute_wrong_decl_type : Error;
 def warn_type_attribute_wrong_type : Warning<


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


Re: r283537 - Revert "[analyzer] Try to re-apply r283092 "Extend bug reports with extra notes"

2016-10-07 Thread Bill Seurer via cfe-commits

On 10/07/16 05:56, Artem Dergachev via cfe-commits wrote:
> Author: dergachev
> Date: Fri Oct  7 05:56:44 2016
> New Revision: 283537
>
> URL: http://llvm.org/viewvc/llvm-project?rev=283537&view=rev

One of these recent changes introduced a problem in sanitizer testing.


/home/seurer/llvm/build/llvm-test2/bin/clang++   -DCLANG_ENABLE_ARCMT 
-DCLANG_ENABLE_OBJC_REWRITER -DCLANG_ENABLE_STATIC_ANALYZER 
-DGTEST_HAS_RTTI=0 -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS 
-D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS 
-I/home/seurer/llvm/build/llvm-test/tools/clang/lib/StaticAnalyzer/Core 
-I/home/seurer/llvm/llvm-test/tools/clang/lib/StaticAnalyzer/Core 
-I/home/seurer/llvm/llvm-test/tools/clang/include 
-I/home/seurer/llvm/build/llvm-test/tools/clang/include 
-I/home/seurer/llvm/build/llvm-test/include 
-I/home/seurer/llvm/llvm-test/include  -gmlt -fPIC 
-fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter 
-Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic 
-Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor 
-Wdelete-non-virtual-dtor -Werror -Werror=date-time -std=c++11 
-ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual 
-Wno-nested-anon-types -O3-UNDEBUG  -fno-exceptions -fno-rtti -o 
CMakeFiles/clangStaticAnalyzerCore.dir/HTMLDiagnostics.cpp.o -c 
/home/seurer/llvm/llvm-test/tools/clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
/home/seurer/llvm/llvm-test/tools/clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp:388:11: 
error: enumeration value 'Note' not handled in switch [-Werror,-Wswitch]

  switch (P.getKind()) {
  ^
1 error generated.

--

-Bill Seurer

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


[PATCH] D25338: [Driver] Make -print-libgcc-file-name print compiler-rt lib when used

2016-10-07 Thread Michał Górny via cfe-commits
mgorny requested a review of this revision.
mgorny added a comment.

I have updated the patch to include a feature check for platforms rejecting 
`-rtlib=libgcc` and split the test appropriately. Could you re-review, please?


https://reviews.llvm.org/D25338



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


[PATCH] D25338: [Driver] Make -print-libgcc-file-name print compiler-rt lib when used

2016-10-07 Thread Michał Górny via cfe-commits
mgorny removed rL LLVM as the repository for this revision.
mgorny updated this revision to Diff 73979.
This revision is now accepted and ready to land.

https://reviews.llvm.org/D25338

Files:
  docs/CommandGuide/clang.rst
  include/clang/Driver/Options.td
  lib/Driver/Driver.cpp
  test/Driver/print-libgcc-file-name-clangrt.c
  test/Driver/print-libgcc-file-name-libgcc.c
  test/lit.cfg


Index: test/lit.cfg
===
--- test/lit.cfg
+++ test/lit.cfg
@@ -375,6 +375,11 @@
 if platform.system() not in ['Windows']:
 config.available_features.add('utf8-capable-terminal')
 
+# Support for libgcc runtime. Used to rule out tests that require
+# clang to run with -rtlib=libgcc.
+if platform.system() not in ['Darwin', 'Fuchsia']:
+config.available_features.add('libgcc')
+
 # Native compilation: Check if triples match.
 # FIXME: Consider cases that target can be executed
 # even if host_triple were different from target_triple.
Index: test/Driver/print-libgcc-file-name-libgcc.c
===
--- /dev/null
+++ test/Driver/print-libgcc-file-name-libgcc.c
@@ -0,0 +1,7 @@
+// Test that -print-libgcc-file-name correctly respects -rtlib=libgcc.
+
+// REQUIRES: libgcc
+
+// RUN: %clang -rtlib=libgcc -print-libgcc-file-name 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-LIBGCC %s
+// CHECK-LIBGCC: libgcc.a
Index: test/Driver/print-libgcc-file-name-clangrt.c
===
--- /dev/null
+++ test/Driver/print-libgcc-file-name-clangrt.c
@@ -0,0 +1,11 @@
+// Test that -print-libgcc-file-name correctly respects -rtlib=compiler-rt.
+
+// RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name 2>&1 \
+// RUN: --target=x86_64-pc-linux \
+// RUN:   | FileCheck --check-prefix=CHECK-CLANGRT-X8664 %s
+// CHECK-CLANGRT-X8664: libclang_rt.builtins-x86_64.a
+
+// RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name 2>&1 \
+// RUN: --target=i686-pc-linux \
+// RUN:   | FileCheck --check-prefix=CHECK-CLANGRT-I686 %s
+// CHECK-CLANGRT-I686: libclang_rt.builtins-i686.a
Index: lib/Driver/Driver.cpp
===
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -994,7 +994,15 @@
   }
 
   if (C.getArgs().hasArg(options::OPT_print_libgcc_file_name)) {
-llvm::outs() << GetFilePath("libgcc.a", TC) << "\n";
+ToolChain::RuntimeLibType RLT = TC.GetRuntimeLibType(C.getArgs());
+switch (RLT) {
+case ToolChain::RLT_CompilerRT:
+  llvm::outs() << TC.getCompilerRTArgString(C.getArgs(), "builtins") << 
"\n";
+  break;
+case ToolChain::RLT_Libgcc:
+  llvm::outs() << GetFilePath("libgcc.a", TC) << "\n";
+  break;
+}
 return false;
   }
 
Index: include/clang/Driver/Options.td
===
--- include/clang/Driver/Options.td
+++ include/clang/Driver/Options.td
@@ -1861,7 +1861,8 @@
 def print_ivar_layout : Flag<["-"], "print-ivar-layout">, Flags<[CC1Option]>,
   HelpText<"Enable Objective-C Ivar layout bitmap print trace">;
 def print_libgcc_file_name : Flag<["-", "--"], "print-libgcc-file-name">,
-  HelpText<"Print the library path for \"libgcc.a\"">;
+  HelpText<"Print the library path for the currently used compiler runtime "
+   "library (\"libgcc.a\" or \"libclang_rt.builtins.*.a\")">;
 def print_multi_directory : Flag<["-", "--"], "print-multi-directory">;
 def print_multi_lib : Flag<["-", "--"], "print-multi-lib">;
 def print_multi_os_directory : Flag<["-", "--"], "print-multi-os-directory">,
Index: docs/CommandGuide/clang.rst
===
--- docs/CommandGuide/clang.rst
+++ docs/CommandGuide/clang.rst
@@ -394,7 +394,8 @@
 
 .. option:: -print-libgcc-file-name
 
-  Print the library path for "libgcc.a".
+  Print the library path for the currently used compiler runtime library
+  ("libgcc.a" or "libclang_rt.builtins.*.a").
 
 .. option:: -print-prog-name=
 


Index: test/lit.cfg
===
--- test/lit.cfg
+++ test/lit.cfg
@@ -375,6 +375,11 @@
 if platform.system() not in ['Windows']:
 config.available_features.add('utf8-capable-terminal')
 
+# Support for libgcc runtime. Used to rule out tests that require
+# clang to run with -rtlib=libgcc.
+if platform.system() not in ['Darwin', 'Fuchsia']:
+config.available_features.add('libgcc')
+
 # Native compilation: Check if triples match.
 # FIXME: Consider cases that target can be executed
 # even if host_triple were different from target_triple.
Index: test/Driver/print-libgcc-file-name-libgcc.c
===
--- /dev/null
+++ test/Driver/print-libgcc-file-name-libgcc.c
@@ -0,0 +1,7 @@
+// Test that -print-libgcc-file-name correctly respects -rtlib=libgcc.
+
+// REQUIRES: libgcc
+
+// RUN: 

[PATCH] D25338: [Driver] Make -print-libgcc-file-name print compiler-rt lib when used

2016-10-07 Thread Michał Górny via cfe-commits
mgorny planned changes to this revision.
mgorny added a comment.

Reverted, I need to update it to run libgcc part of the test only on platforms 
supporting that.


Repository:
  rL LLVM

https://reviews.llvm.org/D25338



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


r283586 - Revert r283572 - [Driver] Make -print-libgcc-file-name print compiler-rt lib when used

2016-10-07 Thread Michal Gorny via cfe-commits
Author: mgorny
Date: Fri Oct  7 15:04:00 2016
New Revision: 283586

URL: http://llvm.org/viewvc/llvm-project?rev=283586&view=rev
Log:
Revert r283572 - [Driver] Make -print-libgcc-file-name print compiler-rt lib 
when used

Revert the -print-libgcc-file-name change as the new test fails
on Darwin. It needs to be updated to run the libgcc part only on systems
supporting that rtlib.

Removed:
cfe/trunk/test/Driver/print-libgcc-file-name.c
Modified:
cfe/trunk/docs/CommandGuide/clang.rst
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/lib/Driver/Driver.cpp

Modified: cfe/trunk/docs/CommandGuide/clang.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/CommandGuide/clang.rst?rev=283586&r1=283585&r2=283586&view=diff
==
--- cfe/trunk/docs/CommandGuide/clang.rst (original)
+++ cfe/trunk/docs/CommandGuide/clang.rst Fri Oct  7 15:04:00 2016
@@ -394,8 +394,7 @@ Driver Options
 
 .. option:: -print-libgcc-file-name
 
-  Print the library path for the currently used compiler runtime library
-  ("libgcc.a" or "libclang_rt.builtins.*.a").
+  Print the library path for "libgcc.a".
 
 .. option:: -print-prog-name=
 

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=283586&r1=283585&r2=283586&view=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Fri Oct  7 15:04:00 2016
@@ -1861,8 +1861,7 @@ def print_file_name_EQ : Joined<["-", "-
 def print_ivar_layout : Flag<["-"], "print-ivar-layout">, Flags<[CC1Option]>,
   HelpText<"Enable Objective-C Ivar layout bitmap print trace">;
 def print_libgcc_file_name : Flag<["-", "--"], "print-libgcc-file-name">,
-  HelpText<"Print the library path for the currently used compiler runtime "
-   "library (\"libgcc.a\" or \"libclang_rt.builtins.*.a\")">;
+  HelpText<"Print the library path for \"libgcc.a\"">;
 def print_multi_directory : Flag<["-", "--"], "print-multi-directory">;
 def print_multi_lib : Flag<["-", "--"], "print-multi-lib">;
 def print_multi_os_directory : Flag<["-", "--"], "print-multi-os-directory">,

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=283586&r1=283585&r2=283586&view=diff
==
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Fri Oct  7 15:04:00 2016
@@ -994,15 +994,7 @@ bool Driver::HandleImmediateArgs(const C
   }
 
   if (C.getArgs().hasArg(options::OPT_print_libgcc_file_name)) {
-ToolChain::RuntimeLibType RLT = TC.GetRuntimeLibType(C.getArgs());
-switch (RLT) {
-case ToolChain::RLT_CompilerRT:
-  llvm::outs() << TC.getCompilerRTArgString(C.getArgs(), "builtins") << 
"\n";
-  break;
-case ToolChain::RLT_Libgcc:
-  llvm::outs() << GetFilePath("libgcc.a", TC) << "\n";
-  break;
-}
+llvm::outs() << GetFilePath("libgcc.a", TC) << "\n";
 return false;
   }
 

Removed: cfe/trunk/test/Driver/print-libgcc-file-name.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/print-libgcc-file-name.c?rev=283585&view=auto
==
--- cfe/trunk/test/Driver/print-libgcc-file-name.c (original)
+++ cfe/trunk/test/Driver/print-libgcc-file-name.c (removed)
@@ -1,15 +0,0 @@
-// Test that -print-libgcc-file-name correctly respects -rtlib=.
-
-// RUN: %clang -rtlib=libgcc -print-libgcc-file-name 2>&1 \
-// RUN:   | FileCheck --check-prefix=CHECK-LIBGCC %s
-// CHECK-LIBGCC: libgcc.a
-
-// RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name 2>&1 \
-// RUN: --target=x86_64-pc-linux \
-// RUN:   | FileCheck --check-prefix=CHECK-CLANGRT-X8664 %s
-// CHECK-CLANGRT-X8664: libclang_rt.builtins-x86_64.a
-
-// RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name 2>&1 \
-// RUN: --target=i686-pc-linux \
-// RUN:   | FileCheck --check-prefix=CHECK-CLANGRT-I686 %s
-// CHECK-CLANGRT-I686: libclang_rt.builtins-i686.a


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


[PATCH] D25369: [clang-move] Better support enclosing class.

2016-10-07 Thread Haojian Wu via cfe-commits
hokein added inline comments.



Comment at: clang-move/ClangMove.cpp:27
 
+AST_MATCHER_P(CXXMethodDecl, ofOutermostEnclosingClass,
+  ast_matchers::internal::Matcher, InnerMatcher) {

ioeric wrote:
> I'm not sure if we really need to limit this to the `outer-most` class. In 
> the future, we might want to support moving nested class, so I guess this can 
> simply be `ofClass`? Not sure if the name is right though.
`clang-move` can't handle nested classes well enough currently, and supporting 
nested class requires more stuff there, like changing the qualifiers of the 
method definitions in the nested class  (`int A::B::f()` should be `int B::f()` 
when moving nested class `A::B`). So we'd better to only allow `outer-most` 
class at least for now .


https://reviews.llvm.org/D25369



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


[PATCH] D25369: [clang-move] Better support enclosing class.

2016-10-07 Thread Haojian Wu via cfe-commits
hokein updated this revision to Diff 73976.
hokein marked 2 inline comments as done.
hokein added a comment.

support moving static member of nested class when moving its enclosing class.


https://reviews.llvm.org/D25369

Files:
  clang-move/ClangMove.cpp
  test/clang-move/Inputs/multiple_class_test.cpp
  test/clang-move/Inputs/multiple_class_test.h
  test/clang-move/move-multiple-classes.cpp

Index: test/clang-move/move-multiple-classes.cpp
===
--- test/clang-move/move-multiple-classes.cpp
+++ test/clang-move/move-multiple-classes.cpp
@@ -1,12 +1,15 @@
 // RUN: mkdir -p %T/clang-move
 // RUN: cp %S/Inputs/multiple_class_test*  %T/clang-move/
 // RUN: cd %T/clang-move
-// RUN: clang-move -names="a::Move1, b::Move2,c::Move3,c::Move4" -new_cc=%T/clang-move/new_multiple_class_test.cpp -new_header=%T/clang-move/new_multiple_class_test.h -old_cc=%T/clang-move/multiple_class_test.cpp -old_header=../clang-move/multiple_class_test.h %T/clang-move/multiple_class_test.cpp --
+// RUN: clang-move -names="c::EnclosingMove5::Nested" -new_cc=%T/clang-move/new_multiple_class_test.cpp -new_header=%T/clang-move/new_multiple_class_test.h -old_cc=%T/clang-move/multiple_class_test.cpp -old_header=../clang-move/multiple_class_test.h -dump_result %T/clang-move/multiple_class_test.cpp -- | FileCheck %s -check-prefix=CHECK-EMPTY
+// RUN: clang-move -names="a::Move1, b::Move2,c::Move3,c::Move4,c::EnclosingMove5" -new_cc=%T/clang-move/new_multiple_class_test.cpp -new_header=%T/clang-move/new_multiple_class_test.h -old_cc=%T/clang-move/multiple_class_test.cpp -old_header=../clang-move/multiple_class_test.h %T/clang-move/multiple_class_test.cpp --
 // RUN: FileCheck -input-file=%T/clang-move/new_multiple_class_test.cpp -check-prefix=CHECK-NEW-TEST-CPP %s
 // RUN: FileCheck -input-file=%T/clang-move/new_multiple_class_test.h -check-prefix=CHECK-NEW-TEST-H %s
 // RUN: FileCheck -input-file=%T/clang-move/multiple_class_test.cpp -check-prefix=CHECK-OLD-TEST-CPP %s
 // RUN: FileCheck -input-file=%T/clang-move/multiple_class_test.h -check-prefix=CHECK-OLD-TEST-H %s
 //
+// CHECK-EMPTY: [{{[[:space:]]*}}]
+//
 // CHECK-OLD-TEST-H: namespace c {
 // CHECK-OLD-TEST-H: class NoMove {
 // CHECK-OLD-TEST-H: public:
@@ -42,6 +45,14 @@
 // CHECK-NEW-TEST-H: public:
 // CHECK-NEW-TEST-H:   int f();
 // CHECK-NEW-TEST-H: };
+// CHECK-NEW-TEST-H: class EnclosingMove5 {
+// CHECK-NEW-TEST-H: public:
+// CHECK-NEW-TEST-H:   class Nested {
+// CHECK-NEW-TEST-H: int f();
+// CHECK-NEW-TEST-H: static int b;
+// CHECK-NEW-TEST-H:   };
+// CHECK-NEW-TEST-H:   static int a;
+// CHECK-NEW-TEST-H: };
 // CHECK-NEW-TEST-H: } // namespace c
 
 // CHECK-NEW-TEST-CPP: #include "{{.*}}new_multiple_class_test.h"
@@ -54,4 +65,7 @@
 // CHECK-NEW-TEST-CPP: namespace c {
 // CHECK-NEW-TEST-CPP: int Move3::f() { return 0; }
 // CHECK-NEW-TEST-CPP: int Move4::f() { return 0; }
+// CHECK-NEW-TEST-CPP: int EnclosingMove5::a = 1;
+// CHECK-NEW-TEST-CPP: int EnclosingMove5::Nested::f() { return 0; }
+// CHECK-NEW-TEST-CPP: int EnclosingMove5::Nested::b = 1;
 // CHECK-NEW-TEST-CPP: } // namespace c
Index: test/clang-move/Inputs/multiple_class_test.h
===
--- test/clang-move/Inputs/multiple_class_test.h
+++ test/clang-move/Inputs/multiple_class_test.h
@@ -23,6 +23,15 @@
   int f();
 };
 
+class EnclosingMove5 {
+public:
+  class Nested {
+int f();
+static int b;
+  };
+  static int a;
+};
+
 class NoMove {
 public:
   int f();
Index: test/clang-move/Inputs/multiple_class_test.cpp
===
--- test/clang-move/Inputs/multiple_class_test.cpp
+++ test/clang-move/Inputs/multiple_class_test.cpp
@@ -21,6 +21,14 @@
   return 0;
 }
 
+int EnclosingMove5::a = 1;
+
+int EnclosingMove5::Nested::f() {
+  return 0;
+}
+
+int EnclosingMove5::Nested::b = 1;
+
 int NoMove::f() {
   return 0;
 }
Index: clang-move/ClangMove.cpp
===
--- clang-move/ClangMove.cpp
+++ clang-move/ClangMove.cpp
@@ -24,6 +24,32 @@
 namespace move {
 namespace {
 
+AST_MATCHER_P(Decl, hasOutermostEnclosingClass,
+  ast_matchers::internal::Matcher, InnerMatcher) {
+  const auto* Context = Node.getDeclContext();
+  if (!Context) return false;
+  while (const auto *NextContext = Context->getParent()) {
+if (isa(NextContext) ||
+isa(NextContext))
+  break;
+Context = NextContext;
+  }
+  return InnerMatcher.matches(*Decl::castFromDeclContext(Context), Finder,
+  Builder);
+}
+
+AST_MATCHER_P(CXXMethodDecl, ofOutermostEnclosingClass,
+  ast_matchers::internal::Matcher, InnerMatcher) {
+  const CXXRecordDecl *Parent = Node.getParent();
+  if (!Parent) return false;
+  while (const auto *NextParent =
+ dyn_cast(Parent->getParent())) {
+Parent = NextParent;
+  }
+
+  return InnerMa

RE: [PATCH] D25373: Fix for Bug 30639: CGDebugInfo Null dereference with OpenMP array access

2016-10-07 Thread Keane, Erich via cfe-commits
Ok, I dug into this deeper.  ASTContext.cpp:2811 (getVariableArrayDecayedType) 
intentionaly sets size to nullptr in this case for the purpose of turning it 
into a [*] type.  OpenMP.cpp:236 
(CodeGenFunction::GenerateOpenMPCapturedStmtFunction) calls this to replace 
variably modified type with this one.  It definitely looks like this is on 
purpose as far as I can tell.



From: Keane, Erich
Sent: Friday, October 7, 2016 11:56 AM
To: 'David Blaikie' ; 
reviews+d25373+public+d8ec2a4bb41b1...@reviews.llvm.org; 
cfe-commits@lists.llvm.org; david.majne...@gmail.com; 'Alexey Bataev' 

Cc: junb...@codeaurora.org
Subject: RE: [PATCH] D25373: Fix for Bug 30639: CGDebugInfo Null dereference 
with OpenMP array access

Added Alexey to the list, he’s the OMP Maintainer, so hopefully he knows better 
☺

From: David Blaikie [mailto:dblai...@gmail.com]
Sent: Friday, October 7, 2016 11:51 AM
To: 
reviews+d25373+public+d8ec2a4bb41b1...@reviews.llvm.org;
 Keane, Erich mailto:erich.ke...@intel.com>>; 
cfe-commits@lists.llvm.org; 
david.majne...@gmail.com; 
guy.ben...@intel.com
Cc: junb...@codeaurora.org
Subject: Re: [PATCH] D25373: Fix for Bug 30639: CGDebugInfo Null dereference 
with OpenMP array access

Could you explain how/why there's a null size expr? I would've thought it must 
have /some/ size for code generation purposes...

On Fri, Oct 7, 2016 at 11:33 AM Erich Keane 
mailto:erich.ke...@intel.com>> wrote:
erichkeane created this revision.
erichkeane added reviewers: cfe-commits, dblaikie, majnemer, gbenyei.
erichkeane set the repository for this revision to rL LLVM.

OpenMP creates a variable array type with a a null size-expr.  The Debug 
generation failed to properly consider this case.  This patch adds a null check 
to prevent a null dereference seg-fault in this case, plus adds a test.


Repository:
  rL LLVM

https://reviews.llvm.org/D25373

Files:
  lib/CodeGen/CGDebugInfo.cpp
  test/CodeGenCXX/debug-info-openmp-array.cpp


Index: lib/CodeGen/CGDebugInfo.cpp
===
--- lib/CodeGen/CGDebugInfo.cpp
+++ lib/CodeGen/CGDebugInfo.cpp
@@ -2181,7 +2181,8 @@
   Count = CAT->getSize().getZExtValue();
 else if (const auto *VAT = dyn_cast(Ty)) {
   llvm::APSInt V;
-  if (VAT->getSizeExpr()->EvaluateAsInt(V, CGM.getContext()))
+  if (VAT->getSizeExpr() &&
+  VAT->getSizeExpr()->EvaluateAsInt(V, CGM.getContext()))
 Count = V.getExtValue();
 }

Index: test/CodeGenCXX/debug-info-openmp-array.cpp
===
--- test/CodeGenCXX/debug-info-openmp-array.cpp
+++ test/CodeGenCXX/debug-info-openmp-array.cpp
@@ -0,0 +1,17 @@
+// RUN: %clang -target x86_64-unknown-unknown -fverbose-asm -fopenmp -g -O0 -S 
-emit-llvm %s -o - | FileCheck %s
+
+
+void f(int m) {
+  int i;
+  int cen[m];
+#pragma omp parallel for
+  for (i = 0; i < m; ++i) {
+cen[i] = i;
+  }
+}
+
+// CHECK: !DICompositeType(tag: DW_TAG_array_type,
+// CHECK-NOT: size:
+// CHECK-SAME: align: 32
+// CHECK-SAME:  elements: [[ELEM_TYPE:![0-9]+]]
+// CHECK: !DISubrange(count: -1)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r283584 - [analyzer] Re-apply r283092, attempt no.4, chunk no.4 (last)

2016-10-07 Thread Artem Dergachev via cfe-commits
Author: dergachev
Date: Fri Oct  7 14:25:10 2016
New Revision: 283584

URL: http://llvm.org/viewvc/llvm-project?rev=283584&view=rev
Log:
[analyzer] Re-apply r283092, attempt no.4, chunk no.4 (last)

The problem that caused the msvc crash has been indentified and fixed
in the previous commit. This patch contains the rest of r283092.

Modified:
cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
cfe/trunk/lib/Rewrite/HTMLRewrite.cpp
cfe/trunk/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp
cfe/trunk/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
cfe/trunk/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp

Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h?rev=283584&r1=283583&r2=283584&view=diff
==
--- cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h Fri Oct  7 
14:25:10 2016
@@ -266,6 +266,9 @@ private:
   /// \sa shouldWidenLoops
   Optional WidenLoops;
 
+  /// \sa shouldDisplayNotesAsEvents
+  Optional DisplayNotesAsEvents;
+
   /// A helper function that retrieves option for a given full-qualified
   /// checker name.
   /// Options for checkers can be specified via 'analyzer-config' command-line
@@ -534,6 +537,14 @@ public:
   /// This is controlled by the 'widen-loops' config option.
   bool shouldWidenLoops();
 
+  /// Returns true if the bug reporter should transparently treat extra note
+  /// diagnostic pieces as event diagnostic pieces. Useful when the diagnostic
+  /// consumer doesn't support the extra note pieces.
+  ///
+  /// This is controlled by the 'extra-notes-as-events' option, which defaults
+  /// to false when unset.
+  bool shouldDisplayNotesAsEvents();
+
 public:
   AnalyzerOptions() :
 AnalysisStoreOpt(RegionStoreModel),

Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h?rev=283584&r1=283583&r2=283584&view=diff
==
--- cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h 
(original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h Fri 
Oct  7 14:25:10 2016
@@ -180,6 +180,18 @@ public:
   const BugType& getBugType() const { return BT; }
   BugType& getBugType() { return BT; }
 
+  /// \brief True when the report has an execution path associated with it.
+  ///
+  /// A report is said to be path-sensitive if it was thrown against a
+  /// particular exploded node in the path-sensitive analysis graph.
+  /// Path-sensitive reports have their intermediate path diagnostics
+  /// auto-generated, perhaps with the help of checker-defined visitors,
+  /// and may contain extra notes.
+  /// Path-insensitive reports consist only of a single warning message
+  /// in a specific location, and perhaps extra notes.
+  /// Path-sensitive checkers are allowed to throw path-insensitive reports.
+  bool isPathSensitive() const { return ErrorNode != nullptr; }
+
   const ExplodedNode *getErrorNode() const { return ErrorNode; }
 
   StringRef getDescription() const { return Description; }
@@ -256,8 +268,7 @@ public:
   /// the extra note should appear.
   void addNote(StringRef Msg, const PathDiagnosticLocation &Pos,
ArrayRef Ranges) {
-PathDiagnosticNotePiece *P =
-new PathDiagnosticNotePiece(Pos, Msg);
+PathDiagnosticNotePiece *P = new PathDiagnosticNotePiece(Pos, Msg);
 
 for (const auto &R : Ranges)
   P->addRange(R);
@@ -265,6 +276,17 @@ public:
 Notes.push_back(P);
   }
 
+  // FIXME: Instead of making an override, we could have default-initialized
+  // Ranges with {}, however it crashes the MSVC 2013 compiler.
+  void addNote(StringRef Msg, const PathDiagnosticLocation &Pos) {
+std::vector Ranges;
+addNote(Msg, Pos, Ranges);
+  }
+
+  virtual const NoteList &getNotes() {
+return Notes;
+  }
+
   /// \brief This allows for addition of meta data to the diagnostic.
   ///
   /// Currently, only the HTMLDiagnosticClient knows how to display it. 

Modified: cfe/trunk/lib/Rewrite/HTMLRewrite.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Rewrite/HTMLRewrite.cpp?rev=283584&r1=283583&r2=283584&view=diff
==
--- cfe/trunk/lib/Rewrite/HTMLRewrite.cpp (original)
+++ cfe/trunk/lib/Rewrite/HTMLRewrite.cpp Fri Oct  7 14:25:10 2016
@@ -324,6 +324,7 @@ void html::AddHeaderFooterInternalBuilti
   " .msgT { padding:

r283583 - Silence Warning. NFC.

2016-10-07 Thread Nirav Dave via cfe-commits
Author: niravd
Date: Fri Oct  7 14:11:33 2016
New Revision: 283583

URL: http://llvm.org/viewvc/llvm-project?rev=283583&view=rev
Log:
Silence Warning. NFC.

Modified:
cfe/trunk/lib/StaticAnalyzer/Core/CoreEngine.cpp

Modified: cfe/trunk/lib/StaticAnalyzer/Core/CoreEngine.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/CoreEngine.cpp?rev=283583&r1=283582&r2=283583&view=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Core/CoreEngine.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/CoreEngine.cpp Fri Oct  7 14:11:33 2016
@@ -313,7 +313,7 @@ void CoreEngine::HandleBlockEdge(const B
 const ReturnStmt *RS = nullptr;
 if (!L.getSrc()->empty()) {
   if (Optional LastStmt = L.getSrc()->back().getAs()) {
-if (RS = dyn_cast(LastStmt->getStmt())) {
+if ((RS = dyn_cast(LastStmt->getStmt( {
   if (!RS->getRetValue())
 RS = nullptr;
 }


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


[PATCH] D25153: preprocessor supports `-dI` flag

2016-10-07 Thread Steve O'Brien via cfe-commits
elsteveogrande added a comment.

Hi @rsmith -- now this simply reports the `#include` line (or whatever token) 
without fiddly path escaping.  So this is simplified and there's less room for 
error and such.


https://reviews.llvm.org/D25153



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


[PATCH] D25141: [libcxx] [test] Remove MSVC workarounds

2016-10-07 Thread Eric Fiselier via cfe-commits
EricWF closed this revision.
EricWF added a comment.

r283580.


https://reviews.llvm.org/D25141



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


[libcxx] r283580 - Remove MSVC workarounds. Patch from s...@microsoft.com

2016-10-07 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Oct  7 13:51:33 2016
New Revision: 283580

URL: http://llvm.org/viewvc/llvm-project?rev=283580&view=rev
Log:
Remove MSVC workarounds. Patch from s...@microsoft.com

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

Modified: libcxx/trunk/test/support/test_allocator.h
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/test_allocator.h?rev=283580&r1=283579&r2=283580&view=diff
==
--- libcxx/trunk/test/support/test_allocator.h (original)
+++ libcxx/trunk/test/support/test_allocator.h Fri Oct  7 13:51:33 2016
@@ -88,10 +88,7 @@ public:
 {::new(static_cast(p)) T(std::forward(val));}
 #endif
 void destroy(pointer p)
-{
-p->~T();
-((void)p); // Prevent MSVC's spurious unused warning
-}
+{p->~T();}
 friend bool operator==(const test_allocator& x, const test_allocator& y)
 {return x.data_ == y.data_;}
 friend bool operator!=(const test_allocator& x, const test_allocator& y)
@@ -291,10 +288,7 @@ public:
 
 template
 void destroy(U* p)
-{
-p->~U();
-((void)p); // Prevent MSVC's spurious unused warning
-}
+{ p->~U(); }
 };
 
 template


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


RE: [PATCH] D25373: Fix for Bug 30639: CGDebugInfo Null dereference with OpenMP array access

2016-10-07 Thread Keane, Erich via cfe-commits
Added Alexey to the list, he’s the OMP Maintainer, so hopefully he knows better 
☺

From: David Blaikie [mailto:dblai...@gmail.com]
Sent: Friday, October 7, 2016 11:51 AM
To: reviews+d25373+public+d8ec2a4bb41b1...@reviews.llvm.org; Keane, Erich 
; cfe-commits@lists.llvm.org; david.majne...@gmail.com; 
guy.ben...@intel.com
Cc: junb...@codeaurora.org
Subject: Re: [PATCH] D25373: Fix for Bug 30639: CGDebugInfo Null dereference 
with OpenMP array access

Could you explain how/why there's a null size expr? I would've thought it must 
have /some/ size for code generation purposes...

On Fri, Oct 7, 2016 at 11:33 AM Erich Keane 
mailto:erich.ke...@intel.com>> wrote:
erichkeane created this revision.
erichkeane added reviewers: cfe-commits, dblaikie, majnemer, gbenyei.
erichkeane set the repository for this revision to rL LLVM.

OpenMP creates a variable array type with a a null size-expr.  The Debug 
generation failed to properly consider this case.  This patch adds a null check 
to prevent a null dereference seg-fault in this case, plus adds a test.


Repository:
  rL LLVM

https://reviews.llvm.org/D25373

Files:
  lib/CodeGen/CGDebugInfo.cpp
  test/CodeGenCXX/debug-info-openmp-array.cpp


Index: lib/CodeGen/CGDebugInfo.cpp
===
--- lib/CodeGen/CGDebugInfo.cpp
+++ lib/CodeGen/CGDebugInfo.cpp
@@ -2181,7 +2181,8 @@
   Count = CAT->getSize().getZExtValue();
 else if (const auto *VAT = dyn_cast(Ty)) {
   llvm::APSInt V;
-  if (VAT->getSizeExpr()->EvaluateAsInt(V, CGM.getContext()))
+  if (VAT->getSizeExpr() &&
+  VAT->getSizeExpr()->EvaluateAsInt(V, CGM.getContext()))
 Count = V.getExtValue();
 }

Index: test/CodeGenCXX/debug-info-openmp-array.cpp
===
--- test/CodeGenCXX/debug-info-openmp-array.cpp
+++ test/CodeGenCXX/debug-info-openmp-array.cpp
@@ -0,0 +1,17 @@
+// RUN: %clang -target x86_64-unknown-unknown -fverbose-asm -fopenmp -g -O0 -S 
-emit-llvm %s -o - | FileCheck %s
+
+
+void f(int m) {
+  int i;
+  int cen[m];
+#pragma omp parallel for
+  for (i = 0; i < m; ++i) {
+cen[i] = i;
+  }
+}
+
+// CHECK: !DICompositeType(tag: DW_TAG_array_type,
+// CHECK-NOT: size:
+// CHECK-SAME: align: 32
+// CHECK-SAME:  elements: [[ELEM_TYPE:![0-9]+]]
+// CHECK: !DISubrange(count: -1)

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


RE: [PATCH] D25373: Fix for Bug 30639: CGDebugInfo Null dereference with OpenMP array access

2016-10-07 Thread Keane, Erich via cfe-commits
I cannot personally right now, though I will dig into OpenMP implementation to 
see how intentional that is.  The size is seemingly determined by the OMP code 
generation as far as I can tell.

From: David Blaikie [mailto:dblai...@gmail.com]
Sent: Friday, October 7, 2016 11:51 AM
To: reviews+d25373+public+d8ec2a4bb41b1...@reviews.llvm.org; Keane, Erich 
; cfe-commits@lists.llvm.org; david.majne...@gmail.com; 
guy.ben...@intel.com
Cc: junb...@codeaurora.org
Subject: Re: [PATCH] D25373: Fix for Bug 30639: CGDebugInfo Null dereference 
with OpenMP array access

Could you explain how/why there's a null size expr? I would've thought it must 
have /some/ size for code generation purposes...

On Fri, Oct 7, 2016 at 11:33 AM Erich Keane 
mailto:erich.ke...@intel.com>> wrote:
erichkeane created this revision.
erichkeane added reviewers: cfe-commits, dblaikie, majnemer, gbenyei.
erichkeane set the repository for this revision to rL LLVM.

OpenMP creates a variable array type with a a null size-expr.  The Debug 
generation failed to properly consider this case.  This patch adds a null check 
to prevent a null dereference seg-fault in this case, plus adds a test.


Repository:
  rL LLVM

https://reviews.llvm.org/D25373

Files:
  lib/CodeGen/CGDebugInfo.cpp
  test/CodeGenCXX/debug-info-openmp-array.cpp


Index: lib/CodeGen/CGDebugInfo.cpp
===
--- lib/CodeGen/CGDebugInfo.cpp
+++ lib/CodeGen/CGDebugInfo.cpp
@@ -2181,7 +2181,8 @@
   Count = CAT->getSize().getZExtValue();
 else if (const auto *VAT = dyn_cast(Ty)) {
   llvm::APSInt V;
-  if (VAT->getSizeExpr()->EvaluateAsInt(V, CGM.getContext()))
+  if (VAT->getSizeExpr() &&
+  VAT->getSizeExpr()->EvaluateAsInt(V, CGM.getContext()))
 Count = V.getExtValue();
 }

Index: test/CodeGenCXX/debug-info-openmp-array.cpp
===
--- test/CodeGenCXX/debug-info-openmp-array.cpp
+++ test/CodeGenCXX/debug-info-openmp-array.cpp
@@ -0,0 +1,17 @@
+// RUN: %clang -target x86_64-unknown-unknown -fverbose-asm -fopenmp -g -O0 -S 
-emit-llvm %s -o - | FileCheck %s
+
+
+void f(int m) {
+  int i;
+  int cen[m];
+#pragma omp parallel for
+  for (i = 0; i < m; ++i) {
+cen[i] = i;
+  }
+}
+
+// CHECK: !DICompositeType(tag: DW_TAG_array_type,
+// CHECK-NOT: size:
+// CHECK-SAME: align: 32
+// CHECK-SAME:  elements: [[ELEM_TYPE:![0-9]+]]
+// CHECK: !DISubrange(count: -1)

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


Re: [PATCH] D25373: Fix for Bug 30639: CGDebugInfo Null dereference with OpenMP array access

2016-10-07 Thread David Blaikie via cfe-commits
Could you explain how/why there's a null size expr? I would've thought it
must have /some/ size for code generation purposes...

On Fri, Oct 7, 2016 at 11:33 AM Erich Keane  wrote:

> erichkeane created this revision.
> erichkeane added reviewers: cfe-commits, dblaikie, majnemer, gbenyei.
> erichkeane set the repository for this revision to rL LLVM.
>
> OpenMP creates a variable array type with a a null size-expr.  The Debug
> generation failed to properly consider this case.  This patch adds a null
> check to prevent a null dereference seg-fault in this case, plus adds a
> test.
>
>
> Repository:
>   rL LLVM
>
> https://reviews.llvm.org/D25373
>
> Files:
>   lib/CodeGen/CGDebugInfo.cpp
>   test/CodeGenCXX/debug-info-openmp-array.cpp
>
>
> Index: lib/CodeGen/CGDebugInfo.cpp
> ===
> --- lib/CodeGen/CGDebugInfo.cpp
> +++ lib/CodeGen/CGDebugInfo.cpp
> @@ -2181,7 +2181,8 @@
>Count = CAT->getSize().getZExtValue();
>  else if (const auto *VAT = dyn_cast(Ty)) {
>llvm::APSInt V;
> -  if (VAT->getSizeExpr()->EvaluateAsInt(V, CGM.getContext()))
> +  if (VAT->getSizeExpr() &&
> +  VAT->getSizeExpr()->EvaluateAsInt(V, CGM.getContext()))
>  Count = V.getExtValue();
>  }
>
> Index: test/CodeGenCXX/debug-info-openmp-array.cpp
> ===
> --- test/CodeGenCXX/debug-info-openmp-array.cpp
> +++ test/CodeGenCXX/debug-info-openmp-array.cpp
> @@ -0,0 +1,17 @@
> +// RUN: %clang -target x86_64-unknown-unknown -fverbose-asm -fopenmp -g
> -O0 -S -emit-llvm %s -o - | FileCheck %s
> +
> +
> +void f(int m) {
> +  int i;
> +  int cen[m];
> +#pragma omp parallel for
> +  for (i = 0; i < m; ++i) {
> +cen[i] = i;
> +  }
> +}
> +
> +// CHECK: !DICompositeType(tag: DW_TAG_array_type,
> +// CHECK-NOT: size:
> +// CHECK-SAME: align: 32
> +// CHECK-SAME:  elements:
> [[ELEM_TYPE:![0-9]+]]
> +// CHECK: !DISubrange(count: -1)
>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25373: Fix for Bug 30639: CGDebugInfo Null dereference with OpenMP array access

2016-10-07 Thread Erich Keane via cfe-commits
erichkeane created this revision.
erichkeane added reviewers: cfe-commits, dblaikie, majnemer, gbenyei.
erichkeane set the repository for this revision to rL LLVM.

OpenMP creates a variable array type with a a null size-expr.  The Debug 
generation failed to properly consider this case.  This patch adds a null check 
to prevent a null dereference seg-fault in this case, plus adds a test.


Repository:
  rL LLVM

https://reviews.llvm.org/D25373

Files:
  lib/CodeGen/CGDebugInfo.cpp
  test/CodeGenCXX/debug-info-openmp-array.cpp


Index: lib/CodeGen/CGDebugInfo.cpp
===
--- lib/CodeGen/CGDebugInfo.cpp
+++ lib/CodeGen/CGDebugInfo.cpp
@@ -2181,7 +2181,8 @@
   Count = CAT->getSize().getZExtValue();
 else if (const auto *VAT = dyn_cast(Ty)) {
   llvm::APSInt V;
-  if (VAT->getSizeExpr()->EvaluateAsInt(V, CGM.getContext()))
+  if (VAT->getSizeExpr() &&
+  VAT->getSizeExpr()->EvaluateAsInt(V, CGM.getContext()))
 Count = V.getExtValue();
 }
 
Index: test/CodeGenCXX/debug-info-openmp-array.cpp
===
--- test/CodeGenCXX/debug-info-openmp-array.cpp
+++ test/CodeGenCXX/debug-info-openmp-array.cpp
@@ -0,0 +1,17 @@
+// RUN: %clang -target x86_64-unknown-unknown -fverbose-asm -fopenmp -g -O0 -S 
-emit-llvm %s -o - | FileCheck %s
+
+
+void f(int m) {
+  int i;
+  int cen[m];
+#pragma omp parallel for
+  for (i = 0; i < m; ++i) {
+cen[i] = i;
+  }
+}
+
+// CHECK: !DICompositeType(tag: DW_TAG_array_type,
+// CHECK-NOT: size:
+// CHECK-SAME: align: 32
+// CHECK-SAME:  elements: [[ELEM_TYPE:![0-9]+]]
+// CHECK: !DISubrange(count: -1)


Index: lib/CodeGen/CGDebugInfo.cpp
===
--- lib/CodeGen/CGDebugInfo.cpp
+++ lib/CodeGen/CGDebugInfo.cpp
@@ -2181,7 +2181,8 @@
   Count = CAT->getSize().getZExtValue();
 else if (const auto *VAT = dyn_cast(Ty)) {
   llvm::APSInt V;
-  if (VAT->getSizeExpr()->EvaluateAsInt(V, CGM.getContext()))
+  if (VAT->getSizeExpr() &&
+  VAT->getSizeExpr()->EvaluateAsInt(V, CGM.getContext()))
 Count = V.getExtValue();
 }
 
Index: test/CodeGenCXX/debug-info-openmp-array.cpp
===
--- test/CodeGenCXX/debug-info-openmp-array.cpp
+++ test/CodeGenCXX/debug-info-openmp-array.cpp
@@ -0,0 +1,17 @@
+// RUN: %clang -target x86_64-unknown-unknown -fverbose-asm -fopenmp -g -O0 -S -emit-llvm %s -o - | FileCheck %s
+
+
+void f(int m) {
+  int i;
+  int cen[m];
+#pragma omp parallel for
+  for (i = 0; i < m; ++i) {
+cen[i] = i;
+  }
+}
+
+// CHECK: !DICompositeType(tag: DW_TAG_array_type,
+// CHECK-NOT: size:
+// CHECK-SAME: align: 32
+// CHECK-SAME:  elements: [[ELEM_TYPE:![0-9]+]]
+// CHECK: !DISubrange(count: -1)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r283554 - [analyzer] Don't merge different return nodes in ExplodedGraph

2016-10-07 Thread Galina Kistanova via cfe-commits
Hi Daniel,

This revision introduced warnings on one our of builders:
http://lab.llvm.org:8011/builders/clang-3stage-ubuntu/builds/4719

The warnings:

/home/buildbot/Buildbot/Slave1a/clang-3stage-ubuntu/llvm.src/tools/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp:316:59:
warning: suggest parentheses around assignment used as truth value
[-Wparentheses]
/home/buildbot/Buildbot/Slave1a/clang-3stage-ubuntu/llvm.src/tools/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp:316:16:
warning: using the result of an assignment as a condition without
parentheses [-Wparentheses]
1 warning generated.
/home/buildbot/Buildbot/Slave1a/clang-3stage-ubuntu/llvm.src/tools/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp:316:16:
warning: using the result of an assignment as a condition without
parentheses [-Wparentheses]
1 warning generated.

Please have a look?

Thanks

Galina



On Fri, Oct 7, 2016 at 7:21 AM, Daniel Marjamaki via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: danielmarjamaki
> Date: Fri Oct  7 09:21:08 2016
> New Revision: 283554
>
> URL: http://llvm.org/viewvc/llvm-project?rev=283554&view=rev
> Log:
> [analyzer] Don't merge different return nodes in ExplodedGraph
>
> Returns when calling an inline function should not be merged in the
> ExplodedGraph unless they are same.
>
> Differential Revision: https://reviews.llvm.org/D25326
>
> Modified:
> cfe/trunk/include/clang/Analysis/ProgramPoint.h
> cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
> cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
> cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h
> cfe/trunk/lib/StaticAnalyzer/Core/CoreEngine.cpp
> cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
> cfe/trunk/test/Analysis/inlining/InlineObjCClassMethod.m
> cfe/trunk/test/Analysis/unreachable-code-path.c
>
> Modified: cfe/trunk/include/clang/Analysis/ProgramPoint.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/
> clang/Analysis/ProgramPoint.h?rev=283554&r1=283553&r2=283554&view=diff
> 
> ==
> --- cfe/trunk/include/clang/Analysis/ProgramPoint.h (original)
> +++ cfe/trunk/include/clang/Analysis/ProgramPoint.h Fri Oct  7 09:21:08
> 2016
> @@ -622,8 +622,8 @@ private:
>  class CallExitBegin : public ProgramPoint {
>  public:
>// CallExitBegin uses the callee's location context.
> -  CallExitBegin(const StackFrameContext *L)
> -: ProgramPoint(nullptr, CallExitBeginKind, L, nullptr) {}
> +  CallExitBegin(const StackFrameContext *L, const ReturnStmt *RS)
> +: ProgramPoint(RS, CallExitBeginKind, L, nullptr) { }
>
>  private:
>friend class ProgramPoint;
>
> Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/
> PathSensitive/CoreEngine.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/
> clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h?
> rev=283554&r1=283553&r2=283554&view=diff
> 
> ==
> --- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
> (original)
> +++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
> Fri Oct  7 09:21:08 2016
> @@ -109,7 +109,8 @@ private:
>CoreEngine(const CoreEngine &) = delete;
>void operator=(const CoreEngine &) = delete;
>
> -  ExplodedNode *generateCallExitBeginNode(ExplodedNode *N);
> +  ExplodedNode *generateCallExitBeginNode(ExplodedNode *N,
> +  const ReturnStmt *RS);
>
>  public:
>/// Construct a CoreEngine object to analyze the provided CFG.
> @@ -172,7 +173,7 @@ public:
>
>/// \brief enqueue the nodes corresponding to the end of function onto
> the
>/// end of path / work list.
> -  void enqueueEndOfFunction(ExplodedNodeSet &Set);
> +  void enqueueEndOfFunction(ExplodedNodeSet &Set, const ReturnStmt *RS);
>
>/// \brief Enqueue a single node created as a result of statement
> processing.
>void enqueueStmtNode(ExplodedNode *N, const CFGBlock *Block, unsigned
> Idx);
>
> Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/
> PathSensitive/ExprEngine.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/
> clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h?
> rev=283554&r1=283553&r2=283554&view=diff
> 
> ==
> --- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
> (original)
> +++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
> Fri Oct  7 09:21:08 2016
> @@ -262,7 +262,8 @@ public:
>/// Called by CoreEngine.  Used to notify checkers that processing a
>/// function has ended. Called for both inlined and and top-level
> functions.
>void processEndOfFunction(NodeBuilderContext& BC,
> -ExplodedNode *Pred) override;
> +ExplodedNode *Pr

[PATCH] D25244: [clang-tidy] Add a whitelist option in google-runtime-references.

2016-10-07 Thread Aaron Ballman via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM with a small nit.




Comment at: clang-tidy/google/NonConstReferences.cpp:71-75
+  for (const auto &WhiteListType: WhiteListTypes) {
+if (ReferencedType.getCanonicalType().getAsString(
+Result.Context->getPrintingPolicy()) == WhiteListType)
+  return;
+  }

I think this would be a bit easier to read with std::find_if rather than a 
manual loop. If you decide to stick with the manual loop, the colon in the 
range-based for loop needs a preceding space.


https://reviews.llvm.org/D25244



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


[PATCH] D25338: [Driver] Make -print-libgcc-file-name print compiler-rt lib when used

2016-10-07 Thread Michał Górny via cfe-commits
mgorny added a comment.

It seems that my test doesn't work on Darwin, and I should exclude the libgcc 
part there. Do you happen to have any suggestion how to do that?

I'm going to wait for other buildbots to finish to see if I haven't broken any 
other platform, then revert it and look for a proper way to restrict the tests.


Repository:
  rL LLVM

https://reviews.llvm.org/D25338



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


[PATCH] D24669: {Sema] Gcc compatibility of vector shift.

2016-10-07 Thread Bruno Cardoso Lopes via cfe-commits
bruno added a reviewer: bruno.
bruno added inline comments.



Comment at: llvm/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td:2306
+  "vector operands do not have the same elements sizes (%0 and %1)">,
+  InGroup>, DefaultError;
 def err_ext_vector_component_exceeds_length : Error<

Although the motivation is to support the same warning present in GCC, I think 
this is helpful enough anyway so that we might skip calling it 
"gnu-vec-elem-size" and have a more generic name instead? How about plain 
"vec-elem-size"?



Comment at: llvm/tools/clang/lib/Sema/SemaExpr.cpp:8787
 }
+if (!S.LangOpts.OpenCL && !S.LangOpts.ZVector) {
+  const BuiltinType *LHSBT = LHSEleType->getAs();

Besides `__ext_vector_type__`, would this also trigger for `vector_size`? Right 
now this is an error for `vector_size` primarily because the number of elements 
is different, can you confirm this won't change?


https://reviews.llvm.org/D24669



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


[PATCH] D25338: [Driver] Make -print-libgcc-file-name print compiler-rt lib when used

2016-10-07 Thread Michał Górny via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL283572: [Driver] Make -print-libgcc-file-name print 
compiler-rt lib when used (authored by mgorny).

Changed prior to commit:
  https://reviews.llvm.org/D25338?vs=73887&id=73953#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D25338

Files:
  cfe/trunk/docs/CommandGuide/clang.rst
  cfe/trunk/include/clang/Driver/Options.td
  cfe/trunk/lib/Driver/Driver.cpp
  cfe/trunk/test/Driver/print-libgcc-file-name.c


Index: cfe/trunk/lib/Driver/Driver.cpp
===
--- cfe/trunk/lib/Driver/Driver.cpp
+++ cfe/trunk/lib/Driver/Driver.cpp
@@ -994,7 +994,15 @@
   }
 
   if (C.getArgs().hasArg(options::OPT_print_libgcc_file_name)) {
-llvm::outs() << GetFilePath("libgcc.a", TC) << "\n";
+ToolChain::RuntimeLibType RLT = TC.GetRuntimeLibType(C.getArgs());
+switch (RLT) {
+case ToolChain::RLT_CompilerRT:
+  llvm::outs() << TC.getCompilerRTArgString(C.getArgs(), "builtins") << 
"\n";
+  break;
+case ToolChain::RLT_Libgcc:
+  llvm::outs() << GetFilePath("libgcc.a", TC) << "\n";
+  break;
+}
 return false;
   }
 
Index: cfe/trunk/docs/CommandGuide/clang.rst
===
--- cfe/trunk/docs/CommandGuide/clang.rst
+++ cfe/trunk/docs/CommandGuide/clang.rst
@@ -394,7 +394,8 @@
 
 .. option:: -print-libgcc-file-name
 
-  Print the library path for "libgcc.a".
+  Print the library path for the currently used compiler runtime library
+  ("libgcc.a" or "libclang_rt.builtins.*.a").
 
 .. option:: -print-prog-name=
 
Index: cfe/trunk/include/clang/Driver/Options.td
===
--- cfe/trunk/include/clang/Driver/Options.td
+++ cfe/trunk/include/clang/Driver/Options.td
@@ -1861,7 +1861,8 @@
 def print_ivar_layout : Flag<["-"], "print-ivar-layout">, Flags<[CC1Option]>,
   HelpText<"Enable Objective-C Ivar layout bitmap print trace">;
 def print_libgcc_file_name : Flag<["-", "--"], "print-libgcc-file-name">,
-  HelpText<"Print the library path for \"libgcc.a\"">;
+  HelpText<"Print the library path for the currently used compiler runtime "
+   "library (\"libgcc.a\" or \"libclang_rt.builtins.*.a\")">;
 def print_multi_directory : Flag<["-", "--"], "print-multi-directory">;
 def print_multi_lib : Flag<["-", "--"], "print-multi-lib">;
 def print_multi_os_directory : Flag<["-", "--"], "print-multi-os-directory">,
Index: cfe/trunk/test/Driver/print-libgcc-file-name.c
===
--- cfe/trunk/test/Driver/print-libgcc-file-name.c
+++ cfe/trunk/test/Driver/print-libgcc-file-name.c
@@ -0,0 +1,15 @@
+// Test that -print-libgcc-file-name correctly respects -rtlib=.
+
+// RUN: %clang -rtlib=libgcc -print-libgcc-file-name 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-LIBGCC %s
+// CHECK-LIBGCC: libgcc.a
+
+// RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name 2>&1 \
+// RUN: --target=x86_64-pc-linux \
+// RUN:   | FileCheck --check-prefix=CHECK-CLANGRT-X8664 %s
+// CHECK-CLANGRT-X8664: libclang_rt.builtins-x86_64.a
+
+// RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name 2>&1 \
+// RUN: --target=i686-pc-linux \
+// RUN:   | FileCheck --check-prefix=CHECK-CLANGRT-I686 %s
+// CHECK-CLANGRT-I686: libclang_rt.builtins-i686.a


Index: cfe/trunk/lib/Driver/Driver.cpp
===
--- cfe/trunk/lib/Driver/Driver.cpp
+++ cfe/trunk/lib/Driver/Driver.cpp
@@ -994,7 +994,15 @@
   }
 
   if (C.getArgs().hasArg(options::OPT_print_libgcc_file_name)) {
-llvm::outs() << GetFilePath("libgcc.a", TC) << "\n";
+ToolChain::RuntimeLibType RLT = TC.GetRuntimeLibType(C.getArgs());
+switch (RLT) {
+case ToolChain::RLT_CompilerRT:
+  llvm::outs() << TC.getCompilerRTArgString(C.getArgs(), "builtins") << "\n";
+  break;
+case ToolChain::RLT_Libgcc:
+  llvm::outs() << GetFilePath("libgcc.a", TC) << "\n";
+  break;
+}
 return false;
   }
 
Index: cfe/trunk/docs/CommandGuide/clang.rst
===
--- cfe/trunk/docs/CommandGuide/clang.rst
+++ cfe/trunk/docs/CommandGuide/clang.rst
@@ -394,7 +394,8 @@
 
 .. option:: -print-libgcc-file-name
 
-  Print the library path for "libgcc.a".
+  Print the library path for the currently used compiler runtime library
+  ("libgcc.a" or "libclang_rt.builtins.*.a").
 
 .. option:: -print-prog-name=
 
Index: cfe/trunk/include/clang/Driver/Options.td
===
--- cfe/trunk/include/clang/Driver/Options.td
+++ cfe/trunk/include/clang/Driver/Options.td
@@ -1861,7 +1861,8 @@
 def print_ivar_layout : Flag<["-"], "print-ivar-layout">, Flags<[CC1Option]>,
   HelpText<"Enable Objective-C Ivar layout bitmap print trace">;
 def print_libgcc_file_name : Flag<["-", "-

[PATCH] D25326: [StaticAnalyser] Don't merge different returns in ExplodedGraph

2016-10-07 Thread Daniel Marjamäki via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL283554: [analyzer] Don't merge different return nodes in 
ExplodedGraph (authored by danielmarjamaki).

Changed prior to commit:
  https://reviews.llvm.org/D25326?vs=73926&id=73947#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D25326

Files:
  cfe/trunk/include/clang/Analysis/ProgramPoint.h
  cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
  cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
  cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h
  cfe/trunk/lib/StaticAnalyzer/Core/CoreEngine.cpp
  cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
  cfe/trunk/test/Analysis/inlining/InlineObjCClassMethod.m
  cfe/trunk/test/Analysis/unreachable-code-path.c

Index: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h
===
--- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h
@@ -109,7 +109,8 @@
   /// Called by CoreEngine.  Used to notify checkers that processing a
   /// function has ended. Called for both inlined and and top-level functions.
   virtual void processEndOfFunction(NodeBuilderContext& BC,
-ExplodedNode *Pred) = 0;
+ExplodedNode *Pred,
+const ReturnStmt *RS = nullptr) = 0;
 
   // Generate the entry node of the callee.
   virtual void processCallEnter(NodeBuilderContext& BC, CallEnter CE,
Index: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
===
--- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
@@ -262,7 +262,8 @@
   /// Called by CoreEngine.  Used to notify checkers that processing a
   /// function has ended. Called for both inlined and and top-level functions.
   void processEndOfFunction(NodeBuilderContext& BC,
-ExplodedNode *Pred) override;
+ExplodedNode *Pred,
+const ReturnStmt *RS=nullptr) override;
 
   /// Remove dead bindings/symbols before exiting a function.
   void removeDeadOnEndOfFunction(NodeBuilderContext& BC,
Index: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
===
--- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
@@ -109,7 +109,8 @@
   CoreEngine(const CoreEngine &) = delete;
   void operator=(const CoreEngine &) = delete;
 
-  ExplodedNode *generateCallExitBeginNode(ExplodedNode *N);
+  ExplodedNode *generateCallExitBeginNode(ExplodedNode *N,
+  const ReturnStmt *RS);
 
 public:
   /// Construct a CoreEngine object to analyze the provided CFG.
@@ -172,7 +173,7 @@
 
   /// \brief enqueue the nodes corresponding to the end of function onto the
   /// end of path / work list.
-  void enqueueEndOfFunction(ExplodedNodeSet &Set);
+  void enqueueEndOfFunction(ExplodedNodeSet &Set, const ReturnStmt *RS);
 
   /// \brief Enqueue a single node created as a result of statement processing.
   void enqueueStmtNode(ExplodedNode *N, const CFGBlock *Block, unsigned Idx);
Index: cfe/trunk/include/clang/Analysis/ProgramPoint.h
===
--- cfe/trunk/include/clang/Analysis/ProgramPoint.h
+++ cfe/trunk/include/clang/Analysis/ProgramPoint.h
@@ -622,8 +622,8 @@
 class CallExitBegin : public ProgramPoint {
 public:
   // CallExitBegin uses the callee's location context.
-  CallExitBegin(const StackFrameContext *L)
-: ProgramPoint(nullptr, CallExitBeginKind, L, nullptr) {}
+  CallExitBegin(const StackFrameContext *L, const ReturnStmt *RS)
+: ProgramPoint(RS, CallExitBeginKind, L, nullptr) { }
 
 private:
   friend class ProgramPoint;
Index: cfe/trunk/test/Analysis/unreachable-code-path.c
===
--- cfe/trunk/test/Analysis/unreachable-code-path.c
+++ cfe/trunk/test/Analysis/unreachable-code-path.c
@@ -194,3 +194,15 @@
 break;
   }
 }
+
+// Don't merge return nodes in ExplodedGraph unless they are same.
+extern int table[];
+static int inlineFunction(const int i) {
+  if (table[i] != 0)
+return 1;
+  return 0;
+}
+void test13(int i) {
+  int x = inlineFunction(i);
+  x && x < 10; // no-warning
+}
Index: cfe/trunk/test/Analysis/inlining/InlineObjCClassMethod.m
===
--- cfe/trunk/test/Analysis/inlining/InlineObjCClassMethod.m
+++ cfe/trunk/test/Analysis/inlining/InlineObjCClassMethod.m

Re: [PATCH] D25326: [StaticAnalyser] Don't merge different returns in ExplodedGraph

2016-10-07 Thread Bill Seurer via cfe-commits

On 10/07/16 08:39, Daniel Marjamäki via cfe-commits wrote:

danielmarjamaki removed rL LLVM as the repository for this revision.
danielmarjamaki updated this revision to Diff 73926.
danielmarjamaki added a comment.

Refactoring.


https://reviews.llvm.org/D25326

Files:
  include/clang/Analysis/ProgramPoint.h
  include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
  include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
  include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h
  lib/StaticAnalyzer/Core/CoreEngine.cpp
  lib/StaticAnalyzer/Core/ExprEngine.cpp
  test/Analysis/inlining/InlineObjCClassMethod.m
  test/Analysis/unreachable-code-path.c



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



The changes in CoreEngine.cpp cause issues with the sanitizer buildbots 
which compile with -Werror


[ 80%] Building CXX object 
tools/clang/lib/StaticAnalyzer/Core/CMakeFiles/clangStaticAnalyzerCore.dir/CoreEngine.cpp.o
cd /home/seurer/llvm/build/llvm-test/tools/clang/lib/StaticAnalyzer/Core 
&& /home/seurer/llvm/build/llvm-test2/bin/clang++   -DCLANG_ENABLE_ARCMT 
-DCLANG_ENABLE_OBJC_REWRITER -DCLANG_ENABLE_STATIC_ANALYZER 
-DGTEST_HAS_RTTI=0 -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS 
-D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS 
-I/home/seurer/llvm/build/llvm-test/tools/clang/lib/StaticAnalyzer/Core 
-I/home/seurer/llvm/llvm-test/tools/clang/lib/StaticAnalyzer/Core 
-I/home/seurer/llvm/llvm-test/tools/clang/include 
-I/home/seurer/llvm/build/llvm-test/tools/clang/include 
-I/home/seurer/llvm/build/llvm-test/include 
-I/home/seurer/llvm/llvm-test/include  -gmlt -fPIC 
-fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter 
-Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic 
-Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor 
-Wdelete-non-virtual-dtor -Werror -Werror=date-time -std=c++11 
-ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual 
-Wno-nested-anon-types -O3-UNDEBUG  -fno-exceptions -fno-rtti -o 
CMakeFiles/clangStaticAnalyzerCore.dir/CoreEngine.cpp.o -c 
/home/seurer/llvm/llvm-test/tools/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp
/home/seurer/llvm/llvm-test/tools/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp:316:16: 
error: using the result of an assignment as a condition without parentheses

  [-Werror,-Wparentheses]
if (RS = dyn_cast(LastStmt->getStmt())) {
~~~^~~
/home/seurer/llvm/llvm-test/tools/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp:316:16: 
note: place parentheses around the assignment to silence this warning

if (RS = dyn_cast(LastStmt->getStmt())) {
   ^
( )
/home/seurer/llvm/llvm-test/tools/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp:316:16: 
note: use '==' to turn this assignment into an equality comparison

if (RS = dyn_cast(LastStmt->getStmt())) {
   ^
   ==
1 error generated.

--

-Bill Seurer

--

-Bill Seurer

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


r283574 - [analyzer] Re-apply r283092, attempt no.4, chunk no.3, fixup 1.

2016-10-07 Thread Artem Dergachev via cfe-commits
Author: dergachev
Date: Fri Oct  7 12:24:06 2016
New Revision: 283574

URL: http://llvm.org/viewvc/llvm-project?rev=283574&view=rev
Log:
[analyzer] Re-apply r283092, attempt no.4, chunk no.3, fixup 1.

Remove the brace default initializer to see if this is what's causing
the msvc crash.

Modified:
cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h

Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h?rev=283574&r1=283573&r2=283574&view=diff
==
--- cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h 
(original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h Fri 
Oct  7 12:24:06 2016
@@ -255,7 +255,7 @@ public:
   /// allows you to specify where exactly in the auto-generated path diagnostic
   /// the extra note should appear.
   void addNote(StringRef Msg, const PathDiagnosticLocation &Pos,
-ArrayRef Ranges = {}) {
+   ArrayRef Ranges) {
 PathDiagnosticNotePiece *P =
 new PathDiagnosticNotePiece(Pos, Msg);
 


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


[PATCH] D25326: [StaticAnalyser] Don't merge different returns in ExplodedGraph

2016-10-07 Thread Aleksei Sidorin via cfe-commits
a.sidorin added inline comments.



Comment at: test/Analysis/unreachable-code-path.c:201
+static int inlineFunction(const int i) {
+  if (table[i] != 0)
+return 1;

I have a small question. Is it possible to simplify this sample with removing 
of table[] array? Like putting something like `i != 0` into condition. As I 
understand, the problem is not array-related.


https://reviews.llvm.org/D25326



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


r283573 - [analyzer] Re-apply r283092, attempt no.4, chunk no.3.

2016-10-07 Thread Artem Dergachev via cfe-commits
Author: dergachev
Date: Fri Oct  7 12:12:05 2016
New Revision: 283573

URL: http://llvm.org/viewvc/llvm-project?rev=283573&view=rev
Log:
[analyzer] Re-apply r283092, attempt no.4, chunk no.3.

This is the primary suspect for causing the msvc crash, now that vector of
smart pointers was proven to be safe. Probably the default {}-initializer
is the problem.




Modified:
cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h

Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h?rev=283573&r1=283572&r2=283573&view=diff
==
--- cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h 
(original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h Fri 
Oct  7 12:12:05 2016
@@ -248,7 +248,23 @@ public:
   void setDeclWithIssue(const Decl *declWithIssue) {
 DeclWithIssue = declWithIssue;
   }
-  
+
+  /// Add new item to the list of additional notes that need to be attached to
+  /// this path-insensitive report. If you want to add extra notes to a
+  /// path-sensitive report, you need to use a BugReporterVisitor because it
+  /// allows you to specify where exactly in the auto-generated path diagnostic
+  /// the extra note should appear.
+  void addNote(StringRef Msg, const PathDiagnosticLocation &Pos,
+ArrayRef Ranges = {}) {
+PathDiagnosticNotePiece *P =
+new PathDiagnosticNotePiece(Pos, Msg);
+
+for (const auto &R : Ranges)
+  P->addRange(R);
+
+Notes.push_back(P);
+  }
+
   /// \brief This allows for addition of meta data to the diagnostic.
   ///
   /// Currently, only the HTMLDiagnosticClient knows how to display it. 


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


r283572 - [Driver] Make -print-libgcc-file-name print compiler-rt lib when used

2016-10-07 Thread Michal Gorny via cfe-commits
Author: mgorny
Date: Fri Oct  7 12:08:06 2016
New Revision: 283572

URL: http://llvm.org/viewvc/llvm-project?rev=283572&view=rev
Log:
[Driver] Make -print-libgcc-file-name print compiler-rt lib when used

Make the -print-libgcc-file-name option print an appropriate compiler
runtime library, that is libgcc.a if gcc runtime is used
and an appropriate compiler-rt library if that runtime is used.

The main use for this is to allow linking executables built with
-nodefaultlibs (e.g. to avoid linking to the standard C++ library) to
the compiler runtime library, e.g. using:

  clang++ ... -nodefaultlibs $(clang++ ... -print-libgcc-file-name)

in which case currently a program built like this linked to the gcc
runtime unconditionally. The patch fixes it to use compiler-rt libraries
instead when compiler-rt is the active runtime.

Differential Revision: https://reviews.llvm.org/D25338

Added:
cfe/trunk/test/Driver/print-libgcc-file-name.c
Modified:
cfe/trunk/docs/CommandGuide/clang.rst
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/lib/Driver/Driver.cpp

Modified: cfe/trunk/docs/CommandGuide/clang.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/CommandGuide/clang.rst?rev=283572&r1=283571&r2=283572&view=diff
==
--- cfe/trunk/docs/CommandGuide/clang.rst (original)
+++ cfe/trunk/docs/CommandGuide/clang.rst Fri Oct  7 12:08:06 2016
@@ -394,7 +394,8 @@ Driver Options
 
 .. option:: -print-libgcc-file-name
 
-  Print the library path for "libgcc.a".
+  Print the library path for the currently used compiler runtime library
+  ("libgcc.a" or "libclang_rt.builtins.*.a").
 
 .. option:: -print-prog-name=
 

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=283572&r1=283571&r2=283572&view=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Fri Oct  7 12:08:06 2016
@@ -1861,7 +1861,8 @@ def print_file_name_EQ : Joined<["-", "-
 def print_ivar_layout : Flag<["-"], "print-ivar-layout">, Flags<[CC1Option]>,
   HelpText<"Enable Objective-C Ivar layout bitmap print trace">;
 def print_libgcc_file_name : Flag<["-", "--"], "print-libgcc-file-name">,
-  HelpText<"Print the library path for \"libgcc.a\"">;
+  HelpText<"Print the library path for the currently used compiler runtime "
+   "library (\"libgcc.a\" or \"libclang_rt.builtins.*.a\")">;
 def print_multi_directory : Flag<["-", "--"], "print-multi-directory">;
 def print_multi_lib : Flag<["-", "--"], "print-multi-lib">;
 def print_multi_os_directory : Flag<["-", "--"], "print-multi-os-directory">,

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=283572&r1=283571&r2=283572&view=diff
==
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Fri Oct  7 12:08:06 2016
@@ -994,7 +994,15 @@ bool Driver::HandleImmediateArgs(const C
   }
 
   if (C.getArgs().hasArg(options::OPT_print_libgcc_file_name)) {
-llvm::outs() << GetFilePath("libgcc.a", TC) << "\n";
+ToolChain::RuntimeLibType RLT = TC.GetRuntimeLibType(C.getArgs());
+switch (RLT) {
+case ToolChain::RLT_CompilerRT:
+  llvm::outs() << TC.getCompilerRTArgString(C.getArgs(), "builtins") << 
"\n";
+  break;
+case ToolChain::RLT_Libgcc:
+  llvm::outs() << GetFilePath("libgcc.a", TC) << "\n";
+  break;
+}
 return false;
   }
 

Added: cfe/trunk/test/Driver/print-libgcc-file-name.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/print-libgcc-file-name.c?rev=283572&view=auto
==
--- cfe/trunk/test/Driver/print-libgcc-file-name.c (added)
+++ cfe/trunk/test/Driver/print-libgcc-file-name.c Fri Oct  7 12:08:06 2016
@@ -0,0 +1,15 @@
+// Test that -print-libgcc-file-name correctly respects -rtlib=.
+
+// RUN: %clang -rtlib=libgcc -print-libgcc-file-name 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-LIBGCC %s
+// CHECK-LIBGCC: libgcc.a
+
+// RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name 2>&1 \
+// RUN: --target=x86_64-pc-linux \
+// RUN:   | FileCheck --check-prefix=CHECK-CLANGRT-X8664 %s
+// CHECK-CLANGRT-X8664: libclang_rt.builtins-x86_64.a
+
+// RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name 2>&1 \
+// RUN: --target=i686-pc-linux \
+// RUN:   | FileCheck --check-prefix=CHECK-CLANGRT-I686 %s
+// CHECK-CLANGRT-I686: libclang_rt.builtins-i686.a


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


[PATCH] D25326: [StaticAnalyser] Don't merge different returns in ExplodedGraph

2016-10-07 Thread Artem Dergachev via cfe-commits
NoQ added inline comments.



Comment at: test/Analysis/unreachable-code-path.c:201
+static int inlineFunction(const int i) {
+  if (table[i] != 0)
+return 1;

a.sidorin wrote:
> I have a small question. Is it possible to simplify this sample with removing 
> of table[] array? Like putting something like `i != 0` into condition. As I 
> understand, the problem is not array-related.
Any `UnknownVal` in the condition would trigger this issue.


https://reviews.llvm.org/D25326



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


[PATCH] D25338: [Driver] Make -print-libgcc-file-name print compiler-rt lib when used

2016-10-07 Thread Michał Górny via cfe-commits
mgorny added a comment.

Thanks for the review.


https://reviews.llvm.org/D25338



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


[PATCH] D25326: [StaticAnalyser] Don't merge different returns in ExplodedGraph

2016-10-07 Thread Devin Coughlin via cfe-commits
dcoughlin added a comment.

Can you also add a test that tests this more directly (i.e., with 
clang_analyzer_warnIfReached). I don't think it is good to have the only test 
for this core coverage issue to be in tests for an alpha checker. Adding the 
direct test would also make it easier to track down any regression if it 
happens. The 'func.c' test file might be a good place for such a test.


https://reviews.llvm.org/D25326



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


[PATCH] D25343: [OpenCL] Mark group functions as noduplicate in opencl-c.h

2016-10-07 Thread Brian Sumner via cfe-commits
b-sumner added a comment.

clang does not recognize convergent as a valid attribute.  There was an attempt 
to add this, see 
https://www.mail-archive.com/cfe-commits@lists.llvm.org/msg22271.html but it 
hasn't had any result.  Matt do you see "real uses" for this now?


https://reviews.llvm.org/D25343



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


[PATCH] D25338: [Driver] Make -print-libgcc-file-name print compiler-rt lib when used

2016-10-07 Thread Bruno Cardoso Lopes via cfe-commits
bruno accepted this revision.
bruno added a comment.
This revision is now accepted and ready to land.

LGTM


https://reviews.llvm.org/D25338



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


[PATCH] D25326: [StaticAnalyser] Don't merge different returns in ExplodedGraph

2016-10-07 Thread Anna Zaks via cfe-commits
zaks.anna accepted this revision.
zaks.anna added a comment.

Please, fix the style issues before committing.




Comment at: include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h:266
+ExplodedNode *Pred,
+const ReturnStmt *RS=nullptr) override;
 

Add spaces around '=.'


https://reviews.llvm.org/D25326



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


[PATCH] D25321: Fix PR13910: Don't warn that __builtin_unreachable() is unreachable

2016-10-07 Thread Adrian Prantl via cfe-commits
aprantl accepted this revision.
aprantl added a reviewer: aprantl.
aprantl added a comment.
This revision is now accepted and ready to land.

Thanks, LGTM!


Repository:
  rL LLVM

https://reviews.llvm.org/D25321



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


r283568 - [analyzer] Re-apply r283092, attempt no.4, chunk no.2.

2016-10-07 Thread Artem Dergachev via cfe-commits
Author: dergachev
Date: Fri Oct  7 10:55:18 2016
New Revision: 283568

URL: http://llvm.org/viewvc/llvm-project?rev=283568&view=rev
Log:
[analyzer] Re-apply r283092, attempt no.4, chunk no.2.

Define the list of pieces in BugReport class. This is half of the changes
in the BugReport class code, which is pointed to by the msvc crash message.

Modified:
cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h

Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h?rev=283568&r1=283567&r2=283568&view=diff
==
--- cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h 
(original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h Fri 
Oct  7 10:55:18 2016
@@ -66,6 +66,8 @@ public:
   typedef SmallVector, 8> VisitorList;
   typedef VisitorList::iterator visitor_iterator;
   typedef SmallVector ExtraTextList;
+  typedef SmallVector, 4>
+  NoteList;
 
 protected:
   friend class BugReporter;
@@ -82,7 +84,8 @@ protected:
   const ExplodedNode *ErrorNode;
   SmallVector Ranges;
   ExtraTextList ExtraText;
-  
+  NoteList Notes;
+
   typedef llvm::DenseSet Symbols;
   typedef llvm::DenseSet Regions;
 


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


r283566 - [analyzer] Re-apply r283092, attempt no.4, a small chunk.

2016-10-07 Thread Artem Dergachev via cfe-commits
Author: dergachev
Date: Fri Oct  7 10:23:02 2016
New Revision: 283566

URL: http://llvm.org/viewvc/llvm-project?rev=283566&view=rev
Log:
[analyzer] Re-apply r283092, attempt no.4, a small chunk.

Define PathDiagnosticNotePiece. The next commit would be able to address the
BugReport class code that is pointed to by the msvc crash message.

Modified:
cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp
cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp

Modified: 
cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h?rev=283566&r1=283565&r2=283566&view=diff
==
--- cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h 
(original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h 
Fri Oct  7 10:23:02 2016
@@ -336,7 +336,7 @@ public:
 
 class PathDiagnosticPiece : public RefCountedBaseVPTR {
 public:
-  enum Kind { ControlFlow, Event, Macro, Call };
+  enum Kind { ControlFlow, Event, Macro, Call, Note };
   enum DisplayHint { Above, Below };
 
 private:
@@ -452,7 +452,8 @@ public:
   void Profile(llvm::FoldingSetNodeID &ID) const override;
 
   static bool classof(const PathDiagnosticPiece *P) {
-return P->getKind() == Event || P->getKind() == Macro;
+return P->getKind() == Event || P->getKind() == Macro ||
+   P->getKind() == Note;
   }
 };
 
@@ -706,6 +707,23 @@ public:
   }
 
   void dump() const override;
+
+  void Profile(llvm::FoldingSetNodeID &ID) const override;
+};
+
+class PathDiagnosticNotePiece: public PathDiagnosticSpotPiece {
+public:
+  PathDiagnosticNotePiece(const PathDiagnosticLocation &Pos, StringRef S,
+   bool AddPosRange = true)
+  : PathDiagnosticSpotPiece(Pos, S, Note, AddPosRange) {}
+
+  ~PathDiagnosticNotePiece() override;
+
+  static inline bool classof(const PathDiagnosticPiece *P) {
+return P->getKind() == Note;
+  }
+
+  void dump() const override;
 
   void Profile(llvm::FoldingSetNodeID &ID) const override;
 };

Modified: cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp?rev=283566&r1=283565&r2=283566&view=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp Fri Oct  7 10:23:02 2016
@@ -114,15 +114,15 @@ static void removeRedundantMsgs(PathPiec
 path.pop_front();
 
 switch (piece->getKind()) {
-  case clang::ento::PathDiagnosticPiece::Call:
+  case PathDiagnosticPiece::Call:
 removeRedundantMsgs(cast(piece)->path);
 break;
-  case clang::ento::PathDiagnosticPiece::Macro:
+  case PathDiagnosticPiece::Macro:
 removeRedundantMsgs(cast(piece)->subPieces);
 break;
-  case clang::ento::PathDiagnosticPiece::ControlFlow:
+  case PathDiagnosticPiece::ControlFlow:
 break;
-  case clang::ento::PathDiagnosticPiece::Event: {
+  case PathDiagnosticPiece::Event: {
 if (i == N-1)
   break;
 
@@ -142,6 +142,8 @@ static void removeRedundantMsgs(PathPiec
 }
 break;
   }
+  case PathDiagnosticPiece::Note:
+break;
 }
 path.push_back(piece);
   }
@@ -199,6 +201,9 @@ static bool removeUnneededCalls(PathPiec
   }
   case PathDiagnosticPiece::ControlFlow:
 break;
+
+  case PathDiagnosticPiece::Note:
+break;
 }
 
 pieces.push_back(piece);
@@ -3520,6 +3525,13 @@ LLVM_DUMP_METHOD void PathDiagnosticMacr
   // FIXME: Print which macro is being invoked.
 }
 
+LLVM_DUMP_METHOD void PathDiagnosticNotePiece::dump() const {
+  llvm::errs() << "NOTE\n--\n";
+  llvm::errs() << getString() << "\n";
+  llvm::errs() << "  at \n";
+  getLocation().dump();
+}
+
 LLVM_DUMP_METHOD void PathDiagnosticLocation::dump() const {
   if (!isValid()) {
 llvm::errs() << "\n";

Modified: cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp?rev=283566&r1=283565&r2=283566&view=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp Fri Oct  7 10:23:02 
2016
@@ -60,6 +60,7 @@ PathDiagnosticEventPiece::~PathDiagnosti
 PathDiagnosticCallPiece::~PathDiagnosticCallPiece() {}
 PathDiagnosticControlFlowPiece::~PathDiagnosticControlFlowPiece() {}
 PathDiagnosticMacroPiece::~PathDiagnosticMacroPiece() {}
+PathDiagnosticNotePiece::~PathDiagnosticNotePiece() {}
 
 void PathPieces::flatt

r283564 - Update clang test to accomendate discriminator change in https://reviews.llvm.org/D25132

2016-10-07 Thread Dehao Chen via cfe-commits
Author: dehao
Date: Fri Oct  7 10:21:29 2016
New Revision: 283564

URL: http://llvm.org/viewvc/llvm-project?rev=283564&view=rev
Log:
Update clang test to accomendate discriminator change in 
https://reviews.llvm.org/D25132

Summary: https://reviews.llvm.org/D25132 added discriminator even add -g0. This 
leads to test fail which is addressed in thie patch.

Reviewers: davidxl, dnovillo

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D25133

Modified:
cfe/trunk/test/CodeGenCXX/debug-info-line.cpp
cfe/trunk/test/CodeGenObjC/arc-linetable-autorelease.m

Modified: cfe/trunk/test/CodeGenCXX/debug-info-line.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-line.cpp?rev=283564&r1=283563&r2=283564&view=diff
==
--- cfe/trunk/test/CodeGenCXX/debug-info-line.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-line.cpp Fri Oct  7 10:21:29 2016
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -w -debug-info-kind=line-tables-only -std=c++11 
-fexceptions -fcxx-exceptions -S -emit-llvm %s -o - -triple %itanium_abi_triple 
| FileCheck %s
-// RUN: %clang_cc1 -w -debug-info-kind=line-tables-only -std=c++11 
-fexceptions -fcxx-exceptions -S -emit-llvm %s -o - -triple i686-linux-gnu | 
FileCheck %s
+// RUN: %clang_cc1 -w -debug-info-kind=line-tables-only -std=c++11 
-fexceptions -fcxx-exceptions -S -mllvm -no-discriminators -emit-llvm %s -o - 
-triple %itanium_abi_triple | FileCheck %s
+// RUN: %clang_cc1 -w -debug-info-kind=line-tables-only -std=c++11 
-fexceptions -fcxx-exceptions -S -mllvm -no-discriminators -emit-llvm %s -o - 
-triple i686-linux-gnu | FileCheck %s
 
 int &src();
 int *sink();

Modified: cfe/trunk/test/CodeGenObjC/arc-linetable-autorelease.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/arc-linetable-autorelease.m?rev=283564&r1=283563&r2=283564&view=diff
==
--- cfe/trunk/test/CodeGenObjC/arc-linetable-autorelease.m (original)
+++ cfe/trunk/test/CodeGenObjC/arc-linetable-autorelease.m Fri Oct  7 10:21:29 
2016
@@ -30,10 +30,11 @@ NSRect NSMakeRect(CGFloat x, CGFloat y,
   // CHECK: define {{.*}}_createBezierPathWithWidth
   // CHECK: load {{.*}} %path, align {{.*}}, !dbg ![[RET:[0-9]+]]
   // CHECK: call void @objc_storeStrong{{.*}} !dbg ![[ARC:[0-9]+]]
-  // CHECK: call {{.*}} @objc_autoreleaseReturnValue{{.*}} !dbg ![[ARC]]
+  // CHECK: call {{.*}} @objc_autoreleaseReturnValue{{.*}} !dbg 
![[ARC1:[0-9]+]]
   // CHECK: ret {{.*}} !dbg ![[ARC]]
   // CHECK: ![[RET]] = !DILocation(line: [[@LINE+1]], scope: !{{.*}})
   return path;
-  // CHECK: ![[ARC]] = !DILocation(line: [[@LINE+1]], scope: !{{.*}})
+  // CHECK: ![[ARC]] = !DILocation(line: [[@LINE+2]], scope: !{{.*}})
+  // CHECK: ![[ARC1]] = !DILocation(line: [[@LINE+1]], scope: !{{.*}})
 }
 @end


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


[PATCH] D20428: Tracking exception specification source locations

2016-10-07 Thread Stanisław Barzowski via cfe-commits
sbarzowski added a comment.

What's happening here? It's accepted, but not merged and the last activity is 3 
months old while my change is waiting for it. Can I help somehow?


https://reviews.llvm.org/D20428



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


[PATCH] D25343: [OpenCL] Mark group functions as noduplicate in opencl-c.h

2016-10-07 Thread Yaxun Liu via cfe-commits
yaxunl added a comment.

In https://reviews.llvm.org/D25343#564092, @arsenm wrote:

> These should be convergent instead


Unfortunately convergent is not supported as Clang attribute. There was patch 
to add it but the author withdrew it.

Anastasia/Alexey,

Do you think it is a good idea to add __attribute__((convergent)) to clang and 
mark these group functions with it?

convergent put more restrictions on what transformations are allowed, whereas 
noduplicate only forbids duplicate of the function calls.

Thanks.


https://reviews.llvm.org/D25343



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


r283554 - [analyzer] Don't merge different return nodes in ExplodedGraph

2016-10-07 Thread Daniel Marjamaki via cfe-commits
Author: danielmarjamaki
Date: Fri Oct  7 09:21:08 2016
New Revision: 283554

URL: http://llvm.org/viewvc/llvm-project?rev=283554&view=rev
Log:
[analyzer] Don't merge different return nodes in ExplodedGraph

Returns when calling an inline function should not be merged in the 
ExplodedGraph unless they are same.

Differential Revision: https://reviews.llvm.org/D25326

Modified:
cfe/trunk/include/clang/Analysis/ProgramPoint.h
cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h
cfe/trunk/lib/StaticAnalyzer/Core/CoreEngine.cpp
cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
cfe/trunk/test/Analysis/inlining/InlineObjCClassMethod.m
cfe/trunk/test/Analysis/unreachable-code-path.c

Modified: cfe/trunk/include/clang/Analysis/ProgramPoint.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/ProgramPoint.h?rev=283554&r1=283553&r2=283554&view=diff
==
--- cfe/trunk/include/clang/Analysis/ProgramPoint.h (original)
+++ cfe/trunk/include/clang/Analysis/ProgramPoint.h Fri Oct  7 09:21:08 2016
@@ -622,8 +622,8 @@ private:
 class CallExitBegin : public ProgramPoint {
 public:
   // CallExitBegin uses the callee's location context.
-  CallExitBegin(const StackFrameContext *L)
-: ProgramPoint(nullptr, CallExitBeginKind, L, nullptr) {}
+  CallExitBegin(const StackFrameContext *L, const ReturnStmt *RS)
+: ProgramPoint(RS, CallExitBeginKind, L, nullptr) { }
 
 private:
   friend class ProgramPoint;

Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h?rev=283554&r1=283553&r2=283554&view=diff
==
--- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h 
(original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h Fri 
Oct  7 09:21:08 2016
@@ -109,7 +109,8 @@ private:
   CoreEngine(const CoreEngine &) = delete;
   void operator=(const CoreEngine &) = delete;
 
-  ExplodedNode *generateCallExitBeginNode(ExplodedNode *N);
+  ExplodedNode *generateCallExitBeginNode(ExplodedNode *N,
+  const ReturnStmt *RS);
 
 public:
   /// Construct a CoreEngine object to analyze the provided CFG.
@@ -172,7 +173,7 @@ public:
 
   /// \brief enqueue the nodes corresponding to the end of function onto the
   /// end of path / work list.
-  void enqueueEndOfFunction(ExplodedNodeSet &Set);
+  void enqueueEndOfFunction(ExplodedNodeSet &Set, const ReturnStmt *RS);
 
   /// \brief Enqueue a single node created as a result of statement processing.
   void enqueueStmtNode(ExplodedNode *N, const CFGBlock *Block, unsigned Idx);

Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h?rev=283554&r1=283553&r2=283554&view=diff
==
--- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h 
(original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h Fri 
Oct  7 09:21:08 2016
@@ -262,7 +262,8 @@ public:
   /// Called by CoreEngine.  Used to notify checkers that processing a
   /// function has ended. Called for both inlined and and top-level functions.
   void processEndOfFunction(NodeBuilderContext& BC,
-ExplodedNode *Pred) override;
+ExplodedNode *Pred,
+const ReturnStmt *RS=nullptr) override;
 
   /// Remove dead bindings/symbols before exiting a function.
   void removeDeadOnEndOfFunction(NodeBuilderContext& BC,

Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h?rev=283554&r1=283553&r2=283554&view=diff
==
--- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h 
(original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h Fri 
Oct  7 09:21:08 2016
@@ -109,7 +109,8 @@ public:
   /// Called by CoreEngine.  Used to notify checkers that processing a
   /// function has ended. Called for both inlined and and top-level functions.
   virtual void processEndOfFunction(NodeBuilderContext& BC,
-ExplodedNode *Pred) = 0;
+ExplodedNode *Pred,
+const ReturnStmt *RS = nullptr) = 0;
 
   // Genera

[PATCH] D25326: [StaticAnalyser] Don't merge different returns in ExplodedGraph

2016-10-07 Thread Artem Dergachev via cfe-commits
NoQ accepted this revision.
NoQ added a comment.
This revision is now accepted and ready to land.

Yay, this is great. Thanks for investigating all those loss of coverage issues!




Comment at: lib/StaticAnalyzer/Core/CoreEngine.cpp:610
   // Use the callee location context.
-  CallExitBegin Loc(LocCtx);
+  CallExitBegin Loc(LocCtx,RS);
 

Space after ",".



Comment at: lib/StaticAnalyzer/Core/CoreEngine.cpp:639
 if (N->getLocationContext()->getParent()) {
-  N = generateCallExitBeginNode(N);
+  N = generateCallExitBeginNode(N,RS);
   if (N)

Space after ",".



Comment at: lib/StaticAnalyzer/Core/ExprEngine.cpp:1792
 
-  Engine.enqueueEndOfFunction(Dst);
+  Engine.enqueueEndOfFunction(Dst,RS);
 }

Space after ",".


https://reviews.llvm.org/D25326



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


[PATCH] D25369: [clang-move] Better support enclosing class.

2016-10-07 Thread Eric Liu via cfe-commits
ioeric added inline comments.



Comment at: clang-move/ClangMove.cpp:27
 
+AST_MATCHER_P(CXXMethodDecl, ofOutermostEnclosingClass,
+  ast_matchers::internal::Matcher, InnerMatcher) {

I'm not sure if we really need to limit this to the `outer-most` class. In the 
future, we might want to support moving nested class, so I guess this can 
simply be `ofClass`? Not sure if the name is right though.



Comment at: clang-move/ClangMove.cpp:343
   // Match static member variable definition of the moved class.
   Finder->addMatcher(varDecl(InMovedClass, InOldCC, isDefinition())
  .bind("class_static_var_decl"),

What about static variable of the nested class?


https://reviews.llvm.org/D25369



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


Re: [clang-tools-extra] r283534 - Fix buildbot error.

2016-10-07 Thread Renato Golin via cfe-commits
On 7 October 2016 at 13:06, Renato Golin  wrote:
> On 7 October 2016 at 10:23, Haojian Wu via cfe-commits
>  wrote:
>> Author: hokein
>> Date: Fri Oct  7 04:23:28 2016
>> New Revision: 283534
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=283534&view=rev
>> Log:
>> Fix buildbot error.
>>
>> The error maybe caused by the mixed environment of the two lint tests.
>> Cleanup the environment before running each test.
>
> Hi,
>
> Can you revert all changes and test it again on your machine before
> pushing it upstream?
>
> Your changes and reverts are really upsetting all our buildbots and
> making them completely unstable.

Right, your tests were breaking all over the place on ranges that had
nothing to do with your commits, so I reverted on r283553.

Please let me know if you need help with tests before you commit it again.

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


[clang-tools-extra] r283553 - Revert "[clang-move] Support moving multiple classes in one run."

2016-10-07 Thread Renato Golin via cfe-commits
Author: rengolin
Date: Fri Oct  7 08:58:10 2016
New Revision: 283553

URL: http://llvm.org/viewvc/llvm-project?rev=283553&view=rev
Log:
Revert "[clang-move] Support moving multiple classes in one run."

This reverts commit r283526 et al as it keeps randomly breaking bots, even after
the commit has gone, on other people's commit ranges.

Revert "[clang-move] Simplify lint tests" (r283545).
Revert "Fix buildbot error." (r283534).
Revert "Revert "fix buildbot error" since it is not right fix." (r283538).

Added:
clang-tools-extra/trunk/test/clang-move/Inputs/database_template.json
Removed:
clang-tools-extra/trunk/test/clang-move/Inputs/multiple_class_test.cpp
clang-tools-extra/trunk/test/clang-move/Inputs/multiple_class_test.h
clang-tools-extra/trunk/test/clang-move/move-multiple-classes.cpp
Modified:
clang-tools-extra/trunk/clang-move/ClangMove.cpp
clang-tools-extra/trunk/clang-move/ClangMove.h
clang-tools-extra/trunk/clang-move/tool/ClangMoveMain.cpp
clang-tools-extra/trunk/test/clang-move/move-class.cpp
clang-tools-extra/trunk/unittests/clang-move/ClangMoveTests.cpp

Modified: clang-tools-extra/trunk/clang-move/ClangMove.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-move/ClangMove.cpp?rev=283553&r1=283552&r2=283553&view=diff
==
--- clang-tools-extra/trunk/clang-move/ClangMove.cpp (original)
+++ clang-tools-extra/trunk/clang-move/ClangMove.cpp Fri Oct  7 08:58:10 2016
@@ -287,43 +287,31 @@ ClangMoveTool::ClangMoveTool(
 : Spec(MoveSpec), FileToReplacements(FileToReplacements),
   OriginalRunningDirectory(OriginalRunningDirectory),
   FallbackStyle(FallbackStyle) {
+  Spec.Name = llvm::StringRef(Spec.Name).ltrim(':');
   if (!Spec.NewHeader.empty())
 CCIncludes.push_back("#include \"" + Spec.NewHeader + "\"\n");
 }
 
 void ClangMoveTool::registerMatchers(ast_matchers::MatchFinder *Finder) {
-  SmallVector ClassNames;
-  llvm::StringRef(Spec.Names).split(ClassNames, ',');
-  Optional> InMovedClassNames;
-  for (StringRef ClassName : ClassNames) {
-llvm::StringRef GlobalClassName = ClassName.trim().ltrim(':');
-const auto HasName = hasName(("::" + GlobalClassName).str());
-InMovedClassNames =
-InMovedClassNames ? anyOf(*InMovedClassNames, HasName) : HasName;
-  }
-  if (!InMovedClassNames) {
-llvm::errs() << "No classes being moved.\n";
-return;
-  }
-
+  std::string FullyQualifiedName = "::" + Spec.Name;
   auto InOldHeader = isExpansionInFile(
   MakeAbsolutePath(OriginalRunningDirectory, Spec.OldHeader));
   auto InOldCC = isExpansionInFile(
   MakeAbsolutePath(OriginalRunningDirectory, Spec.OldCC));
   auto InOldFiles = anyOf(InOldHeader, InOldCC);
   auto InMovedClass =
-  hasDeclContext(cxxRecordDecl(*InMovedClassNames));
+  hasDeclContext(cxxRecordDecl(hasName(FullyQualifiedName)));
 
   // Match moved class declarations.
   auto MovedClass = cxxRecordDecl(
-  InOldFiles, *InMovedClassNames, isDefinition(),
+  InOldFiles, hasName(FullyQualifiedName), isDefinition(),
   hasDeclContext(anyOf(namespaceDecl(), translationUnitDecl(;
   Finder->addMatcher(MovedClass.bind("moved_class"), this);
 
   // Match moved class methods (static methods included) which are defined
   // outside moved class declaration.
   Finder->addMatcher(cxxMethodDecl(InOldFiles,
-   ofClass(*InMovedClassNames),
+   ofClass(hasName(FullyQualifiedName)),
isDefinition())
  .bind("class_method"),
  this);

Modified: clang-tools-extra/trunk/clang-move/ClangMove.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-move/ClangMove.h?rev=283553&r1=283552&r2=283553&view=diff
==
--- clang-tools-extra/trunk/clang-move/ClangMove.h (original)
+++ clang-tools-extra/trunk/clang-move/ClangMove.h Fri Oct  7 08:58:10 2016
@@ -37,9 +37,8 @@ public:
   };
 
   struct MoveDefinitionSpec {
-// A comma-separated list of fully qualified names, e.g. "Foo",
-// "a::Foo, b::Foo".
-std::string Names;
+// A fully qualified name, e.g. "X", "a::X".
+std::string Name;
 // The file path of old header, can be relative path and absolute path.
 std::string OldHeader;
 // The file path of old cc, can be relative path and absolute path.

Modified: clang-tools-extra/trunk/clang-move/tool/ClangMoveMain.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-move/tool/ClangMoveMain.cpp?rev=283553&r1=283552&r2=283553&view=diff
==
--- clang-tools-extra/trunk/clang-move/tool/ClangMoveMain.cpp (original)
+++ clang-tools-extra/trunk/clang-move/tool/ClangMoveMain.cpp Fri Oct  7 
08:58:10 2016
@@ -37,10 +

[PATCH] D25244: [clang-tidy] Add a whitelist option in google-runtime-references.

2016-10-07 Thread Haojian Wu via cfe-commits
hokein added a comment.

friendly ping. Aaron, could you take a look on this patch?


https://reviews.llvm.org/D25244



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


[PATCH] D25369: [clang-move] Better support enclosing class.

2016-10-07 Thread Haojian Wu via cfe-commits
hokein created this revision.
hokein added a reviewer: ioeric.
hokein added a subscriber: cfe-commits.

- When moving an outermost enclosing class, all its nested classes should also 
be moved together.
- Add a test for not moving nested class.


https://reviews.llvm.org/D25369

Files:
  clang-move/ClangMove.cpp
  test/clang-move/Inputs/multiple_class_test.cpp
  test/clang-move/Inputs/multiple_class_test.h
  test/clang-move/move-multiple-classes.cpp

Index: test/clang-move/move-multiple-classes.cpp
===
--- test/clang-move/move-multiple-classes.cpp
+++ test/clang-move/move-multiple-classes.cpp
@@ -1,12 +1,15 @@
 // RUN: mkdir -p %T/clang-move
 // RUN: cp %S/Inputs/multiple_class_test*  %T/clang-move/
 // RUN: cd %T/clang-move
-// RUN: clang-move -names="a::Move1, b::Move2,c::Move3,c::Move4" -new_cc=%T/clang-move/new_multiple_class_test.cpp -new_header=%T/clang-move/new_multiple_class_test.h -old_cc=%T/clang-move/multiple_class_test.cpp -old_header=../clang-move/multiple_class_test.h %T/clang-move/multiple_class_test.cpp --
+// RUN: clang-move -names="c::EnclosingMove5::Nested" -new_cc=%T/clang-move/new_multiple_class_test.cpp -new_header=%T/clang-move/new_multiple_class_test.h -old_cc=%T/clang-move/multiple_class_test.cpp -old_header=../clang-move/multiple_class_test.h -dump_result %T/clang-move/multiple_class_test.cpp -- | FileCheck %s -check-prefix=CHECK-EMPTY
+// RUN: clang-move -names="a::Move1, b::Move2,c::Move3,c::Move4,c::EnclosingMove5" -new_cc=%T/clang-move/new_multiple_class_test.cpp -new_header=%T/clang-move/new_multiple_class_test.h -old_cc=%T/clang-move/multiple_class_test.cpp -old_header=../clang-move/multiple_class_test.h %T/clang-move/multiple_class_test.cpp --
 // RUN: FileCheck -input-file=%T/clang-move/new_multiple_class_test.cpp -check-prefix=CHECK-NEW-TEST-CPP %s
 // RUN: FileCheck -input-file=%T/clang-move/new_multiple_class_test.h -check-prefix=CHECK-NEW-TEST-H %s
 // RUN: FileCheck -input-file=%T/clang-move/multiple_class_test.cpp -check-prefix=CHECK-OLD-TEST-CPP %s
 // RUN: FileCheck -input-file=%T/clang-move/multiple_class_test.h -check-prefix=CHECK-OLD-TEST-H %s
 //
+// CHECK-EMPTY: [{{[[:space:]]*}}]
+//
 // CHECK-OLD-TEST-H: namespace c {
 // CHECK-OLD-TEST-H: class NoMove {
 // CHECK-OLD-TEST-H: public:
@@ -42,6 +45,12 @@
 // CHECK-NEW-TEST-H: public:
 // CHECK-NEW-TEST-H:   int f();
 // CHECK-NEW-TEST-H: };
+// CHECK-NEW-TEST-H: class EnclosingMove5 {
+// CHECK-NEW-TEST-H: public:
+// CHECK-NEW-TEST-H:   class Nested {
+// CHECK-NEW-TEST-H: int f();
+// CHECK-NEW-TEST-H:   };
+// CHECK-NEW-TEST-H: };
 // CHECK-NEW-TEST-H: } // namespace c
 
 // CHECK-NEW-TEST-CPP: #include "{{.*}}new_multiple_class_test.h"
@@ -54,4 +63,5 @@
 // CHECK-NEW-TEST-CPP: namespace c {
 // CHECK-NEW-TEST-CPP: int Move3::f() { return 0; }
 // CHECK-NEW-TEST-CPP: int Move4::f() { return 0; }
+// CHECK-NEW-TEST-CPP: int EnclosingMove5::Nested::f() { return 0; }
 // CHECK-NEW-TEST-CPP: } // namespace c
Index: test/clang-move/Inputs/multiple_class_test.h
===
--- test/clang-move/Inputs/multiple_class_test.h
+++ test/clang-move/Inputs/multiple_class_test.h
@@ -23,6 +23,13 @@
   int f();
 };
 
+class EnclosingMove5 {
+public:
+  class Nested {
+int f();
+  };
+};
+
 class NoMove {
 public:
   int f();
Index: test/clang-move/Inputs/multiple_class_test.cpp
===
--- test/clang-move/Inputs/multiple_class_test.cpp
+++ test/clang-move/Inputs/multiple_class_test.cpp
@@ -21,6 +21,10 @@
   return 0;
 }
 
+int EnclosingMove5::Nested::f() {
+  return 0;
+}
+
 int NoMove::f() {
   return 0;
 }
Index: clang-move/ClangMove.cpp
===
--- clang-move/ClangMove.cpp
+++ clang-move/ClangMove.cpp
@@ -24,6 +24,17 @@
 namespace move {
 namespace {
 
+AST_MATCHER_P(CXXMethodDecl, ofOutermostEnclosingClass,
+  ast_matchers::internal::Matcher, InnerMatcher) {
+  const CXXRecordDecl *Parent = Node.getParent();
+  while (const auto *NextParent =
+ dyn_cast(Parent->getParent())) {
+Parent = NextParent;
+  }
+
+  return Parent && (InnerMatcher.matches(*Parent, Finder, Builder));
+}
+
 // Make the Path absolute using the CurrentDir if the Path is not an absolute
 // path. An empty Path will result in an empty string.
 std::string MakeAbsolutePath(StringRef CurrentDir, StringRef Path) {
@@ -322,11 +333,11 @@
 
   // Match moved class methods (static methods included) which are defined
   // outside moved class declaration.
-  Finder->addMatcher(cxxMethodDecl(InOldFiles,
-   ofClass(*InMovedClassNames),
-   isDefinition())
- .bind("class_method"),
- this);
+  Finder->addMatcher(
+  cxxMethodDecl(InOldFiles, ofOutermostEnclosingClass(*InMovedClassNa

[PATCH] D25326: [StaticAnalyser] Don't merge different returns in ExplodedGraph

2016-10-07 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki removed rL LLVM as the repository for this revision.
danielmarjamaki updated this revision to Diff 73926.
danielmarjamaki added a comment.

Refactoring.


https://reviews.llvm.org/D25326

Files:
  include/clang/Analysis/ProgramPoint.h
  include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
  include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
  include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h
  lib/StaticAnalyzer/Core/CoreEngine.cpp
  lib/StaticAnalyzer/Core/ExprEngine.cpp
  test/Analysis/inlining/InlineObjCClassMethod.m
  test/Analysis/unreachable-code-path.c

Index: test/Analysis/unreachable-code-path.c
===
--- test/Analysis/unreachable-code-path.c
+++ test/Analysis/unreachable-code-path.c
@@ -194,3 +194,15 @@
 break;
   }
 }
+
+// Don't merge return nodes in ExplodedGraph unless they are same.
+extern int table[];
+static int inlineFunction(const int i) {
+  if (table[i] != 0)
+return 1;
+  return 0;
+}
+void test13(int i) {
+  int x = inlineFunction(i);
+  x && x < 10; // no-warning
+}
Index: test/Analysis/inlining/InlineObjCClassMethod.m
===
--- test/Analysis/inlining/InlineObjCClassMethod.m
+++ test/Analysis/inlining/InlineObjCClassMethod.m
@@ -174,12 +174,12 @@
 @implementation MyClassSelf
 + (int)testClassMethodByKnownVarDecl {
   int y = [MyParentSelf testSelf];
-  return 5/y; // Should warn here.
+  return 5/y; // expected-warning{{Division by zero}}
 }
 @end
 int foo2() {
   int y = [MyParentSelf testSelf];
-  return 5/y; // Should warn here.
+  return 5/y; // expected-warning{{Division by zero}}
 }
 
 // TODO: We do not inline 'getNum' in the following case, where the value of 
Index: lib/StaticAnalyzer/Core/ExprEngine.cpp
===
--- lib/StaticAnalyzer/Core/ExprEngine.cpp
+++ lib/StaticAnalyzer/Core/ExprEngine.cpp
@@ -1766,7 +1766,8 @@
 /// ProcessEndPath - Called by CoreEngine.  Used to generate end-of-path
 ///  nodes when the control reaches the end of a function.
 void ExprEngine::processEndOfFunction(NodeBuilderContext& BC,
-  ExplodedNode *Pred) {
+  ExplodedNode *Pred,
+  const ReturnStmt *RS) {
   // FIXME: Assert that stackFrameDoesNotContainInitializedTemporaries(*Pred)).
   // We currently cannot enable this assert, as lifetime extended temporaries
   // are not modelled correctly.
@@ -1788,7 +1789,7 @@
 getCheckerManager().runCheckersForEndFunction(BC, Dst, Pred, *this);
   }
 
-  Engine.enqueueEndOfFunction(Dst);
+  Engine.enqueueEndOfFunction(Dst,RS);
 }
 
 /// ProcessSwitch - Called by CoreEngine.  Used to generate successor
Index: lib/StaticAnalyzer/Core/CoreEngine.cpp
===
--- lib/StaticAnalyzer/Core/CoreEngine.cpp
+++ lib/StaticAnalyzer/Core/CoreEngine.cpp
@@ -309,8 +309,19 @@
 assert (L.getLocationContext()->getCFG()->getExit().size() == 0
 && "EXIT block cannot contain Stmts.");
 
+// Get return statement..
+const ReturnStmt *RS = nullptr;
+if (!L.getSrc()->empty()) {
+  if (Optional LastStmt = L.getSrc()->back().getAs()) {
+if (RS = dyn_cast(LastStmt->getStmt())) {
+  if (!RS->getRetValue())
+RS = nullptr;
+}
+  }
+}
+
 // Process the final state transition.
-SubEng.processEndOfFunction(BuilderCtx, Pred);
+SubEng.processEndOfFunction(BuilderCtx, Pred, RS);
 
 // This path is done. Don't enqueue any more nodes.
 return;
@@ -589,13 +600,14 @@
 WList->enqueue(Succ, Block, Idx+1);
 }
 
-ExplodedNode *CoreEngine::generateCallExitBeginNode(ExplodedNode *N) {
+ExplodedNode *CoreEngine::generateCallExitBeginNode(ExplodedNode *N,
+const ReturnStmt *RS) {
   // Create a CallExitBegin node and enqueue it.
   const StackFrameContext *LocCtx
  = cast(N->getLocationContext());
 
   // Use the callee location context.
-  CallExitBegin Loc(LocCtx);
+  CallExitBegin Loc(LocCtx,RS);
 
   bool isNew;
   ExplodedNode *Node = G.getNode(Loc, N->getState(), false, &isNew);
@@ -619,12 +631,12 @@
   }
 }
 
-void CoreEngine::enqueueEndOfFunction(ExplodedNodeSet &Set) {
+void CoreEngine::enqueueEndOfFunction(ExplodedNodeSet &Set, const ReturnStmt *RS) {
   for (ExplodedNodeSet::iterator I = Set.begin(), E = Set.end(); I != E; ++I) {
 ExplodedNode *N = *I;
 // If we are in an inlined call, generate CallExitBegin node.
 if (N->getLocationContext()->getParent()) {
-  N = generateCallExitBeginNode(N);
+  N = generateCallExitBeginNode(N,RS);
   if (N)
 WList->enqueue(N);
 } else {
Index: include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h

r283549 - Wdocumentation fix

2016-10-07 Thread Simon Pilgrim via cfe-commits
Author: rksimon
Date: Fri Oct  7 08:25:41 2016
New Revision: 283549

URL: http://llvm.org/viewvc/llvm-project?rev=283549&view=rev
Log:
Wdocumentation fix

Modified:
cfe/trunk/include/clang/Sema/Sema.h

Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=283549&r1=283548&r2=283549&view=diff
==
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Fri Oct  7 08:25:41 2016
@@ -8837,16 +8837,16 @@ public:
 
   /// Check assignment constraints for an assignment of RHS to LHSType.
   ///
-  /// \brief LHSType The destination type for the assignment.
-  /// \brief RHS The source expression for the assignment.
-  /// \brief Diagnose If \c true, diagnostics may be produced when checking
+  /// \param LHSType The destination type for the assignment.
+  /// \param RHS The source expression for the assignment.
+  /// \param Diagnose If \c true, diagnostics may be produced when checking
   ///for assignability. If a diagnostic is produced, \p RHS will be
   ///set to ExprError(). Note that this function may still return
   ///without producing a diagnostic, even for an invalid assignment.
-  /// \brief DiagnoseCFAudited If \c true, the target is a function parameter
+  /// \param DiagnoseCFAudited If \c true, the target is a function parameter
   ///in an audited Core Foundation API and does not need to be checked
   ///for ARC retain issues.
-  /// \brief ConvertRHS If \c true, \p RHS will be updated to model the
+  /// \param ConvertRHS If \c true, \p RHS will be updated to model the
   ///conversions necessary to perform the assignment. If \c false,
   ///\p Diagnose must also be \c false.
   AssignConvertType CheckSingleAssignmentConstraints(


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


[clang-tools-extra] r283545 - [clang-move] Simplify lint tests

2016-10-07 Thread Haojian Wu via cfe-commits
Author: hokein
Date: Fri Oct  7 07:35:37 2016
New Revision: 283545

URL: http://llvm.org/viewvc/llvm-project?rev=283545&view=rev
Log:
[clang-move] Simplify lint tests

No need to use compilation database.

Removed:
clang-tools-extra/trunk/test/clang-move/Inputs/database_template.json
Modified:
clang-tools-extra/trunk/test/clang-move/move-class.cpp
clang-tools-extra/trunk/test/clang-move/move-multiple-classes.cpp

Removed: clang-tools-extra/trunk/test/clang-move/Inputs/database_template.json
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-move/Inputs/database_template.json?rev=283544&view=auto
==
--- clang-tools-extra/trunk/test/clang-move/Inputs/database_template.json 
(original)
+++ clang-tools-extra/trunk/test/clang-move/Inputs/database_template.json 
(removed)
@@ -1,12 +0,0 @@
-[
-{
-  "directory": "$test_dir/build",
-  "command": "clang++ -o test.o $test_dir/test.cpp",
-  "file": "$test_dir/test.cpp"
-},
-{
-  "directory": "$test_dir/build",
-  "command": "clang++ -o test.o $test_dir/multiple_class_test.cpp",
-  "file": "$test_dir/multiple_class_test.cpp"
-}
-]

Modified: clang-tools-extra/trunk/test/clang-move/move-class.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-move/move-class.cpp?rev=283545&r1=283544&r2=283545&view=diff
==
--- clang-tools-extra/trunk/test/clang-move/move-class.cpp (original)
+++ clang-tools-extra/trunk/test/clang-move/move-class.cpp Fri Oct  7 07:35:37 
2016
@@ -1,9 +1,8 @@
-// RUN: mkdir -p %T/clang-move/build
-// RUN: sed 's|$test_dir|%/T/clang-move|g' %S/Inputs/database_template.json > 
%T/clang-move/compile_commands.json
+// RUN: mkdir -p %T/clang-move
 // RUN: cp %S/Inputs/test*  %T/clang-move/
 // RUN: touch %T/clang-move/test2.h
 // RUN: cd %T/clang-move
-// RUN: clang-move -names="a::Foo" -new_cc=%T/clang-move/new_test.cpp 
-new_header=%T/clang-move/new_test.h -old_cc=../clang-move/test.cpp 
-old_header=../clang-move/test.h %T/clang-move/test.cpp
+// RUN: clang-move -names="a::Foo" -new_cc=%T/clang-move/new_test.cpp 
-new_header=%T/clang-move/new_test.h -old_cc=../clang-move/test.cpp 
-old_header=../clang-move/test.h %T/clang-move/test.cpp --
 // RUN: FileCheck -input-file=%T/clang-move/new_test.cpp 
-check-prefix=CHECK-NEW-TEST-CPP %s
 // RUN: FileCheck -input-file=%T/clang-move/new_test.h 
-check-prefix=CHECK-NEW-TEST-H %s
 // RUN: FileCheck -input-file=%T/clang-move/test.cpp 
-check-prefix=CHECK-OLD-TEST-CPP %s
@@ -11,7 +10,7 @@
 //
 // RUN: cp %S/Inputs/test*  %T/clang-move/
 // RUN: cd %T/clang-move
-// RUN: clang-move -names="a::Foo" -new_cc=%T/clang-move/new_test.cpp 
-new_header=%T/clang-move/new_test.h -old_cc=%T/clang-move/test.cpp 
-old_header=%T/clang-move/test.h %T/clang-move/test.cpp
+// RUN: clang-move -names="a::Foo" -new_cc=%T/clang-move/new_test.cpp 
-new_header=%T/clang-move/new_test.h -old_cc=%T/clang-move/test.cpp 
-old_header=%T/clang-move/test.h %T/clang-move/test.cpp --
 // RUN: FileCheck -input-file=%T/clang-move/new_test.cpp 
-check-prefix=CHECK-NEW-TEST-CPP %s
 // RUN: FileCheck -input-file=%T/clang-move/new_test.h 
-check-prefix=CHECK-NEW-TEST-H %s
 // RUN: FileCheck -input-file=%T/clang-move/test.cpp 
-check-prefix=CHECK-OLD-TEST-CPP %s

Modified: clang-tools-extra/trunk/test/clang-move/move-multiple-classes.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-move/move-multiple-classes.cpp?rev=283545&r1=283544&r2=283545&view=diff
==
--- clang-tools-extra/trunk/test/clang-move/move-multiple-classes.cpp (original)
+++ clang-tools-extra/trunk/test/clang-move/move-multiple-classes.cpp Fri Oct  
7 07:35:37 2016
@@ -1,8 +1,7 @@
-// RUN: mkdir -p %T/clang-move/build
-// RUN: sed 's|$test_dir|%/T/clang-move|g' %S/Inputs/database_template.json > 
%T/clang-move/compile_commands.json
+// RUN: mkdir -p %T/clang-move
 // RUN: cp %S/Inputs/multiple_class_test*  %T/clang-move/
 // RUN: cd %T/clang-move
-// RUN: clang-move -names="a::Move1, b::Move2,c::Move3,c::Move4" 
-new_cc=%T/clang-move/new_multiple_class_test.cpp 
-new_header=%T/clang-move/new_multiple_class_test.h 
-old_cc=%T/clang-move/multiple_class_test.cpp 
-old_header=../clang-move/multiple_class_test.h 
%T/clang-move/multiple_class_test.cpp
+// RUN: clang-move -names="a::Move1, b::Move2,c::Move3,c::Move4" 
-new_cc=%T/clang-move/new_multiple_class_test.cpp 
-new_header=%T/clang-move/new_multiple_class_test.h 
-old_cc=%T/clang-move/multiple_class_test.cpp 
-old_header=../clang-move/multiple_class_test.h 
%T/clang-move/multiple_class_test.cpp --
 // RUN: FileCheck -input-file=%T/clang-move/new_multiple_class_test.cpp 
-check-prefix=CHECK-NEW-TEST-CPP %s
 // RUN: FileCheck -input-file=%T/clang-move/new_multiple_class_test.h 
-check-prefix=CHECK-NEW-TEST-H %s
 // RUN: FileCh

r283543 - [ARM]: Add Cortex-R52 target

2016-10-07 Thread Javed Absar via cfe-commits
Author: javed.absar
Date: Fri Oct  7 07:08:41 2016
New Revision: 283543

URL: http://llvm.org/viewvc/llvm-project?rev=283543&view=rev
Log:
[ARM]: Add Cortex-R52 target

This patch adds Cortex-R52, the new ARM real-time processor.
Cortex-R52 implements the ARMv8-R architecture.


Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/test/Driver/arm-cortex-cpus.c
cfe/trunk/test/Preprocessor/arm-target-features.c

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=283543&r1=283542&r2=283543&view=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Fri Oct  7 07:08:41 2016
@@ -4929,6 +4929,8 @@ class ARMTargetInfo : public TargetInfo
   return "8M_BASE";
 case llvm::ARM::AK_ARMV8MMainline:
   return "8M_MAIN";
+case llvm::ARM::AK_ARMV8R:
+  return "8R";
 }
   }
 

Modified: cfe/trunk/test/Driver/arm-cortex-cpus.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/arm-cortex-cpus.c?rev=283543&r1=283542&r2=283543&view=diff
==
--- cfe/trunk/test/Driver/arm-cortex-cpus.c (original)
+++ cfe/trunk/test/Driver/arm-cortex-cpus.c Fri Oct  7 07:08:41 2016
@@ -146,6 +146,27 @@
 // RUN: %clang -target arm -mlittle-endian -march=armv8-a -mlittle-endian -### 
-c %s 2>&1 | FileCheck -check-prefix=CHECK-V8A %s
 // CHECK-V8A: "-cc1"{{.*}} "-triple" "armv8-{{.*}}" "-target-cpu" "cortex-a53"
 
+// RUN: %clang -target armv8r-linux-gnueabi -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-V8R %s
+// RUN: %clang -target arm -march=armv8r -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-V8R %s
+// RUN: %clang -target arm -march=armv8-r -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-V8R %s
+// CHECK-V8R: "-cc1"{{.*}} "-triple" "armv8r-{{.*}} "-target-cpu" "cortex-r52"
+
+// RUN: %clang -target armv8r-linux-gnueabi -mbig-endian -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-V8R-BIG %s
+// RUN: %clang -target arm -march=armv8r -mbig-endian -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-V8R-BIG %s
+// RUN: %clang -target arm -march=armv8-r -mbig-endian -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-V8R-BIG %s
+// CHECK-V8R-BIG: "-cc1"{{.*}} "-triple" "armebv8r-{{.*}} "-target-cpu" 
"cortex-r52"
+
+// RUN: %clang -target armv8r-linux-gnueabi -mthumb -### -c %s 2>&1 | \
+// RUN: FileCheck -check-prefix=CHECK-V8R-THUMB %s
+// RUN: %clang -target arm -march=armv8r -mthumb -### -c %s 2>&1 | \
+// RUN: FileCheck -check-prefix=CHECK-V8R-THUMB %s
+// CHECK-V8R-THUMB: "-cc1"{{.*}} "-triple" "thumbv8r-{{.*}} "-target-cpu" 
"cortex-r52"
+// RUN: %clang -target armv8r-linux-gnueabi -mthumb -mbig-endian -### -c %s 
2>&1 | \
+// RUN: FileCheck -check-prefix=CHECK-V8R-THUMB-BIG %s
+// RUN: %clang -target arm -march=armv8r -mthumb -mbig-endian -### -c %s 2>&1 
| \
+// RUN: FileCheck -check-prefix=CHECK-V8R-THUMB-BIG %s
+// CHECK-V8R-THUMB-BIG: "-cc1"{{.*}} "-triple" "thumbebv8r-{{.*}} "-target-cpu
+
 // RUN: %clang -mcpu=generic -target armv8 -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-V8A-GENERIC %s
 // RUN: %clang -mcpu=generic -target arm -march=armv8 -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-V8A-GENERIC %s
 // RUN: %clang -mcpu=generic -target armv8a -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-V8A-GENERIC %s
@@ -502,6 +523,9 @@
 // RUN: %clang -target arm -mcpu=exynos-m2 -mbig-endian -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-BE-CPUV8A %s
 // CHECK-BE-CPUV8A: "-cc1"{{.*}} "-triple" "armebv8-{{.*}}
 
+// RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-r52 -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-CPUV8R %s
+// CHECK-CPUV8R: "-cc1"{{.*}} "-triple" "armv8r-{{.*}}
+
 // RUN: %clang -target arm -mcpu=cortex-a32 -mthumb -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-CPUV8A-THUMB %s
 // RUN: %clang -target arm -mcpu=cortex-a35 -mthumb -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-CPUV8A-THUMB %s
 // RUN: %clang -target arm -mcpu=cortex-a53 -mthumb -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-CPUV8A-THUMB %s

Modified: cfe/trunk/test/Preprocessor/arm-target-features.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/arm-target-features.c?rev=283543&r1=283542&r2=283543&view=diff
==
--- cfe/trunk/test/Preprocessor/arm-target-features.c (original)
+++ cfe/trunk/test/Preprocessor/arm-target-features.c Fri Oct  7 07:08:41 2016
@@ -9,6 +9,15 @@
 // CHECK-V8A: #define __ARM_FP16_ARGS 1
 // CHECK-V8A: #define __ARM_FP16_FORMAT_IEEE 1
 
+// RUN: %clang -target armv8r-none-linux-gnu -x c -E -dM %s -o - | FileCheck 
-match-full-lines --check-prefix=CHECK-V8R %s
+// CHECK-V8R: #define __ARMEL__ 1
+// CHECK-V8R: #define __ARM_ARCH 8
+// CHECK-V8R: #define __ARM_ARCH_8R__ 1
+// CHECK-V8R: #define __ARM_FEATURE_

Re: [clang-tools-extra] r283534 - Fix buildbot error.

2016-10-07 Thread Renato Golin via cfe-commits
On 7 October 2016 at 10:23, Haojian Wu via cfe-commits
 wrote:
> Author: hokein
> Date: Fri Oct  7 04:23:28 2016
> New Revision: 283534
>
> URL: http://llvm.org/viewvc/llvm-project?rev=283534&view=rev
> Log:
> Fix buildbot error.
>
> The error maybe caused by the mixed environment of the two lint tests.
> Cleanup the environment before running each test.

Hi,

Can you revert all changes and test it again on your machine before
pushing it upstream?

Your changes and reverts are really upsetting all our buildbots and
making them completely unstable.

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


  1   2   >