Re: [PATCH] D12081: Add use-nullptr check to clang-tidy.

2015-08-19 Thread Angel Garcia via cfe-commits
angelgarcia updated this revision to Diff 32539.
angelgarcia marked 13 inline comments as done.
angelgarcia added a comment.

Fix comments.


http://reviews.llvm.org/D12081

Files:
  clang-tidy/modernize/CMakeLists.txt
  clang-tidy/modernize/ModernizeTidyModule.cpp
  clang-tidy/modernize/UseNullptrCheck.cpp
  clang-tidy/modernize/UseNullptrCheck.h
  test/clang-tidy/modernize-use-nullptr-basic.cpp
  test/clang-tidy/modernize-use-nullptr.cpp

Index: test/clang-tidy/modernize-use-nullptr.cpp
===
--- test/clang-tidy/modernize-use-nullptr.cpp
+++ test/clang-tidy/modernize-use-nullptr.cpp
@@ -0,0 +1,178 @@
+// RUN: $(dirname %s)/check_clang_tidy.sh %s modernize-use-nullptr %t \
+// RUN:   -config={CheckOptions: [{key: modernize-use-nullptr.UserNullMacros, value: 'MY_NULL'}]} \
+// RUN:   -- -std=c++11
+// REQUIRES: shell
+
+#define NULL 0
+
+namespace std {
+
+typedef decltype(nullptr) nullptr_t;
+
+} // namespace std
+
+// Just to make sure make_null() could have side effects.
+void external();
+
+std::nullptr_t make_null() {
+  external();
+  return nullptr;
+}
+
+void func() {
+  void *CallTest = make_null();
+
+  int var = 1;
+  void *CommaTest = (var+=2, make_null());
+
+  int *CastTest = static_castint*(make_null());
+}
+
+void dummy(int*) {}
+void side_effect() {}
+
+#define MACRO_EXPANSION_HAS_NULL \
+  void foo() { \
+dummy(0); \
+dummy(NULL); \
+side_effect(); \
+  }
+
+MACRO_EXPANSION_HAS_NULL;
+#undef MACRO_EXPANSION_HAS_NULL
+
+
+void test_macro_expansion1() {
+#define MACRO_EXPANSION_HAS_NULL \
+  dummy(NULL); \
+  side_effect();
+
+  MACRO_EXPANSION_HAS_NULL;
+
+#undef MACRO_EXPANSION_HAS_NULL
+}
+
+// Test macro expansion with cast sequence, PR15572.
+void test_macro_expansion2() {
+#define MACRO_EXPANSION_HAS_NULL \
+  dummy((int*)0); \
+  side_effect();
+
+  MACRO_EXPANSION_HAS_NULL;
+
+#undef MACRO_EXPANSION_HAS_NULL
+}
+
+void test_macro_expansion3() {
+#define MACRO_EXPANSION_HAS_NULL \
+  dummy(NULL); \
+  side_effect();
+
+#define OUTER_MACRO \
+  MACRO_EXPANSION_HAS_NULL; \
+  side_effect();
+
+  OUTER_MACRO;
+
+#undef OUTER_MACRO
+#undef MACRO_EXPANSION_HAS_NULL
+}
+
+void test_macro_expansion4() {
+#define MY_NULL NULL
+  int *p = MY_NULL;
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: use nullptr [modernize-use-nullptr]
+  // CHECK-FIXES: int *p = nullptr;
+#undef MY_NULL
+}
+
+#define IS_EQ(x, y) if (x != y) return;
+void test_macro_args() {
+  int i = 0;
+  int *Ptr;
+
+  IS_EQ(static_castint*(0), Ptr);
+  // CHECK-MESSAGES: :[[@LINE-1]]:27: warning: use nullptr
+  // CHECK-FIXES: IS_EQ(static_castint*(nullptr), Ptr);
+
+  IS_EQ(0, Ptr);// literal
+  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: use nullptr
+  // CHECK-FIXES: IS_EQ(nullptr, Ptr);
+
+  IS_EQ(NULL, Ptr); // macro
+  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: use nullptr
+  // CHECK-FIXES: IS_EQ(nullptr, Ptr);
+
+  // These are ok since the null literal is not spelled within a macro.
+#define myassert(x) if (!(x)) return;
+  myassert(0 == Ptr);
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: use nullptr
+  // CHECK-FIXES: myassert(nullptr == Ptr);
+
+  myassert(NULL == Ptr);
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: use nullptr
+  // CHECK-FIXES: myassert(nullptr == Ptr);
+
+  // These are bad as the null literal is buried in a macro.
+#define BLAH(X) myassert(0 == (X));
+#define BLAH2(X) myassert(NULL == (X));
+  BLAH(Ptr);
+  BLAH2(Ptr);
+
+  // Same as above but testing extra macro expansion.
+#define EXPECT_NULL(X) IS_EQ(0, X);
+#define EXPECT_NULL2(X) IS_EQ(NULL, X);
+  EXPECT_NULL(Ptr);
+  EXPECT_NULL2(Ptr);
+
+  // Almost the same as above but now null literal is not in a macro so ok
+  // to transform.
+#define EQUALS_PTR(X) IS_EQ(X, Ptr);
+  EQUALS_PTR(0);
+  // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: use nullptr
+  // CHECK-FIXES: EQUALS_PTR(nullptr);
+  EQUALS_PTR(NULL);
+  // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: use nullptr
+  // CHECK-FIXES: EQUALS_PTR(nullptr);
+
+  // Same as above but testing extra macro expansion.
+#define EQUALS_PTR_I(X) EQUALS_PTR(X)
+  EQUALS_PTR_I(0);
+  // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: use nullptr
+  // CHECK-FIXES: EQUALS_PTR_I(nullptr);
+  EQUALS_PTR_I(NULL);
+  // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: use nullptr
+  // CHECK-FIXES: EQUALS_PTR_I(nullptr);
+
+  // Ok since null literal not within macro. However, now testing macro
+  // used as arg to another macro.
+#define decorate(EXPR) side_effect(); EXPR;
+  decorate(IS_EQ(NULL, Ptr));
+  // CHECK-MESSAGES: :[[@LINE-1]]:18: warning: use nullptr
+  // CHECK-FIXES: decorate(IS_EQ(nullptr, Ptr));
+  decorate(IS_EQ(0, Ptr));
+  // CHECK-MESSAGES: :[[@LINE-1]]:18: warning: use nullptr
+  // CHECK-FIXES: decorate(IS_EQ(nullptr, Ptr));
+
+  // This macro causes a NullToPointer cast to happen where 0 is assigned to z
+  // but the 0 literal cannot be replaced because it is also used as an
+  // integer in the comparison.

[PATCH] D12148: [ARM] Allow passing/returning of __fp16 arguments

2015-08-19 Thread Oliver Stannard via cfe-commits
olista01 created this revision.
olista01 added a subscriber: cfe-commits.
olista01 set the repository for this revision to rL LLVM.
Herald added subscribers: rengolin, aemerson.

The ACLE (ARM C Language Extensions) 2.0 allows the __fp16 type to be
used as a functon argument or return type (ACLE 1.1 did not).

The current public release of the AAPCS (2.09) states that __fp16 values
should be converted to single-precision before being passed or returned,
but AAPCS 2.10 (to be released shortly) changes this, so that they are
passed in the least-significant 16 bits of either a GPR (for base AAPCS)
or a single-precision register (for AAPCS-VFP). This does not change how
arguments are passed if they get passed on the stack.

This patch brings clang up to compliance with the latest versions of
both of these specs.

We can now set the __ARM_FP16_ARGS ACLE predefine, and we have always
been able to set the __ARM_FP16_FORMAT_IEEE predefine (we do not support
the alternative format).

Repository:
  rL LLVM

http://reviews.llvm.org/D12148

Files:
  lib/Basic/Targets.cpp
  lib/CodeGen/TargetInfo.cpp
  lib/Driver/Tools.cpp
  test/CodeGen/arm-fp16-arguments.c
  test/Preprocessor/arm-acle-6.5.c
  test/Preprocessor/arm-target-features.c

Index: test/Preprocessor/arm-target-features.c
===
--- test/Preprocessor/arm-target-features.c
+++ test/Preprocessor/arm-target-features.c
@@ -5,6 +5,8 @@
 // CHECK: __ARM_FEATURE_CRC32 1
 // CHECK: __ARM_FEATURE_DIRECTED_ROUNDING 1
 // CHECK: __ARM_FEATURE_NUMERIC_MAXMIN 1
+// CHECK: __ARM_FP16_ARGS 1
+// CHECK: __ARM_FP16_FORMAT_IEEE 1
 
 // RUN: %clang -target armv7a-none-linux-gnu -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-V7 %s
 // CHECK-V7: __ARMEL__ 1
Index: test/Preprocessor/arm-acle-6.5.c
===
--- test/Preprocessor/arm-acle-6.5.c
+++ test/Preprocessor/arm-acle-6.5.c
@@ -1,6 +1,6 @@
 // RUN: %clang -target arm-eabi -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-DEFAULT
 
-// CHECK-DEFAULT-NOT: __ARM_FP
+// CHECK-DEFAULT-NOT: __ARM_FP 0x
 
 // RUN: %clang -target arm-eabi -mfpu=vfp -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-SP-DP
 // RUN: %clang -target arm-eabi -mfpu=vfp3 -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-SP-DP
Index: test/CodeGen/arm-fp16-arguments.c
===
--- /dev/null
+++ test/CodeGen/arm-fp16-arguments.c
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 -triple armv7a--none-eabi -target-abi aapcs -mfloat-abi soft -fallow-half-arguments-and-returns -emit-llvm -o - -O1 %s | FileCheck %s --check-prefix=CHECK --check-prefix=SOFT
+// RUN: %clang_cc1 -triple armv7a--none-eabi -target-abi aapcs -mfloat-abi hard -fallow-half-arguments-and-returns -emit-llvm -o - -O1 %s | FileCheck %s --check-prefix=CHECK --check-prefix=HARD
+
+__fp16 g;
+
+void t1(__fp16 a) { g = a; }
+// SOFT: define void @t1(i32 [[PARAM:%.*]])
+// SOFT: [[TRUNC:%.*]] = trunc i32 [[PARAM]] to i16
+// HARD: define arm_aapcs_vfpcc void @t1(float [[PARAM:%.*]])
+// HARD: [[BITCAST:%.*]] = bitcast float [[PARAM]] to i32
+// HARD: [[TRUNC:%.*]] = trunc i32 [[BITCAST]] to i16
+// CHECK: store i16 [[TRUNC]], i16* bitcast (half* @g to i16*)
+
+__fp16 t2() { return g; }
+// SOFT: define i32 @t2()
+// HARD: define arm_aapcs_vfpcc float @t2()
+// CHECK: [[LOAD:%.*]] = load i16, i16* bitcast (half* @g to i16*)
+// CHECK: [[ZEXT:%.*]] = zext i16 [[LOAD]] to i32
+// SOFT: ret i32 [[ZEXT]]
+// HARD: [[BITCAST:%.*]] = bitcast i32 [[ZEXT]] to float
+// HARD: ret float [[BITCAST]]
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -4251,7 +4251,11 @@
   }
 
   if (getToolChain().getArch() == llvm::Triple::aarch64 ||
-  getToolChain().getArch() == llvm::Triple::aarch64_be)
+  getToolChain().getArch() == llvm::Triple::aarch64_be ||
+  getToolChain().getArch() == llvm::Triple::arm ||
+  getToolChain().getArch() == llvm::Triple::armeb ||
+  getToolChain().getArch() == llvm::Triple::thumb ||
+  getToolChain().getArch() == llvm::Triple::thumbeb)
 CmdArgs.push_back(-fallow-half-arguments-and-returns);
 
   if (Arg *A = Args.getLastArg(options::OPT_mrestrict_it,
Index: lib/CodeGen/TargetInfo.cpp
===
--- lib/CodeGen/TargetInfo.cpp
+++ lib/CodeGen/TargetInfo.cpp
@@ -4714,6 +4714,15 @@
 return ABIArgInfo::getIndirect(0, /*ByVal=*/false);
   }
 
+  // __fp16 gets passed as if it were an int or float, but with the top 32 bits
+  // unspecified.
+  if (Ty-isHalfType()) {
+llvm::Type *ResType = IsEffectivelyAAPCS_VFP ?
+  llvm::Type::getFloatTy(getVMContext()) :
+  llvm::Type::getInt32Ty(getVMContext());
+return ABIArgInfo::getDirect(ResType);
+  }
+
   if (!isAggregateTypeForABI(Ty)) {
 // Treat an enum type as its 

[PATCH] D12152: [OPENMP] Info about OpenMP Support in Users Manual

2015-08-19 Thread Alexey Bataev via cfe-commits
ABataev created this revision.
ABataev added reviewers: hans, fraggamuffin, ejstotzer, hfinkel.
ABataev added a subscriber: cfe-commits.

http://reviews.llvm.org/D12152

Files:
  docs/UsersManual.rst

Index: docs/UsersManual.rst
===
--- docs/UsersManual.rst
+++ docs/UsersManual.rst
@@ -1852,6 +1852,32 @@
 Objective-C++ Language Features
 ===
 
+.. _openmp:
+
+OpenMP Features
+===
+
+clang fully implements all of standard OpenMP 3.1 directives and clauses + some
+features of OpenMP 4.0, including ``#pragma omp simd``,
+``#pragma omp for simd``, ``#pragma omp parallel for simd`` directives, 
extended
+set of atomic constructs, ``proc_bind`` clause for all parallel-based
+directives, ``depend`` clause for ``#pragma omp task`` directive (except for
+array sections), ``#pragma omp cancel`` and ``#pragma omp cancellation point``
+directives, and ``#pragma omp taskgroup`` directive.
+
+OpenMP support is disabled by default. Use option::`-fopenmp=libomp` to enable
+it. Support for OpenMP can be disabled with :option:`-fno-openmp`.
+
+Controlling implementation limits
+-
+
+.. option:: -fopenmp-use-tls
+
+ Controls code generation for OpenMP threadprivate variables. In presence of
+ this options all threadprivate variables are generated the same way as thread
+ local variables, using TLS support. If :option:`-fno-openmp-use-tls`
+ is provided or target does not support TLS, code generation for threadprivate
+ variables relies on OpenMP runtime library.
 
 .. _target_features:
 


Index: docs/UsersManual.rst
===
--- docs/UsersManual.rst
+++ docs/UsersManual.rst
@@ -1852,6 +1852,32 @@
 Objective-C++ Language Features
 ===
 
+.. _openmp:
+
+OpenMP Features
+===
+
+clang fully implements all of standard OpenMP 3.1 directives and clauses + some
+features of OpenMP 4.0, including ``#pragma omp simd``,
+``#pragma omp for simd``, ``#pragma omp parallel for simd`` directives, extended
+set of atomic constructs, ``proc_bind`` clause for all parallel-based
+directives, ``depend`` clause for ``#pragma omp task`` directive (except for
+array sections), ``#pragma omp cancel`` and ``#pragma omp cancellation point``
+directives, and ``#pragma omp taskgroup`` directive.
+
+OpenMP support is disabled by default. Use option::`-fopenmp=libomp` to enable
+it. Support for OpenMP can be disabled with :option:`-fno-openmp`.
+
+Controlling implementation limits
+-
+
+.. option:: -fopenmp-use-tls
+
+ Controls code generation for OpenMP threadprivate variables. In presence of
+ this options all threadprivate variables are generated the same way as thread
+ local variables, using TLS support. If :option:`-fno-openmp-use-tls`
+ is provided or target does not support TLS, code generation for threadprivate
+ variables relies on OpenMP runtime library.
 
 .. _target_features:
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12081: Add use-nullptr check to clang-tidy.

2015-08-19 Thread Alexander Kornienko via cfe-commits
alexfh closed this revision.
alexfh added a comment.

Committed revision 245434.


http://reviews.llvm.org/D12081



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


[clang-tools-extra] r245434 - [clang-tidy] Add use-nullptr check to clang-tidy.

2015-08-19 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Wed Aug 19 08:13:12 2015
New Revision: 245434

URL: http://llvm.org/viewvc/llvm-project?rev=245434view=rev
Log:
[clang-tidy] Add use-nullptr check to clang-tidy.

Move UseNullptr from clang-modernize to modernize module in clang-tidy.

http://reviews.llvm.org/D12081

Patch by Angel Garcia!

Added:
clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp
clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.h
clang-tools-extra/trunk/test/clang-tidy/modernize-use-nullptr-basic.cpp
clang-tools-extra/trunk/test/clang-tidy/modernize-use-nullptr.cpp
Modified:
clang-tools-extra/trunk/clang-tidy/modernize/CMakeLists.txt
clang-tools-extra/trunk/clang-tidy/modernize/ModernizeTidyModule.cpp

