[PATCH] D16396: Warn if variable cannot be implicitly instantiated

2016-01-21 Thread Serge Pavlov via cfe-commits
sepavloff created this revision.
sepavloff added a reviewer: rsmith.
sepavloff added subscribers: cfe-commits, silvas.

Instantiation of static class members may be a source of user misunderstanding,
especially in the case of using modules, PR24425 describes one of such examples.
This patch implements warning if compiler tried to make implicit instantiation
but could not find template definition. The implementation follows discussion
of http://reviews.llvm.org/D12326.

http://reviews.llvm.org/D16396

Files:
  include/clang/Basic/DiagnosticGroups.td
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Sema/Sema.h
  lib/Sema/SemaTemplateInstantiateDecl.cpp
  test/CXX/temp/temp.decls/temp.mem/p1.cpp
  test/OpenMP/parallel_ast_print.cpp
  test/OpenMP/parallel_sections_ast_print.cpp
  test/OpenMP/task_ast_print.cpp
  test/OpenMP/teams_ast_print.cpp
  test/OpenMP/threadprivate_ast_print.cpp
  test/SemaCXX/PR10177.cpp
  test/SemaCXX/undefined-internal.cpp
  test/SemaTemplate/unavailable-var-template.cpp

Index: test/SemaTemplate/unavailable-var-template.cpp
===
--- /dev/null
+++ test/SemaTemplate/unavailable-var-template.cpp
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+template  struct Foo {
+  static char s_bar;
+  static char s_bar2;
+};
+
+extern template char Foo::s_bar2;
+
+char baz(char x) {
+  if (x == '.')
+return Foo::s_bar2;
+  return Foo::s_bar; // expected-warning{{instantiation of 'Foo::s_bar' required here, but corresponding template is not found}}
+  // expected-note@-1{{add an explicit instantiation declaration to suppress this warning if 'Foo::s_bar' is explicitly instantiated in another translation unit}}
+}
Index: test/SemaCXX/undefined-internal.cpp
===
--- test/SemaCXX/undefined-internal.cpp
+++ test/SemaCXX/undefined-internal.cpp
@@ -82,6 +82,7 @@
 static int var; // expected-warning {{variable 'test5::B::var' has internal linkage but is not defined}}
 static void foo(); // expected-warning {{function 'test5::B::foo' has internal linkage but is not defined}}
   };
+  extern template int B::var;
 
   void test() {
 B::var = 0; // expected-note {{used here}}
Index: test/SemaCXX/PR10177.cpp
===
--- test/SemaCXX/PR10177.cpp
+++ test/SemaCXX/PR10177.cpp
@@ -54,6 +54,7 @@
 
 namespace { template extern int n; }
 template int g() { return n; }
+namespace { extern template int n; }
 
 #endif
 
Index: test/OpenMP/threadprivate_ast_print.cpp
===
--- test/OpenMP/threadprivate_ast_print.cpp
+++ test/OpenMP/threadprivate_ast_print.cpp
@@ -69,4 +69,5 @@
   return (foo());
 }
 
+extern template int ST::m;
 #endif
Index: test/OpenMP/teams_ast_print.cpp
===
--- test/OpenMP/teams_ast_print.cpp
+++ test/OpenMP/teams_ast_print.cpp
@@ -109,4 +109,6 @@
   return tmain(b, &b) + tmain(x, &x);
 }
 
+extern template int S::TS;
+extern template long S::TS;
 #endif
Index: test/OpenMP/task_ast_print.cpp
===
--- test/OpenMP/task_ast_print.cpp
+++ test/OpenMP/task_ast_print.cpp
@@ -149,4 +149,7 @@
   return tmain(b, &b) + tmain(x, &x);
 }
 
+extern template int S::TS;
+extern template long S::TS;
+
 #endif
Index: test/OpenMP/parallel_sections_ast_print.cpp
===
--- test/OpenMP/parallel_sections_ast_print.cpp
+++ test/OpenMP/parallel_sections_ast_print.cpp
@@ -141,4 +141,7 @@
   return tmain(b, &b) + tmain(x, &x);
 }
 
+template
+T S::TS = 0;
+
 #endif
Index: test/OpenMP/parallel_ast_print.cpp
===
--- test/OpenMP/parallel_ast_print.cpp
+++ test/OpenMP/parallel_ast_print.cpp
@@ -171,4 +171,7 @@
   }
 }
 
+template
+T S::TS = 0;
+
 #endif
Index: test/CXX/temp/temp.decls/temp.mem/p1.cpp
===
--- test/CXX/temp/temp.decls/temp.mem/p1.cpp
+++ test/CXX/temp/temp.decls/temp.mem/p1.cpp
@@ -10,6 +10,7 @@
 }
   };
 };