Modified: clang-tools-extra/trunk/clang-tidy/modernize/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/CMakeLists.txt?rev=245434r1=245433r2=245434view=diff
==
--- clang-tools-extra/trunk/clang-tidy/modernize/CMakeLists.txt (original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/CMakeLists.txt Wed Aug 19 
08:13:12 2015
@@ -5,6 +5,7 @@ add_clang_library(clangTidyModernizeModu
   LoopConvertUtils.cpp
   ModernizeTidyModule.cpp
   PassByValueCheck.cpp
+  UseNullptrCheck.cpp
 
   LINK_LIBS
   clangAST

Modified: clang-tools-extra/trunk/clang-tidy/modernize/ModernizeTidyModule.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/ModernizeTidyModule.cpp?rev=245434r1=245433r2=245434view=diff
==
--- clang-tools-extra/trunk/clang-tidy/modernize/ModernizeTidyModule.cpp 
(original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/ModernizeTidyModule.cpp Wed 
Aug 19 08:13:12 2015
@@ -12,6 +12,7 @@
 #include ../ClangTidyModuleRegistry.h
 #include LoopConvertCheck.h
 #include PassByValueCheck.h
+#include UseNullptrCheck.h
 
 using namespace clang::ast_matchers;
 
@@ -24,6 +25,7 @@ public:
   void addCheckFactories(ClangTidyCheckFactories CheckFactories) override {
 CheckFactories.registerCheckLoopConvertCheck(modernize-loop-convert);
 CheckFactories.registerCheckPassByValueCheck(modernize-pass-by-value);
+CheckFactories.registerCheckUseNullptrCheck(modernize-use-nullptr);
   }
 
   ClangTidyOptions getModuleOptions() override {
@@ -31,6 +33,9 @@ public:
 auto Opts = Options.CheckOptions;
 Opts[modernize-loop-convert.MinConfidence] = reasonable;
 Opts[modernize-pass-by-value.IncludeStyle] = llvm; // Also: google.
+
+// Comma-separated list of user-defined macros that behave like NULL.
+Opts[modernize-use-nullptr.UserNullMacros] = ;
 return Options;
   }
 };

Added: clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp?rev=245434view=auto
==
--- clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp (added)
+++ clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp Wed Aug 19 
08:13:12 2015
@@ -0,0 +1,472 @@
+//===--- UseNullptrCheck.cpp - 
clang-tidy--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include UseNullptrCheck.h
+#include clang/AST/ASTContext.h
+#include clang/AST/RecursiveASTVisitor.h
+#include clang/ASTMatchers/ASTMatchFinder.h
+#include clang/Lex/Lexer.h
+
+using namespace clang;
+using namespace clang::ast_matchers;
+using namespace llvm;
+
+namespace clang {
+namespace tidy {
+namespace modernize {
+
+const char CastSequence[] = sequence;
+const char NullMacroName[] = NULL;
+
+/// \brief Matches cast expressions that have a cast kind of CK_NullToPointer
+/// or CK_NullToMemberPointer.
+///
+/// Given
+/// \code
+///   int *p = 0;
+/// \endcode
+/// implicitCastExpr(isNullToPointer()) matches the implicit cast clang adds
+/// around \c 0.
+AST_MATCHER(CastExpr, isNullToPointer) {
+  return Node.getCastKind() == CK_NullToPointer ||
+ Node.getCastKind() == CK_NullToMemberPointer;
+}
+
+AST_MATCHER(Type, sugaredNullptrType) {
+  const Type *DesugaredType = Node.getUnqualifiedDesugaredType();
+  if (const BuiltinType *BT = dyn_castBuiltinType(DesugaredType))
+return BT-getKind() == BuiltinType::NullPtr;
+  return false;
+}
+
+/// \brief Create a matcher that finds implicit casts as well as the head of a
+/// sequence of zero or more nested explicit casts that have an implicit cast
+/// to null within.
+/// Finding sequences of explict casts is necessary so that an entire sequence
+/// can be replaced instead of just 

[PATCH] D12147: Fix typos in lib/AST

2015-08-19 Thread Kai Zhao via cfe-commits
loverszhaokai created this revision.
loverszhaokai added reviewers: gbenyei, krememek, rsmith, ABataev, majnemer.
loverszhaokai added a subscriber: cfe-commits.

Fix typos:

modeled -   modelled
protcol-   protocol
overriden-   overridden
endianess  -endianness 
unmodeled -   unmodelled
Intialize   -   Initialize

http://reviews.llvm.org/D12147

Files:
  lib/AST/ASTContext.cpp
  lib/AST/DeclObjC.cpp
  lib/AST/Expr.cpp
  lib/AST/ExprConstant.cpp
  lib/AST/Stmt.cpp
  lib/AST/VTableBuilder.cpp

Index: lib/AST/VTableBuilder.cpp
===
--- lib/AST/VTableBuilder.cpp
+++ lib/AST/VTableBuilder.cpp
@@ -3013,7 +3013,7 @@
   }
 
   // In case we need a return adjustment, we'll add a new slot for
-  // the overrider. Mark the overriden method as shadowed by the new slot.
+  // the overrider. Mark the overridden method as shadowed by the new slot.
   OverriddenMethodInfo.Shadowed = true;
 
   // Force a special name mangling for a return-adjusting thunk
Index: lib/AST/Stmt.cpp
===
--- lib/AST/Stmt.cpp
+++ lib/AST/Stmt.cpp
@@ -38,7 +38,7 @@
   if (Initialized)
 return StmtClassInfo[E];
 
-  // Intialize the table on the first use.
+  // Initialize the table on the first use.
   Initialized = true;
 #define ABSTRACT_STMT(STMT)
 #define STMT(CLASS, PARENT) \
Index: lib/AST/ExprConstant.cpp
===
--- lib/AST/ExprConstant.cpp
+++ lib/AST/ExprConstant.cpp
@@ -475,7 +475,7 @@
   EM_EvaluateForOverflow,
 
   /// Evaluate in any way we know how. Don't worry about side-effects that
-  /// can't be modeled.
+  /// can't be modelled.
   EM_IgnoreSideEffects,
 
   /// Evaluate as a constant expression. Stop if we find that the expression
@@ -2679,7 +2679,7 @@
   }
 
   // In C++1y, we can't safely access any mutable state when we might be
-  // evaluating after an unmodeled side effect or an evaluation failure.
+  // evaluating after an unmodelled side effect or an evaluation failure.
   //
   // FIXME: Not all local state is mutable. Allow local constant subobjects
   // to be read here (but take care with 'mutable' fields).
Index: lib/AST/Expr.cpp
===
--- lib/AST/Expr.cpp
+++ lib/AST/Expr.cpp
@@ -967,7 +967,7 @@
 void StringLiteral::setString(const ASTContext C, StringRef Str,
   StringKind Kind, bool IsPascal) {
   //FIXME: we assume that the string data comes from a target that uses the same
-  // code unit size and endianess for the type of string.
+  // code unit size and endianness for the type of string.
   this-Kind = Kind;
   this-IsPascal = IsPascal;
   
Index: lib/AST/DeclObjC.cpp
===
--- lib/AST/DeclObjC.cpp
+++ lib/AST/DeclObjC.cpp
@@ -1051,8 +1051,8 @@
   if (!Container)
 return;
 
-  // In categories look for overriden methods from protocols. A method from
-  // category is not overriden since it is considered as the same method
+  // In categories look for overridden methods from protocols. A method from
+  // category is not overridden since it is considered as the same method
   // (same USR) as the one from the interface.
   if (const ObjCCategoryDecl *
 Category = dyn_castObjCCategoryDecl(Container)) {
Index: lib/AST/ASTContext.cpp
===
--- lib/AST/ASTContext.cpp
+++ lib/AST/ASTContext.cpp
@@ -1628,7 +1628,7 @@
   Align = Target-getPointerAlign(0);
   break;
 case BuiltinType::OCLSampler:
-  // Samplers are modeled as integers.
+  // Samplers are modelled as integers.
   Width = Target-getIntWidth();
   Align = Target-getIntAlign();
   break;
@@ -3743,7 +3743,7 @@
   CollectInheritedProtocols(IDecl, InheritedProtocols);
   if (InheritedProtocols.empty())
 return false;
-  // Check that if every protocol in list of idplist conforms to a protcol
+  // Check that if every protocol in list of idplist conforms to a protocol
   // of IDecl's, then bridge casting is ok.
   bool Conforms = false;
   for (auto *Proto : OPT-quals()) {
@@ -8592,7 +8592,7 @@
   ///
   /// Note that the relationship described here is purely in terms of AST
   /// traversal - there are other relationships (for example declaration context)
-  /// in the AST that are better modeled by special matchers.
+  /// in the AST that are better modelled by special matchers.
   ///
   /// FIXME: Currently only builds up the map using \c Stmt and \c Decl nodes.
   class ParentMapASTVisitor : public RecursiveASTVisitorParentMapASTVisitor {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D11784: [PATCH] clang-tidy check for incorrect move constructor initializers

2015-08-19 Thread Alexander Kornienko via cfe-commits
alexfh added a comment.

Sorry for the long delay.



Comment at: clang-tidy/misc/MoveConstructorInitCheck.cpp:40
@@ +39,3 @@
+  for (const auto *Ctor : CopyCtor-getParent()-ctors()) {
+if (Ctor-isMoveConstructor() 
+Ctor-getAccess() = AS_protected 

clang-format?


Comment at: clang-tidy/misc/MoveConstructorInitCheck.cpp:46
@@ +45,3 @@
+  //
+  // FIXME: Determine whether the move constructor is a viable candidate
+  // for the ctor-initializer, perhaps provide a fixit that suggests

This seems to be rather important to do from the beginning. Otherwise the check 
may be too noisy. BTW, did you run it over LLVM and Clang sources? Would be 
useful for some smoke testing.


Comment at: test/clang-tidy/misc-move-constructor-init.cpp:64
@@ +63,3 @@
+struct J : I {
+  // CHECK-NOT: warning:
+  J(J RHS) : I(RHS) {} // ok

I'd suggest using FileCheck -implicit-check-not='{{warning|error}}:' instead of 
stuffing the code with `// CHECK-NOT: warning:`. It will make the test more 
consistent with the other tests that use the clang_tidy_test.sh script.


http://reviews.llvm.org/D11784



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


[PATCH] D12144: Fix 4 typos in lib/Analysis/

2015-08-19 Thread Kai Zhao via cfe-commits
loverszhaokai created this revision.
loverszhaokai added reviewers: delesley, krememek.
loverszhaokai added a subscriber: cfe-commits.

Fix 4 typos:

  Intialize   - Initialize
  accessable - accessible
  modeled -  modelled

http://reviews.llvm.org/D12144

Files:
  lib/Analysis/ThreadSafetyCommon.cpp
  lib/Analysis/ThreadSafetyTIL.cpp
  lib/Analysis/UninitializedValues.cpp

Index: lib/Analysis/UninitializedValues.cpp
===
--- lib/Analysis/UninitializedValues.cpp
+++ lib/Analysis/UninitializedValues.cpp
@@ -788,7 +788,7 @@
 
 void TransferFunctions::VisitObjCMessageExpr(ObjCMessageExpr *ME) {
   // If the Objective-C message expression is an implicit no-return that
-  // is not modeled in the CFG, set the tracked dataflow values to Unknown.
+  // is not modelled in the CFG, set the tracked dataflow values to Unknown.
   if (objCNoRet.isImplicitNoReturn(ME)) {
 vals.setAllScratchValues(Unknown);
   }
Index: lib/Analysis/ThreadSafetyTIL.cpp
===
--- lib/Analysis/ThreadSafetyTIL.cpp
+++ lib/Analysis/ThreadSafetyTIL.cpp
@@ -186,8 +186,8 @@
 //
 // This sort assumes that (1) dominators have been computed, (2) there are no
 // critical edges, and (3) the entry block is reachable from the exit block
-// and no blocks are accessable via traversal of back-edges from the exit that
-// weren't accessable via forward edges from the entry.
+// and no blocks are accessible via traversal of back-edges from the exit that
+// weren't accessible via forward edges from the entry.
 int BasicBlock::topologicalFinalSort(SimpleArrayBasicBlock* Blocks, int ID) 
{
   // Visited is assumed to have been set by the topologicalSort.  This pass
   // assumes !Visited means that we've visited this node before.
Index: lib/Analysis/ThreadSafetyCommon.cpp
===
--- lib/Analysis/ThreadSafetyCommon.cpp
+++ lib/Analysis/ThreadSafetyCommon.cpp
@@ -846,7 +846,7 @@
 
 
 void SExprBuilder::enterCFGBlock(const CFGBlock *B) {
-  // Intialize TIL basic block and add it to the CFG.
+  // Initialize TIL basic block and add it to the CFG.
   CurrentBB = lookupBlock(B);
   CurrentBB-reservePredecessors(B-pred_size());
   Scfg-add(CurrentBB);


Index: lib/Analysis/UninitializedValues.cpp
===
--- lib/Analysis/UninitializedValues.cpp
+++ lib/Analysis/UninitializedValues.cpp
@@ -788,7 +788,7 @@
 
 void TransferFunctions::VisitObjCMessageExpr(ObjCMessageExpr *ME) {
   // If the Objective-C message expression is an implicit no-return that
-  // is not modeled in the CFG, set the tracked dataflow values to Unknown.
+  // is not modelled in the CFG, set the tracked dataflow values to Unknown.
   if (objCNoRet.isImplicitNoReturn(ME)) {
 vals.setAllScratchValues(Unknown);
   }
Index: lib/Analysis/ThreadSafetyTIL.cpp
===
--- lib/Analysis/ThreadSafetyTIL.cpp
+++ lib/Analysis/ThreadSafetyTIL.cpp
@@ -186,8 +186,8 @@
 //
 // This sort assumes that (1) dominators have been computed, (2) there are no
 // critical edges, and (3) the entry block is reachable from the exit block
-// and no blocks are accessable via traversal of back-edges from the exit that
-// weren't accessable via forward edges from the entry.
+// and no blocks are accessible via traversal of back-edges from the exit that
+// weren't accessible via forward edges from the entry.
 int BasicBlock::topologicalFinalSort(SimpleArrayBasicBlock* Blocks, int ID) {
   // Visited is assumed to have been set by the topologicalSort.  This pass
   // assumes !Visited means that we've visited this node before.
Index: lib/Analysis/ThreadSafetyCommon.cpp
===
--- lib/Analysis/ThreadSafetyCommon.cpp
+++ lib/Analysis/ThreadSafetyCommon.cpp
@@ -846,7 +846,7 @@
 
 
 void SExprBuilder::enterCFGBlock(const CFGBlock *B) {
-  // Intialize TIL basic block and add it to the CFG.
+  // Initialize TIL basic block and add it to the CFG.
   CurrentBB = lookupBlock(B);
   CurrentBB-reservePredecessors(B-pred_size());
   Scfg-add(CurrentBB);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12081: Add use-nullptr check to clang-tidy.

2015-08-19 Thread Angel Garcia via cfe-commits
angelgarcia added a comment.

Ok, thanks! :)


http://reviews.llvm.org/D12081



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


Re: [Diffusion] rL245435: clang-tools-extra/test/clang-tidy/readability-identifier-naming.cpp: Appease…

2015-08-19 Thread NAKAMURA Takumi via cfe-commits
chapuni added a subscriber: cfe-commits.
chapuni added a comment.

Targeting msvc (-triple *-win32) implies a few -f options.
You can reproduce the failure with -fdelayed-template-parsing, or -triple 
i686-win32.

Eyes might be increased if python version of check_clang_tidy.sh were 
introduced.
For now, just only my cross builder, --host=linux --target=x86_64-win32, can 
catch issues targeting msvc.


Users:
  chapuni (Author)

http://reviews.llvm.org/rL245435



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


Re: [PATCH] D11784: [PATCH] clang-tidy check for incorrect move constructor initializers

2015-08-19 Thread Aaron Ballman via cfe-commits
aaron.ballman updated this revision to Diff 32559.
aaron.ballman added a comment.

Addressed review comments. I re-ran the updated patch against LLVM and Clang, 
and there were some more false positives that I would like to address if 
possible. It seems my previous run against the source base was before expanding 
the scope of the patch to include more than just base class initialization 
(sorry for the earlier misinformation).

1. SourceMgr.h:58 is an example where the checker issues a diagnostic (for 
IncludeLoc), but given the triviality of the type, I don't see a reason to 
diagnose. However, this requires support from Sema, so I think a FIXME may be 
the best I can do. Note, adding a call to std::move() in these instances is not 
wrong, it's just not particularly useful.
2. we should not be warning on anything an implicit constructor does. For 
instance LiveQueryResult is triggering this because of SlotIndex. This should 
be fixed with this patch.

Running over Clang and LLVM, there are 7 distinct false positives (repeated due 
to being in header files) and they all relate to triviality. The total false 
positive count was 832 of which two warnings (SourceMgr.h and Preprocessor.h) 
accounted for probably close to 90% of the diagnostics. This time around there 
were no true positives.


http://reviews.llvm.org/D11784

Files:
  clang-tidy/misc/CMakeLists.txt
  clang-tidy/misc/MiscTidyModule.cpp
  clang-tidy/misc/MoveConstructorInitCheck.cpp
  clang-tidy/misc/MoveConstructorInitCheck.h
  test/clang-tidy/misc-move-constructor-init.cpp

Index: test/clang-tidy/misc-move-constructor-init.cpp
===
--- test/clang-tidy/misc-move-constructor-init.cpp
+++ test/clang-tidy/misc-move-constructor-init.cpp
@@ -0,0 +1,79 @@
+// RUN: clang-tidy %s -checks=-*,misc-move-constructor-init -- -std=c++14 | FileCheck %s -implicit-check-not={{warning|error}}:
+
+template class T struct remove_reference  {typedef T type;};
+template class T struct remove_referenceT  {typedef T type;};
+template class T struct remove_referenceT {typedef T type;};
+
+template typename T
+typename remove_referenceT::type move(T arg) {
+  return static_casttypename remove_referenceT::type(arg);
+}
+
+struct C {
+  C() = default;
+  C(const C) = default;
+};
+
+struct B {
+  B() {}
+  B(const B) {}
+  B(B ) {}
+};
+
+struct D : B {
+  D() : B() {}
+  D(const D RHS) : B(RHS) {}
+  // CHECK: :[[@LINE+3]]:16: warning: move constructor initializes base class by calling a copy constructor [misc-move-constructor-init]
+  // CHECK: 19:3: note: copy constructor being called
+  // CHECK: 20:3: note: candidate move constructor here
+  D(D RHS) : B(RHS) {}
+};
+
+struct E : B {
+  E() : B() {}
+  E(const E RHS) : B(RHS) {}
+  E(E RHS) : B(move(RHS)) {} // ok
+};
+
+struct F {
+  C M;
+
+  F(F ) : M(C()) {} // ok
+};
+
+struct G {
+  G() = default;
+  G(const G) = default;
+  G(G) = delete;
+};
+
+struct H : G {
+  H() = default;
+  H(const H) = default;
+  H(H RHS) : G(RHS) {} // ok
+};
+
+struct I {
+  I(const I ) = default; // suppresses move constructor creation
+};
+
+struct J : I {
+  J(J RHS) : I(RHS) {} // ok
+};
+
+struct K {}; // Has implicit copy and move constructors
+struct L : K {
+  // CHECK: :[[@LINE+1]]:16: warning: move constructor initializes base class by calling a copy constructor [misc-move-constructor-init]
+  L(L RHS) : K(RHS) {}
+};
+
+struct M {
+  B Mem;
+  // CHECK: :[[@LINE+1]]:16: warning: move constructor initializes class member by calling a copy constructor [misc-move-constructor-init]
+  M(M RHS) : Mem(RHS.Mem) {}
+};
+
+struct N {
+  B Mem;
+  N(N RHS) : Mem(move(RHS.Mem)) {}
+};
Index: clang-tidy/misc/MoveConstructorInitCheck.h
===
--- clang-tidy/misc/MoveConstructorInitCheck.h
+++ clang-tidy/misc/MoveConstructorInitCheck.h
@@ -0,0 +1,32 @@
+//===--- MoveConstructorInitCheck.h - clang-tidy-*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_MOVECONSTRUCTORINITCHECK_H
+#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_MOVECONSTRUCTORINITCHECK_H
+
+#include ../ClangTidy.h
+
+namespace clang {
+namespace tidy {
+
+/// \brief The check flags user-defined move constructors that have a
+/// ctor-initializer initializing a member or base class through a copy
+/// constructor instead of a move constructor.
+class MoveConstructorInitCheck : public ClangTidyCheck {
+public:
+  MoveConstructorInitCheck(StringRef Name, ClangTidyContext *Context)
+  : ClangTidyCheck(Name, Context) {}
+  void registerMatchers(ast_matchers::MatchFinder *Finder) override;
+  void check(const ast_matchers::MatchFinder::MatchResult 

[libcxxabi] r245449 - [AArch64] Quick fix for cxa demangler

2015-08-19 Thread Renato Golin via cfe-commits
Author: rengolin
Date: Wed Aug 19 10:24:03 2015
New Revision: 245449

URL: http://llvm.org/viewvc/llvm-project?rev=245449view=rev
Log:
[AArch64] Quick fix for cxa demangler

This makes all libcxxabi tests pass on AArch64. Further changes and
new tests to come.

Patch by Keith Walker.

Modified:
libcxxabi/trunk/src/cxa_demangle.cpp

Modified: libcxxabi/trunk/src/cxa_demangle.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_demangle.cpp?rev=245449r1=245448r2=245449view=diff
==
--- libcxxabi/trunk/src/cxa_demangle.cpp (original)
+++ libcxxabi/trunk/src/cxa_demangle.cpp Wed Aug 19 10:24:03 2015
@@ -156,7 +156,7 @@ constexpr const char* float_datadouble
 template 
 struct float_datalong double
 {
-#if defined(__mips__)  defined(__mips_n64)
+#if defined(__mips__)  defined(__mips_n64) || defined(__aarch64__)
 static const size_t mangled_size = 32;
 #elif defined(__arm__) || defined(__mips__)
 static const size_t mangled_size = 16;


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


Re: [PATCH] D11555: [libcxx] Allow use of atomic in C++03. Try 3.

2015-08-19 Thread Marshall Clow via cfe-commits
mclow.lists accepted this revision.
mclow.lists added a comment.
This revision is now accepted and ready to land.

I think this is ready to land now. Thanks, Eric.


http://reviews.llvm.org/D11555



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


Re: [PATCH] D11784: [PATCH] clang-tidy check for incorrect move constructor initializers

2015-08-19 Thread Aaron Ballman via cfe-commits
aaron.ballman marked 5 inline comments as done.
aaron.ballman added a comment.

http://reviews.llvm.org/D11784



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


r245445 - [ARM] Proper generic cpus handling

2015-08-19 Thread Vladimir Sukharev via cfe-commits
Author: vsukharev
Date: Wed Aug 19 09:50:18 2015
New Revision: 245445

URL: http://llvm.org/viewvc/llvm-project?rev=245445view=rev
Log:
[ARM] Proper generic cpus handling

generic cpu was wrongly handled as exact real CPU name of ARMv8.1A 
architecture.

This has been fixed, now it is abstract name, suitable for any arch.

Reviewers: rengolin

Subscribers: cfe-commits

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

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

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=245445r1=245444r2=245445view=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Wed Aug 19 09:50:18 2015
@@ -4257,21 +4257,18 @@ class ARMTargetInfo : public TargetInfo
 ArchISA= llvm::ARMTargetParser::parseArchISA(ArchName);
 DefaultCPU = getDefaultCPU(ArchName);
 
-// SubArch is specified by the target triple
-if (!DefaultCPU.empty()) 
-  setArchInfo(DefaultCPU);
-else 
-  // FIXME ArchInfo should be based on ArchName from triple, not on 
-  // a hard-coded CPU name. Doing so currently causes regressions:
-  // test/Preprocessor/init.c: __ARM_ARCH_6J__ not defined
-  setArchInfo(CPU);
+unsigned ArchKind = llvm::ARMTargetParser::parseArch(ArchName);
+if (ArchKind == llvm::ARM::AK_INVALID)
+  // set arch of the CPU, either provided explicitly or hardcoded default
+  ArchKind = llvm::ARMTargetParser::parseCPUArch(CPU);
+setArchInfo(ArchKind);
   }
 
-  void setArchInfo(StringRef CPU) {
+  void setArchInfo(unsigned Kind) {
 StringRef SubArch;
 
 // cache TargetParser info
-ArchKind= llvm::ARMTargetParser::parseCPUArch(CPU);
+ArchKind= Kind;
 SubArch = llvm::ARMTargetParser::getSubArch(ArchKind);
 ArchProfile = llvm::ARMTargetParser::parseArchProfile(SubArch);
 ArchVersion = llvm::ARMTargetParser::parseArchVersion(SubArch);
@@ -4570,10 +4567,11 @@ public:
   }
 
   bool setCPU(const std::string Name) override {
-unsigned ArchKind = llvm::ARMTargetParser::parseCPUArch(Name);
+if (Name != generic)
+  setArchInfo(llvm::ARMTargetParser::parseCPUArch(Name));
+
 if (ArchKind == llvm::ARM::AK_INVALID)
   return false;
-setArchInfo(Name);
 setAtomic();
 CPU = Name;
 return true;

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=245445r1=245444r2=245445view=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Wed Aug 19 09:50:18 2015
@@ -6002,9 +6002,9 @@ std::string arm::getARMTargetCPU(StringR
 /// CPU  (or Arch, if CPU is generic).
 // FIXME: This is redundant with -mcpu, why does LLVM use this.
 const char *arm::getLLVMArchSuffixForARM(StringRef CPU, StringRef Arch) {
-  if (CPU == generic 
-  llvm::ARMTargetParser::parseArch(Arch) == llvm::ARM::AK_ARMV8_1A)
-return v8.1a;
+  if (CPU == generic)
+return llvm::ARMTargetParser::getSubArch(
+llvm::ARMTargetParser::parseArch(Arch));
 
   unsigned ArchKind = llvm::ARMTargetParser::parseCPUArch(CPU);
   if (ArchKind == llvm::ARM::AK_INVALID)

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=245445r1=245444r2=245445view=diff
==
--- cfe/trunk/test/Driver/arm-cortex-cpus.c (original)
+++ cfe/trunk/test/Driver/arm-cortex-cpus.c Wed Aug 19 09:50:18 2015
@@ -134,6 +134,18 @@
 // RUN: %clang -target arm -mlittle-endian -march=armv8-a -mlittle-endian -### 
-c %s 21 | FileCheck -check-prefix=CHECK-V8A %s
 // CHECK-V8A: -cc1{{.*}} -triple armv8-{{.*}} -target-cpu cortex-a53
 
+// RUN: %clang -mcpu=generic -target armv8 -### -c %s 21 | FileCheck 
-check-prefix=CHECK-V8A-GENERIC %s
+// RUN: %clang -mcpu=generic -target arm -march=armv8 -### -c %s 21 | 
FileCheck -check-prefix=CHECK-V8A-GENERIC %s
+// RUN: %clang -mcpu=generic -target armv8a -### -c %s 21 | FileCheck 
-check-prefix=CHECK-V8A-GENERIC %s
+// RUN: %clang -mcpu=generic -target arm -march=armv8a -### -c %s 21 | 
FileCheck -check-prefix=CHECK-V8A-GENERIC %s
+// RUN: %clang -mcpu=generic -target arm -march=armv8-a -### -c %s 21 | 
FileCheck -check-prefix=CHECK-V8A-GENERIC %s
+// RUN: %clang -mcpu=generic -target armv8 -mlittle-endian -### -c %s 21 | 
FileCheck -check-prefix=CHECK-V8A-GENERIC %s
+// RUN: %clang -mcpu=generic -target arm -march=armv8 -mlittle-endian -### -c 
%s 21 | FileCheck -check-prefix=CHECK-V8A-GENERIC %s
+// RUN: %clang -mcpu=generic -target armv8a -mlittle-endian -### -c %s 21 | 
FileCheck -check-prefix=CHECK-V8A-GENERIC %s
+// RUN: 

Re: [PATCH] D11784: [PATCH] clang-tidy check for incorrect move constructor initializers

2015-08-19 Thread Aaron Ballman via cfe-commits
aaron.ballman added inline comments.


Comment at: clang-tidy/misc/MoveConstructorInitCheck.cpp:40
@@ +39,3 @@
+  for (const auto *Ctor : CopyCtor-getParent()-ctors()) {
+if (Ctor-isMoveConstructor() 
+Ctor-getAccess() = AS_protected 

alexfh wrote:
 clang-format?
I thought the current formatting was an improvement over what clang-format 
produces (for those of us with debuggers that aren't as good at subexpression 
highlighting). I'm fine either way, though.


Comment at: clang-tidy/misc/MoveConstructorInitCheck.cpp:46
@@ +45,3 @@
+  //
+  // FIXME: Determine whether the move constructor is a viable candidate
+  // for the ctor-initializer, perhaps provide a fixit that suggests

alexfh wrote:
 This seems to be rather important to do from the beginning. Otherwise the 
 check may be too noisy. BTW, did you run it over LLVM and Clang sources? 
 Would be useful for some smoke testing.
In order to do that, I would need access to more parts of Sema. The check, as 
it currently stands, is fairly reasonable from what I can tell. The false 
positive rate appears to be low. I ran it over Clang and LLVM and it did point 
out one debatably-true-positive (which we've since resolved) with no 
false-positives. In testing other code bases, the diagnostic was not chatty, 
but perhaps they did not make heavy use of move semantics.


Comment at: test/clang-tidy/misc-move-constructor-init.cpp:64
@@ +63,3 @@
+struct J : I {
+  // CHECK-NOT: warning:
+  J(J RHS) : I(RHS) {} // ok

alexfh wrote:
 I'd suggest using FileCheck -implicit-check-not='{{warning|error}}:' instead 
 of stuffing the code with `// CHECK-NOT: warning:`. It will make the test 
 more consistent with the other tests that use the clang_tidy_test.sh script.
Can do (though I am explicitly not using clang_tidy_test.sh because I am 
working on Windows and all those tests are currently disabled due to REQUIRES: 
shell :-()


http://reviews.llvm.org/D11784



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


FunctionDecl::getBody() returning nullptr

2015-08-19 Thread Aaron Ballman via cfe-commits
When I run the following test code through clang-tidy -checks=*, I get
a crash from some relatively strange behavior with FunctionDecl.

template class T struct remove_reference  {typedef T type;};
template class T struct remove_referenceT  {typedef T type;};
template class T struct remove_referenceT {typedef T type;};

template typename T
typename remove_referenceT::type move(T arg) {
  return static_casttypename remove_referenceT::type(arg);
}

AnalysisConsumer::getModeForDecl() is called, and it has code that
does: D-hasBody() ? D-getBody()-stuff : stuff;

What's strange is that hasBody() returns true, but getBody() returns
nullptr. I don't think that this should be possible. I'm wondering
whether it's purposeful that hasBody() does not check
Definition-Body?

Also, the FunctionDecl in question is for move(), which does have a
body, so I do not understand why the definition would claim there is
no body.

Ideas, or should I file a bug report?

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


Re: [PATCH] D12148: [ARM] Allow passing/returning of __fp16 arguments

2015-08-19 Thread James Molloy via cfe-commits
jmolloy added a subscriber: jmolloy.


Comment at: lib/CodeGen/TargetInfo.cpp:4717
@@ -4716,1 +4716,3 @@
 
+  // __fp16 gets passed as if it were an int or float, but with the top 32 bits
+  // unspecified.

Top 16 bits?


Comment at: lib/CodeGen/TargetInfo.cpp:4884
@@ -4874,1 +4883,3 @@
 
+  // __fp16 gets returned as if it were an int or float, but with the top 32
+  // bits unspecified.

Top 16 bits ?


Repository:
  rL LLVM

http://reviews.llvm.org/D12148



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


Re: [PATCH] D12144: Fix 4 typos in lib/Analysis/

2015-08-19 Thread Delesley Hutchins via cfe-commits
delesley added a comment.

Looks good for the thread safety stuff.


http://reviews.llvm.org/D12144



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


Re: [PATCH] D11963: Create a __config_site file to capture configuration decisions.

2015-08-19 Thread Jonathan Roelofs via cfe-commits
jroelofs added a comment.

In http://reviews.llvm.org/D11963#227444, @EricWF wrote:

 I also just realized that this change will currently likely play havoc with 
 how libc++ and libc++abi build together. In order to build libc++ and 
 libc++abi together we would need to

 1. Configure libc++ pointing to the libc++abi headers in order to generate 
 the __config_site file.
 2. Configure libc++abi pointing it to the libc++ build directory for the 
 headers.
 3. build libc++abi
 4. build libc++

   I'm not quite sure how this would work for an in-tree build.


This patch, combined with http://reviews.llvm.org/D11964, works the way you 
describe.

 However if we do things as I suggested above we can keep the current two step 
 build process.





http://reviews.llvm.org/D11963



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


Re: [PATCH] D12148: [ARM] Allow passing/returning of __fp16 arguments

2015-08-19 Thread Oliver Stannard via cfe-commits
olista01 updated this revision to Diff 32558.
olista01 added a comment.

Fixed typo


Repository:
  rL LLVM

http://reviews.llvm.org/D12148

Files:
  lib/Basic/Targets.cpp
  lib/CodeGen/TargetInfo.cpp
  lib/Driver/Tools.cpp
  test/CodeGen/arm-fp16-arguments.c
  test/Preprocessor/arm-acle-6.5.c
  test/Preprocessor/arm-target-features.c

Index: test/Preprocessor/arm-target-features.c
===
--- test/Preprocessor/arm-target-features.c
+++ test/Preprocessor/arm-target-features.c
@@ -5,6 +5,8 @@
 // CHECK: __ARM_FEATURE_CRC32 1
 // CHECK: __ARM_FEATURE_DIRECTED_ROUNDING 1
 // CHECK: __ARM_FEATURE_NUMERIC_MAXMIN 1
+// CHECK: __ARM_FP16_ARGS 1
+// CHECK: __ARM_FP16_FORMAT_IEEE 1
 
 // RUN: %clang -target armv7a-none-linux-gnu -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-V7 %s
 // CHECK-V7: __ARMEL__ 1
Index: test/Preprocessor/arm-acle-6.5.c
===
--- test/Preprocessor/arm-acle-6.5.c
+++ test/Preprocessor/arm-acle-6.5.c
@@ -1,6 +1,6 @@
 // RUN: %clang -target arm-eabi -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-DEFAULT
 
-// CHECK-DEFAULT-NOT: __ARM_FP
+// CHECK-DEFAULT-NOT: __ARM_FP 0x
 
 // RUN: %clang -target arm-eabi -mfpu=vfp -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-SP-DP
 // RUN: %clang -target arm-eabi -mfpu=vfp3 -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-SP-DP
Index: test/CodeGen/arm-fp16-arguments.c
===
--- /dev/null
+++ test/CodeGen/arm-fp16-arguments.c
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 -triple armv7a--none-eabi -target-abi aapcs -mfloat-abi soft -fallow-half-arguments-and-returns -emit-llvm -o - -O1 %s | FileCheck %s --check-prefix=CHECK --check-prefix=SOFT
+// RUN: %clang_cc1 -triple armv7a--none-eabi -target-abi aapcs -mfloat-abi hard -fallow-half-arguments-and-returns -emit-llvm -o - -O1 %s | FileCheck %s --check-prefix=CHECK --check-prefix=HARD
+
+__fp16 g;
+
+void t1(__fp16 a) { g = a; }
+// SOFT: define void @t1(i32 [[PARAM:%.*]])
+// SOFT: [[TRUNC:%.*]] = trunc i32 [[PARAM]] to i16
+// HARD: define arm_aapcs_vfpcc void @t1(float [[PARAM:%.*]])
+// HARD: [[BITCAST:%.*]] = bitcast float [[PARAM]] to i32
+// HARD: [[TRUNC:%.*]] = trunc i32 [[BITCAST]] to i16
+// CHECK: store i16 [[TRUNC]], i16* bitcast (half* @g to i16*)
+
+__fp16 t2() { return g; }
+// SOFT: define i32 @t2()
+// HARD: define arm_aapcs_vfpcc float @t2()
+// CHECK: [[LOAD:%.*]] = load i16, i16* bitcast (half* @g to i16*)
+// CHECK: [[ZEXT:%.*]] = zext i16 [[LOAD]] to i32
+// SOFT: ret i32 [[ZEXT]]
+// HARD: [[BITCAST:%.*]] = bitcast i32 [[ZEXT]] to float
+// HARD: ret float [[BITCAST]]
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -4251,7 +4251,11 @@
   }
 
   if (getToolChain().getArch() == llvm::Triple::aarch64 ||
-  getToolChain().getArch() == llvm::Triple::aarch64_be)
+  getToolChain().getArch() == llvm::Triple::aarch64_be ||
+  getToolChain().getArch() == llvm::Triple::arm ||
+  getToolChain().getArch() == llvm::Triple::armeb ||
+  getToolChain().getArch() == llvm::Triple::thumb ||
+  getToolChain().getArch() == llvm::Triple::thumbeb)
 CmdArgs.push_back(-fallow-half-arguments-and-returns);
 
   if (Arg *A = Args.getLastArg(options::OPT_mrestrict_it,
Index: lib/CodeGen/TargetInfo.cpp
===
--- lib/CodeGen/TargetInfo.cpp
+++ lib/CodeGen/TargetInfo.cpp
@@ -4714,6 +4714,15 @@
 return ABIArgInfo::getIndirect(0, /*ByVal=*/false);
   }
 
+  // __fp16 gets passed as if it were an int or float, but with the top 16 bits
+  // unspecified.
+  if (Ty-isHalfType()) {
+llvm::Type *ResType = IsEffectivelyAAPCS_VFP ?
+  llvm::Type::getFloatTy(getVMContext()) :
+  llvm::Type::getInt32Ty(getVMContext());
+return ABIArgInfo::getDirect(ResType);
+  }
+
   if (!isAggregateTypeForABI(Ty)) {
 // Treat an enum type as its underlying type.
 if (const EnumType *EnumTy = Ty-getAsEnumType()) {
@@ -4872,6 +4881,15 @@
 return ABIArgInfo::getIndirect(0);
   }
 
+  // __fp16 gets returned as if it were an int or float, but with the top 16
+  // bits unspecified.
+  if (RetTy-isHalfType()) {
+llvm::Type *ResType = IsEffectivelyAAPCS_VFP ?
+  llvm::Type::getFloatTy(getVMContext()) :
+  llvm::Type::getInt32Ty(getVMContext());
+return ABIArgInfo::getDirect(ResType);
+  }
+
   if (!isAggregateTypeForABI(RetTy)) {
 // Treat an enum type as its underlying type.
 if (const EnumType *EnumTy = RetTy-getAsEnumType())
Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -4625,6 +4625,10 @@
 // ACLE predefines.
 Builder.defineMacro(__ARM_ACLE, 200);
 
+// FP16 support (we currently only 

[clang-tools-extra] r245471 - [clang-tidy] Fix a bug in UseNullptrCheck.

2015-08-19 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Wed Aug 19 12:50:22 2015
New Revision: 245471

URL: http://llvm.org/viewvc/llvm-project?rev=245471view=rev
Log:
[clang-tidy] Fix a bug in UseNullptrCheck.

http://reviews.llvm.org/D12162

Patch by Angel Garcia!

Modified:
clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp

Modified: clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp?rev=245471r1=245470r2=245471view=diff
==
--- clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp Wed Aug 19 
12:50:22 2015
@@ -175,10 +175,10 @@ private:
 class CastSequenceVisitor : public RecursiveASTVisitorCastSequenceVisitor {
 public:
   CastSequenceVisitor(ASTContext Context,
-  SmallVectorStringRef, 1 UserNullMacros,
+  ArrayRefStringRef UserNullMacros,
   ClangTidyCheck check)
   : SM(Context.getSourceManager()), Context(Context),
-UserNullMacros(std::move(UserNullMacros)), Check(check),
+UserNullMacros(UserNullMacros), Check(check),
 FirstSubExpr(nullptr), PruneSubtree(false) {}
 
   bool TraverseStmt(Stmt *S) {
@@ -435,7 +435,7 @@ private:
 private:
   SourceManager SM;
   ASTContext Context;
-  const SmallVectorStringRef, 1 UserNullMacros;
+  ArrayRefStringRef UserNullMacros;
   ClangTidyCheck Check;
   Expr *FirstSubExpr;
   bool PruneSubtree;


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


Re: [PATCH] D12162: Remove reference.

2015-08-19 Thread Alexander Kornienko via cfe-commits
alexfh accepted this revision.
alexfh added a comment.
This revision is now accepted and ready to land.

Thanks! LG


http://reviews.llvm.org/D12162



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


[PATCH] D12155: ARM: Error out on apple darwin platforms if float-abi is hard

2015-08-19 Thread Akira Hatanaka via cfe-commits
ahatanak created this revision.
ahatanak added a subscriber: cfe-commits.
Herald added subscribers: rengolin, aemerson.

Error out if user provides -mfloat-abi=hard or -mhard-float on the command line 
since hard float abi isn't supported on apple platforms (except for non-darwin 
platforms).

http://reviews.llvm.org/D12155

Files:
  lib/Driver/Tools.cpp
  test/Driver/arm-float-abi.c

Index: test/Driver/arm-float-abi.c
===
--- /dev/null
+++ test/Driver/arm-float-abi.c
@@ -0,0 +1,5 @@
+// RUN: not %clang %s -target armv7-apple-ios -mfloat-abi=hard 21 | 
FileCheck -check-prefix=ARMV7-HARD %s
+// RUN: %clang %s -target armv7-apple-ios -mfloat-abi=softfp -### 21 | 
FileCheck -check-prefix=ARMV7-SOFTFP %s
+
+// ARMV7-HARD: unsupported option '-mfloat-abi=hard' for target 'thumbv7'
+// ARMV7-SOFTFP-NOT: unsupported option
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -582,6 +582,10 @@
 FloatABI = soft;
   }
 }
+
+if (Triple.isOSDarwin()  FloatABI == hard)
+  D.Diag(diag::err_drv_unsupported_opt_for_target)  A-getAsString(Args)
+Triple.getArchName();
   }
 
   // If unspecified, choose the default based on the platform.


Index: test/Driver/arm-float-abi.c
===
--- /dev/null
+++ test/Driver/arm-float-abi.c
@@ -0,0 +1,5 @@
+// RUN: not %clang %s -target armv7-apple-ios -mfloat-abi=hard 21 | FileCheck -check-prefix=ARMV7-HARD %s
+// RUN: %clang %s -target armv7-apple-ios -mfloat-abi=softfp -### 21 | FileCheck -check-prefix=ARMV7-SOFTFP %s
+
+// ARMV7-HARD: unsupported option '-mfloat-abi=hard' for target 'thumbv7'
+// ARMV7-SOFTFP-NOT: unsupported option
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -582,6 +582,10 @@
 FloatABI = soft;
   }
 }
+
+if (Triple.isOSDarwin()  FloatABI == hard)
+  D.Diag(diag::err_drv_unsupported_opt_for_target)  A-getAsString(Args)
+Triple.getArchName();
   }
 
   // If unspecified, choose the default based on the platform.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12002: Initial WebAssembly support in clang

2015-08-19 Thread JF Bastien via cfe-commits
jfb added a comment.

Still lgtm, with minor comments.



Comment at: lib/CodeGen/ItaniumCXXABI.cpp:364
@@ +363,3 @@
+ItaniumCXXABI(CGM, /* UseARMMethodPtrABI = */ true,
+  /* UseARMGuardVarABI = */ true) {}
+

It's more common to have no spaces for these comments: 
`/*UseARMMethodPtrABI=*/true,`.


Comment at: lib/Driver/Tools.cpp:1567
@@ +1566,3 @@
+
+#ifdef __wasm__
+// Handle native by examining the host.

Could you expand a bit on why native doesn't make sense if LLVM itself wasn't 
compiled for wasm?


Repository:
  rL LLVM

http://reviews.llvm.org/D12002



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


Re: [PATCH] D12128: Generating available_externally vtables bugfix

2015-08-19 Thread John McCall via cfe-commits
rjmccall added a comment.

LGTM.


http://reviews.llvm.org/D12128



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


Re: [PATCH] D11963: Create a __config_site file to capture configuration decisions.

2015-08-19 Thread Eric Fiselier via cfe-commits
EricWF added a comment.

In http://reviews.llvm.org/D11963#227951, @jroelofs wrote:

 In http://reviews.llvm.org/D11963#227441, @EricWF wrote:

  @jroelofs What do you think of an approach like this?


 Having two copies of the __config_site file makes me uncomfortable, but I 
 could put up with that given that they're effectively the same for 99% of 
 people who will want to build this library.

 That being said, @mclow.lists raised a few concerns with the overall 
 strategy... I don't want to keep pushing on this patch if his plan is to 
 pocket-veto it.


My hackey suggestion makes me uncomfortable too.  However, as unfortunate as it 
is, we **need** a patch like this (Despite how bad I don't want it). One reason 
is that  libc++ *claims* to support using libsupc++ to provide `typeinfo` 
definition. The problem is that libc++ declares `typeinfo` with a different 
vtable layout. In order to match libsupc++ we need something like a 
`__config_site` header. I think we either need to nuke libsupc++ support or 
adopt a patch like this.


http://reviews.llvm.org/D11963



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


[libcxxabi] r245461 - [libcxxabi] Add install-libcxxabi target.

2015-08-19 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Wed Aug 19 12:17:21 2015
New Revision: 245461

URL: http://llvm.org/viewvc/llvm-project?rev=245461view=rev
Log:
[libcxxabi] Add install-libcxxabi target.

Summary:
Currently you can't install libc++abi from within the LLVM tree without 
installing all of LLVM. This patch adds an install rule for libc++abi.


Reviewers: danalbert, compnerd, rengolin, beanz

Subscribers: martell, beanz, jroelofs, cfe-commits

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

Modified:
libcxxabi/trunk/src/CMakeLists.txt

Modified: libcxxabi/trunk/src/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/CMakeLists.txt?rev=245461r1=245460r2=245461view=diff
==
--- libcxxabi/trunk/src/CMakeLists.txt (original)
+++ libcxxabi/trunk/src/CMakeLists.txt Wed Aug 19 12:17:21 2015
@@ -119,6 +119,14 @@ endif()
 add_custom_target(cxxabi DEPENDS ${LIBCXXABI_TARGETS})
 
 install(TARGETS ${LIBCXXABI_TARGETS}
-  LIBRARY DESTINATION lib${LIBCXXABI_LIBDIR_SUFFIX}
-  ARCHIVE DESTINATION lib${LIBCXXABI_LIBDIR_SUFFIX}
+  LIBRARY DESTINATION lib${LIBCXXABI_LIBDIR_SUFFIX} COMPONENT libcxxabi
+  ARCHIVE DESTINATION lib${LIBCXXABI_LIBDIR_SUFFIX} COMPONENT libcxxabi
   )
+
+if (NOT CMAKE_CONFIGURATION_TYPES)
+  add_custom_target(install-libcxxabi
+DEPENDS cxxabi
+COMMAND ${CMAKE_COMMAND}
+-DCMAKE_INSTALL_COMPONENT=libcxxabi
+-P ${LIBCXXABI_BINARY_DIR}/cmake_install.cmake)
+endif()


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


Re: [PATCH] D11963: Create a __config_site file to capture configuration decisions.

2015-08-19 Thread Jonathan Roelofs via cfe-commits
jroelofs added a comment.

In http://reviews.llvm.org/D11963#228024, @EricWF wrote:

 Wouldn't it still be a mess if you build both libc++ and libc++abi 
 out-of-tree? The user would have to be aware of these weird requirements.


Oh, yeah, true. Do we have any out-of-tree builders to make sure those 
configurations are supported?


http://reviews.llvm.org/D11963



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


Re: [PATCH] D12143: [X86][AVX2] Replace avx2.pbroadcast / avx2.vbroadcast intrinsics usage in avx2intrin.h with __builtin_shufflevector

2015-08-19 Thread Ahmed Bougacha via cfe-commits
ab added a comment.

Heh, this is http://reviews.llvm.org/D10556, no? :P


Repository:
  rL LLVM

http://reviews.llvm.org/D12143



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


Re: [PATCH] D12162: Remove reference.

2015-08-19 Thread Angel Garcia via cfe-commits
angelgarcia changed the visibility of this Differential Revision from All 
Users to Public (No Login Required).
angelgarcia updated this revision to Diff 32576.
angelgarcia added a comment.

Use ArrayRef.


http://reviews.llvm.org/D12162

Files:
  clang-tidy/modernize/UseNullptrCheck.cpp

Index: clang-tidy/modernize/UseNullptrCheck.cpp
===
--- clang-tidy/modernize/UseNullptrCheck.cpp
+++ clang-tidy/modernize/UseNullptrCheck.cpp
@@ -175,10 +175,10 @@
 class CastSequenceVisitor : public RecursiveASTVisitorCastSequenceVisitor {
 public:
   CastSequenceVisitor(ASTContext Context,
-  SmallVectorStringRef, 1 UserNullMacros,
+  ArrayRefStringRef UserNullMacros,
   ClangTidyCheck check)
   : SM(Context.getSourceManager()), Context(Context),
-UserNullMacros(std::move(UserNullMacros)), Check(check),
+UserNullMacros(UserNullMacros), Check(check),
 FirstSubExpr(nullptr), PruneSubtree(false) {}
 
   bool TraverseStmt(Stmt *S) {
@@ -435,7 +435,7 @@
 private:
   SourceManager SM;
   ASTContext Context;
-  const SmallVectorStringRef, 1 UserNullMacros;
+  ArrayRefStringRef UserNullMacros;
   ClangTidyCheck Check;
   Expr *FirstSubExpr;
   bool PruneSubtree;


Index: clang-tidy/modernize/UseNullptrCheck.cpp
===
--- clang-tidy/modernize/UseNullptrCheck.cpp
+++ clang-tidy/modernize/UseNullptrCheck.cpp
@@ -175,10 +175,10 @@
 class CastSequenceVisitor : public RecursiveASTVisitorCastSequenceVisitor {
 public:
   CastSequenceVisitor(ASTContext Context,
-  SmallVectorStringRef, 1 UserNullMacros,
+  ArrayRefStringRef UserNullMacros,
   ClangTidyCheck check)
   : SM(Context.getSourceManager()), Context(Context),
-UserNullMacros(std::move(UserNullMacros)), Check(check),
+UserNullMacros(UserNullMacros), Check(check),
 FirstSubExpr(nullptr), PruneSubtree(false) {}
 
   bool TraverseStmt(Stmt *S) {
@@ -435,7 +435,7 @@
 private:
   SourceManager SM;
   ASTContext Context;
-  const SmallVectorStringRef, 1 UserNullMacros;
+  ArrayRefStringRef UserNullMacros;
   ClangTidyCheck Check;
   Expr *FirstSubExpr;
   bool PruneSubtree;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r245458 - [clang-tidy] Fix LoopConvertCheck bug.

2015-08-19 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Wed Aug 19 11:54:51 2015
New Revision: 245458

URL: http://llvm.org/viewvc/llvm-project?rev=245458view=rev
Log:
[clang-tidy] Fix LoopConvertCheck bug.

Fix LoopConvertCheck bug: StringRef to temporaries.

Also add LLVM_ATTRIBUTE_UNUSED to ModernizeModuleAnchorDestination.

http://reviews.llvm.org/D12157

Patch by Angel Garcia!

Modified:
clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp
clang-tools-extra/trunk/clang-tidy/tool/ClangTidyMain.cpp

Modified: clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp?rev=245458r1=245457r2=245458view=diff
==
--- clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp Wed Aug 
19 11:54:51 2015
@@ -417,7 +417,7 @@ void LoopConvertCheck::doConversion(
 // First, replace all usages of the array subscript expression with our new
 // variable.
 for (const auto I : Usages) {
-  StringRef ReplaceText = I.IsArrow ? VarName + . : VarName;
+  std::string ReplaceText = I.IsArrow ? VarName + . : VarName;
   TUInfo-getReplacedVars().insert(std::make_pair(TheLoop, IndexVar));
   Diag  FixItHint::CreateReplacement(
   CharSourceRange::getTokenRange(I.Range), ReplaceText);
@@ -446,11 +446,9 @@ void LoopConvertCheck::doConversion(
   }
 
   StringRef MaybeDereference = ContainerNeedsDereference ? * : ;
-  StringRef TypeString = AutoRefType.getAsString();
-  StringRef Range = (( + TypeString +   + VarName +  :  +
- MaybeDereference + ContainerString + ))
-.str();
-
+  std::string TypeString = AutoRefType.getAsString();
+  std::string Range = (( + TypeString +   + VarName +  :  +
+   MaybeDereference + ContainerString + )).str();
   Diag  FixItHint::CreateReplacement(
   CharSourceRange::getTokenRange(ParenRange), Range);
   TUInfo-getGeneratedDecls().insert(make_pair(TheLoop, VarName));

Modified: clang-tools-extra/trunk/clang-tidy/tool/ClangTidyMain.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/tool/ClangTidyMain.cpp?rev=245458r1=245457r2=245458view=diff
==
--- clang-tools-extra/trunk/clang-tidy/tool/ClangTidyMain.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/tool/ClangTidyMain.cpp Wed Aug 19 
11:54:51 2015
@@ -347,23 +347,28 @@ static int clangTidyMain(int argc, const
 
 // This anchor is used to force the linker to link the LLVMModule.
 extern volatile int LLVMModuleAnchorSource;
-static int LLVM_ATTRIBUTE_UNUSED LLVMModuleAnchorDestination = 
LLVMModuleAnchorSource;
+static int LLVM_ATTRIBUTE_UNUSED LLVMModuleAnchorDestination =
+LLVMModuleAnchorSource;
 
 // This anchor is used to force the linker to link the GoogleModule.
 extern volatile int GoogleModuleAnchorSource;
-static int LLVM_ATTRIBUTE_UNUSED GoogleModuleAnchorDestination = 
GoogleModuleAnchorSource;
+static int LLVM_ATTRIBUTE_UNUSED GoogleModuleAnchorDestination =
+GoogleModuleAnchorSource;
 
 // This anchor is used to force the linker to link the MiscModule.
 extern volatile int MiscModuleAnchorSource;
-static int LLVM_ATTRIBUTE_UNUSED MiscModuleAnchorDestination = 
MiscModuleAnchorSource;
+static int LLVM_ATTRIBUTE_UNUSED MiscModuleAnchorDestination =
+MiscModuleAnchorSource;
 
 // This anchor is used to force the linker to link the ModernizeModule.
 extern volatile int ModernizeModuleAnchorSource;
-static int ModernizeModuleAnchorDestination = ModernizeModuleAnchorSource;
+static int LLVM_ATTRIBUTE_UNUSED ModernizeModuleAnchorDestination =
+ModernizeModuleAnchorSource;
 
 // This anchor is used to force the linker to link the ReadabilityModule.
 extern volatile int ReadabilityModuleAnchorSource;
-static int LLVM_ATTRIBUTE_UNUSED ReadabilityModuleAnchorDestination = 
ReadabilityModuleAnchorSource;
+static int LLVM_ATTRIBUTE_UNUSED ReadabilityModuleAnchorDestination =
+ReadabilityModuleAnchorSource;
 
 } // namespace tidy
 } // namespace clang


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


Re: [PATCH] D11963: Create a __config_site file to capture configuration decisions.

2015-08-19 Thread Eric Fiselier via cfe-commits
EricWF added a comment.

In http://reviews.llvm.org/D11963#227933, @jroelofs wrote:

 In http://reviews.llvm.org/D11963#227444, @EricWF wrote:

  I also just realized that this change will currently likely play havoc with 
  how libc++ and libc++abi build together. In order to build libc++ and 
  libc++abi together we would need to
 
  1. Configure libc++ pointing to the libc++abi headers in order to generate 
  the __config_site file.
  2. Configure libc++abi pointing it to the libc++ build directory for the 
  headers.
  3. build libc++abi
  4. build libc++
 
I'm not quite sure how this would work for an in-tree build.


 This patch, combined with http://reviews.llvm.org/D11964, works the way you 
 describe.


Wouldn't it still be a mess if you build both libc++ and libc++abi out-of-tree? 
The user would have to be aware of these weird requirements.


http://reviews.llvm.org/D11963



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


Re: FunctionDecl::getBody() returning nullptr

2015-08-19 Thread Aaron Ballman via cfe-commits
On Wed, Aug 19, 2015 at 11:33 AM, Aaron Ballman aa...@aaronballman.com wrote:
 When I run the following test code through clang-tidy -checks=*, I get
 a crash from some relatively strange behavior with FunctionDecl.

 template class T struct remove_reference  {typedef T type;};
 template class T struct remove_referenceT  {typedef T type;};
 template class T struct remove_referenceT {typedef T type;};

 template typename T
 typename remove_referenceT::type move(T arg) {
   return static_casttypename remove_referenceT::type(arg);
 }

 AnalysisConsumer::getModeForDecl() is called, and it has code that
 does: D-hasBody() ? D-getBody()-stuff : stuff;

 What's strange is that hasBody() returns true, but getBody() returns
 nullptr. I don't think that this should be possible. I'm wondering
 whether it's purposeful that hasBody() does not check
 Definition-Body?

Looking into this a bit further, the issue is that hasBody() checks
for Definition-Body *or* Definition-IsLateTemplateParsed when
deciding to return true. In my case, Body is null, but
IsLateTemplateParsed is true, so hasBody() returns true. However,
getBody() doesn't have any special logic for late template parsed
function bodies.

 Also, the FunctionDecl in question is for move(), which does have a
 body, so I do not understand why the definition would claim there is
 no body.

 Ideas, or should I file a bug report?

From my further look, I wonder if the correct solution to this is to
simply call getBody() and handle a nullptr return instead of calling
hasBody() first. It basically makes the check to ignore late parsed
template bodies an implicit one.

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


[PATCH] D12163: [Patch] [Analyzer] BugReporter.cpp:2869: Assertion failed: !RemainingNodes.empty() No error node found in the trimmed graph (PR 24184)

2015-08-19 Thread Ying Yi via cfe-commits
MaggieYi created this revision.
MaggieYi added a reviewer: krememek.
MaggieYi added a subscriber: cfe-commits.

Dear All,

I would like to propose a patch to solve an assertion failure reported by 
Dmitry in https://llvm.org/bugs/show_bug.cgi?id=24184.

The assertion is caused by reusing a “filler” ExplodedNode as an error node. 
The “filler” nodes are only used for intermediate processing and are not 
essential for analyzer history, so they can be reclaimed when the ExplodedGraph 
is trimmed by the “collectNode” function. When a checker finds a bug, they 
generate a new transition in the ExplodedGraph. The analyzer will try to reuse 
the existing predecessor node. If it cannot, it creates a new ExplodedNode, 
which always has a tag to uniquely identify the creation site. The assertion is 
caused when the analyzer reuses a “filler” node. 

In the test case, some “filler” nodes were reused and then reclaimed later when 
the ExplodedGraph was trimmed. This caused an assertion because the node was 
needed to generate the report. The “filler” nodes should not be reused as error 
nodes. The patch adds a constraint to prevent this happening, which solves the 
problem and makes the test cases pass. 

Please let me know if this is an acceptable patch.

Regards,

Ying Yi
SN Systems Ltd - Sony Computer Entertainment Group.

http://reviews.llvm.org/D12163

Files:
  include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h
  test/Analysis/PR24184.cpp
  test/Analysis/malloc.c

Index: test/Analysis/malloc.c
===
--- test/Analysis/malloc.c
+++ test/Analysis/malloc.c
@@ -1386,7 +1386,8 @@
   int *s;
   char *b = realloc(a-p, size);
   char *m = realloc(a-p, size); // expected-warning {{Attempt to free released memory}}
-  return a-p;
+  //PR24184: Object a-p was returned at next line after being freed by calling realloc at previous line.
+  return a-p; // expected-warning {{Use of memory after it is freed}}
 }
 
 // We should not warn in this case since the caller will presumably free a-p in all cases.
Index: test/Analysis/PR24184.cpp
===
--- /dev/null
+++ test/Analysis/PR24184.cpp
@@ -0,0 +1,97 @@
+// RUN: %clang_cc1 -w -analyze -analyzer-eagerly-assume -fcxx-exceptions -analyzer-checker=core -analyzer-checker=alpha.core.PointerArithm,alpha.core.CastToStruct -analyzer-max-loop 64 -verify %s
+// RUN: %clang_cc1 -w -analyze -analyzer-checker=core -analyzer-checker=cplusplus -fcxx-exceptions -analyzer-checker alpha.core.PointerArithm,alpha.core.CastToStruct -analyzer-max-loop 63 -verify %s
+
+// These tests used to hit an assertion in the bug report. Test case from http://llvm.org/PR24184.
+typedef struct {
+  int cbData;
+  unsigned pbData;
+} CRYPT_DATA_BLOB;
+
+typedef enum { DT_NONCE_FIXED } DATA_TYPE;
+int a;
+typedef int *vcreate_t(int *, DATA_TYPE, int, int);
+void fn1(unsigned, unsigned) {
+  char b = 0;
+  for (; 1; a++, b + a * 0) // expected-warning{{Pointer arithmetic done on non-array variables means reliance on memory layout, which is dangerous}}
+;
+}
+
+vcreate_t fn2;
+struct A {
+  CRYPT_DATA_BLOB value;
+  int m_fn1() {
+int c;
+value.pbData == 0;
+fn1(0, 0);
+  }
+};
+struct B {
+  A IkeHashAlg;
+  A IkeGType;
+  A NoncePhase1_r;
+};
+class C {
+  int m_fn2(B *);
+  void m_fn3(B *, int, int, int);
+};
+int C::m_fn2(B *p1) {
+  int *d;
+  int e = p1-IkeHashAlg.m_fn1();
+  unsigned f = p1-IkeGType.m_fn1(), h;
+  int g;
+  d = fn2(0, DT_NONCE_FIXED, (char)0, p1-NoncePhase1_r.value.cbData);
+  h = 0 | 0;
+  m_fn3(p1, 0, 0, 0);
+}
+
+// case 2:
+typedef struct {
+  int cbData;
+  unsigned char *pbData;
+} CRYPT_DATA_BLOB_1;
+typedef unsigned uint32_t;
+void fn1_1(void *p1, const void *p2) { p1 != p2; }
+
+void fn2_1(uint32_t *p1, unsigned char *p2, uint32_t p3) {
+  unsigned i = 0;
+  for (0; i  p3; i++)
+fn1_1(p1 + i, p2 + i * 0);// expected-warning{{Pointer arithmetic done on non-array variables means reliance on memory layout, which is dangerous}}
+}
+
+struct A_1 {
+  CRYPT_DATA_BLOB_1 value;
+  uint32_t m_fn1() {
+uint32_t a;
+if (value.pbData)
+  fn2_1(a, value.pbData, value.cbData);
+return 0;
+  }
+};
+struct {
+  A_1 HashAlgId;
+} *b;
+void fn3() {
+  uint32_t c, d;
+  d = b-HashAlgId.m_fn1();
+  d  0 | 0 | 0;
+  c = 0;
+  0 | 1  0 | 0  b;
+}
+
+// case 3:
+struct ST {
+  char c;
+};
+char *p;
+int foo1(ST);
+int foo2() {
+  ST *p1 = (ST *)(p);  // expected-warning{{Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption}}
+  while (p1-c  0x0F || p1-c  0x07)
+p1 = p1 + foo1(*p1);
+}
+
+int foo3(int *node) {
+  int i = foo2();
+  if (i)
+return foo2();
+}
\ No newline at end of file
Index: include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h
===
--- 

Re: [PATCH] D12157: Fix LoopConvertCheck bug.

2015-08-19 Thread Alexander Kornienko via cfe-commits
alexfh closed this revision.
alexfh added a comment.

Committed revision 245458.


http://reviews.llvm.org/D12157



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


Re: r245084 - WindowsX86: long double is x87DoubleExtended on mingw

2015-08-19 Thread Yaron Keren via cfe-commits
Sorry to notice late (just diagnosed the issue from a failing boost::math
test), according to i686 ABI, long double size on x86 is 12 bytes (the
memory allocated, not the underlying 80 bits register), see

https://gcc.gnu.org/onlinedocs/gcc-3.2/gcc/i386-and-x86-64-Options.html

-m128bit-long-double
Control the size of long double type. i386 application binary interface
specify the size to be 12 bytes, while modern architectures (Pentium and
newer) prefer long double aligned to 8 or 16 byte boundary. This is
impossible to reach with 12 byte long doubles in the array accesses.
Warning: if you use the -m128bit-long-double switch, the structures and
arrays containing long double will change their size as well as function
calling convention for function taking long double will be modified.

-m96bit-long-double
Set the size of long double to 96 bits as required by the i386 application
binary interface. This is the default.


You can check long double size out by running

#include iostream
int main() {
  long double a;
  std::coutsizeof(a)std::endl;
}

which outputs 12 with mingw 32 bit, 16 with mingw 64 bit but always 16 with
current clang.
I fixed this and added test in r245459+r245462.


2015-08-19 19:41 GMT+03:00 Hans Wennborg via cfe-commits 
cfe-commits@lists.llvm.org:

 On Tue, Aug 18, 2015 at 6:11 PM, Richard Smith rich...@metafoo.co.uk
 wrote:
  On Tue, Aug 18, 2015 at 3:01 PM, Hans Wennborg h...@chromium.org
 wrote:
 
  Richard, I tried to ping you on the review thread but I'm not sure it
  got through. Martell requested this be merged to 3.7. What do you
  think?
 
 
  LGTM

 Thanks! r245456.

 
 
  On Fri, Aug 14, 2015 at 12:05 PM, Martell Malone via cfe-commits
  cfe-commits@lists.llvm.org wrote:
   Author: martell
   Date: Fri Aug 14 14:05:56 2015
   New Revision: 245084
  
   URL: http://llvm.org/viewvc/llvm-project?rev=245084view=rev
   Log:
   WindowsX86: long double is x87DoubleExtended on mingw
  
   Summary:
   long double on x86 mingw is 80bits and is aligned to 16bytes
  
   Fixes:
   https://llvm.org/bugs/show_bug.cgi?id=24398
  
   Reviewers: rnk
  
   Subscribers: cfe-commits
  
   Differential Revision: http://reviews.llvm.org/D12037
  
   Modified:
   cfe/trunk/lib/Basic/Targets.cpp
  
   Modified: cfe/trunk/lib/Basic/Targets.cpp
   URL:
  
 http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=245084r1=245083r2=245084view=diff
  
  
 ==
   --- cfe/trunk/lib/Basic/Targets.cpp (original)
   +++ cfe/trunk/lib/Basic/Targets.cpp Fri Aug 14 14:05:56 2015
   @@ -3784,7 +3784,10 @@ namespace {
class MinGWX86_32TargetInfo : public WindowsX86_32TargetInfo {
public:
  MinGWX86_32TargetInfo(const llvm::Triple Triple)
   -  : WindowsX86_32TargetInfo(Triple) {}
   +  : WindowsX86_32TargetInfo(Triple) {
   +LongDoubleWidth = LongDoubleAlign = 128;
   +LongDoubleFormat = llvm::APFloat::x87DoubleExtended;
   +  }
  void getTargetDefines(const LangOptions Opts,
MacroBuilder Builder) const override {
WindowsX86_32TargetInfo::getTargetDefines(Opts, Builder);
   @@ -4014,7 +4017,10 @@ public:
class MinGWX86_64TargetInfo : public WindowsX86_64TargetInfo {
public:
  MinGWX86_64TargetInfo(const llvm::Triple Triple)
   -  : WindowsX86_64TargetInfo(Triple) {}
   +  : WindowsX86_64TargetInfo(Triple) {
   +LongDoubleWidth = LongDoubleAlign = 128;
   +LongDoubleFormat = llvm::APFloat::x87DoubleExtended;
   +  }
  void getTargetDefines(const LangOptions Opts,
MacroBuilder Builder) const override {
WindowsX86_64TargetInfo::getTargetDefines(Opts, Builder);
  
  
   ___
   cfe-commits mailing list
   cfe-commits@lists.llvm.org
   http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
 
 
 ___
 cfe-commits mailing list
 cfe-commits@lists.llvm.org
 http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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


[libcxx] r245463 - [libcxx] Allow use of atomic in C++03. Try 3.

2015-08-19 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Wed Aug 19 12:21:46 2015
New Revision: 245463

URL: http://llvm.org/viewvc/llvm-project?rev=245463view=rev
Log:
[libcxx] Allow use of atomic in C++03. Try 3.

Summary:
After putting this question up on cfe-dev I have decided that it would be best 
to allow the use of `atomic` in C++03. Although static initialization is a 
concern the syntax required to get it is C++11 only. Meaning that C++11 
constant static initialization cannot silently break in C++03, it will always 
cause a syntax error. Furthermore `ATOMIC_VAR_INIT` and `ATOMIC_FLAG_INIT` 
remain defined in C++03 even though they cannot be used because C++03 usages 
will cause better error messages.

The main change in this patch is to replace `__has_feature(cxx_atomic)`, which 
only returns true when C++ = 11, to `__has_extension(c_atomic)` which returns 
true whenever clang supports the required atomic builtins.


This patch adds the following macros:
* `_LIBCPP_HAS_C_ATOMIC_IMP`  - Defined on clang versions which provide the 
C `_Atomic` keyword.
* `_LIBCPP_HAS_GCC_ATOMIC_IMP` - Defined on GCC  4.7. We must use the fallback 
atomic implementation.
* `_LIBCPP_HAS_NO_ATOMIC_HEADER` - Defined when it is not safe to include 
`atomic`.

`_LIBCPP_HAS_C_ATOMIC_IMP` and `_LIBCPP_HAS_GCC_ATOMIC_IMP` are mutually 
exclusive, only one should be defined. If neither is defined then `atomic` is 
not implemented and including `atomic` will issue an error.

Reviewers: chandlerc, jroelofs, mclow.lists

Subscribers: cfe-commits

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

Added:
libcxx/trunk/test/std/atomics/atomics.flag/init03.pass.cpp

libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_helpers.h
Modified:
libcxx/trunk/include/__config
libcxx/trunk/include/atomic
libcxx/trunk/include/ios
libcxx/trunk/include/memory
libcxx/trunk/src/ios.cpp
libcxx/trunk/src/memory.cpp
libcxx/trunk/test/std/atomics/atomics.flag/atomic_flag_clear.pass.cpp

libcxx/trunk/test/std/atomics/atomics.flag/atomic_flag_clear_explicit.pass.cpp
libcxx/trunk/test/std/atomics/atomics.flag/clear.pass.cpp
libcxx/trunk/test/std/atomics/atomics.flag/init.pass.cpp

libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong.pass.cpp

libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong_explicit.pass.cpp

libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak.pass.cpp

libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak_explicit.pass.cpp

libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_exchange.pass.cpp

libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_exchange_explicit.pass.cpp

libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add.pass.cpp

libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add_explicit.pass.cpp

libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_and.pass.cpp

libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_and_explicit.pass.cpp

libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_or.pass.cpp

libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_or_explicit.pass.cpp

libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub.pass.cpp

libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub_explicit.pass.cpp

libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_xor.pass.cpp

libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_xor_explicit.pass.cpp

libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_init.pass.cpp

libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_is_lock_free.pass.cpp

libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load.pass.cpp

libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load_explicit.pass.cpp

libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_store.pass.cpp

libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_store_explicit.pass.cpp

libcxx/trunk/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_var_init.pass.cpp


[clang-tools-extra] r245484 - Replacing a custom AST matcher with some builtin AST matchers; NFC, and existing tests should provide sufficient coverage.

2015-08-19 Thread Aaron Ballman via cfe-commits
Author: aaronballman
Date: Wed Aug 19 14:29:23 2015
New Revision: 245484

URL: http://llvm.org/viewvc/llvm-project?rev=245484view=rev
Log:
Replacing a custom AST matcher with some builtin AST matchers; NFC, and 
existing tests should provide sufficient coverage.

Modified:
clang-tools-extra/trunk/clang-modernize/PassByValue/PassByValueMatchers.cpp

Modified: 
clang-tools-extra/trunk/clang-modernize/PassByValue/PassByValueMatchers.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-modernize/PassByValue/PassByValueMatchers.cpp?rev=245484r1=245483r2=245484view=diff
==
--- clang-tools-extra/trunk/clang-modernize/PassByValue/PassByValueMatchers.cpp 
(original)
+++ clang-tools-extra/trunk/clang-modernize/PassByValue/PassByValueMatchers.cpp 
Wed Aug 19 14:29:23 2015
@@ -44,19 +44,6 @@ AST_MATCHER(CXXRecordDecl, isMoveConstru
   }
   return false;
 }
-
-/// \brief Matches non-deleted copy constructors.
-///
-/// Given
-/// \code
-///   struct Foo { Foo(const Foo ) = default; };
-///   struct Bar { Bar(const Bar ) = deleted; };
-/// \endcode
-/// constructorDecl(isNonDeletedCopyConstructor())
-///   matches Foo(const Foo ).
-AST_MATCHER(CXXConstructorDecl, isNonDeletedCopyConstructor) {
-  return Node.isCopyConstructor()  !Node.isDeleted();
-}
 } // namespace ast_matchers
 } // namespace clang
 
@@ -87,7 +74,7 @@ DeclarationMatcher makePassByValueCtorPa
   anyOf(constRefType(), nonConstValueType()
   .bind(PassByValueParamId,
   hasDeclaration(constructorDecl(
-  isNonDeletedCopyConstructor(),
+  isCopyConstructor(), unless(isDeleted()),
   hasDeclContext(recordDecl(isMoveConstructible(
 .bind(PassByValueInitializerId)))
   .bind(PassByValueCtorId);


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


Re: [PATCH] D12143: [X86][AVX2] Replace avx2.pbroadcast / avx2.vbroadcast intrinsics usage in avx2intrin.h with __builtin_shufflevector

2015-08-19 Thread Simon Pilgrim via cfe-commits
RKSimon abandoned this revision.
RKSimon added a comment.

In http://reviews.llvm.org/D12143#228006, @ab wrote:

 Heh, this is http://reviews.llvm.org/D10556, no? :P


Yes you're right (and you remembered to kill the builtin defs) - please can you 
add some more reviewers so that we can get it dealt with along with 
http://reviews.llvm.org/D10555?


Repository:
  rL LLVM

http://reviews.llvm.org/D12143



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


Re: [PATCH] D11958: Add a -gmodules option to the clang driver.

2015-08-19 Thread David Blaikie via cfe-commits
On Tue, Aug 11, 2015 at 1:49 PM, Adrian Prantl apra...@apple.com wrote:

 aprantl created this revision.
 aprantl added reviewers: dblaikie, echristo.
 aprantl added a subscriber: cfe-commits.
 aprantl set the repository for this revision to rL LLVM.

 This patch adds a -gmodules option to the driver and a -dwarf-ext-refs to
 cc1 to enable the use of external type references in the debug info (a.k.a.
 module debugging).

 The driver expands -gmodules to -g -fmodule-format=obj -dwarf-ext-refs
 and passes that to cc1.
 Most options that start with -g (e.g., -gdwarf-2) also turn on -g, and
 module requires object-container-wrapped modules, -dwarf-ext-refs been
 the actual low-level option for turning on external type references.

 Rationale for the choice of names (and this is really all there is to
 review in this patch):
 -gmodules: is meant to pair nicely with -fmodules
 -dwarf-ext-refs: Fits into the naming scheme of similar options like
 -dwarf-column-info and -dwarf-debug-flags. Spelling out the option
 -dwarf-external-type-references seemed to be overkill.


Sounds reasonable - and the flag will be for more than just types
eventually anyway (specifically references to members (functions, etc) of
types too).


 All this does at the moment is set a flag codegenopts. Having this flag in
 place is a prerequisite for emitting debug info into modules: The debug
 info for a module needs to use external type references for types defined
 in (other) modules or we would violate the minimal deserialization
 requirements (cf. test/PCH/check-deserializations.cpp).


Could you explain what you mean by violate the minimal deserialization
requirements

Mechanically, the patch looks fine/exactly what you'd expect. Feel free to
commit whenever you're ready.



 Repository:
   rL LLVM

 http://reviews.llvm.org/D11958

 Files:
   docs/CommandGuide/clang.rst
   include/clang/Driver/CC1Options.td
   include/clang/Driver/Options.td
   include/clang/Frontend/CodeGenOptions.def
   lib/CodeGen/CGDebugInfo.cpp
   lib/CodeGen/CGDebugInfo.h
   lib/CodeGen/ObjectFilePCHContainerOperations.cpp
   lib/Driver/Tools.cpp
   lib/Frontend/CompilerInvocation.cpp
   test/Driver/debug-options.c


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


Re: [PATCH] D12128: Generating available_externally vtables bugfix

2015-08-19 Thread Piotr Padlewski via cfe-commits
Prazek updated this revision to Diff 32587.

http://reviews.llvm.org/D12128

Files:
  include/clang/AST/VTableBuilder.h
  lib/CodeGen/ItaniumCXXABI.cpp
  test/CodeGenCXX/vtable-available-externally.cpp

Index: test/CodeGenCXX/vtable-available-externally.cpp
===
--- test/CodeGenCXX/vtable-available-externally.cpp
+++ test/CodeGenCXX/vtable-available-externally.cpp
@@ -7,6 +7,10 @@
 // RUN: FileCheck --check-prefix=CHECK-TEST9 %s  %t.opt
 // RUN: FileCheck --check-prefix=CHECK-TEST10 %s  %t.opt
 // RUN: FileCheck --check-prefix=CHECK-TEST11 %s  %t.opt
+// RUN: FileCheck --check-prefix=CHECK-TEST12 %s  %t.opt
+// RUN: FileCheck --check-prefix=CHECK-TEST13 %s  %t.opt
+// RUN: FileCheck --check-prefix=CHECK-TEST14 %s  %t.opt
+// RUN: FileCheck --check-prefix=CHECK-TEST15 %s  %t.opt
 
 #include typeinfo
 
@@ -289,3 +293,76 @@
   g(d);
 }
 }  // Test 11
+
+namespace Test12 {
+
+// CHECK-TEST12: @_ZTVN6Test121AE = external unnamed_addr constant
+struct A {
+  virtual void foo();
+  virtual ~A() {}
+};
+// CHECK-TEST12: @_ZTVN6Test121BE = external unnamed_addr constant
+struct B : A {
+  void foo();
+};
+
+void g() {
+  A a;
+  a.foo();
+  B b;
+  b.foo();
+}
+}
+
+namespace Test13 {
+
+// CHECK-TEST13-DAG: @_ZTVN6Test131AE = available_externally unnamed_addr constant
+// CHECK-TEST13-DAG: @_ZTVN6Test131BE = external unnamed_addr constant
+struct A {
+  virtual ~A();
+};
+struct B : A {
+  virtual void f();
+  void operator delete(void *);
+  ~B() {}
+};
+
+void g() {
+  A *b = new B;
+}
+}
+
+namespace Test14 {
+
+// CHECK-TEST14: @_ZTVN6Test141AE = available_externally unnamed_addr constant
+struct A {
+  virtual void f();
+  void operator delete(void *);
+  ~A();
+};
+
+void g() {
+  A *b = new A;
+  delete b;
+}
+}
+
+namespace Test15 {
+// In this test D's vtable has two slots for function f(), but uses only one,
+// so the second slot is set to null.
+// CHECK-TEST15: @_ZTVN6Test151DE = available_externally unnamed_addr constant
+struct A { virtual void f() {} };
+struct B : virtual A {};
+struct C : virtual A {};
+struct D : B, C {
+  virtual void g();
+  void f();
+};
+
+void test() {
+  D * d = new D;
+  d-f();
+}
+}
+
+
Index: lib/CodeGen/ItaniumCXXABI.cpp
===
--- lib/CodeGen/ItaniumCXXABI.cpp
+++ lib/CodeGen/ItaniumCXXABI.cpp
@@ -320,17 +320,15 @@
   void emitCXXStructor(const CXXMethodDecl *MD, StructorType Type) override;
 
  private:
-  /// Checks if function has any virtual inline function.
-  bool hasAnyVirtualInlineFunction(const CXXRecordDecl *RD) const {
+   bool hasAnyUsedVirtualInlineFunction(const CXXRecordDecl *RD) const {
 const auto VtableLayout =
 CGM.getItaniumVTableContext().getVTableLayout(RD);
 
 for (const auto VtableComponent : VtableLayout.vtable_components()) {
-  if (VtableComponent.getKind() !=
-  VTableComponent::Kind::CK_FunctionPointer)
+  if (!VtableComponent.isUsedFunctionPointerKind())
 continue;
 
-  const auto Method = VtableComponent.getFunctionDecl();
+  const CXXMethodDecl *Method = VtableComponent.getFunctionDecl();
   if (Method-getCanonicalDecl()-isInlined())
 return true;
 }
@@ -1536,7 +1534,7 @@
   // then we are safe to emit available_externally copy of vtable.
   // FIXME we can still emit a copy of the vtable if we
   // can emit definition of the inline functions.
-  return !hasAnyVirtualInlineFunction(RD);
+  return !hasAnyUsedVirtualInlineFunction(RD);
 }
 static llvm::Value *performTypeAdjustment(CodeGenFunction CGF,
   llvm::Value *Ptr,
Index: include/clang/AST/VTableBuilder.h
===
--- include/clang/AST/VTableBuilder.h
+++ include/clang/AST/VTableBuilder.h
@@ -123,30 +123,50 @@
 
   const CXXRecordDecl *getRTTIDecl() const {
 assert(getKind() == CK_RTTI  Invalid component kind!);
-
 return reinterpret_castCXXRecordDecl *(getPointer());
   }
 
   const CXXMethodDecl *getFunctionDecl() const {
-assert(getKind() == CK_FunctionPointer);
-
+assert(isFunctionPointerKind()  Invalid component kind!);
+if (isDestructorKind())
+  return getDestructorDecl();
 return reinterpret_castCXXMethodDecl *(getPointer());
   }
 
   const CXXDestructorDecl *getDestructorDecl() const {
-assert((getKind() == CK_CompleteDtorPointer ||
-getKind() == CK_DeletingDtorPointer)  Invalid component kind!);
-
+assert(isDestructorKind()  Invalid component kind!);
 return reinterpret_castCXXDestructorDecl *(getPointer());
   }
 
   const CXXMethodDecl *getUnusedFunctionDecl() const {
-assert(getKind() == CK_UnusedFunctionPointer);
-
+assert(getKind() == CK_UnusedFunctionPointer  Invalid component kind!);
 return reinterpret_castCXXMethodDecl *(getPointer());
   }
 
+  bool isDestructorKind() const { return isDestructorKind(getKind()); }
+

Re: [PATCH] D10556: [Headers][X86] Replace avx2.pbroadcast intrinsics with native IR.

2015-08-19 Thread Sanjay Patel via cfe-commits
spatel accepted this revision.
spatel added a comment.
This revision is now accepted and ready to land.

LGTM.
See discussion in http://reviews.llvm.org/D10555.


http://reviews.llvm.org/D10556



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


Re: [PATCH] D11958: Add a -gmodules option to the clang driver.

2015-08-19 Thread Adrian Prantl via cfe-commits

 On Aug 19, 2015, at 1:12 PM, David Blaikie dblai...@gmail.com wrote:
 
 
 
 On Tue, Aug 11, 2015 at 1:49 PM, Adrian Prantl apra...@apple.com 
 mailto:apra...@apple.com wrote:
 aprantl created this revision.
 aprantl added reviewers: dblaikie, echristo.
 aprantl added a subscriber: cfe-commits.
 aprantl set the repository for this revision to rL LLVM.
 
 This patch adds a -gmodules option to the driver and a -dwarf-ext-refs to cc1 
 to enable the use of external type references in the debug info (a.k.a. 
 module debugging).
 
 The driver expands -gmodules to -g -fmodule-format=obj -dwarf-ext-refs and 
 passes that to cc1.
 Most options that start with -g (e.g., -gdwarf-2) also turn on -g, and module 
 requires object-container-wrapped modules, -dwarf-ext-refs been the actual 
 low-level option for turning on external type references.
 
 Rationale for the choice of names (and this is really all there is to review 
 in this patch):
 -gmodules: is meant to pair nicely with -fmodules
 -dwarf-ext-refs: Fits into the naming scheme of similar options like 
 -dwarf-column-info and -dwarf-debug-flags. Spelling out the option 
 -dwarf-external-type-references seemed to be overkill.
 
 Sounds reasonable - and the flag will be for more than just types eventually 
 anyway (specifically references to members (functions, etc) of types too).
  
 All this does at the moment is set a flag codegenopts. Having this flag in 
 place is a prerequisite for emitting debug info into modules: The debug info 
 for a module needs to use external type references for types defined in 
 (other) modules or we would violate the minimal deserialization requirements 
 (cf. test/PCH/check-deserializations.cpp).
 
 Could you explain what you mean by violate the minimal deserialization 
 requirements”

There are tests in the testsuite to ensure that when deserializing a type from 
a module, only the bare minimum is actually deserialized. For example:

a.h
class A {};

b.h
class B { A a; };

When emitting debug info for B we need to emit an external reference for A 
instead of recursively emitting A (and thus “illegally” deserializing A from 
a.pcm).

 
 Mechanically, the patch looks fine/exactly what you'd expect. Feel free to 
 commit whenever you're ready.

thanks,
adrian

  
 
 Repository:
   rL LLVM
 
 http://reviews.llvm.org/D11958 
 https://urldefense.proofpoint.com/v2/url?u=http-3A__reviews.llvm.org_D11958d=BQMFaQc=eEvniauFctOgLOKGJOplqwr=cTx6f1tAfqPeajYunFWp7_8ot79RnHyNteqzig4fXmAm=OYlTn71sx_aJ_kkl6dcJDmmGe2SZ2AOMtPSiptwqe3Ms=9Oww56T9mtLMfzpO0B3gFzdboCnRX1kVMs8QUq18Tpwe=
 
 Files:
   docs/CommandGuide/clang.rst
   include/clang/Driver/CC1Options.td
   include/clang/Driver/Options.td
   include/clang/Frontend/CodeGenOptions.def
   lib/CodeGen/CGDebugInfo.cpp
   lib/CodeGen/CGDebugInfo.h
   lib/CodeGen/ObjectFilePCHContainerOperations.cpp
   lib/Driver/Tools.cpp
   lib/Frontend/CompilerInvocation.cpp
   test/Driver/debug-options.c

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


Fwd: [PATCH] Have clang list the imported modules in the debug info

2015-08-19 Thread David Blaikie via cfe-commits
(add the right list)
-- Forwarded message --
From: David Blaikie dblai...@gmail.com
Date: Wed, Aug 19, 2015 at 1:20 PM
Subject: Re: [PATCH] Have clang list the imported modules in the debug info
To: Adrian Prantl apra...@apple.com
Cc: Eric Christopher echri...@gmail.com, Zachary Turner 
ztur...@google.com, Robinson, Paul paul_robin...@playstation.sony.com,
Richard Smith rich...@metafoo.co.uk, llvm cfe cfe-comm...@cs.uiuc.edu,
Greg Clayton gclay...@apple.com, Sean Callanan scalla...@apple.com




On Mon, Aug 10, 2015 at 5:00 PM, Adrian Prantl apra...@apple.com wrote:


 On Jul 24, 2015, at 12:33 PM, David Blaikie dblai...@gmail.com wrote:

 *reads back through the thread*


 appreciated, it’s long :-)

 So what I originally had in mind about a year ago when we discussed this,
 was that the module data could have an extra table from type hash to
 whatever useful internal representation to find the type in the PCM.


 It turned out that the most useful internal type representation to find a
 type in a PCM is the type’s DeclContext+Name; this is how (surprise!) clang
 looks up types in a PCM and the format is supposed to be fast for these
 kind of lookups.


Still, I would imagine there would be some kind of direct access (the
offset in the file, or somesuch) rather than actually having to go through
hashtables, etc. No? (how does one module refer to types in another module?
Really by name?)



 Everything else would just be DWARF with type units and fission (with the
 slight wrinkle of type units that aren't resolvable within a single object
 file - they could reference cross-object/dwo file) - emitting a fission CU
 for each referenced module.

 Needing modules to disambiguate/avoid collisions/support non-odr languages
 wasn't something I understood/had considered back then. That explains the
 need to add module references to the CU, so the debugger can know which
 modules to search for the types in ( doesn't just go loading all of them,
 etc).

 I would still picture this as normal type units + a table in the module
 to resolve types, but if you guys particularly like using the mangled
 string name (or other identifier) in the DWARF that may avoid the need for
 an intermediate table (but it doesn't sound like you are avoiding an
 intermediate table - you said something about having an
 accelerator-table-like thing to aid in the DWARF-AST mapping? So could
 that be key'd of the type hash/signature we're using, thus keeping the
 DWARF more plain/vanilla DWARF5 (type units + fission)?)


 I originally disliked type signatures and favored using mangled names
 because the mangled names contained the DeclContext necessary to find types
 in the PCM. But if we can squeeze the DeclContext somewhere else, that’s
 fine.

 From the discussion we had on FlagExternalTypeRef I got the impression
 that long-form forward declarations are starting to look more attractive:
 If every external type reference is a reference to a forward declaration
 that has a complete decl context,


While that's conveniently what we output currently, I'm not sure it's a
great idea to rely on it. We might one day optimize type references (
we'll certainly need to optimize non-type references like member functions,
etc - since emitting a stub for those would start to, more visibly, reduce
the benefit of doing this work in the first place, I would imagine) so that
when there's no contents (which will be more common once we can reference
members directly with Bag O DWARF) we just have a DW_AT_type encoded as a
DW_FORM_ref_sig8 directly.

with a DW_TAG_module at the root of the decl context chain,


This ^ is something I didn't have in mind and would complicate things
somewhat. I'd really like to keep things as close to the existing standard
type unit + split dwarf standards as possible except where necessary to do
otherwise.


 and a DW_AT_name+DW_AT_signature at the other end, we would have all the
 information we need without introducing any further LLVM-specific DWARF
 extensions. To look up an external type from the PCM, the consumer imports
 the DW_TAG_module and deserializes the type found by declcontext+name. To
 load the type from DWARF, the consumer grabs the signature from the forward
 declaration and magically (1) finds the PCM and looks up the type by
 signature (2).

 (1) My suggestion is to extend LLVM so it can put the DW_TAG_module with
 the forward declaration inside the skeleton compile unit (which has the
 path to the PCM and its DWOid).
 (2) On ELF with type units this works out of the box,


Not necessarily - the use of DW_TAG_modules in the scope chain might
confuse/break things. It's pretty unprecedented/non-standard, I would think?


 on MachO without type units we need some kind of index mapping signature
 - DIE (bag of DWARF style?).


I was rather hoping you guys would implement type units (since they'll be a
step towards Bag O DWARF anyway) on MachO... - at least for this case. They
wouldn't have to be 

Re: r245459 - According to i686 ABI, long double size on x86 is 12 bytes not 16 bytes.

2015-08-19 Thread Yaron Keren via cfe-commits
Yes, it looks like a legacy issue. Documentation says so:

*https://gcc.gnu.org/onlinedocs/gcc-4.8.2/gcc/i386-and-x86-64-Options.html
https://gcc.gnu.org/onlinedocs/gcc-4.8.2/gcc/i386-and-x86-64-Options.html*

-m96bit-long-double-m128bit-long-doubleThese switches control the size of long
double type. The i386 application binary interface specifies the size to be
96 bits, so -m96bit-long-double is the default in 32-bit mode.

Modern architectures (Pentium and newer) prefer long double to be aligned
to an 8- or 16-byte boundary. In arrays or structures conforming to the
ABI, this is not possible. So specifying -m128bit-long-double aligns long
double to a 16-byte boundary by padding the long double with an additional
32-bit zero.

In the x86-64 compiler, -m128bit-long-double is the default choice as its
ABI specifies that long double is aligned on 16-byte boundary.

Notice that neither of these options enable any extra precision over the
x87 standard of 80 bits for a long double.

*Warning:* if you override the default value for your target ABI, this
changes the size of structures and arrays containing long double variables,
as well as modifying the function calling convention for functions taking long
double. Hence they are not binary-compatible with code compiled without
that switch.

And practical testing agrees:

sh-4.3$ cat  a.cpp
#include iostream
int main() {
  long double a;
  std::coutsizeof(a)std::endl;
}
sh-4.3$ g++ -v
Using built-in specs.
COLLECT_GCC=C:\mingw32\bin\g++.exe
COLLECT_LTO_WRAPPER=C:/mingw32/bin/../libexec/gcc/i686-w64-mingw32/5.1.0/lto-wrapper.exe
Target: i686-w64-mingw32
Configured with: ../../../src/gcc-5.1.0/configure --host=i686-w64-mingw32
--build=i686-w64-mingw32 --target=i686-w64-mingw32 --prefix=/mingw32
--with-sysroot=/c/mingw510/i686-510-posix-dwarf-rt_v4-rev0/mingw32
--with-gxx-include-dir=/mingw32/i686-w64-mingw32/include/c++
--enable-shared --enable-static --disable-multilib
--enable-languages=c,c++,fortran,objc,obj-c++,lto
--enable-libstdcxx-time=yes --enable-threads=posix --enable-libgomp
--enable-libatomic --enable-lto --enable-graphite --enable-checking=release
--enable-fully-dynamic-string --enable-version-specific-runtime-libs
--disable-sjlj-exceptions --with-dwarf2 --disable-isl-version-check
--disable-libstdcxx-pch --disable-libstdcxx-debug --enable-bootstrap
--disable-rpath --disable-win32-registry --disable-nls --disable-werror
--disable-symvers --with-gnu-as --with-gnu-ld --with-arch=i686
--with-tune=generic --with-libiconv --with-system-zlib
--with-gmp=/c/mingw510/prerequisites/i686-w64-mingw32-static
--with-mpfr=/c/mingw510/prerequisites/i686-w64-mingw32-static
--with-mpc=/c/mingw510/prerequisites/i686-w64-mingw32-static
--with-isl=/c/mingw510/prerequisites/i686-w64-mingw32-static
--with-pkgversion='i686-posix-dwarf-rev0, Built by MinGW-W64 project'
--with-bugurl=http://sourceforge.net/projects/mingw-w64 CFLAGS='-O2 -pipe
-I/c/mingw510/i686-510-posix-dwarf-rt_v4-rev0/mingw32/opt/include
-I/c/mingw510/prerequisites/i686-zlib-static/include
-I/c/mingw510/prerequisites/i686-w64-mingw32-static/include' CXXFLAGS='-O2
-pipe -I/c/mingw510/i686-510-posix-dwarf-rt_v4-rev0/mingw32/opt/include
-I/c/mingw510/prerequisites/i686-zlib-static/include
-I/c/mingw510/prerequisites/i686-w64-mingw32-static/include' CPPFLAGS=
LDFLAGS='-pipe
-L/c/mingw510/i686-510-posix-dwarf-rt_v4-rev0/mingw32/opt/lib
-L/c/mingw510/prerequisites/i686-zlib-static/lib
-L/c/mingw510/prerequisites/i686-w64-mingw32-static/lib
-Wl,--large-address-aware'
Thread model: posix
gcc version 5.1.0 (i686-posix-dwarf-rev0, Built by MinGW-W64 project)

sh-4.3$ g++ a.cpp
sh-4.3$ ./a.exe
12

Without the patch clang outputs 16 and seg faults on a boost::math example.


2015-08-19 21:29 GMT+03:00 Richard Smith rich...@metafoo.co.uk:

 On Wed, Aug 19, 2015 at 10:02 AM, Yaron Keren via cfe-commits 
 cfe-commits@lists.llvm.org wrote:

 Author: yrnkrn
 Date: Wed Aug 19 12:02:32 2015
 New Revision: 245459

 URL: http://llvm.org/viewvc/llvm-project?rev=245459view=rev
 Log:
 According to i686 ABI, long double size on x86 is 12 bytes not 16 bytes.
 See
  https://gcc.gnu.org/onlinedocs/gcc-3.2/gcc/i386-and-x86-64-Options.html


 Added:
 cfe/trunk/test/CodeGen/mingw-long-double-size.c
 Modified:
 cfe/trunk/lib/Basic/Targets.cpp

 Modified: cfe/trunk/lib/Basic/Targets.cpp
 URL:
 http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=245459r1=245458r2=245459view=diff

 ==
 --- cfe/trunk/lib/Basic/Targets.cpp (original)
 +++ cfe/trunk/lib/Basic/Targets.cpp Wed Aug 19 12:02:32 2015
 @@ -3785,7 +3785,8 @@ class MinGWX86_32TargetInfo : public Win
  public:
MinGWX86_32TargetInfo(const llvm::Triple Triple)
: WindowsX86_32TargetInfo(Triple) {
 -LongDoubleWidth = LongDoubleAlign = 128;
 +LongDoubleWidth = 96;
 +LongDoubleAlign = 128;


 Is this really correct? It's deeply suspicious that the size is not a
 

r245489 - Generating available_externally vtables bugfix

2015-08-19 Thread Piotr Padlewski via cfe-commits
Author: prazek
Date: Wed Aug 19 15:09:09 2015
New Revision: 245489

URL: http://llvm.org/viewvc/llvm-project?rev=245489view=rev
Log:
Generating available_externally vtables bugfix

Bugfix revealed in r245264.

http://reviews.llvm.org/D12128

Modified:
cfe/trunk/include/clang/AST/VTableBuilder.h
cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
cfe/trunk/test/CodeGenCXX/vtable-available-externally.cpp

Modified: cfe/trunk/include/clang/AST/VTableBuilder.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/VTableBuilder.h?rev=245489r1=245488r2=245489view=diff
==
--- cfe/trunk/include/clang/AST/VTableBuilder.h (original)
+++ cfe/trunk/include/clang/AST/VTableBuilder.h Wed Aug 19 15:09:09 2015
@@ -123,30 +123,50 @@ public:
 
   const CXXRecordDecl *getRTTIDecl() const {
 assert(getKind() == CK_RTTI  Invalid component kind!);
-
 return reinterpret_castCXXRecordDecl *(getPointer());
   }
 
   const CXXMethodDecl *getFunctionDecl() const {
-assert(getKind() == CK_FunctionPointer);
-
+assert(isFunctionPointerKind()  Invalid component kind!);
+if (isDestructorKind())
+  return getDestructorDecl();
 return reinterpret_castCXXMethodDecl *(getPointer());
   }
 
   const CXXDestructorDecl *getDestructorDecl() const {
-assert((getKind() == CK_CompleteDtorPointer ||
-getKind() == CK_DeletingDtorPointer)  Invalid component kind!);
-
+assert(isDestructorKind()  Invalid component kind!);
 return reinterpret_castCXXDestructorDecl *(getPointer());
   }
 
   const CXXMethodDecl *getUnusedFunctionDecl() const {
-assert(getKind() == CK_UnusedFunctionPointer);
-
+assert(getKind() == CK_UnusedFunctionPointer  Invalid component kind!);
 return reinterpret_castCXXMethodDecl *(getPointer());
   }
 
+  bool isDestructorKind() const { return isDestructorKind(getKind()); }
+
+  bool isUsedFunctionPointerKind() const {
+return isUsedFunctionPointerKind(getKind());
+  }
+
+  bool isFunctionPointerKind() const {
+return isFunctionPointerKind(getKind());
+  }
+
 private:
+  static bool isFunctionPointerKind(Kind ComponentKind) {
+return isUsedFunctionPointerKind(ComponentKind) ||
+   ComponentKind == CK_UnusedFunctionPointer;
+  }
+  static bool isUsedFunctionPointerKind(Kind ComponentKind) {
+return ComponentKind == CK_FunctionPointer ||
+   isDestructorKind(ComponentKind);
+  }
+  static bool isDestructorKind(Kind ComponentKind) {
+return ComponentKind == CK_CompleteDtorPointer ||
+   ComponentKind == CK_DeletingDtorPointer;
+  }
+
   VTableComponent(Kind ComponentKind, CharUnits Offset) {
 assert((ComponentKind == CK_VCallOffset ||
 ComponentKind == CK_VBaseOffset ||
@@ -158,12 +178,8 @@ private:
   }
 
   VTableComponent(Kind ComponentKind, uintptr_t Ptr) {
-assert((ComponentKind == CK_RTTI ||
-ComponentKind == CK_FunctionPointer ||
-ComponentKind == CK_CompleteDtorPointer ||
-ComponentKind == CK_DeletingDtorPointer ||
-ComponentKind == CK_UnusedFunctionPointer) 
-Invalid component kind!);
+assert((ComponentKind == CK_RTTI || isFunctionPointerKind(ComponentKind)) 

+   Invalid component kind!);
 
 assert((Ptr  7) == 0  Pointer not sufficiently aligned!);
 
@@ -178,11 +194,7 @@ private:
   }
 
   uintptr_t getPointer() const {
-assert((getKind() == CK_RTTI ||
-getKind() == CK_FunctionPointer ||
-getKind() == CK_CompleteDtorPointer ||
-getKind() == CK_DeletingDtorPointer ||
-getKind() == CK_UnusedFunctionPointer) 
+assert((getKind() == CK_RTTI || isFunctionPointerKind()) 
Invalid component kind!);
 
 return static_castuintptr_t(Value  ~7ULL);

Modified: cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp?rev=245489r1=245488r2=245489view=diff
==
--- cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp (original)
+++ cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp Wed Aug 19 15:09:09 2015
@@ -306,17 +306,15 @@ public:
   void emitCXXStructor(const CXXMethodDecl *MD, StructorType Type) override;
 
  private:
-  /// Checks if function has any virtual inline function.
-  bool hasAnyVirtualInlineFunction(const CXXRecordDecl *RD) const {
+   bool hasAnyUsedVirtualInlineFunction(const CXXRecordDecl *RD) const {
 const auto VtableLayout =
 CGM.getItaniumVTableContext().getVTableLayout(RD);
 
 for (const auto VtableComponent : VtableLayout.vtable_components()) {
-  if (VtableComponent.getKind() !=
-  VTableComponent::Kind::CK_FunctionPointer)
+  if (!VtableComponent.isUsedFunctionPointerKind())
 continue;
 
-  const auto Method = VtableComponent.getFunctionDecl();
+  const CXXMethodDecl *Method = 

Re: r245084 - WindowsX86: long double is x87DoubleExtended on mingw

2015-08-19 Thread Hans Wennborg via cfe-commits
I assume this is a merge request?

Richard: what do you think about r245459+r245462?



On Wed, Aug 19, 2015 at 10:22 AM, Yaron Keren yaron.ke...@gmail.com wrote:
 Sorry to notice late (just diagnosed the issue from a failing boost::math
 test), according to i686 ABI, long double size on x86 is 12 bytes (the
 memory allocated, not the underlying 80 bits register), see

 https://gcc.gnu.org/onlinedocs/gcc-3.2/gcc/i386-and-x86-64-Options.html

 -m128bit-long-double
 Control the size of long double type. i386 application binary interface
 specify the size to be 12 bytes, while modern architectures (Pentium and
 newer) prefer long double aligned to 8 or 16 byte boundary. This is
 impossible to reach with 12 byte long doubles in the array accesses.
 Warning: if you use the -m128bit-long-double switch, the structures and
 arrays containing long double will change their size as well as function
 calling convention for function taking long double will be modified.

 -m96bit-long-double
 Set the size of long double to 96 bits as required by the i386 application
 binary interface. This is the default.


 You can check long double size out by running

 #include iostream
 int main() {
   long double a;
   std::coutsizeof(a)std::endl;
 }

 which outputs 12 with mingw 32 bit, 16 with mingw 64 bit but always 16 with
 current clang.
 I fixed this and added test in r245459+r245462.


 2015-08-19 19:41 GMT+03:00 Hans Wennborg via cfe-commits
 cfe-commits@lists.llvm.org:

 On Tue, Aug 18, 2015 at 6:11 PM, Richard Smith rich...@metafoo.co.uk
 wrote:
  On Tue, Aug 18, 2015 at 3:01 PM, Hans Wennborg h...@chromium.org
  wrote:
 
  Richard, I tried to ping you on the review thread but I'm not sure it
  got through. Martell requested this be merged to 3.7. What do you
  think?
 
 
  LGTM

 Thanks! r245456.

 
 
  On Fri, Aug 14, 2015 at 12:05 PM, Martell Malone via cfe-commits
  cfe-commits@lists.llvm.org wrote:
   Author: martell
   Date: Fri Aug 14 14:05:56 2015
   New Revision: 245084
  
   URL: http://llvm.org/viewvc/llvm-project?rev=245084view=rev
   Log:
   WindowsX86: long double is x87DoubleExtended on mingw
  
   Summary:
   long double on x86 mingw is 80bits and is aligned to 16bytes
  
   Fixes:
   https://llvm.org/bugs/show_bug.cgi?id=24398
  
   Reviewers: rnk
  
   Subscribers: cfe-commits
  
   Differential Revision: http://reviews.llvm.org/D12037
  
   Modified:
   cfe/trunk/lib/Basic/Targets.cpp
  
   Modified: cfe/trunk/lib/Basic/Targets.cpp
   URL:
  
   http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=245084r1=245083r2=245084view=diff
  
  
   ==
   --- cfe/trunk/lib/Basic/Targets.cpp (original)
   +++ cfe/trunk/lib/Basic/Targets.cpp Fri Aug 14 14:05:56 2015
   @@ -3784,7 +3784,10 @@ namespace {
class MinGWX86_32TargetInfo : public WindowsX86_32TargetInfo {
public:
  MinGWX86_32TargetInfo(const llvm::Triple Triple)
   -  : WindowsX86_32TargetInfo(Triple) {}
   +  : WindowsX86_32TargetInfo(Triple) {
   +LongDoubleWidth = LongDoubleAlign = 128;
   +LongDoubleFormat = llvm::APFloat::x87DoubleExtended;
   +  }
  void getTargetDefines(const LangOptions Opts,
MacroBuilder Builder) const override {
WindowsX86_32TargetInfo::getTargetDefines(Opts, Builder);
   @@ -4014,7 +4017,10 @@ public:
class MinGWX86_64TargetInfo : public WindowsX86_64TargetInfo {
public:
  MinGWX86_64TargetInfo(const llvm::Triple Triple)
   -  : WindowsX86_64TargetInfo(Triple) {}
   +  : WindowsX86_64TargetInfo(Triple) {
   +LongDoubleWidth = LongDoubleAlign = 128;
   +LongDoubleFormat = llvm::APFloat::x87DoubleExtended;
   +  }
  void getTargetDefines(const LangOptions Opts,
MacroBuilder Builder) const override {
WindowsX86_64TargetInfo::getTargetDefines(Opts, Builder);
  
  
   ___
   cfe-commits mailing list
   cfe-commits@lists.llvm.org
   http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
 
 
 ___
 cfe-commits mailing list
 cfe-commits@lists.llvm.org
 http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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


Re: [PATCH] D12022: Refactored dtor sanitizing into EHScopeStack

2015-08-19 Thread Naomi Musgrave via cfe-commits
nmusgrave updated this revision to Diff 32608.
nmusgrave added a comment.

- More complex testing for destruction order. Tests class with base, virtual 
base, trivial, and nontrivial member to ensure destruction order is correct.


http://reviews.llvm.org/D12022

Files:
  lib/CodeGen/CGCXX.cpp
  lib/CodeGen/CGClass.cpp
  test/CodeGenCXX/sanitize-dtor-repress-aliasing.cpp

Index: test/CodeGenCXX/sanitize-dtor-repress-aliasing.cpp
===
--- /dev/null
+++ test/CodeGenCXX/sanitize-dtor-repress-aliasing.cpp
@@ -0,0 +1,84 @@
+// Test -fsanitize-memory-use-after-dtor
+// RUN: %clang_cc1 -fsanitize=memory -O0 -fsanitize-memory-use-after-dtor -std=c++11 -triple=x86_64-pc-linux -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -fsanitize=memory -O1 -fsanitize-memory-use-after-dtor -std=c++11 -triple=x86_64-pc-linux -emit-llvm -o - %s | FileCheck %s
+
+template class T
+class Vector {
+public:
+  int size;
+  ~Vector() {}
+};
+
+// Virtual function table for the derived class only contains
+// its own destructors, with no aliasing to base class dtors.
+struct Base {
+  int x;
+  Base() { x = 5; }
+  virtual ~Base() {}
+};
+
+struct VirtualBase {
+  int y;
+  VirtualBase() { y = 10; }
+  virtual ~VirtualBase() {}
+};
+
+struct Derived : public Base, public virtual VirtualBase {
+  int z;
+  Vectorint v;
+  Derived() { z = 10; }
+  ~Derived() {}
+};
+
+Derived d;
+// Destruction order:
+// Derived: int, Vector, Base, VirtualBase
+
+// Declaration of virtual function table
+// CHECK: $_ZTV7Derived = comdat any
+
+// Definition of virtual function table
+// CHECK: @_ZTV7Derived = {{.*}}(void (%struct.Derived*)* @_ZN7DerivedD1Ev to i8*){{.*}}(void (%struct.Derived*)* @_ZN7DerivedD0Ev to i8*)
+
+// CHECK-LABEL: define {{.*}}ZN7DerivedD1Ev
+// CHECK: call void {{.*}}ZN7DerivedD2Ev
+// CHECK: call void {{.*}}ZN11VirtualBaseD2Ev
+// CHECK: ret void
+
+// CHECK-LABEL: define {{.*}}ZN7DerivedD0Ev
+// CHECK: call void {{.*}}ZN7DerivedD1Ev
+// CHECK: ret void
+
+// CHECK-LABEL: define {{.*}}ZN11VirtualBaseD1Ev
+// CHECK: call void {{.*}}ZN11VirtualBaseD2Ev
+// CHECK: ret void
+
+// CHECK-LABEL: define {{.*}}ZN11VirtualBaseD0Ev
+// CHECK: call void {{.*}}ZN11VirtualBaseD1Ev
+// CHECK: ret void
+
+// CHECK-LABEL: define {{.*}}ZN11VirtualBaseD2Ev
+// CHECK: call void {{.*}}sanitizer_dtor_callback(i8* %{{[0-9]*}}, i64 4)
+// CHECK: ret void
+
+// CHECK-LABEL: define {{.*}}ZN4BaseD1Ev
+// CHECK: call void {{.*}}ZN4BaseD2Ev
+// CHECK: ret void
+
+// CHECK-LABEL: define {{.*}}ZN4BaseD0Ev
+// CHECK: call void {{.*}}ZN4BaseD1Ev
+// CHECK: ret void
+
+// CHECK-LABEL: define {{.*}}ZN4BaseD2Ev
+// CHECK: call void {{.*}}sanitizer_dtor_callback(i8* %{{[0-9]*}}, i64 4)
+// CHECK: ret void
+
+// CHECK-LABEL: define {{.*}}ZN7DerivedD2Ev
+// CHECK: call void {{.*}}ZN6VectorIiED1Ev
+// CHECK: call void {{.*}}sanitizer_dtor_callback
+// CHECK: call void {{.*}}ZN4BaseD2Ev
+// CHECK: ret void
+
+// CHECK-LABEL: define {{.*}}ZN6VectorIiED2Ev
+// CHECK: call void {{.*}}sanitizer_dtor_callback(i8* %{{[0-9]*}}, i64 4)
+// CHECK: ret void
Index: lib/CodeGen/CGClass.cpp
===
--- lib/CodeGen/CGClass.cpp
+++ lib/CodeGen/CGClass.cpp
@@ -1367,52 +1367,6 @@
   return true;
 }
 
-// Generates function call for handling object poisoning, passing in
-// references to 'this' and its size as arguments.
-// Disables tail call elimination, to prevent the current stack frame from
-// disappearing from the stack trace.
-static void EmitDtorSanitizerCallback(CodeGenFunction CGF,
-  const CXXDestructorDecl *Dtor) {
-  const ASTRecordLayout Layout =
-  CGF.getContext().getASTRecordLayout(Dtor-getParent());
-
-  // Nothing to poison
-  if(Layout.getFieldCount() == 0)
-return;
-
-  // Construct pointer to region to begin poisoning, and calculate poison
-  // size, so that only members declared in this class are poisoned.
-  llvm::Value *OffsetPtr;
-  CharUnits::QuantityType PoisonSize;
-  ASTContext Context = CGF.getContext();
-
-  llvm::ConstantInt *OffsetSizePtr = llvm::ConstantInt::get(
-  CGF.SizeTy, Context.toCharUnitsFromBits(Layout.getFieldOffset(0)).
-  getQuantity());
-
-  OffsetPtr = CGF.Builder.CreateGEP(CGF.Builder.CreateBitCast(
-  CGF.LoadCXXThis(), CGF.Int8PtrTy), OffsetSizePtr);
-
-  PoisonSize = Layout.getSize().getQuantity() -
-  Context.toCharUnitsFromBits(Layout.getFieldOffset(0)).getQuantity();
-
-  llvm::Value *Args[] = {
-CGF.Builder.CreateBitCast(OffsetPtr, CGF.VoidPtrTy),
-llvm::ConstantInt::get(CGF.SizeTy, PoisonSize)};
-
-  llvm::Type *ArgTypes[] = {CGF.VoidPtrTy, CGF.SizeTy};
-
-  llvm::FunctionType *FnType =
-  llvm::FunctionType::get(CGF.VoidTy, ArgTypes, false);
-  llvm::Value *Fn =
-  CGF.CGM.CreateRuntimeFunction(FnType, __sanitizer_dtor_callback);
-
-  // Disables tail call elimination, to prevent the current stack frame from
-  // 

r245497 - Internal-linkage variables with constant-evaluatable initializers do not need to be emitted. (Also reduces the set of variables that need to be eagerly deserialized when using PCH / modules.

2015-08-19 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Wed Aug 19 15:49:38 2015
New Revision: 245497

URL: http://llvm.org/viewvc/llvm-project?rev=245497view=rev
Log:
Internal-linkage variables with constant-evaluatable initializers do not need 
to be emitted. (Also reduces the set of variables that need to be eagerly 
deserialized when using PCH / modules.)

Modified:
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/test/CodeGen/block-with-perdefinedexpr.c
cfe/trunk/test/CodeGenCXX/const-init-cxx11.cpp
cfe/trunk/test/CodeGenCXX/dllimport.cpp
cfe/trunk/test/CodeGenCXX/typeid-cxx11.cpp
cfe/trunk/test/CodeGenObjC/local-static-block.m
cfe/trunk/test/PCH/check-deserializations.cpp

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=245497r1=245496r2=245497view=diff
==
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Wed Aug 19 15:49:38 2015
@@ -8311,6 +8311,9 @@ bool ASTContext::DeclMustBeEmitted(const
 // Global named register variables (GNU extension) are never emitted.
 if (VD-getStorageClass() == SC_Register)
   return false;
+if (VD-getDescribedVarTemplate() ||
+isaVarTemplatePartialSpecializationDecl(VD))
+  return false;
   } else if (const FunctionDecl *FD = dyn_castFunctionDecl(D)) {
 // We never need to emit an uninstantiated function template.
 if (FD-getTemplatedKind() == FunctionDecl::TK_FunctionTemplate)
@@ -8383,7 +8386,8 @@ bool ASTContext::DeclMustBeEmitted(const
 return true;
 
   // Variables that have initialization with side-effects are required.
-  if (VD-getInit()  VD-getInit()-HasSideEffects(*this))
+  if (VD-getInit()  VD-getInit()-HasSideEffects(*this) 
+  !VD-evaluateValue())
 return true;
 
   return false;

Modified: cfe/trunk/test/CodeGen/block-with-perdefinedexpr.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/block-with-perdefinedexpr.c?rev=245497r1=245496r2=245497view=diff
==
--- cfe/trunk/test/CodeGen/block-with-perdefinedexpr.c (original)
+++ cfe/trunk/test/CodeGen/block-with-perdefinedexpr.c Wed Aug 19 15:49:38 2015
@@ -5,6 +5,7 @@ void syslog(const char *, ...);
 
 void handler( );
 
+__attribute__((used))
 static void (^spd)() = ^()
 {
  handler( ^(){ syslog(%s, __FUNCTION__); } );

Modified: cfe/trunk/test/CodeGenCXX/const-init-cxx11.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/const-init-cxx11.cpp?rev=245497r1=245496r2=245497view=diff
==
--- cfe/trunk/test/CodeGenCXX/const-init-cxx11.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/const-init-cxx11.cpp Wed Aug 19 15:49:38 2015
@@ -350,6 +350,7 @@ namespace VirtualMembers {
 virtual void f();
   };
   // CHECK: @_ZN14VirtualMembersL13sGlobalMemoryE = internal global { i8** } { 
i8** getelementptr inbounds ([3 x i8*], [3 x i8*]* 
@_ZTVN14VirtualMembers12nsMemoryImplE, i64 0, i64 2) }
+  __attribute__((used))
   static nsMemoryImpl sGlobalMemory;
 
   templateclass T

Modified: cfe/trunk/test/CodeGenCXX/dllimport.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/dllimport.cpp?rev=245497r1=245496r2=245497view=diff
==
--- cfe/trunk/test/CodeGenCXX/dllimport.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/dllimport.cpp Wed Aug 19 15:49:38 2015
@@ -581,7 +581,7 @@ struct __declspec(dllimport) KeyFuncClas
   constexpr KeyFuncClass() {}
   virtual void foo();
 };
-constexpr KeyFuncClass keyFuncClassVar;
+extern constexpr KeyFuncClass keyFuncClassVar = {};
 // G32-DAG: @_ZTV12KeyFuncClass = external dllimport unnamed_addr constant [3 
x i8*]
 
 struct __declspec(dllimport) X : public virtual W {};

Modified: cfe/trunk/test/CodeGenCXX/typeid-cxx11.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/typeid-cxx11.cpp?rev=245497r1=245496r2=245497view=diff
==
--- cfe/trunk/test/CodeGenCXX/typeid-cxx11.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/typeid-cxx11.cpp Wed Aug 19 15:49:38 2015
@@ -18,8 +18,8 @@ struct A { virtual ~A(); };
 struct B : virtual A {};
 struct C { int n; };
 
-// CHECK: @_ZN5Test1L5itemsE = internal constant [4 x {{.*}}] [{{.*}} 
@_ZTIN5Test11AE {{.*}}, {{.*}}, {{.*}} @_ZN5Test19make_implINS_1AEEEPvv }, 
{{.*}} @_ZTIN5Test11BE {{.*}} @_ZN5Test19make_implINS_1BEEEPvv {{.*}} 
@_ZTIN5Test11CE {{.*}} @_ZN5Test19make_implINS_1CEEEPvv {{.*}} @_ZTIi {{.*}} 
@_ZN5Test19make_implIiEEPvv }]
-constexpr Item items[] = {
+// CHECK: @_ZN5Test15itemsE = constant [4 x {{.*}}] [{{.*}} @_ZTIN5Test11AE 
{{.*}}, {{.*}}, {{.*}} @_ZN5Test19make_implINS_1AEEEPvv }, {{.*}} 
@_ZTIN5Test11BE {{.*}} @_ZN5Test19make_implINS_1BEEEPvv {{.*}} 

Re: [PATCH] D11694: [CUDA] Added stubs for __nvvm_atom_add*_d()

2015-08-19 Thread Artem Belevich via cfe-commits
tra added a comment.

Ping.


http://reviews.llvm.org/D11694



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


Re: FunctionDecl::getBody() returning nullptr

2015-08-19 Thread Richard Smith via cfe-commits
It looks like this would only happen for a late-parsed template that the
analysis code is checking before it is parsed. Should we really be running
these checks at all in that case?

Also, it looks like this code doesn't actually want the body at all, and
just wants to get the location of the definition. Asking for the body here
does not seem like the right approach, because it'll cause the external AST
source (if there is one) to fault the body in.

The right fix is probably something like:

  const FunctionDecl *Def;
  SourceLocation SL = (D-isDefined(Def) ? Def : D)-getLocation();

On Wed, Aug 19, 2015 at 1:44 PM, Aaron Ballman aa...@aaronballman.com
wrote:

 The attached patch resolves the null pointer crash I am seeing.

 ~Aaron

 On Wed, Aug 19, 2015 at 1:24 PM, Aaron Ballman aa...@aaronballman.com
 wrote:
  On Wed, Aug 19, 2015 at 11:33 AM, Aaron Ballman aa...@aaronballman.com
 wrote:
  When I run the following test code through clang-tidy -checks=*, I get
  a crash from some relatively strange behavior with FunctionDecl.
 
  template class T struct remove_reference  {typedef T type;};
  template class T struct remove_referenceT  {typedef T type;};
  template class T struct remove_referenceT {typedef T type;};
 
  template typename T
  typename remove_referenceT::type move(T arg) {
return static_casttypename remove_referenceT::type(arg);
  }
 
  AnalysisConsumer::getModeForDecl() is called, and it has code that
  does: D-hasBody() ? D-getBody()-stuff : stuff;
 
  What's strange is that hasBody() returns true, but getBody() returns
  nullptr. I don't think that this should be possible. I'm wondering
  whether it's purposeful that hasBody() does not check
  Definition-Body?
 
  Looking into this a bit further, the issue is that hasBody() checks
  for Definition-Body *or* Definition-IsLateTemplateParsed when
  deciding to return true. In my case, Body is null, but
  IsLateTemplateParsed is true, so hasBody() returns true. However,
  getBody() doesn't have any special logic for late template parsed
  function bodies.
 
  Also, the FunctionDecl in question is for move(), which does have a
  body, so I do not understand why the definition would claim there is
  no body.
 
  Ideas, or should I file a bug report?
 
  From my further look, I wonder if the correct solution to this is to
  simply call getBody() and handle a nullptr return instead of calling
  hasBody() first. It basically makes the check to ignore late parsed
  template bodies an implicit one.
 
  ~Aaron

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


Re: [PATCH] D12164: Stop treating -static as overriding -fPIC: they are distinct.

2015-08-19 Thread Joerg Sonnenberger via cfe-commits
joerg accepted this revision.
joerg added a comment.
This revision is now accepted and ready to land.

LGTM.


http://reviews.llvm.org/D12164



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


r245509 - Add missing comment.

2015-08-19 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Wed Aug 19 16:59:52 2015
New Revision: 245509

URL: http://llvm.org/viewvc/llvm-project?rev=245509view=rev
Log:
Add missing comment.

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=245509r1=245508r2=245509view=diff
==
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Wed Aug 19 16:59:52 2015
@@ -6617,7 +6617,8 @@ public:
   /// the stack.
   struct InstantiatingTemplate {
 /// \brief Note that we are instantiating a class template,
-/// function template, or a member thereof.
+/// function template, variable template, alias template,
+/// or a member thereof.
 InstantiatingTemplate(Sema SemaRef, SourceLocation PointOfInstantiation,
   Decl *Entity,
   SourceRange InstantiationRange = SourceRange());
@@ -6663,6 +6664,8 @@ public:
   sema::TemplateDeductionInfo DeductionInfo,
   SourceRange InstantiationRange = SourceRange());
 
+/// \brief Note that we are instantiating a default argument for a function
+/// parameter.
 InstantiatingTemplate(Sema SemaRef, SourceLocation PointOfInstantiation,
   ParmVarDecl *Param,
   ArrayRefTemplateArgument TemplateArgs,


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


Re: [clang-tools-extra] r245471 - [clang-tidy] Fix a bug in UseNullptrCheck.

2015-08-19 Thread Justin Bogner via cfe-commits
Justin Bogner m...@justinbogner.com writes:
 Locally, it seems to fail two tests now:

 Failing Tests (2):
 Clang Tools :: clang-tidy/modernize-use-nullptr-basic.cpp
 Clang Tools :: clang-tidy/modernize-use-nullptr.cpp

 I'll poke at it for a minute and see if there's something obvious I can
 do, but running the run line manually just seems to return 127 with no
 output for me (as opposed to the output that's printed correctly under
 lit)

Okay, I guess check_clang_tidy.sh needs the clang-tidy under test to be
in path (that script's kind of odd, by the way).

It looks like the NULL macro (ie, NULL-nullptr) isn't happening, so
those tests fail. Ring any bells?

 Alexander Kornienko via cfe-commits cfe-commits@lists.llvm.org writes:
 I've committed the check with minor modifications and without the offending
 test in r245511. Could you verify that it works in your setup?

 -- Alex

 On Wed, Aug 19, 2015 at 11:41 PM, Pete Cooper peter_coo...@apple.com wrote:

 On Aug 19, 2015, at 2:38 PM, Alexander Kornienko ale...@google.com
 wrote:

 The check has been reverted in r245493. Sorry for the breakage, I was
 hoping that this commit fixes it.

 No problem.  Thanks for taking a look.

 If you think the rest of the code is good and want to land it again then
 thats fine.  You can leave out the check below until you are happy that
 its working too.  That way you potentially won’t be blocked for too long.

 Thanks,
 Pete

 On Wed, Aug 19, 2015 at 10:31 PM, Pete Cooper 
 peter_coo...@apple.com
 wrote:

 Looks like its only a single test thats failing.

 Would you mind if I remove this piece of the test until we can 
 get
 to the bottom of it?

 void test_macro_expansion4() {
 #define MY_NULL NULL
   int *p = MY_NULL;
   // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: use nullptr
 [modernize-use-nullptr]
   // CHECK-FIXES: int *p = nullptr;
 #undef MY_NULL
 }

 Thanks,
 Pete

 On Aug 19, 2015, at 1:00 PM, Pete Cooper 
 peter_coo...@apple.com wrote:

 Hi Alexander

 We’re still getting a green dragon failure on the null ptr
 check test.  Mind taking a look?

 http://lab.llvm.org:8080/green/job/
 clang-stage1-configure-RA_check/10351/consoleFull#
 50560140149ba4694-19c4-4d7e-bec5-911270d8a58c

 Thanks
 Pete

 On Aug 19, 2015, at 10:50 AM, Alexander Kornienko via
 cfe-commits cfe-commits@lists.llvm.org wrote:

 Author: alexfh
 Date: Wed Aug 19 12:50:22 2015
 New Revision: 245471

 URL: https://urldefense.proofpoint.com/v2/url?u=
 
 http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D245471-26view-3Drev
 d=BQIGaQc=eEvniauFctOgLOKGJOplqwr=
 03tkj3107244TlY4t3_hEgkDY-UG6gKwwK0wOUS3qjMm=
 vEGzlOUc6IO5ny5JKNkJAUEoiokQ1N60GDcHk0yboKQs=
 wuoYp-wW8aBSkIHSX7igi7DHfur7JyIHWwnzHMTYdlge=
 Log:
 [clang-tidy] Fix a bug in UseNullptrCheck.

 https://urldefense.proofpoint.com/v2/url?u=
 http-3A__reviews.llvm.org_D12162d=BQIGaQc=
 eEvniauFctOgLOKGJOplqwr=
 03tkj3107244TlY4t3_hEgkDY-UG6gKwwK0wOUS3qjMm=
 vEGzlOUc6IO5ny5JKNkJAUEoiokQ1N60GDcHk0yboKQs=
 YiXUYCqfOl7durvaPOdifn3l7_G0FJhlE4A_q5Q6xwMe=

 Patch by Angel Garcia!

 Modified:
    clang-tools-extra/trunk/clang-tidy/modernize/
 UseNullptrCheck.cpp

 Modified: clang-tools-extra/trunk/clang-tidy/modernize/
 UseNullptrCheck.cpp
 URL: https://urldefense.proofpoint.com/v2/url?u=
 
 http-3A__llvm.org_viewvc_llvm-2Dproject_clang-2Dtools-2Dextra_trunk_clang-2Dtidy_modernize_UseNullptrCheck.cpp-3Frev-3D245471-26r1-3D245470-26r2-3D245471-26view-3Ddiff
 d=BQIGaQc=eEvniauFctOgLOKGJOplqwr=
 03tkj3107244TlY4t3_hEgkDY-UG6gKwwK0wOUS3qjMm=
 vEGzlOUc6IO5ny5JKNkJAUEoiokQ1N60GDcHk0yboKQs=
 4y-EkuMJJlcYjI15KrZY8VE3eGEhkvg9ScDcHtItY2ge=
 
 ==
 

[clang-tools-extra] r245517 - [clang-tidy] Work around failure in Darwin.

2015-08-19 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Wed Aug 19 18:03:23 2015
New Revision: 245517

URL: http://llvm.org/viewvc/llvm-project?rev=245517view=rev
Log:
[clang-tidy] Work around failure in Darwin.

Modified:
clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp

Modified: clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp?rev=245517r1=245516r2=245517view=diff
==
--- clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp Wed Aug 19 
18:03:23 2015
@@ -442,7 +442,7 @@ private:
 
 UseNullptrCheck::UseNullptrCheck(StringRef Name, ClangTidyContext *Context)
 : ClangTidyCheck(Name, Context) {
-  StringRef MacrosStr = Options.get(NullMacros, );
+  StringRef MacrosStr = Options.get(NullMacros, NULL);
   MacrosStr.split(NullMacros, ,);
 }
 


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


Re: [clang-tools-extra] r245471 - [clang-tidy] Fix a bug in UseNullptrCheck.

2015-08-19 Thread Justin Bogner via cfe-commits
That didn't work either - both tests are still failing.

Alexander Kornienko ale...@google.com writes:
 Something weird happens with options reading. Submitted a possible workaround
 in r245517.

 On Thu, Aug 20, 2015 at 12:48 AM, Justin Bogner m...@justinbogner.com wrote:

 Locally, it seems to fail two tests now:

 Failing Tests (2):
     Clang Tools :: clang-tidy/modernize-use-nullptr-basic.cpp
     Clang Tools :: clang-tidy/modernize-use-nullptr.cpp

 I'll poke at it for a minute and see if there's something obvious I can
 do, but running the run line manually just seems to return 127 with no
 output for me (as opposed to the output that's printed correctly under
 lit)

 Alexander Kornienko via cfe-commits cfe-commits@lists.llvm.org writes:
  I've committed the check with minor modifications and without the
 offending
  test in r245511. Could you verify that it works in your setup?
 
  -- Alex
 
  On Wed, Aug 19, 2015 at 11:41 PM, Pete Cooper peter_coo...@apple.com
 wrote:
 
          On Aug 19, 2015, at 2:38 PM, Alexander Kornienko 
 ale...@google.com
          wrote:
 
          The check has been reverted in r245493. Sorry for the breakage,
 I was
          hoping that this commit fixes it.
 
      No problem.  Thanks for taking a look.
 
      If you think the rest of the code is good and want to land it again
 then
      thats fine.  You can leave out the check below until you are happy
 that
      its working too.  That way you potentially won’t be blocked for too
 long.
 
      Thanks,
      Pete
 
          On Wed, Aug 19, 2015 at 10:31 PM, Pete Cooper 
 peter_coo...@apple.com
          wrote:
 
              Looks like its only a single test thats failing.
 
              Would you mind if I remove this piece of the test until we
 can get
              to the bottom of it?
 
                  void test_macro_expansion4() {
                  #define MY_NULL NULL
                    int *p = MY_NULL;
                    // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: use
 nullptr
                  [modernize-use-nullptr]
                    // CHECK-FIXES: int *p = nullptr;
                  #undef MY_NULL
                  }
 
              Thanks,
              Pete
 
                  On Aug 19, 2015, at 1:00 PM, Pete Cooper 
                  peter_coo...@apple.com wrote:
 
                  Hi Alexander
 
                  We’re still getting a green dragon failure on the null
 ptr
                  check test.  Mind taking a look?
 
                  http://lab.llvm.org:8080/green/job/
                  clang-stage1-configure-RA_check/10351/consoleFull#
                  50560140149ba4694-19c4-4d7e-bec5-911270d8a58c
 
                  Thanks
                  Pete
 
                      On Aug 19, 2015, at 10:50 AM, Alexander Kornienko
 via
                      cfe-commits cfe-commits@lists.llvm.org wrote:
 
                      Author: alexfh
                      Date: Wed Aug 19 12:50:22 2015
                      New Revision: 245471
 
                      URL: https://urldefense.proofpoint.com/v2/url?u=
                    
  http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D245471-26view-3Drev
                      d=BQIGaQc=eEvniauFctOgLOKGJOplqwr=
                      03tkj3107244TlY4t3_hEgkDY-UG6gKwwK0wOUS3qjMm=
                      vEGzlOUc6IO5ny5JKNkJAUEoiokQ1N60GDcHk0yboKQs=
                      wuoYp-wW8aBSkIHSX7igi7DHfur7JyIHWwnzHMTYdlge=
                      Log:
                      [clang-tidy] Fix a bug in UseNullptrCheck.
 
                      https://urldefense.proofpoint.com/v2/url?u=
                      http-3A__reviews.llvm.org_D12162d=BQIGaQc=
                      eEvniauFctOgLOKGJOplqwr=
                      03tkj3107244TlY4t3_hEgkDY-UG6gKwwK0wOUS3qjMm=
                      vEGzlOUc6IO5ny5JKNkJAUEoiokQ1N60GDcHk0yboKQs=
                      YiXUYCqfOl7durvaPOdifn3l7_G0FJhlE4A_q5Q6xwMe=
 
                      Patch by Angel Garcia!
 
                      Modified:
                     clang-tools-extra/trunk/clang-tidy/modernize/
                      UseNullptrCheck.cpp
 
                      Modified: clang-tools-extra/trunk/clang-tidy/
 modernize/
                      UseNullptrCheck.cpp
                      URL: https://urldefense.proofpoint.com/v2/url?u=
                    
  
 http-3A__llvm.org_viewvc_llvm-2Dproject_clang-2Dtools-2Dextra_trunk_clang-2Dtidy_modernize_UseNullptrCheck.cpp-3Frev-3D245471-26r1-3D245470-26r2-3D245471-26view-3Ddiff
                      

Re: [clang-tools-extra] r245471 - [clang-tidy] Fix a bug in UseNullptrCheck.

2015-08-19 Thread Justin Bogner via cfe-commits
Locally, it seems to fail two tests now:

Failing Tests (2):
Clang Tools :: clang-tidy/modernize-use-nullptr-basic.cpp
Clang Tools :: clang-tidy/modernize-use-nullptr.cpp

I'll poke at it for a minute and see if there's something obvious I can
do, but running the run line manually just seems to return 127 with no
output for me (as opposed to the output that's printed correctly under
lit)

Alexander Kornienko via cfe-commits cfe-commits@lists.llvm.org writes:
 I've committed the check with minor modifications and without the offending
 test in r245511. Could you verify that it works in your setup?

 -- Alex

 On Wed, Aug 19, 2015 at 11:41 PM, Pete Cooper peter_coo...@apple.com wrote:

 On Aug 19, 2015, at 2:38 PM, Alexander Kornienko ale...@google.com
 wrote:

 The check has been reverted in r245493. Sorry for the breakage, I was
 hoping that this commit fixes it.

 No problem.  Thanks for taking a look.

 If you think the rest of the code is good and want to land it again then
 thats fine.  You can leave out the check below until you are happy that
 its working too.  That way you potentially won’t be blocked for too long.

 Thanks,
 Pete

 On Wed, Aug 19, 2015 at 10:31 PM, Pete Cooper peter_coo...@apple.com
 wrote:

 Looks like its only a single test thats failing.

 Would you mind if I remove this piece of the test until we can get
 to the bottom of it?

 void test_macro_expansion4() {
 #define MY_NULL NULL
   int *p = MY_NULL;
   // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: use nullptr
 [modernize-use-nullptr]
   // CHECK-FIXES: int *p = nullptr;
 #undef MY_NULL
 }

 Thanks,
 Pete

 On Aug 19, 2015, at 1:00 PM, Pete Cooper 
 peter_coo...@apple.com wrote:

 Hi Alexander

 We’re still getting a green dragon failure on the null ptr
 check test.  Mind taking a look?

 http://lab.llvm.org:8080/green/job/
 clang-stage1-configure-RA_check/10351/consoleFull#
 50560140149ba4694-19c4-4d7e-bec5-911270d8a58c

 Thanks
 Pete

 On Aug 19, 2015, at 10:50 AM, Alexander Kornienko via
 cfe-commits cfe-commits@lists.llvm.org wrote:

 Author: alexfh
 Date: Wed Aug 19 12:50:22 2015
 New Revision: 245471

 URL: https://urldefense.proofpoint.com/v2/url?u=
 
 http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D245471-26view-3Drev
 d=BQIGaQc=eEvniauFctOgLOKGJOplqwr=
 03tkj3107244TlY4t3_hEgkDY-UG6gKwwK0wOUS3qjMm=
 vEGzlOUc6IO5ny5JKNkJAUEoiokQ1N60GDcHk0yboKQs=
 wuoYp-wW8aBSkIHSX7igi7DHfur7JyIHWwnzHMTYdlge=
 Log:
 [clang-tidy] Fix a bug in UseNullptrCheck.

 https://urldefense.proofpoint.com/v2/url?u=
 http-3A__reviews.llvm.org_D12162d=BQIGaQc=
 eEvniauFctOgLOKGJOplqwr=
 03tkj3107244TlY4t3_hEgkDY-UG6gKwwK0wOUS3qjMm=
 vEGzlOUc6IO5ny5JKNkJAUEoiokQ1N60GDcHk0yboKQs=
 YiXUYCqfOl7durvaPOdifn3l7_G0FJhlE4A_q5Q6xwMe=

 Patch by Angel Garcia!

 Modified:
    clang-tools-extra/trunk/clang-tidy/modernize/
 UseNullptrCheck.cpp

 Modified: clang-tools-extra/trunk/clang-tidy/modernize/
 UseNullptrCheck.cpp
 URL: https://urldefense.proofpoint.com/v2/url?u=
 
 http-3A__llvm.org_viewvc_llvm-2Dproject_clang-2Dtools-2Dextra_trunk_clang-2Dtidy_modernize_UseNullptrCheck.cpp-3Frev-3D245471-26r1-3D245470-26r2-3D245471-26view-3Ddiff
 d=BQIGaQc=eEvniauFctOgLOKGJOplqwr=
 03tkj3107244TlY4t3_hEgkDY-UG6gKwwK0wOUS3qjMm=
 vEGzlOUc6IO5ny5JKNkJAUEoiokQ1N60GDcHk0yboKQs=
 4y-EkuMJJlcYjI15KrZY8VE3eGEhkvg9ScDcHtItY2ge=
 ==
 
 --- clang-tools-extra/trunk/clang-tidy/modernize/
 UseNullptrCheck.cpp (original)
 +++ clang-tools-extra/trunk/clang-tidy/modernize/
 UseNullptrCheck.cpp Wed Aug 19 12:50:22 2015
 

[PATCH] D12169: Relax constexpr rules to improve __builtin_object_size's accuracy

2015-08-19 Thread George Burgess IV via cfe-commits
george.burgess.iv created this revision.
george.burgess.iv added a reviewer: rsmith.
george.burgess.iv added a subscriber: cfe-commits.

(Hoping the formatting works as one would expect)

Motivating examples:
Pre-patch:

```
__builtin_object_size((char*)foo, 0) != __builtin_object_size(foo, 0) // if 
__builtin_object_size(foo, 0) != -1
__builtin_object_size(foo[1].bar[-1].baz, 1) == -1. // Always.
```

Post-patch:
Both act as one would expect. This was accomplished by making three changes:

  - Adding a flag to PointerExprEvaluator that makes it more accepting of 
reinterpret_casts.
  - Making array index/pointer offset less coupled in PointerExprEvaluator (we 
now carry around an extra Offset field that denotes how far we are away from an 
object boundary). 
  - Adding an OutermostMemberEvaluator that ignores `foo[1].bar[-1]` in 
`foo[1].bar[-1].baz`, and is more relaxed with casts/pointer arithmetic/etc. 
(Not 100% sold on the name)

http://reviews.llvm.org/D12169

Files:
  lib/AST/ExprConstant.cpp
  test/CXX/expr/expr.const/p2-0x.cpp
  test/CodeGen/object-size.c

Index: test/CodeGen/object-size.c
===
--- test/CodeGen/object-size.c
+++ test/CodeGen/object-size.c
@@ -221,12 +221,30 @@
   gi = __builtin_object_size(t[9].t[10], 2);
   // CHECK: store i32 0
   gi = __builtin_object_size(t[9].t[10], 3);
+
+  // CHECK: store i32 0
+  gi = __builtin_object_size((char*)t[0] + sizeof(t), 0);
+  // CHECK: store i32 0
+  gi = __builtin_object_size((char*)t[0] + sizeof(t), 1);
+  // CHECK: store i32 0
+  gi = __builtin_object_size((char*)t[0] + sizeof(t), 2);
+  // CHECK: store i32 0
+  gi = __builtin_object_size((char*)t[0] + sizeof(t), 3);
+
+  // CHECK: store i32 0
+  gi = __builtin_object_size((char*)t[9].t[0] + 10*sizeof(t[0].t), 0);
+  // CHECK: store i32 0
+  gi = __builtin_object_size((char*)t[9].t[0] + 10*sizeof(t[0].t), 1);
+  // CHECK: store i32 0
+  gi = __builtin_object_size((char*)t[9].t[0] + 10*sizeof(t[0].t), 2);
+  // CHECK: store i32 0
+  gi = __builtin_object_size((char*)t[9].t[0] + 10*sizeof(t[0].t), 3);
 }
 
 struct Test23Ty { int t[10]; };
 
 // CHECK: @test23
-void test23(struct Test22Ty *p) {
+void test23(struct Test23Ty *p) {
   // CHECK: call i64 @llvm.objectsize.i64.p0i8(i8* %{{.*}}, i1 false)
   gi = __builtin_object_size(p, 0);
   // CHECK: call i64 @llvm.objectsize.i64.p0i8(i8* %{{.*}}, i1 false)
@@ -240,7 +258,6 @@
   gi = __builtin_object_size(p, 3);
 }
 
-
 // PR24493 -- ICE if __builtin_object_size called with NULL and (Type  1) != 0
 // CHECK @test24
 void test24() {
@@ -280,3 +297,81 @@
   // CHECK: store i32 0
   gi = __builtin_object_size((void*)0 + 0x1000, 3);
 }
+
+// CHECK: @test26
+void test26(struct Test23Ty *p) {
+  struct { int t[10]; } t[10];
+
+  // CHECK: store i32 356
+  gi = __builtin_object_size((char*)t[1].t[1], 0);
+  // CHECK: store i32 36
+  gi = __builtin_object_size((char*)t[1].t[1], 1);
+  // CHECK: store i32 356
+  gi = __builtin_object_size((char*)t[1].t[1], 2);
+  // CHECK: store i32 36
+  gi = __builtin_object_size((char*)t[1].t[1], 3);
+}
+
+// CHECK: @test27
+void test27() {
+  struct { int t[10]; } t[10];
+
+  // CHECK: store i32 359
+  gi = __builtin_object_size((char*)t[1].t[0]+1, 0);
+  // CHECK: store i32 39
+  gi = __builtin_object_size((char*)t[1].t[0]+1, 1);
+  // CHECK: store i32 359
+  gi = __builtin_object_size((char*)t[1].t[0]+1, 2);
+  // CHECK: store i32 39
+  gi = __builtin_object_size((char*)t[1].t[0]+1, 3);
+}
+
+// CHECK: @test28
+void test28() {
+  struct { int t[10]; } t[10];
+
+  // CHECK: store i32 356
+  gi = __builtin_object_size(t[0].t[11], 0);
+  // CHECK: store i32 0
+  gi = __builtin_object_size(t[0].t[12], 1);
+  // CHECK: store i32 348
+  gi = __builtin_object_size(t[0].t[13], 2);
+  // CHECK: store i32 0
+  gi = __builtin_object_size(t[0].t[14], 3);
+
+  // CHECK: store i32 364
+  gi = __builtin_object_size(t[1].t[-1], 0);
+  // CHECK: store i32 0
+  gi = __builtin_object_size(t[1].t[-2], 1);
+  // CHECK: store i32 372
+  gi = __builtin_object_size(t[1].t[-3], 2);
+  // CHECK: store i32 0
+  gi = __builtin_object_size(t[1].t[-4], 3);
+}
+
+struct Test30IncompleteTy;
+
+// CHECK: @test29
+void test29(struct Test30IncompleteTy *t) {
+  // CHECK: call i64 @llvm.objectsize.i64.p0i8(i8* %{{.*}}, i1 false)
+  gi = __builtin_object_size(t, 0);
+  // CHECK: call i64 @llvm.objectsize.i64.p0i8(i8* %{{.*}}, i1 false)
+  gi = __builtin_object_size(t, 1);
+  // CHECK: call i64 @llvm.objectsize.i64.p0i8(i8* %{{.*}}, i1 true)
+  gi = __builtin_object_size(t, 2);
+  // Note: this is currently fixed at 0 because LLVM doesn't have sufficient
+  // data to correctly handle type=3
+  // CHECK: store i32 0
+  gi = __builtin_object_size(t, 3);
+
+  // CHECK: call i64 @llvm.objectsize.i64.p0i8(i8* {{.*}}, i1 false)
+  gi = __builtin_object_size(test29, 0);
+  // CHECK: call i64 @llvm.objectsize.i64.p0i8(i8* {{.*}}, i1 false)
+  gi = __builtin_object_size(test29, 1);
+  // CHECK: 

[libcxx] r245513 - Add files that got missed in r245512.

2015-08-19 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Wed Aug 19 17:35:56 2015
New Revision: 245513

URL: http://llvm.org/viewvc/llvm-project?rev=245513view=rev
Log:
Add files that got missed in r245512.

Added:

libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert.pass.cpp
Removed:

libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert01.pass.cpp

libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert02.pass.cpp

libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert03.pass.cpp

Added: 
libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert.pass.cpp?rev=245513view=auto
==
--- 
libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert.pass.cpp
 (added)
+++ 
libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert.pass.cpp
 Wed Aug 19 17:35:56 2015
@@ -0,0 +1,89 @@
+//===--===//
+//
+// 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.
+//
+//===--===//
+
+// memory
+
+// unique_ptr
+
+// Test unique_ptr converting move assignment
+
+#include memory
+#include utility
+#include cassert
+
+#include ../../deleter.h
+
+struct A
+{
+static int count;
+A() {++count;}
+A(const A) {++count;}
+virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+: public A
+{
+static int count;
+B() {++count;}
+B(const B) {++count;}
+virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+
+template class APtr, class BPtr
+void testAssign(APtr aptr, BPtr bptr) {
+A* p = bptr.get();
+assert(A::count == 2);
+aptr = std::move(bptr);
+assert(aptr.get() == p);
+assert(bptr.get() == 0);
+assert(A::count == 1);
+assert(B::count == 1);
+}
+
+template class LHS, class RHS
+void checkDeleter(LHS lhs, RHS rhs, int LHSState, int RHSState) {
+assert(lhs.get_deleter().state() == LHSState);
+assert(rhs.get_deleter().state() == RHSState);
+}
+
+int main()
+{
+{
+std::unique_ptrB bptr(new B);
+std::unique_ptrA aptr(new A);
+testAssign(aptr, bptr);
+}
+assert(A::count == 0);
+assert(B::count == 0);
+{
+DeleterB del(42);
+std::unique_ptrB, DeleterB  bptr(new B, std::move(del));
+std::unique_ptrA, DeleterA  aptr(new A);
+testAssign(aptr, bptr);
+checkDeleter(aptr, bptr, 42, 0);
+}
+assert(A::count == 0);
+assert(B::count == 0);
+{
+CDeleterA adel(6);
+CDeleterB bdel(42);
+std::unique_ptrB, CDeleterB bptr(new B, bdel);
+std::unique_ptrA, CDeleterA aptr(new A, adel);
+testAssign(aptr, bptr);
+checkDeleter(aptr, bptr, 42, 42);
+}
+assert(A::count == 0);
+assert(B::count == 0);
+}

Removed: 
libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert01.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert01.pass.cpp?rev=245512view=auto
==
--- 
libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert01.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert01.pass.cpp
 (removed)
@@ -1,56 +0,0 @@
-//===--===//
-//
-// 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.
-//
-//===--===//
-
-// memory
-
-// unique_ptr
-
-// Test unique_ptr converting move assignment
-
-#include memory
-#include utility
-#include cassert
-
-struct A
-{
-static int count;
-A() {++count;}
-A(const A) {++count;}
-virtual ~A() {--count;}
-};
-
-int A::count = 0;
-
-struct B
-: public A
-{
-static int count;
-B() {++count;}
-B(const B) {++count;}
-virtual ~B() {--count;}
-};
-
-int B::count = 0;
-
-int main()
-{
-{
-std::unique_ptrB s(new B);
-A* p = s.get();
-std::unique_ptrA s2(new 

[PATCH] D12173: [libcxx] Constrain unique_ptr::operator=(unique_ptrTp, Dp) in C++03 mode

2015-08-19 Thread Eric Fiselier via cfe-commits
EricWF created this revision.
EricWF added a reviewer: mclow.lists.
EricWF added a subscriber: cfe-commits.

This patch properly constrains the converting assignment operator in C++03. It 
also fixes a bug where std::forward was given the wrong type.
The following two tests begin passing in C++03:

* `unique_ptr.single.asgn/move_convert.pass.cpp`
* `unique_ptr.single.asgn/move_convert13.fail.cpp`

http://reviews.llvm.org/D12173

Files:
  include/memory

Index: include/memory
===
--- include/memory
+++ include/memory
@@ -2659,10 +2659,17 @@
 : __ptr_(__u-release(), 
_VSTD::forwarddeleter_type(__u-get_deleter())) {}
 
 template class _Up, class _Ep
-_LIBCPP_INLINE_VISIBILITY unique_ptr operator=(unique_ptr_Up, _Ep __u)
+_LIBCPP_INLINE_VISIBILITY
+typename enable_if
+!is_array_Up::value 
+is_convertibletypename unique_ptr_Up, _Ep::pointer, pointer::value 

+is_assignabledeleter_type, _Ep::value,
+unique_ptr
+::type
+operator=(unique_ptr_Up, _Ep __u)
 {
 reset(__u.release());
-__ptr_.second() = _VSTD::forwarddeleter_type(__u.get_deleter());
+__ptr_.second() = _VSTD::forward_Ep(__u.get_deleter());
 return *this;
 }
 


Index: include/memory
===
--- include/memory
+++ include/memory
@@ -2659,10 +2659,17 @@
 : __ptr_(__u-release(), _VSTD::forwarddeleter_type(__u-get_deleter())) {}
 
 template class _Up, class _Ep
-_LIBCPP_INLINE_VISIBILITY unique_ptr operator=(unique_ptr_Up, _Ep __u)
+_LIBCPP_INLINE_VISIBILITY
+typename enable_if
+!is_array_Up::value 
+is_convertibletypename unique_ptr_Up, _Ep::pointer, pointer::value 
+is_assignabledeleter_type, _Ep::value,
+unique_ptr
+::type
+operator=(unique_ptr_Up, _Ep __u)
 {
 reset(__u.release());
-__ptr_.second() = _VSTD::forwarddeleter_type(__u.get_deleter());
+__ptr_.second() = _VSTD::forward_Ep(__u.get_deleter());
 return *this;
 }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12173: [libcxx] Constrain unique_ptr::operator=(unique_ptrTp, Dp) in C++03 mode

2015-08-19 Thread Eric Fiselier via cfe-commits
EricWF updated this revision to Diff 32631.
EricWF added a comment.

Update diff so it has more context.


http://reviews.llvm.org/D12173

Files:
  include/memory

Index: include/memory
===
--- include/memory
+++ include/memory
@@ -2659,10 +2659,17 @@
 : __ptr_(__u-release(), 
_VSTD::forwarddeleter_type(__u-get_deleter())) {}
 
 template class _Up, class _Ep
-_LIBCPP_INLINE_VISIBILITY unique_ptr operator=(unique_ptr_Up, _Ep __u)
+_LIBCPP_INLINE_VISIBILITY
+typename enable_if
+!is_array_Up::value 
+is_convertibletypename unique_ptr_Up, _Ep::pointer, pointer::value 

+is_assignabledeleter_type, _Ep::value,
+unique_ptr
+::type
+operator=(unique_ptr_Up, _Ep __u)
 {
 reset(__u.release());
-__ptr_.second() = _VSTD::forwarddeleter_type(__u.get_deleter());
+__ptr_.second() = _VSTD::forward_Ep(__u.get_deleter());
 return *this;
 }
 


Index: include/memory
===
--- include/memory
+++ include/memory
@@ -2659,10 +2659,17 @@
 : __ptr_(__u-release(), _VSTD::forwarddeleter_type(__u-get_deleter())) {}
 
 template class _Up, class _Ep
-_LIBCPP_INLINE_VISIBILITY unique_ptr operator=(unique_ptr_Up, _Ep __u)
+_LIBCPP_INLINE_VISIBILITY
+typename enable_if
+!is_array_Up::value 
+is_convertibletypename unique_ptr_Up, _Ep::pointer, pointer::value 
+is_assignabledeleter_type, _Ep::value,
+unique_ptr
+::type
+operator=(unique_ptr_Up, _Ep __u)
 {
 reset(__u.release());
-__ptr_.second() = _VSTD::forwarddeleter_type(__u.get_deleter());
+__ptr_.second() = _VSTD::forward_Ep(__u.get_deleter());
 return *this;
 }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [clang-tools-extra] r245471 - [clang-tidy] Fix a bug in UseNullptrCheck.

2015-08-19 Thread Pete Cooper via cfe-commits
Yep, works for me locally.  Thanks for fixing it.

Pete
 On Aug 19, 2015, at 3:24 PM, Alexander Kornienko ale...@google.com wrote:
 
 I've committed the check with minor modifications and without the offending 
 test in r245511. Could you verify that it works in your setup?
 
 -- Alex
 
 On Wed, Aug 19, 2015 at 11:41 PM, Pete Cooper peter_coo...@apple.com 
 mailto:peter_coo...@apple.com wrote:
 
 On Aug 19, 2015, at 2:38 PM, Alexander Kornienko ale...@google.com 
 mailto:ale...@google.com wrote:
 
 The check has been reverted in r245493. Sorry for the breakage, I was hoping 
 that this commit fixes it.
 No problem.  Thanks for taking a look.
 
 If you think the rest of the code is good and want to land it again then 
 thats fine.  You can leave out the check below until you are happy that its 
 working too.  That way you potentially won’t be blocked for too long.
 
 Thanks,
 Pete
 
 On Wed, Aug 19, 2015 at 10:31 PM, Pete Cooper peter_coo...@apple.com 
 mailto:peter_coo...@apple.com wrote:
 Looks like its only a single test thats failing.
 
 Would you mind if I remove this piece of the test until we can get to the 
 bottom of it?
 
 void test_macro_expansion4() {
 #define MY_NULL NULL
   int *p = MY_NULL;
   // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: use nullptr 
 [modernize-use-nullptr]
   // CHECK-FIXES: int *p = nullptr;
 #undef MY_NULL
 }
 
 Thanks,
 Pete
 On Aug 19, 2015, at 1:00 PM, Pete Cooper peter_coo...@apple.com 
 mailto:peter_coo...@apple.com wrote:
 
 Hi Alexander
 
 We’re still getting a green dragon failure on the null ptr check test.  
 Mind taking a look?
 
 http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA_check/10351/consoleFull#50560140149ba4694-19c4-4d7e-bec5-911270d8a58c
  
 https://urldefense.proofpoint.com/v2/url?u=http-3A__lab.llvm.org-3A8080_green_job_clang-2Dstage1-2Dconfigure-2DRA-5Fcheck_10351_consoleFull-2350560140149ba4694-2D19c4-2D4d7e-2Dbec5-2D911270d8a58cd=BQMFaQc=eEvniauFctOgLOKGJOplqwr=03tkj3107244TlY4t3_hEgkDY-UG6gKwwK0wOUS3qjMm=egkIy3ZyHViev_djzwydHEvkmBTxiHkYi7IViAItTvYs=Jk2TDC-f1lko8XlDHLjnD9998CpHgKUoBidcEOk2xIce=
 
 Thanks
 Pete
 On Aug 19, 2015, at 10:50 AM, Alexander Kornienko via cfe-commits 
 cfe-commits@lists.llvm.org mailto:cfe-commits@lists.llvm.org wrote:
 
 Author: alexfh
 Date: Wed Aug 19 12:50:22 2015
 New Revision: 245471
 
 URL: 
 https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D245471-26view-3Drevd=BQIGaQc=eEvniauFctOgLOKGJOplqwr=03tkj3107244TlY4t3_hEgkDY-UG6gKwwK0wOUS3qjMm=vEGzlOUc6IO5ny5JKNkJAUEoiokQ1N60GDcHk0yboKQs=wuoYp-wW8aBSkIHSX7igi7DHfur7JyIHWwnzHMTYdlge=
  
 https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D245471-26view-3Drevd=BQIGaQc=eEvniauFctOgLOKGJOplqwr=03tkj3107244TlY4t3_hEgkDY-UG6gKwwK0wOUS3qjMm=vEGzlOUc6IO5ny5JKNkJAUEoiokQ1N60GDcHk0yboKQs=wuoYp-wW8aBSkIHSX7igi7DHfur7JyIHWwnzHMTYdlge=
  
 Log:
 [clang-tidy] Fix a bug in UseNullptrCheck.
 
 https://urldefense.proofpoint.com/v2/url?u=http-3A__reviews.llvm.org_D12162d=BQIGaQc=eEvniauFctOgLOKGJOplqwr=03tkj3107244TlY4t3_hEgkDY-UG6gKwwK0wOUS3qjMm=vEGzlOUc6IO5ny5JKNkJAUEoiokQ1N60GDcHk0yboKQs=YiXUYCqfOl7durvaPOdifn3l7_G0FJhlE4A_q5Q6xwMe=
  
 https://urldefense.proofpoint.com/v2/url?u=http-3A__reviews.llvm.org_D12162d=BQIGaQc=eEvniauFctOgLOKGJOplqwr=03tkj3107244TlY4t3_hEgkDY-UG6gKwwK0wOUS3qjMm=vEGzlOUc6IO5ny5JKNkJAUEoiokQ1N60GDcHk0yboKQs=YiXUYCqfOl7durvaPOdifn3l7_G0FJhlE4A_q5Q6xwMe=
  
 
 Patch by Angel Garcia!
 
 Modified:
clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp
 
 Modified: clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp
 URL: 
 https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_clang-2Dtools-2Dextra_trunk_clang-2Dtidy_modernize_UseNullptrCheck.cpp-3Frev-3D245471-26r1-3D245470-26r2-3D245471-26view-3Ddiffd=BQIGaQc=eEvniauFctOgLOKGJOplqwr=03tkj3107244TlY4t3_hEgkDY-UG6gKwwK0wOUS3qjMm=vEGzlOUc6IO5ny5JKNkJAUEoiokQ1N60GDcHk0yboKQs=4y-EkuMJJlcYjI15KrZY8VE3eGEhkvg9ScDcHtItY2ge=
  
 https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_clang-2Dtools-2Dextra_trunk_clang-2Dtidy_modernize_UseNullptrCheck.cpp-3Frev-3D245471-26r1-3D245470-26r2-3D245471-26view-3Ddiffd=BQIGaQc=eEvniauFctOgLOKGJOplqwr=03tkj3107244TlY4t3_hEgkDY-UG6gKwwK0wOUS3qjMm=vEGzlOUc6IO5ny5JKNkJAUEoiokQ1N60GDcHk0yboKQs=4y-EkuMJJlcYjI15KrZY8VE3eGEhkvg9ScDcHtItY2ge=
  
 ==
 --- clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp 
 (original)
 +++ clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp Wed 
 Aug 19 12:50:22 2015
 @@ -175,10 +175,10 @@ private:
 class CastSequenceVisitor : public 
 RecursiveASTVisitorCastSequenceVisitor {
 public:
   CastSequenceVisitor(ASTContext Context,
 -  SmallVectorStringRef, 1 UserNullMacros,
 +  ArrayRefStringRef UserNullMacros,
   ClangTidyCheck 

r245514 - Fix the layout of bitfields in ms_struct unions: their

2015-08-19 Thread John McCall via cfe-commits
Author: rjmccall
Date: Wed Aug 19 17:42:36 2015
New Revision: 245514

URL: http://llvm.org/viewvc/llvm-project?rev=245514view=rev
Log:
Fix the layout of bitfields in ms_struct unions: their
alignment is ignored, and they always allocate a complete
storage unit.

Also, change the dumping of AST record layouts: use the more
readable C++-style dumping even in C, include bitfield offset
information in the dump, and don't print sizeof/alignof
information for fields of record type, since we don't do so
for bases or other kinds of field.

rdar://22275433

Added:
cfe/trunk/test/Layout/ms_struct-bitfields.c
Modified:
cfe/trunk/lib/AST/RecordLayoutBuilder.cpp
cfe/trunk/test/CodeGen/ms_struct-pack.c
cfe/trunk/test/CodeGen/override-layout.c
cfe/trunk/test/Layout/itanium-union-bitfield.cpp
cfe/trunk/test/Layout/ms-x86-alias-avoidance-padding.cpp
cfe/trunk/test/Layout/ms-x86-bitfields-vbases.cpp
cfe/trunk/test/Layout/ms-x86-empty-layout.c
cfe/trunk/test/Layout/ms-x86-empty-nonvirtual-bases.cpp
cfe/trunk/test/Layout/ms-x86-empty-virtual-base.cpp
cfe/trunk/test/Layout/ms-x86-pack-and-align.cpp
cfe/trunk/test/Sema/ms_bitfield_layout.c
cfe/trunk/test/Sema/ms_class_layout.cpp

Modified: cfe/trunk/lib/AST/RecordLayoutBuilder.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/RecordLayoutBuilder.cpp?rev=245514r1=245513r2=245514view=diff
==
--- cfe/trunk/lib/AST/RecordLayoutBuilder.cpp (original)
+++ cfe/trunk/lib/AST/RecordLayoutBuilder.cpp Wed Aug 19 17:42:36 2015
@@ -1565,6 +1565,12 @@ void ItaniumRecordLayoutBuilder::LayoutB
 UnpackedFieldAlign = std::min(UnpackedFieldAlign, MaxFieldAlignmentInBits);
   }
 
+  // But, ms_struct just ignores all of that in unions, even explicit
+  // alignment attributes.
+  if (IsMsStruct  IsUnion) {
+FieldAlign = UnpackedFieldAlign = 1;
+  }
+
   // For purposes of diagnostics, we're going to simultaneously
   // compute the field offsets that we would have used if we weren't
   // adding any alignment padding or if the field weren't packed.
@@ -1631,9 +1637,20 @@ void ItaniumRecordLayoutBuilder::LayoutB
 
   // For unions, this is just a max operation, as usual.
   if (IsUnion) {
-uint64_t RoundedFieldSize = roundUpSizeToCharAlignment(FieldSize,
-   Context);
+// For ms_struct, allocate the entire storage unit --- unless this
+// is a zero-width bitfield, in which case just use a size of 1.
+uint64_t RoundedFieldSize;
+if (IsMsStruct) {
+  RoundedFieldSize =
+(FieldSize ? TypeSize : Context.getTargetInfo().getCharWidth());
+
+// Otherwise, allocate just the number of bytes required to store
+// the bitfield.
+} else {
+  RoundedFieldSize = roundUpSizeToCharAlignment(FieldSize, Context);
+}
 setDataSize(std::max(getDataSizeInBits(), RoundedFieldSize));
+
   // For non-zero-width bitfields in ms_struct structs, allocate a new
   // storage unit if necessary.
   } else if (IsMsStruct  FieldSize) {
@@ -3045,144 +3062,189 @@ ASTContext::getObjCLayout(const ObjCInte
 
 static void PrintOffset(raw_ostream OS,
 CharUnits Offset, unsigned IndentLevel) {
-  OS  llvm::format(%4 PRId64  | , (int64_t)Offset.getQuantity());
+  OS  llvm::format(%10 PRId64  | , (int64_t)Offset.getQuantity());
+  OS.indent(IndentLevel * 2);
+}
+
+static void PrintBitFieldOffset(raw_ostream OS, CharUnits Offset,
+unsigned Begin, unsigned Width,
+unsigned IndentLevel) {
+  llvm::SmallString10 Buffer;
+  {
+llvm::raw_svector_ostream BufferOS(Buffer);
+BufferOS  Offset.getQuantity()  ':';
+if (Width == 0) {
+  BufferOS  '-';
+} else {
+  BufferOS  Begin  '-'  (Begin + Width - 1);
+}
+  }
+  
+  OS  llvm::right_justify(Buffer, 10)   | ;
   OS.indent(IndentLevel * 2);
 }
 
 static void PrintIndentNoOffset(raw_ostream OS, unsigned IndentLevel) {
-  OS   | ;
+  OS | ;
   OS.indent(IndentLevel * 2);
 }
 
-static void DumpCXXRecordLayout(raw_ostream OS,
-const CXXRecordDecl *RD, const ASTContext C,
-CharUnits Offset,
-unsigned IndentLevel,
-const char* Description,
-bool IncludeVirtualBases) {
+static void DumpRecordLayout(raw_ostream OS, const RecordDecl *RD,
+ const ASTContext C,
+ CharUnits Offset,
+ unsigned IndentLevel,
+ const char* Description,
+ bool PrintSizeInfo,
+ bool IncludeVirtualBases) {
   const ASTRecordLayout Layout = C.getASTRecordLayout(RD);
+  auto CXXRD = dyn_castCXXRecordDecl(RD);
 
   PrintOffset(OS, 

Re: [clang-tools-extra] r245471 - [clang-tidy] Fix a bug in UseNullptrCheck.

2015-08-19 Thread Alexander Kornienko via cfe-commits
Something weird happens with options reading. Submitted a possible
workaround in r245517.

On Thu, Aug 20, 2015 at 12:48 AM, Justin Bogner m...@justinbogner.com
wrote:

 Locally, it seems to fail two tests now:

 Failing Tests (2):
 Clang Tools :: clang-tidy/modernize-use-nullptr-basic.cpp
 Clang Tools :: clang-tidy/modernize-use-nullptr.cpp

 I'll poke at it for a minute and see if there's something obvious I can
 do, but running the run line manually just seems to return 127 with no
 output for me (as opposed to the output that's printed correctly under
 lit)

 Alexander Kornienko via cfe-commits cfe-commits@lists.llvm.org writes:
  I've committed the check with minor modifications and without the
 offending
  test in r245511. Could you verify that it works in your setup?
 
  -- Alex
 
  On Wed, Aug 19, 2015 at 11:41 PM, Pete Cooper peter_coo...@apple.com
 wrote:
 
  On Aug 19, 2015, at 2:38 PM, Alexander Kornienko 
 ale...@google.com
  wrote:
 
  The check has been reverted in r245493. Sorry for the breakage,
 I was
  hoping that this commit fixes it.
 
  No problem.  Thanks for taking a look.
 
  If you think the rest of the code is good and want to land it again
 then
  thats fine.  You can leave out the check below until you are happy
 that
  its working too.  That way you potentially won’t be blocked for too
 long.
 
  Thanks,
  Pete
 
  On Wed, Aug 19, 2015 at 10:31 PM, Pete Cooper 
 peter_coo...@apple.com
  wrote:
 
  Looks like its only a single test thats failing.
 
  Would you mind if I remove this piece of the test until we
 can get
  to the bottom of it?
 
  void test_macro_expansion4() {
  #define MY_NULL NULL
int *p = MY_NULL;
// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: use
 nullptr
  [modernize-use-nullptr]
// CHECK-FIXES: int *p = nullptr;
  #undef MY_NULL
  }
 
  Thanks,
  Pete
 
  On Aug 19, 2015, at 1:00 PM, Pete Cooper 
  peter_coo...@apple.com wrote:
 
  Hi Alexander
 
  We’re still getting a green dragon failure on the null
 ptr
  check test.  Mind taking a look?
 
  http://lab.llvm.org:8080/green/job/
  clang-stage1-configure-RA_check/10351/consoleFull#
  50560140149ba4694-19c4-4d7e-bec5-911270d8a58c
 
  Thanks
  Pete
 
  On Aug 19, 2015, at 10:50 AM, Alexander Kornienko via
  cfe-commits cfe-commits@lists.llvm.org wrote:
 
  Author: alexfh
  Date: Wed Aug 19 12:50:22 2015
  New Revision: 245471
 
  URL: https://urldefense.proofpoint.com/v2/url?u=
 
  http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D245471-26view-3Drev
  d=BQIGaQc=eEvniauFctOgLOKGJOplqwr=
  03tkj3107244TlY4t3_hEgkDY-UG6gKwwK0wOUS3qjMm=
  vEGzlOUc6IO5ny5JKNkJAUEoiokQ1N60GDcHk0yboKQs=
  wuoYp-wW8aBSkIHSX7igi7DHfur7JyIHWwnzHMTYdlge=
  Log:
  [clang-tidy] Fix a bug in UseNullptrCheck.
 
  https://urldefense.proofpoint.com/v2/url?u=
  http-3A__reviews.llvm.org_D12162d=BQIGaQc=
  eEvniauFctOgLOKGJOplqwr=
  03tkj3107244TlY4t3_hEgkDY-UG6gKwwK0wOUS3qjMm=
  vEGzlOUc6IO5ny5JKNkJAUEoiokQ1N60GDcHk0yboKQs=
  YiXUYCqfOl7durvaPOdifn3l7_G0FJhlE4A_q5Q6xwMe=
 
  Patch by Angel Garcia!
 
  Modified:
 clang-tools-extra/trunk/clang-tidy/modernize/
  UseNullptrCheck.cpp
 
  Modified:
 clang-tools-extra/trunk/clang-tidy/modernize/
  UseNullptrCheck.cpp
  URL: https://urldefense.proofpoint.com/v2/url?u=
 
  
 http-3A__llvm.org_viewvc_llvm-2Dproject_clang-2Dtools-2Dextra_trunk_clang-2Dtidy_modernize_UseNullptrCheck.cpp-3Frev-3D245471-26r1-3D245470-26r2-3D245471-26view-3Ddiff
  d=BQIGaQc=eEvniauFctOgLOKGJOplqwr=
  03tkj3107244TlY4t3_hEgkDY-UG6gKwwK0wOUS3qjMm=
  vEGzlOUc6IO5ny5JKNkJAUEoiokQ1N60GDcHk0yboKQs=
  4y-EkuMJJlcYjI15KrZY8VE3eGEhkvg9ScDcHtItY2ge=
 
  ==
  
  --- clang-tools-extra/trunk/clang-tidy/modernize/
  UseNullptrCheck.cpp (original)
  +++ clang-tools-extra/trunk/clang-tidy/modernize/
  UseNullptrCheck.cpp Wed Aug 19 12:50:22 2015
 

Re: [PATCH] D12169: Relax constexpr rules to improve __builtin_object_size's accuracy

2015-08-19 Thread Vedant Kumar via cfe-commits
vsk added a subscriber: vsk.
vsk added a comment.

Just a minor nitpick.



Comment at: lib/AST/ExprConstant.cpp:51
@@ -50,1 +50,3 @@
 
+#include iostream
+

Do you need iostream?


http://reviews.llvm.org/D12169



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


Re: [PATCH] D12123: [analyzer] Skip Pre/Post handlers for ObjC calls when receiver is nil.

2015-08-19 Thread Devin Coughlin via cfe-commits
dcoughlin updated the summary for this revision.
dcoughlin updated this revision to Diff 32638.
dcoughlin added a comment.

Update patch to address review comments. I've also updated the 
CheckerDocumentation checker to document the new ObjCMessageNil callback.

This version of the patch also restores the pre-patch behavior of assuming that 
the receiver is non-nil after a method call when the receiver is not definitely 
nil. I've added a test for this behavior (objc-message.m) and a comment based 
on a discussion with Jordan that explains why that behavior is important.


http://reviews.llvm.org/D12123

Files:
  include/clang/StaticAnalyzer/Core/Checker.h
  include/clang/StaticAnalyzer/Core/CheckerManager.h
  lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp
  lib/StaticAnalyzer/Checkers/CheckerDocumentation.cpp
  lib/StaticAnalyzer/Core/CheckerManager.cpp
  lib/StaticAnalyzer/Core/ExprEngineObjC.cpp
  test/Analysis/NSContainers.m
  test/Analysis/objc-message.m

Index: test/Analysis/objc-message.m
===
--- /dev/null
+++ test/Analysis/objc-message.m
@@ -0,0 +1,40 @@
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,debug.ExprInspection -analyzer-store=region -verify -Wno-objc-root-class %s
+
+extern void clang_analyzer_warnIfReached();
+void clang_analyzer_eval(int);
+
+@interface SomeClass
+-(id)someMethodWithReturn;
+-(void)someMethod;
+@end
+
+void consistencyOfReturnWithNilReceiver(SomeClass *o) {
+  id result = [o someMethodWithReturn];
+  if (result) {
+if (!o) {
+  // It is impossible for both o to be nil and result to be non-nil,
+  // so this should not be reached.
+  clang_analyzer_warnIfReached(); // no-warning
+}
+  }
+}
+
+void maybeNilReceiverIsNotNilAfterMessage(SomeClass *o) {
+  [o someMethod];
+
+  // We intentionally drop the non-nil flow (dropping coverage) after a method
+  // call when the receiver may be nil in order to avoid inconsistencies of
+  // the kind tested for in consistencyOfReturnWithNilReceiver().
+  clang_analyzer_eval(o != 0); // expected-warning{{TRUE}}
+}
+
+void NilReceiverIsStillNilAfterMessage(SomeClass *o) {
+  if (o == 0) {
+id result = [o someMethodWithReturn];
+
+// Both the receiver and the result should be nil after a message
+// sent to a nil receiver returning a value of type id.
+clang_analyzer_eval(o == 0); // expected-warning{{TRUE}}
+clang_analyzer_eval(result == 0); // expected-warning{{TRUE}}
+  }
+}
Index: test/Analysis/NSContainers.m
===
--- test/Analysis/NSContainers.m
+++ test/Analysis/NSContainers.m
@@ -24,6 +24,8 @@
 @interface NSObject NSObject {}
 - (id)init;
 + (id)alloc;
+
+- (id)mutableCopy;
 @end
 
 typedef struct {
@@ -292,3 +294,20 @@
   [arr addObject:0 safe:1]; // no-warning
 }
 
+@interface MyView : NSObject
+-(NSArray *)subviews;
+@end
+
+void testNoReportWhenReceiverNil(NSMutableArray *array, int b) {
+  // Don't warn about adding nil to a container when the receiver is also
+  // definitely nil
+  if (array == 0) {
+[array addObject:0]; // no-warning
+  }
+
+  MyView *view = b ? [[MyView alloc] init] : 0;
+  NSMutableArray *subviews = [[view subviews] mutableCopy];
+  // When view is nil, subviews is also nil so there should be no warning
+  // here either.
+  [subviews addObject:view]; // no-warning
+}
Index: lib/StaticAnalyzer/Core/ExprEngineObjC.cpp
===
--- lib/StaticAnalyzer/Core/ExprEngineObjC.cpp
+++ lib/StaticAnalyzer/Core/ExprEngineObjC.cpp
@@ -139,6 +139,69 @@
   CallEventRefObjCMethodCall Msg =
 CEMgr.getObjCMethodCall(ME, Pred-getState(), Pred-getLocationContext());
 
+  // There are three cases for the receiver:
+  //   (1) it is definitely nil,
+  //   (2) it is definitely non-nil, and
+  //   (3) we don't know.
+  //
+  // If the receiver is definitely nil, we skip the pre/post callbacks and
+  // instead call the ObjCMessageNil callbacks and return.
+  //
+  // If the receiver is definitely non-nil, we call the pre- callbacks,
+  // evaluate the call, and call the post- callbacks.
+  //
+  // If we don't know, we drop the potential nil flow and instead
+  // continue from the assumed non-nil state as in (2). This approach
+  // intentionally drops coverage in order to prevent false alarms
+  // in the following scenario:
+  //
+  // id result = [o someMethod]
+  // if (result) {
+  //   if (!o) {
+  // // -- This program point should be unreachable because if o is nil
+  // // it must the case that result is nil as well.
+  //   }
+  // }
+  //
+  // We could avoid dropping coverage by performing an explicit case split
+  // on each method call -- but this would get very expensive. An alternative
+  // would be to introduce lazy constraints.
+  // FIXME: This ignores many potential bugs (rdar://problem/11733396).
+  // Revisit once we have lazier constraints.
+  if 

Re: [PATCH] D12123: [analyzer] Skip Pre/Post handlers for ObjC calls when receiver is nil.

2015-08-19 Thread Devin Coughlin via cfe-commits
dcoughlin marked 5 inline comments as done.


Comment at: include/clang/StaticAnalyzer/Core/CheckerManager.h:96
@@ -95,1 +95,3 @@
 
+enum class ObjCCheckerKind {
+  PreVisit,

xazax.hun wrote:
 I do not really like the name ObjCCheckerKind, because it is not kind of an 
 Obj-C related checker. It is the kind of the visit of the message expression. 
 Maybe ObjCMessageVisitKind? Or just MessageVisitKind to be a bit shorter?
I've changed this to ObjCMessageVisitKind, as you suggested.


Comment at: lib/StaticAnalyzer/Core/ExprEngineObjC.cpp:153
@@ +152,3 @@
+  ProgramStateRef notNilState, nilState;
+  std::tie(notNilState, nilState) = State-assume(receiverVal);
+  if (nilState  !notNilState) {

xazax.hun wrote:
 The old code had a comment about merging two cases and a reference to a rdar. 
 Is that rdar already fixed? Maybe it would be good to preserve the at least 
 the first part of the commend?
Thanks for pointing this out! This revealed a deeper issue where the previous 
patch did not drop the non-nil flow after a method call when it was unknown 
whether the receiver was nil. I've fixed the behavior, added a comment 
explaining why it is needed, and added a test for it.


http://reviews.llvm.org/D12123



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


[libcxx] r245522 - Cleanup failing dynarray tests

2015-08-19 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Wed Aug 19 18:33:18 2015
New Revision: 245522

URL: http://llvm.org/viewvc/llvm-project?rev=245522view=rev
Log:
Cleanup failing dynarray tests

Added:

libcxx/trunk/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default_throws_bad_alloc.pass.cpp
Modified:

libcxx/trunk/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default.pass.cpp

Modified: 
libcxx/trunk/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default.pass.cpp?rev=245522r1=245521r2=245522view=diff
==
--- 
libcxx/trunk/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default.pass.cpp
 (original)
+++ 
libcxx/trunk/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default.pass.cpp
 Wed Aug 19 18:33:18 2015
@@ -7,6 +7,8 @@
 //
 
//===--===//
 
+// UNSUPPORTED: c++98, c++03, c++11
+
 // dynarray.cons
 
 // explicit dynarray(size_type c);
@@ -16,22 +18,21 @@
 
 // ~dynarray();
 
-  
-#include __config
-
-#if _LIBCPP_STD_VER  11
 
 #include experimental/dynarray
 #include cassert
 
 #include algorithm
 #include complex
+#include limits
+#include new
 #include string
 
+
 using std::experimental::dynarray;
 
 template class T
-void test ( const std::initializer_listT vals ) {
+void testInitList( const std::initializer_listT vals ) {
 typedef dynarrayT dynA;
 
 dynA d1 ( vals );
@@ -41,12 +42,14 @@ void test ( const std::initializer_list
 
 
 template class T
-void test ( const T val ) {
+void test ( const T val, bool DefaultValueIsIndeterminate = false) {
 typedef dynarrayT dynA;
 
 dynA d1 ( 4 );
 assert ( d1.size () == 4 );
-assert ( std::all_of ( d1.begin (), d1.end (), []( const T item ){ return 
item == T(); } ));
+if (!DefaultValueIsIndeterminate) {
+assert ( std::all_of ( d1.begin (), d1.end (), []( const T item ){ 
return item == T(); } ));
+}
 
 dynA d2 ( 7, val );
 assert ( d2.size () == 7 );
@@ -60,27 +63,23 @@ void test ( const T val ) {
 void test_bad_length () {
 try { dynarrayint ( std::numeric_limitssize_t::max() / sizeof ( int ) 
+ 1 ); }
 catch ( std::bad_array_length  ) { return ; }
+catch (...) { assert(false); }
 assert ( false );
-}
+}
 
-void test_bad_alloc () {
-try { dynarrayint ( std::numeric_limitssize_t::max() / sizeof ( int ) 
- 1 ); }
-catch ( std::bad_alloc  ) { return ; }
-assert ( false );
-}
 
 int main()
 {
-//  testint ( 14 );   // ints don't get default initialized
-testlong ( 0 );
-testdouble ( 14.0 );
+testint ( 14, /* DefaultValueIsIndeterminate */ true );   // ints 
don't get default initialized
+testlong ( 0, true);
+testdouble ( 14.0, true );
 teststd::complexdouble ( std::complexdouble ( 14, 0 ));
 teststd::string ( fourteen );
 
-test ( { 1, 1, 2, 3, 5, 8 } );
-test ( { 1., 1., 2., 3., 5., 8. } );
-test ( { std::string(1), std::string(1), std::string(2), 
std::string(3), 
-std::string(5), std::string(8)} );
+testInitList( { 1, 1, 2, 3, 5, 8 } );
+testInitList( { 1., 1., 2., 3., 5., 8. } );
+testInitList( { std::string(1), std::string(1), std::string(2), 
std::string(3),
+  std::string(5), std::string(8)} );
 
 //  Make sure we don't pick up the Allocator version here
 dynarraylong d1 ( 20, 3 );
@@ -88,8 +87,4 @@ int main()
 assert ( std::all_of ( d1.begin (), d1.end (), []( long item ){ return 
item == 3L; } ));
 
 test_bad_length ();
-test_bad_alloc ();
 }
-#else
-int main() {}
-#endif

Added: 
libcxx/trunk/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default_throws_bad_alloc.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default_throws_bad_alloc.pass.cpp?rev=245522view=auto
==
--- 
libcxx/trunk/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default_throws_bad_alloc.pass.cpp
 (added)
+++ 
libcxx/trunk/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default_throws_bad_alloc.pass.cpp
 Wed Aug 19 18:33:18 2015
@@ -0,0 +1,33 @@
+//===--===//
+//
+// 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.
+//
+//===--===//
+
+// dynarray.cons
+
+// explicit dynarray(size_type c);
+
+// UNSUPPORTED: c++98, c++03, 

[clang-tools-extra] r245524 - [clang-tidy] Fix use-after-free in UseNullptrCheck.

2015-08-19 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Wed Aug 19 18:57:34 2015
New Revision: 245524

URL: http://llvm.org/viewvc/llvm-project?rev=245524view=rev
Log:
[clang-tidy] Fix use-after-free in UseNullptrCheck.

Modified:
clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp
clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.h

Modified: clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp?rev=245524r1=245523r2=245524view=diff
==
--- clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp Wed Aug 19 
18:57:34 2015
@@ -12,7 +12,6 @@
 #include clang/AST/RecursiveASTVisitor.h
 #include clang/ASTMatchers/ASTMatchFinder.h
 #include clang/Lex/Lexer.h
-#include llvm/ADT/StringExtras.h
 
 using namespace clang;
 using namespace clang::ast_matchers;
@@ -441,14 +440,13 @@ private:
 };
 
 UseNullptrCheck::UseNullptrCheck(StringRef Name, ClangTidyContext *Context)
-: ClangTidyCheck(Name, Context) {
-  StringRef MacrosStr = Options.get(NullMacros, NULL);
-  MacrosStr.split(NullMacros, ,);
+: ClangTidyCheck(Name, Context),
+  NullMacrosStr(Options.get(NullMacros, NULL)) {
+  StringRef(NullMacrosStr).split(NullMacros, ,);
 }
 
 void UseNullptrCheck::storeOptions(ClangTidyOptions::OptionMap Opts) {
-  Options.store(Opts, NullMacros,
-llvm::join(NullMacros.begin(), NullMacros.end(), ,));
+  Options.store(Opts, NullMacros, NullMacrosStr);
 }
 
 void UseNullptrCheck::registerMatchers(MatchFinder *Finder) {

Modified: clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.h?rev=245524r1=245523r2=245524view=diff
==
--- clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.h Wed Aug 19 
18:57:34 2015
@@ -24,6 +24,7 @@ public:
   void check(const ast_matchers::MatchFinder::MatchResult Result) override;
 
 private:
+  const std::string NullMacrosStr;
   SmallVectorStringRef, 1 NullMacros;
 };
 


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


Re: [PATCH] D11950: [CUDA] Check register names on appropriate side of cuda compilation only.

2015-08-19 Thread Artem Belevich via cfe-commits
tra added inline comments.


Comment at: lib/Sema/SemaDecl.cpp:5944
@@ -5943,3 +5943,3 @@
   ProcessDeclAttributes(S, NewVD, D);
-
+  bool ShouldHandleTargetErrors = DeclAttrsMatchCUDAMode(getLangOpts(), NewVD);
   if (getLangOpts().CUDA) {

eliben wrote:
 Since this is a CUDA-only thing, ShouldHandleTargetErrors can perhaps be 
 named better. The checks you added are very selective now - some diags are 
 disabled, some are not. It's not clear why some fall under the should handle 
 target error umbrella. A clearer name like MatchingCUDAMode or something of 
 the sort, may help? 
Considering it's only used in two places, I may as well use 
DeclAttrsMatchCUDAMode() directly, making variable naming moot and hopefully 
making intent somewhat clearer.

CUDA code may contain constructs that can only be validated by appropriate 
TargetInfo() and we currently have access only to one used during current 
compilation mode. We will check for those errors in another CUDA compilation 
pass. The error set is further restricted to error classes I've ran into in 
practice and can reproduce and write tests for.




Comment at: lib/Sema/SemaDecl.cpp:5971
@@ -5970,3 +5970,3 @@
   // Handle GNU asm-label extension (encoded as an attribute).
   if (Expr *E = (Expr*)D.getAsmLabel()) {
 // The parser guarantees this is a string.

eliben wrote:
 Do we plan to support this for CUDA at all? Why not disable here on top?
It does not quite fit virtual registers model used by NVPTX, but as a feature 
per se I believe we should keep it enabled, because it should be OK to use it 
for targets where it's valid. For example, using this feature in host code on 
x86 should be acceptable.


http://reviews.llvm.org/D11950



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


Re: r245084 - WindowsX86: long double is x87DoubleExtended on mingw

2015-08-19 Thread Martell Malone via cfe-commits
Thanks for the spot yaron.
I had only tested x64 at the time as that's what the original bug report
was for.
I can confirm that your fix does infact fix i686

Many Thanks
Martell

On Wed, Aug 19, 2015 at 1:22 PM, Yaron Keren yaron.ke...@gmail.com wrote:

 Yes, worth merging with Richard approval.

 2015-08-19 23:16 GMT+03:00 Hans Wennborg h...@chromium.org:

 I assume this is a merge request?

 Richard: what do you think about r245459+r245462?



 On Wed, Aug 19, 2015 at 10:22 AM, Yaron Keren yaron.ke...@gmail.com
 wrote:
  Sorry to notice late (just diagnosed the issue from a failing
 boost::math
  test), according to i686 ABI, long double size on x86 is 12 bytes (the
  memory allocated, not the underlying 80 bits register), see
 
  https://gcc.gnu.org/onlinedocs/gcc-3.2/gcc/i386-and-x86-64-Options.html
 
  -m128bit-long-double
  Control the size of long double type. i386 application binary interface
  specify the size to be 12 bytes, while modern architectures (Pentium and
  newer) prefer long double aligned to 8 or 16 byte boundary. This is
  impossible to reach with 12 byte long doubles in the array accesses.
  Warning: if you use the -m128bit-long-double switch, the structures and
  arrays containing long double will change their size as well as function
  calling convention for function taking long double will be modified.
 
  -m96bit-long-double
  Set the size of long double to 96 bits as required by the i386
 application
  binary interface. This is the default.
 
 
  You can check long double size out by running
 
  #include iostream
  int main() {
long double a;
std::coutsizeof(a)std::endl;
  }
 
  which outputs 12 with mingw 32 bit, 16 with mingw 64 bit but always 16
 with
  current clang.
  I fixed this and added test in r245459+r245462.
 
 
  2015-08-19 19:41 GMT+03:00 Hans Wennborg via cfe-commits
  cfe-commits@lists.llvm.org:
 
  On Tue, Aug 18, 2015 at 6:11 PM, Richard Smith rich...@metafoo.co.uk
  wrote:
   On Tue, Aug 18, 2015 at 3:01 PM, Hans Wennborg h...@chromium.org
   wrote:
  
   Richard, I tried to ping you on the review thread but I'm not sure
 it
   got through. Martell requested this be merged to 3.7. What do you
   think?
  
  
   LGTM
 
  Thanks! r245456.
 
  
  
   On Fri, Aug 14, 2015 at 12:05 PM, Martell Malone via cfe-commits
   cfe-commits@lists.llvm.org wrote:
Author: martell
Date: Fri Aug 14 14:05:56 2015
New Revision: 245084
   
URL: http://llvm.org/viewvc/llvm-project?rev=245084view=rev
Log:
WindowsX86: long double is x87DoubleExtended on mingw
   
Summary:
long double on x86 mingw is 80bits and is aligned to 16bytes
   
Fixes:
https://llvm.org/bugs/show_bug.cgi?id=24398
   
Reviewers: rnk
   
Subscribers: cfe-commits
   
Differential Revision: http://reviews.llvm.org/D12037
   
Modified:
cfe/trunk/lib/Basic/Targets.cpp
   
Modified: cfe/trunk/lib/Basic/Targets.cpp
URL:
   
   
 http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=245084r1=245083r2=245084view=diff
   
   
   
 ==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Fri Aug 14 14:05:56 2015
@@ -3784,7 +3784,10 @@ namespace {
 class MinGWX86_32TargetInfo : public WindowsX86_32TargetInfo {
 public:
   MinGWX86_32TargetInfo(const llvm::Triple Triple)
-  : WindowsX86_32TargetInfo(Triple) {}
+  : WindowsX86_32TargetInfo(Triple) {
+LongDoubleWidth = LongDoubleAlign = 128;
+LongDoubleFormat = llvm::APFloat::x87DoubleExtended;
+  }
   void getTargetDefines(const LangOptions Opts,
 MacroBuilder Builder) const override {
 WindowsX86_32TargetInfo::getTargetDefines(Opts, Builder);
@@ -4014,7 +4017,10 @@ public:
 class MinGWX86_64TargetInfo : public WindowsX86_64TargetInfo {
 public:
   MinGWX86_64TargetInfo(const llvm::Triple Triple)
-  : WindowsX86_64TargetInfo(Triple) {}
+  : WindowsX86_64TargetInfo(Triple) {
+LongDoubleWidth = LongDoubleAlign = 128;
+LongDoubleFormat = llvm::APFloat::x87DoubleExtended;
+  }
   void getTargetDefines(const LangOptions Opts,
 MacroBuilder Builder) const override {
 WindowsX86_64TargetInfo::getTargetDefines(Opts, Builder);
   
   
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  
  
  ___
  cfe-commits mailing list
  cfe-commits@lists.llvm.org
  http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
 
 



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


Re: [PATCH] D11694: [CUDA] Added stubs for __nvvm_atom_add*_d()

2015-08-19 Thread Artem Belevich via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL245502: [CUDA] Added stubs for __nvvm_atom_add_*_d() 
builtins. (authored by tra).

Changed prior to commit:
  http://reviews.llvm.org/D11694?vs=31157id=32616#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D11694

Files:
  cfe/trunk/include/clang/Basic/BuiltinsNVPTX.def

Index: cfe/trunk/include/clang/Basic/BuiltinsNVPTX.def
===
--- cfe/trunk/include/clang/Basic/BuiltinsNVPTX.def
+++ cfe/trunk/include/clang/Basic/BuiltinsNVPTX.def
@@ -453,6 +453,9 @@
 BUILTIN(__nvvm_atom_add_g_f, ffD*1f, n)
 BUILTIN(__nvvm_atom_add_s_f, ffD*3f, n)
 BUILTIN(__nvvm_atom_add_gen_f, ffD*f, n)
+BUILTIN(__nvvm_atom_add_g_d, ddD*1d, n)
+BUILTIN(__nvvm_atom_add_s_d, ddD*3d, n)
+BUILTIN(__nvvm_atom_add_gen_d, ddD*d, n)
 
 BUILTIN(__nvvm_atom_sub_g_i, iiD*1i, n)
 BUILTIN(__nvvm_atom_sub_s_i, iiD*3i, n)


Index: cfe/trunk/include/clang/Basic/BuiltinsNVPTX.def
===
--- cfe/trunk/include/clang/Basic/BuiltinsNVPTX.def
+++ cfe/trunk/include/clang/Basic/BuiltinsNVPTX.def
@@ -453,6 +453,9 @@
 BUILTIN(__nvvm_atom_add_g_f, ffD*1f, n)
 BUILTIN(__nvvm_atom_add_s_f, ffD*3f, n)
 BUILTIN(__nvvm_atom_add_gen_f, ffD*f, n)
+BUILTIN(__nvvm_atom_add_g_d, ddD*1d, n)
+BUILTIN(__nvvm_atom_add_s_d, ddD*3d, n)
+BUILTIN(__nvvm_atom_add_gen_d, ddD*d, n)
 
 BUILTIN(__nvvm_atom_sub_g_i, iiD*1i, n)
 BUILTIN(__nvvm_atom_sub_s_i, iiD*3i, n)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r245510 - Remove empty destructors added in r245500. I got confused by my

2015-08-19 Thread Daniel Jasper via cfe-commits
Author: djasper
Date: Wed Aug 19 17:04:55 2015
New Revision: 245510

URL: http://llvm.org/viewvc/llvm-project?rev=245510view=rev
Log:
Remove empty destructors added in r245500. I got confused by my
YouCompleteMe setup which apparently doesn't find the base classes and
thus doesn't understand that there is an implicit virtual destructor.

Modified:
clang-tools-extra/trunk/unittests/clang-tidy/IncludeInserterTest.cpp

Modified: clang-tools-extra/trunk/unittests/clang-tidy/IncludeInserterTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clang-tidy/IncludeInserterTest.cpp?rev=245510r1=245509r2=245510view=diff
==
--- clang-tools-extra/trunk/unittests/clang-tidy/IncludeInserterTest.cpp 
(original)
+++ clang-tools-extra/trunk/unittests/clang-tidy/IncludeInserterTest.cpp Wed 
Aug 19 17:04:55 2015
@@ -31,7 +31,6 @@ class IncludeInserterCheckBase : public
 public:
   IncludeInserterCheckBase(StringRef CheckName, ClangTidyContext *Context)
   : ClangTidyCheck(CheckName, Context) {}
-  virtual ~IncludeInserterCheckBase() {}
 
   void registerPPCallbacks(CompilerInstance Compiler) override {
 Inserter.reset(new IncludeInserter(Compiler.getSourceManager(),
@@ -66,7 +65,6 @@ class NonSystemHeaderInserterCheck : pub
 public:
   NonSystemHeaderInserterCheck(StringRef CheckName, ClangTidyContext *Context)
   : IncludeInserterCheckBase(CheckName, Context) {}
-  virtual ~NonSystemHeaderInserterCheck() {}
 
   std::vectorStringRef HeadersToInclude() const override {
 return {path/to/header.h};
@@ -78,7 +76,6 @@ class MultipleHeaderInserterCheck : publ
 public:
   MultipleHeaderInserterCheck(StringRef CheckName, ClangTidyContext *Context)
   : IncludeInserterCheckBase(CheckName, Context) {}
-  virtual ~MultipleHeaderInserterCheck() {}
 
   std::vectorStringRef HeadersToInclude() const override {
 return {path/to/header.h, path/to/header2.h, path/to/header.h};
@@ -90,7 +87,6 @@ class CSystemIncludeInserterCheck : publ
 public:
   CSystemIncludeInserterCheck(StringRef CheckName, ClangTidyContext *Context)
   : IncludeInserterCheckBase(CheckName, Context) {}
-  virtual ~CSystemIncludeInserterCheck() {}
 
   std::vectorStringRef HeadersToInclude() const override {
 return {stdlib.h};


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


r245501 - [modules] Don't needlessly bounce through Sema when updating exception specifications.

2015-08-19 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Wed Aug 19 16:09:32 2015
New Revision: 245501

URL: http://llvm.org/viewvc/llvm-project?rev=245501view=rev
Log:
[modules] Don't needlessly bounce through Sema when updating exception 
specifications.

Modified:
cfe/trunk/lib/Serialization/ASTReader.cpp

Modified: cfe/trunk/lib/Serialization/ASTReader.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=245501r1=245500r2=245501view=diff
==
--- cfe/trunk/lib/Serialization/ASTReader.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReader.cpp Wed Aug 19 16:09:32 2015
@@ -8439,8 +8439,9 @@ void ASTReader::FinishedDeserializing()
   PendingExceptionSpecUpdates.clear();
   for (auto Update : Updates) {
 auto *FPT = Update.second-getType()-castAsFunctionProtoType();
-SemaObj-UpdateExceptionSpec(Update.second,
- FPT-getExtProtoInfo().ExceptionSpec);
+auto ESI = FPT-getExtProtoInfo().ExceptionSpec;
+for (auto *Redecl : Update.second-redecls())
+  Context.adjustExceptionSpec(castFunctionDecl(Redecl), ESI);
   }
 }
 


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


Re: [clang-tools-extra] r245471 - [clang-tidy] Fix a bug in UseNullptrCheck.

2015-08-19 Thread Pete Cooper via cfe-commits

 On Aug 19, 2015, at 2:38 PM, Alexander Kornienko ale...@google.com wrote:
 
 The check has been reverted in r245493. Sorry for the breakage, I was hoping 
 that this commit fixes it.
No problem.  Thanks for taking a look.

If you think the rest of the code is good and want to land it again then thats 
fine.  You can leave out the check below until you are happy that its working 
too.  That way you potentially won’t be blocked for too long.

Thanks,
Pete
 
 On Wed, Aug 19, 2015 at 10:31 PM, Pete Cooper peter_coo...@apple.com 
 mailto:peter_coo...@apple.com wrote:
 Looks like its only a single test thats failing.
 
 Would you mind if I remove this piece of the test until we can get to the 
 bottom of it?
 
 void test_macro_expansion4() {
 #define MY_NULL NULL
   int *p = MY_NULL;
   // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: use nullptr 
 [modernize-use-nullptr]
   // CHECK-FIXES: int *p = nullptr;
 #undef MY_NULL
 }
 
 Thanks,
 Pete
 On Aug 19, 2015, at 1:00 PM, Pete Cooper peter_coo...@apple.com 
 mailto:peter_coo...@apple.com wrote:
 
 Hi Alexander
 
 We’re still getting a green dragon failure on the null ptr check test.  Mind 
 taking a look?
 
 http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA_check/10351/consoleFull#50560140149ba4694-19c4-4d7e-bec5-911270d8a58c
  
 https://urldefense.proofpoint.com/v2/url?u=http-3A__lab.llvm.org-3A8080_green_job_clang-2Dstage1-2Dconfigure-2DRA-5Fcheck_10351_consoleFull-2350560140149ba4694-2D19c4-2D4d7e-2Dbec5-2D911270d8a58cd=BQMFaQc=eEvniauFctOgLOKGJOplqwr=03tkj3107244TlY4t3_hEgkDY-UG6gKwwK0wOUS3qjMm=egkIy3ZyHViev_djzwydHEvkmBTxiHkYi7IViAItTvYs=Jk2TDC-f1lko8XlDHLjnD9998CpHgKUoBidcEOk2xIce=
 
 Thanks
 Pete
 On Aug 19, 2015, at 10:50 AM, Alexander Kornienko via cfe-commits 
 cfe-commits@lists.llvm.org mailto:cfe-commits@lists.llvm.org wrote:
 
 Author: alexfh
 Date: Wed Aug 19 12:50:22 2015
 New Revision: 245471
 
 URL: 
 https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D245471-26view-3Drevd=BQIGaQc=eEvniauFctOgLOKGJOplqwr=03tkj3107244TlY4t3_hEgkDY-UG6gKwwK0wOUS3qjMm=vEGzlOUc6IO5ny5JKNkJAUEoiokQ1N60GDcHk0yboKQs=wuoYp-wW8aBSkIHSX7igi7DHfur7JyIHWwnzHMTYdlge=
  
 https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D245471-26view-3Drevd=BQIGaQc=eEvniauFctOgLOKGJOplqwr=03tkj3107244TlY4t3_hEgkDY-UG6gKwwK0wOUS3qjMm=vEGzlOUc6IO5ny5JKNkJAUEoiokQ1N60GDcHk0yboKQs=wuoYp-wW8aBSkIHSX7igi7DHfur7JyIHWwnzHMTYdlge=
  
 Log:
 [clang-tidy] Fix a bug in UseNullptrCheck.
 
 https://urldefense.proofpoint.com/v2/url?u=http-3A__reviews.llvm.org_D12162d=BQIGaQc=eEvniauFctOgLOKGJOplqwr=03tkj3107244TlY4t3_hEgkDY-UG6gKwwK0wOUS3qjMm=vEGzlOUc6IO5ny5JKNkJAUEoiokQ1N60GDcHk0yboKQs=YiXUYCqfOl7durvaPOdifn3l7_G0FJhlE4A_q5Q6xwMe=
  
 https://urldefense.proofpoint.com/v2/url?u=http-3A__reviews.llvm.org_D12162d=BQIGaQc=eEvniauFctOgLOKGJOplqwr=03tkj3107244TlY4t3_hEgkDY-UG6gKwwK0wOUS3qjMm=vEGzlOUc6IO5ny5JKNkJAUEoiokQ1N60GDcHk0yboKQs=YiXUYCqfOl7durvaPOdifn3l7_G0FJhlE4A_q5Q6xwMe=
  
 
 Patch by Angel Garcia!
 
 Modified:
clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp
 
 Modified: clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp
 URL: 
 https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_clang-2Dtools-2Dextra_trunk_clang-2Dtidy_modernize_UseNullptrCheck.cpp-3Frev-3D245471-26r1-3D245470-26r2-3D245471-26view-3Ddiffd=BQIGaQc=eEvniauFctOgLOKGJOplqwr=03tkj3107244TlY4t3_hEgkDY-UG6gKwwK0wOUS3qjMm=vEGzlOUc6IO5ny5JKNkJAUEoiokQ1N60GDcHk0yboKQs=4y-EkuMJJlcYjI15KrZY8VE3eGEhkvg9ScDcHtItY2ge=
  
 https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_clang-2Dtools-2Dextra_trunk_clang-2Dtidy_modernize_UseNullptrCheck.cpp-3Frev-3D245471-26r1-3D245470-26r2-3D245471-26view-3Ddiffd=BQIGaQc=eEvniauFctOgLOKGJOplqwr=03tkj3107244TlY4t3_hEgkDY-UG6gKwwK0wOUS3qjMm=vEGzlOUc6IO5ny5JKNkJAUEoiokQ1N60GDcHk0yboKQs=4y-EkuMJJlcYjI15KrZY8VE3eGEhkvg9ScDcHtItY2ge=
  
 ==
 --- clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp 
 (original)
 +++ clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp Wed 
 Aug 19 12:50:22 2015
 @@ -175,10 +175,10 @@ private:
 class CastSequenceVisitor : public RecursiveASTVisitorCastSequenceVisitor 
 {
 public:
   CastSequenceVisitor(ASTContext Context,
 -  SmallVectorStringRef, 1 UserNullMacros,
 +  ArrayRefStringRef UserNullMacros,
   ClangTidyCheck check)
   : SM(Context.getSourceManager()), Context(Context),
 -UserNullMacros(std::move(UserNullMacros)), Check(check),
 +UserNullMacros(UserNullMacros), Check(check),
 FirstSubExpr(nullptr), PruneSubtree(false) {}
 
   bool TraverseStmt(Stmt *S) {
 @@ -435,7 +435,7 @@ private:
 private:
   SourceManager SM;
   ASTContext Context;
 -  const SmallVectorStringRef, 1 UserNullMacros;
 +  

Re: FunctionDecl::getBody() returning nullptr

2015-08-19 Thread Aaron Ballman via cfe-commits
On Wed, Aug 19, 2015 at 5:23 PM, Richard Smith rich...@metafoo.co.uk wrote:
 It looks like this would only happen for a late-parsed template that the
 analysis code is checking before it is parsed. Should we really be running
 these checks at all in that case?

This code is being called from DataRecursiveASTVisitor (using an
AnalysisContext) on generic Decl objects to determine whether we
*should* run a checker or not. I think it's reasonable, but am not
overly familiar with this part of the code.

 Also, it looks like this code doesn't actually want the body at all, and
 just wants to get the location of the definition. Asking for the body here
 does not seem like the right approach, because it'll cause the external AST
 source (if there is one) to fault the body in.

 The right fix is probably something like:

   const FunctionDecl *Def;
   SourceLocation SL = (D-isDefined(Def) ? Def : D)-getLocation();

I've attached an updated patch with this suggested approach. It
appears to work nicely. If you like the approach, I'll see what I can
come up with for a test case and commit.

~Aaron


 On Wed, Aug 19, 2015 at 1:44 PM, Aaron Ballman aa...@aaronballman.com
 wrote:

 The attached patch resolves the null pointer crash I am seeing.

 ~Aaron

 On Wed, Aug 19, 2015 at 1:24 PM, Aaron Ballman aa...@aaronballman.com
 wrote:
  On Wed, Aug 19, 2015 at 11:33 AM, Aaron Ballman aa...@aaronballman.com
  wrote:
  When I run the following test code through clang-tidy -checks=*, I get
  a crash from some relatively strange behavior with FunctionDecl.
 
  template class T struct remove_reference  {typedef T type;};
  template class T struct remove_referenceT  {typedef T type;};
  template class T struct remove_referenceT {typedef T type;};
 
  template typename T
  typename remove_referenceT::type move(T arg) {
return static_casttypename remove_referenceT::type(arg);
  }
 
  AnalysisConsumer::getModeForDecl() is called, and it has code that
  does: D-hasBody() ? D-getBody()-stuff : stuff;
 
  What's strange is that hasBody() returns true, but getBody() returns
  nullptr. I don't think that this should be possible. I'm wondering
  whether it's purposeful that hasBody() does not check
  Definition-Body?
 
  Looking into this a bit further, the issue is that hasBody() checks
  for Definition-Body *or* Definition-IsLateTemplateParsed when
  deciding to return true. In my case, Body is null, but
  IsLateTemplateParsed is true, so hasBody() returns true. However,
  getBody() doesn't have any special logic for late template parsed
  function bodies.
 
  Also, the FunctionDecl in question is for move(), which does have a
  body, so I do not understand why the definition would claim there is
  no body.
 
  Ideas, or should I file a bug report?
 
  From my further look, I wonder if the correct solution to this is to
  simply call getBody() and handle a nullptr return instead of calling
  hasBody() first. It basically makes the check to ignore late parsed
  template bodies an implicit one.
 
  ~Aaron




AnalysisConsumer.cpp.patch
Description: Binary data
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [clang-tools-extra] r245471 - [clang-tidy] Fix a bug in UseNullptrCheck.

2015-08-19 Thread Alexander Kornienko via cfe-commits
I've committed the check with minor modifications and without the offending
test in r245511. Could you verify that it works in your setup?

-- Alex

On Wed, Aug 19, 2015 at 11:41 PM, Pete Cooper peter_coo...@apple.com
wrote:


 On Aug 19, 2015, at 2:38 PM, Alexander Kornienko ale...@google.com
 wrote:

 The check has been reverted in r245493. Sorry for the breakage, I was
 hoping that this commit fixes it.

 No problem.  Thanks for taking a look.

 If you think the rest of the code is good and want to land it again then
 thats fine.  You can leave out the check below until you are happy that its
 working too.  That way you potentially won’t be blocked for too long.

 Thanks,
 Pete


 On Wed, Aug 19, 2015 at 10:31 PM, Pete Cooper peter_coo...@apple.com
 wrote:

 Looks like its only a single test thats failing.

 Would you mind if I remove this piece of the test until we can get to the
 bottom of it?

 void test_macro_expansion4() {
 #define MY_NULL NULL
   int *p = MY_NULL;
   // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: use nullptr
 [modernize-use-nullptr]
   // CHECK-FIXES: int *p = nullptr;
 #undef MY_NULL
 }


 Thanks,
 Pete

 On Aug 19, 2015, at 1:00 PM, Pete Cooper peter_coo...@apple.com wrote:

 Hi Alexander

 We’re still getting a green dragon failure on the null ptr check test.
 Mind taking a look?


 http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA_check/10351/consoleFull#50560140149ba4694-19c4-4d7e-bec5-911270d8a58c
 https://urldefense.proofpoint.com/v2/url?u=http-3A__lab.llvm.org-3A8080_green_job_clang-2Dstage1-2Dconfigure-2DRA-5Fcheck_10351_consoleFull-2350560140149ba4694-2D19c4-2D4d7e-2Dbec5-2D911270d8a58cd=BQMFaQc=eEvniauFctOgLOKGJOplqwr=03tkj3107244TlY4t3_hEgkDY-UG6gKwwK0wOUS3qjMm=egkIy3ZyHViev_djzwydHEvkmBTxiHkYi7IViAItTvYs=Jk2TDC-f1lko8XlDHLjnD9998CpHgKUoBidcEOk2xIce=

 Thanks
 Pete

 On Aug 19, 2015, at 10:50 AM, Alexander Kornienko via cfe-commits 
 cfe-commits@lists.llvm.org wrote:

 Author: alexfh
 Date: Wed Aug 19 12:50:22 2015
 New Revision: 245471

 URL:
 https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D245471-26view-3Drevd=BQIGaQc=eEvniauFctOgLOKGJOplqwr=03tkj3107244TlY4t3_hEgkDY-UG6gKwwK0wOUS3qjMm=vEGzlOUc6IO5ny5JKNkJAUEoiokQ1N60GDcHk0yboKQs=wuoYp-wW8aBSkIHSX7igi7DHfur7JyIHWwnzHMTYdlge=
 Log:
 [clang-tidy] Fix a bug in UseNullptrCheck.


 https://urldefense.proofpoint.com/v2/url?u=http-3A__reviews.llvm.org_D12162d=BQIGaQc=eEvniauFctOgLOKGJOplqwr=03tkj3107244TlY4t3_hEgkDY-UG6gKwwK0wOUS3qjMm=vEGzlOUc6IO5ny5JKNkJAUEoiokQ1N60GDcHk0yboKQs=YiXUYCqfOl7durvaPOdifn3l7_G0FJhlE4A_q5Q6xwMe=

 Patch by Angel Garcia!

 Modified:
clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp

 Modified: clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp
 URL:
 https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_clang-2Dtools-2Dextra_trunk_clang-2Dtidy_modernize_UseNullptrCheck.cpp-3Frev-3D245471-26r1-3D245470-26r2-3D245471-26view-3Ddiffd=BQIGaQc=eEvniauFctOgLOKGJOplqwr=03tkj3107244TlY4t3_hEgkDY-UG6gKwwK0wOUS3qjMm=vEGzlOUc6IO5ny5JKNkJAUEoiokQ1N60GDcHk0yboKQs=4y-EkuMJJlcYjI15KrZY8VE3eGEhkvg9ScDcHtItY2ge=

 ==
 --- clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp
 (original)
 +++ clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp Wed
 Aug 19 12:50:22 2015
 @@ -175,10 +175,10 @@ private:
 class CastSequenceVisitor : public
 RecursiveASTVisitorCastSequenceVisitor {
 public:
   CastSequenceVisitor(ASTContext Context,
 -  SmallVectorStringRef, 1 UserNullMacros,
 +  ArrayRefStringRef UserNullMacros,
   ClangTidyCheck check)
   : SM(Context.getSourceManager()), Context(Context),
 -UserNullMacros(std::move(UserNullMacros)), Check(check),
 +UserNullMacros(UserNullMacros), Check(check),
 FirstSubExpr(nullptr), PruneSubtree(false) {}

   bool TraverseStmt(Stmt *S) {
 @@ -435,7 +435,7 @@ private:
 private:
   SourceManager SM;
   ASTContext Context;
 -  const SmallVectorStringRef, 1 UserNullMacros;
 +  ArrayRefStringRef UserNullMacros;
   ClangTidyCheck Check;
   Expr *FirstSubExpr;
   bool PruneSubtree;


 ___
 cfe-commits mailing list
 cfe-commits@lists.llvm.org

 https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_cfe-2Dcommitsd=BQIGaQc=eEvniauFctOgLOKGJOplqwr=03tkj3107244TlY4t3_hEgkDY-UG6gKwwK0wOUS3qjMm=vEGzlOUc6IO5ny5JKNkJAUEoiokQ1N60GDcHk0yboKQs=UUHB6kbqbYNAr9eIu4oMQTKtxnQ37-xusL7D-UY0GR4e=


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


Re: [clang-tools-extra] r244586 - Add an IncludeInserter to clang-tidy.

2015-08-19 Thread Daniel Jasper via cfe-commits
On Tue, Aug 11, 2015 at 1:37 PM, Manuel Klimek via cfe-commits 
cfe-commits@lists.llvm.org wrote:

 Author: klimek
 Date: Tue Aug 11 06:37:48 2015
 New Revision: 244586

 URL: http://llvm.org/viewvc/llvm-project?rev=244586view=rev
 Log:
 Add an IncludeInserter to clang-tidy.

 Will be used to allow checks to insert includes at the right position.

 Added:
 clang-tools-extra/trunk/clang-tidy/IncludeInserter.cpp
 clang-tools-extra/trunk/clang-tidy/IncludeInserter.h
 clang-tools-extra/trunk/clang-tidy/IncludeSorter.cpp
 clang-tools-extra/trunk/clang-tidy/IncludeSorter.h
 clang-tools-extra/trunk/unittests/clang-tidy/IncludeInserterTest.cpp
 Modified:
 clang-tools-extra/trunk/clang-tidy/CMakeLists.txt
 clang-tools-extra/trunk/unittests/clang-tidy/CMakeLists.txt
 clang-tools-extra/trunk/unittests/clang-tidy/ClangTidyTest.h

 Modified: clang-tools-extra/trunk/clang-tidy/CMakeLists.txt
 URL:
 http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/CMakeLists.txt?rev=244586r1=244585r2=244586view=diff

 ==
 --- clang-tools-extra/trunk/clang-tidy/CMakeLists.txt (original)
 +++ clang-tools-extra/trunk/clang-tidy/CMakeLists.txt Tue Aug 11 06:37:48
 2015
 @@ -7,6 +7,8 @@ add_clang_library(clangTidy
ClangTidyModule.cpp
ClangTidyDiagnosticConsumer.cpp
ClangTidyOptions.cpp
 +  IncludeInserter.cpp
 +  IncludeSorter.cpp

DEPENDS
ClangSACheckers

 Added: clang-tools-extra/trunk/clang-tidy/IncludeInserter.cpp
 URL:
 http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/IncludeInserter.cpp?rev=244586view=auto

 ==
 --- clang-tools-extra/trunk/clang-tidy/IncludeInserter.cpp (added)
 +++ clang-tools-extra/trunk/clang-tidy/IncludeInserter.cpp Tue Aug 11
 06:37:48 2015
 @@ -0,0 +1,77 @@
 +//=== IncludeInserter.cpp - clang-tidy
 ===//
 +//
 +// The LLVM Compiler Infrastructure
 +//
 +// This file is distributed under the University of Illinois Open Source
 +// License. See LICENSE.TXT for details.
 +//

 +//===--===//
 +
 +#include IncludeInserter.h
 +
 +namespace clang {
 +namespace tidy {
 +
 +class IncludeInserterCallback : public PPCallbacks {
 +public:
 +  explicit IncludeInserterCallback(IncludeInserter *IncludeInserter)
 +  : IncludeInserter(IncludeInserter) {}
 +  // Implements PPCallbacks::InclusionDerective(). Records the names and
 source
 +  // locations of the inclusions in the main source file being processed.
 +  void InclusionDirective(SourceLocation HashLocation,
 +  const Token  /*include_token*/,
 +  StringRef FileNameRef, bool IsAngled,
 +  CharSourceRange FileNameRange,
 +  const FileEntry * /*IncludedFile*/,
 +  StringRef /*SearchPath*/, StringRef
 /*RelativePath*/,
 +  const Module * /*ImportedModule*/) override {
 +IncludeInserter-AddInclude(FileNameRef, IsAngled, HashLocation,
 +FileNameRange.getEnd());
 +  }
 +
 +private:
 +  IncludeInserter *IncludeInserter;
 +};
 +
 +IncludeInserter::IncludeInserter(const SourceManager SourceMgr,
 + const LangOptions LangOpts,
 + IncludeSorter::IncludeStyle Style)
 +: SourceMgr(SourceMgr), LangOpts(LangOpts), Style(Style) {}
 +
 +IncludeInserter::~IncludeInserter() {}
 +
 +std::unique_ptrPPCallbacks IncludeInserter::CreatePPCallbacks() {
 +  return llvm::make_uniqueIncludeInserterCallback(this);
 +}
 +
 +llvm::OptionalFixItHint
 +IncludeInserter::CreateIncludeInsertion(FileID FileID, StringRef Header,
 +bool IsAngled) {
 +  // We assume the same Header will never be included both angled and not
 +  // angled.
 +  if (!InsertedHeaders.insert(std::make_pair(FileID,
 std::setstd::string()))
 +   .second) {
 +return llvm::None;
 +  }


WAT? How did you come up with this??? This allows the include inserter to
insert at most one header per file.
Fixed in r245500.


 +  if (IncludeSorterByFile.find(FileID) == IncludeSorterByFile.end()) {
 +return llvm::None;
 +  }
 +  return IncludeSorterByFile[FileID]-CreateIncludeInsertion(Header,
 IsAngled);
 +}
 +
 +void IncludeInserter::AddInclude(StringRef file_name, bool IsAngled,
 + SourceLocation HashLocation,
 + SourceLocation end_location) {
 +  FileID FileID = SourceMgr.getFileID(HashLocation);
 +  if (IncludeSorterByFile.find(FileID) == IncludeSorterByFile.end()) {
 +IncludeSorterByFile.insert(std::make_pair(
 +FileID, llvm::make_uniqueIncludeSorter(
 +SourceMgr, LangOpts, FileID,
 

[clang-tools-extra] r245500 - Fix IncludeInserter to allow for more than one added header per file.

2015-08-19 Thread Daniel Jasper via cfe-commits
Author: djasper
Date: Wed Aug 19 16:02:27 2015
New Revision: 245500

URL: http://llvm.org/viewvc/llvm-project?rev=245500view=rev
Log:
Fix IncludeInserter to allow for more than one added header per file.

Also adapt tests a bit to make it possible to test this. Removed
checking the number of errors reported per test. It was never actually
checked and doesn't seem particularly relevant to the test itself.

Modified:
clang-tools-extra/trunk/clang-tidy/utils/IncludeInserter.cpp
clang-tools-extra/trunk/unittests/clang-tidy/IncludeInserterTest.cpp

Modified: clang-tools-extra/trunk/clang-tidy/utils/IncludeInserter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/utils/IncludeInserter.cpp?rev=245500r1=245499r2=245500view=diff
==
--- clang-tools-extra/trunk/clang-tidy/utils/IncludeInserter.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/utils/IncludeInserter.cpp Wed Aug 19 
16:02:27 2015
@@ -49,10 +49,9 @@ IncludeInserter::CreateIncludeInsertion(
 bool IsAngled) {
   // We assume the same Header will never be included both angled and not
   // angled.
-  if (!InsertedHeaders.insert(std::make_pair(FileID, std::setstd::string()))
-   .second) {
+  if (!InsertedHeaders[FileID].insert(Header).second)
 return llvm::None;
-  }
+
   if (IncludeSorterByFile.find(FileID) == IncludeSorterByFile.end()) {
 // This may happen if there have been no preprocessor directives in this
 // file.

Modified: clang-tools-extra/trunk/unittests/clang-tidy/IncludeInserterTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clang-tidy/IncludeInserterTest.cpp?rev=245500r1=245499r2=245500view=diff
==
--- clang-tools-extra/trunk/unittests/clang-tidy/IncludeInserterTest.cpp 
(original)
+++ clang-tools-extra/trunk/unittests/clang-tidy/IncludeInserterTest.cpp Wed 
Aug 19 16:02:27 2015
@@ -31,6 +31,8 @@ class IncludeInserterCheckBase : public
 public:
   IncludeInserterCheckBase(StringRef CheckName, ClangTidyContext *Context)
   : ClangTidyCheck(CheckName, Context) {}
+  virtual ~IncludeInserterCheckBase() {}
+
   void registerPPCallbacks(CompilerInstance Compiler) override {
 Inserter.reset(new IncludeInserter(Compiler.getSourceManager(),
Compiler.getLangOpts(),
@@ -43,21 +45,18 @@ public:
   }
 
   void check(const ast_matchers::MatchFinder::MatchResult Result) override {
-auto Fixit =
-Inserter-CreateIncludeInsertion(Result.SourceManager-getMainFileID(),
- HeaderToInclude(), IsAngledInclude());
-if (Fixit) {
-  diag(Result.Nodes.getStmtAsDeclStmt(stmt)-getLocStart(), foo, bar)
-   *Fixit;
+auto Diag = diag(Result.Nodes.getStmtAsDeclStmt(stmt)-getLocStart(),
+ foo, bar);
+for (StringRef header : HeadersToInclude()) {
+  auto Fixit = Inserter-CreateIncludeInsertion(
+  Result.SourceManager-getMainFileID(), header, IsAngledInclude());
+  if (Fixit) {
+Diag  *Fixit;
+  }
 }
-// Second include should yield no Fixit.
-Fixit =
-Inserter-CreateIncludeInsertion(Result.SourceManager-getMainFileID(),
- HeaderToInclude(), IsAngledInclude());
-EXPECT_FALSE(Fixit);
   }
 
-  virtual StringRef HeaderToInclude() const = 0;
+  virtual std::vectorStringRef HeadersToInclude() const = 0;
   virtual bool IsAngledInclude() const = 0;
 
   std::unique_ptrIncludeInserter Inserter;
@@ -67,7 +66,23 @@ class NonSystemHeaderInserterCheck : pub
 public:
   NonSystemHeaderInserterCheck(StringRef CheckName, ClangTidyContext *Context)
   : IncludeInserterCheckBase(CheckName, Context) {}
-  StringRef HeaderToInclude() const override { return path/to/header.h; }
+  virtual ~NonSystemHeaderInserterCheck() {}
+
+  std::vectorStringRef HeadersToInclude() const override {
+return {path/to/header.h};
+  }
+  bool IsAngledInclude() const override { return false; }
+};
+
+class MultipleHeaderInserterCheck : public IncludeInserterCheckBase {
+public:
+  MultipleHeaderInserterCheck(StringRef CheckName, ClangTidyContext *Context)
+  : IncludeInserterCheckBase(CheckName, Context) {}
+  virtual ~MultipleHeaderInserterCheck() {}
+
+  std::vectorStringRef HeadersToInclude() const override {
+return {path/to/header.h, path/to/header2.h, path/to/header.h};
+  }
   bool IsAngledInclude() const override { return false; }
 };
 
@@ -75,7 +90,11 @@ class CSystemIncludeInserterCheck : publ
 public:
   CSystemIncludeInserterCheck(StringRef CheckName, ClangTidyContext *Context)
   : IncludeInserterCheckBase(CheckName, Context) {}
-  StringRef HeaderToInclude() const override { return stdlib.h; }
+  virtual ~CSystemIncludeInserterCheck() {}
+
+  

r245507 - Fix -Wlogical-not-parentheses to work better with C code.

2015-08-19 Thread Richard Trieu via cfe-commits
Author: rtrieu
Date: Wed Aug 19 16:33:54 2015
New Revision: 245507

URL: http://llvm.org/viewvc/llvm-project?rev=245507view=rev
Log:
Fix -Wlogical-not-parentheses to work better with C code.

Remove the assumption of a Boolean type by checking if an expression is known
to have a boolean value.  Disable warning in two other tests.

Added:
cfe/trunk/test/Sema/warn-logical-not-compare.c
Modified:
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/test/Sema/atomic-compare.c
cfe/trunk/test/Sema/bool-compare.c

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=245507r1=245506r2=245507view=diff
==
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Wed Aug 19 16:33:54 2015
@@ -8374,19 +8374,16 @@ static void diagnoseLogicalNotOnLHSofCom
 ExprResult RHS,
 SourceLocation Loc,
 unsigned OpaqueOpc) {
-  // This checking requires bools.
-  if (!S.getLangOpts().Bool) return;
-
   // Check that left hand side is !something.
   UnaryOperator *UO = dyn_castUnaryOperator(LHS.get()-IgnoreImpCasts());
   if (!UO || UO-getOpcode() != UO_LNot) return;
 
   // Only check if the right hand side is non-bool arithmetic type.
-  if (RHS.get()-getType()-isBooleanType()) return;
+  if (RHS.get()-isKnownToHaveBooleanValue()) return;
 
   // Make sure that the something in !something is not bool.
   Expr *SubExpr = UO-getSubExpr()-IgnoreImpCasts();
-  if (SubExpr-getType()-isBooleanType()) return;
+  if (SubExpr-isKnownToHaveBooleanValue()) return;
 
   // Emit warning.
   S.Diag(UO-getOperatorLoc(), diag::warn_logical_not_on_lhs_of_comparison)

Modified: cfe/trunk/test/Sema/atomic-compare.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/atomic-compare.c?rev=245507r1=245506r2=245507view=diff
==
--- cfe/trunk/test/Sema/atomic-compare.c (original)
+++ cfe/trunk/test/Sema/atomic-compare.c Wed Aug 19 16:33:54 2015
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -verify -fsyntax-only
+// RUN: %clang_cc1 %s -verify -fsyntax-only -Wno-logical-not-parentheses
 
 void f(_Atomic(int) a, _Atomic(int) b) {
   if (a  b)  {} // no warning

Modified: cfe/trunk/test/Sema/bool-compare.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/bool-compare.c?rev=245507r1=245506r2=245507view=diff
==
--- cfe/trunk/test/Sema/bool-compare.c (original)
+++ cfe/trunk/test/Sema/bool-compare.c Wed Aug 19 16:33:54 2015
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s -Wno-logical-not-parentheses
 
 
 void f(int x, int y, int z) {

Added: cfe/trunk/test/Sema/warn-logical-not-compare.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/warn-logical-not-compare.c?rev=245507view=auto
==
--- cfe/trunk/test/Sema/warn-logical-not-compare.c (added)
+++ cfe/trunk/test/Sema/warn-logical-not-compare.c Wed Aug 19 16:33:54 2015
@@ -0,0 +1,204 @@
+// RUN: %clang_cc1 -fsyntax-only -Wlogical-not-parentheses -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wlogical-not-parentheses 
-fdiagnostics-parseable-fixits %s 21 | FileCheck %s
+
+int getInt();
+
+int test1(int i1, int i2) {
+  int ret;
+
+  ret = !i1 == i2;
+  // expected-warning@-1 {{logical not is only applied to the left hand side 
of this comparison}}
+  // expected-note@-2 {{add parentheses after the '!' to evaluate the 
comparison first}}
+  // expected-note@-3 {{add parentheses around left hand side expression to 
silence this warning}}
+  // CHECK: warn-logical-not-compare.c:[[line:[0-9]*]]:9: warning
+  // CHECK: to evaluate the comparison first
+  // CHECK: fix-it:{{.*}}:{[[line]]:10-[[line]]:10}:(
+  // CHECK: fix-it:{{.*}}:{[[line]]:18-[[line]]:18}:)
+  // CHECK: to silence this warning
+  // CHECK: fix-it:{{.*}}:{[[line]]:9-[[line]]:9}:(
+  // CHECK: fix-it:{{.*}}:{[[line]]:12-[[line]]:12}:)
+
+  ret = !i1 != i2;
+  //expected-warning@-1 {{logical not is only applied to the left hand side of 
this comparison}}
+  // expected-note@-2 {{add parentheses after the '!' to evaluate the 
comparison first}}
+  // expected-note@-3 {{add parentheses around left hand side expression to 
silence this warning}}
+  // CHECK: warn-logical-not-compare.c:[[line:[0-9]*]]:9: warning
+  // CHECK: to evaluate the comparison first
+  // CHECK: fix-it:{{.*}}:{[[line]]:10-[[line]]:10}:(
+  // CHECK: fix-it:{{.*}}:{[[line]]:18-[[line]]:18}:)
+  // CHECK: to silence this warning
+  // CHECK: fix-it:{{.*}}:{[[line]]:9-[[line]]:9}:(
+  // CHECK: fix-it:{{.*}}:{[[line]]:12-[[line]]:12}:)
+
+  ret = !i1  i2;
+  

Re: [clang-tools-extra] r245471 - [clang-tidy] Fix a bug in UseNullptrCheck.

2015-08-19 Thread Alexander Kornienko via cfe-commits
The check has been reverted in r245493. Sorry for the breakage, I was
hoping that this commit fixes it.

On Wed, Aug 19, 2015 at 10:31 PM, Pete Cooper peter_coo...@apple.com
wrote:

 Looks like its only a single test thats failing.

 Would you mind if I remove this piece of the test until we can get to the
 bottom of it?

 void test_macro_expansion4() {
 #define MY_NULL NULL
   int *p = MY_NULL;
   // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: use nullptr
 [modernize-use-nullptr]
   // CHECK-FIXES: int *p = nullptr;
 #undef MY_NULL
 }


 Thanks,
 Pete

 On Aug 19, 2015, at 1:00 PM, Pete Cooper peter_coo...@apple.com wrote:

 Hi Alexander

 We’re still getting a green dragon failure on the null ptr check test.
 Mind taking a look?


 http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA_check/10351/consoleFull#50560140149ba4694-19c4-4d7e-bec5-911270d8a58c

 Thanks
 Pete

 On Aug 19, 2015, at 10:50 AM, Alexander Kornienko via cfe-commits 
 cfe-commits@lists.llvm.org wrote:

 Author: alexfh
 Date: Wed Aug 19 12:50:22 2015
 New Revision: 245471

 URL:
 https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D245471-26view-3Drevd=BQIGaQc=eEvniauFctOgLOKGJOplqwr=03tkj3107244TlY4t3_hEgkDY-UG6gKwwK0wOUS3qjMm=vEGzlOUc6IO5ny5JKNkJAUEoiokQ1N60GDcHk0yboKQs=wuoYp-wW8aBSkIHSX7igi7DHfur7JyIHWwnzHMTYdlge=
 Log:
 [clang-tidy] Fix a bug in UseNullptrCheck.


 https://urldefense.proofpoint.com/v2/url?u=http-3A__reviews.llvm.org_D12162d=BQIGaQc=eEvniauFctOgLOKGJOplqwr=03tkj3107244TlY4t3_hEgkDY-UG6gKwwK0wOUS3qjMm=vEGzlOUc6IO5ny5JKNkJAUEoiokQ1N60GDcHk0yboKQs=YiXUYCqfOl7durvaPOdifn3l7_G0FJhlE4A_q5Q6xwMe=

 Patch by Angel Garcia!

 Modified:
clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp

 Modified: clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp
 URL:
 https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_clang-2Dtools-2Dextra_trunk_clang-2Dtidy_modernize_UseNullptrCheck.cpp-3Frev-3D245471-26r1-3D245470-26r2-3D245471-26view-3Ddiffd=BQIGaQc=eEvniauFctOgLOKGJOplqwr=03tkj3107244TlY4t3_hEgkDY-UG6gKwwK0wOUS3qjMm=vEGzlOUc6IO5ny5JKNkJAUEoiokQ1N60GDcHk0yboKQs=4y-EkuMJJlcYjI15KrZY8VE3eGEhkvg9ScDcHtItY2ge=

 ==
 --- clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp
 (original)
 +++ clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp Wed
 Aug 19 12:50:22 2015
 @@ -175,10 +175,10 @@ private:
 class CastSequenceVisitor : public
 RecursiveASTVisitorCastSequenceVisitor {
 public:
   CastSequenceVisitor(ASTContext Context,
 -  SmallVectorStringRef, 1 UserNullMacros,
 +  ArrayRefStringRef UserNullMacros,
   ClangTidyCheck check)
   : SM(Context.getSourceManager()), Context(Context),
 -UserNullMacros(std::move(UserNullMacros)), Check(check),
 +UserNullMacros(UserNullMacros), Check(check),
 FirstSubExpr(nullptr), PruneSubtree(false) {}

   bool TraverseStmt(Stmt *S) {
 @@ -435,7 +435,7 @@ private:
 private:
   SourceManager SM;
   ASTContext Context;
 -  const SmallVectorStringRef, 1 UserNullMacros;
 +  ArrayRefStringRef UserNullMacros;
   ClangTidyCheck Check;
   Expr *FirstSubExpr;
   bool PruneSubtree;


 ___
 cfe-commits mailing list
 cfe-commits@lists.llvm.org

 https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_cfe-2Dcommitsd=BQIGaQc=eEvniauFctOgLOKGJOplqwr=03tkj3107244TlY4t3_hEgkDY-UG6gKwwK0wOUS3qjMm=vEGzlOUc6IO5ny5JKNkJAUEoiokQ1N60GDcHk0yboKQs=UUHB6kbqbYNAr9eIu4oMQTKtxnQ37-xusL7D-UY0GR4e=



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


Re: [PATCH] D11950: [CUDA] Check register names on appropriate side of cuda compilation only.

2015-08-19 Thread Eli Bendersky via cfe-commits
eliben accepted this revision.
eliben added a comment.
This revision is now accepted and ready to land.

lgtm


http://reviews.llvm.org/D11950



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


Re: patch: clarify diagnostic when returned value doesn't match function return type

2015-08-19 Thread Nick Lewycky via cfe-commits
On 10 August 2015 at 19:08, Nick Lewycky nlewy...@google.com wrote:

 This simple-minded patch extends the case where we report no viable
 conversion from 'X' to 'Y' to emit a more useful diagnostic no viable
 conversion from returned value of type 'X' to function return type 'Y'
 when used in that context.

 In lieu of adding tests for this diagnostic explicitly, I've only updated
 the tests where the patch changes their result.

 Please review!


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


[clang-tools-extra] r245511 - [clang-tidy] Add modernize-use-nullptr check, attempt 2.

2015-08-19 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Wed Aug 19 17:21:37 2015
New Revision: 245511

URL: http://llvm.org/viewvc/llvm-project?rev=245511view=rev
Log:
[clang-tidy] Add modernize-use-nullptr check, attempt 2.

This patch re-applies r245434 and r245471 reverted in r245493, and changes the
way custom null macros are configured. The test for custom null macros is
temporarily excluded and will be committed separately to reduce chances of
breakages.

Initial patches by Angel Garcia.

Added:
clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp
clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.h
clang-tools-extra/trunk/test/clang-tidy/modernize-use-nullptr-basic.cpp
clang-tools-extra/trunk/test/clang-tidy/modernize-use-nullptr.cpp
Modified:
clang-tools-extra/trunk/clang-tidy/modernize/CMakeLists.txt
clang-tools-extra/trunk/clang-tidy/modernize/ModernizeTidyModule.cpp

Modified: clang-tools-extra/trunk/clang-tidy/modernize/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/CMakeLists.txt?rev=245511r1=245510r2=245511view=diff
==
--- clang-tools-extra/trunk/clang-tidy/modernize/CMakeLists.txt (original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/CMakeLists.txt Wed Aug 19 
17:21:37 2015
@@ -5,6 +5,7 @@ add_clang_library(clangTidyModernizeModu
   LoopConvertUtils.cpp
   ModernizeTidyModule.cpp
   PassByValueCheck.cpp
+  UseNullptrCheck.cpp
 
   LINK_LIBS
   clangAST

Modified: clang-tools-extra/trunk/clang-tidy/modernize/ModernizeTidyModule.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/ModernizeTidyModule.cpp?rev=245511r1=245510r2=245511view=diff
==
--- clang-tools-extra/trunk/clang-tidy/modernize/ModernizeTidyModule.cpp 
(original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/ModernizeTidyModule.cpp Wed 
Aug 19 17:21:37 2015
@@ -12,6 +12,7 @@
 #include ../ClangTidyModuleRegistry.h
 #include LoopConvertCheck.h
 #include PassByValueCheck.h
+#include UseNullptrCheck.h
 
 using namespace clang::ast_matchers;
 
@@ -24,6 +25,7 @@ public:
   void addCheckFactories(ClangTidyCheckFactories CheckFactories) override {
 CheckFactories.registerCheckLoopConvertCheck(modernize-loop-convert);
 CheckFactories.registerCheckPassByValueCheck(modernize-pass-by-value);
+CheckFactories.registerCheckUseNullptrCheck(modernize-use-nullptr);
   }
 
   ClangTidyOptions getModuleOptions() override {
@@ -31,6 +33,9 @@ public:
 auto Opts = Options.CheckOptions;
 Opts[modernize-loop-convert.MinConfidence] = reasonable;
 Opts[modernize-pass-by-value.IncludeStyle] = llvm; // Also: google.
+
+// Comma-separated list of macros that behave like NULL.
+Opts[modernize-use-nullptr.NullMacros] = NULL;
 return Options;
   }
 };

Added: clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp?rev=245511view=auto
==
--- clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp (added)
+++ clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp Wed Aug 19 
17:21:37 2015
@@ -0,0 +1,471 @@
+//===--- UseNullptrCheck.cpp - 
clang-tidy--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include UseNullptrCheck.h
+#include clang/AST/ASTContext.h
+#include clang/AST/RecursiveASTVisitor.h
+#include clang/ASTMatchers/ASTMatchFinder.h
+#include clang/Lex/Lexer.h
+#include llvm/ADT/StringExtras.h
+
+using namespace clang;
+using namespace clang::ast_matchers;
+using namespace llvm;
+
+namespace clang {
+namespace tidy {
+namespace modernize {
+
+const char CastSequence[] = sequence;
+
+/// \brief Matches cast expressions that have a cast kind of CK_NullToPointer
+/// or CK_NullToMemberPointer.
+///
+/// Given
+/// \code
+///   int *p = 0;
+/// \endcode
+/// implicitCastExpr(isNullToPointer()) matches the implicit cast clang adds
+/// around \c 0.
+AST_MATCHER(CastExpr, isNullToPointer) {
+  return Node.getCastKind() == CK_NullToPointer ||
+ Node.getCastKind() == CK_NullToMemberPointer;
+}
+
+AST_MATCHER(Type, sugaredNullptrType) {
+  const Type *DesugaredType = Node.getUnqualifiedDesugaredType();
+  if (const BuiltinType *BT = dyn_castBuiltinType(DesugaredType))
+return BT-getKind() == BuiltinType::NullPtr;
+  return false;
+}
+
+/// \brief Create a matcher that finds implicit casts as well as the head of a
+/// sequence of zero or more nested explicit casts that have an implicit cast

Re: [PATCH] D12137: Fix 4 typos in test/CodeGenCXX/

2015-08-19 Thread Kai Zhao via cfe-commits
loverszhaokai added a comment.

Thanks. I am not a committer.

@rnk, could you commit this revision ? Thanks.


http://reviews.llvm.org/D12137



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


[libcxxabi] r245531 - Fix or disable C++11 tests in C++03 mode

2015-08-19 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Wed Aug 19 20:22:17 2015
New Revision: 245531

URL: http://llvm.org/viewvc/llvm-project?rev=245531view=rev
Log:
Fix or disable C++11 tests in C++03 mode

Modified:
libcxxabi/trunk/test/catch_in_noexcept.pass.cpp
libcxxabi/trunk/test/catch_pointer_nullptr.pass.cpp
libcxxabi/trunk/test/catch_ptr_02.pass.cpp
libcxxabi/trunk/test/dynamic_cast_stress.pass.cpp

Modified: libcxxabi/trunk/test/catch_in_noexcept.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/catch_in_noexcept.pass.cpp?rev=245531r1=245530r2=245531view=diff
==
--- libcxxabi/trunk/test/catch_in_noexcept.pass.cpp (original)
+++ libcxxabi/trunk/test/catch_in_noexcept.pass.cpp Wed Aug 19 20:22:17 2015
@@ -7,6 +7,8 @@
 //
 
//===--===//
 
+// UNSUPPORTED: c++98, c++03
+
 #include exception
 #include stdlib.h
 #include assert.h

Modified: libcxxabi/trunk/test/catch_pointer_nullptr.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/catch_pointer_nullptr.pass.cpp?rev=245531r1=245530r2=245531view=diff
==
--- libcxxabi/trunk/test/catch_pointer_nullptr.pass.cpp (original)
+++ libcxxabi/trunk/test/catch_pointer_nullptr.pass.cpp Wed Aug 19 20:22:17 2015
@@ -7,17 +7,13 @@
 //
 
//===--===//
 
+// UNSUPPORTED: c++98, c++03
+
 #include cassert
 #include cstdlib
 
-#ifndef __has_feature
-#define __has_feature(x) 0
-#endif
-
 struct A {};
 
-#if __has_feature(cxx_nullptr)
-
 void test1()
 {
 try
@@ -62,22 +58,6 @@ void catch_nullptr_test() {
   }
 }
 
-#else
-
-void test1()
-{
-}
-
-void test2()
-{
-}
-
-template class Catch
-void catch_nullptr_test()
-{
-}
-
-#endif
 
 int main()
 {

Modified: libcxxabi/trunk/test/catch_ptr_02.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/catch_ptr_02.pass.cpp?rev=245531r1=245530r2=245531view=diff
==
--- libcxxabi/trunk/test/catch_ptr_02.pass.cpp (original)
+++ libcxxabi/trunk/test/catch_ptr_02.pass.cpp Wed Aug 19 20:22:17 2015
@@ -9,6 +9,10 @@
 
 #include cassert
 
+#if __cplusplus  201103L
+#define DISABLE_NULLPTR_TESTS
+#endif
+
 struct  A {};
 A a;
 const A ca = A();
@@ -99,6 +103,7 @@ void test5 ()
 
 void test6 ()
 {
+#if !defined(DISABLE_NULLPTR_TESTS)
 try
 {
 throw nullptr;
@@ -111,6 +116,7 @@ void test6 ()
 {
 assert (false);
 }
+#endif
 }
 
 void test7 ()
@@ -152,6 +158,7 @@ void test8 ()
 
 void test9 ()
 {
+#if !defined(DISABLE_NULLPTR_TESTS)
 try
 {
 throw nullptr;
@@ -164,6 +171,7 @@ void test9 ()
 {
 assert (false);
 }
+#endif
 }
 
 void test10 ()

Modified: libcxxabi/trunk/test/dynamic_cast_stress.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/dynamic_cast_stress.pass.cpp?rev=245531r1=245530r2=245531view=diff
==
--- libcxxabi/trunk/test/dynamic_cast_stress.pass.cpp (original)
+++ libcxxabi/trunk/test/dynamic_cast_stress.pass.cpp Wed Aug 19 20:22:17 2015
@@ -7,6 +7,8 @@
 //
 
//===--===//
 
+// UNSUPPORTED: c++98, c++03
+
 #include cassert
 #include tuple
 #include support/timer.hpp


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


Re: [clang-tools-extra] r245471 - [clang-tidy] Fix a bug in UseNullptrCheck.

2015-08-19 Thread Alexander Kornienko via cfe-commits
After looking at the code once again, I found an obvious use-after-free bug
which could have caused all of this (and for some reason only manifested
itself on Darwin). r245524 should fix the issue.

On Thu, Aug 20, 2015 at 1:44 AM, Justin Bogner m...@justinbogner.com
wrote:

 That didn't work either - both tests are still failing.

 Alexander Kornienko ale...@google.com writes:
  Something weird happens with options reading. Submitted a possible
 workaround
  in r245517.
 
  On Thu, Aug 20, 2015 at 12:48 AM, Justin Bogner m...@justinbogner.com
 wrote:
 
  Locally, it seems to fail two tests now:
 
  Failing Tests (2):
  Clang Tools :: clang-tidy/modernize-use-nullptr-basic.cpp
  Clang Tools :: clang-tidy/modernize-use-nullptr.cpp
 
  I'll poke at it for a minute and see if there's something obvious I
 can
  do, but running the run line manually just seems to return 127 with
 no
  output for me (as opposed to the output that's printed correctly
 under
  lit)
 
  Alexander Kornienko via cfe-commits cfe-commits@lists.llvm.org
 writes:
   I've committed the check with minor modifications and without the
  offending
   test in r245511. Could you verify that it works in your setup?
  
   -- Alex
  
   On Wed, Aug 19, 2015 at 11:41 PM, Pete Cooper 
 peter_coo...@apple.com
  wrote:
  
   On Aug 19, 2015, at 2:38 PM, Alexander Kornienko 
  ale...@google.com
   wrote:
  
   The check has been reverted in r245493. Sorry for the
 breakage,
  I was
   hoping that this commit fixes it.
  
   No problem.  Thanks for taking a look.
  
   If you think the rest of the code is good and want to land it
 again
  then
   thats fine.  You can leave out the check below until you are
 happy
  that
   its working too.  That way you potentially won’t be blocked
 for too
  long.
  
   Thanks,
   Pete
  
   On Wed, Aug 19, 2015 at 10:31 PM, Pete Cooper 
  peter_coo...@apple.com
   wrote:
  
   Looks like its only a single test thats failing.
  
   Would you mind if I remove this piece of the test
 until we
  can get
   to the bottom of it?
  
   void test_macro_expansion4() {
   #define MY_NULL NULL
 int *p = MY_NULL;
 // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: use
  nullptr
   [modernize-use-nullptr]
 // CHECK-FIXES: int *p = nullptr;
   #undef MY_NULL
   }
  
   Thanks,
   Pete
  
   On Aug 19, 2015, at 1:00 PM, Pete Cooper 
   peter_coo...@apple.com wrote:
  
   Hi Alexander
  
   We’re still getting a green dragon failure on the
 null
  ptr
   check test.  Mind taking a look?
  
   http://lab.llvm.org:8080/green/job/
   clang-stage1-configure-RA_check/10351/consoleFull#
   50560140149ba4694-19c4-4d7e-bec5-911270d8a58c
  
   Thanks
   Pete
  
   On Aug 19, 2015, at 10:50 AM, Alexander
 Kornienko
  via
   cfe-commits cfe-commits@lists.llvm.org
 wrote:
  
   Author: alexfh
   Date: Wed Aug 19 12:50:22 2015
   New Revision: 245471
  
   URL:
 https://urldefense.proofpoint.com/v2/url?u=
  
   http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D245471-26view-3Drev
   d=BQIGaQc=eEvniauFctOgLOKGJOplqwr=
   03tkj3107244TlY4t3_hEgkDY-UG6gKwwK0wOUS3qjMm=
   vEGzlOUc6IO5ny5JKNkJAUEoiokQ1N60GDcHk0yboKQs=
   wuoYp-wW8aBSkIHSX7igi7DHfur7JyIHWwnzHMTYdlge=
   Log:
   [clang-tidy] Fix a bug in UseNullptrCheck.
  
   https://urldefense.proofpoint.com/v2/url?u=
   http-3A__reviews.llvm.org_D12162d=BQIGaQc=
   eEvniauFctOgLOKGJOplqwr=
   03tkj3107244TlY4t3_hEgkDY-UG6gKwwK0wOUS3qjMm=
   vEGzlOUc6IO5ny5JKNkJAUEoiokQ1N60GDcHk0yboKQs=
   YiXUYCqfOl7durvaPOdifn3l7_G0FJhlE4A_q5Q6xwMe=
  
   Patch by Angel Garcia!
  
   Modified:
  
 clang-tools-extra/trunk/clang-tidy/modernize/
   UseNullptrCheck.cpp
  
   Modified: clang-tools-extra/trunk/clang-tidy/
  

[libcxx] r245525 - Fix more uses of uninitialized values in dynarray

2015-08-19 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Wed Aug 19 19:10:22 2015
New Revision: 245525

URL: http://llvm.org/viewvc/llvm-project?rev=245525view=rev
Log:
Fix more uses of uninitialized values in dynarray

Modified:

libcxx/trunk/test/libcxx/experimental/containers/sequences/dynarray/dynarray.data/default.pass.cpp

Modified: 
libcxx/trunk/test/libcxx/experimental/containers/sequences/dynarray/dynarray.data/default.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/experimental/containers/sequences/dynarray/dynarray.data/default.pass.cpp?rev=245525r1=245524r2=245525view=diff
==
--- 
libcxx/trunk/test/libcxx/experimental/containers/sequences/dynarray/dynarray.data/default.pass.cpp
 (original)
+++ 
libcxx/trunk/test/libcxx/experimental/containers/sequences/dynarray/dynarray.data/default.pass.cpp
 Wed Aug 19 19:10:22 2015
@@ -7,15 +7,13 @@
 //
 
//===--===//
 
+// UNSUPPORTED: c++98, c++03, c++11
+
 // dynarray.data
 
 // T* data() noexcept;
 // const T* data() const noexcept;
 
-  
-#include __config
-
-#if _LIBCPP_STD_VER  11
 
 #include experimental/dynarray
 #include cassert
@@ -27,41 +25,44 @@
 using std::experimental::dynarray;
 
 template class T
-void dyn_test_const ( const dynarrayT dyn ) {
+void dyn_test_const(const dynarrayT dyn, bool CheckEquals = true) {
 const T *data = dyn.data ();
 assert ( data != NULL );
-assert ( std::equal ( dyn.begin(), dyn.end(), data ));
+if (CheckEquals) {
+assert ( std::equal ( dyn.begin(), dyn.end(), data ));
 }
+}
 
 template class T
-void dyn_test ( dynarrayT dyn ) {
+void dyn_test( dynarrayT dyn, bool CheckEquals = true) {
 T *data = dyn.data ();
 assert ( data != NULL );
-assert ( std::equal ( dyn.begin(), dyn.end(), data ));
+if (CheckEquals) {
+assert ( std::equal ( dyn.begin(), dyn.end(), data ));
 }
+}
 
 
 
 template class T
-void test ( const T val ) {
+void test(const T val, bool DefaultValueIsIndeterminate = false) {
 typedef dynarrayT dynA;
+
+const bool CheckDefaultValues = !DefaultValueIsIndeterminate;
+
+dynA d1(4);
+dyn_test(d1, CheckDefaultValues);
+dyn_test_const(d1, CheckDefaultValues);
 
-dynA d1 ( 4 );
-dyn_test ( d1 );
-dyn_test_const ( d1 );
-
-dynA d2 ( 7, val );
+dynA d2 (7, val);
 dyn_test ( d2 );
 dyn_test_const ( d2 );
-}
+}
 
 int main()
 {
-testint ( 14 );
-testdouble ( 14.0 );
+testint(14, /* DefaultValueIsIndeterminate */ true);
+testdouble(14.0, true);
 teststd::complexdouble ( std::complexdouble ( 14, 0 ));
 teststd::string ( fourteen );
 }
-#else
-int main() {}
-#endif


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


Re: [PATCH] D12137: Fix 4 typos in test/CodeGenCXX/

2015-08-19 Thread Timur Iskhodzhanov via cfe-commits
timu added a comment.

If you are a committer, commit via svn and then close the revision.
If you are not, ask some committer to do that for you (sorry, I don't have 
anything set up right now) and close when it lands.


http://reviews.llvm.org/D12137



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


Re: [PATCH] D12180: [clang-tidy] Use a python script instead of a shell script to run clang-tidy tests.

2015-08-19 Thread Alexander Kornienko via cfe-commits
alexfh updated this revision to Diff 32645.
alexfh added a comment.

Removed an unused import.


http://reviews.llvm.org/D12180

Files:
  test/clang-tidy/arg-comments.cpp
  test/clang-tidy/check_clang_tidy.py
  test/clang-tidy/google-explicit-constructor.cpp
  test/clang-tidy/google-explicit-make-pair.cpp
  test/clang-tidy/google-member-string-references.cpp
  test/clang-tidy/google-memset-zero-length.cpp
  test/clang-tidy/google-overloaded-unary-and.cpp
  test/clang-tidy/google-readability-casting.c
  test/clang-tidy/google-readability-casting.cpp
  test/clang-tidy/google-readability-namespace-comments.cpp
  test/clang-tidy/google-readability-todo.cpp
  test/clang-tidy/google-runtime-int.cpp
  test/clang-tidy/llvm-include-order.cpp
  test/clang-tidy/llvm-twine-local.cpp
  test/clang-tidy/misc-assert-side-effect.cpp
  test/clang-tidy/misc-assign-operator-signature.cpp
  test/clang-tidy/misc-bool-pointer-implicit-conversion.cpp
  test/clang-tidy/misc-inaccurate-erase.cpp
  test/clang-tidy/misc-inefficient-algorithm.cpp
  test/clang-tidy/misc-macro-parentheses.cpp
  test/clang-tidy/misc-noexcept-move-constructor.cpp
  test/clang-tidy/misc-repeated-side-effects-in-macro.c
  test/clang-tidy/misc-static-assert.cpp
  test/clang-tidy/misc-swapped-arguments.cpp
  test/clang-tidy/misc-undelegated-constructor.cpp
  test/clang-tidy/misc-uniqueptr-reset-release.cpp
  test/clang-tidy/misc-unused-alias-decls.cpp
  test/clang-tidy/misc-unused-parameters.c
  test/clang-tidy/misc-unused-parameters.cpp
  test/clang-tidy/misc-unused-raii.cpp
  test/clang-tidy/misc-use-override-cxx98.cpp
  test/clang-tidy/misc-use-override.cpp
  test/clang-tidy/modernize-loop-convert-basic.cpp
  test/clang-tidy/modernize-loop-convert-extra.cpp
  test/clang-tidy/modernize-loop-convert-negative.cpp
  test/clang-tidy/modernize-pass-by-value.cpp
  test/clang-tidy/modernize-use-nullptr-basic.cpp
  test/clang-tidy/modernize-use-nullptr.cpp
  test/clang-tidy/readability-braces-around-statements-few-lines.cpp
  test/clang-tidy/readability-braces-around-statements-same-line.cpp
  test/clang-tidy/readability-braces-around-statements-single-line.cpp
  test/clang-tidy/readability-braces-around-statements.cpp
  test/clang-tidy/readability-container-size-empty.cpp
  test/clang-tidy/readability-else-after-return.cpp
  test/clang-tidy/readability-function-size.cpp
  test/clang-tidy/readability-identifier-naming.cpp
  test/clang-tidy/readability-named-parameter.cpp
  test/clang-tidy/readability-redundant-smartptr-get.cpp
  test/clang-tidy/readability-redundant-string-cstr.cpp
  test/clang-tidy/readability-shrink-to-fit.cpp
  
test/clang-tidy/readability-simplify-bool-expr-chained-conditional-assignment.cpp
  test/clang-tidy/readability-simplify-bool-expr-chained-conditional-return.cpp
  test/clang-tidy/readability-simplify-bool-expr.cpp

Index: test/clang-tidy/readability-simplify-bool-expr.cpp
===
--- test/clang-tidy/readability-simplify-bool-expr.cpp
+++ test/clang-tidy/readability-simplify-bool-expr.cpp
@@ -1,5 +1,4 @@
-// RUN: $(dirname %s)/check_clang_tidy.sh %s readability-simplify-boolean-expr %t
-// REQUIRES: shell
+// RUN: $(dirname %s)/check_clang_tidy.py %s readability-simplify-boolean-expr %t
 
 bool a1 = false;
 
Index: test/clang-tidy/readability-simplify-bool-expr-chained-conditional-return.cpp
===
--- test/clang-tidy/readability-simplify-bool-expr-chained-conditional-return.cpp
+++ test/clang-tidy/readability-simplify-bool-expr-chained-conditional-return.cpp
@@ -1,5 +1,4 @@
-// RUN: $(dirname %s)/check_clang_tidy.sh %s readability-simplify-boolean-expr %t -config={CheckOptions: [{key: readability-simplify-boolean-expr.ChainedConditionalReturn, value: 1}]} --
-// REQUIRES: shell
+// RUN: $(dirname %s)/check_clang_tidy.py %s readability-simplify-boolean-expr %t -config={CheckOptions: [{key: readability-simplify-boolean-expr.ChainedConditionalReturn, value: 1}]} --
 
 bool chained_conditional_compound_return(int i) {
   if (i  0) {
Index: test/clang-tidy/readability-simplify-bool-expr-chained-conditional-assignment.cpp
===
--- test/clang-tidy/readability-simplify-bool-expr-chained-conditional-assignment.cpp
+++ test/clang-tidy/readability-simplify-bool-expr-chained-conditional-assignment.cpp
@@ -1,5 +1,4 @@
-// RUN: $(dirname %s)/check_clang_tidy.sh %s readability-simplify-boolean-expr %t -config={CheckOptions: [{key: readability-simplify-boolean-expr.ChainedConditionalAssignment, value: 1}]} --
-// REQUIRES: shell
+// RUN: $(dirname %s)/check_clang_tidy.py %s readability-simplify-boolean-expr %t -config={CheckOptions: [{key: readability-simplify-boolean-expr.ChainedConditionalAssignment, value: 1}]} --
 
 void chained_conditional_compound_assignment(int i) {
   bool b;
Index: test/clang-tidy/readability-shrink-to-fit.cpp

[clang-tools-extra] r245533 - [clang-tidy] Add back a test with a custom NULL macro. Remove redundant default.

2015-08-19 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Wed Aug 19 20:44:14 2015
New Revision: 245533

URL: http://llvm.org/viewvc/llvm-project?rev=245533view=rev
Log:
[clang-tidy] Add back a test with a custom NULL macro. Remove redundant default.

Modified:
clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp
clang-tools-extra/trunk/test/clang-tidy/modernize-use-nullptr.cpp

Modified: clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp?rev=245533r1=245532r2=245533view=diff
==
--- clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp Wed Aug 19 
20:44:14 2015
@@ -441,7 +441,7 @@ private:
 
 UseNullptrCheck::UseNullptrCheck(StringRef Name, ClangTidyContext *Context)
 : ClangTidyCheck(Name, Context),
-  NullMacrosStr(Options.get(NullMacros, NULL)) {
+  NullMacrosStr(Options.get(NullMacros, )) {
   StringRef(NullMacrosStr).split(NullMacros, ,);
 }
 

Modified: clang-tools-extra/trunk/test/clang-tidy/modernize-use-nullptr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/modernize-use-nullptr.cpp?rev=245533r1=245532r2=245533view=diff
==
--- clang-tools-extra/trunk/test/clang-tidy/modernize-use-nullptr.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/modernize-use-nullptr.cpp Wed Aug 
19 20:44:14 2015
@@ -78,6 +78,14 @@ void test_macro_expansion3() {
 #undef MACRO_EXPANSION_HAS_NULL
 }
 
+void test_macro_expansion4() {
+#define MY_NULL NULL
+  int *p = MY_NULL;
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: use nullptr 
[modernize-use-nullptr]
+  // CHECK-FIXES: int *p = nullptr;
+#undef MY_NULL
+}
+
 #define IS_EQ(x, y) if (x != y) return;
 void test_macro_args() {
   int i = 0;


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


Re: [PATCH] D12163: [Patch] [Analyzer] BugReporter.cpp:2869: Assertion failed: !RemainingNodes.empty() No error node found in the trimmed graph (PR 24184)

2015-08-19 Thread Anna Zaks via cfe-commits
zaks.anna added a comment.

I have some minor nits but looks good otherwise. Thanks for fixing this!



Comment at: include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h:290
@@ -289,2 +289,3 @@
  const ProgramPointTag *Tag = nullptr) {
-if (!State || (State == Pred-getState()  !Tag  !MarkAsSink))
+// It may not be safe to use the Pred node with no tag because the Pred
+// node may be recycled in the shouldCollect reclamation function. See

Please, remove the reference to the method name, the comment might get stale if 
the function name changes. Also, please, remove the PR reference from here.


Comment at: test/Analysis/malloc.c:1389
@@ -1388,2 +1388,3 @@
   char *m = realloc(a-p, size); // expected-warning {{Attempt to free 
released memory}}
-  return a-p;
+  //PR24184: Object a-p was returned at next line after being freed by 
calling realloc at previous line.
+  return a-p; // expected-warning {{Use of memory after it is freed}}

Some wordsmithing: Object a-p is returned after being freed by calling 
realloc.


http://reviews.llvm.org/D12163



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


Re: [PATCH] D12137: Fix 4 typos in test/CodeGenCXX/

2015-08-19 Thread Kai Zhao via cfe-commits
loverszhaokai added a comment.

What should I do now ?  Close Revision ?  Thanks.


http://reviews.llvm.org/D12137



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


[libcxx] r245529 - Cleanup unique_ptr failure tests and convert them to Clang verify

2015-08-19 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Wed Aug 19 20:08:03 2015
New Revision: 245529

URL: http://llvm.org/viewvc/llvm-project?rev=245529view=rev
Log:
Cleanup unique_ptr failure tests and convert them to Clang verify

Modified:

libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move01.fail.cpp

libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move02.fail.cpp

libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move03.fail.cpp

libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move04.fail.cpp

libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert01.fail.cpp

libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert02.fail.cpp

libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert03.fail.cpp

libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert04.fail.cpp

Modified: 
libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move01.fail.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move01.fail.cpp?rev=245529r1=245528r2=245529view=diff
==
--- 
libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move01.fail.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move01.fail.cpp
 Wed Aug 19 20:08:03 2015
@@ -14,25 +14,16 @@
 // Test unique_ptr move assignment
 
 #include memory
-#include cassert
 
-// Can't copy from lvalue
-
-struct A
-{
-static int count;
-A() {++count;}
-A(const A) {++count;}
-~A() {--count;}
-};
-
-int A::count = 0;
+#include test_macros.h
 
+// Can't copy from lvalue
 int main()
 {
-{
-std::unique_ptrA s(new A);
-std::unique_ptrA s2;
-s2 = s;
-}
+std::unique_ptrint s, s2;
+#if TEST_STD_VER = 11
+s2 = s; // expected-error {{cannot be assigned because its copy assignment 
operator is implicitly deleted}}
+#else
+s2 = s; // expected-error {{'operator=' is a private member}}
+#endif
 }

Modified: 
libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move02.fail.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move02.fail.cpp?rev=245529r1=245528r2=245529view=diff
==
--- 
libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move02.fail.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move02.fail.cpp
 Wed Aug 19 20:08:03 2015
@@ -14,25 +14,20 @@
 // Test unique_ptr move assignment
 
 #include memory
-#include cassert
 
-// Can't copy from const lvalue
-
-struct A
-{
-static int count;
-A() {++count;}
-A(const A) {++count;}
-~A() {--count;}
-};
+#include test_macros.h
 
-int A::count = 0;
+// Can't copy from const lvalue
 
 int main()
 {
-{
-const std::unique_ptrA s(new A);
-std::unique_ptrA s2;
-s2 = s;
-}
+const std::unique_ptrint s(new int);
+std::unique_ptrint s2;
+#if TEST_STD_VER = 11
+s2 = s; // expected-error {{cannot be assigned because its copy assignment 
operator is implicitly deleted}}
+#else
+// NOTE: The error says constructor because the assignment operator takes
+// 's' by value and attempts to copy construct it.
+s2 = s; // expected-error {{no matching constructor for initialization}}
+#endif
 }

Modified: 
libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move03.fail.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move03.fail.cpp?rev=245529r1=245528r2=245529view=diff
==
--- 
libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move03.fail.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move03.fail.cpp
 Wed Aug 19 20:08:03 2015
@@ -14,43 +14,20 @@
 // Test unique_ptr move assignment
 
 #include memory
-#include cassert
 
-// Can't copy from lvalue
+#include test_macros.h
 
-struct A
-{
-static int count;
-A() {++count;}
-A(const A) {++count;}
-~A() {--count;}
-};
-
-int A::count = 0;
-
-class Deleter
-{
-int state_;
-
-public:
-
-Deleter() : state_(5) {}
-
-int state() const {return state_;}

Re: [clang-tools-extra] r245471 - [clang-tidy] Fix a bug in UseNullptrCheck.

2015-08-19 Thread Alexander Kornienko via cfe-commits
The tests are passing now
http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA_check/6531/.
Will now try to add back the piece of test that was removed and see whether
it works.

On Thu, Aug 20, 2015 at 2:00 AM, Alexander Kornienko ale...@google.com
wrote:

 After looking at the code once again, I found an obvious use-after-free
 bug which could have caused all of this (and for some reason only
 manifested itself on Darwin). r245524 should fix the issue.


 On Thu, Aug 20, 2015 at 1:44 AM, Justin Bogner m...@justinbogner.com
 wrote:

 That didn't work either - both tests are still failing.

 Alexander Kornienko ale...@google.com writes:
  Something weird happens with options reading. Submitted a possible
 workaround
  in r245517.
 
  On Thu, Aug 20, 2015 at 12:48 AM, Justin Bogner m...@justinbogner.com
 wrote:
 
  Locally, it seems to fail two tests now:
 
  Failing Tests (2):
  Clang Tools :: clang-tidy/modernize-use-nullptr-basic.cpp
  Clang Tools :: clang-tidy/modernize-use-nullptr.cpp
 
  I'll poke at it for a minute and see if there's something obvious I
 can
  do, but running the run line manually just seems to return 127 with
 no
  output for me (as opposed to the output that's printed correctly
 under
  lit)
 
  Alexander Kornienko via cfe-commits cfe-commits@lists.llvm.org
 writes:
   I've committed the check with minor modifications and without the
  offending
   test in r245511. Could you verify that it works in your setup?
  
   -- Alex
  
   On Wed, Aug 19, 2015 at 11:41 PM, Pete Cooper 
 peter_coo...@apple.com
  wrote:
  
   On Aug 19, 2015, at 2:38 PM, Alexander Kornienko 
  ale...@google.com
   wrote:
  
   The check has been reverted in r245493. Sorry for the
 breakage,
  I was
   hoping that this commit fixes it.
  
   No problem.  Thanks for taking a look.
  
   If you think the rest of the code is good and want to land it
 again
  then
   thats fine.  You can leave out the check below until you are
 happy
  that
   its working too.  That way you potentially won’t be blocked
 for too
  long.
  
   Thanks,
   Pete
  
   On Wed, Aug 19, 2015 at 10:31 PM, Pete Cooper 
  peter_coo...@apple.com
   wrote:
  
   Looks like its only a single test thats failing.
  
   Would you mind if I remove this piece of the test
 until we
  can get
   to the bottom of it?
  
   void test_macro_expansion4() {
   #define MY_NULL NULL
 int *p = MY_NULL;
 // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: use
  nullptr
   [modernize-use-nullptr]
 // CHECK-FIXES: int *p = nullptr;
   #undef MY_NULL
   }
  
   Thanks,
   Pete
  
   On Aug 19, 2015, at 1:00 PM, Pete Cooper 
   peter_coo...@apple.com wrote:
  
   Hi Alexander
  
   We’re still getting a green dragon failure on the
 null
  ptr
   check test.  Mind taking a look?
  
   http://lab.llvm.org:8080/green/job/
   clang-stage1-configure-RA_check/10351/consoleFull#
   50560140149ba4694-19c4-4d7e-bec5-911270d8a58c
  
   Thanks
   Pete
  
   On Aug 19, 2015, at 10:50 AM, Alexander
 Kornienko
  via
   cfe-commits cfe-commits@lists.llvm.org
 wrote:
  
   Author: alexfh
   Date: Wed Aug 19 12:50:22 2015
   New Revision: 245471
  
   URL:
 https://urldefense.proofpoint.com/v2/url?u=
  
   http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D245471-26view-3Drev
   d=BQIGaQc=eEvniauFctOgLOKGJOplqwr=
   03tkj3107244TlY4t3_hEgkDY-UG6gKwwK0wOUS3qjMm=
   vEGzlOUc6IO5ny5JKNkJAUEoiokQ1N60GDcHk0yboKQs=
   wuoYp-wW8aBSkIHSX7igi7DHfur7JyIHWwnzHMTYdlge=
   Log:
   [clang-tidy] Fix a bug in UseNullptrCheck.
  
   https://urldefense.proofpoint.com/v2/url?u=
   http-3A__reviews.llvm.org_D12162d=BQIGaQc=
   eEvniauFctOgLOKGJOplqwr=
   03tkj3107244TlY4t3_hEgkDY-UG6gKwwK0wOUS3qjMm=
   vEGzlOUc6IO5ny5JKNkJAUEoiokQ1N60GDcHk0yboKQs=
   YiXUYCqfOl7durvaPOdifn3l7_G0FJhlE4A_q5Q6xwMe=
  

[libcxx] r245538 - Fix a typo: abreviated - abbreviated - Patch from Kai Zhao

2015-08-19 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Thu Aug 20 00:20:29 2015
New Revision: 245538

URL: http://llvm.org/viewvc/llvm-project?rev=245538view=rev
Log:
Fix a typo: abreviated - abbreviated - Patch from Kai Zhao

Modified:

libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_monthname.pass.cpp

libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_monthname_wide.pass.cpp

Modified: 
libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_monthname.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_monthname.pass.cpp?rev=245538r1=245537r2=245538view=diff
==
--- 
libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_monthname.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_monthname.pass.cpp
 Thu Aug 20 00:20:29 2015
@@ -12,7 +12,7 @@
 // REQUIRES: locale.ru_RU.UTF-8
 // REQUIRES: locale.zh_CN.UTF-8
 
-// NOTE: debian and opensuse use old locale data for ru_RU.UTF-8 abreviated
+// NOTE: debian and opensuse use old locale data for ru_RU.UTF-8 abbreviated
 // months. This locale data was changed in glibc 2.14.
 // Debian uses glibc 2.13 as of 20/11/2014
 // OpenSuse uses glibc 2.19 with old locale data as of 20/11/2014

Modified: 
libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_monthname_wide.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_monthname_wide.pass.cpp?rev=245538r1=245537r2=245538view=diff
==
--- 
libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_monthname_wide.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_monthname_wide.pass.cpp
 Thu Aug 20 00:20:29 2015
@@ -12,7 +12,7 @@
 // REQUIRES: locale.ru_RU.UTF-8
 // REQUIRES: locale.zh_CN.UTF-8
 
-// NOTE: debian and opensuse use bad locale data for ru_RU.UTF-8 abreviated
+// NOTE: debian and opensuse use bad locale data for ru_RU.UTF-8 abbreviated
 // months. This locale data was fixed in glibc 2.14.
 // Debian uses glibc 2.13 as of 20/11/2014
 // OpenSuse uses glibc 2.19 with old locale data as of 20/11/2014


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


Re: [PATCH] D12183: Fix a typo: abreviated - abbreviated

2015-08-19 Thread Eric Fiselier via cfe-commits
EricWF accepted this revision.
EricWF added a comment.
This revision is now accepted and ready to land.

Thanks again! A lot of these look like my mistakes :S


http://reviews.llvm.org/D12183



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


Re: [PATCH] D12183: Fix a typo: abreviated - abbreviated

2015-08-19 Thread Eric Fiselier via cfe-commits
EricWF closed this revision.
EricWF added a comment.

commited as r245538.


http://reviews.llvm.org/D12183



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


[libcxx] r245539 - Fix a typo: overidden - overridden - Patch from Kai Zhao

2015-08-19 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Thu Aug 20 00:23:16 2015
New Revision: 245539

URL: http://llvm.org/viewvc/llvm-project?rev=245539view=rev
Log:
Fix a typo: overidden - overridden - Patch from Kai Zhao

Modified:
libcxx/trunk/src/new.cpp

Modified: libcxx/trunk/src/new.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/new.cpp?rev=245539r1=245538r2=245539view=diff
==
--- libcxx/trunk/src/new.cpp (original)
+++ libcxx/trunk/src/new.cpp Thu Aug 20 00:23:16 2015
@@ -38,7 +38,7 @@
 #ifndef __GLIBCXX__
 
 // Implement all new and delete operators as weak definitions
-// in this shared library, so that they can be overriden by programs
+// in this shared library, so that they can be overridden by programs
 // that define non-weak copies of the functions.
 
 _LIBCPP_WEAK _LIBCPP_NEW_DELETE_VIS


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


  1   2   >