+extern template bool A::cond;
 
 int foo() {
   A::cond = true;
Index: lib/Sema/SemaTemplateInstantiateDecl.cpp
===
--- lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -3768,7 +3768,7 @@
 
 void Sema::InstantiateVariableDefinition(SourceLocation PointOfInstantiation,
  VarDecl *Var, bool Recursive,
- bool DefinitionRequired) {
+  bool DefinitionRequired, bool AtEndOfTU) {
   if (Var->isInvalidDecl())
 return;
 
@@ -3900,6 +3900,14 @@
  == TSK_Explici

[PATCH] D16400: [OpenMP] Sema for depend clause on target enter data directive.

2016-01-21 Thread Arpith Jacob via cfe-commits
arpith-jacob created this revision.
arpith-jacob added reviewers: ABataev, kkwli0, hfinkel, sfantao, carlo.bertolli.
arpith-jacob added subscribers: cfe-commits, fraggamuffin, caomhin.

Accept depend clause on target enter data directive in sema and add test cases.

http://reviews.llvm.org/D16400

Files:
  include/clang/Basic/OpenMPKinds.def
  test/OpenMP/target_enter_data_ast_print.cpp
  test/OpenMP/target_enter_data_depend_messages.cpp

Index: test/OpenMP/target_enter_data_depend_messages.cpp
===
--- /dev/null
+++ test/OpenMP/target_enter_data_depend_messages.cpp
@@ -0,0 +1,90 @@
+// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -o - -std=c++11 %s
+
+void foo() {
+}
+
+bool foobool(int argc) {
+  return argc;
+}
+
+struct S1; // expected-note {{declared here}}
+
+class vector {
+  public:
+int operator[](int index) { return 0; }
+};
+
+int main(int argc, char **argv, char *env[]) {
+  vector vec;
+  typedef float V __attribute__((vector_size(16)));
+  V a;
+  auto arr = x; // expected-error {{use of undeclared identifier 'x'}}
+
+  int i;
+  #pragma omp target enter data map(to: i) depend // expected-error {{expected '(' after 'depend'}}
+  foo();
+  #pragma omp target enter data map(to: i) depend ( // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}} expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after dependency type - ignoring}}
+  foo();
+  #pragma omp target enter data map(to: i) depend () // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}}
+  foo();
+  #pragma omp target enter data map(to: i) depend (argc // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} expected-error {{expected ')'}} expected-note {{to match this '('}}
+  foo();
+  #pragma omp target enter data map(to: i) depend (source : argc) // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}}
+  foo();
+  #pragma omp target enter data map(to: i) depend (source) // expected-error {{expected expression}} expected-warning {{missing ':' after dependency type - ignoring}}
+  foo();
+  #pragma omp target enter data map(to: i) depend (in : argc)) // expected-warning {{extra tokens at the end of '#pragma omp target enter data map(to: i)' are ignored}}
+  foo();
+  #pragma omp target enter data map(to: i) depend (out: ) // expected-error {{expected expression}}
+  foo();
+  #pragma omp target enter data map(to: i) depend (inout : foobool(argc)), depend (in, argc) // expected-error {{expected variable name, array element or array section}} expected-warning {{missing ':' after dependency type - ignoring}} expected-error {{expected expression}}
+  foo();
+  #pragma omp target enter data map(to: i) depend (out :S1) // expected-error {{'S1' does not refer to a value}}
+  foo();
+  #pragma omp target enter data map(to: i) depend(in : argv[1][1] = '2') // expected-error {{expected variable name, array element or array section}}
+  foo();
+  #pragma omp target enter data map(to: i) depend (in : vec[1]) // expected-error {{expected variable name, array element or array section}}
+  foo();
+  #pragma omp target enter data map(to: i) depend (in : argv[0])
+  foo();
+  #pragma omp target enter data map(to: i) depend (in : ) // expected-error {{expected expression}}
+  foo();
+  #pragma omp target enter data map(to: i) depend (in : main) // expected-error {{expected variable name, array element or array section}}
+  foo();
+  #pragma omp target enter data map(to: i) depend(in : a[0]) // expected-error{{expected variable name, array element or array section}}
+  foo();
+  #pragma omp target enter data map(to: i) depend (in : vec[1:2]) // expected-error {{ value is not an array or pointer}}
+  foo();
+  #pragma omp target enter data map(to: i) depend (in : argv[ // expected-error {{expected expression}} expected-error {{expected ']'}} expected-error {{expected ')'}} expected-note {{to match this '['}} expected-note {{to match this '('}}
+  foo();
+  #pragma omp target enter data map(to: i) depend (in : argv[: // expected-error {{expected expression}} expected-error {{expected ']'}} expected-error {{expected ')'}} expected-note {{to match this '['}} expected-note {{to match this '('}}
+  foo();
+  #pragma omp target enter data map(to: i) depend (in : argv[:] // expected-error {{section length is unspecified and cannot be inferred because subscripted value is not an array}} expected-error {{expected ')'}} expected-note {{to match this '('}}
+  foo();
+  #pragma omp target enter data map(to: i) depend (in : argv[argc: // expected-error {{expected expression}} expected-error {{expected ']'}} expected-error {{expected ')'}} expected-note {{to match this '['}} expected-note {{to match this '('}}
+  foo();
+  #

[PATCH] D16401: [OpenMP] Sema for depend clause on target exit data directive.

2016-01-21 Thread Arpith Jacob via cfe-commits
arpith-jacob created this revision.
arpith-jacob added reviewers: ABataev, kkwli0, hfinkel, sfantao, carlo.bertolli.
arpith-jacob added subscribers: cfe-commits, fraggamuffin, caomhin.

Accept depend clause on target exit data directive in sema and add test cases.

http://reviews.llvm.org/D16401

Files:
  include/clang/Basic/OpenMPKinds.def
  test/OpenMP/target_exit_data_ast_print.cpp
  test/OpenMP/target_exit_data_depend_messages.cpp

Index: test/OpenMP/target_exit_data_depend_messages.cpp
===
--- /dev/null
+++ test/OpenMP/target_exit_data_depend_messages.cpp
@@ -0,0 +1,90 @@
+// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -o - -std=c++11 %s
+
+void foo() {
+}
+
+bool foobool(int argc) {
+  return argc;
+}
+
+struct S1; // expected-note {{declared here}}
+
+class vector {
+  public:
+int operator[](int index) { return 0; }
+};
+
+int main(int argc, char **argv, char *env[]) {
+  vector vec;
+  typedef float V __attribute__((vector_size(16)));
+  V a;
+  auto arr = x; // expected-error {{use of undeclared identifier 'x'}}
+
+  int i;
+  #pragma omp target exit data map(from: i) depend // expected-error {{expected '(' after 'depend'}}
+  foo();
+  #pragma omp target exit data map(from: i) depend ( // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}} expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after dependency type - ignoring}}
+  foo();
+  #pragma omp target exit data map(from: i) depend () // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}}
+  foo();
+  #pragma omp target exit data map(from: i) depend (argc // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} expected-error {{expected ')'}} expected-note {{to match this '('}}
+  foo();
+  #pragma omp target exit data map(from: i) depend (source : argc) // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}}
+  foo();
+  #pragma omp target exit data map(from: i) depend (source) // expected-error {{expected expression}} expected-warning {{missing ':' after dependency type - ignoring}}
+  foo();
+  #pragma omp target exit data map(from: i) depend (in : argc)) // expected-warning {{extra tokens at the end of '#pragma omp target exit data' are ignored}}
+  foo();
+  #pragma omp target exit data map(from: i) depend (out: ) // expected-error {{expected expression}}
+  foo();
+  #pragma omp target exit data map(from: i) depend (inout : foobool(argc)), depend (in, argc) // expected-error {{expected variable name, array element or array section}} expected-warning {{missing ':' after dependency type - ignoring}} expected-error {{expected expression}}
+  foo();
+  #pragma omp target exit data map(from: i) depend (out :S1) // expected-error {{'S1' does not refer to a value}}
+  foo();
+  #pragma omp target exit data map(from: i) depend(in : argv[1][1] = '2') // expected-error {{expected variable name, array element or array section}}
+  foo();
+  #pragma omp target exit data map(from: i) depend (in : vec[1]) // expected-error {{expected variable name, array element or array section}}
+  foo();
+  #pragma omp target exit data map(from: i) depend (in : argv[0])
+  foo();
+  #pragma omp target exit data map(from: i) depend (in : ) // expected-error {{expected expression}}
+  foo();
+  #pragma omp target exit data map(from: i) depend (in : main) // expected-error {{expected variable name, array element or array section}}
+  foo();
+  #pragma omp target exit data map(from: i) depend(in : a[0]) // expected-error{{expected variable name, array element or array section}}
+  foo();
+  #pragma omp target exit data map(from: i) depend (in : vec[1:2]) // expected-error {{ value is not an array or pointer}}
+  foo();
+  #pragma omp target exit data map(from: i) depend (in : argv[ // expected-error {{expected expression}} expected-error {{expected ']'}} expected-error {{expected ')'}} expected-note {{to match this '['}} expected-note {{to match this '('}}
+  foo();
+  #pragma omp target exit data map(from: i) depend (in : argv[: // expected-error {{expected expression}} expected-error {{expected ']'}} expected-error {{expected ')'}} expected-note {{to match this '['}} expected-note {{to match this '('}}
+  foo();
+  #pragma omp target exit data map(from: i) depend (in : argv[:] // expected-error {{section length is unspecified and cannot be inferred because subscripted value is not an array}} expected-error {{expected ')'}} expected-note {{to match this '('}}
+  foo();
+  #pragma omp target exit data map(from: i) depend (in : argv[argc: // expected-error {{expected expression}} expected-error {{expected ']'}} expected-error {{expected ')'}} expected-note {{to match this '['}} expected-note {{to match this '('}}
+  foo();

Re: [PATCH] D16400: [OpenMP] Sema for depend clause on target enter data directive.

2016-01-21 Thread Alexey Bataev via cfe-commits
ABataev added a comment.

Add tests for templates to test/OpenMP/target_enter_data_depend_messages.cpp


http://reviews.llvm.org/D16400



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


r258394 - [OPENMP] Fix crash on reduction for complex variables.

2016-01-21 Thread Alexey Bataev via cfe-commits
Author: abataev
Date: Thu Jan 21 06:35:58 2016
New Revision: 258394

URL: http://llvm.org/viewvc/llvm-project?rev=258394&view=rev
Log:
[OPENMP] Fix crash on reduction for complex variables.
reworked codegen for reduction operation for complex types to avoid crash

Modified:
cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp
cfe/trunk/lib/CodeGen/CodeGenFunction.h
cfe/trunk/test/OpenMP/parallel_reduction_codegen.cpp

Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp?rev=258394&r1=258393&r2=258394&view=diff
==
--- cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp Thu Jan 21 06:35:58 2016
@@ -3548,14 +3548,16 @@ void CGOpenMPRuntime::emitReduction(Code
   E = CGF.EmitAnyExpr(EExpr);
 CGF.EmitOMPAtomicSimpleUpdateExpr(
 X, E, BO, /*IsXLHSInRHSPart=*/true, llvm::Monotonic, Loc,
-[&CGF, UpExpr, VD, IPriv](RValue XRValue) {
+[&CGF, UpExpr, VD, IPriv, Loc](RValue XRValue) {
   CodeGenFunction::OMPPrivateScope PrivateScope(CGF);
-  PrivateScope.addPrivate(VD, [&CGF, VD, XRValue]() -> Address 
{
-Address LHSTemp = CGF.CreateMemTemp(VD->getType());
-CGF.EmitStoreThroughLValue(
-XRValue, CGF.MakeAddrLValue(LHSTemp, VD->getType()));
-return LHSTemp;
-  });
+  PrivateScope.addPrivate(
+  VD, [&CGF, VD, XRValue, Loc]() -> Address {
+Address LHSTemp = CGF.CreateMemTemp(VD->getType());
+CGF.emitOMPSimpleStore(
+CGF.MakeAddrLValue(LHSTemp, VD->getType()), 
XRValue,
+VD->getType().getNonReferenceType(), Loc);
+return LHSTemp;
+  });
   (void)PrivateScope.Privatize();
   return CGF.EmitAnyExpr(UpExpr);
 });

Modified: cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp?rev=258394&r1=258393&r2=258394&view=diff
==
--- cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp Thu Jan 21 06:35:58 2016
@@ -2167,17 +2167,17 @@ static void emitSimpleAtomicStore(CodeGe
   }
 }
 
-static void emitSimpleStore(CodeGenFunction &CGF, LValue LVal, RValue RVal,
-QualType RValTy, SourceLocation Loc) {
-  switch (CGF.getEvaluationKind(LVal.getType())) {
+void CodeGenFunction::emitOMPSimpleStore(LValue LVal, RValue RVal,
+ QualType RValTy, SourceLocation Loc) {
+  switch (getEvaluationKind(LVal.getType())) {
   case TEK_Scalar:
-CGF.EmitStoreThroughLValue(RValue::get(convertToScalarValue(
-   CGF, RVal, RValTy, LVal.getType(), Loc)),
-   LVal);
+EmitStoreThroughLValue(RValue::get(convertToScalarValue(
+   *this, RVal, RValTy, LVal.getType(), Loc)),
+   LVal);
 break;
   case TEK_Complex:
-CGF.EmitStoreOfComplex(
-convertToComplexValue(CGF, RVal, RValTy, LVal.getType(), Loc), LVal,
+EmitStoreOfComplex(
+convertToComplexValue(*this, RVal, RValTy, LVal.getType(), Loc), LVal,
 /*isInit=*/false);
 break;
   case TEK_Aggregate:
@@ -2205,7 +2205,7 @@ static void EmitOMPAtomicReadExpr(CodeGe
   // list.
   if (IsSeqCst)
 CGF.CGM.getOpenMPRuntime().emitFlush(CGF, llvm::None, Loc);
-  emitSimpleStore(CGF, VLValue, Res, X->getType().getNonReferenceType(), Loc);
+  CGF.emitOMPSimpleStore(VLValue, Res, X->getType().getNonReferenceType(), 
Loc);
 }
 
 static void EmitOMPAtomicWriteExpr(CodeGenFunction &CGF, bool IsSeqCst,
@@ -2463,7 +2463,7 @@ static void EmitOMPAtomicCaptureExpr(Cod
 }
   }
   // Emit post-update store to 'v' of old/new 'x' value.
-  emitSimpleStore(CGF, VLValue, NewVVal, NewVValType, Loc);
+  CGF.emitOMPSimpleStore(VLValue, NewVVal, NewVValType, Loc);
   // OpenMP, 2.12.6, atomic Construct
   // Any atomic construct with a seq_cst clause forces the atomically
   // performed operation to include an implicit flush operation without a

Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=258394&r1=258393&r2=258394&view=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Thu Jan 21 06:35:58 2016
@@ -2212,6 +2212,8 @@ public:
   llvm::Function *G

Re: [PATCH] D16394: Add an isVirtualAsWritten AST matcher.

2016-01-21 Thread Aaron Ballman via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.

FWIW, LGTM as well.


http://reviews.llvm.org/D16394



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


r258396 - Fix crash for typedefs for arrays of runtime bounds in Lambdas/Captured Statements, used in sizeof() expression only.

2016-01-21 Thread Alexey Bataev via cfe-commits
Author: abataev
Date: Thu Jan 21 06:54:48 2016
New Revision: 258396

URL: http://llvm.org/viewvc/llvm-project?rev=258396&view=rev
Log:
Fix crash for typedefs for arrays of runtime bounds in Lambdas/Captured 
Statements, used in sizeof() expression only.

Modified:
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/test/CodeGenCXX/lambda-expressions.cpp

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=258396&r1=258395&r2=258396&view=diff
==
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Thu Jan 21 06:54:48 2016
@@ -3748,6 +3748,128 @@ bool Sema::CheckVecStepExpr(Expr *E) {
   return CheckUnaryExprOrTypeTraitOperand(E, UETT_VecStep);
 }
 
+static void captureVariablyModifiedType(ASTContext &Context, QualType T,
+CapturingScopeInfo *CSI) {
+  assert(T->isVariablyModifiedType());
+  assert(CSI != nullptr);
+
+  // We're going to walk down into the type and look for VLA expressions.
+  do {
+const Type *Ty = T.getTypePtr();
+switch (Ty->getTypeClass()) {
+#define TYPE(Class, Base)
+#define ABSTRACT_TYPE(Class, Base)
+#define NON_CANONICAL_TYPE(Class, Base)
+#define DEPENDENT_TYPE(Class, Base) case Type::Class:
+#define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base)
+#include "clang/AST/TypeNodes.def"
+  T = QualType();
+  break;
+// These types are never variably-modified.
+case Type::Builtin:
+case Type::Complex:
+case Type::Vector:
+case Type::ExtVector:
+case Type::Record:
+case Type::Enum:
+case Type::Elaborated:
+case Type::TemplateSpecialization:
+case Type::ObjCObject:
+case Type::ObjCInterface:
+case Type::ObjCObjectPointer:
+case Type::Pipe:
+  llvm_unreachable("type class is never variably-modified!");
+case Type::Adjusted:
+  T = cast(Ty)->getOriginalType();
+  break;
+case Type::Decayed:
+  T = cast(Ty)->getPointeeType();
+  break;
+case Type::Pointer:
+  T = cast(Ty)->getPointeeType();
+  break;
+case Type::BlockPointer:
+  T = cast(Ty)->getPointeeType();
+  break;
+case Type::LValueReference:
+case Type::RValueReference:
+  T = cast(Ty)->getPointeeType();
+  break;
+case Type::MemberPointer:
+  T = cast(Ty)->getPointeeType();
+  break;
+case Type::ConstantArray:
+case Type::IncompleteArray:
+  // Losing element qualification here is fine.
+  T = cast(Ty)->getElementType();
+  break;
+case Type::VariableArray: {
+  // Losing element qualification here is fine.
+  const VariableArrayType *VAT = cast(Ty);
+
+  // Unknown size indication requires no size computation.
+  // Otherwise, evaluate and record it.
+  if (auto Size = VAT->getSizeExpr()) {
+if (!CSI->isVLATypeCaptured(VAT)) {
+  RecordDecl *CapRecord = nullptr;
+  if (auto LSI = dyn_cast(CSI)) {
+CapRecord = LSI->Lambda;
+  } else if (auto CRSI = dyn_cast(CSI)) {
+CapRecord = CRSI->TheRecordDecl;
+  }
+  if (CapRecord) {
+auto ExprLoc = Size->getExprLoc();
+auto SizeType = Context.getSizeType();
+// Build the non-static data member.
+auto Field =
+FieldDecl::Create(Context, CapRecord, ExprLoc, ExprLoc,
+  /*Id*/ nullptr, SizeType, /*TInfo*/ nullptr,
+  /*BW*/ nullptr, /*Mutable*/ false,
+  /*InitStyle*/ ICIS_NoInit);
+Field->setImplicit(true);
+Field->setAccess(AS_private);
+Field->setCapturedVLAType(VAT);
+CapRecord->addDecl(Field);
+
+CSI->addVLATypeCapture(ExprLoc, SizeType);
+  }
+}
+  }
+  T = VAT->getElementType();
+  break;
+}
+case Type::FunctionProto:
+case Type::FunctionNoProto:
+  T = cast(Ty)->getReturnType();
+  break;
+case Type::Paren:
+case Type::TypeOf:
+case Type::UnaryTransform:
+case Type::Attributed:
+case Type::SubstTemplateTypeParm:
+case Type::PackExpansion:
+  // Keep walking after single level desugaring.
+  T = T.getSingleStepDesugaredType(Context);
+  break;
+case Type::Typedef:
+  T = cast(Ty)->desugar();
+  break;
+case Type::Decltype:
+  T = cast(Ty)->desugar();
+  break;
+case Type::Auto:
+  T = cast(Ty)->getDeducedType();
+  break;
+case Type::TypeOfExpr:
+  T = cast(Ty)->getUnderlyingExpr()->getType();
+  break;
+case Type::Atomic:
+  T = cast(Ty)->getValueType();
+  break;
+}
+  } while (!T.isNull() && T->isVariablyModifiedType());
+}
+
 /// \brief Build a sizeof or alignof expression given a type operand.
 ExprResult
 Sema::CreateUnaryExprOrTypeTraitExpr(TypeSourceInf

Re: [PATCH] D11035: trivial patch, improve constness

2016-01-21 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki marked an inline comment as done.
danielmarjamaki added a comment.

http://reviews.llvm.org/D11035



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


Re: [PATCH] D11035: trivial patch, improve constness

2016-01-21 Thread Aaron Ballman via cfe-commits
aaron.ballman added a subscriber: aaron.ballman.
aaron.ballman accepted this revision.
aaron.ballman added a reviewer: aaron.ballman.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM!


http://reviews.llvm.org/D11035



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


Re: [PATCH] D16310: new clang-tidy checker misc-long-cast

2016-01-21 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment.

In http://reviews.llvm.org/D16310#331538, @LegalizeAdulthood wrote:

> If you state what the check does, then
>
> In http://reviews.llvm.org/D16310#331054, @danielmarjamaki wrote:
>
> > In http://reviews.llvm.org/D16310#330367, @LegalizeAdulthood wrote:
> >
> > > Why not supply a fixit that removes the cast?
> >
> >
> > I am skeptic. There are different valid fixes.
> >
> > Example code:
> >
> >   l = (long)(a*1000);
> >   
> >
> > Fix1:
> >
> >   l = ((long)a * 1000);
> >   
> >
> > Fix2:
> >
> >   l = (a * (long)1000);
> >   
> >
> > Fix3:
> >
> >   l = (a * 1000L);
>
>
> The way I see it, the check is complaining about the pointless cast and 
> pointing the finger at the beginning of the cast.  To me, my expectation is 
> that the suggested fix is none of the options you gave but instead:
>
>   l = (a*1000);
>
>
> In other words, the cast is superfluous for the code as written.  Omitting 
> the cast directly expresses the code as written without unnecessary casting.  
> Because the check can't know your intent, it hints that you may have intended 
> something else, but for what was written, this **is** the semantics.
>
> If we want to get into detecting numeric overflow, then we're talking some 
> kind of run-time assisted check and it's beyond the scope of clang-tidy.
>
> Basically, I look at this unnecessary cast as clutter.  I'm fine with static 
> analysis that warns about intermediate expressions possibly overflowing when 
> assigned to a "larger" type, but to me that sounds like something for the 
> static analyzer and not for tidy.
>
> In other words, I think of clang-tidy as a refactoring tool, not a static 
> analysis tool.


Why is there a cast in the first place? It is unlikely that the programmer 
added a useless cast for no reason.

I say that it looks like the programmer wanted to avoid loss of precision.

If we remove the useless cast there will still be loss of precision. And the 
warnings go away so maybe a sloppy programmer thinks that all is good.

> I tested this on debian projects.. and I see quite little noise. in 1212 
> projects I got 76 warnings.


In my opinion the proper fix for these are to cast the expressions properly.


Repository:
  rL LLVM

http://reviews.llvm.org/D16310



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


Re: [PATCH] D16310: new clang-tidy checker misc-long-cast

2016-01-21 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki marked an inline comment as done.


Comment at: clang-tidy/misc/LongCastCheck.cpp:43
@@ +42,3 @@
+
+static unsigned getMaxCalculationWidth(ASTContext &C, const Expr *E) {
+  E = E->IgnoreParenImpCasts();

LegalizeAdulthood wrote:
> Prefer anonymous namespace over `static` to scope visibility.
As I read the LLVM coding standards we prefer static for functions.

http://llvm.org/docs/CodingStandards.html#anonymous-namespaces




Comment at: clang-tidy/misc/LongCastCheck.cpp:97
@@ +96,3 @@
+
+  if (!CastType->isIntegerType() || !SubType->isIntegerType())
+return;

LegalizeAdulthood wrote:
> Why don't you check for casting a `float` expression to a `double` or `long 
> double`?
> 
> Isn't this the exact same issue?
> 
> If so, add a test case for casting a `float` expression to `double` and a 
> test case for casting a `double` expression to a `long double`.
in theory yes.. but somehow that feels strange to me. yes there will possibly 
be loss of precision in some decimals, that is normal when using floating point 
numbers. if such loss of precision would be unwanted then float should be 
avoided to start with.

so I do agree in theory but I don't think I would feel good about adding such 
warnings.



Comment at: clang-tidy/misc/MiscTidyModule.cpp:61
@@ -59,1 +60,3 @@
+CheckFactories.registerCheck(
+"misc-long-cast");
 CheckFactories.registerCheck(

LegalizeAdulthood wrote:
> The documentation describes this check as one that looks for a cast to a 
> "bigger type", but the name of the check implies that it only works for casts 
> to `long`.
> 
> The name of the check should be made more generic to reflect reality.
> 
> Perhaps `misc-redundant-cast-to-larger-type` or 
> `misc-redundant-bigger-type-cast`?
Yes I agree.. will fix..

I used long because that is the typical case that I envision.


Repository:
  rL LLVM

http://reviews.llvm.org/D16310



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


Re: [PATCH] D16400: [OpenMP] Sema for depend clause on target enter data directive.

2016-01-21 Thread Arpith Jacob via cfe-commits
arpith-jacob updated this revision to Diff 45525.
arpith-jacob added a comment.

Added template instantiation test case for all feasible tests.


http://reviews.llvm.org/D16400

Files:
  include/clang/Basic/OpenMPKinds.def
  test/OpenMP/target_enter_data_ast_print.cpp
  test/OpenMP/target_enter_data_depend_messages.cpp

Index: test/OpenMP/target_enter_data_depend_messages.cpp
===
--- /dev/null
+++ test/OpenMP/target_enter_data_depend_messages.cpp
@@ -0,0 +1,166 @@
+// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -o - -std=c++11 %s
+
+void foo() {
+}
+
+bool foobool(int argc) {
+  return argc;
+}
+
+struct S1; // expected-note {{declared here}} expected-note {{declared here}}
+
+class vector {
+  public:
+int operator[](int index) { return 0; }
+};
+
+template 
+int tmain(T argc, S **argv, R *env[]) {
+  vector vec;
+  typedef float V __attribute__((vector_size(16)));
+  V a;
+  char *arr;
+
+  int i;
+  #pragma omp target enter data map(to: i) depend // expected-error {{expected '(' after 'depend'}}
+  foo();
+  #pragma omp target enter data map(to: i) depend ( // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}} expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after dependency type - ignoring}}
+  foo();
+  #pragma omp target enter data map(to: i) depend () // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}}
+  foo();
+  #pragma omp target enter data map(to: i) depend (argc // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} expected-error {{expected ')'}} expected-note {{to match this '('}}
+  foo();
+  #pragma omp target enter data map(to: i) depend (source : argc) // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}}
+  foo();
+  #pragma omp target enter data map(to: i) depend (source) // expected-error {{expected expression}} expected-warning {{missing ':' after dependency type - ignoring}}
+  foo();
+  #pragma omp target enter data map(to: i) depend (in : argc)) // expected-warning {{extra tokens at the end of '#pragma omp target enter data' are ignored}}
+  foo();
+  #pragma omp target enter data map(to: i) depend (out: ) // expected-error {{expected expression}}
+  foo();
+  #pragma omp target enter data map(to: i) depend (inout : foobool(argc)), depend (in, argc) // expected-error {{expected variable name, array element or array section}} expected-warning {{missing ':' after dependency type - ignoring}} expected-error {{expected expression}}
+  foo();
+  #pragma omp target enter data map(to: i) depend (out :S1) // expected-error {{'S1' does not refer to a value}}
+  foo();
+  #pragma omp target enter data map(to: i) depend(in : argv[1][1] = '2') // expected-error {{expected variable name, array element or array section}}
+  foo();
+  #pragma omp target enter data map(to: i) depend (in : vec[1]) // expected-error {{expected variable name, array element or array section}}
+  foo();
+  #pragma omp target enter data map(to: i) depend (in : argv[0])
+  foo();
+  #pragma omp target enter data map(to: i) depend (in : ) // expected-error {{expected expression}}
+  foo();
+  #pragma omp target enter data map(to: i) depend (in : tmain) // expected-error {{expected variable name, array element or array section}}
+  foo();
+  #pragma omp target enter data map(to: i) depend(in : a[0]) // expected-error{{expected variable name, array element or array section}}
+  foo();
+  #pragma omp target enter data map(to: i) depend (in : vec[1:2]) // expected-error {{ value is not an array or pointer}}
+  foo();
+  #pragma omp target enter data map(to: i) depend (in : argv[ // expected-error {{expected expression}} expected-error {{expected ']'}} expected-error {{expected ')'}} expected-note {{to match this '['}} expected-note {{to match this '('}}
+  foo();
+  #pragma omp target enter data map(to: i) depend (in : argv[: // expected-error {{expected expression}} expected-error {{expected ']'}} expected-error {{expected ')'}} expected-note {{to match this '['}} expected-note {{to match this '('}}
+  foo();
+  #pragma omp target enter data map(to: i) depend (in : argv[:] // expected-error {{section length is unspecified and cannot be inferred because subscripted value is not an array}} expected-error {{expected ')'}} expected-note {{to match this '('}}
+  foo();
+  #pragma omp target enter data map(to: i) depend (in : argv[argc: // expected-error {{expected expression}} expected-error {{expected ']'}} expected-error {{expected ')'}} expected-note {{to match this '['}} expected-note {{to match this '('}}
+  foo();
+  #pragma omp target enter data map(to: i) depend (in : argv[argc:argc] // expected-error {{expected ')'}} expected-note {{to match this '('}}
+  foo();
+ 

Re: [PATCH] D16376: clang-tidy check: User-defined copy without assignment

2016-01-21 Thread Aaron Ballman via cfe-commits
aaron.ballman added inline comments.


Comment at: clang-tidy/misc/UserDefinedCopyWithoutAssignmentCheck.cpp:37
@@ +36,3 @@
+
+  DiagnosticBuilder Diag = diag(MatchedDecl->getLocation(), "class '%0' 
defines a copy-constructor but not an assignment operator")
+  << ClassName;

You should run clang-format over the patch to address 80-col limit issues like 
this.


Comment at: clang-tidy/misc/UserDefinedCopyWithoutAssignmentCheck.cpp:49
@@ +48,3 @@
+  llvm::raw_string_ostream Insertion(S);
+  Insertion << "\n" << ClassName << "& operator = (const " << ClassName << "&) 
= delete;";
+

I think we usually prefer `operator=` to `operator =`, but am not certain.


Comment at: clang-tidy/misc/UserDefinedCopyWithoutAssignmentCheck.cpp:51
@@ +50,3 @@
+
+  Diag << FixItHint::CreateInsertion(CCtorEnd, Insertion.str());
+}

We probably do not want to generate this fixit unless we are compiling for at 
least C++11. We should have a test for C++98.


Comment at: clang-tidy/misc/UserDefinedCopyWithoutAssignmentCheck.h:24
@@ +23,3 @@
+/// copy-constructors but no assignement operator and (defensively) defines the
+/// assignment operator to be `= delete`.
+///

Would it make sense to have an explicitly defaulted copy constructor generate a 
fixit for an explicitly defaulted copy assignment operator instead of a deleted 
one? It seems like the user is being explicit about wanting default copy 
operations more often in that case, and the defaulted copy constructor would 
not be actively harmful to that.


Comment at: 
docs/clang-tidy/checks/misc-user-defined-copy-without-assignment.rst:24
@@ +23,3 @@
+The fix is defensive. Incorrect compiler-generated assignement can cause
+unexpected behaviour. An explicitly deleted assigneemnt operator will cause a
+compiler error if it is used.

s/assigneemnt/assignment


Repository:
  rL LLVM

http://reviews.llvm.org/D16376



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


[PATCH] D16406: [libcxx] Add appropriate 'REQUIRE' directives to tests that require en_US.UTF-8.

2016-01-21 Thread Daniel Sanders via cfe-commits
dsanders created this revision.
dsanders added reviewers: mclow.lists, hans.
dsanders added a subscriber: cfe-commits.

http://reviews.llvm.org/D16406

Files:
  test/std/input.output/file.streams/fstreams/filebuf.virtuals/overflow.pass.cpp
  
test/std/input.output/file.streams/fstreams/filebuf.virtuals/underflow.pass.cpp
  test/std/input.output/iostream.format/ext.manip/get_time.pass.cpp
  test/std/input.output/iostream.format/ext.manip/put_time.pass.cpp
  
test/std/input.output/iostreams.base/ios.base/ios.base.callback/register_callback.pass.cpp
  test/std/input.output/iostreams.base/ios.base/ios.base.locales/imbue.pass.cpp
  test/std/input.output/iostreams.base/ios/basic.ios.members/imbue.pass.cpp
  test/std/input.output/stream.buffers/streambuf/streambuf.cons/copy.pass.cpp
  test/std/input.output/stream.buffers/streambuf/streambuf.cons/default.pass.cpp
  
test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.assign/assign.pass.cpp
  
test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.assign/swap.pass.cpp
  
test/std/localization/locale.categories/category.collate/locale.collate.byname/hash.pass.cpp
  
test/std/localization/locale.categories/category.collate/locale.collate.byname/types.pass.cpp
  
test/std/localization/locale.categories/category.ctype/locale.codecvt.byname/ctor_wchar_t.pass.cpp
  
test/std/localization/locale.categories/category.ctype/locale.ctype.byname/types.pass.cpp
  test/std/localization/locales/locale/locale.cons/default.pass.cpp
  test/std/localization/locales/locale/locale.members/name.pass.cpp
  test/std/localization/locales/locale/locale.operators/eq.pass.cpp
  test/std/localization/locales/locale/locale.statics/global.pass.cpp
  test/std/re/re.regex/re.regex.locale/imbue.pass.cpp
  test/std/re/re.traits/default.pass.cpp
  test/std/re/re.traits/getloc.pass.cpp
  test/std/re/re.traits/imbue.pass.cpp

Index: test/std/re/re.traits/imbue.pass.cpp
===
--- test/std/re/re.traits/imbue.pass.cpp
+++ test/std/re/re.traits/imbue.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===--===//
 
+// REQUIRES: locale.en_US.UTF-8
+
 // 
 
 // template  struct regex_traits;
Index: test/std/re/re.traits/getloc.pass.cpp
===
--- test/std/re/re.traits/getloc.pass.cpp
+++ test/std/re/re.traits/getloc.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===--===//
 
+// REQUIRES: locale.en_US.UTF-8
+
 // 
 
 // template  struct regex_traits;
Index: test/std/re/re.traits/default.pass.cpp
===
--- test/std/re/re.traits/default.pass.cpp
+++ test/std/re/re.traits/default.pass.cpp
@@ -8,6 +8,8 @@
 //
 //===--===//
 
+// REQUIRES: locale.en_US.UTF-8
+
 // 
 
 // template  struct regex_traits;
Index: test/std/re/re.regex/re.regex.locale/imbue.pass.cpp
===
--- test/std/re/re.regex/re.regex.locale/imbue.pass.cpp
+++ test/std/re/re.regex/re.regex.locale/imbue.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===--===//
 
+// REQUIRES: locale.en_US.UTF-8
+
 // 
 
 // template > class basic_regex;
Index: test/std/localization/locales/locale/locale.statics/global.pass.cpp
===
--- test/std/localization/locales/locale/locale.statics/global.pass.cpp
+++ test/std/localization/locales/locale/locale.statics/global.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===--===//
 
+// REQUIRES: locale.en_US.UTF-8
+
 // 
 
 // static const locale& classic();
Index: test/std/localization/locales/locale/locale.operators/eq.pass.cpp
===
--- test/std/localization/locales/locale/locale.operators/eq.pass.cpp
+++ test/std/localization/locales/locale/locale.operators/eq.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===--===//
 
+// REQUIRES: locale.en_US.UTF-8
+
 // 
 
 // basic_string name() const;
Index: test/std/localization/locales/locale/locale.members/name.pass.cpp
===
--- test/std/localization/locales/locale/locale.members/name.pass.cpp
+++ test/std/localization/locales/locale/locale.members/name.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===--===//
 
+// REQUIRES: locale.en_US.UTF-8
+
 // 
 
 // basic_string name() const;
Index: test/std/localization/locales/locale/locale.cons/default.pass.cpp
===
--- test/st

Re: [PATCH] D16406: [libcxx] Add appropriate 'REQUIRE' directives to tests that require en_US.UTF-8.

2016-01-21 Thread Daniel Sanders via cfe-commits
dsanders added a comment.

Hi,

I'd like to merge this to the 3.8 branch once it has been accepted.


http://reviews.llvm.org/D16406



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


Re: [PATCH] D16310: new clang-tidy checker misc-long-cast

2016-01-21 Thread Alexander Kornienko via cfe-commits
alexfh added inline comments.


Comment at: clang-tidy/misc/LongCastCheck.cpp:21
@@ +20,3 @@
+  Finder->addMatcher(
+  returnStmt(
+  has(cStyleCastExpr(has(binaryOperator(anyOf(hasOperatorName("+"),

Any reason to limit this to returnStmt, varDecl and assignment? This pattern 
can appear in any expression and lead to equally incorrect results.


Comment at: clang-tidy/misc/LongCastCheck.cpp:22
@@ +21,3 @@
+  returnStmt(
+  has(cStyleCastExpr(has(binaryOperator(anyOf(hasOperatorName("+"),
+  hasOperatorName("*"),

Why only c-style casts? The problem applies to static_cast as well. Not sure 
how likely a reinterpret_cast is to appear in this situation, maybe it should 
be handled as well.


Comment at: clang-tidy/misc/LongCastCheck.cpp:23
@@ +22,3 @@
+  has(cStyleCastExpr(has(binaryOperator(anyOf(hasOperatorName("+"),
+  hasOperatorName("*"),
+  hasOperatorName("<<")

Why other operators are not considered here? Subtraction, for example, can 
suffer the same problem.


Comment at: clang-tidy/misc/LongCastCheck.cpp:66
@@ +65,3 @@
+return LHSWidth + Bits.getExtValue();
+  else
+// Unknown bitcount, assume there is truncation.

No `else` after `return`, please.


Comment at: clang-tidy/misc/LongCastCheck.cpp:71
@@ +70,3 @@
+  }
+
+  else if (const auto *Uop = dyn_cast(E)) {

Please remove the extra line breaks.


Comment at: clang-tidy/misc/LongCastCheck.cpp:100
@@ +99,3 @@
+
+  ASTContext &C = *Result.Context;
+

Ctx or Context, please.


Comment at: clang-tidy/misc/MiscTidyModule.cpp:61
@@ -59,1 +60,3 @@
+CheckFactories.registerCheck(
+"misc-long-cast");
 CheckFactories.registerCheck(

danielmarjamaki wrote:
> LegalizeAdulthood wrote:
> > The documentation describes this check as one that looks for a cast to a 
> > "bigger type", but the name of the check implies that it only works for 
> > casts to `long`.
> > 
> > The name of the check should be made more generic to reflect reality.
> > 
> > Perhaps `misc-redundant-cast-to-larger-type` or 
> > `misc-redundant-bigger-type-cast`?
> Yes I agree.. will fix..
> 
> I used long because that is the typical case that I envision.
How about misc-misplaced-widening-cast?


Comment at: docs/clang-tidy/checks/misc-long-cast.rst:11
@@ +10,3 @@
+
+Example code::
+

LegalizeAdulthood wrote:
> Please add an example for another type other than `long`, such as casting a 
> `float` expression to a `double`.
Is the use of two colons intended?


Comment at: test/clang-tidy/misc-long-cast.cpp:1
@@ +1,2 @@
+// RUN: %check_clang_tidy %s misc-long-cast %t
+

Please add tests with templates: casting to or from a dependent type shouldn't 
trigger the warning.


Repository:
  rL LLVM

http://reviews.llvm.org/D16310



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


Re: [PATCH] D16376: clang-tidy check: User-defined copy without assignment

2016-01-21 Thread Alexander Kornienko via cfe-commits
alexfh added inline comments.


Comment at: clang-tidy/misc/UserDefinedCopyWithoutAssignmentCheck.cpp:32
@@ +31,3 @@
+
+  if (MatchedDecl->isImplicit())
+return;

This check should be done in the matcher.


Comment at: clang-tidy/misc/UserDefinedCopyWithoutAssignmentCheck.cpp:49
@@ +48,3 @@
+  llvm::raw_string_ostream Insertion(S);
+  Insertion << "\n" << ClassName << "& operator = (const " << ClassName << "&) 
= delete;";
+

aaron.ballman wrote:
> I think we usually prefer `operator=` to `operator =`, but am not certain.
+1 for `operator=`

Also, I'd use `(llvm::Twine("\n") + ClassName + ...).str()` instead of the 
stream.


Comment at: clang-tidy/misc/UserDefinedCopyWithoutAssignmentCheck.cpp:51
@@ +50,3 @@
+
+  Diag << FixItHint::CreateInsertion(CCtorEnd, Insertion.str());
+}

aaron.ballman wrote:
> We probably do not want to generate this fixit unless we are compiling for at 
> least C++11. We should have a test for C++98.
Just insert this at the start of `registerMatchers`:

  if (!getLangOpts().CPlusPlus11)
return;


Comment at: 
docs/clang-tidy/checks/misc-user-defined-copy-without-assignment.rst:6
@@ +5,3 @@
+
+MSVC 2015 will generate an assignment operator even if the user defines a copy 
constructor.
+This check finds classes with a user-defined (including deleted)

Is this problem only relevant to MSVC 2015? Is MSVC's behavior 
standard-compliant in this case?


Repository:
  rL LLVM

http://reviews.llvm.org/D16376



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


Re: [PATCH] D16376: clang-tidy check: User-defined copy without assignment

2016-01-21 Thread Aaron Ballman via cfe-commits
aaron.ballman added subscribers: dblaikie, rsmith.


Comment at: clang-tidy/misc/UserDefinedCopyWithoutAssignmentCheck.cpp:51
@@ +50,3 @@
+
+  Diag << FixItHint::CreateInsertion(CCtorEnd, Insertion.str());
+}

alexfh wrote:
> aaron.ballman wrote:
> > We probably do not want to generate this fixit unless we are compiling for 
> > at least C++11. We should have a test for C++98.
> Just insert this at the start of `registerMatchers`:
> 
>   if (!getLangOpts().CPlusPlus11)
> return;
I think the check is still useful in C++98 mode assuming older versions of MSVC 
(before they started supporting C++11) have the same behavior. The fixit isn't 
useful, but warning the user about the problem is.


Comment at: 
docs/clang-tidy/checks/misc-user-defined-copy-without-assignment.rst:6
@@ +5,3 @@
+
+MSVC 2015 will generate an assignment operator even if the user defines a copy 
constructor.
+This check finds classes with a user-defined (including deleted)

alexfh wrote:
> Is this problem only relevant to MSVC 2015? Is MSVC's behavior 
> standard-compliant in this case?
MSVC's behavior is standards compliant, but is deprecated behavior. 
[class.copy]p18:

"If the class definition does not explicitly declare a copy assignment 
operator, one is declared implicitly. If
the class definition declares a move constructor or move assignment operator, 
the implicitly declared copy
assignment operator is defined as deleted; otherwise, it is defined as 
defaulted (8.4). The latter case is
deprecated if the class has a user-declared copy constructor or a user-declared 
destructor."

Now that I think about it more, I thought @dblaikie or @rsmith made a check for 
this once under -Wdeprecated. It looks like Richard did in r183884.


Repository:
  rL LLVM

http://reviews.llvm.org/D16376



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


Re: [PATCH] D16406: [libcxx] Add appropriate 'REQUIRE' directives to tests that require en_US.UTF-8.

2016-01-21 Thread Ben Craig via cfe-commits
bcraig added a subscriber: bcraig.
bcraig added a comment.

LGTM, but that doesn't mean much.

I suspect that there are some tests that have snuck past this sweep, but I 
haven't done the work to figure out which ones.  I base this statement off of 
these search results...
LOCALE_en_US_UTF_8 found in 78 files underneath libcxx/test (prior to this 
change)
locale.en_US.UTF-8 found in 46 files underneath libcxx/test (prior to this 
change)
23 new instances of locale.en_US.UTF-8 in this change.

That suggests that there are at least 78 - (46+23) = 9 files that mention 
LOCALE_en_US_UTF_8 that don't have the REQUIRES clause.  Maybe some other 
REQUIRES clause is making it so your test runs work.  In my opinion, it is fine 
to leave that work for someone else.


http://reviews.llvm.org/D16406



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


Re: [PATCH] D16310: new clang-tidy checker misc-long-cast

2016-01-21 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki marked an inline comment as done.


Comment at: clang-tidy/misc/LongCastCheck.cpp:21
@@ +20,3 @@
+  Finder->addMatcher(
+  returnStmt(
+  has(cStyleCastExpr(has(binaryOperator(anyOf(hasOperatorName("+"),

alexfh wrote:
> Any reason to limit this to returnStmt, varDecl and assignment? This pattern 
> can appear in any expression and lead to equally incorrect results.
Yes. There could be some extra pattern we want to look for later. But I don't 
want to warn in general. Example:

int A,B,C;
long ABC = (long)(A * B) + C;

That code makes perfect sense if the calculation A*B won't overflow and you 
want that the addition is done with long precision.



Comment at: clang-tidy/misc/LongCastCheck.cpp:22
@@ +21,3 @@
+  returnStmt(
+  has(cStyleCastExpr(has(binaryOperator(anyOf(hasOperatorName("+"),
+  hasOperatorName("*"),

alexfh wrote:
> Why only c-style casts? The problem applies to static_cast as well. Not sure 
> how likely a reinterpret_cast is to appear in this situation, maybe it should 
> be handled as well.
ok, I will handle that too in next patch.


Comment at: clang-tidy/misc/LongCastCheck.cpp:23
@@ +22,3 @@
+  has(cStyleCastExpr(has(binaryOperator(anyOf(hasOperatorName("+"),
+  hasOperatorName("*"),
+  hasOperatorName("<<")

alexfh wrote:
> Why other operators are not considered here? Subtraction, for example, can 
> suffer the same problem.
yes. true. the ~ operator also. I can't say how noisy that would be but I will 
test it.


Comment at: clang-tidy/misc/MiscTidyModule.cpp:61
@@ -59,1 +60,3 @@
+CheckFactories.registerCheck(
+"misc-long-cast");
 CheckFactories.registerCheck(

alexfh wrote:
> danielmarjamaki wrote:
> > LegalizeAdulthood wrote:
> > > The documentation describes this check as one that looks for a cast to a 
> > > "bigger type", but the name of the check implies that it only works for 
> > > casts to `long`.
> > > 
> > > The name of the check should be made more generic to reflect reality.
> > > 
> > > Perhaps `misc-redundant-cast-to-larger-type` or 
> > > `misc-redundant-bigger-type-cast`?
> > Yes I agree.. will fix..
> > 
> > I used long because that is the typical case that I envision.
> How about misc-misplaced-widening-cast?
I already changed.. but I like misc-misplaced-widening-cast better so I will 
change again..


Repository:
  rL LLVM

http://reviews.llvm.org/D16310



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


r258401 - When dumping documentation for AST matchers, do something more useful with \see doxygen commands. Ideally this would link to the target of \see, but for now it translates \see into "See also

2016-01-21 Thread Aaron Ballman via cfe-commits
Author: aaronballman
Date: Thu Jan 21 09:18:25 2016
New Revision: 258401

URL: http://llvm.org/viewvc/llvm-project?rev=258401&view=rev
Log:
When dumping documentation for AST matchers, do something more useful with \see 
doxygen commands. Ideally this would link to the target of \see, but for now it 
translates \see into "See also: "

Regenerate the AST documentation for this new functionality.

Modified:
cfe/trunk/docs/LibASTMatchersReference.html
cfe/trunk/docs/tools/dump_ast_matchers.py

Modified: cfe/trunk/docs/LibASTMatchersReference.html
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LibASTMatchersReference.html?rev=258401&r1=258400&r2=258401&view=diff
==
--- cfe/trunk/docs/LibASTMatchersReference.html (original)
+++ cfe/trunk/docs/LibASTMatchersReference.html Thu Jan 21 09:18:25 2016
@@ -787,8 +787,8 @@ Example matches reinterpret_castStmt>cxxStaticCastExprMatcherCXXStaticCastExpr>...
 Matches a C++ 
static_cast expression.
 
-hasDestinationType
-reinterpretCast
+See also: hasDestinationType
+See also: reinterpretCast
 
 Example:
   cxxStaticCastExpr()
@@ -898,7 +898,7 @@ Note: the name "explicitCast" is chosen
 Clang uses the term "cast" to apply to implicit conversions as well as to
 actual cast expressions.
 
-hasDestinationType.
+See also: hasDestinationType.
 
 Example: matches all five of the casts in
   
int((int)(reinterpret_cast(static_cast(const_cast(42)
@@ -1061,15 +1061,16 @@ NSString's "alloc". This matcher should
   [[NSString alloc] initWithString:@"Hello"]
 
 
+
 MatcherStmt>parenExprMatcherParenExpr>...
 Matches parentheses used 
in expressions.
 
-Given
+Example matches (foo() + 1)
   int foo() { return 1; }
   int a = (foo() + 1);
-matches '(foo() + 1)'
 
 
+
 MatcherStmt>returnStmtMatcherReturnStmt>...
 Matches return 
statements.
 
@@ -2177,6 +2178,17 @@ functionDecl(isConstexpr())
 
 
 
+MatcherFunctionDecl>isDefaulted
+Matches defaulted 
function declarations.
+
+Given:
+  class A { ~A(); };
+  class B { ~B() = default; };
+functionDecl(isDefaulted())
+  matches the declaration of ~B, but not ~A.
+
+
+
 MatcherFunctionDecl>isDefinition
 Matches if a 
declaration has a body attached.
 
@@ -2192,17 +2204,6 @@ Usable as: MatcherFunctionDecl>isDefaulted
-Matches defaulted 
function declarations.
-
-Given:
-  class A { ~A(); };
-  class B { ~B() = default; };
-functionDecl(isDefaulted())
-  matches the declaration of ~B, but not ~A.
-
-
-
 MatcherFunctionDecl>isDeleted
 Matches deleted function 
declarations.
 

Modified: cfe/trunk/docs/tools/dump_ast_matchers.py
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/tools/dump_ast_matchers.py?rev=258401&r1=258400&r2=258401&view=diff
==
--- cfe/trunk/docs/tools/dump_ast_matchers.py (original)
+++ cfe/trunk/docs/tools/dump_ast_matchers.py Thu Jan 21 09:18:25 2016
@@ -83,6 +83,11 @@ def strip_doxygen(comment):
   """Returns the given comment without \-escaped words."""
   # If there is only a doxygen keyword in the line, delete the whole line.
   comment = re.sub(r'^\\[^\s]+\n', r'', comment, flags=re.M)
+  
+  # If there is a doxygen \see command, change the \see prefix into "See 
also:".
+  # FIXME: it would be better to turn this into a link to the target instead.
+  comment = re.sub(r'\\see', r'See also:', comment)
+  
   # Delete the doxygen command and the following whitespace.
   comment = re.sub(r'\\[^\s]+\s+', r'', comment)
   return comment


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


Re: [PATCH] D16310: new clang-tidy checker misc-long-cast

2016-01-21 Thread Alexander Kornienko via cfe-commits
alexfh added inline comments.


Comment at: clang-tidy/misc/LongCastCheck.cpp:21
@@ +20,3 @@
+  Finder->addMatcher(
+  returnStmt(
+  has(cStyleCastExpr(has(binaryOperator(anyOf(hasOperatorName("+"),

danielmarjamaki wrote:
> alexfh wrote:
> > Any reason to limit this to returnStmt, varDecl and assignment? This 
> > pattern can appear in any expression and lead to equally incorrect results.
> Yes. There could be some extra pattern we want to look for later. But I don't 
> want to warn in general. Example:
> 
> int A,B,C;
> long ABC = (long)(A * B) + C;
> 
> That code makes perfect sense if the calculation A*B won't overflow and you 
> want that the addition is done with long precision.
> 
Then you don't need to repeat the inner matcher. Assign it to an auto variable 
and then use it in the other matchers:

  auto CastExpr = cStyleCastExpr(...);
  Finder->addMatcher(returnStmt(has(CastExpr)));
  Finder->addMatcher(varDecl(has(CastExpr)));
  ...



Comment at: clang-tidy/misc/LongCastCheck.cpp:55
@@ +54,3 @@
+  llvm::APSInt Val;
+  if (Bop->getRHS()->EvaluateAsInt(Val, C)) {
+return Val.getActiveBits();

nit: Braces are not needed around one-line `if` bodies.


Comment at: clang-tidy/misc/LongCastCheck.cpp:61
@@ +60,3 @@
+  llvm::APSInt Bits;
+  if (Bop->getRHS()->EvaluateAsInt(Bits, C))
+// We don't handle negative values and large values well. It is assumed

Please insert braces around the `if` body here: it's hard to see its scope 
otherwise.


Repository:
  rL LLVM

http://reviews.llvm.org/D16310



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


Re: [PATCH] D16406: [libcxx] Add appropriate 'REQUIRE' directives to tests that require en_US.UTF-8.

2016-01-21 Thread Daniel Sanders via cfe-commits
dsanders updated this revision to Diff 45531.
dsanders added a comment.

Added one more. It was also guarded by a check for ru_RU.UTF-8 so it was missed 
on the first sweep.


http://reviews.llvm.org/D16406

Files:
  test/std/input.output/file.streams/fstreams/filebuf.virtuals/overflow.pass.cpp
  
test/std/input.output/file.streams/fstreams/filebuf.virtuals/underflow.pass.cpp
  test/std/input.output/iostream.format/ext.manip/get_time.pass.cpp
  test/std/input.output/iostream.format/ext.manip/put_time.pass.cpp
  
test/std/input.output/iostreams.base/ios.base/ios.base.callback/register_callback.pass.cpp
  test/std/input.output/iostreams.base/ios.base/ios.base.locales/imbue.pass.cpp
  test/std/input.output/iostreams.base/ios/basic.ios.members/imbue.pass.cpp
  test/std/input.output/stream.buffers/streambuf/streambuf.cons/copy.pass.cpp
  test/std/input.output/stream.buffers/streambuf/streambuf.cons/default.pass.cpp
  
test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.assign/assign.pass.cpp
  
test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.assign/swap.pass.cpp
  
test/std/localization/locale.categories/category.collate/locale.collate.byname/hash.pass.cpp
  
test/std/localization/locale.categories/category.collate/locale.collate.byname/types.pass.cpp
  
test/std/localization/locale.categories/category.ctype/locale.codecvt.byname/ctor_wchar_t.pass.cpp
  
test/std/localization/locale.categories/category.ctype/locale.ctype.byname/types.pass.cpp
  test/std/localization/locales/locale/locale.cons/default.pass.cpp
  test/std/localization/locales/locale/locale.cons/locale_string_cat.pass.cpp
  test/std/localization/locales/locale/locale.members/name.pass.cpp
  test/std/localization/locales/locale/locale.operators/eq.pass.cpp
  test/std/localization/locales/locale/locale.statics/global.pass.cpp
  test/std/re/re.regex/re.regex.locale/imbue.pass.cpp
  test/std/re/re.traits/default.pass.cpp
  test/std/re/re.traits/getloc.pass.cpp
  test/std/re/re.traits/imbue.pass.cpp

Index: test/std/re/re.traits/imbue.pass.cpp
===
--- test/std/re/re.traits/imbue.pass.cpp
+++ test/std/re/re.traits/imbue.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===--===//
 
+// REQUIRES: locale.en_US.UTF-8
+
 // 
 
 // template  struct regex_traits;
Index: test/std/re/re.traits/getloc.pass.cpp
===
--- test/std/re/re.traits/getloc.pass.cpp
+++ test/std/re/re.traits/getloc.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===--===//
 
+// REQUIRES: locale.en_US.UTF-8
+
 // 
 
 // template  struct regex_traits;
Index: test/std/re/re.traits/default.pass.cpp
===
--- test/std/re/re.traits/default.pass.cpp
+++ test/std/re/re.traits/default.pass.cpp
@@ -8,6 +8,8 @@
 //
 //===--===//
 
+// REQUIRES: locale.en_US.UTF-8
+
 // 
 
 // template  struct regex_traits;
Index: test/std/re/re.regex/re.regex.locale/imbue.pass.cpp
===
--- test/std/re/re.regex/re.regex.locale/imbue.pass.cpp
+++ test/std/re/re.regex/re.regex.locale/imbue.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===--===//
 
+// REQUIRES: locale.en_US.UTF-8
+
 // 
 
 // template > class basic_regex;
Index: test/std/localization/locales/locale/locale.statics/global.pass.cpp
===
--- test/std/localization/locales/locale/locale.statics/global.pass.cpp
+++ test/std/localization/locales/locale/locale.statics/global.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===--===//
 
+// REQUIRES: locale.en_US.UTF-8
+
 // 
 
 // static const locale& classic();
Index: test/std/localization/locales/locale/locale.operators/eq.pass.cpp
===
--- test/std/localization/locales/locale/locale.operators/eq.pass.cpp
+++ test/std/localization/locales/locale/locale.operators/eq.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===--===//
 
+// REQUIRES: locale.en_US.UTF-8
+
 // 
 
 // basic_string name() const;
Index: test/std/localization/locales/locale/locale.members/name.pass.cpp
===
--- test/std/localization/locales/locale/locale.members/name.pass.cpp
+++ test/std/localization/locales/locale/locale.members/name.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===--===//
 
+// REQUIRES: locale.en_US.UTF-8
+
 // 
 
 // basic_string name() const;
Index: test/std/lo

Re: [PATCH] D16400: [OpenMP] Sema for depend clause on target enter data directive.

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

LG


http://reviews.llvm.org/D16400



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


Re: [PATCH] D16406: [libcxx] Add appropriate 'REQUIRE' directives to tests that require en_US.UTF-8.

2016-01-21 Thread Daniel Sanders via cfe-commits
dsanders added a comment.

Thanks. I've added one more which came up after enabling all the missing 
locales except for en_US.UTF-8.

I'll commit this and find the other 8 with grep afterwards.


http://reviews.llvm.org/D16406



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


Re: [PATCH] D16401: [OpenMP] Sema for depend clause on target exit data directive.

2016-01-21 Thread Arpith Jacob via cfe-commits
arpith-jacob updated this revision to Diff 45532.
arpith-jacob added a comment.

Added template instantiation test case for all feasible tests.


http://reviews.llvm.org/D16401

Files:
  include/clang/Basic/OpenMPKinds.def
  test/OpenMP/target_exit_data_ast_print.cpp
  test/OpenMP/target_exit_data_depend_messages.cpp

Index: test/OpenMP/target_exit_data_depend_messages.cpp
===
--- /dev/null
+++ test/OpenMP/target_exit_data_depend_messages.cpp
@@ -0,0 +1,166 @@
+// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -o - -std=c++11 %s
+
+void foo() {
+}
+
+bool foobool(int argc) {
+  return argc;
+}
+
+struct S1; // expected-note {{declared here}} expected-note {{declared here}}
+
+class vector {
+  public:
+int operator[](int index) { return 0; }
+};
+
+template 
+int tmain(T argc, S **argv, R *env[]) {
+  vector vec;
+  typedef float V __attribute__((vector_size(16)));
+  V a;
+  char *arr;
+
+  int i;
+  #pragma omp target exit data map(from: i) depend // expected-error {{expected '(' after 'depend'}}
+  foo();
+  #pragma omp target exit data map(from: i) depend ( // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}} expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after dependency type - ignoring}}
+  foo();
+  #pragma omp target exit data map(from: i) depend () // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}}
+  foo();
+  #pragma omp target exit data map(from: i) depend (argc // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} expected-error {{expected ')'}} expected-note {{to match this '('}}
+  foo();
+  #pragma omp target exit data map(from: i) depend (source : argc) // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}}
+  foo();
+  #pragma omp target exit data map(from: i) depend (source) // expected-error {{expected expression}} expected-warning {{missing ':' after dependency type - ignoring}}
+  foo();
+  #pragma omp target exit data map(from: i) depend (in : argc)) // expected-warning {{extra tokens at the end of '#pragma omp target exit data' are ignored}}
+  foo();
+  #pragma omp target exit data map(from: i) depend (out: ) // expected-error {{expected expression}}
+  foo();
+  #pragma omp target exit data map(from: i) depend (inout : foobool(argc)), depend (in, argc) // expected-error {{expected variable name, array element or array section}} expected-warning {{missing ':' after dependency type - ignoring}} expected-error {{expected expression}}
+  foo();
+  #pragma omp target exit data map(from: i) depend (out :S1) // expected-error {{'S1' does not refer to a value}}
+  foo();
+  #pragma omp target exit data map(from: i) depend(in : argv[1][1] = '2') // expected-error {{expected variable name, array element or array section}}
+  foo();
+  #pragma omp target exit data map(from: i) depend (in : vec[1]) // expected-error {{expected variable name, array element or array section}}
+  foo();
+  #pragma omp target exit data map(from: i) depend (in : argv[0])
+  foo();
+  #pragma omp target exit data map(from: i) depend (in : ) // expected-error {{expected expression}}
+  foo();
+  #pragma omp target exit data map(from: i) depend (in : tmain) // expected-error {{expected variable name, array element or array section}}
+  foo();
+  #pragma omp target exit data map(from: i) depend(in : a[0]) // expected-error{{expected variable name, array element or array section}}
+  foo();
+  #pragma omp target exit data map(from: i) depend (in : vec[1:2]) // expected-error {{ value is not an array or pointer}}
+  foo();
+  #pragma omp target exit data map(from: i) depend (in : argv[ // expected-error {{expected expression}} expected-error {{expected ']'}} expected-error {{expected ')'}} expected-note {{to match this '['}} expected-note {{to match this '('}}
+  foo();
+  #pragma omp target exit data map(from: i) depend (in : argv[: // expected-error {{expected expression}} expected-error {{expected ']'}} expected-error {{expected ')'}} expected-note {{to match this '['}} expected-note {{to match this '('}}
+  foo();
+  #pragma omp target exit data map(from: i) depend (in : argv[:] // expected-error {{section length is unspecified and cannot be inferred because subscripted value is not an array}} expected-error {{expected ')'}} expected-note {{to match this '('}}
+  foo();
+  #pragma omp target exit data map(from: i) depend (in : argv[argc: // expected-error {{expected expression}} expected-error {{expected ']'}} expected-error {{expected ')'}} expected-note {{to match this '['}} expected-note {{to match this '('}}
+  foo();
+  #pragma omp target exit data map(from: i) depend (in : argv[argc:argc] // expected-error {{expected ')'}} expected-note {{to match this '

Re: [PATCH] D16406: [libcxx] Add appropriate 'REQUIRE' directives to tests that require en_US.UTF-8.

2016-01-21 Thread Daniel Sanders via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL258403: [libcxx] Add appropriate 'REQUIRE' directives to 
tests that require en_US.UTF-8. (authored by dsanders).

Changed prior to commit:
  http://reviews.llvm.org/D16406?vs=45531&id=45533#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D16406

Files:
  
libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.virtuals/overflow.pass.cpp
  
libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.virtuals/underflow.pass.cpp
  libcxx/trunk/test/std/input.output/iostream.format/ext.manip/get_time.pass.cpp
  libcxx/trunk/test/std/input.output/iostream.format/ext.manip/put_time.pass.cpp
  
libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.base.callback/register_callback.pass.cpp
  
libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.base.locales/imbue.pass.cpp
  
libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/imbue.pass.cpp
  
libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.cons/copy.pass.cpp
  
libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.cons/default.pass.cpp
  
libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.assign/assign.pass.cpp
  
libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.assign/swap.pass.cpp
  
libcxx/trunk/test/std/localization/locale.categories/category.collate/locale.collate.byname/hash.pass.cpp
  
libcxx/trunk/test/std/localization/locale.categories/category.collate/locale.collate.byname/types.pass.cpp
  
libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt.byname/ctor_wchar_t.pass.cpp
  
libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/types.pass.cpp
  libcxx/trunk/test/std/localization/locales/locale/locale.cons/default.pass.cpp
  
libcxx/trunk/test/std/localization/locales/locale/locale.cons/locale_string_cat.pass.cpp
  libcxx/trunk/test/std/localization/locales/locale/locale.members/name.pass.cpp
  libcxx/trunk/test/std/localization/locales/locale/locale.operators/eq.pass.cpp
  
libcxx/trunk/test/std/localization/locales/locale/locale.statics/global.pass.cpp
  libcxx/trunk/test/std/re/re.regex/re.regex.locale/imbue.pass.cpp
  libcxx/trunk/test/std/re/re.traits/default.pass.cpp
  libcxx/trunk/test/std/re/re.traits/getloc.pass.cpp
  libcxx/trunk/test/std/re/re.traits/imbue.pass.cpp

Index: libcxx/trunk/test/std/localization/locale.categories/category.collate/locale.collate.byname/types.pass.cpp
===
--- libcxx/trunk/test/std/localization/locale.categories/category.collate/locale.collate.byname/types.pass.cpp
+++ libcxx/trunk/test/std/localization/locale.categories/category.collate/locale.collate.byname/types.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===--===//
 
+// REQUIRES: locale.en_US.UTF-8
+
 // 
 
 // template 
Index: libcxx/trunk/test/std/localization/locale.categories/category.collate/locale.collate.byname/hash.pass.cpp
===
--- libcxx/trunk/test/std/localization/locale.categories/category.collate/locale.collate.byname/hash.pass.cpp
+++ libcxx/trunk/test/std/localization/locale.categories/category.collate/locale.collate.byname/hash.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===--===//
 
+// REQUIRES: locale.en_US.UTF-8
+
 // 
 
 // template  class collate_byname
Index: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt.byname/ctor_wchar_t.pass.cpp
===
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt.byname/ctor_wchar_t.pass.cpp
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt.byname/ctor_wchar_t.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===--===//
 
+// REQUIRES: locale.en_US.UTF-8
+
 // 
 
 // template <> class codecvt_byname
Index: libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/types.pass.cpp
===
--- libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/types.pass.cpp
+++ libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/types.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===--===//
 
+// REQUIRES: locale.en_US.UTF-8
+
 // 
 
 // template 
Index: libcxx/trunk/test/std/localization/locales/locale/locale.statics/global.pass.cpp
===
--- libcxx/trunk/test/std/localization/locale

[libcxx] r258403 - [libcxx] Add appropriate 'REQUIRE' directives to tests that require en_US.UTF-8.

2016-01-21 Thread Daniel Sanders via cfe-commits
Author: dsanders
Date: Thu Jan 21 09:35:15 2016
New Revision: 258403

URL: http://llvm.org/viewvc/llvm-project?rev=258403&view=rev
Log:
[libcxx] Add appropriate 'REQUIRE' directives to tests that require en_US.UTF-8.

Reviewers: mclow.lists, hans

Subscribers: bcraig, cfe-commits

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

Modified:

libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.virtuals/overflow.pass.cpp

libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.virtuals/underflow.pass.cpp

libcxx/trunk/test/std/input.output/iostream.format/ext.manip/get_time.pass.cpp

libcxx/trunk/test/std/input.output/iostream.format/ext.manip/put_time.pass.cpp

libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.base.callback/register_callback.pass.cpp

libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.base.locales/imbue.pass.cpp

libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/imbue.pass.cpp

libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.cons/copy.pass.cpp

libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.cons/default.pass.cpp

libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.assign/assign.pass.cpp

libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.assign/swap.pass.cpp

libcxx/trunk/test/std/localization/locale.categories/category.collate/locale.collate.byname/hash.pass.cpp

libcxx/trunk/test/std/localization/locale.categories/category.collate/locale.collate.byname/types.pass.cpp

libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.codecvt.byname/ctor_wchar_t.pass.cpp

libcxx/trunk/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/types.pass.cpp

libcxx/trunk/test/std/localization/locales/locale/locale.cons/default.pass.cpp

libcxx/trunk/test/std/localization/locales/locale/locale.cons/locale_string_cat.pass.cpp

libcxx/trunk/test/std/localization/locales/locale/locale.members/name.pass.cpp

libcxx/trunk/test/std/localization/locales/locale/locale.operators/eq.pass.cpp

libcxx/trunk/test/std/localization/locales/locale/locale.statics/global.pass.cpp
libcxx/trunk/test/std/re/re.regex/re.regex.locale/imbue.pass.cpp
libcxx/trunk/test/std/re/re.traits/default.pass.cpp
libcxx/trunk/test/std/re/re.traits/getloc.pass.cpp
libcxx/trunk/test/std/re/re.traits/imbue.pass.cpp

Modified: 
libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.virtuals/overflow.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.virtuals/overflow.pass.cpp?rev=258403&r1=258402&r2=258403&view=diff
==
--- 
libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.virtuals/overflow.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.virtuals/overflow.pass.cpp
 Thu Jan 21 09:35:15 2016
@@ -7,6 +7,8 @@
 //
 
//===--===//
 
+// REQUIRES: locale.en_US.UTF-8
+
 // 
 
 // int_type overflow(int_type c = traits::eof());

Modified: 
libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.virtuals/underflow.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.virtuals/underflow.pass.cpp?rev=258403&r1=258402&r2=258403&view=diff
==
--- 
libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.virtuals/underflow.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.virtuals/underflow.pass.cpp
 Thu Jan 21 09:35:15 2016
@@ -7,6 +7,8 @@
 //
 
//===--===//
 
+// REQUIRES: locale.en_US.UTF-8
+
 // 
 
 // int_type underflow();

Modified: 
libcxx/trunk/test/std/input.output/iostream.format/ext.manip/get_time.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/ext.manip/get_time.pass.cpp?rev=258403&r1=258402&r2=258403&view=diff
==
--- 
libcxx/trunk/test/std/input.output/iostream.format/ext.manip/get_time.pass.cpp 
(original)
+++ 
libcxx/trunk/test/std/input.output/iostream.format/ext.manip/get_time.pass.cpp 
Thu Jan 21 09:35:15 2016
@@ -7,6 +7,8 @@
 //
 
//===--===//
 
+// REQUIRES: locale.en_US.UTF-8
+
 // 
 
 // template  T9 get_time(struct tm* tmb, const charT* fmt);

Modified: 
libcxx/trunk/test/std/input.output/iostream.format/ext.manip/put_time.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/s

[PATCH] D16408: [libcxx] Additional 'REQUIRE' directives for tests that require en_US.UTF-8.

2016-01-21 Thread Daniel Sanders via cfe-commits
dsanders created this revision.
dsanders added reviewers: bcraig, mclow.lists, hans.
dsanders added a subscriber: cfe-commits.

These are the tests that didn't fail in the release candidate because they were
covered by another 'REQUIRES' directive.

http://reviews.llvm.org/D16408

Files:
  
test/std/localization/locale.categories/category.collate/locale.collate.byname/compare.pass.cpp
  
test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_1.pass.cpp
  
test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_many.pass.cpp
  
test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_1.pass.cpp
  
test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_many.pass.cpp
  
test/std/localization/locale.categories/category.ctype/locale.ctype.byname/widen_1.pass.cpp
  
test/std/localization/locale.categories/category.ctype/locale.ctype.byname/widen_many.pass.cpp

Index: 
test/std/localization/locale.categories/category.ctype/locale.ctype.byname/widen_many.pass.cpp
===
--- 
test/std/localization/locale.categories/category.ctype/locale.ctype.byname/widen_many.pass.cpp
+++ 
test/std/localization/locale.categories/category.ctype/locale.ctype.byname/widen_many.pass.cpp
@@ -7,6 +7,8 @@
 //
 
//===--===//
 
+// REQUIRES: locale.en_US.UTF-8
+
 // 
 
 // template  class ctype_byname;
Index: 
test/std/localization/locale.categories/category.ctype/locale.ctype.byname/widen_1.pass.cpp
===
--- 
test/std/localization/locale.categories/category.ctype/locale.ctype.byname/widen_1.pass.cpp
+++ 
test/std/localization/locale.categories/category.ctype/locale.ctype.byname/widen_1.pass.cpp
@@ -7,6 +7,8 @@
 //
 
//===--===//
 
+// REQUIRES: locale.en_US.UTF-8
+
 // 
 
 // template  class ctype_byname;
Index: 
test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_many.pass.cpp
===
--- 
test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_many.pass.cpp
+++ 
test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_many.pass.cpp
@@ -7,6 +7,8 @@
 //
 
//===--===//
 
+// REQUIRES: locale.en_US.UTF-8
+
 // 
 
 // template  class ctype_byname;
Index: 
test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_1.pass.cpp
===
--- 
test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_1.pass.cpp
+++ 
test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_1.pass.cpp
@@ -7,6 +7,8 @@
 //
 
//===--===//
 
+// REQUIRES: locale.en_US.UTF-8
+
 // 
 
 // template  class ctype_byname;
Index: 
test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_many.pass.cpp
===
--- 
test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_many.pass.cpp
+++ 
test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_many.pass.cpp
@@ -7,6 +7,8 @@
 //
 
//===--===//
 
+// REQUIRES: locale.en_US.UTF-8
+
 // 
 
 // template  class ctype_byname;
Index: 
test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_1.pass.cpp
===
--- 
test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_1.pass.cpp
+++ 
test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_1.pass.cpp
@@ -7,6 +7,8 @@
 //
 
//===--===//
 
+// REQUIRES: locale.en_US.UTF-8
+
 // 
 
 // template  class ctype_byname;
Index: 
test/std/localization/locale.categories/category.collate/locale.collate.byname/compare.pass.cpp
===
--- 
test/std/localization/locale.categories/category.collate/locale.collate.byname/compare.pass.cpp
+++ 
test/std/localization/locale.categories/category.collate/locale.collate.byname/compare.pass.cpp
@@ -7,6 +7,8 @@
 //
 
//===--===//
 
+// REQUIRES: locale.en_US.UTF-8
+
 // 
 
 // template  class collate_byname


Index: test/std/localization/locale.categories/category.ctype/locale.ctype.byname/widen_many.pass.cpp
==

Re: [PATCH] D16376: clang-tidy check: User-defined copy without assignment

2016-01-21 Thread Alexander Kornienko via cfe-commits
alexfh added inline comments.


Comment at: 
docs/clang-tidy/checks/misc-user-defined-copy-without-assignment.rst:6
@@ +5,3 @@
+
+MSVC 2015 will generate an assignment operator even if the user defines a copy 
constructor.
+This check finds classes with a user-defined (including deleted)

aaron.ballman wrote:
> alexfh wrote:
> > Is this problem only relevant to MSVC 2015? Is MSVC's behavior 
> > standard-compliant in this case?
> MSVC's behavior is standards compliant, but is deprecated behavior. 
> [class.copy]p18:
> 
> "If the class definition does not explicitly declare a copy assignment 
> operator, one is declared implicitly. If
> the class definition declares a move constructor or move assignment operator, 
> the implicitly declared copy
> assignment operator is defined as deleted; otherwise, it is defined as 
> defaulted (8.4). The latter case is
> deprecated if the class has a user-declared copy constructor or a 
> user-declared destructor."
> 
> Now that I think about it more, I thought @dblaikie or @rsmith made a check 
> for this once under -Wdeprecated. It looks like Richard did in r183884.
Ah, now I start understanding ;)

The check is actually (incompletely) verifying [[ 
https://en.wikipedia.org/wiki/Rule_of_three_(C%2B%2B_programming) | the rule of 
2 ]], and it's not specific to MSVC in any way (and the documentation shouldn't 
mention MSVC then). It makes sense to:
1. make the check symmetric (a user-defined assignment and an implicit 
copy-construction;
2. extend the check to verify move operations as well (the rule of 4);
3. and maybe extend it to verify the rule of 3 and the rule of 5 (though 
detecting non-RAII resource owning may be really hard if even possible).


Comment at: 
docs/clang-tidy/checks/misc-user-defined-copy-without-assignment.rst:23
@@ +22,3 @@
+
+The fix is defensive. Incorrect compiler-generated assignement can cause
+unexpected behaviour. An explicitly deleted assigneemnt operator will cause a

The fix will break code that uses the implicit assignment operator. I'm not 
sure it's a nice thing to do in a check enabled by default.


Repository:
  rL LLVM

http://reviews.llvm.org/D16376



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


Re: [PATCH] D16408: [libcxx] Additional 'REQUIRE' directives for tests that require en_US.UTF-8.

2016-01-21 Thread Daniel Sanders via cfe-commits
dsanders added a comment.

There's only 7 instead of the 8 we were expecting because one match turned out 
to be the python script that checks for the availability of the locale.


http://reviews.llvm.org/D16408



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


Re: [PATCH] D16408: [libcxx] Additional 'REQUIRE' directives for tests that require en_US.UTF-8.

2016-01-21 Thread Hans Wennborg via cfe-commits
hans added a subscriber: dim.
hans added a comment.

+dim who said the locale tests were also failing for him on FreeBSD. Maybe this 
is relevant?


http://reviews.llvm.org/D16408



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


Re: [clang-tools-extra] r258356 - Make modernize-use-default tolerant of delayed template parsing; this code was previously causing failed assertions because dyn_cast was being passed a null pointer d

2016-01-21 Thread Hans Wennborg via cfe-commits
I'm fine with it. Alex, what do you think?

On Wed, Jan 20, 2016 at 3:07 PM, Aaron Ballman  wrote:
> Uncertain whether this meets the bar for inclusion in 3.8.
> clang-modernize was moved into clang-tidy and from what I can tell, it
> did not suffer from this crash. I wouldn't normally recommend this,
> but just about any use of clang-tidy (that does not filter out this
> check) over code that includes the MSVC STL headers will trigger that
> assert without this fix.
>
> ~Aaron
>
> On Wed, Jan 20, 2016 at 5:14 PM, Aaron Ballman via cfe-commits
>  wrote:
>> Author: aaronballman
>> Date: Wed Jan 20 16:14:10 2016
>> New Revision: 258356
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=258356&view=rev
>> Log:
>> Make modernize-use-default tolerant of delayed template parsing; this code 
>> was previously causing failed assertions because dyn_cast was being passed a 
>> null pointer due to the delay-parsed body.
>>
>> Added:
>> clang-tools-extra/trunk/test/clang-tidy/modernize-use-default-delayed.cpp
>> Modified:
>> clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultCheck.cpp
>>
>> Modified: clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultCheck.cpp
>> URL: 
>> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultCheck.cpp?rev=258356&r1=258355&r2=258356&view=diff
>> ==
>> --- clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultCheck.cpp 
>> (original)
>> +++ clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultCheck.cpp Wed Jan 
>> 20 16:14:10 2016
>> @@ -272,6 +272,7 @@ void UseDefaultCheck::check(const MatchF
>>// that are not user-provided (automatically generated).
>>if (SpecialFunctionDecl->isDeleted() ||
>>SpecialFunctionDecl->isExplicitlyDefaulted() ||
>> +  SpecialFunctionDecl->isLateTemplateParsed() ||
>>!SpecialFunctionDecl->isUserProvided() || 
>> !SpecialFunctionDecl->hasBody())
>>  return;
>>
>>
>> Added: 
>> clang-tools-extra/trunk/test/clang-tidy/modernize-use-default-delayed.cpp
>> URL: 
>> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/modernize-use-default-delayed.cpp?rev=258356&view=auto
>> ==
>> --- 
>> clang-tools-extra/trunk/test/clang-tidy/modernize-use-default-delayed.cpp 
>> (added)
>> +++ 
>> clang-tools-extra/trunk/test/clang-tidy/modernize-use-default-delayed.cpp 
>> Wed Jan 20 16:14:10 2016
>> @@ -0,0 +1,8 @@
>> +// RUN: clang-tidy %s -checks=-*,modernize-use-default -- -std=c++11 
>> -fdelayed-template-parsing -fexceptions | count 0
>> +// Note: this test expects no diagnostics, but FileCheck cannot handle that,
>> +// hence the use of | count 0.
>> +
>> +template 
>> +struct S {
>> +  S& operator=(const S&) { return *this; }
>> +};
>>
>>
>> ___
>> 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: [libcxx] r258403 - [libcxx] Add appropriate 'REQUIRE' directives to tests that require en_US.UTF-8.

2016-01-21 Thread Hans Wennborg via cfe-commits
Hi Marshall,

Is this OK for 3.8?

Daniel, I assume we want reviews.llvm.org/D16408 too when that lands, right?

Thanks,
Hans

On Thu, Jan 21, 2016 at 7:35 AM, Daniel Sanders via cfe-commits
 wrote:
> Author: dsanders
> Date: Thu Jan 21 09:35:15 2016
> New Revision: 258403
>
> URL: http://llvm.org/viewvc/llvm-project?rev=258403&view=rev
> Log:
> [libcxx] Add appropriate 'REQUIRE' directives to tests that require 
> en_US.UTF-8.
>
> Reviewers: mclow.lists, hans
>
> Subscribers: bcraig, cfe-commits
>
> Differential Revision: http://reviews.llvm.org/D16406
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


RE: [libcxx] r258403 - [libcxx] Add appropriate 'REQUIRE' directives to tests that require en_US.UTF-8.

2016-01-21 Thread Daniel Sanders via cfe-commits
> Daniel, I assume we want reviews.llvm.org/D16408 too when that lands,
> right?

Yes, the tests in D16408 aren't blocking any particular build that I know of 
but we should still merge it.

> -Original Message-
> From: hwennb...@google.com [mailto:hwennb...@google.com] On Behalf
> Of Hans Wennborg
> Sent: 21 January 2016 17:06
> To: Daniel Sanders; Marshall Clow
> Cc: cfe-commits
> Subject: Re: [libcxx] r258403 - [libcxx] Add appropriate 'REQUIRE' directives 
> to
> tests that require en_US.UTF-8.
> 
> Hi Marshall,
> 
> Is this OK for 3.8?
> 
> Daniel, I assume we want reviews.llvm.org/D16408 too when that lands,
> right?
> 
> Thanks,
> Hans
> 
> On Thu, Jan 21, 2016 at 7:35 AM, Daniel Sanders via cfe-commits
>  wrote:
> > Author: dsanders
> > Date: Thu Jan 21 09:35:15 2016
> > New Revision: 258403
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=258403&view=rev
> > Log:
> > [libcxx] Add appropriate 'REQUIRE' directives to tests that require
> en_US.UTF-8.
> >
> > Reviewers: mclow.lists, hans
> >
> > Subscribers: bcraig, cfe-commits
> >
> > Differential Revision: http://reviews.llvm.org/D16406
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [libcxx] r258403 - [libcxx] Add appropriate 'REQUIRE' directives to tests that require en_US.UTF-8.

2016-01-21 Thread Marshall Clow via cfe-commits
On Thu, Jan 21, 2016 at 9:05 AM, Hans Wennborg  wrote:

> Hi Marshall,
>
> Is this OK for 3.8?
>

I have no idea; this is the first I've seen of it.
Apparently it was posted on phab, no one approved it, and it was committed.

In an hour.

-- Marshall




>
> Daniel, I assume we want reviews.llvm.org/D16408 too when that lands,
> right?
>
> Thanks,
> Hans
>
> On Thu, Jan 21, 2016 at 7:35 AM, Daniel Sanders via cfe-commits
>  wrote:
> > Author: dsanders
> > Date: Thu Jan 21 09:35:15 2016
> > New Revision: 258403
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=258403&view=rev
> > Log:
> > [libcxx] Add appropriate 'REQUIRE' directives to tests that require
> en_US.UTF-8.
> >
> > Reviewers: mclow.lists, hans
> >
> > Subscribers: bcraig, cfe-commits
> >
> > Differential Revision: http://reviews.llvm.org/D16406
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


RE: [libcxx] r258403 - [libcxx] Add appropriate 'REQUIRE' directives to tests that require en_US.UTF-8.

2016-01-21 Thread Daniel Sanders via cfe-commits
Hi,

It was LGTM'd by bcraig.

From: Marshall Clow [mailto:mclow.li...@gmail.com]
Sent: 21 January 2016 17:25
To: Hans Wennborg
Cc: Daniel Sanders; cfe-commits
Subject: Re: [libcxx] r258403 - [libcxx] Add appropriate 'REQUIRE' directives 
to tests that require en_US.UTF-8.

On Thu, Jan 21, 2016 at 9:05 AM, Hans Wennborg 
mailto:h...@chromium.org>> wrote:
Hi Marshall,

Is this OK for 3.8?

I have no idea; this is the first I've seen of it.
Apparently it was posted on phab, no one approved it, and it was committed.

In an hour.

-- Marshall




Daniel, I assume we want 
reviews.llvm.org/D16408 too when that lands, 
right?

Thanks,
Hans

On Thu, Jan 21, 2016 at 7:35 AM, Daniel Sanders via cfe-commits
mailto:cfe-commits@lists.llvm.org>> wrote:
> Author: dsanders
> Date: Thu Jan 21 09:35:15 2016
> New Revision: 258403
>
> URL: http://llvm.org/viewvc/llvm-project?rev=258403&view=rev
> Log:
> [libcxx] Add appropriate 'REQUIRE' directives to tests that require 
> en_US.UTF-8.
>
> Reviewers: mclow.lists, hans
>
> Subscribers: bcraig, cfe-commits
>
> Differential Revision: http://reviews.llvm.org/D16406

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


Re: [libcxx] r258403 - [libcxx] Add appropriate 'REQUIRE' directives to tests that require en_US.UTF-8.

2016-01-21 Thread Marshall Clow via cfe-commits
On Thu, Jan 21, 2016 at 9:27 AM, Daniel Sanders 
wrote:

> Hi,
>
>
>
> It was LGTM'd by bcraig.
>

Specifically, he said "LGTM, but that doesn't mean much."

-- Marshall


>
>
> *From:* Marshall Clow [mailto:mclow.li...@gmail.com]
> *Sent:* 21 January 2016 17:25
> *To:* Hans Wennborg
> *Cc:* Daniel Sanders; cfe-commits
> *Subject:* Re: [libcxx] r258403 - [libcxx] Add appropriate 'REQUIRE'
> directives to tests that require en_US.UTF-8.
>
>
>
> On Thu, Jan 21, 2016 at 9:05 AM, Hans Wennborg  wrote:
>
> Hi Marshall,
>
> Is this OK for 3.8?
>
>
>
> I have no idea; this is the first I've seen of it.
>
> Apparently it was posted on phab, no one approved it, and it was committed.
>
>
>
> In an hour.
>
>
>
> -- Marshall
>
>
>
>
>
>
>
>
> Daniel, I assume we want reviews.llvm.org/D16408 too when that lands,
> right?
>
> Thanks,
> Hans
>
>
> On Thu, Jan 21, 2016 at 7:35 AM, Daniel Sanders via cfe-commits
>  wrote:
> > Author: dsanders
> > Date: Thu Jan 21 09:35:15 2016
> > New Revision: 258403
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=258403&view=rev
> > Log:
> > [libcxx] Add appropriate 'REQUIRE' directives to tests that require
> en_US.UTF-8.
> >
> > Reviewers: mclow.lists, hans
> >
> > Subscribers: bcraig, cfe-commits
> >
> > Differential Revision: http://reviews.llvm.org/D16406
>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


RE: [libcxx] r258403 - [libcxx] Add appropriate 'REQUIRE' directives to tests that require en_US.UTF-8.

2016-01-21 Thread Daniel Sanders via cfe-commits
I just took that as being humble. I'm happy to revert if you want.

From: Marshall Clow [mailto:mclow.li...@gmail.com]
Sent: 21 January 2016 17:29
To: Daniel Sanders
Cc: Hans Wennborg; cfe-commits
Subject: Re: [libcxx] r258403 - [libcxx] Add appropriate 'REQUIRE' directives 
to tests that require en_US.UTF-8.

On Thu, Jan 21, 2016 at 9:27 AM, Daniel Sanders 
mailto:daniel.sand...@imgtec.com>> wrote:
Hi,

It was LGTM'd by bcraig.

Specifically, he said "LGTM, but that doesn't mean much."

-- Marshall


From: Marshall Clow [mailto:mclow.li...@gmail.com]
Sent: 21 January 2016 17:25
To: Hans Wennborg
Cc: Daniel Sanders; cfe-commits
Subject: Re: [libcxx] r258403 - [libcxx] Add appropriate 'REQUIRE' directives 
to tests that require en_US.UTF-8.

On Thu, Jan 21, 2016 at 9:05 AM, Hans Wennborg 
mailto:h...@chromium.org>> wrote:
Hi Marshall,

Is this OK for 3.8?

I have no idea; this is the first I've seen of it.
Apparently it was posted on phab, no one approved it, and it was committed.

In an hour.

-- Marshall




Daniel, I assume we want 
reviews.llvm.org/D16408 too when that lands, 
right?

Thanks,
Hans

On Thu, Jan 21, 2016 at 7:35 AM, Daniel Sanders via cfe-commits
mailto:cfe-commits@lists.llvm.org>> wrote:
> Author: dsanders
> Date: Thu Jan 21 09:35:15 2016
> New Revision: 258403
>
> URL: http://llvm.org/viewvc/llvm-project?rev=258403&view=rev
> Log:
> [libcxx] Add appropriate 'REQUIRE' directives to tests that require 
> en_US.UTF-8.
>
> Reviewers: mclow.lists, hans
>
> Subscribers: bcraig, cfe-commits
>
> Differential Revision: http://reviews.llvm.org/D16406


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


Re: [PATCH][Modules][PR26179]

2016-01-21 Thread Vassil Vassilev via cfe-commits

ping... (perhaps someone else with commit rights can check it it...)
--Vassil
On 18/01/16 22:07, Vassil Vassilev wrote:

Thanks! Could you check it in?
-- Vassil
On 18/01/16 21:38, Richard Smith via cfe-commits wrote:


LGTM

On Jan 18, 2016 12:06 PM, "Vassil Vassilev" > wrote:


Attaching v3 of the patch. Added your case to the current test
and fixed my silly non-array mistake.
-- Vassil
On 18/01/16 20:38, Richard Smith wrote:


Please also add a test case that your old patch would have
failed on, such as:

m1.h:
extern int a[];

m2.h:
extern int a[5];

x.cc:
#include "m1.h"
#include "m2.h"
int *p = a;

On Jan 18, 2016 9:28 AM, "Vassil Vassilev" mailto:vvasi...@cern.ch>> wrote:

On 17/01/16 06:34, Douglas Gregor wrote:

On Jan 16, 2016, at 3:41 PM, Vassil Vassilev
 wrote:

Hi,
  Could somebody review the attached patch. It fixes
https://llvm.org/bugs/show_bug.cgi?id=26179
Many thanks!
Vassil

<0001-modules-Teach-clang-to-how-to-merge-variable-redecls.patch>


+  // We can get decls with different types on the
redecl chain. Eg.
+  // template  struct S { static T
Var[]; }; // #1
+  // template  T S::Var[sizeof(T)];
// #2
+  // Trying to compare #1 and #2 should go through
their canonical decls.
+  QualType VarXTy =
VarX->getCanonicalDecl()->getType();
+  QualType VarYTy =
VarY->getCanonicalDecl()->getType();
+  if (Context.hasSameType(VarXTy, VarYTy))
+return true;

Completing an incomplete array is (I think) the only
case in which this can happen. How about checking for
that case specifically (i.e., it’s okay to have one be
an incomplete array and the other to be any other kind
of array with the same element type), rather than a
blanket check on the canonical declaration types?

- Doug

Thanks for the comments. Patch v2 attached.
-- Vassil





___
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: [libcxx] r258403 - [libcxx] Add appropriate 'REQUIRE' directives to tests that require en_US.UTF-8.

2016-01-21 Thread Daniel Sanders via cfe-commits
I'm not sure why my reply-all dropped Hans from the recipients. Re-added him.

From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On Behalf Of 
Daniel Sanders via cfe-commits
Sent: 21 January 2016 17:31
To: Marshall Clow
Cc: cfe-commits
Subject: RE: [libcxx] r258403 - [libcxx] Add appropriate 'REQUIRE' directives 
to tests that require en_US.UTF-8.

I just took that as being humble. I'm happy to revert if you want.

From: Marshall Clow [mailto:mclow.li...@gmail.com]
Sent: 21 January 2016 17:29
To: Daniel Sanders
Cc: Hans Wennborg; cfe-commits
Subject: Re: [libcxx] r258403 - [libcxx] Add appropriate 'REQUIRE' directives 
to tests that require en_US.UTF-8.

On Thu, Jan 21, 2016 at 9:27 AM, Daniel Sanders 
mailto:daniel.sand...@imgtec.com>> wrote:
Hi,

It was LGTM'd by bcraig.

Specifically, he said "LGTM, but that doesn't mean much."

-- Marshall


From: Marshall Clow [mailto:mclow.li...@gmail.com]
Sent: 21 January 2016 17:25
To: Hans Wennborg
Cc: Daniel Sanders; cfe-commits
Subject: Re: [libcxx] r258403 - [libcxx] Add appropriate 'REQUIRE' directives 
to tests that require en_US.UTF-8.

On Thu, Jan 21, 2016 at 9:05 AM, Hans Wennborg 
mailto:h...@chromium.org>> wrote:
Hi Marshall,

Is this OK for 3.8?

I have no idea; this is the first I've seen of it.
Apparently it was posted on phab, no one approved it, and it was committed.

In an hour.

-- Marshall




Daniel, I assume we want 
reviews.llvm.org/D16408 too when that lands, 
right?

Thanks,
Hans

On Thu, Jan 21, 2016 at 7:35 AM, Daniel Sanders via cfe-commits
mailto:cfe-commits@lists.llvm.org>> wrote:
> Author: dsanders
> Date: Thu Jan 21 09:35:15 2016
> New Revision: 258403
>
> URL: http://llvm.org/viewvc/llvm-project?rev=258403&view=rev
> Log:
> [libcxx] Add appropriate 'REQUIRE' directives to tests that require 
> en_US.UTF-8.
>
> Reviewers: mclow.lists, hans
>
> Subscribers: bcraig, cfe-commits
>
> Differential Revision: http://reviews.llvm.org/D16406


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


[PATCH] D16413: Let RecursiveASTVisitor visit array index VarDecls

2016-01-21 Thread Nico Weber via cfe-commits
thakis created this revision.
thakis added reviewers: rsmith, klimek.
thakis added a subscriber: cfe-commits.
Herald added a subscriber: klimek.

An implicit copy ctor creates loop VarDecls that hang off CXXCtorInitializer. 
RecursiveASTVisitor used to not visit them, so that they didn't show up in the 
parent map used by ASTMatchers, causing asserts() when the implicit 
DeclRefExpr() in a CXXCtorInitializer referred to one of these VarDecls.

Fixes PR26227.

http://reviews.llvm.org/D16413

Files:
  include/clang/AST/RecursiveASTVisitor.h
  unittests/ASTMatchers/ASTMatchersTest.cpp

Index: include/clang/AST/RecursiveASTVisitor.h
===
--- include/clang/AST/RecursiveASTVisitor.h
+++ include/clang/AST/RecursiveASTVisitor.h
@@ -809,6 +809,10 @@
 
   if (Init->isWritten() || getDerived().shouldVisitImplicitCode())
 TRY_TO(TraverseStmt(Init->getInit()));
+
+  if (Init->getNumArrayIndices() && getDerived().shouldVisitImplicitCode())
+for (VarDecl *VD : Init->getArrayIndexes())
+  TRY_TO(TraverseDecl(VD));
   return true;
 }
 
Index: unittests/ASTMatchers/ASTMatchersTest.cpp
===
--- unittests/ASTMatchers/ASTMatchersTest.cpp
+++ unittests/ASTMatchers/ASTMatchersTest.cpp
@@ -4207,6 +4207,14 @@
   
hasAncestor(cxxRecordDecl(unless(isTemplateInstantiation(;
 }
 
+TEST(HasAncestor, FIXMEbettername) {
+  EXPECT_TRUE(matches("struct MyClass {\n"
+  "  int c[1];\n"
+  "  static MyClass Create() { return MyClass(); }\n"
+  "};",
+  declRefExpr(to(decl(hasAncestor(decl()));
+}
+
 TEST(HasParent, MatchesAllParents) {
   EXPECT_TRUE(matches(
   "template  struct C { static void f() { 42; } };"


Index: include/clang/AST/RecursiveASTVisitor.h
===
--- include/clang/AST/RecursiveASTVisitor.h
+++ include/clang/AST/RecursiveASTVisitor.h
@@ -809,6 +809,10 @@
 
   if (Init->isWritten() || getDerived().shouldVisitImplicitCode())
 TRY_TO(TraverseStmt(Init->getInit()));
+
+  if (Init->getNumArrayIndices() && getDerived().shouldVisitImplicitCode())
+for (VarDecl *VD : Init->getArrayIndexes())
+  TRY_TO(TraverseDecl(VD));
   return true;
 }
 
Index: unittests/ASTMatchers/ASTMatchersTest.cpp
===
--- unittests/ASTMatchers/ASTMatchersTest.cpp
+++ unittests/ASTMatchers/ASTMatchersTest.cpp
@@ -4207,6 +4207,14 @@
   hasAncestor(cxxRecordDecl(unless(isTemplateInstantiation(;
 }
 
+TEST(HasAncestor, FIXMEbettername) {
+  EXPECT_TRUE(matches("struct MyClass {\n"
+  "  int c[1];\n"
+  "  static MyClass Create() { return MyClass(); }\n"
+  "};",
+  declRefExpr(to(decl(hasAncestor(decl()));
+}
+
 TEST(HasParent, MatchesAllParents) {
   EXPECT_TRUE(matches(
   "template  struct C { static void f() { 42; } };"
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D16413: Let RecursiveASTVisitor visit array index VarDecls

2016-01-21 Thread Nico Weber via cfe-commits
thakis updated this revision to Diff 45551.
thakis added a comment.

fix test name


http://reviews.llvm.org/D16413

Files:
  include/clang/AST/RecursiveASTVisitor.h
  unittests/ASTMatchers/ASTMatchersTest.cpp

Index: include/clang/AST/RecursiveASTVisitor.h
===
--- include/clang/AST/RecursiveASTVisitor.h
+++ include/clang/AST/RecursiveASTVisitor.h
@@ -809,6 +809,10 @@
 
   if (Init->isWritten() || getDerived().shouldVisitImplicitCode())
 TRY_TO(TraverseStmt(Init->getInit()));
+
+  if (Init->getNumArrayIndices() && getDerived().shouldVisitImplicitCode())
+for (VarDecl *VD : Init->getArrayIndexes())
+  TRY_TO(TraverseDecl(VD));
   return true;
 }
 
Index: unittests/ASTMatchers/ASTMatchersTest.cpp
===
--- unittests/ASTMatchers/ASTMatchersTest.cpp
+++ unittests/ASTMatchers/ASTMatchersTest.cpp
@@ -4207,6 +4207,14 @@
   
hasAncestor(cxxRecordDecl(unless(isTemplateInstantiation(;
 }
 
+TEST(HasAncestor, ImplicitArrayCopyCtorDeclRefExpr) {
+  EXPECT_TRUE(matches("struct MyClass {\n"
+  "  int c[1];\n"
+  "  static MyClass Create() { return MyClass(); }\n"
+  "};",
+  declRefExpr(to(decl(hasAncestor(decl()));
+}
+
 TEST(HasParent, MatchesAllParents) {
   EXPECT_TRUE(matches(
   "template  struct C { static void f() { 42; } };"


Index: include/clang/AST/RecursiveASTVisitor.h
===
--- include/clang/AST/RecursiveASTVisitor.h
+++ include/clang/AST/RecursiveASTVisitor.h
@@ -809,6 +809,10 @@
 
   if (Init->isWritten() || getDerived().shouldVisitImplicitCode())
 TRY_TO(TraverseStmt(Init->getInit()));
+
+  if (Init->getNumArrayIndices() && getDerived().shouldVisitImplicitCode())
+for (VarDecl *VD : Init->getArrayIndexes())
+  TRY_TO(TraverseDecl(VD));
   return true;
 }
 
Index: unittests/ASTMatchers/ASTMatchersTest.cpp
===
--- unittests/ASTMatchers/ASTMatchersTest.cpp
+++ unittests/ASTMatchers/ASTMatchersTest.cpp
@@ -4207,6 +4207,14 @@
   hasAncestor(cxxRecordDecl(unless(isTemplateInstantiation(;
 }
 
+TEST(HasAncestor, ImplicitArrayCopyCtorDeclRefExpr) {
+  EXPECT_TRUE(matches("struct MyClass {\n"
+  "  int c[1];\n"
+  "  static MyClass Create() { return MyClass(); }\n"
+  "};",
+  declRefExpr(to(decl(hasAncestor(decl()));
+}
+
 TEST(HasParent, MatchesAllParents) {
   EXPECT_TRUE(matches(
   "template  struct C { static void f() { 42; } };"
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D8940: Clang changes for indirect call target profiling

2016-01-21 Thread Betul Buyukkurt via cfe-commits
betulb updated this revision to Diff 45550.
betulb added a comment.

In this revision:

- Clang no longer attaches function names as metadata.
- Bug fixed in checking the getNumValueSites return value.
- Addressed review comments.


http://reviews.llvm.org/D8940

Files:
  lib/CodeGen/CGCall.cpp
  lib/CodeGen/CodeGenPGO.cpp
  lib/CodeGen/CodeGenPGO.h
  test/Profile/c-indirect-call.c

Index: test/Profile/c-indirect-call.c
===
--- /dev/null
+++ test/Profile/c-indirect-call.c
@@ -0,0 +1,15 @@
+// Check the data structures emitted by instrumentation.
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name c-indirect-call.c %s -o - -emit-llvm -fprofile-instr-generate -mllvm -enable-value-profiling | FileCheck %s
+
+void (*foo)(void);
+
+int main(void) {
+// CHECK:  [[REG1:%[0-9]+]] = load void ()*, void ()** @foo, align 8
+// CHECK-NEXT:  call void [[REG1]]()
+// CHECK-NEXT:  [[REG2:%[0-9]+]] = ptrtoint void ()* [[REG1]] to i64
+// CHECK-NEXT:  call void @__llvm_profile_instrument_target(i64 [[REG2]], i8* bitcast ({ i32, i32, i64, i8*, i64*, i8*, i8*, [1 x i16] }* @__profd_main to i8*), i32 0)
+  foo();
+  return 0;
+}
+
+// CHECK: declare void @__llvm_profile_instrument_target(i64, i8*, i32)
Index: lib/CodeGen/CodeGenPGO.h
===
--- lib/CodeGen/CodeGenPGO.h
+++ lib/CodeGen/CodeGenPGO.h
@@ -19,6 +19,7 @@
 #include "CodeGenTypes.h"
 #include "clang/Frontend/CodeGenOptions.h"
 #include "llvm/ADT/StringMap.h"
+#include "llvm/ProfileData/InstrProfReader.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include 
 
@@ -32,20 +33,22 @@
   std::string FuncName;
   llvm::GlobalVariable *FuncNameVar;
 
+  unsigned NumValueSites[llvm::IPVK_Last + 1];
   unsigned NumRegionCounters;
   uint64_t FunctionHash;
   std::unique_ptr> RegionCounterMap;
   std::unique_ptr> StmtCountMap;
+  std::unique_ptr ProfRecord;
   std::vector RegionCounts;
   uint64_t CurrentRegionCount;
   /// \brief A flag that is set to true when this function doesn't need
   /// to have coverage mapping data.
   bool SkipCoverageMapping;
 
 public:
   CodeGenPGO(CodeGenModule &CGM)
-  : CGM(CGM), NumRegionCounters(0), FunctionHash(0), CurrentRegionCount(0),
-SkipCoverageMapping(false) {}
+  : CGM(CGM), NumValueSites{0}, NumRegionCounters(0),
+FunctionHash(0), CurrentRegionCount(0), SkipCoverageMapping(false) {}
 
   /// Whether or not we have PGO region data for the current function. This is
   /// false both when we have no data at all and when our data has been
@@ -87,6 +90,9 @@
   /// for an unused declaration.
   void emitEmptyCounterMapping(const Decl *D, StringRef FuncName,
llvm::GlobalValue::LinkageTypes Linkage);
+  // Insert instrumentation or attach profile metadata at value sites
+  void valueProfile(CGBuilderTy &Builder, uint32_t ValueKind,
+llvm::Instruction *ValueSite, llvm::Value *ValuePtr);
 private:
   void setFuncName(llvm::Function *Fn);
   void setFuncName(StringRef Name, llvm::GlobalValue::LinkageTypes Linkage);
Index: lib/CodeGen/CodeGenPGO.cpp
===
--- lib/CodeGen/CodeGenPGO.cpp
+++ lib/CodeGen/CodeGenPGO.cpp
@@ -18,11 +18,14 @@
 #include "clang/AST/StmtVisitor.h"
 #include "llvm/IR/Intrinsics.h"
 #include "llvm/IR/MDBuilder.h"
-#include "llvm/ProfileData/InstrProfReader.h"
 #include "llvm/Support/Endian.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/MD5.h"
 
+static llvm::cl::opt EnableValueProfiling(
+  "enable-value-profiling", llvm::cl::ZeroOrMore,
+  llvm::cl::desc("Enable value profiling"), llvm::cl::init(false));
+
 using namespace clang;
 using namespace CodeGen;
 
@@ -740,21 +743,95 @@
   Builder.getInt32(Counter)});
 }
 
+// This method either inserts a call to the profile run-time during
+// instrumentation or puts profile data into metadata for PGO use.
+void CodeGenPGO::valueProfile(CGBuilderTy &Builder, uint32_t ValueKind,
+llvm::Instruction *ValueSite, llvm::Value *ValuePtr) {
+
+  if (!EnableValueProfiling)
+return;
+
+  if (!ValuePtr || !ValueSite || !Builder.GetInsertBlock())
+return;
+
+  bool InstrumentValueSites = CGM.getCodeGenOpts().ProfileInstrGenerate;
+  if (InstrumentValueSites && RegionCounterMap) {
+llvm::LLVMContext &Ctx = CGM.getLLVMContext();
+auto *I8PtrTy = llvm::Type::getInt8PtrTy(Ctx);
+llvm::Value *Args[5] = {
+llvm::ConstantExpr::getBitCast(FuncNameVar, I8PtrTy),
+Builder.getInt64(FunctionHash),
+Builder.CreatePtrToInt(ValuePtr, Builder.getInt64Ty()),
+Builder.getInt32(ValueKind),
+Builder.getInt32(NumValueSites[ValueKind]++)
+};
+Builder.CreateCall(
+CGM.getIntrinsic(llvm::Intrinsic::instrprof_value_profile), Args);
+return;
+  }
+
+  llvm::IndexedInstrProfReader *PGOReader = CGM.getPGOReader();
+  if (PGORea

r258415 - Add an isVirtualAsWritten AST matcher.

2016-01-21 Thread Nico Weber via cfe-commits
Author: nico
Date: Thu Jan 21 11:56:24 2016
New Revision: 258415

URL: http://llvm.org/viewvc/llvm-project?rev=258415&view=rev
Log:
Add an isVirtualAsWritten AST matcher.

http://reviews.llvm.org/D16394

Modified:
cfe/trunk/docs/LibASTMatchersReference.html
cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp
cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp

Modified: cfe/trunk/docs/LibASTMatchersReference.html
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LibASTMatchersReference.html?rev=258415&r1=258414&r2=258415&view=diff
==
--- cfe/trunk/docs/LibASTMatchersReference.html (original)
+++ cfe/trunk/docs/LibASTMatchersReference.html Thu Jan 21 11:56:24 2016
@@ -1854,6 +1854,20 @@ Given
   matches A::x
 
 
+MatcherCXXMethodDecl>isVirtualAsWritten
+Matches if the 
given method declaration has an explicit "virtual".
+
+Given
+  class A {
+   public:
+virtual void x();
+  };
+  class B : public A {
+   public:
+void x();
+  };
+  matches A::x but not B::x
+
 
 MatcherCXXOperatorCallExpr>hasOverloadedOperatorNameStringRef
 Name
 Matches 
overloaded operator names.

Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h?rev=258415&r1=258414&r2=258415&view=diff
==
--- cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h (original)
+++ cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h Thu Jan 21 11:56:24 2016
@@ -3491,6 +3491,24 @@ AST_MATCHER(CXXMethodDecl, isVirtual) {
   return Node.isVirtual();
 }
 
+/// \brief Matches if the given method declaration has an explicit "virtual".
+///
+/// Given
+/// \code
+///   class A {
+///public:
+/// virtual void x();
+///   };
+///   class B : public A {
+///public:
+/// void x();
+///   };
+/// \endcode
+///   matches A::x but not B::x
+AST_MATCHER(CXXMethodDecl, isVirtualAsWritten) {
+  return Node.isVirtualAsWritten();
+}
+
 /// \brief Matches if the given method or class declaration is final.
 ///
 /// Given:

Modified: cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp?rev=258415&r1=258414&r2=258415&view=diff
==
--- cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp (original)
+++ cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp Thu Jan 21 11:56:24 2016
@@ -303,6 +303,7 @@ RegistryMaps::RegistryMaps() {
   REGISTER_MATCHER(isUnion);
   REGISTER_MATCHER(isVariadic);
   REGISTER_MATCHER(isVirtual);
+  REGISTER_MATCHER(isVirtualAsWritten);
   REGISTER_MATCHER(isVolatileQualified);
   REGISTER_MATCHER(isWritten);
   REGISTER_MATCHER(labelStmt);

Modified: cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp?rev=258415&r1=258414&r2=258415&view=diff
==
--- cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp (original)
+++ cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp Thu Jan 21 11:56:24 2016
@@ -2028,6 +2028,16 @@ TEST(Matcher, MatchesVirtualMethod) {
   EXPECT_TRUE(notMatches("class X { int f(); };", cxxMethodDecl(isVirtual(;
 }
 
+TEST(Matcher, MatchesVirtualAsWrittenMethod) {
+  EXPECT_TRUE(matches("class A { virtual int f(); };"
+  "class B : public A { int f(); };",
+  cxxMethodDecl(isVirtualAsWritten(), hasName("::A::f";
+  EXPECT_TRUE(
+  notMatches("class A { virtual int f(); };"
+ "class B : public A { int f(); };",
+ cxxMethodDecl(isVirtualAsWritten(), hasName("::B::f";
+}
+
 TEST(Matcher, MatchesPureMethod) {
   EXPECT_TRUE(matches("class X { virtual int f() = 0; };",
   cxxMethodDecl(isPure(), hasName("::X::f";


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


Re: [PATCH] D16394: Add an isVirtualAsWritten AST matcher.

2016-01-21 Thread Nico Weber via cfe-commits
thakis closed this revision.
thakis added a comment.

r258415, thanks!


http://reviews.llvm.org/D16394



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


Re: [clang-tools-extra] r258356 - Make modernize-use-default tolerant of delayed template parsing; this code was previously causing failed assertions because dyn_cast was being passed a null pointer d

2016-01-21 Thread Alexander Kornienko via cfe-commits
I'm fine with including this to 3.8. BTW, I'm working on release notes.

On Thu, Jan 21, 2016 at 6:01 PM, Hans Wennborg  wrote:

> I'm fine with it. Alex, what do you think?
>
> On Wed, Jan 20, 2016 at 3:07 PM, Aaron Ballman 
> wrote:
> > Uncertain whether this meets the bar for inclusion in 3.8.
> > clang-modernize was moved into clang-tidy and from what I can tell, it
> > did not suffer from this crash. I wouldn't normally recommend this,
> > but just about any use of clang-tidy (that does not filter out this
> > check) over code that includes the MSVC STL headers will trigger that
> > assert without this fix.
> >
> > ~Aaron
> >
> > On Wed, Jan 20, 2016 at 5:14 PM, Aaron Ballman via cfe-commits
> >  wrote:
> >> Author: aaronballman
> >> Date: Wed Jan 20 16:14:10 2016
> >> New Revision: 258356
> >>
> >> URL: http://llvm.org/viewvc/llvm-project?rev=258356&view=rev
> >> Log:
> >> Make modernize-use-default tolerant of delayed template parsing; this
> code was previously causing failed assertions because dyn_cast was being
> passed a null pointer due to the delay-parsed body.
> >>
> >> Added:
> >>
>  clang-tools-extra/trunk/test/clang-tidy/modernize-use-default-delayed.cpp
> >> Modified:
> >> clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultCheck.cpp
> >>
> >> Modified:
> clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultCheck.cpp
> >> URL:
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultCheck.cpp?rev=258356&r1=258355&r2=258356&view=diff
> >>
> ==
> >> --- clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultCheck.cpp
> (original)
> >> +++ clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultCheck.cpp
> Wed Jan 20 16:14:10 2016
> >> @@ -272,6 +272,7 @@ void UseDefaultCheck::check(const MatchF
> >>// that are not user-provided (automatically generated).
> >>if (SpecialFunctionDecl->isDeleted() ||
> >>SpecialFunctionDecl->isExplicitlyDefaulted() ||
> >> +  SpecialFunctionDecl->isLateTemplateParsed() ||
> >>!SpecialFunctionDecl->isUserProvided() ||
> !SpecialFunctionDecl->hasBody())
> >>  return;
> >>
> >>
> >> Added:
> clang-tools-extra/trunk/test/clang-tidy/modernize-use-default-delayed.cpp
> >> URL:
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/modernize-use-default-delayed.cpp?rev=258356&view=auto
> >>
> ==
> >> ---
> clang-tools-extra/trunk/test/clang-tidy/modernize-use-default-delayed.cpp
> (added)
> >> +++
> clang-tools-extra/trunk/test/clang-tidy/modernize-use-default-delayed.cpp
> Wed Jan 20 16:14:10 2016
> >> @@ -0,0 +1,8 @@
> >> +// RUN: clang-tidy %s -checks=-*,modernize-use-default -- -std=c++11
> -fdelayed-template-parsing -fexceptions | count 0
> >> +// Note: this test expects no diagnostics, but FileCheck cannot handle
> that,
> >> +// hence the use of | count 0.
> >> +
> >> +template 
> >> +struct S {
> >> +  S& operator=(const S&) { return *this; }
> >> +};
> >>
> >>
> >> ___
> >> 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: [clang-tools-extra] r258356 - Make modernize-use-default tolerant of delayed template parsing; this code was previously causing failed assertions because dyn_cast was being passed a null pointer d

2016-01-21 Thread Hans Wennborg via cfe-commits
Thanks.

Aaron, do you want to go ahead and merge this with
utils/release/merge.sh? Or let me know if you'd prefer me to do the
merge.

On Thu, Jan 21, 2016 at 10:00 AM, Alexander Kornienko  wrote:
> I'm fine with including this to 3.8. BTW, I'm working on release notes.
>
> On Thu, Jan 21, 2016 at 6:01 PM, Hans Wennborg  wrote:
>>
>> I'm fine with it. Alex, what do you think?
>>
>> On Wed, Jan 20, 2016 at 3:07 PM, Aaron Ballman 
>> wrote:
>> > Uncertain whether this meets the bar for inclusion in 3.8.
>> > clang-modernize was moved into clang-tidy and from what I can tell, it
>> > did not suffer from this crash. I wouldn't normally recommend this,
>> > but just about any use of clang-tidy (that does not filter out this
>> > check) over code that includes the MSVC STL headers will trigger that
>> > assert without this fix.
>> >
>> > ~Aaron
>> >
>> > On Wed, Jan 20, 2016 at 5:14 PM, Aaron Ballman via cfe-commits
>> >  wrote:
>> >> Author: aaronballman
>> >> Date: Wed Jan 20 16:14:10 2016
>> >> New Revision: 258356
>> >>
>> >> URL: http://llvm.org/viewvc/llvm-project?rev=258356&view=rev
>> >> Log:
>> >> Make modernize-use-default tolerant of delayed template parsing; this
>> >> code was previously causing failed assertions because dyn_cast was being
>> >> passed a null pointer due to the delay-parsed body.
>> >>
>> >> Added:
>> >>
>> >> clang-tools-extra/trunk/test/clang-tidy/modernize-use-default-delayed.cpp
>> >> Modified:
>> >> clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultCheck.cpp
>> >>
>> >> Modified:
>> >> clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultCheck.cpp
>> >> URL:
>> >> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultCheck.cpp?rev=258356&r1=258355&r2=258356&view=diff
>> >>
>> >> ==
>> >> --- clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultCheck.cpp
>> >> (original)
>> >> +++ clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultCheck.cpp
>> >> Wed Jan 20 16:14:10 2016
>> >> @@ -272,6 +272,7 @@ void UseDefaultCheck::check(const MatchF
>> >>// that are not user-provided (automatically generated).
>> >>if (SpecialFunctionDecl->isDeleted() ||
>> >>SpecialFunctionDecl->isExplicitlyDefaulted() ||
>> >> +  SpecialFunctionDecl->isLateTemplateParsed() ||
>> >>!SpecialFunctionDecl->isUserProvided() ||
>> >> !SpecialFunctionDecl->hasBody())
>> >>  return;
>> >>
>> >>
>> >> Added:
>> >> clang-tools-extra/trunk/test/clang-tidy/modernize-use-default-delayed.cpp
>> >> URL:
>> >> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/modernize-use-default-delayed.cpp?rev=258356&view=auto
>> >>
>> >> ==
>> >> ---
>> >> clang-tools-extra/trunk/test/clang-tidy/modernize-use-default-delayed.cpp
>> >> (added)
>> >> +++
>> >> clang-tools-extra/trunk/test/clang-tidy/modernize-use-default-delayed.cpp
>> >> Wed Jan 20 16:14:10 2016
>> >> @@ -0,0 +1,8 @@
>> >> +// RUN: clang-tidy %s -checks=-*,modernize-use-default -- -std=c++11
>> >> -fdelayed-template-parsing -fexceptions | count 0
>> >> +// Note: this test expects no diagnostics, but FileCheck cannot handle
>> >> that,
>> >> +// hence the use of | count 0.
>> >> +
>> >> +template 
>> >> +struct S {
>> >> +  S& operator=(const S&) { return *this; }
>> >> +};
>> >>
>> >>
>> >> ___
>> >> 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] D16376: clang-tidy check: User-defined copy without assignment

2016-01-21 Thread Jonathan B Coe via cfe-commits
jbcoe removed rL LLVM as the repository for this revision.
jbcoe updated this revision to Diff 45554.
jbcoe added a comment.

Made requested changes.


http://reviews.llvm.org/D16376

Files:
  clang-tidy/misc/CMakeLists.txt
  clang-tidy/misc/MiscTidyModule.cpp
  clang-tidy/misc/UserDefinedCopyWithoutAssignmentCheck.cpp
  clang-tidy/misc/UserDefinedCopyWithoutAssignmentCheck.h
  clang-tidy/modernize/UseDefaultCheck.cpp
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/misc-user-defined-copy-without-assignment.rst
  test/clang-tidy/misc-user-defined-copy-without-assignment.cpp
  test/clang-tidy/modernize-use-default-delayed.cpp

Index: test/clang-tidy/modernize-use-default-delayed.cpp
===
--- /dev/null
+++ test/clang-tidy/modernize-use-default-delayed.cpp
@@ -0,0 +1,8 @@
+// RUN: clang-tidy %s -checks=-*,modernize-use-default -- -std=c++11 -fdelayed-template-parsing -fexceptions | count 0
+// Note: this test expects no diagnostics, but FileCheck cannot handle that,
+// hence the use of | count 0.
+
+template 
+struct S {
+  S& operator=(const S&) { return *this; }
+};
Index: test/clang-tidy/misc-user-defined-copy-without-assignment.cpp
===
--- /dev/null
+++ test/clang-tidy/misc-user-defined-copy-without-assignment.cpp
@@ -0,0 +1,38 @@
+// RUN: %check_clang_tidy %s misc-user-defined-copy-without-assignment %t
+class A {
+  A(const A &);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: class 'A' defines a copy-constructor but not an assignment operator [misc-user-defined-copy-without-assignment]
+};
+
+// CHECK-FIXES: class A {
+// CHECK-FIXES-NEXT: A(const A &);
+// CHECK-FIXES-NEXT: A &operator=(const A &) = delete;
+// CHECK-FIXES-NEXT: //
+// CHECK-FIXES-NEXT: };
+
+class B {
+  B(const B &);
+  B &operator=(const B &);
+};
+
+class C {
+  C(const C &) = default;
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: class 'C' defines a copy-constructor but not an assignment operator [misc-user-defined-copy-without-assignment]
+};
+
+// CHECK-FIXES: class C {
+// CHECK-FIXES-NEXT: C(const C &) = default;
+// CHECK-FIXES-NEXT: C &operator=(const C &) = delete;
+// CHECK-FIXES-NEXT: //
+// CHECK-FIXES-NEXT: };
+
+class D {
+  D(const D &);
+  D &operator=(const D &) = default;
+};
+
+class E {
+  E(const E &);
+  E &operator=(const E &) = delete;
+};
+
Index: docs/clang-tidy/checks/misc-user-defined-copy-without-assignment.rst
===
--- /dev/null
+++ docs/clang-tidy/checks/misc-user-defined-copy-without-assignment.rst
@@ -0,0 +1,36 @@
+.. title:: clang-tidy - misc-user-defined-copy-without-assignment
+
+misc-user-defined-copy-without-assignment
+=
+
+Compilers will generate an assignment operator even if the user defines a copy
+constructor.  This behaviour is deprecated by the standard (C++ 14 draft
+standard 12.8.18)
+
+"If the class definition does not explicitly declare a copy assignment
+operator, one is declared implicitly. If the class definition declares a move
+constructor or move assignment operator, the implicitly declared copy
+assignment operator is defined as deleted; otherwise, it is defined as
+defaulted (8.4). The latter case is deprecated if the class has a user-declared
+copy constructor or a user-declared destructor."
+
+This check finds classes with a user-defined (including deleted)
+copy-constructor but no assignment operator.
+
+  .. code:: c++
+class A {
+  A(const A&);
+};
+
+Will be matched and fixed to delete the assignment operator:
+
+  .. code:: c++
+class A {
+  A(const A&);
+  A& operator = (const A&) = delete;
+};
+
+The fix is defensive. Incorrect compiler-generated assignement can cause
+unexpected behaviour. An explicitly deleted assignment operator will cause a
+compiler error if it is used.
+
Index: docs/clang-tidy/checks/list.rst
===
--- docs/clang-tidy/checks/list.rst
+++ docs/clang-tidy/checks/list.rst
@@ -65,6 +65,7 @@
misc-unused-alias-decls
misc-unused-parameters
misc-unused-raii
+   misc-user-defined-copy-without-assignment
misc-virtual-near-miss
modernize-loop-convert
modernize-make-unique
Index: clang-tidy/modernize/UseDefaultCheck.cpp
===
--- clang-tidy/modernize/UseDefaultCheck.cpp
+++ clang-tidy/modernize/UseDefaultCheck.cpp
@@ -272,6 +272,7 @@
   // that are not user-provided (automatically generated).
   if (SpecialFunctionDecl->isDeleted() ||
   SpecialFunctionDecl->isExplicitlyDefaulted() ||
+  SpecialFunctionDecl->isLateTemplateParsed() ||
   !SpecialFunctionDecl->isUserProvided() || !SpecialFunctionDecl->hasBody())
 return;
 
Index: clang-tidy/misc/UserDefinedCopyWithoutAssignmentCheck.h

Re: [PATCH] D8940: Clang changes for indirect call target profiling

2016-01-21 Thread Betul Buyukkurt via cfe-commits
betulb marked 3 inline comments as done.


Comment at: lib/CodeGen/CodeGenPGO.cpp:768
@@ +767,3 @@
+};
+Builder.CreateCall(
+CGM.getIntrinsic(llvm::Intrinsic::instrprof_value_profile), Args);

I removed the if check instead. It was not needed since the later lines do 
check on the presence of the instrumentation flags and the reader. However the 
old check was correct as is.


http://reviews.llvm.org/D8940



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


Re: [PATCH] D16376: clang-tidy check: User-defined copy without assignment

2016-01-21 Thread Jonathan B Coe via cfe-commits
jbcoe marked 5 inline comments as done.


Comment at: clang-tidy/misc/UserDefinedCopyWithoutAssignmentCheck.h:25
@@ +24,3 @@
+/// assignment operator to be `= delete`.
+///
+/// For the user-facing documentation see:

The standard says that compiler generation of the assignment operator is 
deprecated if there is a user-defined copy constructor 12.8.18 . 

'= default' still counts as user-defined to the best of my understanding.

MSVC, clang and gcc all generate assignment operators in the face of deleted 
copy constructors. None of them seem to follow the deprecation rule.

I agree entirely with your point in principle, but it seems to be at odds with 
the standard. I think requiring the user to explicitly default the assignment 
operator by generating a deleted assignment operator is the right thing to do.


Comment at: 
docs/clang-tidy/checks/misc-user-defined-copy-without-assignment.rst:24
@@ +23,3 @@
+};
+
+Will be matched and fixed to delete the assignment operator:

How do I go about disabling a check by default?


http://reviews.llvm.org/D16376



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


Re: [PATCH] D16376: clang-tidy check: User-defined copy without assignment

2016-01-21 Thread Jonathan B Coe via cfe-commits
jbcoe marked 2 inline comments as done.
jbcoe added a comment.

http://reviews.llvm.org/D16376



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


Re: [PATCH] D15363: [UBSan] Implement runtime suppressions (PR25066).

2016-01-21 Thread Alexey Samsonov via cfe-commits
On Wed, Jan 20, 2016 at 12:42 PM, Nico Weber  wrote:

> thakis added a comment.
>
> After some more debugging, the only thing in this test that's still
> faiilng on Windows is the "unsigned-integer-overflow:do_overflow"
> suppression -- when llvm-symbolizer gets symbols from PDBs it currently
> requires the DIA SDK. If that's not found at cmake time, then
> llvm-symbolizer silently can't symbolize executables with pdb debug info.
>
> The test should probably have some "REQUIRES: symbols" thingie. (I'll also
> fix llvm not finding the DIA SDK in our build setup, but the test will
> still fail for others who don't have that.)
>

Interesting, thanks for digging into this! IIRC the story with Dwarf
support on Windows (both producing it by Clang and consuming it by
llvm-symbolizer) got slightly better recently. Maybe, we can add a compiler
flag to force Clang emit Dwarf data on Windows in our compiler-rt test
suites?


>
>
> Repository:
>   rL LLVM
>
> http://reviews.llvm.org/D15363
>
>
>
>


-- 
Alexey Samsonov
vonos...@gmail.com
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D15363: [UBSan] Implement runtime suppressions (PR25066).

2016-01-21 Thread Nico Weber via cfe-commits
On Thu, Jan 21, 2016 at 1:19 PM, Alexey Samsonov  wrote:

>
> On Wed, Jan 20, 2016 at 12:42 PM, Nico Weber  wrote:
>
>> thakis added a comment.
>>
>> After some more debugging, the only thing in this test that's still
>> faiilng on Windows is the "unsigned-integer-overflow:do_overflow"
>> suppression -- when llvm-symbolizer gets symbols from PDBs it currently
>> requires the DIA SDK. If that's not found at cmake time, then
>> llvm-symbolizer silently can't symbolize executables with pdb debug info.
>>
>> The test should probably have some "REQUIRES: symbols" thingie. (I'll
>> also fix llvm not finding the DIA SDK in our build setup, but the test will
>> still fail for others who don't have that.)
>>
>
> Interesting, thanks for digging into this! IIRC the story with Dwarf
> support on Windows (both producing it by Clang and consuming it by
> llvm-symbolizer) got slightly better recently. Maybe, we can add a compiler
> flag to force Clang emit Dwarf data on Windows in our compiler-rt test
> suites?
>

It isn't heavily tested and it'd require using lld instead of link. I think
it's possible. But most clients probably use PDBs for now, so maybe testing
that is better, not sure.


>
>
>>
>>
>> Repository:
>>   rL LLVM
>>
>> http://reviews.llvm.org/D15363
>>
>>
>>
>>
>
>
> --
> Alexey Samsonov
> vonos...@gmail.com
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D16385: [OpenMP] Update map clause SEMA to support OpenMP 4.5 possible list items.

2016-01-21 Thread Samuel Antao via cfe-commits
sfantao updated this revision to Diff 45557.
sfantao retitled this revision from " [OpenMP] Update map clause SEMA to 
support OpenMP 4.5 possible list items." to "[OpenMP] Update map clause SEMA to 
support OpenMP 4.5 possible list items.".
sfantao updated the summary for this revision.
sfantao added a comment.

Rebase patch as requested by Alexey.


http://reviews.llvm.org/D16385

Files:
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/Parse/ParseOpenMP.cpp
  lib/Sema/SemaOpenMP.cpp
  test/OpenMP/target_map_messages.cpp

Index: test/OpenMP/target_map_messages.cpp
===
--- test/OpenMP/target_map_messages.cpp
+++ test/OpenMP/target_map_messages.cpp
@@ -1,5 +1,181 @@
 // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s
 
+template 
+struct SA {
+  static int ss;
+  #pragma omp threadprivate(ss) // expected-note {{defined as threadprivate or thread local}}
+  float a;
+  int b[12];
+  float *c;
+  T d;
+  float e[I];
+  T *f;
+  void func(int arg) {
+#pragma omp target map(arg,a,d)
+{}
+#pragma omp target map(arg[2:2],a,d) // expected-error {{subscripted value is not an array or pointer}}
+{}
+#pragma omp target map(arg,a*2) // expected-error {{expected expression containing only member accesses and/or array sections based on named variables}}
+{}
+#pragma omp target map(arg,(c+1)[2]) // expected-error {{expected expression containing only member accesses and/or array sections based on named variables}}
+{}
+#pragma omp target map(arg,a[:2],d) // expected-error {{subscripted value is not an array or pointer}}
+{}
+#pragma omp target map(arg,a,d[:2]) // expected-error {{subscripted value is not an array or pointer}}
+{}
+
+#pragma omp target map(to:ss) // expected-error {{threadprivate variables are not allowed in map clause}}
+{}
+
+#pragma omp target map(to:b,e)
+{}
+#pragma omp target map(to:b,e) map(to:b) // expected-error {{variable already marked as mapped in current construct}} expected-note {{used here}}
+{}
+#pragma omp target map(to:b[:2],e)
+{}
+#pragma omp target map(to:b,e[:])
+{}
+
+#pragma omp target map(always, tofrom: c,f)
+{}
+#pragma omp target map(always, tofrom: c[1:2],f)
+{}
+#pragma omp target map(always, tofrom: c,f[1:2])
+{}
+#pragma omp target map(always, tofrom: c[:],f)   // expected-error {{section length is unspecified and cannot be inferred because subscripted value is not an array}}
+{}
+#pragma omp target map(always, tofrom: c,f[:])   // expected-error {{section length is unspecified and cannot be inferred because subscripted value is not an array}}
+{}
+return;
+  }
+};
+
+struct SB {
+  unsigned A;
+  unsigned B;
+  float Arr[100];
+  float *Ptr;
+  float *foo() {
+return &Arr[0];
+  }
+};
+
+struct SC {
+  unsigned A : 2;
+  unsigned B : 3;
+  unsigned C;
+  unsigned D;
+  float Arr[100];
+  SB S;
+  SB ArrS[100];
+  SB *PtrS;
+  SB *&RPtrS;
+  float *Ptr;
+
+  SC(SB *&_RPtrS) : RPtrS(_RPtrS) {}
+};
+
+union SD {
+  unsigned A;
+  float B;
+};
+
+void SAclient(int arg) {
+  SA s;
+  s.func(arg); // expected-note {{in instantiation of member function}}
+
+  SB *p;
+
+  SD u;
+  SC r(p),t(p);
+  #pragma omp target map(r)
+  {}
+  #pragma omp target map(r.ArrS[0].B)
+  {}
+  #pragma omp target map(r.ArrS[0].Arr[1:23])
+  {}
+  #pragma omp target map(r.ArrS[0].Error) // expected-error {{no member named 'Error' in 'SB'}}
+  {}
+  #pragma omp target map(r.ArrS[0].A, r.ArrS[1].A) // expected-error {{multiple array elements associated with the same variable are not allowed in map clauses of the same construct}} expected-note {{used here}}
+  {}
+  #pragma omp target map(r.ArrS[0].A, t.ArrS[1].A)
+  {}
+  #pragma omp target map(r.PtrS[0], r.PtrS->B) // expected-error {{same pointer derreferenced in multiple different ways in map clause expressions}} expected-note {{used here}}
+  {}
+  #pragma omp target map(r.RPtrS[0], r.RPtrS->B) // expected-error {{same pointer derreferenced in multiple different ways in map clause expressions}} expected-note {{used here}}
+  {}
+  #pragma omp target map(r.S.Arr[:12])
+  {}
+  #pragma omp target map(r.S.foo()[:12]) // expected-error {{expected expression containing only member accesses and/or array sections based on named variables}}
+  {}
+  #pragma omp target map(r.C, r.D)
+  {}
+  #pragma omp target map(r.C, r.C) // expected-error {{variable already marked as mapped in current construct}} expected-note {{used here}}
+  {}
+  #pragma omp target map(r.C) map(r.C) // expected-error {{variable already marked as mapped in current construct}} expected-note {{used here}}
+  {}
+  #pragma omp target map(r.C, r.S)  // this would be an error only caught at runtime - Sema would have to make sure there is not way for the missing data between fields to be mapped somewhere else.
+  {}
+  #pragma omp target map(r, r.S)  // expected-error {{variable already 

Re: [PATCH] D15624: Add iOS/watchOS/tvOS support for ASan (clang part)

2016-01-21 Thread Alexey Samsonov via cfe-commits
samsonov added a comment.

Thanks.



Comment at: lib/Driver/ToolChains.cpp:322
@@ -321,1 +321,3 @@
 
+StringRef Darwin::getOSLibraryNameSuffix() const {
+  if (isTargetMacOS())

Fun fact: if TargetPlatform is `TvOSSimulator`, this function will return 
`iossim` because `isTargetIOSSimulator` will return true.
I suggest to just switch on the value of `TargetPlatform` instead of using 
these helpers.


Comment at: lib/Driver/ToolChains.cpp:330
@@ +329,3 @@
+  if (isTargetIOSSimulator())
+return "iossim";
+  if (isTargetIPhoneOS())

Also, is it possible to add a test case for this?


http://reviews.llvm.org/D15624



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


[libcxx] r258418 - Implement LWG#2101 'Some transformation types can produce impossible types' Introduced a new (internal) type trait '__is_referenceable' with tests. Use that trait in add_lvalue_refe

2016-01-21 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Thu Jan 21 12:22:43 2016
New Revision: 258418

URL: http://llvm.org/viewvc/llvm-project?rev=258418&view=rev
Log:
Implement LWG#2101 'Some transformation types can produce impossible types'  
Introduced a new (internal) type trait '__is_referenceable' with tests. Use 
that trait in add_lvalue_reference, add_rvalue_reference and add_pointer.

Added:
libcxx/trunk/test/libcxx/utilities/meta/
libcxx/trunk/test/libcxx/utilities/meta/is_referenceable.pass.cpp
Modified:
libcxx/trunk/include/type_traits

libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.ptr/add_pointer.pass.cpp

libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.ptr/remove_pointer.pass.cpp

libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.ref/add_lvalue_ref.pass.cpp

libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.ref/add_rvalue_ref.pass.cpp

libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.ref/remove_ref.pass.cpp
libcxx/trunk/www/cxx1z_status.html

Modified: libcxx/trunk/include/type_traits
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/type_traits?rev=258418&r1=258417&r2=258418&view=diff
==
--- libcxx/trunk/include/type_traits (original)
+++ libcxx/trunk/include/type_traits Thu Jan 21 12:22:43 2016
@@ -957,6 +957,38 @@ template  _LIBCPP_CONSTEXPR b
 = is_compound<_Tp>::value;
 #endif
 
+
+// __is_referenceable  [defns.referenceable]
+template  struct __is_referenceable
+: public std::integral_constant::value || 
is_reference<_Tp>::value> {};
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+template 
+struct __is_referenceable<_Ret(_Args...)>   : public std::true_type {};
+
+template 
+struct __is_referenceable<_Ret(_Args..., ...)>  : public std::true_type {};
+#else
+template 
+struct __is_referenceable<_Ret()>   : public std::true_type {};
+template 
+struct __is_referenceable<_Ret(_A0)>: public std::true_type {};
+template 
+struct __is_referenceable<_Ret(_A0, _A1)>   : public std::true_type {};
+template 
+struct __is_referenceable<_Ret(_A0, _A1, _A2)>  : public std::true_type {};
+
+template 
+struct __is_referenceable<_Ret(...)>: public std::true_type {};
+template 
+struct __is_referenceable<_Ret(_A0, ...)>   : public std::true_type {};
+template 
+struct __is_referenceable<_Ret(_A0, _A1, ...)>  : public std::true_type {};
+template 
+struct __is_referenceable<_Ret(_A0, _A1, _A2, ...)> : public std::true_type {};
+#endif
+
+
 // add_const
 
 template ::value ||
@@ -1014,12 +1046,11 @@ template  using remove_refere
 
 // add_lvalue_reference
 
-template  struct _LIBCPP_TYPE_VIS_ONLY add_lvalue_reference 
 {typedef _Tp& type;};
-template  struct _LIBCPP_TYPE_VIS_ONLY add_lvalue_reference<_Tp&>   
 {typedef _Tp& type;};  // for older compiler
-template <>  struct _LIBCPP_TYPE_VIS_ONLY add_lvalue_reference   
 {typedef void type;};
-template <>  struct _LIBCPP_TYPE_VIS_ONLY add_lvalue_reference  {typedef const void type;};
-template <>  struct _LIBCPP_TYPE_VIS_ONLY 
add_lvalue_reference   {typedef volatile void type;};
-template <>  struct _LIBCPP_TYPE_VIS_ONLY add_lvalue_reference {typedef const volatile void type;};
+template ::value> struct 
__add_lvalue_reference_impl{ typedef _Tp  type; };
+template  struct 
__add_lvalue_reference_impl<_Tp, true> { typedef _Tp& type; };
+
+template  struct _LIBCPP_TYPE_VIS_ONLY add_lvalue_reference
+{typedef typename __add_lvalue_reference_impl<_Tp>::type type;};
 
 #if _LIBCPP_STD_VER > 11
 template  using add_lvalue_reference_t = typename 
add_lvalue_reference<_Tp>::type;
@@ -1027,11 +1058,11 @@ template  using add_lvalue_re
 
 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
 
-template  struct _LIBCPP_TYPE_VIS_ONLY  add_rvalue_reference
 {typedef _Tp&& type;};
-template <>  struct _LIBCPP_TYPE_VIS_ONLY add_rvalue_reference   
 {typedef void type;};
-template <>  struct _LIBCPP_TYPE_VIS_ONLY add_rvalue_reference  {typedef const void type;};
-template <>  struct _LIBCPP_TYPE_VIS_ONLY 
add_rvalue_reference   {typedef volatile void type;};
-template <>  struct _LIBCPP_TYPE_VIS_ONLY add_rvalue_reference {typedef const volatile void type;};
+template ::value> struct 
__add_rvalue_reference_impl{ typedef _Tp   type; };
+template  struct 
__add_rvalue_reference_impl<_Tp, true> { typedef _Tp&& type; };
+
+template  struct _LIBCPP_TYPE_VIS_ONLY add_rvalue_reference
+{typedef typename __add_rvalue_reference_impl<_Tp>::type type;};
 
 #if _LIBCPP_STD_VER > 11
 template  using add_rvalue_reference_t = typename 
add_rvalue_reference<_Tp>::type;
@@ -1072,8 +1103,16 @@ template  using remove_pointe
 
 // add_pointer
 
-template  struct _LIBCPP_TYPE_VIS_ONLY add_pointe

Re: [PATCH] D15363: [UBSan] Implement runtime suppressions (PR25066).

2016-01-21 Thread Alexey Samsonov via cfe-commits
On Thu, Jan 21, 2016 at 10:20 AM, Nico Weber  wrote:

> On Thu, Jan 21, 2016 at 1:19 PM, Alexey Samsonov 
> wrote:
>
>>
>> On Wed, Jan 20, 2016 at 12:42 PM, Nico Weber  wrote:
>>
>>> thakis added a comment.
>>>
>>> After some more debugging, the only thing in this test that's still
>>> faiilng on Windows is the "unsigned-integer-overflow:do_overflow"
>>> suppression -- when llvm-symbolizer gets symbols from PDBs it currently
>>> requires the DIA SDK. If that's not found at cmake time, then
>>> llvm-symbolizer silently can't symbolize executables with pdb debug info.
>>>
>>> The test should probably have some "REQUIRES: symbols" thingie. (I'll
>>> also fix llvm not finding the DIA SDK in our build setup, but the test will
>>> still fail for others who don't have that.)
>>>
>>
>> Interesting, thanks for digging into this! IIRC the story with Dwarf
>> support on Windows (both producing it by Clang and consuming it by
>> llvm-symbolizer) got slightly better recently. Maybe, we can add a compiler
>> flag to force Clang emit Dwarf data on Windows in our compiler-rt test
>> suites?
>>
>
> It isn't heavily tested and it'd require using lld instead of link. I
> think it's possible. But most clients probably use PDBs for now, so maybe
> testing that is better, not sure.
>

Oh, ok, let's not depend on lld then. So, we need to either determine if
DIA SDK is available at compiler-rt configure time, or teach
llvm-symbolizer.exe to tell us that (as we support standalone compiler-rt
build)...


>
>
>>
>>
>>>
>>>
>>> Repository:
>>>   rL LLVM
>>>
>>> http://reviews.llvm.org/D15363
>>>
>>>
>>>
>>>
>>
>>
>> --
>> Alexey Samsonov
>> vonos...@gmail.com
>>
>
>


-- 
Alexey Samsonov
vonos...@gmail.com
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D15363: [UBSan] Implement runtime suppressions (PR25066).

2016-01-21 Thread Nico Weber via cfe-commits
On Thu, Jan 21, 2016 at 1:44 PM, Alexey Samsonov  wrote:

>
> On Thu, Jan 21, 2016 at 10:20 AM, Nico Weber  wrote:
>
>> On Thu, Jan 21, 2016 at 1:19 PM, Alexey Samsonov 
>> wrote:
>>
>>>
>>> On Wed, Jan 20, 2016 at 12:42 PM, Nico Weber 
>>> wrote:
>>>
 thakis added a comment.

 After some more debugging, the only thing in this test that's still
 faiilng on Windows is the "unsigned-integer-overflow:do_overflow"
 suppression -- when llvm-symbolizer gets symbols from PDBs it currently
 requires the DIA SDK. If that's not found at cmake time, then
 llvm-symbolizer silently can't symbolize executables with pdb debug info.

 The test should probably have some "REQUIRES: symbols" thingie. (I'll
 also fix llvm not finding the DIA SDK in our build setup, but the test will
 still fail for others who don't have that.)

>>>
>>> Interesting, thanks for digging into this! IIRC the story with Dwarf
>>> support on Windows (both producing it by Clang and consuming it by
>>> llvm-symbolizer) got slightly better recently. Maybe, we can add a compiler
>>> flag to force Clang emit Dwarf data on Windows in our compiler-rt test
>>> suites?
>>>
>>
>> It isn't heavily tested and it'd require using lld instead of link. I
>> think it's possible. But most clients probably use PDBs for now, so maybe
>> testing that is better, not sure.
>>
>
> Oh, ok, let's not depend on lld then. So, we need to either determine if
> DIA SDK is available at compiler-rt configure time, or teach
> llvm-symbolizer.exe to tell us that (as we support standalone compiler-rt
> build)...
>

Maybe the lit config file could compile a small program with clang-cl and
then run it through llvm-symbolizer and see if a symbol is returned?


>
>
>>
>>
>>>
>>>


 Repository:
   rL LLVM

 http://reviews.llvm.org/D15363




>>>
>>>
>>> --
>>> Alexey Samsonov
>>> vonos...@gmail.com
>>>
>>
>>
>
>
> --
> Alexey Samsonov
> vonos...@gmail.com
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D15363: [UBSan] Implement runtime suppressions (PR25066).

2016-01-21 Thread Reid Kleckner via cfe-commits
On Thu, Jan 21, 2016 at 10:47 AM, Nico Weber  wrote:

> Oh, ok, let's not depend on lld then. So, we need to either determine if
>> DIA SDK is available at compiler-rt configure time, or teach
>> llvm-symbolizer.exe to tell us that (as we support standalone compiler-rt
>> build)...
>>
>
> Maybe the lit config file could compile a small program with clang-cl and
> then run it through llvm-symbolizer and see if a symbol is returned?
>

I'd rather duplicate this check in compiler-rt than add auto-conf style
tests to check-asan startup:
  # See if the DIA SDK is available and usable.
  set(MSVC_DIA_SDK_DIR "$ENV{VSINSTALLDIR}DIA SDK")
  if (IS_DIRECTORY ${MSVC_DIA_SDK_DIR})
set(HAVE_DIA_SDK 1)
  else()
set(HAVE_DIA_SDK 0)
  endif()

It is also possible to change LLVMSymbolizer::SymbolizePC to return false
when llvm-symbolizer returns no useful information. This will cause the
sanitizers to try calling into dbghelp, which will probably work. It
doesn't return PDB column info or work with dwarf, which is why we try
llvm-symbolizer first. I think I made this change at one point, but I was
asked to revert it or there were minor issues that didn't seem worth fixing.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D15225: [Driver] Sanitizer support based on runtime library presence

2016-01-21 Thread Alexey Samsonov via cfe-commits
samsonov added a comment.

In http://reviews.llvm.org/D15225#328218, @zaks.anna wrote:

> > I see, so essentially you want to use a different approach for determining 
> > sanitizer availability (on OS X for now): if the library is present, then 
> > we support 
>
> >  sanitizer, otherwise we don't: i.e. the binary distribution is the source 
> > of truth, not the list of sanitizers hardcoded into Clang driver source 
> > code. I'm fine with 
>
> >  that, and see why it would make sense.
>
>
> Correct.
>
> > It's just that error message looks misleading: the problem is not TSan is 
> > unsupported for target, it's just unavailable in this distribution for one 
> > reason or 
>
> >  another.
>
>
> The main advantage of the error message Kuba has right now is that it is user 
> friendly. A sanitizer IS unsupported for the given target in the given 
> distribution if the library is missing. Saying something along the lines of 
> "runtime components for '-fsanitize=thread' not available" is vague. For 
> example, does it mean that the user needs to install the runtime components 
> in some other way?


s/unsupported/unavailable? I don't know, is there a way to install runtime 
components for ASan if your distribution doesn't happen to have one (that must 
be tricky, as the version of ASan should match the version of the compiler). 
Anyway, you're in much better position to make a judgement here, leaving this 
to you.

I believe, at least part of this patch will be superseded by 
http://reviews.llvm.org/D15624? Feel free to update this one when the latter 
lands.


http://reviews.llvm.org/D15225



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


Re: [PATCH] D15363: [UBSan] Implement runtime suppressions (PR25066).

2016-01-21 Thread Alexey Samsonov via cfe-commits
On Thu, Jan 21, 2016 at 10:58 AM, Reid Kleckner  wrote:

> On Thu, Jan 21, 2016 at 10:47 AM, Nico Weber  wrote:
>
>> Oh, ok, let's not depend on lld then. So, we need to either determine if
>>> DIA SDK is available at compiler-rt configure time, or teach
>>> llvm-symbolizer.exe to tell us that (as we support standalone compiler-rt
>>> build)...
>>>
>>
>> Maybe the lit config file could compile a small program with clang-cl and
>> then run it through llvm-symbolizer and see if a symbol is returned?
>>
>
> I'd rather duplicate this check in compiler-rt than add auto-conf style
> tests to check-asan startup:
>   # See if the DIA SDK is available and usable.
>   set(MSVC_DIA_SDK_DIR "$ENV{VSINSTALLDIR}DIA SDK")
>   if (IS_DIRECTORY ${MSVC_DIA_SDK_DIR})
> set(HAVE_DIA_SDK 1)
>   else()
> set(HAVE_DIA_SDK 0)
>   endif()
>

Yes. It's not 100% correct, but probably fine to assume that if we failed
to find DIA SDK at configure time, so did llvm-symbolizer when it was built.


>
> It is also possible to change LLVMSymbolizer::SymbolizePC to return false
> when llvm-symbolizer returns no useful information.
>

Do we want LLVMSymbolizer::SymbolizePC to succeed if we fetched file/line
info, but not function name?
Also, there may well be another issue that will be hard to debug. It makes
sense to store information about what features of llvm-symbolizer we expect
to work explicitly.


> This will cause the sanitizers to try calling into dbghelp, which will
> probably work. It doesn't return PDB column info or work with dwarf, which
> is why we try llvm-symbolizer first. I think I made this change at one
> point, but I was asked to revert it or there were minor issues that didn't
> seem worth fixing.
>


-- 
Alexey Samsonov
vonos...@gmail.com
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D16376: clang-tidy check: User-defined copy without assignment

2016-01-21 Thread Jonathan B Coe via cfe-commits
jbcoe updated this revision to Diff 45573.
jbcoe added a comment.

Added symmetric check for user-defined assignment but no copy constructor.

Check now adds '=default' to the missing special function if the user-specified 
one was specified as '=default'.

Check needs renaming, I'll update it along with the docs once the 
behaviour/impl are good.


http://reviews.llvm.org/D16376

Files:
  clang-tidy/misc/CMakeLists.txt
  clang-tidy/misc/MiscTidyModule.cpp
  clang-tidy/misc/UserDefinedCopyWithoutAssignmentCheck.cpp
  clang-tidy/misc/UserDefinedCopyWithoutAssignmentCheck.h
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/misc-user-defined-copy-without-assignment.rst
  test/clang-tidy/misc-user-defined-copy-without-assignment.cpp

Index: test/clang-tidy/misc-user-defined-copy-without-assignment.cpp
===
--- /dev/null
+++ test/clang-tidy/misc-user-defined-copy-without-assignment.cpp
@@ -0,0 +1,82 @@
+// RUN: %check_clang_tidy %s misc-user-defined-copy-without-assignment %t
+
+//
+// User defined copy-constructors
+//
+class A {
+  A(const A &);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: class 'A' defines a copy-constructor but not an assignment operator [misc-user-defined-copy-without-assignment]
+};
+
+// CHECK-FIXES: class A {
+// CHECK-FIXES-NEXT: A(const A &);
+// CHECK-FIXES-NEXT: A &operator=(const A &) = delete;
+// CHECK-FIXES-NEXT: //
+// CHECK-FIXES-NEXT: };
+
+class B {
+  B(const B &);
+  B &operator=(const B &);
+};
+
+class C {
+  C(const C &) = default;
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: class 'C' defines a copy-constructor but not an assignment operator [misc-user-defined-copy-without-assignment]
+};
+
+// CHECK-FIXES: class C {
+// CHECK-FIXES-NEXT: C(const C &) = default;
+// CHECK-FIXES-NEXT: C &operator=(const C &) = default;
+// CHECK-FIXES-NEXT: //
+// CHECK-FIXES-NEXT: };
+
+class D {
+  D(const D &);
+  D &operator=(const D &) = default;
+};
+
+class E {
+  E(const E &);
+  E &operator=(const E &) = delete;
+};
+
+//
+// User defined assignment
+//
+class A2 {
+  A2 &operator=(const A2 &);
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: class 'A2' defines an assignment operator but not a copy-constructor [misc-user-defined-copy-without-assignment]
+};
+
+// CHECK-FIXES: class A2 {
+// CHECK-FIXES-NEXT: A2(const A2 &) = delete;
+// CHECK-FIXES-NEXT: A2 &operator=(const A2 &);
+// CHECK-FIXES-NEXT: //
+// CHECK-FIXES-NEXT: };
+
+class B2 {
+  B2(const B2 &);
+  B2 &operator=(const B2 &);
+};
+
+class C2 {
+  C2 &operator=(const C2 &) = default;
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: class 'C2' defines an assignment operator but not a copy-constructor [misc-user-defined-copy-without-assignment]
+};
+
+// CHECK-FIXES: class C2 {
+// CHECK-FIXES-NEXT: C2(const C2 &) = default;
+// CHECK-FIXES-NEXT: C2 &operator=(const C2 &) = default;
+// CHECK-FIXES-NEXT: //
+// CHECK-FIXES-NEXT: };
+
+class D2 {
+  D2(const D2 &) = default;
+  D2 &operator=(const D2 &);
+};
+
+class E2 {
+  E2(const E2 &) = delete;
+  E2 &operator=(const E2 &);
+};
+
Index: docs/clang-tidy/checks/misc-user-defined-copy-without-assignment.rst
===
--- /dev/null
+++ docs/clang-tidy/checks/misc-user-defined-copy-without-assignment.rst
@@ -0,0 +1,36 @@
+.. title:: clang-tidy - misc-user-defined-copy-without-assignment
+
+misc-user-defined-copy-without-assignment
+=
+
+Compilers will generate an assignment operator even if the user defines a copy
+constructor.  This behaviour is deprecated by the standard (C++ 14 draft
+standard 12.8.18)
+
+"If the class definition does not explicitly declare a copy assignment
+operator, one is declared implicitly. If the class definition declares a move
+constructor or move assignment operator, the implicitly declared copy
+assignment operator is defined as deleted; otherwise, it is defined as
+defaulted (8.4). The latter case is deprecated if the class has a user-declared
+copy constructor or a user-declared destructor."
+
+This check finds classes with a user-defined (including deleted)
+copy-constructor but no assignment operator.
+
+  .. code:: c++
+class A {
+  A(const A&);
+};
+
+Will be matched and fixed to delete the assignment operator:
+
+  .. code:: c++
+class A {
+  A(const A&);
+  A& operator = (const A&) = delete;
+};
+
+The fix is defensive. Incorrect compiler-generated assignement can cause
+unexpected behaviour. An explicitly deleted assignment operator will cause a
+compiler error if it is used.
+
Index: docs/clang-tidy/checks/list.rst
===
--- docs/clang-tidy/checks/list.rst
+++ docs/clang-tidy/checks/list.rst
@@ -65,6 +65,7 @@
misc-unused-alias-decls
misc-unused-parameters
misc-unused-raii
+   misc-user-defined-copy-without-assignment
misc-virtual-near-miss
modernize-l

Re: [PATCH] D16395: [Coverage] Reduce complexity of adding function mapping records

2016-01-21 Thread David Li via cfe-commits
davidxl accepted this revision.
davidxl added a comment.
This revision is now accepted and ready to land.

LGTM


http://reviews.llvm.org/D16395



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


r258424 - [Coverage] Reduce complexity of adding function mapping records

2016-01-21 Thread Vedant Kumar via cfe-commits
Author: vedantk
Date: Thu Jan 21 13:25:35 2016
New Revision: 258424

URL: http://llvm.org/viewvc/llvm-project?rev=258424&view=rev
Log:
[Coverage] Reduce complexity of adding function mapping records

Replace a string append operation in addFunctionMappingRecord with a
vector append. The existing behavior is quadratic in the worst case:
this patch makes it linear.

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

Modified:
cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp
cfe/trunk/lib/CodeGen/CoverageMappingGen.h

Modified: cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp?rev=258424&r1=258423&r2=258424&view=diff
==
--- cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp (original)
+++ cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp Thu Jan 21 13:25:35 2016
@@ -15,6 +15,7 @@
 #include "CodeGenFunction.h"
 #include "clang/AST/StmtVisitor.h"
 #include "clang/Lex/Lexer.h"
+#include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/Optional.h"
 #include "llvm/ProfileData/CoverageMapping.h"
 #include "llvm/ProfileData/CoverageMappingReader.h"
@@ -932,7 +933,7 @@ void CoverageMappingModuleGen::addFuncti
   if (!IsUsed)
 FunctionNames.push_back(
 llvm::ConstantExpr::getBitCast(NamePtr, 
llvm::Type::getInt8PtrTy(Ctx)));
-  CoverageMappings += CoverageMapping;
+  CoverageMappings.push_back(CoverageMapping);
 
   if (CGM.getCodeGenOpts().DumpCoverageMapping) {
 // Dump the coverage mapping data for this function by decoding the
@@ -978,8 +979,10 @@ void CoverageMappingModuleGen::emit() {
   std::string FilenamesAndCoverageMappings;
   llvm::raw_string_ostream OS(FilenamesAndCoverageMappings);
   CoverageFilenamesSectionWriter(FilenameRefs).write(OS);
-  OS << CoverageMappings;
-  size_t CoverageMappingSize = CoverageMappings.size();
+  std::string RawCoverageMappings =
+  llvm::join(CoverageMappings.begin(), CoverageMappings.end(), "");
+  OS << RawCoverageMappings;
+  size_t CoverageMappingSize = RawCoverageMappings.size();
   size_t FilenamesSize = OS.str().size() - CoverageMappingSize;
   // Append extra zeroes if necessary to ensure that the size of the filenames
   // and coverage mappings is a multiple of 8.

Modified: cfe/trunk/lib/CodeGen/CoverageMappingGen.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CoverageMappingGen.h?rev=258424&r1=258423&r2=258424&view=diff
==
--- cfe/trunk/lib/CodeGen/CoverageMappingGen.h (original)
+++ cfe/trunk/lib/CodeGen/CoverageMappingGen.h Thu Jan 21 13:25:35 2016
@@ -56,7 +56,7 @@ class CoverageMappingModuleGen {
   std::vector FunctionRecords;
   std::vector FunctionNames;
   llvm::StructType *FunctionRecordTy;
-  std::string CoverageMappings;
+  std::vector CoverageMappings;
 
 public:
   CoverageMappingModuleGen(CodeGenModule &CGM, CoverageSourceInfo &SourceInfo)


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


Re: [PATCH] D16395: [Coverage] Reduce complexity of adding function mapping records

2016-01-21 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL258424: [Coverage] Reduce complexity of adding function 
mapping records (authored by vedantk).

Changed prior to commit:
  http://reviews.llvm.org/D16395?vs=45491&id=45574#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D16395

Files:
  cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp
  cfe/trunk/lib/CodeGen/CoverageMappingGen.h

Index: cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp
===
--- cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp
+++ cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp
@@ -15,6 +15,7 @@
 #include "CodeGenFunction.h"
 #include "clang/AST/StmtVisitor.h"
 #include "clang/Lex/Lexer.h"
+#include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/Optional.h"
 #include "llvm/ProfileData/CoverageMapping.h"
 #include "llvm/ProfileData/CoverageMappingReader.h"
@@ -932,7 +933,7 @@
   if (!IsUsed)
 FunctionNames.push_back(
 llvm::ConstantExpr::getBitCast(NamePtr, 
llvm::Type::getInt8PtrTy(Ctx)));
-  CoverageMappings += CoverageMapping;
+  CoverageMappings.push_back(CoverageMapping);
 
   if (CGM.getCodeGenOpts().DumpCoverageMapping) {
 // Dump the coverage mapping data for this function by decoding the
@@ -978,8 +979,10 @@
   std::string FilenamesAndCoverageMappings;
   llvm::raw_string_ostream OS(FilenamesAndCoverageMappings);
   CoverageFilenamesSectionWriter(FilenameRefs).write(OS);
-  OS << CoverageMappings;
-  size_t CoverageMappingSize = CoverageMappings.size();
+  std::string RawCoverageMappings =
+  llvm::join(CoverageMappings.begin(), CoverageMappings.end(), "");
+  OS << RawCoverageMappings;
+  size_t CoverageMappingSize = RawCoverageMappings.size();
   size_t FilenamesSize = OS.str().size() - CoverageMappingSize;
   // Append extra zeroes if necessary to ensure that the size of the filenames
   // and coverage mappings is a multiple of 8.
Index: cfe/trunk/lib/CodeGen/CoverageMappingGen.h
===
--- cfe/trunk/lib/CodeGen/CoverageMappingGen.h
+++ cfe/trunk/lib/CodeGen/CoverageMappingGen.h
@@ -56,7 +56,7 @@
   std::vector FunctionRecords;
   std::vector FunctionNames;
   llvm::StructType *FunctionRecordTy;
-  std::string CoverageMappings;
+  std::vector CoverageMappings;
 
 public:
   CoverageMappingModuleGen(CodeGenModule &CGM, CoverageSourceInfo &SourceInfo)


Index: cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp
===
--- cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp
+++ cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp
@@ -15,6 +15,7 @@
 #include "CodeGenFunction.h"
 #include "clang/AST/StmtVisitor.h"
 #include "clang/Lex/Lexer.h"
+#include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/Optional.h"
 #include "llvm/ProfileData/CoverageMapping.h"
 #include "llvm/ProfileData/CoverageMappingReader.h"
@@ -932,7 +933,7 @@
   if (!IsUsed)
 FunctionNames.push_back(
 llvm::ConstantExpr::getBitCast(NamePtr, llvm::Type::getInt8PtrTy(Ctx)));
-  CoverageMappings += CoverageMapping;
+  CoverageMappings.push_back(CoverageMapping);
 
   if (CGM.getCodeGenOpts().DumpCoverageMapping) {
 // Dump the coverage mapping data for this function by decoding the
@@ -978,8 +979,10 @@
   std::string FilenamesAndCoverageMappings;
   llvm::raw_string_ostream OS(FilenamesAndCoverageMappings);
   CoverageFilenamesSectionWriter(FilenameRefs).write(OS);
-  OS << CoverageMappings;
-  size_t CoverageMappingSize = CoverageMappings.size();
+  std::string RawCoverageMappings =
+  llvm::join(CoverageMappings.begin(), CoverageMappings.end(), "");
+  OS << RawCoverageMappings;
+  size_t CoverageMappingSize = RawCoverageMappings.size();
   size_t FilenamesSize = OS.str().size() - CoverageMappingSize;
   // Append extra zeroes if necessary to ensure that the size of the filenames
   // and coverage mappings is a multiple of 8.
Index: cfe/trunk/lib/CodeGen/CoverageMappingGen.h
===
--- cfe/trunk/lib/CodeGen/CoverageMappingGen.h
+++ cfe/trunk/lib/CodeGen/CoverageMappingGen.h
@@ -56,7 +56,7 @@
   std::vector FunctionRecords;
   std::vector FunctionNames;
   llvm::StructType *FunctionRecordTy;
-  std::string CoverageMappings;
+  std::vector CoverageMappings;
 
 public:
   CoverageMappingModuleGen(CodeGenModule &CGM, CoverageSourceInfo &SourceInfo)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [clang-tools-extra] r258356 - Make modernize-use-default tolerant of delayed template parsing; this code was previously causing failed assertions because dyn_cast was being passed a null pointer d

2016-01-21 Thread Aaron Ballman via cfe-commits
On Thu, Jan 21, 2016 at 1:01 PM, Hans Wennborg  wrote:
> Thanks.
>
> Aaron, do you want to go ahead and merge this with
> utils/release/merge.sh? Or let me know if you'd prefer me to do the
> merge.

I'd prefer if you'd handle the merge (I'm on Windows), if you don't mind.

Thanks!

~Aaron

>
> On Thu, Jan 21, 2016 at 10:00 AM, Alexander Kornienko  
> wrote:
>> I'm fine with including this to 3.8. BTW, I'm working on release notes.
>>
>> On Thu, Jan 21, 2016 at 6:01 PM, Hans Wennborg  wrote:
>>>
>>> I'm fine with it. Alex, what do you think?
>>>
>>> On Wed, Jan 20, 2016 at 3:07 PM, Aaron Ballman 
>>> wrote:
>>> > Uncertain whether this meets the bar for inclusion in 3.8.
>>> > clang-modernize was moved into clang-tidy and from what I can tell, it
>>> > did not suffer from this crash. I wouldn't normally recommend this,
>>> > but just about any use of clang-tidy (that does not filter out this
>>> > check) over code that includes the MSVC STL headers will trigger that
>>> > assert without this fix.
>>> >
>>> > ~Aaron
>>> >
>>> > On Wed, Jan 20, 2016 at 5:14 PM, Aaron Ballman via cfe-commits
>>> >  wrote:
>>> >> Author: aaronballman
>>> >> Date: Wed Jan 20 16:14:10 2016
>>> >> New Revision: 258356
>>> >>
>>> >> URL: http://llvm.org/viewvc/llvm-project?rev=258356&view=rev
>>> >> Log:
>>> >> Make modernize-use-default tolerant of delayed template parsing; this
>>> >> code was previously causing failed assertions because dyn_cast was being
>>> >> passed a null pointer due to the delay-parsed body.
>>> >>
>>> >> Added:
>>> >>
>>> >> clang-tools-extra/trunk/test/clang-tidy/modernize-use-default-delayed.cpp
>>> >> Modified:
>>> >> clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultCheck.cpp
>>> >>
>>> >> Modified:
>>> >> clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultCheck.cpp
>>> >> URL:
>>> >> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultCheck.cpp?rev=258356&r1=258355&r2=258356&view=diff
>>> >>
>>> >> ==
>>> >> --- clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultCheck.cpp
>>> >> (original)
>>> >> +++ clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultCheck.cpp
>>> >> Wed Jan 20 16:14:10 2016
>>> >> @@ -272,6 +272,7 @@ void UseDefaultCheck::check(const MatchF
>>> >>// that are not user-provided (automatically generated).
>>> >>if (SpecialFunctionDecl->isDeleted() ||
>>> >>SpecialFunctionDecl->isExplicitlyDefaulted() ||
>>> >> +  SpecialFunctionDecl->isLateTemplateParsed() ||
>>> >>!SpecialFunctionDecl->isUserProvided() ||
>>> >> !SpecialFunctionDecl->hasBody())
>>> >>  return;
>>> >>
>>> >>
>>> >> Added:
>>> >> clang-tools-extra/trunk/test/clang-tidy/modernize-use-default-delayed.cpp
>>> >> URL:
>>> >> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/modernize-use-default-delayed.cpp?rev=258356&view=auto
>>> >>
>>> >> ==
>>> >> ---
>>> >> clang-tools-extra/trunk/test/clang-tidy/modernize-use-default-delayed.cpp
>>> >> (added)
>>> >> +++
>>> >> clang-tools-extra/trunk/test/clang-tidy/modernize-use-default-delayed.cpp
>>> >> Wed Jan 20 16:14:10 2016
>>> >> @@ -0,0 +1,8 @@
>>> >> +// RUN: clang-tidy %s -checks=-*,modernize-use-default -- -std=c++11
>>> >> -fdelayed-template-parsing -fexceptions | count 0
>>> >> +// Note: this test expects no diagnostics, but FileCheck cannot handle
>>> >> that,
>>> >> +// hence the use of | count 0.
>>> >> +
>>> >> +template 
>>> >> +struct S {
>>> >> +  S& operator=(const S&) { return *this; }
>>> >> +};
>>> >>
>>> >>
>>> >> ___
>>> >> 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] D15225: [Driver] Sanitizer support based on runtime library presence

2016-01-21 Thread Anna Zaks via cfe-commits
zaks.anna added a comment.

>   I don't know, is there a way to install runtime components for ASan if your 
> distribution doesn't happen to have one (that must be tricky, as the version 
> of ASan should match the version of the compiler).


Correct, there is no recommended way of installing the libraries on top of the 
existing toolchain.


http://reviews.llvm.org/D15225



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


r258425 - [OpenMP] Check for at least one map clause on target data directive.

2016-01-21 Thread Arpith Chacko Jacob via cfe-commits
Author: arpith
Date: Thu Jan 21 13:57:55 2016
New Revision: 258425

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

[OpenMP] Check for at least one map clause on target data directive.

Summary:
Adds the following restriction in the OpenMP specifications.

OpenMP [2.10.1, Restrictions, p. 97]
At least one map clause must appear on the directive.

Reviewers: ABataev

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


Modified:
cfe/trunk/lib/Sema/SemaOpenMP.cpp
cfe/trunk/test/OpenMP/target_data_ast_print.cpp
cfe/trunk/test/OpenMP/target_data_device_messages.cpp
cfe/trunk/test/OpenMP/target_data_if_messages.cpp
cfe/trunk/test/OpenMP/target_data_messages.c

Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=258425&r1=258424&r2=258425&view=diff
==
--- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Thu Jan 21 13:57:55 2016
@@ -5618,6 +5618,14 @@ StmtResult Sema::ActOnOpenMPTargetDataDi
 
   assert(isa(AStmt) && "Captured statement expected");
 
+  // OpenMP [2.10.1, Restrictions, p. 97]
+  // At least one map clause must appear on the directive.
+  if (!HasMapClause(Clauses)) {
+Diag(StartLoc, diag::err_omp_no_map_for_directive) <<
+getOpenMPDirectiveName(OMPD_target_data);
+return StmtError();
+  }
+
   getCurFunction()->setHasBranchProtectedScope();
 
   return OMPTargetDataDirective::Create(Context, StartLoc, EndLoc, Clauses,

Modified: cfe/trunk/test/OpenMP/target_data_ast_print.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_data_ast_print.cpp?rev=258425&r1=258424&r2=258425&view=diff
==
--- cfe/trunk/test/OpenMP/target_data_ast_print.cpp (original)
+++ cfe/trunk/test/OpenMP/target_data_ast_print.cpp Thu Jan 21 13:57:55 2016
@@ -12,13 +12,13 @@ template 
 T tmain(T argc, T *argv) {
   T i, j, b, c, d, e, x[20];
 
-#pragma omp target data
+#pragma omp target data map(to: c)
   i = argc;
 
-#pragma omp target data if (target data: j > 0)
+#pragma omp target data map(to: c) if (target data: j > 0)
   foo();
 
-#pragma omp target data if (b)
+#pragma omp target data map(to: c) if (b)
   foo();
 
 #pragma omp target data map(c)
@@ -48,11 +48,11 @@ T tmain(T argc, T *argv) {
 
 // CHECK: template  int tmain(int argc, int 
*argv) {
 // CHECK-NEXT: int i, j, b, c, d, e, x[20];
-// CHECK-NEXT: #pragma omp target data
+// CHECK-NEXT: #pragma omp target data map(to: c)
 // CHECK-NEXT: i = argc;
-// CHECK-NEXT: #pragma omp target data if(target data: j > 0)
+// CHECK-NEXT: #pragma omp target data map(to: c) if(target data: j > 0)
 // CHECK-NEXT: foo();
-// CHECK-NEXT: #pragma omp target data if(b)
+// CHECK-NEXT: #pragma omp target data map(to: c) if(b)
 // CHECK-NEXT: foo();
 // CHECK-NEXT: #pragma omp target data map(tofrom: c)
 // CHECK-NEXT: foo();
@@ -70,11 +70,11 @@ T tmain(T argc, T *argv) {
 // CHECK-NEXT: foo();
 // CHECK: template  char tmain(char argc, char 
*argv) {
 // CHECK-NEXT: char i, j, b, c, d, e, x[20];
-// CHECK-NEXT: #pragma omp target data
+// CHECK-NEXT: #pragma omp target data map(to: c)
 // CHECK-NEXT: i = argc;
-// CHECK-NEXT: #pragma omp target data if(target data: j > 0)
+// CHECK-NEXT: #pragma omp target data map(to: c) if(target data: j > 0)
 // CHECK-NEXT: foo();
-// CHECK-NEXT: #pragma omp target data if(b)
+// CHECK-NEXT: #pragma omp target data map(to: c) if(b)
 // CHECK-NEXT: foo();
 // CHECK-NEXT: #pragma omp target data map(tofrom: c)
 // CHECK-NEXT: foo();
@@ -92,11 +92,11 @@ T tmain(T argc, T *argv) {
 // CHECK-NEXT: foo();
 // CHECK: template  T tmain(T argc, T *argv) {
 // CHECK-NEXT: T i, j, b, c, d, e, x[20];
-// CHECK-NEXT: #pragma omp target data
+// CHECK-NEXT: #pragma omp target data map(to: c)
 // CHECK-NEXT: i = argc;
-// CHECK-NEXT: #pragma omp target data if(target data: j > 0)
+// CHECK-NEXT: #pragma omp target data map(to: c) if(target data: j > 0)
 // CHECK-NEXT: foo();
-// CHECK-NEXT: #pragma omp target data if(b)
+// CHECK-NEXT: #pragma omp target data map(to: c) if(b)
 // CHECK-NEXT: foo();
 // CHECK-NEXT: #pragma omp target data map(tofrom: c)
 // CHECK-NEXT: foo();
@@ -118,17 +118,17 @@ int main (int argc, char **argv) {
   static int a;
 // CHECK: static int a;
 
-#pragma omp target data
-// CHECK:  #pragma omp target data
+#pragma omp target data map(to: c)
+// CHECK:  #pragma omp target data map(to: c)
   a=2;
 // CHECK-NEXT: a = 2;
-#pragma omp target data if (target data: b)
-// CHECK: #pragma omp target data if(target data: b)
+#pragma omp target data map(to: c) if (target data: b)
+// CHECK: #pragma omp target data map(to: c) if(target data: b)
   foo();
 // CHECK-NEXT: foo();
 
-#pragma omp target data if (b > g)
-// CHECK: #pragma omp target data if(b > g)
+#pragma omp target data map(to: c) if (b > g)

Re: [PATCH] D16341: [OpenMP] Check for at least one map clause on target data directive.

2016-01-21 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL258425 (authored by arpith).

Changed prior to commit:
  http://reviews.llvm.org/D16341?vs=45332&id=45579#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D16341

Files:
  cfe/trunk/lib/Sema/SemaOpenMP.cpp
  cfe/trunk/test/OpenMP/target_data_ast_print.cpp
  cfe/trunk/test/OpenMP/target_data_device_messages.cpp
  cfe/trunk/test/OpenMP/target_data_if_messages.cpp
  cfe/trunk/test/OpenMP/target_data_messages.c

Index: cfe/trunk/test/OpenMP/target_data_ast_print.cpp
===
--- cfe/trunk/test/OpenMP/target_data_ast_print.cpp
+++ cfe/trunk/test/OpenMP/target_data_ast_print.cpp
@@ -12,13 +12,13 @@
 T tmain(T argc, T *argv) {
   T i, j, b, c, d, e, x[20];
 
-#pragma omp target data
+#pragma omp target data map(to: c)
   i = argc;
 
-#pragma omp target data if (target data: j > 0)
+#pragma omp target data map(to: c) if (target data: j > 0)
   foo();
 
-#pragma omp target data if (b)
+#pragma omp target data map(to: c) if (b)
   foo();
 
 #pragma omp target data map(c)
@@ -48,11 +48,11 @@
 
 // CHECK: template  int tmain(int argc, int *argv) {
 // CHECK-NEXT: int i, j, b, c, d, e, x[20];
-// CHECK-NEXT: #pragma omp target data
+// CHECK-NEXT: #pragma omp target data map(to: c)
 // CHECK-NEXT: i = argc;
-// CHECK-NEXT: #pragma omp target data if(target data: j > 0)
+// CHECK-NEXT: #pragma omp target data map(to: c) if(target data: j > 0)
 // CHECK-NEXT: foo();
-// CHECK-NEXT: #pragma omp target data if(b)
+// CHECK-NEXT: #pragma omp target data map(to: c) if(b)
 // CHECK-NEXT: foo();
 // CHECK-NEXT: #pragma omp target data map(tofrom: c)
 // CHECK-NEXT: foo();
@@ -70,11 +70,11 @@
 // CHECK-NEXT: foo();
 // CHECK: template  char tmain(char argc, char *argv) {
 // CHECK-NEXT: char i, j, b, c, d, e, x[20];
-// CHECK-NEXT: #pragma omp target data
+// CHECK-NEXT: #pragma omp target data map(to: c)
 // CHECK-NEXT: i = argc;
-// CHECK-NEXT: #pragma omp target data if(target data: j > 0)
+// CHECK-NEXT: #pragma omp target data map(to: c) if(target data: j > 0)
 // CHECK-NEXT: foo();
-// CHECK-NEXT: #pragma omp target data if(b)
+// CHECK-NEXT: #pragma omp target data map(to: c) if(b)
 // CHECK-NEXT: foo();
 // CHECK-NEXT: #pragma omp target data map(tofrom: c)
 // CHECK-NEXT: foo();
@@ -92,11 +92,11 @@
 // CHECK-NEXT: foo();
 // CHECK: template  T tmain(T argc, T *argv) {
 // CHECK-NEXT: T i, j, b, c, d, e, x[20];
-// CHECK-NEXT: #pragma omp target data
+// CHECK-NEXT: #pragma omp target data map(to: c)
 // CHECK-NEXT: i = argc;
-// CHECK-NEXT: #pragma omp target data if(target data: j > 0)
+// CHECK-NEXT: #pragma omp target data map(to: c) if(target data: j > 0)
 // CHECK-NEXT: foo();
-// CHECK-NEXT: #pragma omp target data if(b)
+// CHECK-NEXT: #pragma omp target data map(to: c) if(b)
 // CHECK-NEXT: foo();
 // CHECK-NEXT: #pragma omp target data map(tofrom: c)
 // CHECK-NEXT: foo();
@@ -118,17 +118,17 @@
   static int a;
 // CHECK: static int a;
 
-#pragma omp target data
-// CHECK:  #pragma omp target data
+#pragma omp target data map(to: c)
+// CHECK:  #pragma omp target data map(to: c)
   a=2;
 // CHECK-NEXT: a = 2;
-#pragma omp target data if (target data: b)
-// CHECK: #pragma omp target data if(target data: b)
+#pragma omp target data map(to: c) if (target data: b)
+// CHECK: #pragma omp target data map(to: c) if(target data: b)
   foo();
 // CHECK-NEXT: foo();
 
-#pragma omp target data if (b > g)
-// CHECK: #pragma omp target data if(b > g)
+#pragma omp target data map(to: c) if (b > g)
+// CHECK: #pragma omp target data map(to: c) if(b > g)
   foo();
 // CHECK-NEXT: foo();
 
Index: cfe/trunk/test/OpenMP/target_data_if_messages.cpp
===
--- cfe/trunk/test/OpenMP/target_data_if_messages.cpp
+++ cfe/trunk/test/OpenMP/target_data_if_messages.cpp
@@ -10,22 +10,23 @@
 struct S1; // expected-note {{declared here}}
 
 int main(int argc, char **argv) {
-  #pragma omp target data if // expected-error {{expected '(' after 'if'}}
-  #pragma omp target data if ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
-  #pragma omp target data if () // expected-error {{expected expression}}
-  #pragma omp target data if (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
-  #pragma omp target data if (argc)) // expected-warning {{extra tokens at the end of '#pragma omp target data' are ignored}}
-  #pragma omp target data if (argc > 0 ? argv[1] : argv[2])
-  #pragma omp target data if (argc + argc)
-  #pragma omp target data if (foobool(argc)), if (true) // expected-error {{directive '#pragma omp target data' cannot contain more than one 'if' clause}}
-  #pragma omp target data if (S1) // expected-error {{'S1' does not refer to a value}}
-  #pragma omp target data if (argv[1]=2) // expected-error {{expected ')'}} expected-no

Re: [PATCH] D16341: [OpenMP] Check for at least one map clause on target data directive.

2016-01-21 Thread Arpith Jacob via cfe-commits
arpith-jacob added a comment.

Committed revision 258425.


Repository:
  rL LLVM

http://reviews.llvm.org/D16341



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


r258426 - [driver] Enable some static analyzer "unix" checkers on Windows.

2016-01-21 Thread Devin Coughlin via cfe-commits
Author: dcoughlin
Date: Thu Jan 21 14:09:49 2016
New Revision: 258426

URL: http://llvm.org/viewvc/llvm-project?rev=258426&view=rev
Log:
[driver] Enable some static analyzer "unix" checkers on Windows.

Many of the "unix" checkers are not actually unix-specific and would be valuable
to run on Windows. This commit explicitly enables those checkers on
Windows.

A patch by Alexander Riccio!

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

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

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=258426&r1=258425&r2=258426&view=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Thu Jan 21 14:09:49 2016
@@ -3642,8 +3642,17 @@ void Clang::ConstructJob(Compilation &C,
 if (!Args.hasArg(options::OPT__analyzer_no_default_checks)) {
   CmdArgs.push_back("-analyzer-checker=core");
 
-  if (!IsWindowsMSVC)
-CmdArgs.push_back("-analyzer-checker=unix");
+if (!IsWindowsMSVC) {
+  CmdArgs.push_back("-analyzer-checker=unix");
+} else {
+  // Enable "unix" checkers that also work on Windows.
+  CmdArgs.push_back("-analyzer-checker=unix.API");
+  CmdArgs.push_back("-analyzer-checker=unix.Malloc");
+  CmdArgs.push_back("-analyzer-checker=unix.MallocSizeof");
+  CmdArgs.push_back("-analyzer-checker=unix.MismatchedDeallocator");
+  CmdArgs.push_back("-analyzer-checker=unix.cstring.BadSizeArg");
+  CmdArgs.push_back("-analyzer-checker=unix.cstring.NullArg");
+}
 
   // Disable some unix checkers for PS4.
   if (IsPS4CPU) {


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


Re: [PATCH] D16248: [Clang-tidy] rename misc-inefficient-algorithm to performance-inefficient-algorithm

2016-01-21 Thread Gábor Horváth via cfe-commits
xazax.hun added inline comments.


Comment at: docs/clang-tidy/checks/performance-inefficient-algorithm.rst:3
@@ -2,3 +2,3 @@
 
-misc-inefficient-algorithm
+performance-inefficient-algorithm
 ==

Eugene.Zelenko wrote:
> alexfh wrote:
> > After reading this check name a few times, I found it too generic (one may 
> > think that this is a generic algorithm-level code profiler ;). I think, we 
> > need to rename it to `performance-inefficient-lookup-algorithm` or 
> > `performance-inefficient-search-algorithm`, since we're changing the name 
> > anyway.
> I think will be better to keep generic name, since other algorithms could be 
> added later.
That is an interesting question whether it is better to have more general check 
names and make checkers do more stuff or have more specific names and split 
functionality between more checks. It would be awesome to have a policy on 
that. A good benchmark whether two checks should be implemented by the same 
checker is to think about whether there are cases when the user might enable 
only one of the checks, not both. 


http://reviews.llvm.org/D16248



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


Re: [libcxxabi] r258249 - Recommit r256322: Fix PR25898 - Check for incomplete pointers types in can_catch(...)

2016-01-21 Thread Eric Fiselier via cfe-commits
I'll merge all my commits tonight. Thanks Hans.

/Eric

On Wed, Jan 20, 2016 at 10:38 AM, Hans Wennborg  wrote:

> No problem. Please go ahead and merge with utils/release/merge.sh, or
> let me know if you'd prefer me to do it.
>
> On Tue, Jan 19, 2016 at 7:09 PM, Eric Fiselier  wrote:
> > Hi Hans,
> >
> > Sorry to make this more complicated, but can you also include the
> follow-up
> > libc++abi commit r258277.
> >
> > /Eric
> >
> > On Tue, Jan 19, 2016 at 7:08 PM, Marshall Clow 
> > wrote:
> >>
> >>
> >>
> >> On Tue, Jan 19, 2016 at 3:48 PM, Eric Fiselier  wrote:
> >>>
> >>> Hi Hans,
> >>>
> >>> I fixed the problem that caused Nico to revert this. I would like to
> >>> re-land this in 3.8.
> >>> This depends on libc++ commit r258217 also landing in 3.8.
> >>>
> >>> @Marshall can you OK this?
> >>>
> >>
> >> This is fine with me.  (both r258217 and r256322)
> >>
> >> -- Marshall
> >>
> >>
> >
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D15829: [PGO] Clang Option that enables IR level PGO instrumentation

2016-01-21 Thread Rong Xu via cfe-commits
xur added a comment.

Ping.

Passmanagerbuilder change has been committed. Could you take a look at this 
command line option patch?

Thanks,

-Rong


http://reviews.llvm.org/D15829



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


Re: [PATCH] D16179: [clang-tidy] Handle decayed types and other improvements in VirtualNearMiss check.

2016-01-21 Thread Alexander Kornienko via cfe-commits
alexfh accepted this revision.
alexfh added a comment.
This revision is now accepted and ready to land.

LG. Thanks!


http://reviews.llvm.org/D16179



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


Re: [PATCH] D16310: new clang-tidy checker misc-long-cast

2016-01-21 Thread Richard via cfe-commits
LegalizeAdulthood added a comment.

In http://reviews.llvm.org/D16310#332200, @danielmarjamaki wrote:

> Why is there a cast in the first place? It is unlikely that the programmer 
> added a useless cast for no reason.


If this has universally been your experience on a code base, then I say you 
should count your blessings that you have worked only with such good 
programmers!

Sadly, I have encountered many code bases where such silly things were written. 
 Sometimes people just write the cast because that is the return type of the 
function.

At any rate, the check simply cannot divine programmer intent from the source 
code alone, which is why for clang-tidy (not static analyzer) purposes, my 
expectation is that clang-tidy would say "this cast is redundant, so I suggest 
you remove it".  Hence the fixit removes the cast.

Only a human being can look at the change suggested by clang-tidy and say 
"hmm looks like the correct thing here is that there was some loss of 
precision in the intermediate result, so I should fix that instead".

If a developer is going to blindly accept the output of clang-tidy, then there 
is nothing we can do about that.  (A case in point: I am currently reviewing 
thousands of changes proposed by google-readability-braces-around-statements; 
it has quite a few bugs and can actually generate syntactically invalid code 
from its suggested fixits!)  At a bare minimum, clang-tidy should never offer 
fixits that change the meaning of the code and my suggested fixit does not do 
that.  The other proposed fixits discussed on this thread **do** change the 
meaning of the code by changing the precision of the intermediate calculations 
and are therefore not refactorings.  They are bug fixes.  Without dynamic 
analysis, only a human can decide on their validity by considering the larger 
context of the code.

Again, my feeling is that clang-tidy should be a refactoring tool when it comes 
to fixits -- the suggested changes should never change the semantic meaning of 
the code.


Repository:
  rL LLVM

http://reviews.llvm.org/D16310



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


Re: [clang-tools-extra] r258356 - Make modernize-use-default tolerant of delayed template parsing; this code was previously causing failed assertions because dyn_cast was being passed a null pointer d

2016-01-21 Thread Hans Wennborg via cfe-commits
On Thu, Jan 21, 2016 at 12:00 PM, Aaron Ballman  wrote:
> On Thu, Jan 21, 2016 at 1:01 PM, Hans Wennborg  wrote:
>> Thanks.
>>
>> Aaron, do you want to go ahead and merge this with
>> utils/release/merge.sh? Or let me know if you'd prefer me to do the
>> merge.
>
> I'd prefer if you'd handle the merge (I'm on Windows), if you don't mind.

No problem, r258431.

Cheers,
Hans


>> On Thu, Jan 21, 2016 at 10:00 AM, Alexander Kornienko  
>> wrote:
>>> I'm fine with including this to 3.8. BTW, I'm working on release notes.
>>>
>>> On Thu, Jan 21, 2016 at 6:01 PM, Hans Wennborg  wrote:

 I'm fine with it. Alex, what do you think?

 On Wed, Jan 20, 2016 at 3:07 PM, Aaron Ballman 
 wrote:
 > Uncertain whether this meets the bar for inclusion in 3.8.
 > clang-modernize was moved into clang-tidy and from what I can tell, it
 > did not suffer from this crash. I wouldn't normally recommend this,
 > but just about any use of clang-tidy (that does not filter out this
 > check) over code that includes the MSVC STL headers will trigger that
 > assert without this fix.
 >
 > ~Aaron
 >
 > On Wed, Jan 20, 2016 at 5:14 PM, Aaron Ballman via cfe-commits
 >  wrote:
 >> Author: aaronballman
 >> Date: Wed Jan 20 16:14:10 2016
 >> New Revision: 258356
 >>
 >> URL: http://llvm.org/viewvc/llvm-project?rev=258356&view=rev
 >> Log:
 >> Make modernize-use-default tolerant of delayed template parsing; this
 >> code was previously causing failed assertions because dyn_cast was being
 >> passed a null pointer due to the delay-parsed body.
 >>
 >> Added:
 >>
 >> clang-tools-extra/trunk/test/clang-tidy/modernize-use-default-delayed.cpp
 >> Modified:
 >> clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultCheck.cpp
 >>
 >> Modified:
 >> clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultCheck.cpp
 >> URL:
 >> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultCheck.cpp?rev=258356&r1=258355&r2=258356&view=diff
 >>
 >> ==
 >> --- clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultCheck.cpp
 >> (original)
 >> +++ clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultCheck.cpp
 >> Wed Jan 20 16:14:10 2016
 >> @@ -272,6 +272,7 @@ void UseDefaultCheck::check(const MatchF
 >>// that are not user-provided (automatically generated).
 >>if (SpecialFunctionDecl->isDeleted() ||
 >>SpecialFunctionDecl->isExplicitlyDefaulted() ||
 >> +  SpecialFunctionDecl->isLateTemplateParsed() ||
 >>!SpecialFunctionDecl->isUserProvided() ||
 >> !SpecialFunctionDecl->hasBody())
 >>  return;
 >>
 >>
 >> Added:
 >> clang-tools-extra/trunk/test/clang-tidy/modernize-use-default-delayed.cpp
 >> URL:
 >> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/modernize-use-default-delayed.cpp?rev=258356&view=auto
 >>
 >> ==
 >> ---
 >> clang-tools-extra/trunk/test/clang-tidy/modernize-use-default-delayed.cpp
 >> (added)
 >> +++
 >> clang-tools-extra/trunk/test/clang-tidy/modernize-use-default-delayed.cpp
 >> Wed Jan 20 16:14:10 2016
 >> @@ -0,0 +1,8 @@
 >> +// RUN: clang-tidy %s -checks=-*,modernize-use-default -- -std=c++11
 >> -fdelayed-template-parsing -fexceptions | count 0
 >> +// Note: this test expects no diagnostics, but FileCheck cannot handle
 >> that,
 >> +// hence the use of | count 0.
 >> +
 >> +template 
 >> +struct S {
 >> +  S& operator=(const S&) { return *this; }
 >> +};
 >>
 >>
 >> ___
 >> 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: r258394 - [OPENMP] Fix crash on reduction for complex variables.

2016-01-21 Thread Hans Wennborg via cfe-commits
Jack suggested (https://llvm.org/bugs/show_bug.cgi?id=26059#c7) that
this should be merged to 3.8.

Alexey, you're the code owner here. OK for merging? If yes, do you
want to go ahead and merge with utils/release/merge.sh?

On Thu, Jan 21, 2016 at 4:35 AM, Alexey Bataev via cfe-commits
 wrote:
> Author: abataev
> Date: Thu Jan 21 06:35:58 2016
> New Revision: 258394
>
> URL: http://llvm.org/viewvc/llvm-project?rev=258394&view=rev
> Log:
> [OPENMP] Fix crash on reduction for complex variables.
> reworked codegen for reduction operation for complex types to avoid crash
>
> Modified:
> cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
> cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp
> cfe/trunk/lib/CodeGen/CodeGenFunction.h
> cfe/trunk/test/OpenMP/parallel_reduction_codegen.cpp
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r258396 - Fix crash for typedefs for arrays of runtime bounds in Lambdas/Captured Statements, used in sizeof() expression only.

2016-01-21 Thread Hans Wennborg via cfe-commits
Richard, it was suggested (in
https://llvm.org/bugs/show_bug.cgi?id=26059#c7) that this gets merged
to 3.8. I believe this falls under your ownership.

On Thu, Jan 21, 2016 at 4:54 AM, Alexey Bataev via cfe-commits
 wrote:
> Author: abataev
> Date: Thu Jan 21 06:54:48 2016
> New Revision: 258396
>
> URL: http://llvm.org/viewvc/llvm-project?rev=258396&view=rev
> Log:
> Fix crash for typedefs for arrays of runtime bounds in Lambdas/Captured 
> Statements, used in sizeof() expression only.
>
> Modified:
> cfe/trunk/lib/Sema/SemaExpr.cpp
> cfe/trunk/test/CodeGenCXX/lambda-expressions.cpp
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r258307 - [OPENMP 4.0] Fix for codegen of 'cancel' directive within 'sections' directive.

2016-01-21 Thread Hans Wennborg via cfe-commits
Jack suggested (https://llvm.org/bugs/show_bug.cgi?id=26059#c7) that
this should be merged to 3.8.

Alexey, you're the code owner here. OK for merging? If yes, do you
want to go ahead and merge with utils/release/merge.sh?

On Wed, Jan 20, 2016 at 4:29 AM, Alexey Bataev via cfe-commits
 wrote:
> Author: abataev
> Date: Wed Jan 20 06:29:47 2016
> New Revision: 258307
>
> URL: http://llvm.org/viewvc/llvm-project?rev=258307&view=rev
> Log:
> [OPENMP 4.0] Fix for codegen of 'cancel' directive within 'sections' 
> directive.
> Allow to emit code for 'cancel' directive within 'sections' directive with 
> single sub-section.
>
> Modified:
> cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
> cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp
> cfe/trunk/test/OpenMP/cancel_codegen.cpp
>
> Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp?rev=258307&r1=258306&r2=258307&view=diff
> ==
> --- cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp Wed Jan 20 06:29:47 2016
> @@ -3685,8 +3685,6 @@ void CGOpenMPRuntime::emitCancelCall(Cod
>// kmp_int32 cncl_kind);
>if (auto *OMPRegionInfo =
>dyn_cast_or_null(CGF.CapturedStmtInfo)) {
> -if (OMPRegionInfo->getDirectiveKind() == OMPD_single)
> -  return;
>  auto &&ThenGen = [this, Loc, CancelRegion,
>OMPRegionInfo](CodeGenFunction &CGF) {
>llvm::Value *Args[] = {
>
> Modified: cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp?rev=258307&r1=258306&r2=258307&view=diff
> ==
> --- cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp Wed Jan 20 06:29:47 2016
> @@ -1786,7 +1786,11 @@ CodeGenFunction::EmitSections(const OMPE
>  CGF.EmitOMPPrivateClause(S, SingleScope);
>  (void)SingleScope.Privatize();
>
> +auto Exit = CGF.getJumpDestInCurrentScope("omp.sections.exit");
> +CGF.BreakContinueStack.push_back(BreakContinue(Exit, Exit));
>  CGF.EmitStmt(Stmt);
> +CGF.EmitBlock(Exit.getBlock());
> +CGF.BreakContinueStack.pop_back();
>};
>CGM.getOpenMPRuntime().emitSingleRegion(*this, CodeGen, S.getLocStart(),
>llvm::None, llvm::None, llvm::None,
> @@ -2647,7 +2651,8 @@ CodeGenFunction::getOMPCancelDestination
>if (Kind == OMPD_parallel || Kind == OMPD_task)
>  return ReturnBlock;
>assert(Kind == OMPD_for || Kind == OMPD_section || Kind == OMPD_sections ||
> - Kind == OMPD_parallel_sections || Kind == OMPD_parallel_for);
> + Kind == OMPD_parallel_sections || Kind == OMPD_parallel_for ||
> + Kind == OMPD_single);
>return BreakContinueStack.back().BreakBlock;
>  }
>
>
> Modified: cfe/trunk/test/OpenMP/cancel_codegen.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/cancel_codegen.cpp?rev=258307&r1=258306&r2=258307&view=diff
> ==
> --- cfe/trunk/test/OpenMP/cancel_codegen.cpp (original)
> +++ cfe/trunk/test/OpenMP/cancel_codegen.cpp Wed Jan 20 06:29:47 2016
> @@ -20,7 +20,7 @@ int main (int argc, char **argv) {
>  #pragma omp cancel sections
>  }
>  // CHECK: call i32 @__kmpc_single(
> -// CHECK-NOT: @__kmpc_cancel
> +// CHECK: call i32 @__kmpc_cancel(
>  // CHECK: call void @__kmpc_end_single(
>  // CHECK: call void @__kmpc_barrier(%ident_t*
>  #pragma omp sections
> @@ -126,7 +126,7 @@ for (int i = 0; i < argc; ++i) {
>
>  // CHECK: define internal void @{{[^(]+}}(i32* {{[^,]+}}, i32* {{[^,]+}})
>  // CHECK: call i32 @__kmpc_single(
> -// CHECK-NOT: @__kmpc_cancel
> +// CHECK: call i32 @__kmpc_cancel(
>  // CHECK: call void @__kmpc_end_single(
>  // CHECK: ret void
>
>
>
> ___
> 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] D16310: new clang-tidy checker misc-long-cast

2016-01-21 Thread Richard via cfe-commits
LegalizeAdulthood added inline comments.


Comment at: clang-tidy/misc/LongCastCheck.cpp:97
@@ +96,3 @@
+
+  if (!CastType->isIntegerType() || !SubType->isIntegerType())
+return;

danielmarjamaki wrote:
> LegalizeAdulthood wrote:
> > Why don't you check for casting a `float` expression to a `double` or `long 
> > double`?
> > 
> > Isn't this the exact same issue?
> > 
> > If so, add a test case for casting a `float` expression to `double` and a 
> > test case for casting a `double` expression to a `long double`.
> in theory yes.. but somehow that feels strange to me. yes there will possibly 
> be loss of precision in some decimals, that is normal when using floating 
> point numbers. if such loss of precision would be unwanted then float should 
> be avoided to start with.
> 
> so I do agree in theory but I don't think I would feel good about adding such 
> warnings.
> 
For floating-point quantities, when I think of the term "precision" I am 
thinking of the number of bits allocated to the mantissa.  This may or may not 
be correct terminology according to floating-point experts, but from what I can 
tell it seems to agree with how the term is used on wikipedias [[ 
https://en.wikipedia.org/wiki/Floating_point | article on floating-point ]].

So while digits are technically lost when we add a small floating-point 
quantity to a large floating-point quantity (the large quantity gobbles up all 
the bits of the mantissa and the small quantity has its least-significant 
mantissa bits discarded), the precision of the result isn't changed -- the 
number of bits in the mantissa is the same for the result as it was for the 
inputs.

To then take a quantity of N bits of mantissa and cast that to a quantity of M 
bits of mantissa where M > N seems just as pointless as the approach of casting 
an `int` to a `long`.  The extra tokens for casting do absolutely nothing and 
are redundant as far as the computation as written is concerned.


Comment at: clang-tidy/misc/MiscTidyModule.cpp:61
@@ -59,1 +60,3 @@
+CheckFactories.registerCheck(
+"misc-long-cast");
 CheckFactories.registerCheck(

danielmarjamaki wrote:
> alexfh wrote:
> > danielmarjamaki wrote:
> > > LegalizeAdulthood wrote:
> > > > The documentation describes this check as one that looks for a cast to 
> > > > a "bigger type", but the name of the check implies that it only works 
> > > > for casts to `long`.
> > > > 
> > > > The name of the check should be made more generic to reflect reality.
> > > > 
> > > > Perhaps `misc-redundant-cast-to-larger-type` or 
> > > > `misc-redundant-bigger-type-cast`?
> > > Yes I agree.. will fix..
> > > 
> > > I used long because that is the typical case that I envision.
> > How about misc-misplaced-widening-cast?
> I already changed.. but I like misc-misplaced-widening-cast better so I will 
> change again..
Yes, Alex's name suggestion is better than mine.  Yay code reviews!


Repository:
  rL LLVM

http://reviews.llvm.org/D16310



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


Re: [PATCH] D13420: Fix deduction of __atomic_load's parameter types.

2016-01-21 Thread Eric Fiselier via cfe-commits
EricWF added a comment.

ping.


http://reviews.llvm.org/D13420



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


r258441 - [OpenMP] Parsing + Sema for nowait clause on target directive

2016-01-21 Thread Arpith Chacko Jacob via cfe-commits
Author: arpith
Date: Thu Jan 21 16:18:28 2016
New Revision: 258441

URL: http://llvm.org/viewvc/llvm-project?rev=258441&view=rev
Log:
[OpenMP] Parsing + Sema for nowait clause on target directive

Summary:
Allow nowait clause on target directive in sema and add test cases.

Reviewers: ABataev

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


Added:
cfe/trunk/test/OpenMP/target_nowait_messages.cpp
Modified:
cfe/trunk/include/clang/Basic/OpenMPKinds.def
cfe/trunk/test/OpenMP/target_ast_print.cpp

Modified: cfe/trunk/include/clang/Basic/OpenMPKinds.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/OpenMPKinds.def?rev=258441&r1=258440&r2=258441&view=diff
==
--- cfe/trunk/include/clang/Basic/OpenMPKinds.def (original)
+++ cfe/trunk/include/clang/Basic/OpenMPKinds.def Thu Jan 21 16:18:28 2016
@@ -355,6 +355,7 @@ OPENMP_TARGET_CLAUSE(if)
 OPENMP_TARGET_CLAUSE(device)
 OPENMP_TARGET_CLAUSE(map)
 OPENMP_TARGET_CLAUSE(private)
+OPENMP_TARGET_CLAUSE(nowait)
 
 // Clauses allowed for OpenMP directive 'target data'.
 // TODO More clauses for 'target data' directive.

Modified: cfe/trunk/test/OpenMP/target_ast_print.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_ast_print.cpp?rev=258441&r1=258440&r2=258441&view=diff
==
--- cfe/trunk/test/OpenMP/target_ast_print.cpp (original)
+++ cfe/trunk/test/OpenMP/target_ast_print.cpp Thu Jan 21 16:18:28 2016
@@ -25,6 +25,8 @@ T tmain(T argc, T *argv) {
   foo();
 #pragma omp target map(always,alloc: i)
   foo();
+#pragma omp target nowait
+  foo();
   return 0;
 }
 
@@ -44,6 +46,8 @@ T tmain(T argc, T *argv) {
 // CHECK-NEXT: foo()
 // CHECK-NEXT: #pragma omp target map(always,alloc: i)
 // CHECK-NEXT: foo()
+// CHECK-NEXT: #pragma omp target nowait
+// CHECK-NEXT: foo()
 // CHECK: template  char tmain(char argc, char 
*argv) {
 // CHECK-NEXT: char i, j, a[20]
 // CHECK-NEXT: #pragma omp target
@@ -60,6 +64,8 @@ T tmain(T argc, T *argv) {
 // CHECK-NEXT: foo()
 // CHECK-NEXT: #pragma omp target map(always,alloc: i)
 // CHECK-NEXT: foo()
+// CHECK-NEXT: #pragma omp target nowait
+// CHECK-NEXT: foo()
 // CHECK: template  T tmain(T argc, T *argv) {
 // CHECK-NEXT: T i, j, a[20]
 // CHECK-NEXT: #pragma omp target
@@ -76,6 +82,8 @@ T tmain(T argc, T *argv) {
 // CHECK-NEXT: foo()
 // CHECK-NEXT: #pragma omp target map(always,alloc: i)
 // CHECK-NEXT: foo()
+// CHECK-NEXT: #pragma omp target nowait
+// CHECK-NEXT: foo()
 
 // CHECK-LABEL: int main(int argc, char **argv) {
 int main (int argc, char **argv) {
@@ -115,6 +123,11 @@ int main (int argc, char **argv) {
   foo();
 // CHECK-NEXT: foo();
 
+#pragma omp target nowait
+// CHECK-NEXT: #pragma omp target nowait
+  foo();
+// CHECK-NEXT: foo();
+
   return tmain(argc, &argc) + tmain(argv[0][0], argv[0]);
 }
 

Added: cfe/trunk/test/OpenMP/target_nowait_messages.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_nowait_messages.cpp?rev=258441&view=auto
==
--- cfe/trunk/test/OpenMP/target_nowait_messages.cpp (added)
+++ cfe/trunk/test/OpenMP/target_nowait_messages.cpp Thu Jan 21 16:18:28 2016
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify -fopenmp 
-ferror-limit 100 -o - %s
+
+void foo() {
+}
+
+int main(int argc, char **argv) {
+  #pragma omp target nowait( // expected-warning {{extra tokens at the end of 
'#pragma omp target' are ignored}}
+  foo();
+  #pragma omp target nowait (argc)) // expected-warning {{extra tokens at the 
end of '#pragma omp target' are ignored}}
+  foo();
+  #pragma omp target nowait device (-10u)
+  foo();
+  #pragma omp target nowait (3.14) device (-10u) // expected-warning {{extra 
tokens at the end of '#pragma omp target' are ignored}}
+  foo();
+
+  return 0;
+}


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


Re: [PATCH] D16358: [OpenMP] Parsing + Sema for nowait clause on target directive

2016-01-21 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL258441: [OpenMP] Parsing + Sema for nowait clause on target 
directive (authored by arpith).

Changed prior to commit:
  http://reviews.llvm.org/D16358?vs=45399&id=45595#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D16358

Files:
  cfe/trunk/include/clang/Basic/OpenMPKinds.def
  cfe/trunk/test/OpenMP/target_ast_print.cpp
  cfe/trunk/test/OpenMP/target_nowait_messages.cpp

Index: cfe/trunk/include/clang/Basic/OpenMPKinds.def
===
--- cfe/trunk/include/clang/Basic/OpenMPKinds.def
+++ cfe/trunk/include/clang/Basic/OpenMPKinds.def
@@ -355,6 +355,7 @@
 OPENMP_TARGET_CLAUSE(device)
 OPENMP_TARGET_CLAUSE(map)
 OPENMP_TARGET_CLAUSE(private)
+OPENMP_TARGET_CLAUSE(nowait)
 
 // Clauses allowed for OpenMP directive 'target data'.
 // TODO More clauses for 'target data' directive.
Index: cfe/trunk/test/OpenMP/target_nowait_messages.cpp
===
--- cfe/trunk/test/OpenMP/target_nowait_messages.cpp
+++ cfe/trunk/test/OpenMP/target_nowait_messages.cpp
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify -fopenmp 
-ferror-limit 100 -o - %s
+
+void foo() {
+}
+
+int main(int argc, char **argv) {
+  #pragma omp target nowait( // expected-warning {{extra tokens at the end of 
'#pragma omp target' are ignored}}
+  foo();
+  #pragma omp target nowait (argc)) // expected-warning {{extra tokens at the 
end of '#pragma omp target' are ignored}}
+  foo();
+  #pragma omp target nowait device (-10u)
+  foo();
+  #pragma omp target nowait (3.14) device (-10u) // expected-warning {{extra 
tokens at the end of '#pragma omp target' are ignored}}
+  foo();
+
+  return 0;
+}
Index: cfe/trunk/test/OpenMP/target_ast_print.cpp
===
--- cfe/trunk/test/OpenMP/target_ast_print.cpp
+++ cfe/trunk/test/OpenMP/target_ast_print.cpp
@@ -25,6 +25,8 @@
   foo();
 #pragma omp target map(always,alloc: i)
   foo();
+#pragma omp target nowait
+  foo();
   return 0;
 }
 
@@ -44,6 +46,8 @@
 // CHECK-NEXT: foo()
 // CHECK-NEXT: #pragma omp target map(always,alloc: i)
 // CHECK-NEXT: foo()
+// CHECK-NEXT: #pragma omp target nowait
+// CHECK-NEXT: foo()
 // CHECK: template  char tmain(char argc, char 
*argv) {
 // CHECK-NEXT: char i, j, a[20]
 // CHECK-NEXT: #pragma omp target
@@ -60,6 +64,8 @@
 // CHECK-NEXT: foo()
 // CHECK-NEXT: #pragma omp target map(always,alloc: i)
 // CHECK-NEXT: foo()
+// CHECK-NEXT: #pragma omp target nowait
+// CHECK-NEXT: foo()
 // CHECK: template  T tmain(T argc, T *argv) {
 // CHECK-NEXT: T i, j, a[20]
 // CHECK-NEXT: #pragma omp target
@@ -76,6 +82,8 @@
 // CHECK-NEXT: foo()
 // CHECK-NEXT: #pragma omp target map(always,alloc: i)
 // CHECK-NEXT: foo()
+// CHECK-NEXT: #pragma omp target nowait
+// CHECK-NEXT: foo()
 
 // CHECK-LABEL: int main(int argc, char **argv) {
 int main (int argc, char **argv) {
@@ -115,6 +123,11 @@
   foo();
 // CHECK-NEXT: foo();
 
+#pragma omp target nowait
+// CHECK-NEXT: #pragma omp target nowait
+  foo();
+// CHECK-NEXT: foo();
+
   return tmain(argc, &argc) + tmain(argv[0][0], argv[0]);
 }
 


Index: cfe/trunk/include/clang/Basic/OpenMPKinds.def
===
--- cfe/trunk/include/clang/Basic/OpenMPKinds.def
+++ cfe/trunk/include/clang/Basic/OpenMPKinds.def
@@ -355,6 +355,7 @@
 OPENMP_TARGET_CLAUSE(device)
 OPENMP_TARGET_CLAUSE(map)
 OPENMP_TARGET_CLAUSE(private)
+OPENMP_TARGET_CLAUSE(nowait)
 
 // Clauses allowed for OpenMP directive 'target data'.
 // TODO More clauses for 'target data' directive.
Index: cfe/trunk/test/OpenMP/target_nowait_messages.cpp
===
--- cfe/trunk/test/OpenMP/target_nowait_messages.cpp
+++ cfe/trunk/test/OpenMP/target_nowait_messages.cpp
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify -fopenmp -ferror-limit 100 -o - %s
+
+void foo() {
+}
+
+int main(int argc, char **argv) {
+  #pragma omp target nowait( // expected-warning {{extra tokens at the end of '#pragma omp target' are ignored}}
+  foo();
+  #pragma omp target nowait (argc)) // expected-warning {{extra tokens at the end of '#pragma omp target' are ignored}}
+  foo();
+  #pragma omp target nowait device (-10u)
+  foo();
+  #pragma omp target nowait (3.14) device (-10u) // expected-warning {{extra tokens at the end of '#pragma omp target' are ignored}}
+  foo();
+
+  return 0;
+}
Index: cfe/trunk/test/OpenMP/target_ast_print.cpp
===
--- cfe/trunk/test/OpenMP/target_ast_print.cpp
+++ cfe/trunk/test/OpenMP/target_ast_print.cpp
@@ -25,6 +25,8 @@
   foo();
 #pragma omp target map(always,alloc: i)
   foo();
+#pragma omp target nowait
+  foo();
   return 0;
 }
 
@@ -44,6 +46,8 @@
 // CHECK-NEXT: foo()
 // CHECK-NEXT

Re: [PATCH] D16163: [Concepts] Diagnose when return type of a function concept or declaration type of a variable concept is not bool.

2016-01-21 Thread Hubert Tong via cfe-commits
hubert.reinterpretcast accepted this revision.
hubert.reinterpretcast added a comment.
This revision is now accepted and ready to land.

LGTM.


http://reviews.llvm.org/D16163



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


Re: [PATCH] D16408: [libcxx] Additional 'REQUIRE' directives for tests that require en_US.UTF-8.

2016-01-21 Thread Ben Craig via cfe-commits
bcraig added a comment.

LGTM.  May want to wait on mclow though considering the trouble I helped cause 
with the last one of these.


http://reviews.llvm.org/D16408



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


Re: [PATCH] D15935: Improve diagnostics for literal conversion to Boolean

2016-01-21 Thread Manman Ren via cfe-commits
manmanren added a subscriber: manmanren.
manmanren added a comment.

Thanks for working on this. This looks good to me overall, but I am not the 
expert on Sema :]

Cheers,
Manman



Comment at: lib/Sema/SemaChecking.cpp:6985
@@ -6984,6 +6984,3 @@
   SmallString<16> PrettyTargetValue;
-  if (T->isSpecificBuiltinType(BuiltinType::Bool))
-PrettyTargetValue = Value.isZero() ? "false" : "true";
-  else
-IntegerValue.toString(PrettyTargetValue);
+  IntegerValue.toString(PrettyTargetValue);
 

Why do we remove the pretty printing for boolean here? Providing context here 
will be nice.


http://reviews.llvm.org/D15935



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


Re: [PATCH] D16408: [libcxx] Additional 'REQUIRE' directives for tests that require en_US.UTF-8.

2016-01-21 Thread Daniel Sanders via cfe-commits
dsanders added a comment.

Thanks.

> May want to wait on mclow though considering the trouble I helped cause with 
> the last one of these.


Sure. That wasn't your fault though, it was mine. I should have asked for 
clarification first.


http://reviews.llvm.org/D16408



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


[PATCH] D16430: Fix printing of nested variable declarations with suppressed specifiers

2016-01-21 Thread Nick Sumner via cfe-commits
nick.sumner created this revision.
nick.sumner added reviewers: bkramer, rsmith.
nick.sumner added a subscriber: cfe-commits.

Allow nested variable declarations to have their types printed correctly even
when the incoming PrintingPolicy suppresses specifiers. This can happen when
initializing a variable with a statement expression. Given the C code:

int a, b = ({
int c = 1;
c;
});

The declaration of c is printed with a missing type specifier:

int a, b = ({
c = 1;
c;
});

With the patch, the declaration of c is properly printed:

int a, b = ({
int c = 1;
c;
});

This is related to the previous patch: http://reviews.llvm.org/D16352

http://reviews.llvm.org/D16430

Files:
  lib/AST/StmtPrinter.cpp
  test/Sema/ast-print.c

Index: test/Sema/ast-print.c
===
--- test/Sema/ast-print.c
+++ test/Sema/ast-print.c
@@ -58,3 +58,11 @@
 // CHECK: int *x = ((void *)0), *y = ((void *)0);
   int *x = ((void *)0), *y = ((void *)0);
 }
+
+void stmtExpr() {
+  int a, b = ({
+// CHECK: int c = 1;
+int c = 1;
+c;
+  });
+}
Index: lib/AST/StmtPrinter.cpp
===
--- lib/AST/StmtPrinter.cpp
+++ lib/AST/StmtPrinter.cpp
@@ -127,7 +127,9 @@
 
 void StmtPrinter::PrintRawDeclStmt(const DeclStmt *S) {
   SmallVector Decls(S->decls());
-  Decl::printGroup(Decls.data(), Decls.size(), OS, Policy, IndentLevel);
+  PrintingPolicy SubPolicy(Policy);
+  SubPolicy.SuppressSpecifiers = false;
+  Decl::printGroup(Decls.data(), Decls.size(), OS, SubPolicy, IndentLevel);
 }
 
 void StmtPrinter::VisitNullStmt(NullStmt *Node) {


Index: test/Sema/ast-print.c
===
--- test/Sema/ast-print.c
+++ test/Sema/ast-print.c
@@ -58,3 +58,11 @@
 // CHECK: int *x = ((void *)0), *y = ((void *)0);
   int *x = ((void *)0), *y = ((void *)0);
 }
+
+void stmtExpr() {
+  int a, b = ({
+// CHECK: int c = 1;
+int c = 1;
+c;
+  });
+}
Index: lib/AST/StmtPrinter.cpp
===
--- lib/AST/StmtPrinter.cpp
+++ lib/AST/StmtPrinter.cpp
@@ -127,7 +127,9 @@
 
 void StmtPrinter::PrintRawDeclStmt(const DeclStmt *S) {
   SmallVector Decls(S->decls());
-  Decl::printGroup(Decls.data(), Decls.size(), OS, Policy, IndentLevel);
+  PrintingPolicy SubPolicy(Policy);
+  SubPolicy.SuppressSpecifiers = false;
+  Decl::printGroup(Decls.data(), Decls.size(), OS, SubPolicy, IndentLevel);
 }
 
 void StmtPrinter::VisitNullStmt(NullStmt *Node) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r258447 - [MSVC Compat] Don't omit frame pointers if /Oy- is specified before /O2

2016-01-21 Thread David Majnemer via cfe-commits
Author: majnemer
Date: Thu Jan 21 17:01:11 2016
New Revision: 258447

URL: http://llvm.org/viewvc/llvm-project?rev=258447&view=rev
Log:
[MSVC Compat] Don't omit frame pointers if /Oy- is specified before /O2

Microsoft's documentation states that specifying
/Oy- after the /O[12x] options disables frame-pointer omission.
What it does *not* state is that it also disables frame-pointer omission
if /Oy- is specified before /O[12x].

Modified:
cfe/trunk/lib/Driver/MSVCToolChain.cpp
cfe/trunk/test/Driver/cl-options.c

Modified: cfe/trunk/lib/Driver/MSVCToolChain.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/MSVCToolChain.cpp?rev=258447&r1=258446&r2=258447&view=diff
==
--- cfe/trunk/lib/Driver/MSVCToolChain.cpp (original)
+++ cfe/trunk/lib/Driver/MSVCToolChain.cpp Thu Jan 21 17:01:11 2016
@@ -659,7 +659,8 @@ static void TranslateOptArg(Arg *A, llvm
 DAL.AddFlagArg(A, Opts.getOption(options::OPT_fbuiltin));
 DAL.AddJoinedArg(A, Opts.getOption(options::OPT_O), "2");
   }
-  if (SupportsForcingFramePointer)
+  if (SupportsForcingFramePointer &&
+  !DAL.hasArgNoClaim(options::OPT_fno_omit_frame_pointer))
 DAL.AddFlagArg(A,
Opts.getOption(options::OPT_fomit_frame_pointer));
   if (OptChar == '1' || OptChar == '2')

Modified: cfe/trunk/test/Driver/cl-options.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cl-options.c?rev=258447&r1=258446&r2=258447&view=diff
==
--- cfe/trunk/test/Driver/cl-options.c (original)
+++ cfe/trunk/test/Driver/cl-options.c Thu Jan 21 17:01:11 2016
@@ -123,6 +123,10 @@
 // PR24003: -momit-leaf-frame-pointer
 // PR24003: -Os
 
+// RUN: %clang_cl --target=i686-pc-win32 /Oy- /O2 -### -- %s 2>&1 | FileCheck 
-check-prefix=Oy_2 %s
+// Oy_2: -momit-leaf-frame-pointer
+// Oy_2: -O2
+
 // RUN: %clang_cl /Zs /Oy -- %s 2>&1
 
 // RUN: %clang_cl --target=i686-pc-win32 /Oy- -### -- %s 2>&1 | FileCheck 
-check-prefix=Oy_ %s


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


[PATCH] D16433: Fix printing signed character literals

2016-01-21 Thread Nick Sumner via cfe-commits
nick.sumner created this revision.
nick.sumner added reviewers: bkramer, rsmith.
nick.sumner added a subscriber: cfe-commits.

Allow StmtPrinter to print signed character literals. Given the code:
char c = '\200';

The character literal is presently printed as:
char c = '\Uff80';

The original literal has the signed value -128 (or unsigned value 128)
and only has any meaning when clamped to the extended ASCII range.
'\Uff80' isn't a valid character.

With the patch, the literal is printed as:
char c = '\x80';

As a side note, this doesn't handle multicharacter literals, but I
don't think there is enough information in the AST to make that
possible. They are implementation defined, anyway.

http://reviews.llvm.org/D16433

Files:
  lib/AST/StmtPrinter.cpp
  test/Sema/ast-print.c

Index: test/Sema/ast-print.c
===
--- test/Sema/ast-print.c
+++ test/Sema/ast-print.c
@@ -66,3 +66,6 @@
 c;
   });
 }
+
+// CHECK: char c = '\x80';
+char c = '\200';
Index: lib/AST/StmtPrinter.cpp
===
--- lib/AST/StmtPrinter.cpp
+++ lib/AST/StmtPrinter.cpp
@@ -1230,8 +1230,8 @@
   default:
 if (value < 256 && isPrintable((unsigned char)value))
   OS << "'" << (char)value << "'";
-else if (value < 256)
-  OS << "'\\x" << llvm::format("%02x", value) << "'";
+else if (value < 256 || CharacterLiteral::Ascii == Node->getKind())
+  OS << "'\\x" << llvm::format("%02x", (unsigned char)value) << "'";
 else if (value <= 0x)
   OS << "'\\u" << llvm::format("%04x", value) << "'";
 else


Index: test/Sema/ast-print.c
===
--- test/Sema/ast-print.c
+++ test/Sema/ast-print.c
@@ -66,3 +66,6 @@
 c;
   });
 }
+
+// CHECK: char c = '\x80';
+char c = '\200';
Index: lib/AST/StmtPrinter.cpp
===
--- lib/AST/StmtPrinter.cpp
+++ lib/AST/StmtPrinter.cpp
@@ -1230,8 +1230,8 @@
   default:
 if (value < 256 && isPrintable((unsigned char)value))
   OS << "'" << (char)value << "'";
-else if (value < 256)
-  OS << "'\\x" << llvm::format("%02x", value) << "'";
+else if (value < 256 || CharacterLiteral::Ascii == Node->getKind())
+  OS << "'\\x" << llvm::format("%02x", (unsigned char)value) << "'";
 else if (value <= 0x)
   OS << "'\\u" << llvm::format("%04x", value) << "'";
 else
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D16361: [OpenMP] Parsing + Sema for nowait clause on target enter data directive.

2016-01-21 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL258457: [OpenMP] Parsing + Sema for nowait clause on target 
enter data directive. (authored by arpith).

Changed prior to commit:
  http://reviews.llvm.org/D16361?vs=45409&id=45610#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D16361

Files:
  cfe/trunk/include/clang/Basic/OpenMPKinds.def
  cfe/trunk/test/OpenMP/target_enter_data_ast_print.cpp
  cfe/trunk/test/OpenMP/target_enter_data_nowait_messages.cpp

Index: cfe/trunk/include/clang/Basic/OpenMPKinds.def
===
--- cfe/trunk/include/clang/Basic/OpenMPKinds.def
+++ cfe/trunk/include/clang/Basic/OpenMPKinds.def
@@ -368,6 +368,7 @@
 OPENMP_TARGET_ENTER_DATA_CLAUSE(if)
 OPENMP_TARGET_ENTER_DATA_CLAUSE(device)
 OPENMP_TARGET_ENTER_DATA_CLAUSE(map)
+OPENMP_TARGET_ENTER_DATA_CLAUSE(nowait)
 
 // Clauses allowed for OpenMP directive 'target exit data'.
 // TODO More clauses for 'target exit data' directive.
Index: cfe/trunk/test/OpenMP/target_enter_data_ast_print.cpp
===
--- cfe/trunk/test/OpenMP/target_enter_data_ast_print.cpp
+++ cfe/trunk/test/OpenMP/target_enter_data_ast_print.cpp
@@ -27,6 +27,22 @@
 
 #pragma omp target enter data map(always,alloc: e)
 
+#pragma omp target enter data nowait map(to: i)
+
+#pragma omp target enter data nowait map(to: i) if (target enter data: j > 0)
+
+#pragma omp target enter data map(to: i) if (b) nowait
+
+#pragma omp target enter data map(to: c) nowait
+
+#pragma omp target enter data map(to: c) nowait if(b>e)
+
+#pragma omp target enter data nowait map(alloc: x[0:10], c)
+
+#pragma omp target enter data nowait map(to: c) map(alloc: d)
+
+#pragma omp target enter data nowait map(always,alloc: e)
+
   return 0;
 }
 
@@ -41,6 +57,14 @@
 // CHECK-NEXT: #pragma omp target enter data map(alloc: x[0:10],c)
 // CHECK-NEXT: #pragma omp target enter data map(to: c) map(alloc: d)
 // CHECK-NEXT: #pragma omp target enter data map(always,alloc: e)
+// CHECK-NEXT: #pragma omp target enter data nowait map(to: i)
+// CHECK-NEXT: #pragma omp target enter data nowait map(to: i) if(target enter data: j > 0)
+// CHECK-NEXT: #pragma omp target enter data map(to: i) if(b) nowait
+// CHECK-NEXT: #pragma omp target enter data map(to: c) nowait
+// CHECK-NEXT: #pragma omp target enter data map(to: c) nowait if(b > e)
+// CHECK-NEXT: #pragma omp target enter data nowait map(alloc: x[0:10],c)
+// CHECK-NEXT: #pragma omp target enter data nowait map(to: c) map(alloc: d)
+// CHECK-NEXT: #pragma omp target enter data nowait map(always,alloc: e)
 // CHECK: template  char tmain(char argc, char *argv) {
 // CHECK-NEXT: char i, j, b, c, d, e, x[20];
 // CHECK-NEXT: i = argc;
@@ -52,6 +76,14 @@
 // CHECK-NEXT: #pragma omp target enter data map(alloc: x[0:10],c)
 // CHECK-NEXT: #pragma omp target enter data map(to: c) map(alloc: d)
 // CHECK-NEXT: #pragma omp target enter data map(always,alloc: e)
+// CHECK-NEXT: #pragma omp target enter data nowait map(to: i)
+// CHECK-NEXT: #pragma omp target enter data nowait map(to: i) if(target enter data: j > 0)
+// CHECK-NEXT: #pragma omp target enter data map(to: i) if(b) nowait
+// CHECK-NEXT: #pragma omp target enter data map(to: c) nowait
+// CHECK-NEXT: #pragma omp target enter data map(to: c) nowait if(b > e)
+// CHECK-NEXT: #pragma omp target enter data nowait map(alloc: x[0:10],c)
+// CHECK-NEXT: #pragma omp target enter data nowait map(to: c) map(alloc: d)
+// CHECK-NEXT: #pragma omp target enter data nowait map(always,alloc: e)
 // CHECK: template  T tmain(T argc, T *argv) {
 // CHECK-NEXT: T i, j, b, c, d, e, x[20];
 // CHECK-NEXT: i = argc;
@@ -63,6 +95,14 @@
 // CHECK-NEXT: #pragma omp target enter data map(alloc: x[0:10],c)
 // CHECK-NEXT: #pragma omp target enter data map(to: c) map(alloc: d)
 // CHECK-NEXT: #pragma omp target enter data map(always,alloc: e)
+// CHECK-NEXT: #pragma omp target enter data nowait map(to: i)
+// CHECK-NEXT: #pragma omp target enter data nowait map(to: i) if(target enter data: j > 0)
+// CHECK-NEXT: #pragma omp target enter data map(to: i) if(b) nowait
+// CHECK-NEXT: #pragma omp target enter data map(to: c) nowait
+// CHECK-NEXT: #pragma omp target enter data map(to: c) nowait if(b > e)
+// CHECK-NEXT: #pragma omp target enter data nowait map(alloc: x[0:10],c)
+// CHECK-NEXT: #pragma omp target enter data nowait map(to: c) map(alloc: d)
+// CHECK-NEXT: #pragma omp target enter data nowait map(always,alloc: e)
 
 int main (int argc, char **argv) {
   int b = argc, c, d, e, f, g, x[20];
@@ -94,6 +134,30 @@
 #pragma omp target enter data map(always,alloc: e)
 // CHECK-NEXT: #pragma omp target enter data map(always,alloc: e)
 
+#pragma omp target enter data nowait map(to: a)
+// CHECK:  #pragma omp target enter data nowait map(to: a)
+
+#pragma omp target enter data nowait map(to: a) if (target enter data: b)
+// CHECK: #pragma omp target enter data 

r258457 - [OpenMP] Parsing + Sema for nowait clause on target enter data directive.

2016-01-21 Thread Arpith Chacko Jacob via cfe-commits
Author: arpith
Date: Thu Jan 21 18:03:50 2016
New Revision: 258457

URL: http://llvm.org/viewvc/llvm-project?rev=258457&view=rev
Log:
[OpenMP] Parsing + Sema for nowait clause on target enter data directive.

Summary:
Accept nowait clause on target enter data directive in sema and add test cases.

Reviewers: ABataev

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


Added:
cfe/trunk/test/OpenMP/target_enter_data_nowait_messages.cpp
Modified:
cfe/trunk/include/clang/Basic/OpenMPKinds.def
cfe/trunk/test/OpenMP/target_enter_data_ast_print.cpp

Modified: cfe/trunk/include/clang/Basic/OpenMPKinds.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/OpenMPKinds.def?rev=258457&r1=258456&r2=258457&view=diff
==
--- cfe/trunk/include/clang/Basic/OpenMPKinds.def (original)
+++ cfe/trunk/include/clang/Basic/OpenMPKinds.def Thu Jan 21 18:03:50 2016
@@ -368,6 +368,7 @@ OPENMP_TARGET_DATA_CLAUSE(map)
 OPENMP_TARGET_ENTER_DATA_CLAUSE(if)
 OPENMP_TARGET_ENTER_DATA_CLAUSE(device)
 OPENMP_TARGET_ENTER_DATA_CLAUSE(map)
+OPENMP_TARGET_ENTER_DATA_CLAUSE(nowait)
 
 // Clauses allowed for OpenMP directive 'target exit data'.
 // TODO More clauses for 'target exit data' directive.

Modified: cfe/trunk/test/OpenMP/target_enter_data_ast_print.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_enter_data_ast_print.cpp?rev=258457&r1=258456&r2=258457&view=diff
==
--- cfe/trunk/test/OpenMP/target_enter_data_ast_print.cpp (original)
+++ cfe/trunk/test/OpenMP/target_enter_data_ast_print.cpp Thu Jan 21 18:03:50 
2016
@@ -27,6 +27,22 @@ T tmain(T argc, T *argv) {
 
 #pragma omp target enter data map(always,alloc: e)
 
+#pragma omp target enter data nowait map(to: i)
+
+#pragma omp target enter data nowait map(to: i) if (target enter data: j > 0)
+
+#pragma omp target enter data map(to: i) if (b) nowait
+
+#pragma omp target enter data map(to: c) nowait
+
+#pragma omp target enter data map(to: c) nowait if(b>e)
+
+#pragma omp target enter data nowait map(alloc: x[0:10], c)
+
+#pragma omp target enter data nowait map(to: c) map(alloc: d)
+
+#pragma omp target enter data nowait map(always,alloc: e)
+
   return 0;
 }
 
@@ -41,6 +57,14 @@ T tmain(T argc, T *argv) {
 // CHECK-NEXT: #pragma omp target enter data map(alloc: x[0:10],c)
 // CHECK-NEXT: #pragma omp target enter data map(to: c) map(alloc: d)
 // CHECK-NEXT: #pragma omp target enter data map(always,alloc: e)
+// CHECK-NEXT: #pragma omp target enter data nowait map(to: i)
+// CHECK-NEXT: #pragma omp target enter data nowait map(to: i) if(target enter 
data: j > 0)
+// CHECK-NEXT: #pragma omp target enter data map(to: i) if(b) nowait
+// CHECK-NEXT: #pragma omp target enter data map(to: c) nowait
+// CHECK-NEXT: #pragma omp target enter data map(to: c) nowait if(b > e)
+// CHECK-NEXT: #pragma omp target enter data nowait map(alloc: x[0:10],c)
+// CHECK-NEXT: #pragma omp target enter data nowait map(to: c) map(alloc: d)
+// CHECK-NEXT: #pragma omp target enter data nowait map(always,alloc: e)
 // CHECK: template  char tmain(char argc, char 
*argv) {
 // CHECK-NEXT: char i, j, b, c, d, e, x[20];
 // CHECK-NEXT: i = argc;
@@ -52,6 +76,14 @@ T tmain(T argc, T *argv) {
 // CHECK-NEXT: #pragma omp target enter data map(alloc: x[0:10],c)
 // CHECK-NEXT: #pragma omp target enter data map(to: c) map(alloc: d)
 // CHECK-NEXT: #pragma omp target enter data map(always,alloc: e)
+// CHECK-NEXT: #pragma omp target enter data nowait map(to: i)
+// CHECK-NEXT: #pragma omp target enter data nowait map(to: i) if(target enter 
data: j > 0)
+// CHECK-NEXT: #pragma omp target enter data map(to: i) if(b) nowait
+// CHECK-NEXT: #pragma omp target enter data map(to: c) nowait
+// CHECK-NEXT: #pragma omp target enter data map(to: c) nowait if(b > e)
+// CHECK-NEXT: #pragma omp target enter data nowait map(alloc: x[0:10],c)
+// CHECK-NEXT: #pragma omp target enter data nowait map(to: c) map(alloc: d)
+// CHECK-NEXT: #pragma omp target enter data nowait map(always,alloc: e)
 // CHECK: template  T tmain(T argc, T *argv) {
 // CHECK-NEXT: T i, j, b, c, d, e, x[20];
 // CHECK-NEXT: i = argc;
@@ -63,6 +95,14 @@ T tmain(T argc, T *argv) {
 // CHECK-NEXT: #pragma omp target enter data map(alloc: x[0:10],c)
 // CHECK-NEXT: #pragma omp target enter data map(to: c) map(alloc: d)
 // CHECK-NEXT: #pragma omp target enter data map(always,alloc: e)
+// CHECK-NEXT: #pragma omp target enter data nowait map(to: i)
+// CHECK-NEXT: #pragma omp target enter data nowait map(to: i) if(target enter 
data: j > 0)
+// CHECK-NEXT: #pragma omp target enter data map(to: i) if(b) nowait
+// CHECK-NEXT: #pragma omp target enter data map(to: c) nowait
+// CHECK-NEXT: #pragma omp target enter data map(to: c) nowait if(b > e)
+// CHECK-NEXT: #pragma omp target enter data nowait map(alloc: x[0:10],c)
+// CHECK-NEXT: #pragma omp target

Re: [PATCH] D16362: [OpenMP] Parsing + Sema for nowait clause on target exit data directive.

2016-01-21 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL258459: [OpenMP] Parsing + Sema for nowait clause on target 
exit data directive. (authored by arpith).

Changed prior to commit:
  http://reviews.llvm.org/D16362?vs=45410&id=45614#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D16362

Files:
  cfe/trunk/include/clang/Basic/OpenMPKinds.def
  cfe/trunk/test/OpenMP/target_exit_data_ast_print.cpp
  cfe/trunk/test/OpenMP/target_exit_data_nowait_messages.cpp

Index: cfe/trunk/include/clang/Basic/OpenMPKinds.def
===
--- cfe/trunk/include/clang/Basic/OpenMPKinds.def
+++ cfe/trunk/include/clang/Basic/OpenMPKinds.def
@@ -375,6 +375,7 @@
 OPENMP_TARGET_EXIT_DATA_CLAUSE(if)
 OPENMP_TARGET_EXIT_DATA_CLAUSE(device)
 OPENMP_TARGET_EXIT_DATA_CLAUSE(map)
+OPENMP_TARGET_EXIT_DATA_CLAUSE(nowait)
 
 // Clauses allowed for OpenMP directive 'teams'.
 // TODO More clauses for 'teams' directive.
Index: cfe/trunk/test/OpenMP/target_exit_data_ast_print.cpp
===
--- cfe/trunk/test/OpenMP/target_exit_data_ast_print.cpp
+++ cfe/trunk/test/OpenMP/target_exit_data_ast_print.cpp
@@ -27,6 +27,22 @@
 
 #pragma omp target exit data map(always,release: e)
 
+#pragma omp target exit data nowait map(from: i)
+
+#pragma omp target exit data nowait map(from: i) if (target exit data: j > 0)
+
+#pragma omp target exit data map(from: i) if (b) nowait
+
+#pragma omp target exit data map(from: c) nowait
+
+#pragma omp target exit data map(from: c) nowait if(b>e)
+
+#pragma omp target exit data nowait map(release: x[0:10], c)
+
+#pragma omp target exit data nowait map(from: c) map(release: d)
+
+#pragma omp target exit data nowait map(always,release: e)
+
   return 0;
 }
 
@@ -41,6 +57,14 @@
 // CHECK-NEXT: #pragma omp target exit data map(release: x[0:10],c)
 // CHECK-NEXT: #pragma omp target exit data map(from: c) map(release: d)
 // CHECK-NEXT: #pragma omp target exit data map(always,release: e)
+// CHECK-NEXT: #pragma omp target exit data nowait map(from: i)
+// CHECK-NEXT: #pragma omp target exit data nowait map(from: i) if(target exit data: j > 0)
+// CHECK-NEXT: #pragma omp target exit data map(from: i) if(b) nowait
+// CHECK-NEXT: #pragma omp target exit data map(from: c) nowait
+// CHECK-NEXT: #pragma omp target exit data map(from: c) nowait if(b > e)
+// CHECK-NEXT: #pragma omp target exit data nowait map(release: x[0:10],c)
+// CHECK-NEXT: #pragma omp target exit data nowait map(from: c) map(release: d)
+// CHECK-NEXT: #pragma omp target exit data nowait map(always,release: e)
 // CHECK: template  char tmain(char argc, char *argv) {
 // CHECK-NEXT: char i, j, b, c, d, e, x[20];
 // CHECK-NEXT: i = argc;
@@ -52,6 +76,14 @@
 // CHECK-NEXT: #pragma omp target exit data map(release: x[0:10],c)
 // CHECK-NEXT: #pragma omp target exit data map(from: c) map(release: d)
 // CHECK-NEXT: #pragma omp target exit data map(always,release: e)
+// CHECK-NEXT: #pragma omp target exit data nowait map(from: i)
+// CHECK-NEXT: #pragma omp target exit data nowait map(from: i) if(target exit data: j > 0)
+// CHECK-NEXT: #pragma omp target exit data map(from: i) if(b) nowait
+// CHECK-NEXT: #pragma omp target exit data map(from: c) nowait
+// CHECK-NEXT: #pragma omp target exit data map(from: c) nowait if(b > e)
+// CHECK-NEXT: #pragma omp target exit data nowait map(release: x[0:10],c)
+// CHECK-NEXT: #pragma omp target exit data nowait map(from: c) map(release: d)
+// CHECK-NEXT: #pragma omp target exit data nowait map(always,release: e)
 // CHECK: template  T tmain(T argc, T *argv) {
 // CHECK-NEXT: T i, j, b, c, d, e, x[20];
 // CHECK-NEXT: i = argc;
@@ -63,6 +95,14 @@
 // CHECK-NEXT: #pragma omp target exit data map(release: x[0:10],c)
 // CHECK-NEXT: #pragma omp target exit data map(from: c) map(release: d)
 // CHECK-NEXT: #pragma omp target exit data map(always,release: e)
+// CHECK-NEXT: #pragma omp target exit data nowait map(from: i)
+// CHECK-NEXT: #pragma omp target exit data nowait map(from: i) if(target exit data: j > 0)
+// CHECK-NEXT: #pragma omp target exit data map(from: i) if(b) nowait
+// CHECK-NEXT: #pragma omp target exit data map(from: c) nowait
+// CHECK-NEXT: #pragma omp target exit data map(from: c) nowait if(b > e)
+// CHECK-NEXT: #pragma omp target exit data nowait map(release: x[0:10],c)
+// CHECK-NEXT: #pragma omp target exit data nowait map(from: c) map(release: d)
+// CHECK-NEXT: #pragma omp target exit data nowait map(always,release: e)
 
 int main (int argc, char **argv) {
   int b = argc, c, d, e, f, g, x[20];
@@ -94,6 +134,30 @@
 #pragma omp target exit data map(always,release: e)
 // CHECK-NEXT: #pragma omp target exit data map(always,release: e)
 
+#pragma omp target exit data nowait map(from: a)
+// CHECK:  #pragma omp target exit data nowait map(from: a)
+
+#pragma omp target exit data nowait map(from: a) if (target exit data: b)
+// CHECK: #pragm

r258459 - [OpenMP] Parsing + Sema for nowait clause on target exit data directive.

2016-01-21 Thread Arpith Chacko Jacob via cfe-commits
Author: arpith
Date: Thu Jan 21 18:22:05 2016
New Revision: 258459

URL: http://llvm.org/viewvc/llvm-project?rev=258459&view=rev
Log:
[OpenMP] Parsing + Sema for nowait clause on target exit data directive.

Summary:
Accept nowait clause on target exit data directive in sema and add test cases.

Reviewers: ABataev

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


Added:
cfe/trunk/test/OpenMP/target_exit_data_nowait_messages.cpp
Modified:
cfe/trunk/include/clang/Basic/OpenMPKinds.def
cfe/trunk/test/OpenMP/target_exit_data_ast_print.cpp

Modified: cfe/trunk/include/clang/Basic/OpenMPKinds.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/OpenMPKinds.def?rev=258459&r1=258458&r2=258459&view=diff
==
--- cfe/trunk/include/clang/Basic/OpenMPKinds.def (original)
+++ cfe/trunk/include/clang/Basic/OpenMPKinds.def Thu Jan 21 18:22:05 2016
@@ -375,6 +375,7 @@ OPENMP_TARGET_ENTER_DATA_CLAUSE(nowait)
 OPENMP_TARGET_EXIT_DATA_CLAUSE(if)
 OPENMP_TARGET_EXIT_DATA_CLAUSE(device)
 OPENMP_TARGET_EXIT_DATA_CLAUSE(map)
+OPENMP_TARGET_EXIT_DATA_CLAUSE(nowait)
 
 // Clauses allowed for OpenMP directive 'teams'.
 // TODO More clauses for 'teams' directive.

Modified: cfe/trunk/test/OpenMP/target_exit_data_ast_print.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_exit_data_ast_print.cpp?rev=258459&r1=258458&r2=258459&view=diff
==
--- cfe/trunk/test/OpenMP/target_exit_data_ast_print.cpp (original)
+++ cfe/trunk/test/OpenMP/target_exit_data_ast_print.cpp Thu Jan 21 18:22:05 
2016
@@ -27,6 +27,22 @@ T tmain(T argc, T *argv) {
 
 #pragma omp target exit data map(always,release: e)
 
+#pragma omp target exit data nowait map(from: i)
+
+#pragma omp target exit data nowait map(from: i) if (target exit data: j > 0)
+
+#pragma omp target exit data map(from: i) if (b) nowait
+
+#pragma omp target exit data map(from: c) nowait
+
+#pragma omp target exit data map(from: c) nowait if(b>e)
+
+#pragma omp target exit data nowait map(release: x[0:10], c)
+
+#pragma omp target exit data nowait map(from: c) map(release: d)
+
+#pragma omp target exit data nowait map(always,release: e)
+
   return 0;
 }
 
@@ -41,6 +57,14 @@ T tmain(T argc, T *argv) {
 // CHECK-NEXT: #pragma omp target exit data map(release: x[0:10],c)
 // CHECK-NEXT: #pragma omp target exit data map(from: c) map(release: d)
 // CHECK-NEXT: #pragma omp target exit data map(always,release: e)
+// CHECK-NEXT: #pragma omp target exit data nowait map(from: i)
+// CHECK-NEXT: #pragma omp target exit data nowait map(from: i) if(target exit 
data: j > 0)
+// CHECK-NEXT: #pragma omp target exit data map(from: i) if(b) nowait
+// CHECK-NEXT: #pragma omp target exit data map(from: c) nowait
+// CHECK-NEXT: #pragma omp target exit data map(from: c) nowait if(b > e)
+// CHECK-NEXT: #pragma omp target exit data nowait map(release: x[0:10],c)
+// CHECK-NEXT: #pragma omp target exit data nowait map(from: c) map(release: d)
+// CHECK-NEXT: #pragma omp target exit data nowait map(always,release: e)
 // CHECK: template  char tmain(char argc, char 
*argv) {
 // CHECK-NEXT: char i, j, b, c, d, e, x[20];
 // CHECK-NEXT: i = argc;
@@ -52,6 +76,14 @@ T tmain(T argc, T *argv) {
 // CHECK-NEXT: #pragma omp target exit data map(release: x[0:10],c)
 // CHECK-NEXT: #pragma omp target exit data map(from: c) map(release: d)
 // CHECK-NEXT: #pragma omp target exit data map(always,release: e)
+// CHECK-NEXT: #pragma omp target exit data nowait map(from: i)
+// CHECK-NEXT: #pragma omp target exit data nowait map(from: i) if(target exit 
data: j > 0)
+// CHECK-NEXT: #pragma omp target exit data map(from: i) if(b) nowait
+// CHECK-NEXT: #pragma omp target exit data map(from: c) nowait
+// CHECK-NEXT: #pragma omp target exit data map(from: c) nowait if(b > e)
+// CHECK-NEXT: #pragma omp target exit data nowait map(release: x[0:10],c)
+// CHECK-NEXT: #pragma omp target exit data nowait map(from: c) map(release: d)
+// CHECK-NEXT: #pragma omp target exit data nowait map(always,release: e)
 // CHECK: template  T tmain(T argc, T *argv) {
 // CHECK-NEXT: T i, j, b, c, d, e, x[20];
 // CHECK-NEXT: i = argc;
@@ -63,6 +95,14 @@ T tmain(T argc, T *argv) {
 // CHECK-NEXT: #pragma omp target exit data map(release: x[0:10],c)
 // CHECK-NEXT: #pragma omp target exit data map(from: c) map(release: d)
 // CHECK-NEXT: #pragma omp target exit data map(always,release: e)
+// CHECK-NEXT: #pragma omp target exit data nowait map(from: i)
+// CHECK-NEXT: #pragma omp target exit data nowait map(from: i) if(target exit 
data: j > 0)
+// CHECK-NEXT: #pragma omp target exit data map(from: i) if(b) nowait
+// CHECK-NEXT: #pragma omp target exit data map(from: c) nowait
+// CHECK-NEXT: #pragma omp target exit data map(from: c) nowait if(b > e)
+// CHECK-NEXT: #pragma omp target exit data nowait map(release: x[0:10],c)
+// CHECK-N

Re: [PATCH] D16375: [OpenMP] Sema for depend clause on target directive.

2016-01-21 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL258460: [OpenMP] Sema for depend clause on target directive. 
(authored by arpith).

Changed prior to commit:
  http://reviews.llvm.org/D16375?vs=45447&id=45616#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D16375

Files:
  cfe/trunk/include/clang/Basic/OpenMPKinds.def
  cfe/trunk/test/OpenMP/target_ast_print.cpp
  cfe/trunk/test/OpenMP/target_depend_messages.cpp

Index: cfe/trunk/include/clang/Basic/OpenMPKinds.def
===
--- cfe/trunk/include/clang/Basic/OpenMPKinds.def
+++ cfe/trunk/include/clang/Basic/OpenMPKinds.def
@@ -356,6 +356,7 @@
 OPENMP_TARGET_CLAUSE(map)
 OPENMP_TARGET_CLAUSE(private)
 OPENMP_TARGET_CLAUSE(nowait)
+OPENMP_TARGET_CLAUSE(depend)
 
 // Clauses allowed for OpenMP directive 'target data'.
 // TODO More clauses for 'target data' directive.
Index: cfe/trunk/test/OpenMP/target_ast_print.cpp
===
--- cfe/trunk/test/OpenMP/target_ast_print.cpp
+++ cfe/trunk/test/OpenMP/target_ast_print.cpp
@@ -27,6 +27,8 @@
   foo();
 #pragma omp target nowait
   foo();
+#pragma omp target depend(in : argc, argv[i:argc], a[:])
+  foo();
   return 0;
 }
 
@@ -48,6 +50,8 @@
 // CHECK-NEXT: foo()
 // CHECK-NEXT: #pragma omp target nowait
 // CHECK-NEXT: foo()
+// CHECK-NEXT: #pragma omp target depend(in : argc,argv[i:argc],a[:])
+// CHECK-NEXT: foo()
 // CHECK: template  char tmain(char argc, char *argv) {
 // CHECK-NEXT: char i, j, a[20]
 // CHECK-NEXT: #pragma omp target
@@ -66,6 +70,8 @@
 // CHECK-NEXT: foo()
 // CHECK-NEXT: #pragma omp target nowait
 // CHECK-NEXT: foo()
+// CHECK-NEXT: #pragma omp target depend(in : argc,argv[i:argc],a[:])
+// CHECK-NEXT: foo()
 // CHECK: template  T tmain(T argc, T *argv) {
 // CHECK-NEXT: T i, j, a[20]
 // CHECK-NEXT: #pragma omp target
@@ -84,6 +90,8 @@
 // CHECK-NEXT: foo()
 // CHECK-NEXT: #pragma omp target nowait
 // CHECK-NEXT: foo()
+// CHECK-NEXT: #pragma omp target depend(in : argc,argv[i:argc],a[:])
+// CHECK-NEXT: foo()
 
 // CHECK-LABEL: int main(int argc, char **argv) {
 int main (int argc, char **argv) {
@@ -128,6 +136,11 @@
   foo();
 // CHECK-NEXT: foo();
 
+#pragma omp target depend(in : argc, argv[i:argc], a[:])
+// CHECK-NEXT: #pragma omp target depend(in : argc,argv[i:argc],a[:])
+  foo();
+// CHECK-NEXT: foo();
+
   return tmain(argc, &argc) + tmain(argv[0][0], argv[0]);
 }
 
Index: cfe/trunk/test/OpenMP/target_depend_messages.cpp
===
--- cfe/trunk/test/OpenMP/target_depend_messages.cpp
+++ cfe/trunk/test/OpenMP/target_depend_messages.cpp
@@ -0,0 +1,89 @@
+// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -o - -std=c++11 %s
+
+void foo() {
+}
+
+bool foobool(int argc) {
+  return argc;
+}
+
+struct S1; // expected-note {{declared here}}
+
+class vector {
+  public:
+int operator[](int index) { return 0; }
+};
+
+int main(int argc, char **argv, char *env[]) {
+  vector vec;
+  typedef float V __attribute__((vector_size(16)));
+  V a;
+  auto arr = x; // expected-error {{use of undeclared identifier 'x'}}
+
+  #pragma omp target depend // expected-error {{expected '(' after 'depend'}}
+  foo();
+  #pragma omp target depend ( // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}} expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after dependency type - ignoring}}
+  foo();
+  #pragma omp target depend () // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}}
+  foo();
+  #pragma omp target depend (argc // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} expected-error {{expected ')'}} expected-note {{to match this '('}}
+  foo();
+  #pragma omp target depend (source : argc) // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}}
+  foo();
+  #pragma omp target depend (source) // expected-error {{expected expression}} expected-warning {{missing ':' after dependency type - ignoring}}
+  foo();
+  #pragma omp target depend (in : argc)) // expected-warning {{extra tokens at the end of '#pragma omp target' are ignored}}
+  foo();
+  #pragma omp target depend (out: ) // expected-error {{expected expression}}
+  foo();
+  #pragma omp target depend (inout : foobool(argc)), depend (in, argc) // expected-error {{expected variable name, array element or array section}} expected-warning {{missing ':' after dependency type - ignoring}} expected-error {{expected expression}}
+  foo();
+  #pragma omp target depend (out :S1) // expected-error {{'S1' does not refer to a value}}
+  foo();
+  #pragma omp target depend(in : argv[1][1] = '2') // expected-error {{expected variable name, array element or 

r258460 - [OpenMP] Sema for depend clause on target directive.

2016-01-21 Thread Arpith Chacko Jacob via cfe-commits
Author: arpith
Date: Thu Jan 21 18:49:21 2016
New Revision: 258460

URL: http://llvm.org/viewvc/llvm-project?rev=258460&view=rev
Log:
[OpenMP] Sema for depend clause on target directive.

Summary:
Accept depend clause on target directive in sema and add test cases.

Reviewers: ABataev

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


Added:
cfe/trunk/test/OpenMP/target_depend_messages.cpp
Modified:
cfe/trunk/include/clang/Basic/OpenMPKinds.def
cfe/trunk/test/OpenMP/target_ast_print.cpp

Modified: cfe/trunk/include/clang/Basic/OpenMPKinds.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/OpenMPKinds.def?rev=258460&r1=258459&r2=258460&view=diff
==
--- cfe/trunk/include/clang/Basic/OpenMPKinds.def (original)
+++ cfe/trunk/include/clang/Basic/OpenMPKinds.def Thu Jan 21 18:49:21 2016
@@ -356,6 +356,7 @@ OPENMP_TARGET_CLAUSE(device)
 OPENMP_TARGET_CLAUSE(map)
 OPENMP_TARGET_CLAUSE(private)
 OPENMP_TARGET_CLAUSE(nowait)
+OPENMP_TARGET_CLAUSE(depend)
 
 // Clauses allowed for OpenMP directive 'target data'.
 // TODO More clauses for 'target data' directive.

Modified: cfe/trunk/test/OpenMP/target_ast_print.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_ast_print.cpp?rev=258460&r1=258459&r2=258460&view=diff
==
--- cfe/trunk/test/OpenMP/target_ast_print.cpp (original)
+++ cfe/trunk/test/OpenMP/target_ast_print.cpp Thu Jan 21 18:49:21 2016
@@ -27,6 +27,8 @@ T tmain(T argc, T *argv) {
   foo();
 #pragma omp target nowait
   foo();
+#pragma omp target depend(in : argc, argv[i:argc], a[:])
+  foo();
   return 0;
 }
 
@@ -48,6 +50,8 @@ T tmain(T argc, T *argv) {
 // CHECK-NEXT: foo()
 // CHECK-NEXT: #pragma omp target nowait
 // CHECK-NEXT: foo()
+// CHECK-NEXT: #pragma omp target depend(in : argc,argv[i:argc],a[:])
+// CHECK-NEXT: foo()
 // CHECK: template  char tmain(char argc, char 
*argv) {
 // CHECK-NEXT: char i, j, a[20]
 // CHECK-NEXT: #pragma omp target
@@ -66,6 +70,8 @@ T tmain(T argc, T *argv) {
 // CHECK-NEXT: foo()
 // CHECK-NEXT: #pragma omp target nowait
 // CHECK-NEXT: foo()
+// CHECK-NEXT: #pragma omp target depend(in : argc,argv[i:argc],a[:])
+// CHECK-NEXT: foo()
 // CHECK: template  T tmain(T argc, T *argv) {
 // CHECK-NEXT: T i, j, a[20]
 // CHECK-NEXT: #pragma omp target
@@ -84,6 +90,8 @@ T tmain(T argc, T *argv) {
 // CHECK-NEXT: foo()
 // CHECK-NEXT: #pragma omp target nowait
 // CHECK-NEXT: foo()
+// CHECK-NEXT: #pragma omp target depend(in : argc,argv[i:argc],a[:])
+// CHECK-NEXT: foo()
 
 // CHECK-LABEL: int main(int argc, char **argv) {
 int main (int argc, char **argv) {
@@ -128,6 +136,11 @@ int main (int argc, char **argv) {
   foo();
 // CHECK-NEXT: foo();
 
+#pragma omp target depend(in : argc, argv[i:argc], a[:])
+// CHECK-NEXT: #pragma omp target depend(in : argc,argv[i:argc],a[:])
+  foo();
+// CHECK-NEXT: foo();
+
   return tmain(argc, &argc) + tmain(argv[0][0], argv[0]);
 }
 

Added: cfe/trunk/test/OpenMP/target_depend_messages.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_depend_messages.cpp?rev=258460&view=auto
==
--- cfe/trunk/test/OpenMP/target_depend_messages.cpp (added)
+++ cfe/trunk/test/OpenMP/target_depend_messages.cpp Thu Jan 21 18:49:21 2016
@@ -0,0 +1,89 @@
+// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -o - -std=c++11 %s
+
+void foo() {
+}
+
+bool foobool(int argc) {
+  return argc;
+}
+
+struct S1; // expected-note {{declared here}}
+
+class vector {
+  public:
+int operator[](int index) { return 0; }
+};
+
+int main(int argc, char **argv, char *env[]) {
+  vector vec;
+  typedef float V __attribute__((vector_size(16)));
+  V a;
+  auto arr = x; // expected-error {{use of undeclared identifier 'x'}}
+
+  #pragma omp target depend // expected-error {{expected '(' after 'depend'}}
+  foo();
+  #pragma omp target depend ( // expected-error {{expected 'in', 'out' or 
'inout' in OpenMP clause 'depend'}} expected-error {{expected ')'}} 
expected-note {{to match this '('}} expected-warning {{missing ':' after 
dependency type - ignoring}}
+  foo();
+  #pragma omp target depend () // expected-error {{expected 'in', 'out' or 
'inout' in OpenMP clause 'depend'}} expected-warning {{missing ':' after 
dependency type - ignoring}}
+  foo();
+  #pragma omp target depend (argc // expected-error {{expected 'in', 'out' or 
'inout' in OpenMP clause 'depend'}} expected-warning {{missing ':' after 
dependency type - ignoring}} expected-error {{expected ')'}} expected-note {{to 
match this '('}}
+  foo();
+  #pragma omp target depend (source : argc) // expected-error {{expected 'in', 
'out' or 'inout' in OpenMP clause 'depend'}}
+  foo();
+  #pragma omp target depend (source) // expected-error {{expected expression}} 
expected-warning {{missing ':' after de

r258461 - [analyzer] Suppress nullability warning for defensive super initializer idiom.

2016-01-21 Thread Devin Coughlin via cfe-commits
Author: dcoughlin
Date: Thu Jan 21 19:01:11 2016
New Revision: 258461

URL: http://llvm.org/viewvc/llvm-project?rev=258461&view=rev
Log:
[analyzer] Suppress nullability warning for defensive super initializer idiom.

A common idiom in Objective-C initializers is for a defensive nil-check on the
result of a call to a super initializer:
  if (self = [super init]) {
 ...
  }
  return self;

To avoid warning on this idiom, the nullability checker now suppress diagnostics
for returns of nil on syntactic 'return self' even in initializers with non-null
return types.

Modified:
cfe/trunk/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
cfe/trunk/test/Analysis/nullability.mm

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp?rev=258461&r1=258460&r2=258461&view=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp Thu Jan 21 
19:01:11 2016
@@ -470,6 +470,22 @@ static const Expr *lookThroughImplicitCa
   return E;
 }
 
+/// Returns true when the return statement is a syntactic 'return self' in
+/// Objective-C.
+static bool isReturnSelf(const ReturnStmt *RS, CheckerContext &C) {
+  const ImplicitParamDecl *SelfDecl =
+C.getCurrentAnalysisDeclContext()->getSelfDecl();
+  if (!SelfDecl)
+return false;
+
+  const Expr *ReturnExpr = lookThroughImplicitCasts(RS->getRetValue());
+  auto *RefExpr = dyn_cast(ReturnExpr);
+  if (!RefExpr)
+return false;
+
+  return RefExpr->getDecl() == SelfDecl;
+}
+
 /// This method check when nullable pointer or null value is returned from a
 /// function that has nonnull return type.
 ///
@@ -494,16 +510,28 @@ void NullabilityChecker::checkPreStmt(co
   if (!RetSVal)
 return;
 
+  bool IsReturnSelfInObjCInit = false;
+
   QualType RequiredRetType;
   AnalysisDeclContext *DeclCtxt =
   C.getLocationContext()->getAnalysisDeclContext();
   const Decl *D = DeclCtxt->getDecl();
-  if (auto *MD = dyn_cast(D))
+  if (auto *MD = dyn_cast(D)) {
 RequiredRetType = MD->getReturnType();
-  else if (auto *FD = dyn_cast(D))
+// Suppress diagnostics for returns of nil that are syntactic returns of
+// self in ObjC initializers. This avoids warning under the common idiom of
+// a defensive check of the result of a call to super:
+//   if (self = [super init]) {
+// ...
+//   }
+//   return self; // no-warning
+IsReturnSelfInObjCInit = (MD->getMethodFamily() == OMF_init) &&
+  isReturnSelf(S, C);
+  } else if (auto *FD = dyn_cast(D)) {
 RequiredRetType = FD->getReturnType();
-  else
+  } else {
 return;
+  }
 
   NullConstraint Nullness = getNullConstraint(*RetSVal, State);
 
@@ -520,7 +548,8 @@ void NullabilityChecker::checkPreStmt(co
   if (Filter.CheckNullReturnedFromNonnull &&
   Nullness == NullConstraint::IsNull &&
   RetExprTypeLevelNullability != Nullability::Nonnull &&
-  RequiredNullability == Nullability::Nonnull) {
+  RequiredNullability == Nullability::Nonnull &&
+  !IsReturnSelfInObjCInit) {
 static CheckerProgramPointTag Tag(this, "NullReturnedFromNonnull");
 ExplodedNode *N = C.generateErrorNode(State, &Tag);
 if (!N)

Modified: cfe/trunk/test/Analysis/nullability.mm
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/nullability.mm?rev=258461&r1=258460&r2=258461&view=diff
==
--- cfe/trunk/test/Analysis/nullability.mm (original)
+++ cfe/trunk/test/Analysis/nullability.mm Thu Jan 21 19:01:11 2016
@@ -1,4 +1,5 @@
 // RUN: %clang_cc1 -fobjc-arc -analyze -analyzer-checker=core,nullability 
-verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,nullability -verify %s
 
 #define nil 0
 #define BOOL int
@@ -279,10 +280,21 @@ Dummy *_Nonnull testDefensiveInlineCheck
   return p;
 }
 
-@interface SomeClass : NSObject
+
+@interface SomeClass : NSObject {
+  int instanceVar;
+}
 @end
 
 @implementation SomeClass (MethodReturn)
+- (id)initWithSomething:(int)i {
+  if (self = [super init]) {
+instanceVar = i;
+  }
+
+  return self;
+}
+
 - (TestObject * _Nonnull)testReturnsNullableInNonnullIndirectly {
   TestObject *local = getNullableTestObject();
   return local; // expected-warning {{Nullable pointer is returned from a 
function that is expected to return a non-null value}}
@@ -301,3 +313,41 @@ Dummy *_Nonnull testDefensiveInlineCheck
 return p; // no-warning
 }
 @end
+
+@interface ClassWithInitializers : NSObject
+@end
+
+@implementation ClassWithInitializers
+- (instancetype _Nonnull)initWithNonnullReturnAndSelfCheckingIdiom {
+  // This defensive check is a common-enough idiom that we filter don't want
+  // to issue a diagnostic for it,
+  if (self = [super ini

[libcxx] r258463 - Merging r258217:

2016-01-21 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Thu Jan 21 19:08:10 2016
New Revision: 258463

URL: http://llvm.org/viewvc/llvm-project?rev=258463&view=rev
Log:
Merging r258217:

r258217 | ericwf | 2016-01-19 16:06:29 -0700 (Tue, 19 Jan 2016) | 1 line

Fix enviroment variables when running shell scripts


Modified:
libcxx/branches/release_38/test/libcxx/test/config.py

Modified: libcxx/branches/release_38/test/libcxx/test/config.py
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/branches/release_38/test/libcxx/test/config.py?rev=258463&r1=258462&r2=258463&view=diff
==
--- libcxx/branches/release_38/test/libcxx/test/config.py (original)
+++ libcxx/branches/release_38/test/libcxx/test/config.py Thu Jan 21 19:08:10 
2016
@@ -606,7 +606,7 @@ class Configuration(object):
 for k, v in self.env.items():
 exec_env_str += ' %s=%s' % (k, v)
 # Configure run env substitution.
-exec_str = ''
+exec_str = exec_env_str
 if self.lit_config.useValgrind:
 exec_str = ' '.join(self.lit_config.valgrindArgs) + exec_env_str
 sub.append(('%exec', exec_str))


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


  1   2   >