Re: [PATCH] D13336: [MSVC] 'property' with an empty array in array subscript expression.

2015-11-16 Thread Alexey Bataev via cfe-commits
ABataev updated this revision to Diff 40253.
ABataev marked 3 inline comments as done.
ABataev added a comment.

Update after review


http://reviews.llvm.org/D13336

Files:
  include/clang/AST/DataRecursiveASTVisitor.h
  include/clang/AST/ExprCXX.h
  include/clang/AST/RecursiveASTVisitor.h
  include/clang/Basic/StmtNodes.td
  include/clang/Serialization/ASTBitCodes.h
  lib/AST/Expr.cpp
  lib/AST/ExprClassification.cpp
  lib/AST/ExprConstant.cpp
  lib/AST/ItaniumMangle.cpp
  lib/AST/StmtPrinter.cpp
  lib/AST/StmtProfile.cpp
  lib/Sema/SemaExceptionSpec.cpp
  lib/Sema/SemaExpr.cpp
  lib/Sema/SemaPseudoObject.cpp
  lib/Sema/TreeTransform.h
  lib/Serialization/ASTReaderStmt.cpp
  lib/Serialization/ASTWriterStmt.cpp
  lib/StaticAnalyzer/Core/ExprEngine.cpp
  test/CodeGenCXX/ms-property.cpp
  test/SemaCXX/ms-property-error.cpp
  test/SemaCXX/ms-property.cpp
  tools/libclang/CXCursor.cpp

Index: lib/Serialization/ASTWriterStmt.cpp
===
--- lib/Serialization/ASTWriterStmt.cpp
+++ lib/Serialization/ASTWriterStmt.cpp
@@ -1668,6 +1668,14 @@
   Code = serialization::EXPR_CXX_PROPERTY_REF_EXPR;
 }
 
+void ASTStmtWriter::VisitMSPropertySubscriptExpr(MSPropertySubscriptExpr *E) {
+  VisitExpr(E);
+  Writer.AddStmt(E->getBase());
+  Writer.AddStmt(E->getIdx());
+  Writer.AddSourceLocation(E->getRBracketLoc(), Record);
+  Code = serialization::EXPR_CXX_PROPERTY_SUBSCRIPT_EXPR;
+}
+
 void ASTStmtWriter::VisitCXXUuidofExpr(CXXUuidofExpr *E) {
   VisitExpr(E);
   Writer.AddSourceRange(E->getSourceRange(), Record);
Index: lib/Serialization/ASTReaderStmt.cpp
===
--- lib/Serialization/ASTReaderStmt.cpp
+++ lib/Serialization/ASTReaderStmt.cpp
@@ -1641,6 +1641,13 @@
   E->TheDecl = ReadDeclAs(Record, Idx);
 }
 
+void ASTStmtReader::VisitMSPropertySubscriptExpr(MSPropertySubscriptExpr *E) {
+  VisitExpr(E);
+  E->setBase(Reader.ReadSubExpr());
+  E->setIdx(Reader.ReadSubExpr());
+  E->setRBracketLoc(ReadSourceLocation(Record, Idx));
+}
+
 void ASTStmtReader::VisitCXXUuidofExpr(CXXUuidofExpr *E) {
   VisitExpr(E);
   E->setSourceRange(ReadSourceRange(Record, Idx));
@@ -3037,6 +3044,9 @@
 case EXPR_CXX_PROPERTY_REF_EXPR:
   S = new (Context) MSPropertyRefExpr(Empty);
   break;
+case EXPR_CXX_PROPERTY_SUBSCRIPT_EXPR:
+  S = new (Context) MSPropertySubscriptExpr(Empty);
+  break;
 case EXPR_CXX_UUIDOF_TYPE:
   S = new (Context) CXXUuidofExpr(Empty, false);
   break;
Index: lib/StaticAnalyzer/Core/ExprEngine.cpp
===
--- lib/StaticAnalyzer/Core/ExprEngine.cpp
+++ lib/StaticAnalyzer/Core/ExprEngine.cpp
@@ -754,6 +754,7 @@
 case Stmt::CXXUuidofExprClass:
 case Stmt::CXXFoldExprClass:
 case Stmt::MSPropertyRefExprClass:
+case Stmt::MSPropertySubscriptExprClass:
 case Stmt::CXXUnresolvedConstructExprClass:
 case Stmt::DependentScopeDeclRefExprClass:
 case Stmt::ArrayTypeTraitExprClass:
Index: lib/AST/Expr.cpp
===
--- lib/AST/Expr.cpp
+++ lib/AST/Expr.cpp
@@ -2998,6 +2998,7 @@
 return true;
 
   case MSPropertyRefExprClass:
+  case MSPropertySubscriptExprClass:
   case CompoundAssignOperatorClass:
   case VAArgExprClass:
   case AtomicExprClass:
Index: lib/AST/StmtProfile.cpp
===
--- lib/AST/StmtProfile.cpp
+++ lib/AST/StmtProfile.cpp
@@ -1123,6 +1123,11 @@
   VisitDecl(S->getPropertyDecl());
 }
 
+void StmtProfiler::VisitMSPropertySubscriptExpr(
+const MSPropertySubscriptExpr *S) {
+  VisitExpr(S);
+}
+
 void StmtProfiler::VisitCXXThisExpr(const CXXThisExpr *S) {
   VisitExpr(S);
   ID.AddBoolean(S->isImplicit());
Index: lib/AST/StmtPrinter.cpp
===
--- lib/AST/StmtPrinter.cpp
+++ lib/AST/StmtPrinter.cpp
@@ -1715,6 +1715,13 @@
   OS << Node->getPropertyDecl()->getDeclName();
 }
 
+void StmtPrinter::VisitMSPropertySubscriptExpr(MSPropertySubscriptExpr *Node) {
+  PrintExpr(Node->getBase());
+  OS << "[";
+  PrintExpr(Node->getIdx());
+  OS << "]";
+}
+
 void StmtPrinter::VisitUserDefinedLiteral(UserDefinedLiteral *Node) {
   switch (Node->getLiteralOperatorKind()) {
   case UserDefinedLiteral::LOK_Raw:
Index: lib/AST/ItaniumMangle.cpp
===
--- lib/AST/ItaniumMangle.cpp
+++ lib/AST/ItaniumMangle.cpp
@@ -2809,6 +2809,7 @@
   case Expr::ParenListExprClass:
   case Expr::LambdaExprClass:
   case Expr::MSPropertyRefExprClass:
+  case Expr::MSPropertySubscriptExprClass:
   case Expr::TypoExprClass:  // This should no longer exist in the AST by now.
   case Expr::OMPArraySectionExprClass:
 llvm_unreachable("unexpected statement kind");
Index: lib/AST/ExprConstant.cpp
===
---

r253190 - [CGDebugInfo] Set the size and align for reference types

2015-11-16 Thread Keno Fischer via cfe-commits
Author: kfischer
Date: Mon Nov 16 03:04:13 2015
New Revision: 253190

URL: http://llvm.org/viewvc/llvm-project?rev=253190&view=rev
Log:
[CGDebugInfo] Set the size and align for reference types

In r253186, I changed the DIBuilder API to now take size and align
for reference types as well. This was done in preparation for upcoming
changes to the Verifier that will validate that sizes match between
DI types and IR values that are declared as having those types.
This updates clang to actually pass the information through.

Modified:
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
cfe/trunk/test/CodeGenCXX/debug-info-rvalue-ref.cpp

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=253190&r1=253189&r2=253190&view=diff
==
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Mon Nov 16 03:04:13 2015
@@ -712,10 +712,6 @@ llvm::DIType *CGDebugInfo::CreatePointer
  const Type *Ty,
  QualType PointeeTy,
  llvm::DIFile *Unit) {
-  if (Tag == llvm::dwarf::DW_TAG_reference_type ||
-  Tag == llvm::dwarf::DW_TAG_rvalue_reference_type)
-return DBuilder.createReferenceType(Tag, getOrCreateType(PointeeTy, Unit));
-
   // Bit size, align and offset of the type.
   // Size is always the size of a pointer. We can't use getTypeSize here
   // because that does not return the correct value for references.
@@ -723,8 +719,13 @@ llvm::DIType *CGDebugInfo::CreatePointer
   uint64_t Size = CGM.getTarget().getPointerWidth(AS);
   uint64_t Align = CGM.getContext().getTypeAlign(Ty);
 
-  return DBuilder.createPointerType(getOrCreateType(PointeeTy, Unit), Size,
-Align);
+  if (Tag == llvm::dwarf::DW_TAG_reference_type ||
+  Tag == llvm::dwarf::DW_TAG_rvalue_reference_type)
+return DBuilder.createReferenceType(Tag, getOrCreateType(PointeeTy, Unit),
+Size, Align);
+  else
+return DBuilder.createPointerType(getOrCreateType(PointeeTy, Unit), Size,
+  Align);
 }
 
 llvm::DIType *CGDebugInfo::getOrCreateStructPtrType(StringRef Name,

Modified: cfe/trunk/test/CodeGenCXX/debug-info-rvalue-ref.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-rvalue-ref.cpp?rev=253190&r1=253189&r2=253190&view=diff
==
--- cfe/trunk/test/CodeGenCXX/debug-info-rvalue-ref.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-rvalue-ref.cpp Mon Nov 16 03:04:13 2015
@@ -8,5 +8,5 @@ void foo (int &&i)
   printf("%d\n", i);
 }
 
-// CHECK: !DIDerivedType(tag: DW_TAG_rvalue_reference_type, baseType: 
![[INT:[0-9]+]])
+// CHECK: !DIDerivedType(tag: DW_TAG_rvalue_reference_type, baseType: 
![[INT:[0-9]+]], size: 64, align: 64)
 // CHECK: ![[INT]] = !DIBasicType(name: "int"


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


r253191 - Update for the gnu flavor being renamed to old-gnu.

2015-11-16 Thread Rafael Espindola via cfe-commits
Author: rafael
Date: Mon Nov 16 03:12:12 2015
New Revision: 253191

URL: http://llvm.org/viewvc/llvm-project?rev=253191&view=rev
Log:
Update for the gnu flavor being renamed to old-gnu.

Modified:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/amdgpu-toolchain.c
cfe/trunk/test/Driver/mingw-useld.c
cfe/trunk/test/Driver/mips-mti-linux.c

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=253191&r1=253190&r2=253191&view=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Mon Nov 16 03:12:12 2015
@@ -6224,7 +6224,7 @@ void amdgpu::Linker::ConstructJob(Compil
   std::string Linker = getToolChain().GetProgramPath(getShortName());
   ArgStringList CmdArgs;
   CmdArgs.push_back("-flavor");
-  CmdArgs.push_back("gnu");
+  CmdArgs.push_back("old-gnu");
   CmdArgs.push_back("-target");
   CmdArgs.push_back(Args.MakeArgString(getToolChain().getTripleString()));
   AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs);
@@ -8477,7 +8477,7 @@ void gnutools::Linker::ConstructJob(Comp
 
   if (llvm::sys::path::filename(ToolChain.Linker) == "lld") {
 CmdArgs.push_back("-flavor");
-CmdArgs.push_back("gnu");
+CmdArgs.push_back("old-gnu");
 CmdArgs.push_back("-target");
 CmdArgs.push_back(Args.MakeArgString(getToolChain().getTripleString()));
   }
@@ -9467,7 +9467,7 @@ void MinGW::Linker::ConstructJob(Compila
   StringRef LinkerName = Args.getLastArgValue(options::OPT_fuse_ld_EQ, "ld");
   if (LinkerName.equals_lower("lld")) {
 CmdArgs.push_back("-flavor");
-CmdArgs.push_back("gnu");
+CmdArgs.push_back("old-gnu");
   } else if (!LinkerName.equals_lower("ld")) {
 D.Diag(diag::err_drv_unsupported_linker) << LinkerName;
   }

Modified: cfe/trunk/test/Driver/amdgpu-toolchain.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/amdgpu-toolchain.c?rev=253191&r1=253190&r2=253191&view=diff
==
--- cfe/trunk/test/Driver/amdgpu-toolchain.c (original)
+++ cfe/trunk/test/Driver/amdgpu-toolchain.c Mon Nov 16 03:12:12 2015
@@ -1,3 +1,3 @@
 // RUN: %clang -### -target amdgcn--amdhsa -x assembler -mcpu=kaveri %s 2>&1 | 
FileCheck -check-prefix=AS_LINK %s
 // AS_LINK: clang{{.*}} "-cc1as"
-// AS_LINK: lld{{.*}} "-flavor" "gnu" "-target" "amdgcn--amdhsa"
+// AS_LINK: lld{{.*}} "-flavor" "old-gnu" "-target" "amdgcn--amdhsa"

Modified: cfe/trunk/test/Driver/mingw-useld.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mingw-useld.c?rev=253191&r1=253190&r2=253191&view=diff
==
--- cfe/trunk/test/Driver/mingw-useld.c (original)
+++ cfe/trunk/test/Driver/mingw-useld.c Mon Nov 16 03:12:12 2015
@@ -1,16 +1,16 @@
 // RUN: %clang -### -target i686-pc-windows-gnu 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s 2>&1 | FileCheck 
-check-prefix=CHECK_LD_32 %s
 // CHECK_LD_32: {{ld|ld.exe}}"
 // CHECK_LD_32: "i386pe"
-// CHECK_LD_32_NOT: "-flavor" "gnu"
+// CHECK_LD_32_NOT: "-flavor" "old-gnu"
 
 // RUN: %clang -### -target i686-pc-windows-gnu 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=lld 2>&1 | FileCheck 
-check-prefix=CHECK_LLD_32 %s
-// CHECK_LLD_32: lld" "-flavor" "gnu"
+// CHECK_LLD_32: lld" "-flavor" "old-gnu"
 // CHECK_LLD_32: "i386pe"
 
 // RUN: %clang -### -target x86_64-pc-windows-gnu 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=lld 2>&1 | FileCheck 
-check-prefix=CHECK_LLD_64 %s
-// CHECK_LLD_64: lld" "-flavor" "gnu"
+// CHECK_LLD_64: lld" "-flavor" "old-gnu"
 // CHECK_LLD_64: "i386pep"
 
 // RUN: %clang -### -target arm-pc-windows-gnu 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=lld 2>&1 | FileCheck 
-check-prefix=CHECK_LLD_ARM %s
-// CHECK_LLD_ARM: lld" "-flavor" "gnu"
+// CHECK_LLD_ARM: lld" "-flavor" "old-gnu"
 // CHECK_LLD_ARM: "thumb2pe"

Modified: cfe/trunk/test/Driver/mips-mti-linux.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mips-mti-linux.c?rev=253191&r1=253190&r2=253191&view=diff
==
--- cfe/trunk/test/Driver/mips-mti-linux.c (original)
+++ cfe/trunk/test/Driver/mips-mti-linux.c Mon Nov 16 03:12:12 2015
@@ -14,7 +14,7 @@
 // CHECK-BE-HF-32R2: "{{[^"]*}}clang{{[^"]*}}" {{.*}} "-triple" 
"mips-mti-linux"
 // CHECK-BE-HF-32R2-SAME: "-fuse-init-array" "-target-cpu" "mips32r2"
 // CHECK-BE-HF-32R2-SAME: "-isysroot" "{{.*}}mips_mti_linux/sysroot"
-// CHECK-BE-HF-32R2: "{{[^"]*}}lld{{[^"]*}}" "-flavor" "gnu" "-target" 
"mips-mti-linux"
+// CHECK-BE-HF-32R2: "{{[^"]*}}lld{{[^"]*}}" "-flavor" "old-gnu" "-target" 
"mips-mti-linux"
 // CHECK-BE-HF-32R2-SAME: "--sysroot=[[SYSROOT:[^"]+]]" {{.*}} 
"-dynamic-linker" "/lib/ld-musl-mips.so.1"
 // CHECK-BE-HF-32R2-SAME: 
"[[SYSROOT]]/mips-r2-hard-musl/usr

Re: [PATCH] D10599: [OPENMP 4.0] Initial support for '#pragma omp declare simd' directive.

2015-11-16 Thread Alexey Bataev via cfe-commits
ABataev marked 4 inline comments as done.


Comment at: include/clang/Basic/AttrDocs.td:1620
@@ +1619,3 @@
+  let Content = [{
+The declare simd construct can be applied to a function to enable the creation 
of one or more versions that can process multiple arguments using SIMD 
instructions from a single invocation from a SIMD loop. The declare simd 
directive is a declarative directive. There may be multiple declare simd 
directives for a function. The use of a declare simd construct on a function 
enables the creation of SIMD
+versions of the associated function that can be used to process multiple 
arguments from a single invocation from a SIMD loop concurrently.

aaron.ballman wrote:
> Line length is an issue here. ;-)
> 
> Also, "from a single invocation from a SIMD loop"; should that be "from a 
> single invocation of a SIMD loop" instead?
> 
> Any time you use "declare simd" as a syntactic phrase, it should be properly 
> formatted for RST as ``declare simd``.
Fixed, thanks


Comment at: lib/Parse/ParseOpenMP.cpp:97
@@ -89,1 +96,3 @@
+AccessSpecifier &AS, ParsedAttributesWithRange &Attrs,
+DeclSpec::TST TagType, Decl *TagDecl) {
   assert(Tok.is(tok::annot_pragma_openmp) && "Not an OpenMP directive!");

aaron.ballman wrote:
> Can we not name the last parameter with an identifier that is also a type 
> name? That always weirds me out. ;-)
Fixed, thanks.


Comment at: lib/Parse/ParseOpenMP.cpp:152
@@ +151,3 @@
+  } else {
+Ptr = ParseCXXClassMemberDeclarationWithPragmas(AS, Attrs, TagType,
+TagDecl);

aaron.ballman wrote:
> Can you add a test case for a member declaration that has attributes to 
> ensure the attributes are properly handled here? In fact, it would be good to 
> add one for the top-level function as well.
Ok, will add


Comment at: lib/Sema/SemaOpenMP.cpp:2370
@@ +2369,3 @@
+
+  auto *NewAttr = new (Context) OMPDeclareSimdDeclAttr(
+  SourceRange(StartLoc, StartLoc), Context, /*SI=*/0);

aaron.ballman wrote:
> Please use OMPDeclareSimdDeclAttr::CreateImplicit instead.
Fixed, thanks


http://reviews.llvm.org/D10599



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


Re: [PATCH] D10599: [OPENMP 4.0] Initial support for '#pragma omp declare simd' directive.

2015-11-16 Thread Alexey Bataev via cfe-commits
ABataev updated this revision to Diff 40255.
ABataev marked 4 inline comments as done.
ABataev added a comment.

Update after review


http://reviews.llvm.org/D10599

Files:
  include/clang/Basic/Attr.td
  include/clang/Basic/AttrDocs.td
  include/clang/Basic/DiagnosticParseKinds.td
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Basic/OpenMPKinds.def
  include/clang/Parse/Parser.h
  include/clang/Sema/Sema.h
  lib/Basic/OpenMPKinds.cpp
  lib/Parse/ParseDecl.cpp
  lib/Parse/ParseDeclCXX.cpp
  lib/Parse/ParseOpenMP.cpp
  lib/Parse/Parser.cpp
  lib/Sema/SemaOpenMP.cpp
  test/OpenMP/declare_simd_ast_print.c
  test/OpenMP/declare_simd_ast_print.cpp
  test/OpenMP/declare_simd_messages.cpp

Index: lib/Parse/Parser.cpp
===
--- lib/Parse/Parser.cpp
+++ lib/Parse/Parser.cpp
@@ -656,8 +656,10 @@
   case tok::annot_pragma_opencl_extension:
 HandlePragmaOpenCLExtension();
 return DeclGroupPtrTy();
-  case tok::annot_pragma_openmp:
-return ParseOpenMPDeclarativeDirective();
+  case tok::annot_pragma_openmp: {
+AccessSpecifier AS = AS_none;
+return ParseOpenMPDeclarativeDirectiveWithExtDecl(AS, attrs);
+  }
   case tok::annot_pragma_ms_pointers_to_members:
 HandlePragmaMSPointersToMembers();
 return DeclGroupPtrTy();
Index: lib/Parse/ParseOpenMP.cpp
===
--- lib/Parse/ParseOpenMP.cpp
+++ lib/Parse/ParseOpenMP.cpp
@@ -31,6 +31,7 @@
   // E.g.: OMPD_for OMPD_simd ===> OMPD_for_simd
   // TODO: add other combined directives in topological order.
   const OpenMPDirectiveKind F[][3] = {
+  {OMPD_unknown /*declare*/, OMPD_simd, OMPD_declare_simd},
   {OMPD_unknown /*cancellation*/, OMPD_unknown /*point*/,
OMPD_cancellation_point},
   {OMPD_target, OMPD_unknown /*data*/, OMPD_target_data},
@@ -48,11 +49,12 @@
   for (unsigned i = 0; i < llvm::array_lengthof(F); ++i) {
 if (!Tok.isAnnotation() && DKind == OMPD_unknown) {
   TokenMatched =
-  (i == 0) &&
-  !P.getPreprocessor().getSpelling(Tok).compare("cancellation");
-} else {
+  ((i == 0) &&
+   !P.getPreprocessor().getSpelling(Tok).compare("declare")) ||
+  ((i == 1) &&
+   !P.getPreprocessor().getSpelling(Tok).compare("cancellation"));
+} else
   TokenMatched = DKind == F[i][0] && DKind != OMPD_unknown;
-}
 
 if (TokenMatched) {
   Tok = P.getPreprocessor().LookAhead(0);
@@ -64,12 +66,11 @@
 
   if (!TokenIsAnnotation && SDKind == OMPD_unknown) {
 TokenMatched =
-((i == 0) &&
+((i == 1) &&
  !P.getPreprocessor().getSpelling(Tok).compare("point")) ||
-((i == 1) && !P.getPreprocessor().getSpelling(Tok).compare("data"));
-  } else {
+((i == 2) && !P.getPreprocessor().getSpelling(Tok).compare("data"));
+  } else
 TokenMatched = SDKind == F[i][1] && SDKind != OMPD_unknown;
-  }
 
   if (TokenMatched) {
 P.ConsumeToken();
@@ -84,8 +85,16 @@
 ///
 ///   threadprivate-directive:
 /// annot_pragma_openmp 'threadprivate' simple-variable-list
+/// annot_pragma_omp_end
 ///
-Parser::DeclGroupPtrTy Parser::ParseOpenMPDeclarativeDirective() {
+///   declare-simd-directive:
+/// annot_pragma_openmp 'declare simd' { [,]}
+/// annot_pragma_omp_end
+/// 
+///
+Parser::DeclGroupPtrTy Parser::ParseOpenMPDeclarativeDirectiveWithExtDecl(
+AccessSpecifier &AS, ParsedAttributesWithRange &Attrs,
+DeclSpec::TST TagType, Decl *Tag) {
   assert(Tok.is(tok::annot_pragma_openmp) && "Not an OpenMP directive!");
   ParenBraceBracketBalancer BalancerRAIIObj(*this);
 
@@ -109,6 +118,47 @@
   return Actions.ActOnOpenMPThreadprivateDirective(Loc, Identifiers);
 }
 break;
+  case OMPD_declare_simd: {
+// The syntax is:
+// { #pragma omp declare simd }
+// 
+//
+
+ConsumeToken();
+// The last seen token is annot_pragma_openmp_end - need to check for
+// extra tokens.
+if (Tok.isNot(tok::annot_pragma_openmp_end)) {
+  Diag(Tok, diag::warn_omp_extra_tokens_at_eol)
+  << getOpenMPDirectiveName(OMPD_declare_simd);
+  while (Tok.isNot(tok::annot_pragma_openmp_end))
+ConsumeAnyToken();
+}
+// Skip the last annot_pragma_openmp_end.
+ConsumeToken();
+
+DeclGroupPtrTy Ptr;
+if (Tok.is(tok::annot_pragma_openmp)) {
+  Ptr = ParseOpenMPDeclarativeDirectiveWithExtDecl(AS, Attrs, TagType, Tag);
+} else if (Tok.isNot(tok::r_brace) && !isEofOrEom()) {
+  // Here we expect to see some function declaration.
+  if (AS == AS_none) {
+assert(TagType == DeclSpec::TST_unspecified);
+MaybeParseCXX11Attributes(Attrs);
+MaybeParseMicrosoftAttributes(Attrs);
+ParsingDeclSpec PDS(*this);
+Ptr = ParseExternalDeclaration(Attrs, &PDS);
+  } else {
+Ptr =
+P

[PATCH] D14695: [libclang] Add entry points that take a full command line including argv[0].

2015-11-16 Thread Benjamin Kramer via cfe-commits
bkramer created this revision.
bkramer added a reviewer: klimek.
bkramer added a subscriber: cfe-commits.

This provides both a more uniform interface and makes libclang behave like
clang tooling wrt relative paths against argv[0]. This is necessary for
finding paths to a c++ standard library relative to a clang binary given
in a compilation database. It can also be used to find paths relative to
libclang.so if the full path to it is passed in.

http://reviews.llvm.org/D14695

Files:
  include/clang-c/Index.h
  lib/Frontend/CreateInvocationFromCommandLine.cpp
  tools/diagtool/ShowEnabledWarnings.cpp
  tools/libclang/CIndex.cpp
  tools/libclang/Indexing.cpp

Index: tools/libclang/Indexing.cpp
===
--- tools/libclang/Indexing.cpp
+++ tools/libclang/Indexing.cpp
@@ -907,6 +907,22 @@
   unsigned num_unsaved_files,
   CXTranslationUnit *out_TU,
   unsigned TU_options) {
+  SmallVector Args;
+  Args.push_back("clang");
+  Args.append(command_line_args, command_line_args + num_command_line_args);
+  return clang_indexSourceFileFullArgv(
+  idxAction, client_data, index_callbacks, index_callbacks_size,
+  index_options, source_filename, Args.data(), Args.size(), unsaved_files,
+  num_unsaved_files, out_TU, TU_options);
+}
+
+int clang_indexSourceFileFullArgv(
+CXIndexAction idxAction, CXClientData client_data,
+IndexerCallbacks *index_callbacks, unsigned index_callbacks_size,
+unsigned index_options, const char *source_filename,
+const char *const *command_line_args, int num_command_line_args,
+struct CXUnsavedFile *unsaved_files, unsigned num_unsaved_files,
+CXTranslationUnit *out_TU, unsigned TU_options) {
   LOG_FUNC_SECTION {
 *Log << source_filename << ": ";
 for (int i = 0; i != num_command_line_args; ++i)
Index: tools/libclang/CIndex.cpp
===
--- tools/libclang/CIndex.cpp
+++ tools/libclang/CIndex.cpp
@@ -3089,12 +3089,12 @@
   break;
 }
   }
-  if (!FoundSpellCheckingArgument)
-Args->push_back("-fno-spell-checking");
-  
   Args->insert(Args->end(), command_line_args,
command_line_args + num_command_line_args);
 
+  if (!FoundSpellCheckingArgument)
+Args->insert(Args->begin() + 1, "-fno-spell-checking");
+
   // The 'source_filename' argument is optional.  If the caller does not
   // specify it then it is assumed that the source file is specified
   // in the actual argument list.
@@ -3157,14 +3157,23 @@
 }
 
 enum CXErrorCode clang_parseTranslationUnit2(
-CXIndex CIdx,
-const char *source_filename,
-const char *const *command_line_args,
-int num_command_line_args,
-struct CXUnsavedFile *unsaved_files,
-unsigned num_unsaved_files,
-unsigned options,
-CXTranslationUnit *out_TU) {
+CXIndex CIdx, const char *source_filename,
+const char *const *command_line_args, int num_command_line_args,
+struct CXUnsavedFile *unsaved_files, unsigned num_unsaved_files,
+unsigned options, CXTranslationUnit *out_TU) {
+  SmallVector Args;
+  Args.push_back("clang");
+  Args.append(command_line_args, command_line_args + num_command_line_args);
+  return clang_parseTranslationUnit2FullArgv(
+  CIdx, source_filename, Args.data(), Args.size(), unsaved_files,
+  num_unsaved_files, options, out_TU);
+}
+
+enum CXErrorCode clang_parseTranslationUnit2FullArgv(
+CXIndex CIdx, const char *source_filename,
+const char *const *command_line_args, int num_command_line_args,
+struct CXUnsavedFile *unsaved_files, unsigned num_unsaved_files,
+unsigned options, CXTranslationUnit *out_TU) {
   LOG_FUNC_SECTION {
 *Log << source_filename << ": ";
 for (int i = 0; i != num_command_line_args; ++i)
Index: tools/diagtool/ShowEnabledWarnings.cpp
===
--- tools/diagtool/ShowEnabledWarnings.cpp
+++ tools/diagtool/ShowEnabledWarnings.cpp
@@ -64,9 +64,11 @@
 new DiagnosticsEngine(DiagIDs, new DiagnosticOptions(), DiagsBuffer));
 
   // Try to build a CompilerInvocation.
+  SmallVector Args;
+  Args.push_back("diagtool");
+  Args.append(argv, argv + argc);
   std::unique_ptr Invocation(
-  createInvocationFromCommandLine(llvm::makeArrayRef(argv, argc),
-  InterimDiags));
+  createInvocationFromCommandLine(Args, InterimDiags));
   if (!Invocation)
 return nullptr;
 
Index: lib/Frontend/CreateInvocationFromCommandLine.cpp
===
--- lib/Frontend/CreateInvocationFromCommandLine.cpp
+++ lib/Frontend/CreateInvocationFromCommandLine.cpp
@@ -39,15 +39,13 @@
 Diags = CompilerInstance::createDiagnostics(new DiagnosticOptions);
   }
 
-  SmallVector Args;
-  Args.push_back(""); // FIXME: Remove dummy argument.
-  Args.insert(Args.end(), Arg

Re: [PATCH] D14695: [libclang] Add entry points that take a full command line including argv[0].

2015-11-16 Thread Manuel Klimek via cfe-commits
klimek added inline comments.


Comment at: include/clang-c/Index.h:5694-5695
@@ -5683,1 +5693,4 @@
 /**
+ * \brief Same as clang_indexSourceFile but requires a full command line
+ * for \c command_line_args including argv[0].
+ */

We should probably expand on why users would want to use on or the other here...


http://reviews.llvm.org/D14695



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


Re: [PATCH] D11182: [OPENMP 4.0] Initial support for 'omp declare reduction' construct.

2015-11-16 Thread Alexey Bataev via cfe-commits
ABataev marked 2 inline comments as done.


Comment at: include/clang/Basic/DiagnosticParseKinds.td:995
@@ -994,1 +994,3 @@
+def err_omp_expected_reduction_identifier : Error<
+  "expected identifier or one of the following operators: '+', '-', '*', '&', 
'|', '^', '&&' and '||'">;
 

hfinkel wrote:
> We're not incredibly consistent here, but I think this reads better if we say:
> 
>   '&&', or '||'
> 
> instead of:
> 
>   '&&' and '||'
> 
> (adding the Oxford comma and 'and' -> 'or').
Fixed, thanks.


Comment at: lib/AST/Decl.cpp:1463
@@ -1461,1 +1462,3 @@
 
+  // Declare reduction are always replaceable.
+  if (OMPDeclareReductionDecl::classofKind(NewK))

hfinkel wrote:
> are -> is
Fixed


http://reviews.llvm.org/D11182



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


Re: [PATCH] D11182: [OPENMP 4.0] Initial support for 'omp declare reduction' construct.

2015-11-16 Thread Alexey Bataev via cfe-commits
ABataev updated this revision to Diff 40262.
ABataev marked 2 inline comments as done.
ABataev added a comment.

Update after review


http://reviews.llvm.org/D11182

Files:
  include/clang/AST/DataRecursiveASTVisitor.h
  include/clang/AST/DeclBase.h
  include/clang/AST/DeclCXX.h
  include/clang/AST/DeclOpenMP.h
  include/clang/AST/RecursiveASTVisitor.h
  include/clang/Basic/DeclNodes.td
  include/clang/Basic/DiagnosticParseKinds.td
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Basic/OpenMPKinds.def
  include/clang/Parse/Parser.h
  include/clang/Sema/ScopeInfo.h
  include/clang/Sema/Sema.h
  include/clang/Serialization/ASTBitCodes.h
  lib/AST/CXXInheritance.cpp
  lib/AST/Decl.cpp
  lib/AST/DeclBase.cpp
  lib/AST/DeclOpenMP.cpp
  lib/AST/DeclPrinter.cpp
  lib/AST/ItaniumMangle.cpp
  lib/AST/MicrosoftMangle.cpp
  lib/Basic/OpenMPKinds.cpp
  lib/CodeGen/CGDecl.cpp
  lib/CodeGen/CodeGenModule.cpp
  lib/CodeGen/CodeGenModule.h
  lib/Parse/ParseDecl.cpp
  lib/Parse/ParseDeclCXX.cpp
  lib/Parse/ParseOpenMP.cpp
  lib/Parse/Parser.cpp
  lib/Sema/ScopeInfo.cpp
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaExpr.cpp
  lib/Sema/SemaLookup.cpp
  lib/Sema/SemaOpenMP.cpp
  lib/Sema/SemaTemplateInstantiateDecl.cpp
  lib/Serialization/ASTCommon.cpp
  lib/Serialization/ASTReaderDecl.cpp
  lib/Serialization/ASTWriterDecl.cpp
  test/OpenMP/declare_reduction_ast_print.c
  test/OpenMP/declare_reduction_ast_print.cpp
  test/OpenMP/declare_reduction_messages.c
  test/OpenMP/declare_reduction_messages.cpp
  tools/libclang/CIndex.cpp

Index: lib/Serialization/ASTWriterDecl.cpp
===
--- lib/Serialization/ASTWriterDecl.cpp
+++ lib/Serialization/ASTWriterDecl.cpp
@@ -131,6 +131,7 @@
 void VisitObjCPropertyDecl(ObjCPropertyDecl *D);
 void VisitObjCPropertyImplDecl(ObjCPropertyImplDecl *D);
 void VisitOMPThreadPrivateDecl(OMPThreadPrivateDecl *D);
+void VisitOMPDeclareReductionDecl(OMPDeclareReductionDecl *D);
 
 /// Add an Objective-C type parameter list to the given record.
 void AddObjCTypeParamList(ObjCTypeParamList *typeParams) {
@@ -1617,6 +1618,16 @@
   Code = serialization::DECL_OMP_THREADPRIVATE;
 }
 
+void ASTDeclWriter::VisitOMPDeclareReductionDecl(OMPDeclareReductionDecl *D) {
+  VisitNamedDecl(D);
+  Writer.AddSourceLocation(D->getLocStart(), Record);
+  Writer.AddStmt(D->getCombiner());
+  Writer.AddStmt(D->getInitializer());
+  Writer.AddDeclRef(D->getPrevDeclInScope(), Record);
+  Writer.AddTypeRef(D->getType(), Record);
+  Code = serialization::DECL_OMP_DECLARE_REDUCTION;
+}
+
 //===--===//
 // ASTWriter Implementation
 //===--===//
Index: lib/Serialization/ASTReaderDecl.cpp
===
--- lib/Serialization/ASTReaderDecl.cpp
+++ lib/Serialization/ASTReaderDecl.cpp
@@ -349,6 +349,7 @@
 void VisitObjCPropertyDecl(ObjCPropertyDecl *D);
 void VisitObjCPropertyImplDecl(ObjCPropertyImplDecl *D);
 void VisitOMPThreadPrivateDecl(OMPThreadPrivateDecl *D);
+void VisitOMPDeclareReductionDecl(OMPDeclareReductionDecl *D);
 
 /// We've merged the definition \p MergedDef into the existing definition
 /// \p Def. Ensure that \p Def is made visible whenever \p MergedDef is made
@@ -2349,6 +2350,15 @@
   D->setVars(Vars);
 }
 
+void ASTDeclReader::VisitOMPDeclareReductionDecl(OMPDeclareReductionDecl *D) {
+  VisitNamedDecl(D);
+  D->setLocation(Reader.ReadSourceLocation(F, Record, Idx));
+  D->setCombiner(Reader.ReadExpr(F));
+  D->setInitializer(Reader.ReadExpr(F));
+  D->PrevDeclInScope = Reader.ReadDeclID(F, Record, Idx);
+  D->setType(Reader.readType(F, Record, Idx));
+}
+
 //===--===//
 // Attribute Reading
 //===--===//
@@ -2398,7 +2408,8 @@
   isa(D) || 
   isa(D) ||
   isa(D) ||
-  isa(D))
+  isa(D) ||
+  isa(D))
 return true;
   if (VarDecl *Var = dyn_cast(D))
 return Var->isFileVarDecl() &&
@@ -3294,6 +3305,9 @@
   case DECL_OMP_THREADPRIVATE:
 D = OMPThreadPrivateDecl::CreateDeserialized(Context, ID, Record[Idx++]);
 break;
+  case DECL_OMP_DECLARE_REDUCTION:
+D = OMPDeclareReductionDecl::CreateDeserialized(Context, ID);
+break;
   case DECL_EMPTY:
 D = EmptyDecl::CreateDeserialized(Context, ID);
 break;
Index: lib/Serialization/ASTCommon.cpp
===
--- lib/Serialization/ASTCommon.cpp
+++ lib/Serialization/ASTCommon.cpp
@@ -329,6 +329,7 @@
   case Decl::ClassScopeFunctionSpecialization:
   case Decl::Import:
   case Decl::OMPThreadPrivate:
+  case Decl::OMPDeclareReduction:
 return false;
 
   // These indirectly derive from Redeclarable but are not actually
Index: lib/

Re: [PATCH] D12031: Const std::move() argument ClangTidy check

2015-11-16 Thread Alexander Kornienko via cfe-commits
alexfh added inline comments.


Comment at: clang-tidy/misc/MoveConstantArgumentCheck.cpp:23
@@ +22,3 @@
+}
+
+void MoveConstantArgumentCheck::check(const MatchFinder::MatchResult &Result) {

The problem is that each template class or function can have several 
representations in the AST: one for the template definition and one for each 
instantiation. Usually, we don't need to even look at the instantiations, when 
we want to reason about the code in the general case. You can filter out 
expressions belonging to template instantiations using this narrowing matcher: 
`unless(isInTemplateInstantiation())`. And for template definitions the type 
will be marked as dependent.


Comment at: clang-tidy/misc/MoveConstantArgumentCheck.cpp:31
@@ +30,3 @@
+
+  bool IsTypeDependOnTemplateParameter = Arg->getType()->isDependentType();
+  if (IsTypeDependOnTemplateParameter)

The variable here is only used once and its name doesn't make the code much 
clearer compared to the expression itself. Please remove it.


Comment at: clang-tidy/misc/MoveConstantArgumentCheck.cpp:40
@@ +39,3 @@
+diag(CallMove->getLocStart(), "std::move of the %select{|const "
+  "}0%select{expression|variable}1 %select{|of 
"
+  "trivially-copyable type }2has no effect; "

dvadym wrote:
> Could you please advice how can I correctly make removal? 
> I expected that 
> FixItHint::CreateRemoval(SourceRange(CallMove->getLocStart(), 
> Arg->getLocStart())) removes "std::move(" but it removes "std::move(varname", 
> so from a "move" call only ")" is left
`FixItHint::CreateRemoval` and many other methods accept `CharSourceRange` 
instead of `SourceRange`. The former is a `SourceRange` + a flag telling 
whether the range should be treated as a character range or a token range. By 
default, `SourceRange` is converted to a `CharSourceRange` marked as a token 
range. So your current code creates a `FixItHint` that removes tokens from 
`std` to `varname` inclusive. If you want to delete everything from `std` to 
just before `varname`, you can create a character range from 
`CallMove->getLocStart()` to `Arg->getLocStart().getLocWithOffset(-1)`.

However, when there's something between `std::move(` and `varname` (whitespace 
and/or comment(s)), might want to delete just `std::move(`. In this case you 
can take `CallMove->getCallee()' (which will correspond to `std::move`), and 
then find the first '(' token after it's end location. It's probably a rare 
case though, so let's go for the simpler solution for now (with 
`getLocWithOffset` and character ranges).


Comment at: test/clang-tidy/move-const-arg.cpp:1
@@ +1,2 @@
+// RUN: %check_clang_tidy %s misc-move-const-arg %t -- -- -std=c++11
+

aaron.ballman wrote:
> Please run clang-format over the test files as well.
Did you forget to include the test file to the latest patch? The formatting is 
still off and the messages don't seem to correspond to the spelling in the 
code. If you have troubles with clang-format breaking the CHECK lines, be sure 
to use `clang-format -style=file` so that the test-specific configuration file 
is used.


http://reviews.llvm.org/D12031



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


Re: [PATCH] D14662: [ARM] Pass architecture to TargetParser defaulting to cope with API change

2015-11-16 Thread Bradley Smith via cfe-commits
bsmith closed this revision.
bsmith added a comment.

Thanks, committed as r253199.


Repository:
  rL LLVM

http://reviews.llvm.org/D14662



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


r253199 - [ARM] Pass in the architecture to TargetParser to cope with API change

2015-11-16 Thread Bradley Smith via cfe-commits
Author: brasmi01
Date: Mon Nov 16 05:16:36 2015
New Revision: 253199

URL: http://llvm.org/viewvc/llvm-project?rev=253199&view=rev
Log:
[ARM] Pass in the architecture to TargetParser to cope with API change

The TargetParser API to get the default FPU and default extensions has
changed so that it can fall back to the architecture in case of a
generic CPU.

Modified:
cfe/trunk/lib/Basic/Targets.cpp

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=253199&r1=253198&r2=253199&view=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Mon Nov 16 05:16:36 2015
@@ -4501,13 +4501,14 @@ public:
  const std::vector &FeaturesVec) const override {
 
 std::vector TargetFeatures;
+unsigned Arch = llvm::ARM::parseArch(getTriple().getArchName());
 
 // get default FPU features
-unsigned FPUKind = llvm::ARM::getDefaultFPU(CPU);
+unsigned FPUKind = llvm::ARM::getDefaultFPU(CPU, Arch);
 llvm::ARM::getFPUFeatures(FPUKind, TargetFeatures);
 
 // get default Extension features
-unsigned Extensions = llvm::ARM::getDefaultExtensions(CPU);
+unsigned Extensions = llvm::ARM::getDefaultExtensions(CPU, Arch);
 llvm::ARM::getExtensionFeatures(Extensions, TargetFeatures);
 
 for (const char *Feature : TargetFeatures)


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


Re: [PATCH] D14695: [libclang] Add entry points that take a full command line including argv[0].

2015-11-16 Thread Benjamin Kramer via cfe-commits
bkramer updated this revision to Diff 40269.
bkramer added a comment.

- Add a test case to make sure argv[0] handling actually works.
- Clarify comments a bit.


http://reviews.llvm.org/D14695

Files:
  include/clang-c/Index.h
  lib/Frontend/CreateInvocationFromCommandLine.cpp
  tools/diagtool/ShowEnabledWarnings.cpp
  tools/libclang/CIndex.cpp
  tools/libclang/Indexing.cpp
  tools/libclang/libclang.exports
  unittests/libclang/LibclangTest.cpp

Index: unittests/libclang/LibclangTest.cpp
===
--- unittests/libclang/LibclangTest.cpp
+++ unittests/libclang/LibclangTest.cpp
@@ -379,8 +379,10 @@
   Filename = Path.str();
   Files.insert(Filename);
 }
+llvm::sys::fs::create_directories(llvm::sys::path::parent_path(Filename));
 std::ofstream OS(Filename);
 OS << Contents;
+assert(OS.good());
   }
   void DisplayDiagnostics() {
 unsigned NumDiagnostics = clang_getNumDiagnostics(ClangTU);
@@ -465,3 +467,27 @@
   ASSERT_TRUE(ReparseTU(0, nullptr /* No unsaved files. */));
   EXPECT_EQ(0U, clang_getNumDiagnostics(ClangTU));
 }
+
+TEST_F(LibclangReparseTest, clang_parseTranslationUnit2FullArgv) {
+  std::string EmptyFiles[] = {"lib/gcc/arm-linux-gnueabi/4.6.1/crtbegin.o",
+  "include/arm-linux-gnueabi/.keep",
+  "include/c++/4.6.1/vector"};
+
+  for (auto &Name : EmptyFiles)
+WriteFile(Name, "\n");
+
+  std::string Filename = "test.cc";
+  WriteFile(Filename, "#include \n");
+
+  std::string Clang = "bin/clang";
+  WriteFile(Clang, "");
+
+  const char *Argv[] = {Clang.c_str(), "-target", "arm-linux-gnueabi"};
+
+  EXPECT_EQ(CXError_Success,
+clang_parseTranslationUnit2FullArgv(Index, Filename.c_str(), Argv,
+sizeof(Argv) / sizeof(Argv[0]),
+nullptr, 0, TUFlags, &ClangTU));
+  EXPECT_EQ(0U, clang_getNumDiagnostics(ClangTU));
+  DisplayDiagnostics();
+}
Index: tools/libclang/libclang.exports
===
--- tools/libclang/libclang.exports
+++ tools/libclang/libclang.exports
@@ -249,6 +249,7 @@
 clang_indexLoc_getCXSourceLocation
 clang_indexLoc_getFileLocation
 clang_indexSourceFile
+clang_indexSourceFileFullArgv
 clang_indexTranslationUnit
 clang_index_getCXXClassDeclInfo
 clang_index_getClientContainer
@@ -284,6 +285,7 @@
 clang_Location_isFromMainFile
 clang_parseTranslationUnit
 clang_parseTranslationUnit2
+clang_parseTranslationUnit2FullArgv
 clang_remap_dispose
 clang_remap_getFilenames
 clang_remap_getNumFiles
Index: tools/libclang/Indexing.cpp
===
--- tools/libclang/Indexing.cpp
+++ tools/libclang/Indexing.cpp
@@ -907,6 +907,22 @@
   unsigned num_unsaved_files,
   CXTranslationUnit *out_TU,
   unsigned TU_options) {
+  SmallVector Args;
+  Args.push_back("clang");
+  Args.append(command_line_args, command_line_args + num_command_line_args);
+  return clang_indexSourceFileFullArgv(
+  idxAction, client_data, index_callbacks, index_callbacks_size,
+  index_options, source_filename, Args.data(), Args.size(), unsaved_files,
+  num_unsaved_files, out_TU, TU_options);
+}
+
+int clang_indexSourceFileFullArgv(
+CXIndexAction idxAction, CXClientData client_data,
+IndexerCallbacks *index_callbacks, unsigned index_callbacks_size,
+unsigned index_options, const char *source_filename,
+const char *const *command_line_args, int num_command_line_args,
+struct CXUnsavedFile *unsaved_files, unsigned num_unsaved_files,
+CXTranslationUnit *out_TU, unsigned TU_options) {
   LOG_FUNC_SECTION {
 *Log << source_filename << ": ";
 for (int i = 0; i != num_command_line_args; ++i)
Index: tools/libclang/CIndex.cpp
===
--- tools/libclang/CIndex.cpp
+++ tools/libclang/CIndex.cpp
@@ -3089,12 +3089,12 @@
   break;
 }
   }
-  if (!FoundSpellCheckingArgument)
-Args->push_back("-fno-spell-checking");
-  
   Args->insert(Args->end(), command_line_args,
command_line_args + num_command_line_args);
 
+  if (!FoundSpellCheckingArgument)
+Args->insert(Args->begin() + 1, "-fno-spell-checking");
+
   // The 'source_filename' argument is optional.  If the caller does not
   // specify it then it is assumed that the source file is specified
   // in the actual argument list.
@@ -3157,14 +3157,23 @@
 }
 
 enum CXErrorCode clang_parseTranslationUnit2(
-CXIndex CIdx,
-const char *source_filename,
-const char *const *command_line_args,
-int num_command_line_args,
-struct CXUnsavedFile *unsaved_files,
-unsigned num_unsaved_files,
-unsigned options,
-CXTranslationUnit *out_TU) {
+CXIndex CIdx, const char *source_filename,
+const char *

Re: [PATCH] D14570: Handle ARMv6KZ naming

2015-11-16 Thread Renato Golin via cfe-commits
rengolin added a comment.

In http://reviews.llvm.org/D14570#288132, @compnerd wrote:

> Wow, this is tricky: the code change is in LLVM, and test change in clang :(. 
>  However, this does seem to preserve the features.


The problem is that Clang is the most important user of this library, which 
also has other users in LLVM. We just need to make sure that Clang is doing the 
right thing, and that the intentions are recorded on the right places. In this 
case, it's Clang. :)


http://reviews.llvm.org/D14570



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


r253202 - clang-format: Enable #include sorting by default.

2015-11-16 Thread Daniel Jasper via cfe-commits
Author: djasper
Date: Mon Nov 16 06:38:56 2015
New Revision: 253202

URL: http://llvm.org/viewvc/llvm-project?rev=253202&view=rev
Log:
clang-format: Enable #include sorting by default.

This has seen quite some usage and I am not aware of any issues. Also
add a style option to enable/disable include sorting. The existing
command line flag can from now on be used to override whatever is set
in the style.

Added:
cfe/trunk/test/Format/disable-include-sorting.cpp
Modified:
cfe/trunk/include/clang/Format/Format.h
cfe/trunk/lib/Format/Format.cpp
cfe/trunk/tools/clang-format/ClangFormat.cpp
cfe/trunk/tools/clang-format/clang-format-sublime.py
cfe/trunk/tools/clang-format/clang-format.el
cfe/trunk/tools/clang-format/clang-format.py
cfe/trunk/unittests/Format/FormatTest.cpp
cfe/trunk/unittests/Format/SortIncludesTest.cpp

Modified: cfe/trunk/include/clang/Format/Format.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Format/Format.h?rev=253202&r1=253201&r2=253202&view=diff
==
--- cfe/trunk/include/clang/Format/Format.h (original)
+++ cfe/trunk/include/clang/Format/Format.h Mon Nov 16 06:38:56 2015
@@ -469,6 +469,9 @@ struct FormatStyle {
   /// Pointer and reference alignment style.
   PointerAlignmentStyle PointerAlignment;
 
+  /// \brief If true, clang-format will sort #includes.
+  bool SortIncludes;
+
   /// \brief If \c true, a space may be inserted after C style casts.
   bool SpaceAfterCStyleCast;
 

Modified: cfe/trunk/lib/Format/Format.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=253202&r1=253201&r2=253202&view=diff
==
--- cfe/trunk/lib/Format/Format.cpp (original)
+++ cfe/trunk/lib/Format/Format.cpp Mon Nov 16 06:38:56 2015
@@ -284,6 +284,7 @@ template <> struct MappingTraits Ranges,
StringRef FileName) {
   tooling::Replacements Replaces;
+  if (!Style.SortIncludes)
+return Replaces;
+
   unsigned Prev = 0;
   unsigned SearchFrom = 0;
   llvm::Regex IncludeRegex(

Added: cfe/trunk/test/Format/disable-include-sorting.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Format/disable-include-sorting.cpp?rev=253202&view=auto
==
--- cfe/trunk/test/Format/disable-include-sorting.cpp (added)
+++ cfe/trunk/test/Format/disable-include-sorting.cpp Mon Nov 16 06:38:56 2015
@@ -0,0 +1,10 @@
+// RUN: clang-format %s | FileCheck %s
+// RUN: clang-format %s -sort-includes -style="{SortIncludes: false}" | 
FileCheck %s
+// RUN: clang-format %s -sort-includes=false | FileCheck %s 
-check-prefix=NOT-SORTED
+
+#include 
+#include 
+// CHECK: 
+// CHECK-NEXT: 
+// NOT-SORTED: 
+// NOT-SORTED-NEXT: 

Modified: cfe/trunk/tools/clang-format/ClangFormat.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-format/ClangFormat.cpp?rev=253202&r1=253201&r2=253202&view=diff
==
--- cfe/trunk/tools/clang-format/ClangFormat.cpp (original)
+++ cfe/trunk/tools/clang-format/ClangFormat.cpp Mon Nov 16 06:38:56 2015
@@ -98,9 +98,11 @@ static cl::opt
 "clang-format from an editor integration"),
cl::init(0), cl::cat(ClangFormatCategory));
 
-static cl::opt SortIncludes("sort-includes",
-  cl::desc("Sort touched include lines"),
-  cl::cat(ClangFormatCategory));
+static cl::opt SortIncludes(
+"sort-includes",
+cl::desc("If set, overrides the include sorting behavior determined by the 
"
+ "SortIncludes style flag"),
+cl::cat(ClangFormatCategory));
 
 static cl::list FileNames(cl::Positional, cl::desc("[ 
...]"),
cl::cat(ClangFormatCategory));
@@ -252,17 +254,14 @@ static bool format(StringRef FileName) {
 return true;
   StringRef AssumedFileName = (FileName == "-") ? AssumeFileName : FileName;
   FormatStyle FormatStyle = getStyle(Style, AssumedFileName, FallbackStyle);
-  Replacements Replaces;
-  std::string ChangedCode;
-  if (SortIncludes) {
-Replaces =
-sortIncludes(FormatStyle, Code->getBuffer(), Ranges, AssumedFileName);
-ChangedCode = tooling::applyAllReplacements(Code->getBuffer(), Replaces);
-for (const auto &R : Replaces)
-  Ranges.push_back({R.getOffset(), R.getLength()});
-  } else {
-ChangedCode = Code->getBuffer().str();
-  }
+  if (SortIncludes.getNumOccurrences() != 0)
+FormatStyle.SortIncludes = SortIncludes;
+  Replacements Replaces =
+  sortIncludes(FormatStyle, Code->getBuffer(), Ranges, AssumedFileName);
+  std::string ChangedCode =
+  tooling::applyAllReplacements(Code->getBuffer(), Replaces);
+  for (const auto &R : Replaces)
+Ranges.push_back({R.getOffset(), R.

Re: [PATCH] D14570: Handle ARMv6KZ naming

2015-11-16 Thread James Molloy via cfe-commits
Hi Renato,

Ideally, shouldn't the clang tests be checking that the LLVM target parsing
library is called with the correct arguments? then separate tests inside
LLVM check that the target parser works correctly?

As it stands, it seems like a very deliberate layering violation that could
really do with chopping up.

James

On Mon, 16 Nov 2015 at 12:19 Renato Golin via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> rengolin added a comment.
>
> In http://reviews.llvm.org/D14570#288132, @compnerd wrote:
>
> > Wow, this is tricky: the code change is in LLVM, and test change in
> clang :(.  However, this does seem to preserve the features.
>
>
> The problem is that Clang is the most important user of this library,
> which also has other users in LLVM. We just need to make sure that Clang is
> doing the right thing, and that the intentions are recorded on the right
> places. In this case, it's Clang. :)
>
>
> http://reviews.llvm.org/D14570
>
>
>
> ___
> 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


[clang-tools-extra] r253203 - [clang-tidy] Test commit (playing with git-svn)

2015-11-16 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Mon Nov 16 07:06:15 2015
New Revision: 253203

URL: http://llvm.org/viewvc/llvm-project?rev=253203&view=rev
Log:
[clang-tidy] Test commit (playing with git-svn)

Modified:
clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp
clang-tools-extra/trunk/clang-tidy/ClangTidyDiagnosticConsumer.cpp

Modified: clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp?rev=253203&r1=253202&r2=253203&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp Mon Nov 16 07:06:15 2015
@@ -114,9 +114,8 @@ public:
 SmallVector, 4> FixLocations;
 {
   auto Level = static_cast(Error.DiagLevel);
-  DiagnosticBuilder Diag =
-  Diags.Report(Loc, Diags.getCustomDiagID(Level, "%0 [%1]"))
-  << Message.Message << Error.CheckName;
+  auto Diag = Diags.Report(Loc, Diags.getCustomDiagID(Level, "%0 [%1]"))
+  << Message.Message << Error.CheckName;
   for (const tooling::Replacement &Fix : Error.Fix) {
 SourceLocation FixLoc = getLocation(Fix.getFilePath(), 
Fix.getOffset());
 SourceLocation FixEndLoc = FixLoc.getLocWithOffset(Fix.getLength());

Modified: clang-tools-extra/trunk/clang-tidy/ClangTidyDiagnosticConsumer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/ClangTidyDiagnosticConsumer.cpp?rev=253203&r1=253202&r2=253203&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/ClangTidyDiagnosticConsumer.cpp 
(original)
+++ clang-tools-extra/trunk/clang-tidy/ClangTidyDiagnosticConsumer.cpp Mon Nov 
16 07:06:15 2015
@@ -132,7 +132,7 @@ static bool ConsumeNegativeIndicator(Str
 static llvm::Regex ConsumeGlob(StringRef &GlobList) {
   StringRef Glob = GlobList.substr(0, GlobList.find(',')).trim();
   GlobList = GlobList.substr(Glob.size() + 1);
-  llvm::SmallString<128> RegexText("^");
+  SmallString<128> RegexText("^");
   StringRef MetaChars("()^$|*+?.[]\\{}");
   for (char C : Glob) {
 if (C == '*')


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


r253207 - Handle ARMv6KZ naming

2015-11-16 Thread Artyom Skrobov via cfe-commits
Author: askrobov
Date: Mon Nov 16 08:05:48 2015
New Revision: 253207

URL: http://llvm.org/viewvc/llvm-project?rev=253207&view=rev
Log:
Handle ARMv6KZ naming

Summary: Update for clang tests for D14568

Reviewers: rengolin, joerg, bogden

Subscribers: aemerson, rengolin, cfe-commits

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

Modified:
cfe/trunk/test/Driver/arm-cortex-cpus.c
cfe/trunk/test/Driver/biarch.c

Modified: cfe/trunk/test/Driver/arm-cortex-cpus.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/arm-cortex-cpus.c?rev=253207&r1=253206&r2=253207&view=diff
==
--- cfe/trunk/test/Driver/arm-cortex-cpus.c (original)
+++ cfe/trunk/test/Driver/arm-cortex-cpus.c Mon Nov 16 08:05:48 2015
@@ -73,11 +73,11 @@
 
 // RUN: %clang -target armv6k -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-V6K %s
 // RUN: %clang -target arm -march=armv6k -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-V6K %s
-// CHECK-V6K: "-cc1"{{.*}} "-triple" "armv6k-{{.*}} "-target-cpu" 
"arm1176jzf-s"
+// CHECK-V6K: "-cc1"{{.*}} "-triple" "armv6k-{{.*}} "-target-cpu" "arm1176j-s"
 
 // RUN: %clang -target armv6k -mthumb -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-V6K-THUMB %s
 // RUN: %clang -target arm -march=armv6k -mthumb -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-V6K-THUMB %s
-// CHECK-V6K-THUMB: "-cc1"{{.*}} "-triple" "thumbv6k-{{.*}} "-target-cpu" 
"arm1176jzf-s"
+// CHECK-V6K-THUMB: "-cc1"{{.*}} "-triple" "thumbv6k-{{.*}} "-target-cpu" 
"arm1176j-s"
 
 // RUN: %clang -target armv6t2 -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-V6T2 %s
 // RUN: %clang -target arm -march=armv6t2 -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-V6T2 %s
@@ -249,12 +249,14 @@
 // RUN: %clang -target arm-linux-gnueabi -mcpu=arm1136jf-s -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-CPUV6 %s
 // CHECK-CPUV6: "-cc1"{{.*}} "-triple" "armv6-{{.*}}
 
-// RUN: %clang -target arm-linux-gnueabi -mcpu=arm1176jz-s -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-CPUV6K %s
-// RUN: %clang -target arm-linux-gnueabi -mcpu=arm1176jzf-s -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-CPUV6K %s
 // RUN: %clang -target arm-linux-gnueabi -mcpu=mpcore -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-CPUV6K %s
 // RUN: %clang -target arm-linux-gnueabi -mcpu=mpcorenovfp -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-CPUV6K %s
 // CHECK-CPUV6K: "-cc1"{{.*}} "-triple" "armv6k-{{.*}}
 
+// RUN: %clang -target arm-linux-gnueabi -mcpu=arm1176jz-s -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-CPUV6KZ %s
+// RUN: %clang -target arm-linux-gnueabi -mcpu=arm1176jzf-s -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-CPUV6KZ %s
+// CHECK-CPUV6KZ: "-cc1"{{.*}} "-triple" "armv6kz-{{.*}}
+
 // RUN: %clang -target arm-linux-gnueabi -mcpu=arm1156t2-s -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-CPUV6T2 %s
 // RUN: %clang -target arm-linux-gnueabi -mcpu=arm1156t2f-s -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-CPUV6T2 %s
 // CHECK-CPUV6T2: "-cc1"{{.*}} "-triple" "armv6t2-{{.*}}

Modified: cfe/trunk/test/Driver/biarch.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/biarch.c?rev=253207&r1=253206&r2=253207&view=diff
==
--- cfe/trunk/test/Driver/biarch.c (original)
+++ cfe/trunk/test/Driver/biarch.c Mon Nov 16 08:05:48 2015
@@ -6,8 +6,9 @@
 // RUN: %clang -target x86_64--netbsd -m64 %s -### 2>&1 | FileCheck 
-check-prefix=X86_64 %s
 // X86_64: "-cc1" "-triple" "x86_64--netbsd"
 
+// r196538 set arm1176jzf-s as default CPU for ARMv6 on NetBSD
 // RUN: %clang -target armv6--netbsd-eabihf -m32 %s -### 2>&1 | FileCheck 
-check-prefix=ARMV6 %s
-// ARMV6: "-cc1" "-triple" "armv6k--netbsd-eabihf"
+// ARMV6: "-cc1" "-triple" "armv6kz--netbsd-eabihf"
 
 // RUN: %clang -target sparcv9--netbsd -m32 %s -### 2>&1 | FileCheck 
-check-prefix=SPARC %s
 // RUN: %clang -target sparc--netbsd -m32 %s -### 2>&1 | FileCheck 
-check-prefix=SPARC %s


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


Re: [PATCH] D14570: Handle ARMv6KZ naming

2015-11-16 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL253207: Handle ARMv6KZ naming (authored by askrobov).

Changed prior to commit:
  http://reviews.llvm.org/D14570?vs=39901&id=40280#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D14570

Files:
  cfe/trunk/test/Driver/arm-cortex-cpus.c
  cfe/trunk/test/Driver/biarch.c

Index: cfe/trunk/test/Driver/arm-cortex-cpus.c
===
--- cfe/trunk/test/Driver/arm-cortex-cpus.c
+++ cfe/trunk/test/Driver/arm-cortex-cpus.c
@@ -73,11 +73,11 @@
 
 // RUN: %clang -target armv6k -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-V6K %s
 // RUN: %clang -target arm -march=armv6k -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-V6K %s
-// CHECK-V6K: "-cc1"{{.*}} "-triple" "armv6k-{{.*}} "-target-cpu" 
"arm1176jzf-s"
+// CHECK-V6K: "-cc1"{{.*}} "-triple" "armv6k-{{.*}} "-target-cpu" "arm1176j-s"
 
 // RUN: %clang -target armv6k -mthumb -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-V6K-THUMB %s
 // RUN: %clang -target arm -march=armv6k -mthumb -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-V6K-THUMB %s
-// CHECK-V6K-THUMB: "-cc1"{{.*}} "-triple" "thumbv6k-{{.*}} "-target-cpu" 
"arm1176jzf-s"
+// CHECK-V6K-THUMB: "-cc1"{{.*}} "-triple" "thumbv6k-{{.*}} "-target-cpu" 
"arm1176j-s"
 
 // RUN: %clang -target armv6t2 -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-V6T2 %s
 // RUN: %clang -target arm -march=armv6t2 -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-V6T2 %s
@@ -249,12 +249,14 @@
 // RUN: %clang -target arm-linux-gnueabi -mcpu=arm1136jf-s -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-CPUV6 %s
 // CHECK-CPUV6: "-cc1"{{.*}} "-triple" "armv6-{{.*}}
 
-// RUN: %clang -target arm-linux-gnueabi -mcpu=arm1176jz-s -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-CPUV6K %s
-// RUN: %clang -target arm-linux-gnueabi -mcpu=arm1176jzf-s -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-CPUV6K %s
 // RUN: %clang -target arm-linux-gnueabi -mcpu=mpcore -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-CPUV6K %s
 // RUN: %clang -target arm-linux-gnueabi -mcpu=mpcorenovfp -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-CPUV6K %s
 // CHECK-CPUV6K: "-cc1"{{.*}} "-triple" "armv6k-{{.*}}
 
+// RUN: %clang -target arm-linux-gnueabi -mcpu=arm1176jz-s -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-CPUV6KZ %s
+// RUN: %clang -target arm-linux-gnueabi -mcpu=arm1176jzf-s -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-CPUV6KZ %s
+// CHECK-CPUV6KZ: "-cc1"{{.*}} "-triple" "armv6kz-{{.*}}
+
 // RUN: %clang -target arm-linux-gnueabi -mcpu=arm1156t2-s -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-CPUV6T2 %s
 // RUN: %clang -target arm-linux-gnueabi -mcpu=arm1156t2f-s -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-CPUV6T2 %s
 // CHECK-CPUV6T2: "-cc1"{{.*}} "-triple" "armv6t2-{{.*}}
Index: cfe/trunk/test/Driver/biarch.c
===
--- cfe/trunk/test/Driver/biarch.c
+++ cfe/trunk/test/Driver/biarch.c
@@ -6,8 +6,9 @@
 // RUN: %clang -target x86_64--netbsd -m64 %s -### 2>&1 | FileCheck 
-check-prefix=X86_64 %s
 // X86_64: "-cc1" "-triple" "x86_64--netbsd"
 
+// r196538 set arm1176jzf-s as default CPU for ARMv6 on NetBSD
 // RUN: %clang -target armv6--netbsd-eabihf -m32 %s -### 2>&1 | FileCheck 
-check-prefix=ARMV6 %s
-// ARMV6: "-cc1" "-triple" "armv6k--netbsd-eabihf"
+// ARMV6: "-cc1" "-triple" "armv6kz--netbsd-eabihf"
 
 // RUN: %clang -target sparcv9--netbsd -m32 %s -### 2>&1 | FileCheck 
-check-prefix=SPARC %s
 // RUN: %clang -target sparc--netbsd -m32 %s -### 2>&1 | FileCheck 
-check-prefix=SPARC %s


Index: cfe/trunk/test/Driver/arm-cortex-cpus.c
===
--- cfe/trunk/test/Driver/arm-cortex-cpus.c
+++ cfe/trunk/test/Driver/arm-cortex-cpus.c
@@ -73,11 +73,11 @@
 
 // RUN: %clang -target armv6k -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V6K %s
 // RUN: %clang -target arm -march=armv6k -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V6K %s
-// CHECK-V6K: "-cc1"{{.*}} "-triple" "armv6k-{{.*}} "-target-cpu" "arm1176jzf-s"
+// CHECK-V6K: "-cc1"{{.*}} "-triple" "armv6k-{{.*}} "-target-cpu" "arm1176j-s"
 
 // RUN: %clang -target armv6k -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V6K-THUMB %s
 // RUN: %clang -target arm -march=armv6k -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V6K-THUMB %s
-// CHECK-V6K-THUMB: "-cc1"{{.*}} "-triple" "thumbv6k-{{.*}} "-target-cpu" "arm1176jzf-s"
+// CHECK-V6K-THUMB: "-cc1"{{.*}} "-triple" "thumbv6k-{{.*}} "-target-cpu" "arm1176j-s"
 
 // RUN: %clang -target armv6t2 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V6T2 %s
 // RUN: %clang -target arm -march=armv6t2 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V6T2 %s
@@ -249,12 +249,14 @@
 // RUN: %clang -target arm-linux-gnueabi -mcpu=arm1136jf-s -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV6 %s
 // CHECK-CPUV6: "-cc1"{{.*}} "-triple" "armv6-{{.*}}
 
-// RUN: %

Re: [PATCH] D14686: Protect against overloaded comma in random_shuffle and improve tests

2015-11-16 Thread Marshall Clow via cfe-commits
mclow.lists added a comment.

Nice catch.  The fix in `` is exactly right, but I think the tests 
need more work.



Comment at: 
test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.pass.cpp:35
@@ -30,1 +34,3 @@
 }
+
+template 

This is not how I would rewrite this test.
I would write a routine that took two "iterators", and called `random_shuffle`, 
and then checked for the desired results.

Then call it with pointers. and RA iters, etc.
for example:

template 
void test(Iter first, Iter last, Iter resFirst, Iter resLast);

test(nullptr, nullptr, nullptr, nullptr);
int source[] = {1, 2, 3, 4};
int res  [] = {1, 2, 3, 4};
const unsigned size = sizeof(source)/sizeof(source[0]);

test(source, source + size, res, res+size); 
test(random_access_iterator(source)  );




Repository:
  rL LLVM

http://reviews.llvm.org/D14686



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


Re: [PATCH] D14609: [ARM, AArch64] Fix __rev16l and __rev16ll intrinsics

2015-11-16 Thread Renato Golin via cfe-commits
rengolin accepted this revision.
rengolin added a reviewer: rengolin.
rengolin added a comment.
This revision is now accepted and ready to land.

LGTM. The 64-bit rev pattern can be added later. Thanks!


Repository:
  rL LLVM

http://reviews.llvm.org/D14609



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


[libcxx] r253212 - Mark P0013 as 'in progress'

2015-11-16 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Mon Nov 16 09:05:09 2015
New Revision: 253212

URL: http://llvm.org/viewvc/llvm-project?rev=253212&view=rev
Log:
Mark P0013 as 'in progress'

Modified:
libcxx/trunk/www/cxx1z_status.html

Modified: libcxx/trunk/www/cxx1z_status.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx1z_status.html?rev=253212&r1=253211&r2=253212&view=diff
==
--- libcxx/trunk/www/cxx1z_status.html (original)
+++ libcxx/trunk/www/cxx1z_status.html Mon Nov 16 09:05:09 2015
@@ -76,7 +76,7 @@
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/P0007R1.html";>P0007R1LWGConstant
 View: A proposal for a std::as_const helper function 
template.KonaIn progress
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/P0156R0.htm"; 
>P0156R0LWGVariadic lock_guard(rev 
3).Kona
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/P0074R0.html";>P0074R0LWGMaking
 std::owner_less more 
flexibleKonaComplete3.8
-   http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/P0013R1.html";>P0013R1LWGLogical
 type traits rev 2Kona
+   http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/P0013R1.html";>P0013R1LWGLogical
 type traits rev 2KonaIn progress
 
   
 


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


Re: [PATCH] D14609: [ARM, AArch64] Fix __rev16l and __rev16ll intrinsics

2015-11-16 Thread Oliver Stannard via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL253211: [ARM,AArch64] Fix __rev16l and __rev16ll intrinsics 
(authored by olista01).

Changed prior to commit:
  http://reviews.llvm.org/D14609?vs=40029&id=40283#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D14609

Files:
  cfe/trunk/lib/Headers/arm_acle.h
  cfe/trunk/test/CodeGen/arm_acle.c

Index: cfe/trunk/lib/Headers/arm_acle.h
===
--- cfe/trunk/lib/Headers/arm_acle.h
+++ cfe/trunk/lib/Headers/arm_acle.h
@@ -175,14 +175,18 @@
   return __ror(__rev(t), 16);
 }
 
-static __inline__ unsigned long __attribute__((__always_inline__, __nodebug__))
-  __rev16l(unsigned long t) {
-return __rorl(__revl(t), sizeof(long) / 2);
-}
-
 static __inline__ uint64_t __attribute__((__always_inline__, __nodebug__))
   __rev16ll(uint64_t t) {
-  return __rorll(__revll(t), 32);
+  return (((uint64_t)__rev16(t >> 32)) << 32) | __rev16(t);
+}
+
+static __inline__ unsigned long __attribute__((__always_inline__, __nodebug__))
+  __rev16l(unsigned long t) {
+#if __SIZEOF_LONG__ == 4
+return __rev16(t);
+#else
+return __rev16ll(t);
+#endif
 }
 
 /* REVSH */
Index: cfe/trunk/test/CodeGen/arm_acle.c
===
--- cfe/trunk/test/CodeGen/arm_acle.c
+++ cfe/trunk/test/CodeGen/arm_acle.c
@@ -186,27 +186,53 @@
 
 // ARM-LABEL: test_rev16
 // ARM: llvm.bswap
-// ARM: lshr
-// ARM: shl
+// ARM: lshr {{.*}}, 16
+// ARM: shl {{.*}}, 16
 // ARM: or
 uint32_t test_rev16(uint32_t t) {
   return __rev16(t);
 }
 
 // ARM-LABEL: test_rev16l
-// ARM: llvm.bswap
-// ARM: lshr
-// ARM: shl
-// ARM: or
+// AArch32: llvm.bswap
+// AArch32: lshr {{.*}}, 16
+// AArch32: shl {{.*}}, 16
+// AArch32: or
+// AArch64: [[T1:%.*]] = lshr i64 [[IN:%.*]], 32
+// AArch64: [[T2:%.*]] = trunc i64 [[T1]] to i32
+// AArch64: [[T3:%.*]] = tail call i32 @llvm.bswap.i32(i32 [[T2]])
+// AArch64: [[T4:%.*]] = lshr i32 [[T3]], 16
+// AArch64: [[T5:%.*]] = shl i32 [[T3]], 16
+// AArch64: [[T6:%.*]] = or i32 [[T5]], [[T4]]
+// AArch64: [[T7:%.*]] = zext i32 [[T6]] to i64
+// AArch64: [[T8:%.*]] = shl nuw i64 [[T7]], 32
+// AArch64: [[T9:%.*]] = trunc i64 [[IN]] to i32
+// AArch64: [[T10:%.*]] = tail call i32 @llvm.bswap.i32(i32 [[T9]])
+// AArch64: [[T11:%.*]] = lshr i32 [[T10]], 16
+// AArch64: [[T12:%.*]] = shl i32 [[T10]], 16
+// AArch64: [[T13:%.*]] = or i32 [[T12]], [[T11]]
+// AArch64: [[T14:%.*]] = zext i32 [[T13]] to i64
+// AArch64: [[T15:%.*]] = or i64 [[T8]], [[T14]]
 long test_rev16l(long t) {
   return __rev16l(t);
 }
 
 // ARM-LABEL: test_rev16ll
-// ARM: llvm.bswap
-// ARM: lshr
-// ARM: shl
-// ARM: or
+// ARM: [[T1:%.*]] = lshr i64 [[IN:%.*]], 32
+// ARM: [[T2:%.*]] = trunc i64 [[T1]] to i32
+// ARM: [[T3:%.*]] = tail call i32 @llvm.bswap.i32(i32 [[T2]])
+// ARM: [[T4:%.*]] = lshr i32 [[T3]], 16
+// ARM: [[T5:%.*]] = shl i32 [[T3]], 16
+// ARM: [[T6:%.*]] = or i32 [[T5]], [[T4]]
+// ARM: [[T7:%.*]] = zext i32 [[T6]] to i64
+// ARM: [[T8:%.*]] = shl nuw i64 [[T7]], 32
+// ARM: [[T9:%.*]] = trunc i64 [[IN]] to i32
+// ARM: [[T10:%.*]] = tail call i32 @llvm.bswap.i32(i32 [[T9]])
+// ARM: [[T11:%.*]] = lshr i32 [[T10]], 16
+// ARM: [[T12:%.*]] = shl i32 [[T10]], 16
+// ARM: [[T13:%.*]] = or i32 [[T12]], [[T11]]
+// ARM: [[T14:%.*]] = zext i32 [[T13]] to i64
+// ARM: [[T15:%.*]] = or i64 [[T8]], [[T14]]
 uint64_t test_rev16ll(uint64_t t) {
   return __rev16ll(t);
 }


Index: cfe/trunk/lib/Headers/arm_acle.h
===
--- cfe/trunk/lib/Headers/arm_acle.h
+++ cfe/trunk/lib/Headers/arm_acle.h
@@ -175,14 +175,18 @@
   return __ror(__rev(t), 16);
 }
 
-static __inline__ unsigned long __attribute__((__always_inline__, __nodebug__))
-  __rev16l(unsigned long t) {
-return __rorl(__revl(t), sizeof(long) / 2);
-}
-
 static __inline__ uint64_t __attribute__((__always_inline__, __nodebug__))
   __rev16ll(uint64_t t) {
-  return __rorll(__revll(t), 32);
+  return (((uint64_t)__rev16(t >> 32)) << 32) | __rev16(t);
+}
+
+static __inline__ unsigned long __attribute__((__always_inline__, __nodebug__))
+  __rev16l(unsigned long t) {
+#if __SIZEOF_LONG__ == 4
+return __rev16(t);
+#else
+return __rev16ll(t);
+#endif
 }
 
 /* REVSH */
Index: cfe/trunk/test/CodeGen/arm_acle.c
===
--- cfe/trunk/test/CodeGen/arm_acle.c
+++ cfe/trunk/test/CodeGen/arm_acle.c
@@ -186,27 +186,53 @@
 
 // ARM-LABEL: test_rev16
 // ARM: llvm.bswap
-// ARM: lshr
-// ARM: shl
+// ARM: lshr {{.*}}, 16
+// ARM: shl {{.*}}, 16
 // ARM: or
 uint32_t test_rev16(uint32_t t) {
   return __rev16(t);
 }
 
 // ARM-LABEL: test_rev16l
-// ARM: llvm.bswap
-// ARM: lshr
-// ARM: shl
-// ARM: or
+// AArch32: llvm.bswap
+// AArch32: lshr {{.*}}, 16
+// AArch32: shl {{.*}}, 16
+// AArch32: or
+// AArch64: [[T1:%.*]] = lshr i64 [[IN:%.*]], 32
+// AArch64: [[T2:%.*]] = 

r253211 - [ARM,AArch64] Fix __rev16l and __rev16ll intrinsics

2015-11-16 Thread Oliver Stannard via cfe-commits
Author: olista01
Date: Mon Nov 16 08:58:50 2015
New Revision: 253211

URL: http://llvm.org/viewvc/llvm-project?rev=253211&view=rev
Log:
[ARM,AArch64] Fix __rev16l and __rev16ll intrinsics

These two intrinsics are defined in arm_acle.h.

__rev16l needs to rotate by 16 bits, bit it was actually rotating by 2 bits.
For AArch64, where long is 64 bits, this would still be wrong.

__rev16ll was incorrect, it reversed the bytes in each 32-bit word, rather than
each 16-bit halfword. The correct implementation is to apply __rev16 to the top
and bottom words of the 64-bit value.

For AArch32 targets, these get compiled down to the hardware rev16 instruction
at -O1 and above. For AArch64 targets, the 64-bit ones get compiled to two
32-bit rev16 instructions, because there is not currently a pattern for the
64-bit rev16 instruction.

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

Modified:
cfe/trunk/lib/Headers/arm_acle.h
cfe/trunk/test/CodeGen/arm_acle.c

Modified: cfe/trunk/lib/Headers/arm_acle.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/arm_acle.h?rev=253211&r1=253210&r2=253211&view=diff
==
--- cfe/trunk/lib/Headers/arm_acle.h (original)
+++ cfe/trunk/lib/Headers/arm_acle.h Mon Nov 16 08:58:50 2015
@@ -175,14 +175,18 @@ static __inline__ uint32_t __attribute__
   return __ror(__rev(t), 16);
 }
 
-static __inline__ unsigned long __attribute__((__always_inline__, __nodebug__))
-  __rev16l(unsigned long t) {
-return __rorl(__revl(t), sizeof(long) / 2);
-}
-
 static __inline__ uint64_t __attribute__((__always_inline__, __nodebug__))
   __rev16ll(uint64_t t) {
-  return __rorll(__revll(t), 32);
+  return (((uint64_t)__rev16(t >> 32)) << 32) | __rev16(t);
+}
+
+static __inline__ unsigned long __attribute__((__always_inline__, __nodebug__))
+  __rev16l(unsigned long t) {
+#if __SIZEOF_LONG__ == 4
+return __rev16(t);
+#else
+return __rev16ll(t);
+#endif
 }
 
 /* REVSH */

Modified: cfe/trunk/test/CodeGen/arm_acle.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/arm_acle.c?rev=253211&r1=253210&r2=253211&view=diff
==
--- cfe/trunk/test/CodeGen/arm_acle.c (original)
+++ cfe/trunk/test/CodeGen/arm_acle.c Mon Nov 16 08:58:50 2015
@@ -186,27 +186,53 @@ uint64_t test_revll(uint64_t t) {
 
 // ARM-LABEL: test_rev16
 // ARM: llvm.bswap
-// ARM: lshr
-// ARM: shl
+// ARM: lshr {{.*}}, 16
+// ARM: shl {{.*}}, 16
 // ARM: or
 uint32_t test_rev16(uint32_t t) {
   return __rev16(t);
 }
 
 // ARM-LABEL: test_rev16l
-// ARM: llvm.bswap
-// ARM: lshr
-// ARM: shl
-// ARM: or
+// AArch32: llvm.bswap
+// AArch32: lshr {{.*}}, 16
+// AArch32: shl {{.*}}, 16
+// AArch32: or
+// AArch64: [[T1:%.*]] = lshr i64 [[IN:%.*]], 32
+// AArch64: [[T2:%.*]] = trunc i64 [[T1]] to i32
+// AArch64: [[T3:%.*]] = tail call i32 @llvm.bswap.i32(i32 [[T2]])
+// AArch64: [[T4:%.*]] = lshr i32 [[T3]], 16
+// AArch64: [[T5:%.*]] = shl i32 [[T3]], 16
+// AArch64: [[T6:%.*]] = or i32 [[T5]], [[T4]]
+// AArch64: [[T7:%.*]] = zext i32 [[T6]] to i64
+// AArch64: [[T8:%.*]] = shl nuw i64 [[T7]], 32
+// AArch64: [[T9:%.*]] = trunc i64 [[IN]] to i32
+// AArch64: [[T10:%.*]] = tail call i32 @llvm.bswap.i32(i32 [[T9]])
+// AArch64: [[T11:%.*]] = lshr i32 [[T10]], 16
+// AArch64: [[T12:%.*]] = shl i32 [[T10]], 16
+// AArch64: [[T13:%.*]] = or i32 [[T12]], [[T11]]
+// AArch64: [[T14:%.*]] = zext i32 [[T13]] to i64
+// AArch64: [[T15:%.*]] = or i64 [[T8]], [[T14]]
 long test_rev16l(long t) {
   return __rev16l(t);
 }
 
 // ARM-LABEL: test_rev16ll
-// ARM: llvm.bswap
-// ARM: lshr
-// ARM: shl
-// ARM: or
+// ARM: [[T1:%.*]] = lshr i64 [[IN:%.*]], 32
+// ARM: [[T2:%.*]] = trunc i64 [[T1]] to i32
+// ARM: [[T3:%.*]] = tail call i32 @llvm.bswap.i32(i32 [[T2]])
+// ARM: [[T4:%.*]] = lshr i32 [[T3]], 16
+// ARM: [[T5:%.*]] = shl i32 [[T3]], 16
+// ARM: [[T6:%.*]] = or i32 [[T5]], [[T4]]
+// ARM: [[T7:%.*]] = zext i32 [[T6]] to i64
+// ARM: [[T8:%.*]] = shl nuw i64 [[T7]], 32
+// ARM: [[T9:%.*]] = trunc i64 [[IN]] to i32
+// ARM: [[T10:%.*]] = tail call i32 @llvm.bswap.i32(i32 [[T9]])
+// ARM: [[T11:%.*]] = lshr i32 [[T10]], 16
+// ARM: [[T12:%.*]] = shl i32 [[T10]], 16
+// ARM: [[T13:%.*]] = or i32 [[T12]], [[T11]]
+// ARM: [[T14:%.*]] = zext i32 [[T13]] to i64
+// ARM: [[T15:%.*]] = or i64 [[T8]], [[T14]]
 uint64_t test_rev16ll(uint64_t t) {
   return __rev16ll(t);
 }


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


Re: [PATCH] D9600: Add scan-build python implementation

2015-11-16 Thread Jonathan Roelofs via cfe-commits
jroelofs added a comment.

Thanks for re-uploading!



Comment at: tools/scan-build-py/README.md:39
@@ +38,3 @@
+
+$ python setup.py build
+$ python setup.py install

Mind adding a CMakeLists.txt to drive these from the clang build itself?


Comment at: tools/scan-build-py/libscanbuild/__init__.py:7
@@ +6,3 @@
+"""
+This module responsible to run the Clang static analyzer against any build
+and generate reports.

I think most of this block comment belongs in a new file: 
clang/docs/ScanBuild.rst


Comment at: tools/scan-build-py/tests/functional/src/build/Makefile:1
@@ +1,2 @@
+SRCDIR := ..
+OBJDIR := .

It'd probably be a good idea to structure these test inputs into their own 
"projects" so that support for more build system can be added later.

I'd suggest something like:

tools/scan-build-py/tests/functional/
simple_makefile
src
clean-one.c
broken-two.c
clean-one.c
clean-two.c
build
Makefile
cmake_makefiles
src
...
build
CMakeLists.txt
cmake_ninja
src
...
build
CMakeLists.txt


Comment at: tools/scan-build-py/tests/unit/__init__.py:16
@@ +15,3 @@
+
+def load_tests(loader, suite, pattern):
+suite.addTests(loader.loadTestsFromModule(test_command))

Mind hooking these up so that a LIT test harness can run them too? We use LIT 
to test pretty much everything else in the llvm project, and it'd be a shame to 
have a tool with a completely different way of running tests...


http://reviews.llvm.org/D9600



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


r253213 - [Myriad]: pass the 'std=' option to moviCompile

2015-11-16 Thread Douglas Katzman via cfe-commits
Author: dougk
Date: Mon Nov 16 09:38:40 2015
New Revision: 253213

URL: http://llvm.org/viewvc/llvm-project?rev=253213&view=rev
Log:
[Myriad]: pass the 'std=' option to moviCompile

Modified:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/myriad-toolchain.c

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=253213&r1=253212&r2=253213&view=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Mon Nov 16 09:38:40 2015
@@ -9890,7 +9890,7 @@ void tools::SHAVE::Compiler::ConstructJo
   // 'f' flags, optimize flags, and warning options.
   // These are spelled the same way in clang and moviCompile.
   Args.AddAllArgs(CmdArgs, {options::OPT_I_Group, options::OPT_clang_i_Group,
-options::OPT_D, options::OPT_U,
+options::OPT_std_EQ, options::OPT_D, 
options::OPT_U,
 options::OPT_f_Group, options::OPT_f_clang_Group,
 options::OPT_g_Group, options::OPT_M_Group,
 options::OPT_O_Group, options::OPT_W_Group});

Modified: cfe/trunk/test/Driver/myriad-toolchain.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/myriad-toolchain.c?rev=253213&r1=253212&r2=253213&view=diff
==
--- cfe/trunk/test/Driver/myriad-toolchain.c (original)
+++ cfe/trunk/test/Driver/myriad-toolchain.c Mon Nov 16 09:38:40 2015
@@ -60,6 +60,10 @@
 // RUN:   | FileCheck %s -check-prefix=MDMF
 // MDMF: "-S" "-MD" "-MF" "dep.d" "-MT" "foo.o"
 
+// RUN: %clang -target shave-myriad -std=gnu++11 -S %s -o foo.o -### 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=STDEQ
+// STDEQ: "-mcpu=myriad2" "-S" "-std=gnu++11"
+
 // RUN: %clang -target sparc-myriad -### --driver-mode=g++ %s 2>&1 | FileCheck 
%s --check-prefix=STDLIBCXX
 // STDLIBCXX: "-lstdc++" "-lc" "-lgcc"
 


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


r253214 - [mips] Do not add arch name in the compiler-rt's components.

2015-11-16 Thread Vasileios Kalintiris via cfe-commits
Author: vkalintiris
Date: Mon Nov 16 09:41:30 2015
New Revision: 253214

URL: http://llvm.org/viewvc/llvm-project?rev=253214&view=rev
Log:
[mips] Do not add arch name in the compiler-rt's components.

Instead, use the constant "mips" since the libraries are already
placed under the multilib's OS suffix.

Modified:
cfe/trunk/lib/Driver/ToolChains.cpp
cfe/trunk/test/Driver/mips-mti-linux.c

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=253214&r1=253213&r2=253214&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Mon Nov 16 09:41:30 2015
@@ -2517,8 +2517,7 @@ std::string MipsLLVMToolChain::getCompil
   llvm::sys::path::append(Path, SelectedMultilib.osSuffix(), "lib" + LibSuffix,
   getOS());
   llvm::sys::path::append(Path, Twine("libclang_rt." + Component + "-" +
-  getTriple().getArchName() +
-  (Shared ? ".so" : ".a")));
+  "mips" + (Shared ? ".so" : ".a")));
   return Path.str();
 }
 

Modified: cfe/trunk/test/Driver/mips-mti-linux.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mips-mti-linux.c?rev=253214&r1=253213&r2=253214&view=diff
==
--- cfe/trunk/test/Driver/mips-mti-linux.c (original)
+++ cfe/trunk/test/Driver/mips-mti-linux.c Mon Nov 16 09:41:30 2015
@@ -37,6 +37,6 @@
 // CHECK-LE-HF-32R2-SAME: 
"[[SYSROOT]]/mipsel-r2-hard-musl/usr/lib{{/|}}crt1.o"
 // CHECK-LE-HF-32R2-SAME: 
"[[SYSROOT]]/mipsel-r2-hard-musl/usr/lib{{/|}}crti.o"
 // CHECK-LE-HF-32R2-SAME: "-L[[SYSROOT]]/mipsel-r2-hard-musl/usr/lib"
-// CHECK-LE-HF-32R2-SAME: 
"{{[^"]+}}/mipsel-r2-hard-musl{{/|}}lib{{/|}}linux{{/|}}libclang_rt.builtins-mipsel.a"
+// CHECK-LE-HF-32R2-SAME: 
"{{[^"]+}}/mipsel-r2-hard-musl{{/|}}lib{{/|}}linux{{/|}}libclang_rt.builtins-mips.a"
 // CHECK-LE-HF-32R2-SAME: "-lc"
 // CHECK-LE-HF-32R2-SAME: 
"[[SYSROOT]]/mipsel-r2-hard-musl/usr/lib{{/|}}crtn.o"


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


Re: [PATCH] D14686: Protect against overloaded comma in random_shuffle and improve tests

2015-11-16 Thread Dmitri Gribenko via cfe-commits
gribozavr added inline comments.


Comment at: 
test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.pass.cpp:35
@@ -30,1 +34,3 @@
 }
+
+template 

mclow.lists wrote:
> This is not how I would rewrite this test.
> I would write a routine that took two "iterators", and called 
> `random_shuffle`, and then checked for the desired results.
> 
> Then call it with pointers. and RA iters, etc.
> for example:
> 
> template 
> void test(Iter first, Iter last, Iter resFirst, Iter resLast);
> 
> test(nullptr, nullptr, nullptr, nullptr);
> int source[] = {1, 2, 3, 4};
> int res  [] = {1, 2, 3, 4};
> const unsigned size = sizeof(source)/sizeof(source[0]);
> 
> test(source, source + size, res, res+size); 
> test(random_access_iterator(source)  );
> 
> 
I actually thought about this, and it is hard to rewrite it like that for two 
reasons.  First, `random_shuffle` mutates the elements, so one needs to restore 
the original sequence between calls to `test()` (otherwise it is not obvious 
that it was mutated).  Second, this overload of `random_shuffle` takes 
randomness from global state, so one can't just specify one expected result in 
the test.  That's why I first check for the initial shuffle exactly, and then 
only check that the output is a permutation of input.



Repository:
  rL LLVM

http://reviews.llvm.org/D14686



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


[libcxx] r253215 - Implement P0013R1: Logical Operator Type Traits. Make a hidden implementation (__and_, __or_, and __not_) so that we can use them elsewhere in non-C++17 code - for example, in the L

2015-11-16 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Mon Nov 16 09:54:13 2015
New Revision: 253215

URL: http://llvm.org/viewvc/llvm-project?rev=253215&view=rev
Log:
Implement P0013R1: Logical Operator Type Traits. Make a hidden implementation 
(__and_, __or_, and __not_) so that we can use them elsewhere in non-C++17 code 
- for example, in the LFTS

Added:
libcxx/trunk/test/std/utilities/meta/meta.logical/
libcxx/trunk/test/std/utilities/meta/meta.logical/conjunction.pass.cpp
libcxx/trunk/test/std/utilities/meta/meta.logical/disjunction.pass.cpp
libcxx/trunk/test/std/utilities/meta/meta.logical/negation.pass.cpp
Modified:
libcxx/trunk/include/type_traits
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=253215&r1=253214&r2=253215&view=diff
==
--- libcxx/trunk/include/type_traits (original)
+++ libcxx/trunk/include/type_traits Mon Nov 16 09:54:13 2015
@@ -205,145 +205,157 @@ namespace std
 template 
   using void_t = void;   // C++17
   
- // See C++14 20.10.4.1, primary type categories
- template  constexpr bool is_void_v
-   = is_void::value;
 // C++17
- template  constexpr bool is_null_pointer_v
-   = is_null_pointer::value;
 // C++17
- template  constexpr bool is_integral_v
-   = is_integral::value;
 // C++17
- template  constexpr bool is_floating_point_v
-   = is_floating_point::value;  
 // C++17
- template  constexpr bool is_array_v
-   = is_array::value;   
 // C++17
- template  constexpr bool is_pointer_v
-   = is_pointer::value; 
 // C++17
- template  constexpr bool is_lvalue_reference_v
-   = is_lvalue_reference::value;
 // C++17
- template  constexpr bool is_rvalue_reference_v
-   = is_rvalue_reference::value;
 // C++17
- template  constexpr bool is_member_object_pointer_v
-   = is_member_object_pointer::value;   
 // C++17
- template  constexpr bool is_member_function_pointer_v
-   = is_member_function_pointer::value; 
 // C++17
- template  constexpr bool is_enum_v
-   = is_enum::value;
 // C++17
- template  constexpr bool is_union_v
-   = is_union::value;   
 // C++17
- template  constexpr bool is_class_v
-   = is_class::value;   
 // C++17
- template  constexpr bool is_function_v
-   = is_function::value;
 // C++17
-
- // See C++14 20.10.4.2, composite type categories
- template  constexpr bool is_reference_v
-   = is_reference::value;   
 // C++17
- template  constexpr bool is_arithmetic_v
-   = is_arithmetic::value;  
 // C++17
- template  constexpr bool is_fundamental_v
-   = is_fundamental::value; 
 // C++17
- template  constexpr bool is_object_v
-   = is_object::value;  
 // C++17
- template  constexpr bool is_scalar_v
-   = is_scalar::value;  
 // C++17
- template  constexpr bool is_compound_v
-   = is_compound::value;
 // C++17
- template  constexpr bool is_member_pointer_v
-   = is_member_pointer::value;  
 // C++17
-
- // See C++14 20.10.4.3, type properties
- template  constexpr bool is_const_v
-   = is_const::value;   
 // C++17
- template  constexpr bool is_volatile_v
-   = is_volatile::value;
 // C++17
- template  constexpr bool is_trivial_v
-   = is_trivial::value; 
 // C++17
- template  constexpr bool is_trivially_copyable_v
-   = is_trivially_copyable::value;  
 // C++17
- template  constexpr bool is_standard_layout_v
-   = is_standard_layout::value; 
 // C++17
- template  constexpr bool is_pod_v
-   = is_

[libcxx] r253223 - LWG#2156 loosened the requirements on unordered containers 'rehash' calls. Add tests to make sure we meet these requirements. Since we met the stricter ones, no code change needed t

2015-11-16 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Mon Nov 16 10:42:16 2015
New Revision: 253223

URL: http://llvm.org/viewvc/llvm-project?rev=253223&view=rev
Log:
LWG#2156 loosened the requirements on unordered containers 'rehash' calls. Add 
tests to make sure we meet these requirements. Since we met the stricter ones, 
no code change needed to meet the looser ones.

Modified:
libcxx/trunk/test/std/containers/unord/unord.map/rehash.pass.cpp
libcxx/trunk/test/std/containers/unord/unord.multimap/rehash.pass.cpp
libcxx/trunk/test/std/containers/unord/unord.multiset/rehash.pass.cpp
libcxx/trunk/test/std/containers/unord/unord.set/rehash.pass.cpp
libcxx/trunk/www/cxx1z_status.html

Modified: libcxx/trunk/test/std/containers/unord/unord.map/rehash.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/unord/unord.map/rehash.pass.cpp?rev=253223&r1=253222&r2=253223&view=diff
==
--- libcxx/trunk/test/std/containers/unord/unord.map/rehash.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/unord/unord.map/rehash.pass.cpp Mon Nov 16 
10:42:16 2015
@@ -22,6 +22,12 @@
 #include "min_allocator.h"
 
 template 
+void rehash_postcondition(const C& c, size_t n)
+{
+   assert(c.bucket_count() >= c.size() / c.max_load_factor() && 
c.bucket_count() >= n);
+}
+
+template 
 void test(const C& c)
 {
 assert(c.size() == 4);
@@ -49,13 +55,16 @@ int main()
 test(c);
 assert(c.bucket_count() >= 5);
 c.rehash(3);
+rehash_postcondition(c, 3);
 assert(c.bucket_count() == 5);
 test(c);
 c.max_load_factor(2);
 c.rehash(3);
+rehash_postcondition(c, 3);
 assert(c.bucket_count() == 3);
 test(c);
 c.rehash(31);
+rehash_postcondition(c, 31);
 assert(c.bucket_count() == 31);
 test(c);
 }
@@ -77,13 +86,16 @@ int main()
 test(c);
 assert(c.bucket_count() >= 5);
 c.rehash(3);
+rehash_postcondition(c, 3);
 assert(c.bucket_count() == 5);
 test(c);
 c.max_load_factor(2);
 c.rehash(3);
+rehash_postcondition(c, 3);
 assert(c.bucket_count() == 3);
 test(c);
 c.rehash(31);
+rehash_postcondition(c, 31);
 assert(c.bucket_count() == 31);
 test(c);
 }

Modified: libcxx/trunk/test/std/containers/unord/unord.multimap/rehash.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/unord/unord.multimap/rehash.pass.cpp?rev=253223&r1=253222&r2=253223&view=diff
==
--- libcxx/trunk/test/std/containers/unord/unord.multimap/rehash.pass.cpp 
(original)
+++ libcxx/trunk/test/std/containers/unord/unord.multimap/rehash.pass.cpp Mon 
Nov 16 10:42:16 2015
@@ -23,6 +23,12 @@
 #include "min_allocator.h"
 
 template 
+void rehash_postcondition(const C& c, size_t n)
+{
+   assert(c.bucket_count() >= c.size() / c.max_load_factor() && 
c.bucket_count() >= n);
+}
+
+template 
 void test(const C& c)
 {
 assert(c.size() == 6);
@@ -77,13 +83,16 @@ int main()
 test(c);
 assert(c.bucket_count() >= 7);
 c.rehash(3);
+rehash_postcondition(c, 3);
 assert(c.bucket_count() == 7);
 test(c);
 c.max_load_factor(2);
 c.rehash(3);
+rehash_postcondition(c, 3);
 assert(c.bucket_count() == 3);
 test(c);
 c.rehash(31);
+rehash_postcondition(c, 31);
 assert(c.bucket_count() == 31);
 test(c);
 }
@@ -105,13 +114,16 @@ int main()
 test(c);
 assert(c.bucket_count() >= 7);
 c.rehash(3);
+rehash_postcondition(c, 3);
 assert(c.bucket_count() == 7);
 test(c);
 c.max_load_factor(2);
 c.rehash(3);
+rehash_postcondition(c, 3);
 assert(c.bucket_count() == 3);
 test(c);
 c.rehash(31);
+rehash_postcondition(c, 31);
 assert(c.bucket_count() == 31);
 test(c);
 }

Modified: libcxx/trunk/test/std/containers/unord/unord.multiset/rehash.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/unord/unord.multiset/rehash.pass.cpp?rev=253223&r1=253222&r2=253223&view=diff
==
--- libcxx/trunk/test/std/containers/unord/unord.multiset/rehash.pass.cpp 
(original)
+++ libcxx/trunk/test/std/containers/unord/unord.multiset/rehash.pass.cpp Mon 
Nov 16 10:42:16 2015
@@ -21,6 +21,12 @@
 #include "min_allocator.h"
 
 template 
+void rehash_postcondition(const C& c, size_t n)
+{
+   assert(c.bucket_count() >= c.size() / c.max_load_factor() && 
c.bucket_count() >= n);
+}
+
+template 
 void test(const C& c)
 {
 assert(c.size() == 6);
@@ -48,13 +54,16 @@ int main()
 test(c);
 assert(c.bucket_count() >= 7);
 

Re: [PATCH] D14215: Disable frame pointer elimination when using -pg

2015-11-16 Thread Sanjay Patel via cfe-commits
spatel added a subscriber: spatel.
spatel added reviewers: davidxl, dnovillo, slingn.
spatel added a comment.

Adding some PGO-active reviewers.


http://reviews.llvm.org/D14215



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


Re: [PATCH] D14653: [libcxx] Introduce the mechanism for fixing -fno-exceptions test failures.

2015-11-16 Thread Asiri Rathnayake via cfe-commits
rmaprath updated this revision to Diff 40307.
rmaprath added a comment.

Tidied up the patch a bit:

- Got rid of the different variants of the throw_helper function, can do with 
one in almost all the cases (the exceptional case will be submitted for review 
separately).
- Modified __config a little to make the compiler not complain about 
re-defining _LIBCPP_NO_EXCEPTIONS macro when compiling with -fno-exceptions 
(NFC).


http://reviews.llvm.org/D14653

Files:
  include/__config
  include/__noexcept
  include/array
  test/std/containers/sequences/array/at.pass.cpp
  test/support/noexcept.h

Index: test/support/noexcept.h
===
--- /dev/null
+++ test/support/noexcept.h
@@ -0,0 +1,41 @@
+// -*- C++ -*-
+//===- noexcept.h -===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+#ifdef _LIBCPP_NO_EXCEPTIONS
+
+#include
+#include
+#include
+
+jmp_buf try_buf;
+
+// Re-write try/catch with if/else to mimic a similar control flow when testing
+// the no-exceptions library variant. The idea is to save as much of the usual
+// with-exceptions assertions as possible. This of course does not work when
+// there are multiple catch statements, in those cases we have to use the
+// _LIBCPP_NO_EXCEPTIONS macro as appropriate; such cases are rare.
+#define try if(!setjmp(try_buf))
+#define catch(ex) else
+
+// The default assert macro calls abort(), we don't want that.
+#undef assert
+
+static void noexcept_assert_failed(const char *exp, const char *file, int line) {
+  fprintf(stderr, "Assertion failed: (%s), at %s line %d.\n", exp, file, line);
+  exit(-1);
+}
+
+#define assert(e) (e) ? (void) 0 : noexcept_assert_failed(#e, __FILE__, __LINE__);
+
+// Jump back to the catch (now else) clause.
+extern "C" void abort(void) {
+  longjmp(try_buf, 1);
+}
+
+#endif // _LIBCPP_NO_EXCEPTIONS
Index: test/std/containers/sequences/array/at.pass.cpp
===
--- test/std/containers/sequences/array/at.pass.cpp
+++ test/std/containers/sequences/array/at.pass.cpp
@@ -7,7 +7,6 @@
 //
 //===--===//
 
-// XFAIL: libcpp-no-exceptions
 // 
 
 // reference operator[] (size_type)
@@ -19,6 +18,7 @@
 #include 
 
 #include "test_macros.h"
+#include "noexcept.h"
 
 // std::array is explicitly allowed to be initialized with A a = { init-list };.
 // Disable the missing braces warning for this reason.
Index: include/array
===
--- include/array
+++ include/array
@@ -110,6 +110,7 @@
 #if defined(_LIBCPP_NO_EXCEPTIONS)
 #include 
 #endif
+#include <__noexcept>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header
@@ -201,11 +202,7 @@
 array<_Tp, _Size>::at(size_type __n)
 {
 if (__n >= _Size)
-#ifndef _LIBCPP_NO_EXCEPTIONS
-throw out_of_range("array::at");
-#else
-assert(!"array::at out_of_range");
-#endif
+throw_helper(out_of_range("array::at out_of_range"));
 return __elems_[__n];
 }
 
@@ -215,11 +212,7 @@
 array<_Tp, _Size>::at(size_type __n) const
 {
 if (__n >= _Size)
-#ifndef _LIBCPP_NO_EXCEPTIONS
-throw out_of_range("array::at");
-#else
-assert(!"array::at out_of_range");
-#endif
+throw_helper(out_of_range("array::at out_of_range"));
 return __elems_[__n];
 }
 
Index: include/__noexcept
===
--- /dev/null
+++ include/__noexcept
@@ -0,0 +1,39 @@
+// -*- C++ -*-
+//===-- __noexcept ===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+#ifndef _LIBCPP_NOEXCEPT_H
+#define _LIBCPP_NOEXCEPT_H
+
+#include <__config>
+
+#ifdef _LIBCPP_NO_EXCEPTIONS
+#include
+#include
+#endif
+
+template
+inline void throw_helper(T t, const char *msg = nullptr)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+throw t;
+#else
+if (msg) // explicit error message provided
+  fprintf(stderr, "%s\n", msg);
+// FIXME: instead of using the default what() string of the std::exception
+// class, make all the exception classes return a meaningful error message.
+else if (t.what())
+  fprintf(stderr, "%s\n", t.what());
+else // use a generic error message
+  fprintf(stderr, "exception raised, cannot propagate. Aborting.\n");
+abort();
+#endif
+}
+
+#endif // _LIBCPP_NOEXCEPT_H
I

Re: r252834 - Provide a frontend based error for always_inline functions that require

2015-11-16 Thread Bruno Cardoso Lopes via cfe-commits
Hi Eric,

On Fri, Nov 13, 2015 at 8:55 PM, Eric Christopher  wrote:
> This all sounds a little weird as _mm_mul_ps only requires sse. Can you give
> me a testcase and command line that you're using to trigger this?

clang -O3 -flto -arch x86_64h -fomit-frame-pointer -c
test-suite/SingleSource/UnitTests/Vector/SSE/sse.expandfft.c -o
/dev/null

Thanks,

-- 
Bruno Cardoso Lopes
http://www.brunocardoso.cc
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r253242 - When producing error messages for always_inline functions with the

2015-11-16 Thread Eric Christopher via cfe-commits
Author: echristo
Date: Mon Nov 16 12:29:59 2015
New Revision: 253242

URL: http://llvm.org/viewvc/llvm-project?rev=253242&view=rev
Log:
When producing error messages for always_inline functions with the
target attribute, don't include "negative" subtarget features in the
list of required features. Builtins are positive by default so don't
need this change, but we pull the default list of features from the
command line and so need to make sure that we only include features
that are turned on for code generation in our error.

Added:
cfe/trunk/test/CodeGen/target-features-no-error.c
Modified:
cfe/trunk/lib/CodeGen/CodeGenFunction.cpp

Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.cpp?rev=253242&r1=253241&r2=253242&view=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenFunction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.cpp Mon Nov 16 12:29:59 2015
@@ -1917,8 +1917,11 @@ void CodeGenFunction::checkTargetFeature
 SmallVector ReqFeatures;
 llvm::StringMap CalleeFeatureMap;
 CGM.getFunctionFeatureMap(CalleeFeatureMap, TargetDecl);
-for (const auto &F : CalleeFeatureMap)
-  ReqFeatures.push_back(F.getKey());
+for (const auto &F : CalleeFeatureMap) {
+  // Only positive features are "required".
+  if (F.getValue())
+ReqFeatures.push_back(F.getKey());
+}
 if (!hasRequiredFeatures(ReqFeatures, CGM, FD, MissingFeature))
   CGM.getDiags().Report(E->getLocStart(), diag::err_function_needs_feature)
   << FD->getDeclName() << TargetDecl->getDeclName() << MissingFeature;

Added: cfe/trunk/test/CodeGen/target-features-no-error.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/target-features-no-error.c?rev=253242&view=auto
==
--- cfe/trunk/test/CodeGen/target-features-no-error.c (added)
+++ cfe/trunk/test/CodeGen/target-features-no-error.c Mon Nov 16 12:29:59 2015
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 %s -triple=x86_64-linux-gnu -emit-llvm -o - -target-feature 
-sse2
+
+// Verify that negative features don't cause additional requirements on the 
inline function.
+int __attribute__((target("sse"), always_inline)) foo(int a) {
+  return a + 4;
+}
+int bar() {
+  return foo(4); // expected-no-diagnostics
+}


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


Re: r252834 - Provide a frontend based error for always_inline functions that require

2015-11-16 Thread Eric Christopher via cfe-commits
Fixed thusly:

dzur:~/sources/llvm/tools/clang> git svn dcommit
Committing to https://llvm.org/svn/llvm-project/cfe/trunk ...
A test/CodeGen/target-features-no-error.c
M lib/CodeGen/CodeGenFunction.cpp
Committed r253242

Thanks!

-eric

On Mon, Nov 16, 2015 at 9:48 AM Bruno Cardoso Lopes 
wrote:

> Hi Eric,
>
> On Fri, Nov 13, 2015 at 8:55 PM, Eric Christopher 
> wrote:
> > This all sounds a little weird as _mm_mul_ps only requires sse. Can you
> give
> > me a testcase and command line that you're using to trigger this?
>
> clang -O3 -flto -arch x86_64h -fomit-frame-pointer -c
> test-suite/SingleSource/UnitTests/Vector/SSE/sse.expandfft.c -o
> /dev/null
>
> Thanks,
>
> --
> Bruno Cardoso Lopes
> http://www.brunocardoso.cc
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r253202 - clang-format: Enable #include sorting by default.

2015-11-16 Thread Eric Christopher via cfe-commits
!!!

Awesome :)

-eric

On Mon, Nov 16, 2015 at 4:41 AM Daniel Jasper via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: djasper
> Date: Mon Nov 16 06:38:56 2015
> New Revision: 253202
>
> URL: http://llvm.org/viewvc/llvm-project?rev=253202&view=rev
> Log:
> clang-format: Enable #include sorting by default.
>
> This has seen quite some usage and I am not aware of any issues. Also
> add a style option to enable/disable include sorting. The existing
> command line flag can from now on be used to override whatever is set
> in the style.
>
> Added:
> cfe/trunk/test/Format/disable-include-sorting.cpp
> Modified:
> cfe/trunk/include/clang/Format/Format.h
> cfe/trunk/lib/Format/Format.cpp
> cfe/trunk/tools/clang-format/ClangFormat.cpp
> cfe/trunk/tools/clang-format/clang-format-sublime.py
> cfe/trunk/tools/clang-format/clang-format.el
> cfe/trunk/tools/clang-format/clang-format.py
> cfe/trunk/unittests/Format/FormatTest.cpp
> cfe/trunk/unittests/Format/SortIncludesTest.cpp
>
> Modified: cfe/trunk/include/clang/Format/Format.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Format/Format.h?rev=253202&r1=253201&r2=253202&view=diff
>
> ==
> --- cfe/trunk/include/clang/Format/Format.h (original)
> +++ cfe/trunk/include/clang/Format/Format.h Mon Nov 16 06:38:56 2015
> @@ -469,6 +469,9 @@ struct FormatStyle {
>/// Pointer and reference alignment style.
>PointerAlignmentStyle PointerAlignment;
>
> +  /// \brief If true, clang-format will sort #includes.
> +  bool SortIncludes;
> +
>/// \brief If \c true, a space may be inserted after C style casts.
>bool SpaceAfterCStyleCast;
>
>
> Modified: cfe/trunk/lib/Format/Format.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=253202&r1=253201&r2=253202&view=diff
>
> ==
> --- cfe/trunk/lib/Format/Format.cpp (original)
> +++ cfe/trunk/lib/Format/Format.cpp Mon Nov 16 06:38:56 2015
> @@ -284,6 +284,7 @@ template <> struct MappingTraits  IO.mapOptional("PenaltyExcessCharacter",
> Style.PenaltyExcessCharacter);
>  IO.mapOptional("PenaltyReturnTypeOnItsOwnLine",
> Style.PenaltyReturnTypeOnItsOwnLine);
> +IO.mapOptional("SortIncludes", Style.SortIncludes);
>  IO.mapOptional("PointerAlignment", Style.PointerAlignment);
>  IO.mapOptional("SpaceAfterCStyleCast", Style.SpaceAfterCStyleCast);
>  IO.mapOptional("SpaceBeforeAssignmentOperators",
> @@ -507,6 +508,7 @@ FormatStyle getLLVMStyle() {
>LLVMStyle.PenaltyBreakBeforeFirstCallParameter = 19;
>
>LLVMStyle.DisableFormat = false;
> +  LLVMStyle.SortIncludes = true;
>
>return LLVMStyle;
>  }
> @@ -635,6 +637,7 @@ FormatStyle getGNUStyle() {
>  FormatStyle getNoStyle() {
>FormatStyle NoStyle = getLLVMStyle();
>NoStyle.DisableFormat = true;
> +  NoStyle.SortIncludes = false;
>return NoStyle;
>  }
>
> @@ -1743,6 +1746,9 @@ tooling::Replacements sortIncludes(const
> ArrayRef Ranges,
> StringRef FileName) {
>tooling::Replacements Replaces;
> +  if (!Style.SortIncludes)
> +return Replaces;
> +
>unsigned Prev = 0;
>unsigned SearchFrom = 0;
>llvm::Regex IncludeRegex(
>
> Added: cfe/trunk/test/Format/disable-include-sorting.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Format/disable-include-sorting.cpp?rev=253202&view=auto
>
> ==
> --- cfe/trunk/test/Format/disable-include-sorting.cpp (added)
> +++ cfe/trunk/test/Format/disable-include-sorting.cpp Mon Nov 16 06:38:56
> 2015
> @@ -0,0 +1,10 @@
> +// RUN: clang-format %s | FileCheck %s
> +// RUN: clang-format %s -sort-includes -style="{SortIncludes: false}" |
> FileCheck %s
> +// RUN: clang-format %s -sort-includes=false | FileCheck %s
> -check-prefix=NOT-SORTED
> +
> +#include 
> +#include 
> +// CHECK: 
> +// CHECK-NEXT: 
> +// NOT-SORTED: 
> +// NOT-SORTED-NEXT: 
>
> Modified: cfe/trunk/tools/clang-format/ClangFormat.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-format/ClangFormat.cpp?rev=253202&r1=253201&r2=253202&view=diff
>
> ==
> --- cfe/trunk/tools/clang-format/ClangFormat.cpp (original)
> +++ cfe/trunk/tools/clang-format/ClangFormat.cpp Mon Nov 16 06:38:56 2015
> @@ -98,9 +98,11 @@ static cl::opt
>  "clang-format from an editor integration"),
> cl::init(0), cl::cat(ClangFormatCategory));
>
> -static cl::opt SortIncludes("sort-includes",
> -  cl::desc("Sort touched include lines"),
> -  cl::cat(ClangFormatCategory));
> +static cl::opt SortIncludes(
> +"sort-includes",
> + 

Re: r253202 - clang-format: Enable #include sorting by default.

2015-11-16 Thread Nico Weber via cfe-commits
Should this be a per-style default? It still only doesn't break webkit
files only by accident, right?

On Mon, Nov 16, 2015 at 10:35 AM, Eric Christopher via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> !!!
>
> Awesome :)
>
> -eric
>
> On Mon, Nov 16, 2015 at 4:41 AM Daniel Jasper via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: djasper
>> Date: Mon Nov 16 06:38:56 2015
>> New Revision: 253202
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=253202&view=rev
>> Log:
>> clang-format: Enable #include sorting by default.
>>
>> This has seen quite some usage and I am not aware of any issues. Also
>> add a style option to enable/disable include sorting. The existing
>> command line flag can from now on be used to override whatever is set
>> in the style.
>>
>> Added:
>> cfe/trunk/test/Format/disable-include-sorting.cpp
>> Modified:
>> cfe/trunk/include/clang/Format/Format.h
>> cfe/trunk/lib/Format/Format.cpp
>> cfe/trunk/tools/clang-format/ClangFormat.cpp
>> cfe/trunk/tools/clang-format/clang-format-sublime.py
>> cfe/trunk/tools/clang-format/clang-format.el
>> cfe/trunk/tools/clang-format/clang-format.py
>> cfe/trunk/unittests/Format/FormatTest.cpp
>> cfe/trunk/unittests/Format/SortIncludesTest.cpp
>>
>> Modified: cfe/trunk/include/clang/Format/Format.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Format/Format.h?rev=253202&r1=253201&r2=253202&view=diff
>>
>> ==
>> --- cfe/trunk/include/clang/Format/Format.h (original)
>> +++ cfe/trunk/include/clang/Format/Format.h Mon Nov 16 06:38:56 2015
>> @@ -469,6 +469,9 @@ struct FormatStyle {
>>/// Pointer and reference alignment style.
>>PointerAlignmentStyle PointerAlignment;
>>
>> +  /// \brief If true, clang-format will sort #includes.
>> +  bool SortIncludes;
>> +
>>/// \brief If \c true, a space may be inserted after C style casts.
>>bool SpaceAfterCStyleCast;
>>
>>
>> Modified: cfe/trunk/lib/Format/Format.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=253202&r1=253201&r2=253202&view=diff
>>
>> ==
>> --- cfe/trunk/lib/Format/Format.cpp (original)
>> +++ cfe/trunk/lib/Format/Format.cpp Mon Nov 16 06:38:56 2015
>> @@ -284,6 +284,7 @@ template <> struct MappingTraits>  IO.mapOptional("PenaltyExcessCharacter",
>> Style.PenaltyExcessCharacter);
>>  IO.mapOptional("PenaltyReturnTypeOnItsOwnLine",
>> Style.PenaltyReturnTypeOnItsOwnLine);
>> +IO.mapOptional("SortIncludes", Style.SortIncludes);
>>  IO.mapOptional("PointerAlignment", Style.PointerAlignment);
>>  IO.mapOptional("SpaceAfterCStyleCast", Style.SpaceAfterCStyleCast);
>>  IO.mapOptional("SpaceBeforeAssignmentOperators",
>> @@ -507,6 +508,7 @@ FormatStyle getLLVMStyle() {
>>LLVMStyle.PenaltyBreakBeforeFirstCallParameter = 19;
>>
>>LLVMStyle.DisableFormat = false;
>> +  LLVMStyle.SortIncludes = true;
>>
>>return LLVMStyle;
>>  }
>> @@ -635,6 +637,7 @@ FormatStyle getGNUStyle() {
>>  FormatStyle getNoStyle() {
>>FormatStyle NoStyle = getLLVMStyle();
>>NoStyle.DisableFormat = true;
>> +  NoStyle.SortIncludes = false;
>>return NoStyle;
>>  }
>>
>> @@ -1743,6 +1746,9 @@ tooling::Replacements sortIncludes(const
>> ArrayRef Ranges,
>> StringRef FileName) {
>>tooling::Replacements Replaces;
>> +  if (!Style.SortIncludes)
>> +return Replaces;
>> +
>>unsigned Prev = 0;
>>unsigned SearchFrom = 0;
>>llvm::Regex IncludeRegex(
>>
>> Added: cfe/trunk/test/Format/disable-include-sorting.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Format/disable-include-sorting.cpp?rev=253202&view=auto
>>
>> ==
>> --- cfe/trunk/test/Format/disable-include-sorting.cpp (added)
>> +++ cfe/trunk/test/Format/disable-include-sorting.cpp Mon Nov 16 06:38:56
>> 2015
>> @@ -0,0 +1,10 @@
>> +// RUN: clang-format %s | FileCheck %s
>> +// RUN: clang-format %s -sort-includes -style="{SortIncludes: false}" |
>> FileCheck %s
>> +// RUN: clang-format %s -sort-includes=false | FileCheck %s
>> -check-prefix=NOT-SORTED
>> +
>> +#include 
>> +#include 
>> +// CHECK: 
>> +// CHECK-NEXT: 
>> +// NOT-SORTED: 
>> +// NOT-SORTED-NEXT: 
>>
>> Modified: cfe/trunk/tools/clang-format/ClangFormat.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-format/ClangFormat.cpp?rev=253202&r1=253201&r2=253202&view=diff
>>
>> ==
>> --- cfe/trunk/tools/clang-format/ClangFormat.cpp (original)
>> +++ cfe/trunk/tools/clang-format/ClangFormat.cpp Mon Nov 16 06:38:56 2015
>> @@ -98,9 +98,11 @@ static cl::opt
>>  "clang-format from

Re: r253202 - clang-format: Enable #include sorting by default.

2015-11-16 Thread Nico Weber via cfe-commits
i.e. should SortIncludes be false for -style=WebKit for now?

On Mon, Nov 16, 2015 at 11:19 AM, Nico Weber  wrote:

> Should this be a per-style default? It still only doesn't break webkit
> files only by accident, right?
>
> On Mon, Nov 16, 2015 at 10:35 AM, Eric Christopher via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> !!!
>>
>> Awesome :)
>>
>> -eric
>>
>> On Mon, Nov 16, 2015 at 4:41 AM Daniel Jasper via cfe-commits <
>> cfe-commits@lists.llvm.org> wrote:
>>
>>> Author: djasper
>>> Date: Mon Nov 16 06:38:56 2015
>>> New Revision: 253202
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=253202&view=rev
>>> Log:
>>> clang-format: Enable #include sorting by default.
>>>
>>> This has seen quite some usage and I am not aware of any issues. Also
>>> add a style option to enable/disable include sorting. The existing
>>> command line flag can from now on be used to override whatever is set
>>> in the style.
>>>
>>> Added:
>>> cfe/trunk/test/Format/disable-include-sorting.cpp
>>> Modified:
>>> cfe/trunk/include/clang/Format/Format.h
>>> cfe/trunk/lib/Format/Format.cpp
>>> cfe/trunk/tools/clang-format/ClangFormat.cpp
>>> cfe/trunk/tools/clang-format/clang-format-sublime.py
>>> cfe/trunk/tools/clang-format/clang-format.el
>>> cfe/trunk/tools/clang-format/clang-format.py
>>> cfe/trunk/unittests/Format/FormatTest.cpp
>>> cfe/trunk/unittests/Format/SortIncludesTest.cpp
>>>
>>> Modified: cfe/trunk/include/clang/Format/Format.h
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Format/Format.h?rev=253202&r1=253201&r2=253202&view=diff
>>>
>>> ==
>>> --- cfe/trunk/include/clang/Format/Format.h (original)
>>> +++ cfe/trunk/include/clang/Format/Format.h Mon Nov 16 06:38:56 2015
>>> @@ -469,6 +469,9 @@ struct FormatStyle {
>>>/// Pointer and reference alignment style.
>>>PointerAlignmentStyle PointerAlignment;
>>>
>>> +  /// \brief If true, clang-format will sort #includes.
>>> +  bool SortIncludes;
>>> +
>>>/// \brief If \c true, a space may be inserted after C style casts.
>>>bool SpaceAfterCStyleCast;
>>>
>>>
>>> Modified: cfe/trunk/lib/Format/Format.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=253202&r1=253201&r2=253202&view=diff
>>>
>>> ==
>>> --- cfe/trunk/lib/Format/Format.cpp (original)
>>> +++ cfe/trunk/lib/Format/Format.cpp Mon Nov 16 06:38:56 2015
>>> @@ -284,6 +284,7 @@ template <> struct MappingTraits>>  IO.mapOptional("PenaltyExcessCharacter",
>>> Style.PenaltyExcessCharacter);
>>>  IO.mapOptional("PenaltyReturnTypeOnItsOwnLine",
>>> Style.PenaltyReturnTypeOnItsOwnLine);
>>> +IO.mapOptional("SortIncludes", Style.SortIncludes);
>>>  IO.mapOptional("PointerAlignment", Style.PointerAlignment);
>>>  IO.mapOptional("SpaceAfterCStyleCast", Style.SpaceAfterCStyleCast);
>>>  IO.mapOptional("SpaceBeforeAssignmentOperators",
>>> @@ -507,6 +508,7 @@ FormatStyle getLLVMStyle() {
>>>LLVMStyle.PenaltyBreakBeforeFirstCallParameter = 19;
>>>
>>>LLVMStyle.DisableFormat = false;
>>> +  LLVMStyle.SortIncludes = true;
>>>
>>>return LLVMStyle;
>>>  }
>>> @@ -635,6 +637,7 @@ FormatStyle getGNUStyle() {
>>>  FormatStyle getNoStyle() {
>>>FormatStyle NoStyle = getLLVMStyle();
>>>NoStyle.DisableFormat = true;
>>> +  NoStyle.SortIncludes = false;
>>>return NoStyle;
>>>  }
>>>
>>> @@ -1743,6 +1746,9 @@ tooling::Replacements sortIncludes(const
>>> ArrayRef Ranges,
>>> StringRef FileName) {
>>>tooling::Replacements Replaces;
>>> +  if (!Style.SortIncludes)
>>> +return Replaces;
>>> +
>>>unsigned Prev = 0;
>>>unsigned SearchFrom = 0;
>>>llvm::Regex IncludeRegex(
>>>
>>> Added: cfe/trunk/test/Format/disable-include-sorting.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Format/disable-include-sorting.cpp?rev=253202&view=auto
>>>
>>> ==
>>> --- cfe/trunk/test/Format/disable-include-sorting.cpp (added)
>>> +++ cfe/trunk/test/Format/disable-include-sorting.cpp Mon Nov 16
>>> 06:38:56 2015
>>> @@ -0,0 +1,10 @@
>>> +// RUN: clang-format %s | FileCheck %s
>>> +// RUN: clang-format %s -sort-includes -style="{SortIncludes: false}" |
>>> FileCheck %s
>>> +// RUN: clang-format %s -sort-includes=false | FileCheck %s
>>> -check-prefix=NOT-SORTED
>>> +
>>> +#include 
>>> +#include 
>>> +// CHECK: 
>>> +// CHECK-NEXT: 
>>> +// NOT-SORTED: 
>>> +// NOT-SORTED-NEXT: 
>>>
>>> Modified: cfe/trunk/tools/clang-format/ClangFormat.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-format/ClangFormat.cpp?rev=253202&r1=253201&r2=253202&view=diff
>>>
>>> ==

[clang-tools-extra] r253246 - Add a new clang-tidy checker that flags throw expressions whose thrown type is not nothrow copy constructible. While the compiler is free to elide copy constructor calls

2015-11-16 Thread Aaron Ballman via cfe-commits
Author: aaronballman
Date: Mon Nov 16 13:17:43 2015
New Revision: 253246

URL: http://llvm.org/viewvc/llvm-project?rev=253246&view=rev
Log:
Add a new clang-tidy checker that flags throw expressions whose thrown type is 
not nothrow copy constructible. While the compiler is free to elide copy 
constructor calls in some cases, it is under no obligation to do so, which 
makes the code a portability concern as well as a security concern.

This checker corresponds to the CERT secure coding rule: 
https://www.securecoding.cert.org/confluence/display/cplusplus/ERR60-CPP.+Exception+objects+must+be+nothrow+copy+constructible

Added:
clang-tools-extra/trunk/clang-tidy/cert/ThrownExceptionTypeCheck.cpp
clang-tools-extra/trunk/clang-tidy/cert/ThrownExceptionTypeCheck.h

clang-tools-extra/trunk/docs/clang-tidy/checks/cert-thrown-exception-type.rst
clang-tools-extra/trunk/test/clang-tidy/cert-throw-exception-type.cpp
Modified:
clang-tools-extra/trunk/clang-tidy/cert/CERTTidyModule.cpp
clang-tools-extra/trunk/clang-tidy/cert/CMakeLists.txt
clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst

Modified: clang-tools-extra/trunk/clang-tidy/cert/CERTTidyModule.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/cert/CERTTidyModule.cpp?rev=253246&r1=253245&r2=253246&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/cert/CERTTidyModule.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/cert/CERTTidyModule.cpp Mon Nov 16 
13:17:43 2015
@@ -17,6 +17,7 @@
 #include "../misc/StaticAssertCheck.h"
 #include "../misc/ThrowByValueCatchByReferenceCheck.h"
 #include "SetLongJmpCheck.h"
+#include "ThrownExceptionTypeCheck.h"
 #include "VariadicFunctionDefCheck.h"
 
 namespace clang {
@@ -40,6 +41,8 @@ public:
 // ERR
 CheckFactories.registerCheck(
 "cert-err52-cpp");
+CheckFactories.registerCheck(
+"cert-err60-cpp");
 CheckFactories.registerCheck(
 "cert-err61-cpp");
 

Modified: clang-tools-extra/trunk/clang-tidy/cert/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/cert/CMakeLists.txt?rev=253246&r1=253245&r2=253246&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/cert/CMakeLists.txt (original)
+++ clang-tools-extra/trunk/clang-tidy/cert/CMakeLists.txt Mon Nov 16 13:17:43 
2015
@@ -3,6 +3,7 @@ set(LLVM_LINK_COMPONENTS support)
 add_clang_library(clangTidyCERTModule
   CERTTidyModule.cpp
   SetLongJmpCheck.cpp
+  ThrownExceptionTypeCheck.cpp
   VariadicFunctionDefCheck.cpp
 
   LINK_LIBS

Added: clang-tools-extra/trunk/clang-tidy/cert/ThrownExceptionTypeCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/cert/ThrownExceptionTypeCheck.cpp?rev=253246&view=auto
==
--- clang-tools-extra/trunk/clang-tidy/cert/ThrownExceptionTypeCheck.cpp (added)
+++ clang-tools-extra/trunk/clang-tidy/cert/ThrownExceptionTypeCheck.cpp Mon 
Nov 16 13:17:43 2015
@@ -0,0 +1,50 @@
+//===--- ThrownExceptionTypeCheck.cpp - 
clang-tidy-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "ThrownExceptionTypeCheck.h"
+#include "clang/AST/ASTContext.h"
+#include "clang/ASTMatchers/ASTMatchFinder.h"
+
+using namespace clang::ast_matchers;
+
+namespace clang {
+namespace {
+AST_MATCHER(CXXConstructorDecl, isNoThrowCopyConstructor) {
+  if (!Node.isCopyConstructor())
+return false;
+
+  if (const auto *FnTy = Node.getType()->getAs())
+return FnTy->isNothrow(Node.getASTContext());
+  llvm_unreachable("Copy constructor with no prototype");
+}
+} // end namespace
+
+namespace tidy {
+void ThrownExceptionTypeCheck::registerMatchers(MatchFinder *Finder) {
+  if (!getLangOpts().CPlusPlus)
+return;
+
+  Finder->addMatcher(
+  cxxThrowExpr(
+  has(cxxConstructExpr(hasDeclaration(cxxConstructorDecl(
+  isCopyConstructor(), unless(isNoThrowCopyConstructor()
+  .bind("expr"))),
+  this);
+
+}
+
+void ThrownExceptionTypeCheck::check(const MatchFinder::MatchResult &Result) {
+  const auto *E = Result.Nodes.getNodeAs("expr");
+  diag(E->getExprLoc(),
+   "thrown exception type is not nothrow copy constructible");
+}
+
+} // namespace tidy
+} // namespace clang
+

Added: clang-tools-extra/trunk/clang-tidy/cert/ThrownExceptionTypeCheck.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/cert/ThrownExceptionTypeCheck.h?rev=253246&view=auto
==
--- clang-tools-extra/trunk/clang

Re: [PATCH] D14619: [PATCH] clang-tidy checker for nothrow copy constructible exception objects

2015-11-16 Thread Aaron Ballman via cfe-commits
On Fri, Nov 13, 2015 at 10:45 PM, Alexander Kornienko  wrote:
> alexfh accepted this revision.
> alexfh added a comment.
> This revision is now accepted and ready to land.
>
> Looks good with one nit. Thank you!
>
>
> 
> Comment at: clang-tidy/cert/ThrownExceptionTypeCheck.cpp:23
> @@ +22,3 @@
> +  if (const auto *FnTy = Node.getType()->getAs()) {
> +// If any of the copy constructors is throwing, we will assume that it
> +// is plausible that the constructor may be selected by the throw and
> 
> The comment is not relevant now.

Thanks! I've commit in r253246.

~Aaron

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


Re: r253202 - clang-format: Enable #include sorting by default.

2015-11-16 Thread Daniel Jasper via cfe-commits
Up to you. I am not worried about accidentally breaking it in the
foreseeable future.

On Mon, Nov 16, 2015 at 8:20 PM, Nico Weber  wrote:

> i.e. should SortIncludes be false for -style=WebKit for now?
>
> On Mon, Nov 16, 2015 at 11:19 AM, Nico Weber  wrote:
>
>> Should this be a per-style default? It still only doesn't break webkit
>> files only by accident, right?
>>
>> On Mon, Nov 16, 2015 at 10:35 AM, Eric Christopher via cfe-commits <
>> cfe-commits@lists.llvm.org> wrote:
>>
>>> !!!
>>>
>>> Awesome :)
>>>
>>> -eric
>>>
>>> On Mon, Nov 16, 2015 at 4:41 AM Daniel Jasper via cfe-commits <
>>> cfe-commits@lists.llvm.org> wrote:
>>>
 Author: djasper
 Date: Mon Nov 16 06:38:56 2015
 New Revision: 253202

 URL: http://llvm.org/viewvc/llvm-project?rev=253202&view=rev
 Log:
 clang-format: Enable #include sorting by default.

 This has seen quite some usage and I am not aware of any issues. Also
 add a style option to enable/disable include sorting. The existing
 command line flag can from now on be used to override whatever is set
 in the style.

 Added:
 cfe/trunk/test/Format/disable-include-sorting.cpp
 Modified:
 cfe/trunk/include/clang/Format/Format.h
 cfe/trunk/lib/Format/Format.cpp
 cfe/trunk/tools/clang-format/ClangFormat.cpp
 cfe/trunk/tools/clang-format/clang-format-sublime.py
 cfe/trunk/tools/clang-format/clang-format.el
 cfe/trunk/tools/clang-format/clang-format.py
 cfe/trunk/unittests/Format/FormatTest.cpp
 cfe/trunk/unittests/Format/SortIncludesTest.cpp

 Modified: cfe/trunk/include/clang/Format/Format.h
 URL:
 http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Format/Format.h?rev=253202&r1=253201&r2=253202&view=diff

 ==
 --- cfe/trunk/include/clang/Format/Format.h (original)
 +++ cfe/trunk/include/clang/Format/Format.h Mon Nov 16 06:38:56 2015
 @@ -469,6 +469,9 @@ struct FormatStyle {
/// Pointer and reference alignment style.
PointerAlignmentStyle PointerAlignment;

 +  /// \brief If true, clang-format will sort #includes.
 +  bool SortIncludes;
 +
/// \brief If \c true, a space may be inserted after C style casts.
bool SpaceAfterCStyleCast;


 Modified: cfe/trunk/lib/Format/Format.cpp
 URL:
 http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=253202&r1=253201&r2=253202&view=diff

 ==
 --- cfe/trunk/lib/Format/Format.cpp (original)
 +++ cfe/trunk/lib/Format/Format.cpp Mon Nov 16 06:38:56 2015
 @@ -284,6 +284,7 @@ template <> struct MappingTraits>>>  IO.mapOptional("PenaltyExcessCharacter",
 Style.PenaltyExcessCharacter);
  IO.mapOptional("PenaltyReturnTypeOnItsOwnLine",
 Style.PenaltyReturnTypeOnItsOwnLine);
 +IO.mapOptional("SortIncludes", Style.SortIncludes);
  IO.mapOptional("PointerAlignment", Style.PointerAlignment);
  IO.mapOptional("SpaceAfterCStyleCast", Style.SpaceAfterCStyleCast);
  IO.mapOptional("SpaceBeforeAssignmentOperators",
 @@ -507,6 +508,7 @@ FormatStyle getLLVMStyle() {
LLVMStyle.PenaltyBreakBeforeFirstCallParameter = 19;

LLVMStyle.DisableFormat = false;
 +  LLVMStyle.SortIncludes = true;

return LLVMStyle;
  }
 @@ -635,6 +637,7 @@ FormatStyle getGNUStyle() {
  FormatStyle getNoStyle() {
FormatStyle NoStyle = getLLVMStyle();
NoStyle.DisableFormat = true;
 +  NoStyle.SortIncludes = false;
return NoStyle;
  }

 @@ -1743,6 +1746,9 @@ tooling::Replacements sortIncludes(const
 ArrayRef Ranges,
 StringRef FileName) {
tooling::Replacements Replaces;
 +  if (!Style.SortIncludes)
 +return Replaces;
 +
unsigned Prev = 0;
unsigned SearchFrom = 0;
llvm::Regex IncludeRegex(

 Added: cfe/trunk/test/Format/disable-include-sorting.cpp
 URL:
 http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Format/disable-include-sorting.cpp?rev=253202&view=auto

 ==
 --- cfe/trunk/test/Format/disable-include-sorting.cpp (added)
 +++ cfe/trunk/test/Format/disable-include-sorting.cpp Mon Nov 16
 06:38:56 2015
 @@ -0,0 +1,10 @@
 +// RUN: clang-format %s | FileCheck %s
 +// RUN: clang-format %s -sort-includes -style="{SortIncludes: false}"
 | FileCheck %s
 +// RUN: clang-format %s -sort-includes=false | FileCheck %s
 -check-prefix=NOT-SORTED
 +
 +#include 
 +#include 
 +// CHECK: 
 +// CHECK-NEXT: 
 +// NOT-SORTED: 
 +// NOT-SO

Re: r252834 - Provide a frontend based error for always_inline functions that require

2015-11-16 Thread Bruno Cardoso Lopes via cfe-commits
Thanks Eric!!

On Mon, Nov 16, 2015 at 10:32 AM, Eric Christopher  wrote:
> Fixed thusly:
>
> dzur:~/sources/llvm/tools/clang> git svn dcommit
> Committing to https://llvm.org/svn/llvm-project/cfe/trunk ...
> A test/CodeGen/target-features-no-error.c
> M lib/CodeGen/CodeGenFunction.cpp
> Committed r253242
>
> Thanks!
>
> -eric
>
> On Mon, Nov 16, 2015 at 9:48 AM Bruno Cardoso Lopes
>  wrote:
>>
>> Hi Eric,
>>
>> On Fri, Nov 13, 2015 at 8:55 PM, Eric Christopher 
>> wrote:
>> > This all sounds a little weird as _mm_mul_ps only requires sse. Can you
>> > give
>> > me a testcase and command line that you're using to trigger this?
>>
>> clang -O3 -flto -arch x86_64h -fomit-frame-pointer -c
>> test-suite/SingleSource/UnitTests/Vector/SSE/sse.expandfft.c -o
>> /dev/null
>>
>> Thanks,
>>
>> --
>> Bruno Cardoso Lopes
>> http://www.brunocardoso.cc



-- 
Bruno Cardoso Lopes
http://www.brunocardoso.cc
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D14506: Porting shouldVisitImplicitCode to DataRecursiveASTVisitor.

2015-11-16 Thread Ben Craig via cfe-commits
bcraig added a comment.

Ping.  Note that the test is basically a copy / paste job, and the new code in 
DataRecursiveASTVisitor.h is a very direct translation from the 'regular' 
RecursiveASTVisitor.h.


http://reviews.llvm.org/D14506



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


Re: [PATCH] D14619: [PATCH] clang-tidy checker for nothrow copy constructible exception objects

2015-11-16 Thread Aaron Ballman via cfe-commits
aaron.ballman closed this revision.
aaron.ballman added a comment.

Commit in r253246


http://reviews.llvm.org/D14619



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


Re: [PATCH] D10599: [OPENMP 4.0] Initial support for '#pragma omp declare simd' directive.

2015-11-16 Thread Aaron Ballman via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

I don't think we generally want files commit with explicit svn properties like 
your new test files have. However, beyond that, LGTM. You should still wait for 
approval from Richard before committing, however.


http://reviews.llvm.org/D10599



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


Re: [PATCH] D14506: Porting shouldVisitImplicitCode to DataRecursiveASTVisitor.

2015-11-16 Thread Argyrios Kyrtzidis via cfe-commits
LGTM.

> On Nov 16, 2015, at 12:32 PM, Ben Craig  wrote:
> 
> bcraig added a comment.
> 
> Ping.  Note that the test is basically a copy / paste job, and the new code 
> in DataRecursiveASTVisitor.h is a very direct translation from the 'regular' 
> RecursiveASTVisitor.h.
> 
> 
> http://reviews.llvm.org/D14506
> 
> 
> 

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


Re: [PATCH] D14506: Porting shouldVisitImplicitCode to DataRecursiveASTVisitor.

2015-11-16 Thread Richard Smith via cfe-commits
Rather than trying to maintain the horrible duplication between
DataRecursiveASTVisitor and RecursiveASTVisitor, can we just delete
DataRecursiveASTVisitor? RecursiveASTVisitor is data-recursive too these
days (and has a smarter implementation than DataRecursiveASTVisitor's from
what I can see), but doesn't yet apply data recursion in so many cases.

On Mon, Nov 16, 2015 at 1:07 PM, Argyrios Kyrtzidis 
wrote:

> LGTM.
>
> > On Nov 16, 2015, at 12:32 PM, Ben Craig 
> wrote:
> >
> > bcraig added a comment.
> >
> > Ping.  Note that the test is basically a copy / paste job, and the new
> code in DataRecursiveASTVisitor.h is a very direct translation from the
> 'regular' RecursiveASTVisitor.h.
> >
> >
> > http://reviews.llvm.org/D14506
> >
> >
> >
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D14727: [Driver] Adapt Linux::GCCVersion::Parse to match GCC 5 installations

2015-11-16 Thread Thiago Macieira via cfe-commits
thiagomacieira created this revision.
thiagomacieira added a reviewer: cfe-commits.

Some GCC 5 installations store the libstdc++ includes and GCC-specific files in 
paths without 
the minor part of the version number, such as

  /usr/include/c++/5
  /usr/lib64/gcc/x86_64-suse-linux/5

http://reviews.llvm.org/D14727

Files:
  lib/Driver/ToolChains.cpp

Index: lib/Driver/ToolChains.cpp
===
--- lib/Driver/ToolChains.cpp
+++ lib/Driver/ToolChains.cpp
@@ -1231,13 +1231,12 @@
   if (First.first.getAsInteger(10, GoodVersion.Major) || GoodVersion.Major < 0)
 return BadVersion;
   GoodVersion.MajorStr = First.first.str();
-  if (Second.first.getAsInteger(10, GoodVersion.Minor) || GoodVersion.Minor < 
0)
-return BadVersion;
   GoodVersion.MinorStr = Second.first.str();
 
   // First look for a number prefix and parse that if present. Otherwise just
   // stash the entire patch string in the suffix, and leave the number
   // unspecified. This covers versions strings such as:
+  //   5
   //   4.4
   //   4.4.0
   //   4.4.x


Index: lib/Driver/ToolChains.cpp
===
--- lib/Driver/ToolChains.cpp
+++ lib/Driver/ToolChains.cpp
@@ -1231,13 +1231,12 @@
   if (First.first.getAsInteger(10, GoodVersion.Major) || GoodVersion.Major < 0)
 return BadVersion;
   GoodVersion.MajorStr = First.first.str();
-  if (Second.first.getAsInteger(10, GoodVersion.Minor) || GoodVersion.Minor < 0)
-return BadVersion;
   GoodVersion.MinorStr = Second.first.str();
 
   // First look for a number prefix and parse that if present. Otherwise just
   // stash the entire patch string in the suffix, and leave the number
   // unspecified. This covers versions strings such as:
+  //   5
   //   4.4
   //   4.4.0
   //   4.4.x
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r253255 - Correctly handle type mismatches in the __weak copy/move-initialization

2015-11-16 Thread John McCall via cfe-commits
Author: rjmccall
Date: Mon Nov 16 16:11:41 2015
New Revision: 253255

URL: http://llvm.org/viewvc/llvm-project?rev=253255&view=rev
Log:
Correctly handle type mismatches in the __weak copy/move-initialization
peephole I added in r250916.

rdar://23559789

Added:
cfe/trunk/test/CodeGenObjC/arc-weak.m
cfe/trunk/test/CodeGenObjCXX/arc-weak.mm
Modified:
cfe/trunk/lib/CodeGen/CGDecl.cpp

Modified: cfe/trunk/lib/CodeGen/CGDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDecl.cpp?rev=253255&r1=253254&r2=253255&view=diff
==
--- cfe/trunk/lib/CodeGen/CGDecl.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDecl.cpp Mon Nov 16 16:11:41 2015
@@ -600,12 +600,15 @@ static bool isAccessedBy(const ValueDecl
 
 static bool tryEmitARCCopyWeakInit(CodeGenFunction &CGF,
const LValue &destLV, const Expr *init) {
+  bool needsCast = false;
+
   while (auto castExpr = dyn_cast(init->IgnoreParens())) {
 switch (castExpr->getCastKind()) {
 // Look through casts that don't require representation changes.
 case CK_NoOp:
 case CK_BitCast:
 case CK_BlockPointerToObjCPointerCast:
+  needsCast = true;
   break;
 
 // If we find an l-value to r-value cast from a __weak variable,
@@ -618,12 +621,19 @@ static bool tryEmitARCCopyWeakInit(CodeG
   // Emit the source l-value.
   LValue srcLV = CGF.EmitLValue(srcExpr);
 
+  // Handle a formal type change to avoid asserting.
+  auto srcAddr = srcLV.getAddress();
+  if (needsCast) {
+srcAddr = CGF.Builder.CreateElementBitCast(srcAddr,
+ destLV.getAddress().getElementType());
+  }
+
   // If it was an l-value, use objc_copyWeak.
   if (srcExpr->getValueKind() == VK_LValue) {
-CGF.EmitARCCopyWeak(destLV.getAddress(), srcLV.getAddress());
+CGF.EmitARCCopyWeak(destLV.getAddress(), srcAddr);
   } else {
 assert(srcExpr->getValueKind() == VK_XValue);
-CGF.EmitARCMoveWeak(destLV.getAddress(), srcLV.getAddress());
+CGF.EmitARCMoveWeak(destLV.getAddress(), srcAddr);
   }
   return true;
 }

Added: cfe/trunk/test/CodeGenObjC/arc-weak.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/arc-weak.m?rev=253255&view=auto
==
--- cfe/trunk/test/CodeGenObjC/arc-weak.m (added)
+++ cfe/trunk/test/CodeGenObjC/arc-weak.m Mon Nov 16 16:11:41 2015
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fblocks 
-fobjc-arc -fobjc-runtime-has-weak -o - %s | FileCheck %s
+
+__attribute((objc_root_class)) @interface A @end
+@interface B : A @end
+
+// rdar://problem/23559789
+//   Ensure that type differences don't cause an assert here.
+void test0(__weak B **src) {
+  __weak A *dest = *src;
+}
+// CHECK-LABEL: define void @test0
+// CHECK:   [[SRC:%.*]] = alloca [[B:%.*]]**, align 8
+// CHECK:   [[DEST:%.*]] = alloca [[A:%.*]]*, align 8
+// CHECK:   [[T0:%.*]] = load [[B]]**, [[B]]*** [[SRC]], align 8
+// CHECK-NEXT:  [[T1:%.*]] = bitcast [[B]]** [[T0]] to [[A]]**
+// CHECK-NEXT:  [[T2:%.*]] = bitcast [[A]]** [[DEST]] to i8**
+// CHECK-NEXT:  [[T3:%.*]] = bitcast [[A]]** [[T1]] to i8**
+// CHECK-NEXT:  call void @objc_copyWeak(i8** [[T2]], i8** [[T3]])
+// CHECK-NEXT:  [[T0:%.*]] = bitcast [[A]]** [[DEST]] to i8**
+// CHECK:   call void @objc_destroyWeak(i8** [[T0]])

Added: cfe/trunk/test/CodeGenObjCXX/arc-weak.mm
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjCXX/arc-weak.mm?rev=253255&view=auto
==
--- cfe/trunk/test/CodeGenObjCXX/arc-weak.mm (added)
+++ cfe/trunk/test/CodeGenObjCXX/arc-weak.mm Mon Nov 16 16:11:41 2015
@@ -0,0 +1,34 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fblocks 
-fobjc-arc -fobjc-runtime-has-weak -std=c++11 -o - %s | FileCheck %s
+
+__attribute((objc_root_class)) @interface A @end
+@interface B : A @end
+
+// rdar://problem/23559789
+//   Ensure that type differences don't cause an assert here.
+void test0(__weak B **src) {
+  __weak A *dest = *src;
+}
+// CHECK-LABEL: define void @_Z5test0PU6__weakP1B(
+// CHECK:   [[SRC:%.*]] = alloca [[B:%.*]]**, align 8
+// CHECK:   [[DEST:%.*]] = alloca [[A:%.*]]*, align 8
+// CHECK:   [[T0:%.*]] = load [[B]]**, [[B]]*** [[SRC]], align 8
+// CHECK-NEXT:  [[T1:%.*]] = bitcast [[B]]** [[T0]] to [[A]]**
+// CHECK-NEXT:  [[T2:%.*]] = bitcast [[A]]** [[DEST]] to i8**
+// CHECK-NEXT:  [[T3:%.*]] = bitcast [[A]]** [[T1]] to i8**
+// CHECK-NEXT:  call void @objc_copyWeak(i8** [[T2]], i8** [[T3]])
+// CHECK-NEXT:  [[T0:%.*]] = bitcast [[A]]** [[DEST]] to i8**
+// CHECK:   call void @objc_destroyWeak(i8** [[T0]])
+
+void test1(__weak B **src) {
+  __weak A *dest = static_cast<__weak B*&&>(*src);
+}
+//

[libcxx] r253257 - More tests for LWG#2156

2015-11-16 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Mon Nov 16 16:18:36 2015
New Revision: 253257

URL: http://llvm.org/viewvc/llvm-project?rev=253257&view=rev
Log:
More tests for LWG#2156

Modified:
libcxx/trunk/test/std/containers/unord/unord.map/reserve.pass.cpp
libcxx/trunk/test/std/containers/unord/unord.multimap/reserve.pass.cpp
libcxx/trunk/test/std/containers/unord/unord.multiset/reserve.pass.cpp
libcxx/trunk/test/std/containers/unord/unord.set/reserve.pass.cpp

Modified: libcxx/trunk/test/std/containers/unord/unord.map/reserve.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/unord/unord.map/reserve.pass.cpp?rev=253257&r1=253256&r2=253257&view=diff
==
--- libcxx/trunk/test/std/containers/unord/unord.map/reserve.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/unord/unord.map/reserve.pass.cpp Mon Nov 
16 16:18:36 2015
@@ -31,6 +31,21 @@ void test(const C& c)
 assert(c.at(4) == "four");
 }
 
+void reserve_invariant(size_t n) // LWG #2156
+{
+for (size_t i = 0; i < n; ++i)
+{
+std::unordered_map c;
+c.reserve(n);
+size_t buckets = c.bucket_count();
+for (size_t j = 0; j < i; ++j)
+{
+c[i] = i;
+assert(buckets == c.bucket_count());
+}
+}
+}
+
 int main()
 {
 {
@@ -88,4 +103,5 @@ int main()
 test(c);
 }
 #endif
+reserve_invariant(20);
 }

Modified: libcxx/trunk/test/std/containers/unord/unord.multimap/reserve.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/unord/unord.multimap/reserve.pass.cpp?rev=253257&r1=253256&r2=253257&view=diff
==
--- libcxx/trunk/test/std/containers/unord/unord.multimap/reserve.pass.cpp 
(original)
+++ libcxx/trunk/test/std/containers/unord/unord.multimap/reserve.pass.cpp Mon 
Nov 16 16:18:36 2015
@@ -33,6 +33,21 @@ void test(const C& c)
 assert(c.find(4)->second == "four");
 }
 
+void reserve_invariant(size_t n) // LWG #2156
+{
+for (size_t i = 0; i < n; ++i)
+{
+std::unordered_multimap c;
+c.reserve(n);
+size_t buckets = c.bucket_count();
+for (size_t j = 0; j < i; ++j)
+{
+c[i] = i;
+assert(buckets == c.bucket_count());
+}
+}
+}
+
 int main()
 {
 {
@@ -90,4 +105,5 @@ int main()
 test(c);
 }
 #endif
+reserve_invariant(20);
 }

Modified: libcxx/trunk/test/std/containers/unord/unord.multiset/reserve.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/unord/unord.multiset/reserve.pass.cpp?rev=253257&r1=253256&r2=253257&view=diff
==
--- libcxx/trunk/test/std/containers/unord/unord.multiset/reserve.pass.cpp 
(original)
+++ libcxx/trunk/test/std/containers/unord/unord.multiset/reserve.pass.cpp Mon 
Nov 16 16:18:36 2015
@@ -30,6 +30,21 @@ void test(const C& c)
 assert(c.count(4) == 1);
 }
 
+void reserve_invariant(size_t n) // LWG #2156
+{
+for (size_t i = 0; i < n; ++i)
+{
+std::unordered_multiset c;
+c.reserve(n);
+size_t buckets = c.bucket_count();
+for (size_t j = 0; j < i; ++j)
+{
+c.insert(i);
+assert(buckets == c.bucket_count());
+}
+}
+}
+
 int main()
 {
 {
@@ -87,4 +102,5 @@ int main()
 test(c);
 }
 #endif
+reserve_invariant(20);
 }

Modified: libcxx/trunk/test/std/containers/unord/unord.set/reserve.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/unord/unord.set/reserve.pass.cpp?rev=253257&r1=253256&r2=253257&view=diff
==
--- libcxx/trunk/test/std/containers/unord/unord.set/reserve.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/unord/unord.set/reserve.pass.cpp Mon Nov 
16 16:18:36 2015
@@ -30,6 +30,21 @@ void test(const C& c)
 assert(c.count(4) == 1);
 }
 
+void reserve_invariant(size_t n) // LWG #2156
+{
+for (size_t i = 0; i < n; ++i)
+{
+std::unordered_set c;
+c.reserve(n);
+size_t buckets = c.bucket_count();
+for (size_t j = 0; j < i; ++j)
+{
+c.insert(i);
+assert(buckets == c.bucket_count());
+}
+}
+}
+
 int main()
 {
 {
@@ -87,4 +102,5 @@ int main()
 test(c);
 }
 #endif
+reserve_invariant(20);
 }


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


[PATCH] D14731: [libcxx] Add clang thread safety annotations to mutex and lock_guard

2015-11-16 Thread James Robinson via cfe-commits
jamesr created this revision.
jamesr added a subscriber: cfe-commits.

This adds clang thread safety annotations to std::mutex and
std::lock_guard so code using these types can use these types directly
instead of having to wrap the types to provide annotations. These checks
when enabled by -Wthread-safety provide simple but useful static
checking to detect potential race conditions.
See http://clang.llvm.org/docs/ThreadSafetyAnalysis.html for details.

http://reviews.llvm.org/D14731

Files:
  include/__config
  include/__mutex_base

Index: include/__mutex_base
===
--- include/__mutex_base
+++ include/__mutex_base
@@ -26,7 +26,7 @@
 
 #ifndef _LIBCPP_HAS_NO_THREADS
 
-class _LIBCPP_TYPE_VIS mutex
+class _LIBCPP_TYPE_VIS _LIBCPP_THREAD_ANNOTATION(capability("mutex")) mutex
 {
 pthread_mutex_t __m_;
 
@@ -44,9 +44,9 @@
 mutex& operator=(const mutex&);// = delete;
 
 public:
-void lock();
-bool try_lock() _NOEXCEPT;
-void unlock() _NOEXCEPT;
+void lock() _LIBCPP_THREAD_ANNOTATION(acquire_capability());
+bool try_lock() _NOEXCEPT 
_LIBCPP_THREAD_ANNOTATION(try_acquire_capability(true));
+void unlock() _NOEXCEPT _LIBCPP_THREAD_ANNOTATION(release_capability());
 
 typedef pthread_mutex_t* native_handle_type;
 _LIBCPP_INLINE_VISIBILITY native_handle_type native_handle() {return 
&__m_;}
@@ -71,7 +71,7 @@
 #endif
 
 template 
-class _LIBCPP_TYPE_VIS_ONLY lock_guard
+class _LIBCPP_TYPE_VIS_ONLY _LIBCPP_THREAD_ANNOTATION(scoped_lockable) 
lock_guard
 {
 public:
 typedef _Mutex mutex_type;
@@ -81,13 +81,13 @@
 public:
 
 _LIBCPP_INLINE_VISIBILITY
-explicit lock_guard(mutex_type& __m)
+explicit lock_guard(mutex_type& __m) 
_LIBCPP_THREAD_ANNOTATION(acquire_capability(__m))
 : __m_(__m) {__m_.lock();}
 _LIBCPP_INLINE_VISIBILITY
-lock_guard(mutex_type& __m, adopt_lock_t)
+lock_guard(mutex_type& __m, adopt_lock_t) 
_LIBCPP_THREAD_ANNOTATION(requires_capability(__m))
 : __m_(__m) {}
 _LIBCPP_INLINE_VISIBILITY
-~lock_guard() {__m_.unlock();}
+~lock_guard() _LIBCPP_THREAD_ANNOTATION(release_capability()) 
{__m_.unlock();}
 
 private:
 lock_guard(lock_guard const&);// = delete;
Index: include/__config
===
--- include/__config
+++ include/__config
@@ -825,6 +825,12 @@
 #define _LIBCPP_HAS_NO_ATOMIC_HEADER
 #endif
 
+#if defined(__clang__)
+#define _LIBCPP_THREAD_ANNOTATION(x) __attribute__((x))
+#else
+#define _LIBCPP_THREAD_ANNOTATION(x)
+#endif
+
 #endif // __cplusplus
 
 #endif // _LIBCPP_CONFIG


Index: include/__mutex_base
===
--- include/__mutex_base
+++ include/__mutex_base
@@ -26,7 +26,7 @@
 
 #ifndef _LIBCPP_HAS_NO_THREADS
 
-class _LIBCPP_TYPE_VIS mutex
+class _LIBCPP_TYPE_VIS _LIBCPP_THREAD_ANNOTATION(capability("mutex")) mutex
 {
 pthread_mutex_t __m_;
 
@@ -44,9 +44,9 @@
 mutex& operator=(const mutex&);// = delete;
 
 public:
-void lock();
-bool try_lock() _NOEXCEPT;
-void unlock() _NOEXCEPT;
+void lock() _LIBCPP_THREAD_ANNOTATION(acquire_capability());
+bool try_lock() _NOEXCEPT _LIBCPP_THREAD_ANNOTATION(try_acquire_capability(true));
+void unlock() _NOEXCEPT _LIBCPP_THREAD_ANNOTATION(release_capability());
 
 typedef pthread_mutex_t* native_handle_type;
 _LIBCPP_INLINE_VISIBILITY native_handle_type native_handle() {return &__m_;}
@@ -71,7 +71,7 @@
 #endif
 
 template 
-class _LIBCPP_TYPE_VIS_ONLY lock_guard
+class _LIBCPP_TYPE_VIS_ONLY _LIBCPP_THREAD_ANNOTATION(scoped_lockable) lock_guard
 {
 public:
 typedef _Mutex mutex_type;
@@ -81,13 +81,13 @@
 public:
 
 _LIBCPP_INLINE_VISIBILITY
-explicit lock_guard(mutex_type& __m)
+explicit lock_guard(mutex_type& __m) _LIBCPP_THREAD_ANNOTATION(acquire_capability(__m))
 : __m_(__m) {__m_.lock();}
 _LIBCPP_INLINE_VISIBILITY
-lock_guard(mutex_type& __m, adopt_lock_t)
+lock_guard(mutex_type& __m, adopt_lock_t) _LIBCPP_THREAD_ANNOTATION(requires_capability(__m))
 : __m_(__m) {}
 _LIBCPP_INLINE_VISIBILITY
-~lock_guard() {__m_.unlock();}
+~lock_guard() _LIBCPP_THREAD_ANNOTATION(release_capability()) {__m_.unlock();}
 
 private:
 lock_guard(lock_guard const&);// = delete;
Index: include/__config
===
--- include/__config
+++ include/__config
@@ -825,6 +825,12 @@
 #define _LIBCPP_HAS_NO_ATOMIC_HEADER
 #endif
 
+#if defined(__clang__)
+#define _LIBCPP_THREAD_ANNOTATION(x) __attribute__((x))
+#else
+#define _LIBCPP_THREAD_ANNOTATION(x)
+#endif
+
 #endif // __cplusplus
 
 #endif // _LIBCPP_CONFIG
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r253259 - Derive nacltools::Linker from GnuTool to get response file support

2015-11-16 Thread Derek Schuff via cfe-commits
Author: dschuff
Date: Mon Nov 16 16:21:25 2015
New Revision: 253259

URL: http://llvm.org/viewvc/llvm-project?rev=253259&view=rev
Log:
Derive nacltools::Linker from GnuTool to get response file support

It could be derived from gnutools::Linker directly but this way makes it
consistent with all the other toolchains around it.

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

Modified: cfe/trunk/lib/Driver/Tools.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.h?rev=253259&r1=253258&r2=253259&view=diff
==
--- cfe/trunk/lib/Driver/Tools.h (original)
+++ cfe/trunk/lib/Driver/Tools.h Mon Nov 16 16:21:25 2015
@@ -555,9 +555,9 @@ public:
 const char *LinkingOutput) const override;
 };
 
-class LLVM_LIBRARY_VISIBILITY Linker : public Tool {
+class LLVM_LIBRARY_VISIBILITY Linker : public GnuTool {
 public:
-  Linker(const ToolChain &TC) : Tool("NaCl::Linker", "linker", TC) {}
+  Linker(const ToolChain &TC) : GnuTool("NaCl::Linker", "linker", TC) {}
 
   bool hasIntegratedCPP() const override { return false; }
   bool isLinkJob() const override { return true; }


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


Re: [PATCH] D14506: Porting shouldVisitImplicitCode to DataRecursiveASTVisitor.

2015-11-16 Thread Craig, Ben via cfe-commits
I'm fine with this approach.  How about I leave the file in place, but 
replace the contents with a "using DataRecursiveASTVisitor = 
RecursiveASTVisitor;" and see what breaks?  That way I won't need to go 
through a large retrofit.


On 11/16/2015 3:28 PM, Richard Smith wrote:
Rather than trying to maintain the horrible duplication between 
DataRecursiveASTVisitor and RecursiveASTVisitor, can we just delete 
DataRecursiveASTVisitor? RecursiveASTVisitor is data-recursive too 
these days (and has a smarter implementation than 
DataRecursiveASTVisitor's from what I can see), but doesn't yet apply 
data recursion in so many cases.


On Mon, Nov 16, 2015 at 1:07 PM, Argyrios Kyrtzidis > wrote:


LGTM.

> On Nov 16, 2015, at 12:32 PM, Ben Craig
mailto:ben.cr...@codeaurora.org>> wrote:
>
> bcraig added a comment.
>
> Ping.  Note that the test is basically a copy / paste job, and
the new code in DataRecursiveASTVisitor.h is a very direct
translation from the 'regular' RecursiveASTVisitor.h.
>
>
> http://reviews.llvm.org/D14506
>
>
>




--
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux 
Foundation Collaborative Project

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


Re: [PATCH] D14727: [Driver] Adapt Linux::GCCVersion::Parse to match GCC 5 installations

2015-11-16 Thread Jonathan Roelofs via cfe-commits
jroelofs added a subscriber: jroelofs.
jroelofs added a comment.

testcase?


http://reviews.llvm.org/D14727



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


r253269 - Make FP_CONTRACT ON the default.

2015-11-16 Thread Stephen Canon via cfe-commits
Author: scanon
Date: Mon Nov 16 17:09:11 2015
New Revision: 253269

URL: http://llvm.org/viewvc/llvm-project?rev=253269&view=rev
Log:
Make FP_CONTRACT ON the default.

Differential Revision: D14200

Added:
cfe/trunk/test/CodeGen/aarch64-scalar-fma.c
Modified:
cfe/trunk/include/clang/Basic/LangOptions.def
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/test/CodeGen/aarch64-neon-fma.c
cfe/trunk/test/CodeGen/fp-contract-pragma.cpp
cfe/trunk/test/Driver/clang_f_opts.c

Modified: cfe/trunk/include/clang/Basic/LangOptions.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.def?rev=253269&r1=253268&r2=253269&view=diff
==
--- cfe/trunk/include/clang/Basic/LangOptions.def (original)
+++ cfe/trunk/include/clang/Basic/LangOptions.def Mon Nov 16 17:09:11 2015
@@ -187,7 +187,7 @@ BENIGN_LANGOPT(DebuggerObjCLiteral , 1,
 BENIGN_LANGOPT(SpellChecking , 1, 1, "spell-checking")
 LANGOPT(SinglePrecisionConstants , 1, 0, "treating double-precision floating 
point constants as single precision constants")
 LANGOPT(FastRelaxedMath , 1, 0, "OpenCL fast relaxed math")
-LANGOPT(DefaultFPContract , 1, 0, "FP_CONTRACT")
+LANGOPT(DefaultFPContract , 1, 1, "FP_CONTRACT")
 LANGOPT(NoBitFieldTypeAlign , 1, 0, "bit-field type alignment")
 LANGOPT(HexagonQdsp6Compat , 1, 0, "hexagon-qdsp6 backward compatibility")
 LANGOPT(ObjCAutoRefCount , 1, 0, "Objective-C automated reference counting")

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=253269&r1=253268&r2=253269&view=diff
==
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Mon Nov 16 17:09:11 2015
@@ -1336,7 +1336,6 @@ void CompilerInvocation::setLangDefaults
 Opts.ZVector = 0;
 Opts.CXXOperatorNames = 1;
 Opts.LaxVectorConversions = 0;
-Opts.DefaultFPContract = 1;
 Opts.NativeHalfType = 1;
   }
 

Modified: cfe/trunk/test/CodeGen/aarch64-neon-fma.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/aarch64-neon-fma.c?rev=253269&r1=253268&r2=253269&view=diff
==
--- cfe/trunk/test/CodeGen/aarch64-neon-fma.c (original)
+++ cfe/trunk/test/CodeGen/aarch64-neon-fma.c Mon Nov 16 17:09:11 2015
@@ -1,5 +1,8 @@
 // REQUIRES: aarch64-registered-target
-// RUN: %clang_cc1 -triple arm64-none-linux-gnu -target-feature +neon -S -O3 
-o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple arm64-none-linux-gnu -target-feature +neon -S -O3 \
+// RUN:   -ffp-contract=off -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple arm64-none-linux-gnu -target-feature +neon -S -O3 \
+// RUN:   -o - %s | FileCheck -check-prefix=CHECK-FMA %s
 
 // Test new aarch64 intrinsics and types
 
@@ -10,8 +13,7 @@ float32x2_t test_vmla_n_f32(float32x2_t
   return vmla_n_f32(a, b, c);
   // CHECK: fmul {{v[0-9]+}}.2s, {{v[0-9]+}}.2s, {{v[0-9]+}}.s[0]
   // CHECK: fadd {{v[0-9]+}}.2s, {{v[0-9]+}}.2s, {{v[0-9]+}}.2s
-  // CHECK-FMA: dup {{v[0-9]+}}.2s, {{v[0-9]+}}.s[0]
-  // CHECK-FMA: fmla {{v[0-9]+}}.2s, {{v[0-9]+}}.2s, {{v[0-9]+}}.2s
+  // CHECK-FMA: fmla {{v[0-9]+}}.2s, {{v[0-9]+}}.2s, {{v[0-9]+}}.s[0]
 }
 
 float32x4_t test_vmlaq_n_f32(float32x4_t a, float32x4_t b, float32_t c) {
@@ -19,8 +21,7 @@ float32x4_t test_vmlaq_n_f32(float32x4_t
   return vmlaq_n_f32(a, b, c);
   // CHECK: fmul {{v[0-9]+}}.4s, {{v[0-9]+}}.4s, {{v[0-9]+}}.s[0]
   // CHECK: fadd {{v[0-9]+}}.4s, {{v[0-9]+}}.4s, {{v[0-9]+}}.4s
-  // CHECK-FMA: dup {{v[0-9]+}}.4s, {{v[0-9]+}}.s[0]
-  // CHECK-FMA: fmla {{v[0-9]+}}.4s, {{v[0-9]+}}.4s, {{v[0-9]+}}.4s
+  // CHECK-FMA: fmla {{v[0-9]+}}.4s, {{v[0-9]+}}.4s, {{v[0-9]+}}.s[0]
 }
 
 float64x2_t test_vmlaq_n_f64(float64x2_t a, float64x2_t b, float64_t c) {
@@ -28,8 +29,7 @@ float64x2_t test_vmlaq_n_f64(float64x2_t
   return vmlaq_n_f64(a, b, c);
   // CHECK: fmul {{v[0-9]+}}.2d, {{v[0-9]+}}.2d, {{v[0-9]+}}.d[0]
   // CHECK: fadd {{v[0-9]+}}.2d, {{v[0-9]+}}.2d, {{v[0-9]+}}.2d
-  // CHECK-FMA: dup {{v[0-9]+}}.2d, {{v[0-9]+}}.d[0]
-  // CHECK-FMA: fmla {{v[0-9]+}}.2d, {{v[0-9]+}}.2d, {{v[0-9]+}}.2d
+  // CHECK-FMA: fmla {{v[0-9]+}}.2d, {{v[0-9]+}}.2d, {{v[0-9]+}}.d[0]
 }
 
 float32x4_t test_vmlsq_n_f32(float32x4_t a, float32x4_t b, float32_t c) {
@@ -37,8 +37,7 @@ float32x4_t test_vmlsq_n_f32(float32x4_t
   return vmlsq_n_f32(a, b, c);
   // CHECK: fmul {{v[0-9]+}}.4s, {{v[0-9]+}}.4s, {{v[0-9]+}}.s[0]
   // CHECK: fsub {{v[0-9]+}}.4s, {{v[0-9]+}}.4s, {{v[0-9]+}}.4s
-  // CHECK-FMA: dup {{v[0-9]+}}.4s, {{v[0-9]+}}.s[0]
-  // CHECK-FMA: fmls {{v[0-9]+}}.4s, {{v[0-9]+}}.4s, {{v[0-9]+}}.4s
+  // CHECK-FMA: fmls {{v[0-9]+}}.4s, {{v[0-9]+}}.4s, {{v[0-9]+}}.s[0]
 }
 
 float32x2_t test_vmls_n_f32(float32x2_t a, float32x2_t b, float32_t c) {
@@ -4

Re: [PATCH] D14200: Make FP_CONTRACT ON default.

2015-11-16 Thread Steve Canon via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL253269: Make FP_CONTRACT ON the default. (authored by 
scanon).

Changed prior to commit:
  http://reviews.llvm.org/D14200?vs=39205&id=40351#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D14200

Files:
  cfe/trunk/include/clang/Basic/LangOptions.def
  cfe/trunk/lib/Frontend/CompilerInvocation.cpp
  cfe/trunk/test/CodeGen/aarch64-neon-fma.c
  cfe/trunk/test/CodeGen/aarch64-scalar-fma.c
  cfe/trunk/test/CodeGen/fp-contract-pragma.cpp
  cfe/trunk/test/Driver/clang_f_opts.c

Index: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
===
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp
@@ -1336,7 +1336,6 @@
 Opts.ZVector = 0;
 Opts.CXXOperatorNames = 1;
 Opts.LaxVectorConversions = 0;
-Opts.DefaultFPContract = 1;
 Opts.NativeHalfType = 1;
   }
 
Index: cfe/trunk/include/clang/Basic/LangOptions.def
===
--- cfe/trunk/include/clang/Basic/LangOptions.def
+++ cfe/trunk/include/clang/Basic/LangOptions.def
@@ -187,7 +187,7 @@
 BENIGN_LANGOPT(SpellChecking , 1, 1, "spell-checking")
 LANGOPT(SinglePrecisionConstants , 1, 0, "treating double-precision floating point constants as single precision constants")
 LANGOPT(FastRelaxedMath , 1, 0, "OpenCL fast relaxed math")
-LANGOPT(DefaultFPContract , 1, 0, "FP_CONTRACT")
+LANGOPT(DefaultFPContract , 1, 1, "FP_CONTRACT")
 LANGOPT(NoBitFieldTypeAlign , 1, 0, "bit-field type alignment")
 LANGOPT(HexagonQdsp6Compat , 1, 0, "hexagon-qdsp6 backward compatibility")
 LANGOPT(ObjCAutoRefCount , 1, 0, "Objective-C automated reference counting")
Index: cfe/trunk/test/Driver/clang_f_opts.c
===
--- cfe/trunk/test/Driver/clang_f_opts.c
+++ cfe/trunk/test/Driver/clang_f_opts.c
@@ -36,8 +36,10 @@
 // RUN: %clang -### -S -ffp-contract=fast %s 2>&1 | FileCheck -check-prefix=FP-CONTRACT-FAST-CHECK %s
 // RUN: %clang -### -S -ffast-math %s 2>&1 | FileCheck -check-prefix=FP-CONTRACT-FAST-CHECK %s
 // RUN: %clang -### -S -ffp-contract=off %s 2>&1 | FileCheck -check-prefix=FP-CONTRACT-OFF-CHECK %s
+// RUN: %clang -### -S -ffp-contract=on %s 2>&1 | FileCheck -check-prefix=FP-CONTRACT-ON-CHECK %s
 // FP-CONTRACT-FAST-CHECK: -ffp-contract=fast
 // FP-CONTRACT-OFF-CHECK: -ffp-contract=off
+// FP-CONTRACT-ON-CHECK: -ffp-contract=on
 
 // RUN: %clang -### -S -funroll-loops %s 2>&1 | FileCheck -check-prefix=CHECK-UNROLL-LOOPS %s
 // RUN: %clang -### -S -fno-unroll-loops %s 2>&1 | FileCheck -check-prefix=CHECK-NO-UNROLL-LOOPS %s
Index: cfe/trunk/test/CodeGen/fp-contract-pragma.cpp
===
--- cfe/trunk/test/CodeGen/fp-contract-pragma.cpp
+++ cfe/trunk/test/CodeGen/fp-contract-pragma.cpp
@@ -1,5 +1,7 @@
 // RUN: %clang_cc1 -O3 -triple %itanium_abi_triple -emit-llvm -o - %s | FileCheck %s
 
+#pragma STDC FP_CONTRACT OFF
+
 // Is FP_CONTRACT is honored in a simple case?
 float fp_contract_1(float a, float b, float c) {
 // CHECK: _Z13fp_contract_1fff
Index: cfe/trunk/test/CodeGen/aarch64-scalar-fma.c
===
--- cfe/trunk/test/CodeGen/aarch64-scalar-fma.c
+++ cfe/trunk/test/CodeGen/aarch64-scalar-fma.c
@@ -0,0 +1,177 @@
+// RUN: %clang_cc1 -triple=aarch64-unknown -Os -ffp-contract=fast -S -o - %s | FileCheck -check-prefix=CHECK-FAST -check-prefix=CHECK-ALL %s
+// RUN: %clang_cc1 -triple=aarch64-unknown -Os -ffp-contract=on -S -o - %s | FileCheck -check-prefix=CHECK-ON -check-prefix=CHECK-ALL %s
+// RUN: %clang_cc1 -triple=aarch64-unknown -Os -ffp-contract=off -S -o - %s | FileCheck -check-prefix=CHECK-OFF -check-prefix=CHECK-ALL %s
+// RUN: %clang_cc1 -triple=aarch64-unknown -Os -S -o - %s | FileCheck -check-prefix=CHECK-ON -check-prefix=CHECK-ALL %s
+// REQUIRES: aarch64-registered-target
+
+float test1(float x, float y, float z) {
+  return x*y + z;
+  // CHECK-ALL-LABEL: test1:
+  // CHECK-FAST: fmadd
+  // CHECK-ON: fmadd
+  // CHECK-OFF: fmul
+  // CHECK-OFF-NEXT: fadd
+}
+
+double test2(double x, double y, double z) {
+  z -= x*y;
+  return z;
+  // CHECK-ALL-LABEL: test2:
+  // CHECK-FAST: fmsub
+  // CHECK-ON: fmsub
+  // CHECK-OFF: fmul
+  // CHECK-OFF-NEXT: fsub
+}
+
+float test3(float x, float y, float z) {
+  float tmp = x*y;
+  return tmp + z;
+  // CHECK-ALL-LABEL: test3:
+  // CHECK-FAST: fmadd
+  // CHECK-ON: fmul
+  // CHECK-ON-NEXT: fadd
+  // CHECK-OFF: fmul
+  // CHECK-OFF-NEXT: fadd
+}
+
+double test4(double x, double y, double z) {
+  double tmp = x*y;
+  return tmp - z;
+  // CHECK-ALL-LABEL: test4:
+  // CHECK-FAST: fnmsub
+  // CHECK-ON: fmul
+  // CHECK-ON-NEXT: fsub
+  // CHECK-OFF: fmul
+  // CHECK-OFF-NEXT: fsub
+}
+
+#pragma STDC FP_CONTRACT ON
+
+float test5(float x, float y, float z) {
+  return x*y + z;
+  // 

Re: [libcxx] r253257 - More tests for LWG#2156

2015-11-16 Thread Bruno Cardoso Lopes via cfe-commits
Hi Marshall,

reserve.pass.cpp is failing on green dragon bot:

/Users/buildslave/jenkins/sharedspace/clang-stage1-cmake-RA_workspace@2/llvm/projects/libcxx/test/std/containers/unord/unord.multimap/reserve.pass.cpp:45:14:
error: type 'std::unordered_multimap' does not provide
a subscript operator

c[i] = i;

~^~

1 error generated.

--

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


On Mon, Nov 16, 2015 at 2:18 PM, Marshall Clow via cfe-commits
 wrote:
> Author: marshall
> Date: Mon Nov 16 16:18:36 2015
> New Revision: 253257
>
> URL: http://llvm.org/viewvc/llvm-project?rev=253257&view=rev
> Log:
> More tests for LWG#2156
>
> Modified:
> libcxx/trunk/test/std/containers/unord/unord.map/reserve.pass.cpp
> libcxx/trunk/test/std/containers/unord/unord.multimap/reserve.pass.cpp
> libcxx/trunk/test/std/containers/unord/unord.multiset/reserve.pass.cpp
> libcxx/trunk/test/std/containers/unord/unord.set/reserve.pass.cpp
>
> Modified: libcxx/trunk/test/std/containers/unord/unord.map/reserve.pass.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/unord/unord.map/reserve.pass.cpp?rev=253257&r1=253256&r2=253257&view=diff
> ==
> --- libcxx/trunk/test/std/containers/unord/unord.map/reserve.pass.cpp 
> (original)
> +++ libcxx/trunk/test/std/containers/unord/unord.map/reserve.pass.cpp Mon Nov 
> 16 16:18:36 2015
> @@ -31,6 +31,21 @@ void test(const C& c)
>  assert(c.at(4) == "four");
>  }
>
> +void reserve_invariant(size_t n) // LWG #2156
> +{
> +for (size_t i = 0; i < n; ++i)
> +{
> +std::unordered_map c;
> +c.reserve(n);
> +size_t buckets = c.bucket_count();
> +for (size_t j = 0; j < i; ++j)
> +{
> +c[i] = i;
> +assert(buckets == c.bucket_count());
> +}
> +}
> +}
> +
>  int main()
>  {
>  {
> @@ -88,4 +103,5 @@ int main()
>  test(c);
>  }
>  #endif
> +reserve_invariant(20);
>  }
>
> Modified: 
> libcxx/trunk/test/std/containers/unord/unord.multimap/reserve.pass.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/unord/unord.multimap/reserve.pass.cpp?rev=253257&r1=253256&r2=253257&view=diff
> ==
> --- libcxx/trunk/test/std/containers/unord/unord.multimap/reserve.pass.cpp 
> (original)
> +++ libcxx/trunk/test/std/containers/unord/unord.multimap/reserve.pass.cpp 
> Mon Nov 16 16:18:36 2015
> @@ -33,6 +33,21 @@ void test(const C& c)
>  assert(c.find(4)->second == "four");
>  }
>
> +void reserve_invariant(size_t n) // LWG #2156
> +{
> +for (size_t i = 0; i < n; ++i)
> +{
> +std::unordered_multimap c;
> +c.reserve(n);
> +size_t buckets = c.bucket_count();
> +for (size_t j = 0; j < i; ++j)
> +{
> +c[i] = i;
> +assert(buckets == c.bucket_count());
> +}
> +}
> +}
> +
>  int main()
>  {
>  {
> @@ -90,4 +105,5 @@ int main()
>  test(c);
>  }
>  #endif
> +reserve_invariant(20);
>  }
>
> Modified: 
> libcxx/trunk/test/std/containers/unord/unord.multiset/reserve.pass.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/unord/unord.multiset/reserve.pass.cpp?rev=253257&r1=253256&r2=253257&view=diff
> ==
> --- libcxx/trunk/test/std/containers/unord/unord.multiset/reserve.pass.cpp 
> (original)
> +++ libcxx/trunk/test/std/containers/unord/unord.multiset/reserve.pass.cpp 
> Mon Nov 16 16:18:36 2015
> @@ -30,6 +30,21 @@ void test(const C& c)
>  assert(c.count(4) == 1);
>  }
>
> +void reserve_invariant(size_t n) // LWG #2156
> +{
> +for (size_t i = 0; i < n; ++i)
> +{
> +std::unordered_multiset c;
> +c.reserve(n);
> +size_t buckets = c.bucket_count();
> +for (size_t j = 0; j < i; ++j)
> +{
> +c.insert(i);
> +assert(buckets == c.bucket_count());
> +}
> +}
> +}
> +
>  int main()
>  {
>  {
> @@ -87,4 +102,5 @@ int main()
>  test(c);
>  }
>  #endif
> +reserve_invariant(20);
>  }
>
> Modified: libcxx/trunk/test/std/containers/unord/unord.set/reserve.pass.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/unord/unord.set/reserve.pass.cpp?rev=253257&r1=253256&r2=253257&view=diff
> ==
> --- libcxx/trunk/test/std/containers/unord/unord.set/reserve.pass.cpp 
> (original)
> +++ libcxx/trunk/test/std/containers/unord/unord.set/reserve.pass.cpp Mon Nov 
> 16 16:18:36 2015
> @@ -30,6 +30,21 @@ void test(const C& c)
>  assert(c.count(4) == 1);
>  }
>
> +void reserve_invariant(size_t n) // LWG 

[libcxx] r253271 - Fix compile error in test. Can't use `operator[]` for multimap.

2015-11-16 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Mon Nov 16 17:40:27 2015
New Revision: 253271

URL: http://llvm.org/viewvc/llvm-project?rev=253271&view=rev
Log:
Fix compile error in test. Can't use `operator[]` for multimap.


Modified:
libcxx/trunk/test/std/containers/unord/unord.multimap/reserve.pass.cpp

Modified: libcxx/trunk/test/std/containers/unord/unord.multimap/reserve.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/unord/unord.multimap/reserve.pass.cpp?rev=253271&r1=253270&r2=253271&view=diff
==
--- libcxx/trunk/test/std/containers/unord/unord.multimap/reserve.pass.cpp 
(original)
+++ libcxx/trunk/test/std/containers/unord/unord.multimap/reserve.pass.cpp Mon 
Nov 16 17:40:27 2015
@@ -42,7 +42,7 @@ void reserve_invariant(size_t n) // LWG
 size_t buckets = c.bucket_count();
 for (size_t j = 0; j < i; ++j)
 {
-c[i] = i;
+c.insert(std::unordered_multimap::value_type(i,i));
 assert(buckets == c.bucket_count());
 }
 }


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


Re: [PATCH] D14727: [Driver] Adapt Linux::GCCVersion::Parse to match GCC 5 installations

2015-11-16 Thread Jonathan Roelofs via cfe-commits
jroelofs added a comment.

hHave a look at the svn-blame for this file, then find other commits which 
changed this part of the file, and see where those commits added tests.


http://reviews.llvm.org/D14727



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


LLVM buildmaster will be restarted tonight

2015-11-16 Thread Galina Kistanova via cfe-commits
Hello everyone,

LLVM buildmaster will be updated restarted after 7 PM Pacific time today.

Thanks

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


[libcxx] r253274 - Implement P0007: Constant View: A proposal for a std::as_const helper function template.

2015-11-16 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Mon Nov 16 18:08:08 2015
New Revision: 253274

URL: http://llvm.org/viewvc/llvm-project?rev=253274&view=rev
Log:
Implement P0007: Constant View: A proposal for a std::as_const helper function 
template.

Added:
libcxx/trunk/test/std/utilities/utility/as_const/
libcxx/trunk/test/std/utilities/utility/as_const/as_const.fail.cpp
libcxx/trunk/test/std/utilities/utility/as_const/as_const.pass.cpp
Modified:
libcxx/trunk/include/utility
libcxx/trunk/www/cxx1z_status.html

Modified: libcxx/trunk/include/utility
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/utility?rev=253274&r1=253273&r2=253274&view=diff
==
--- libcxx/trunk/include/utility (original)
+++ libcxx/trunk/include/utility Mon Nov 16 18:08:08 2015
@@ -52,6 +52,9 @@ template 
 >::type
 move_if_noexcept(T& x) noexcept; // constexpr in C++14
 
+template  constexpr add_const_t& as_const(T& t) noexcept;  // 
C++17
+template   void as_const(const T&&) = delete; // 
C++17
+
 template  typename add_rvalue_reference::type declval() noexcept;
 
 template 
@@ -242,6 +245,11 @@ move_if_noexcept(_Tp& __x) _NOEXCEPT
 return _VSTD::move(__x);
 }
 
+#if _LIBCPP_STD_VER > 14
+template  constexpr add_const_t<_Tp>& as_const(_Tp& __t) noexcept { 
return __t; }
+template void as_const(const _Tp&&) = 
delete;
+#endif
+
 struct _LIBCPP_TYPE_VIS_ONLY piecewise_construct_t { };
 #if defined(_LIBCPP_HAS_NO_CONSTEXPR) || defined(_LIBCPP_BUILDING_UTILITY)
 extern const piecewise_construct_t piecewise_construct;// = 
piecewise_construct_t();

Added: libcxx/trunk/test/std/utilities/utility/as_const/as_const.fail.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/utility/as_const/as_const.fail.cpp?rev=253274&view=auto
==
--- libcxx/trunk/test/std/utilities/utility/as_const/as_const.fail.cpp (added)
+++ libcxx/trunk/test/std/utilities/utility/as_const/as_const.fail.cpp Mon Nov 
16 18:08:08 2015
@@ -0,0 +1,22 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// template  constexpr add_const& as_const(T& t) noexcept;  // 
C++17
+// templateadd_const& as_const(const T&&) = delete; // 
C++17
+
+#include 
+
+struct S {int i;};
+
+int main()
+{
+   std::as_const(S{});
+}

Added: libcxx/trunk/test/std/utilities/utility/as_const/as_const.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/utility/as_const/as_const.pass.cpp?rev=253274&view=auto
==
--- libcxx/trunk/test/std/utilities/utility/as_const/as_const.pass.cpp (added)
+++ libcxx/trunk/test/std/utilities/utility/as_const/as_const.pass.cpp Mon Nov 
16 18:08:08 2015
@@ -0,0 +1,46 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// template  constexpr add_const& as_const(T& t) noexcept;  // 
C++17
+// templateadd_const& as_const(const T&&) = delete; // 
C++17
+
+#include 
+#include 
+
+struct S {int i;};
+bool operator==(const S& x, const S& y) { return x.i == y.i; }
+bool operator==(const volatile S& x, const volatile S& y) { return x.i == y.i; 
}
+
+template
+void test(T& t)
+{
+static_assert(std::is_const::type>::value, "");
+static_assert(std::is_const(t))>::type>::value, "");
+static_assert(std::is_const(t))>::type>::value, "");
+static_assert(std::is_const(t))>::type>::value, "");
+static_assert(std::is_const(t))>::type>::value, "");
+
+assert(std::as_const(t) == t);
+assert(std::as_const<   T>(t) == t);
+assert(std::as_const(t) == t);
+assert(std::as_const(t) == t);
+assert(std::as_const(t) == t);
+}
+
+int main()
+{
+   int i = 3;
+   double d = 4.0;
+   S s{2};
+   test(i);
+   test(d);
+   test(s);
+}

Modified: libcxx/trunk/www/cxx1z_status.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx1z_status.html?rev=253274&r1=253273&r2=253274&view=diff
==
--- libcxx/trunk/www/cxx1z_status.html (original)
+++ libcxx/t

[PATCH] D14736: [analyzer] DeadStoresChecker: Treat locals captured by reference in C++ lambdas as escaped.

2015-11-16 Thread Devin Coughlin via cfe-commits
dcoughlin created this revision.
dcoughlin added reviewers: zaks.anna, xazax.hun.
dcoughlin added a subscriber: cfe-commits.

The analyzer currently reports dead store false positives when a local variable 
is captured by reference in a C++ lambda.

For example:

int local = 0; 
auto lambda = [&local]() {
  local++;
};
local = 7; // False Positive: Value stored to 'local' is never read
lambda();

In this case, the assignment setting `local` to 7 is not a dead store because 
the called lambda will later read that assigned value.

This patch silences this source of false positives by treating locals captured 
by reference in C++ lambdas as escaped, similarly to how the DeadStoresChecker 
deals with locals whose address is taken.

http://reviews.llvm.org/D14736

Files:
  lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp
  test/Analysis/lambdas.cpp

Index: test/Analysis/lambdas.cpp
===
--- test/Analysis/lambdas.cpp
+++ test/Analysis/lambdas.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++11 -fsyntax-only -analyze -analyzer-checker=core,debug.ExprInspection -analyzer-config inline-lambdas=true -verify %s 
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -analyze -analyzer-checker=core,deadcode,debug.ExprInspection -analyzer-config inline-lambdas=true -verify %s
 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -analyze -analyzer-checker=core,debug.DumpCFG -analyzer-config inline-lambdas=true %s > %t 2>&1
 // RUN: FileCheck --input-file=%t %s
 
@@ -281,6 +281,49 @@
   }();
 }
 
+// Lambda capture counts as use for dead-store checking.
+
+int returnsValue();
+
+void captureByCopyCausesUse() {
+  int local1 = returnsValue(); // no-warning
+  int local2 = returnsValue(); // no-warning
+  int local3 = returnsValue(); // expected-warning{{Value stored to 'local3' during its initialization is never read}}
+
+  (void)[local1, local2]() { }; // Explicit capture by copy counts as use.
+
+  int local4 = returnsValue(); // no-warning
+  int local5 = returnsValue(); // expected-warning{{Value stored to 'local5' during its initialization is never read}}
+
+  (void)[=]() {
+(void)local4; // Implicit capture by copy counts as use
+  };
+}
+
+void captureByReference() {
+  int local1 = returnsValue(); // no-warning
+
+  auto lambda1 = [&local1]() { // Explicit capture by reference
+local1++;
+  };
+
+  // Don't treat as a dead store because local1 was was captured by reference.
+  local1 = 7; // no-warning
+
+  lambda1();
+
+  int local2 = returnsValue(); // no-warning
+
+  auto lambda2 = [&]() {
+local2++; // Implicit capture by reference
+  };
+
+  // Don't treat as a dead store because local2 was was captured by reference.
+  local2 = 7; // no-warning
+
+  lambda2();
+}
+
 
 // CHECK: [B2 (ENTRY)]
 // CHECK:   Succs (1): B1
Index: lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp
===
--- lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp
+++ lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp
@@ -401,6 +401,11 @@
 // Check for '&'. Any VarDecl whose address has been taken we treat as
 // escaped.
 // FIXME: What about references?
+if (auto *LE = dyn_cast(S)) {
+  findLambdaReferenceCaptures(LE);
+  return;
+}
+
 const UnaryOperator *U = dyn_cast(S);
 if (!U)
   return;
@@ -412,6 +417,28 @@
   if (const VarDecl *VD = dyn_cast(DR->getDecl()))
 Escaped.insert(VD);
   }
+
+  // Treat local variables captured by reference in C++ lambdas as escaped.
+  void findLambdaReferenceCaptures(const LambdaExpr *LE)  {
+const CXXRecordDecl *LambdaClass = LE->getLambdaClass();
+llvm::DenseMap CaptureFields;
+FieldDecl *ThisCaptureField;
+LambdaClass->getCaptureFields(CaptureFields, ThisCaptureField);
+
+for (const LambdaCapture &C : LE->captures()) {
+  if (!C.capturesVariable())
+continue;
+
+  VarDecl *VD = C.getCapturedVar();
+  const FieldDecl *FD = CaptureFields[VD];
+  if (!FD)
+continue;
+
+  // If the capture field is a reference type, it is capture-by-reference.
+  if (FD->getType()->isReferenceType())
+Escaped.insert(VD);
+}
+  }
 };
 } // end anonymous namespace
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D14727: [Driver] Adapt Linux::GCCVersion::Parse to match GCC 5 installations

2015-11-16 Thread Thiago Macieira via cfe-commits
thiagomacieira updated this revision to Diff 40359.
thiagomacieira added a comment.

v2: fix accidental breakage of GCC 4


http://reviews.llvm.org/D14727

Files:
  lib/Driver/ToolChains.cpp

Index: lib/Driver/ToolChains.cpp
===
--- lib/Driver/ToolChains.cpp
+++ lib/Driver/ToolChains.cpp
@@ -1230,14 +1230,17 @@
   GCCVersion GoodVersion = {VersionText.str(), -1, -1, -1, "", "", ""};
   if (First.first.getAsInteger(10, GoodVersion.Major) || GoodVersion.Major < 0)
 return BadVersion;
-  GoodVersion.MajorStr = First.first.str();
+  if (First.second.empty())
+return GoodVersion;
+
   if (Second.first.getAsInteger(10, GoodVersion.Minor) || GoodVersion.Minor < 
0)
 return BadVersion;
   GoodVersion.MinorStr = Second.first.str();
 
   // First look for a number prefix and parse that if present. Otherwise just
   // stash the entire patch string in the suffix, and leave the number
   // unspecified. This covers versions strings such as:
+  //   5(handled above)
   //   4.4
   //   4.4.0
   //   4.4.x


Index: lib/Driver/ToolChains.cpp
===
--- lib/Driver/ToolChains.cpp
+++ lib/Driver/ToolChains.cpp
@@ -1230,14 +1230,17 @@
   GCCVersion GoodVersion = {VersionText.str(), -1, -1, -1, "", "", ""};
   if (First.first.getAsInteger(10, GoodVersion.Major) || GoodVersion.Major < 0)
 return BadVersion;
-  GoodVersion.MajorStr = First.first.str();
+  if (First.second.empty())
+return GoodVersion;
+
   if (Second.first.getAsInteger(10, GoodVersion.Minor) || GoodVersion.Minor < 0)
 return BadVersion;
   GoodVersion.MinorStr = Second.first.str();
 
   // First look for a number prefix and parse that if present. Otherwise just
   // stash the entire patch string in the suffix, and leave the number
   // unspecified. This covers versions strings such as:
+  //   5(handled above)
   //   4.4
   //   4.4.0
   //   4.4.x
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D14727: [Driver] Adapt Linux::GCCVersion::Parse to match GCC 5 installations

2015-11-16 Thread Thiago Macieira via cfe-commits
thiagomacieira added a comment.

In http://reviews.llvm.org/D14727#290539, @jroelofs wrote:

> testcase?


Gladly, but where are the tests for GCCVersion located?


http://reviews.llvm.org/D14727



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


Re: [PATCH] D14736: [analyzer] DeadStoresChecker: Treat locals captured by reference in C++ lambdas as escaped.

2015-11-16 Thread Devin Coughlin via cfe-commits
dcoughlin added a comment.

This is PR 22834. https://llvm.org/bugs/show_bug.cgi?id=22834.


http://reviews.llvm.org/D14736



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


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

2015-11-16 Thread Pete Cooper via cfe-commits
pete created this revision.
pete added a reviewer: rjmccall.
pete added a subscriber: cfe-commits.

It is faster to directly call the ObjC runtime for methods such as 
retain/release instead of sending a message to those functions.

This patch adds support for converting messages to 
retain/release/alloc/autorelease to their equivalent runtime calls.

Tests included for the positive case of applying this transformation, negative 
tests that we ensure we only convert "alloc" to objc_alloc, not "alloc2", and 
also a driver test to ensure we enable this only for supported runtime versions.

http://reviews.llvm.org/D14737

Files:
  include/clang/Basic/LangOptions.def
  include/clang/Basic/ObjCRuntime.h
  include/clang/Driver/Options.td
  lib/CodeGen/CGObjC.cpp
  lib/CodeGen/CGObjCMac.cpp
  lib/CodeGen/CodeGenFunction.h
  lib/CodeGen/CodeGenModule.h
  lib/Driver/Tools.cpp
  lib/Frontend/CompilerInvocation.cpp
  test/CodeGenObjC/convert-messages-to-runtime-calls.m
  test/Driver/objc-convert-messages-to-runtime-calls.m

Index: test/Driver/objc-convert-messages-to-runtime-calls.m
===
--- /dev/null
+++ test/Driver/objc-convert-messages-to-runtime-calls.m
@@ -0,0 +1,17 @@
+// RUN: %clang %s -### -o %t.o 2>&1 -fobjc-convert-messages-to-runtime-calls -fsyntax-only -fno-objc-convert-messages-to-runtime-calls -target x86_64-apple-macosx10.10.0 | FileCheck  %s --check-prefix=DISABLE
+// RUN: %clang %s -### -o %t.o 2>&1 -fobjc-convert-messages-to-runtime-calls -fsyntax-only -target x86_64-apple-macosx10.10.0 | FileCheck  %s --check-prefix=ENABLE
+// RUN: %clang %s -### -o %t.o 2>&1 -fsyntax-only -target x86_64-apple-macosx10.10.0 | FileCheck  %s --check-prefix=SUPPORTED_MACOS
+// RUN: %clang %s -### -o %t.o 2>&1 -fsyntax-only -target x86_64-apple-macosx10.9.0 | FileCheck  %s --check-prefix=UNSUPPORTED_MACOS
+// RUN: %clang %s -### -o %t.o 2>&1 -fsyntax-only -target armv7-apple-ios8.0 | FileCheck  %s --check-prefix=SUPPORTED_IOS
+// RUN: %clang %s -### -o %t.o 2>&1 -fsyntax-only -target armv7-apple-ios7.0 | FileCheck  %s --check-prefix=UNSUPPORTED_IOS
+
+// Check that we pass fobjc-convert-messages-to-runtime-calls only when supported, and not explicitly disabled.
+
+// DISABLE-NOT: "-fobjc-convert-messages-to-runtime-calls"
+// ENABLE: "-fobjc-convert-messages-to-runtime-calls"
+// SUPPORTED_MACOS: "-fobjc-convert-messages-to-runtime-calls"
+// UNSUPPORTED_MACOS-NOT: "-fobjc-convert-messages-to-runtime-calls"
+// SUPPORTED_IOS: "-fobjc-convert-messages-to-runtime-calls"
+// UNSUPPORTED_IOS-NOT: "-fobjc-convert-messages-to-runtime-calls"
+
+
Index: test/CodeGenObjC/convert-messages-to-runtime-calls.m
===
--- /dev/null
+++ test/CodeGenObjC/convert-messages-to-runtime-calls.m
@@ -0,0 +1,38 @@
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.10.0 -emit-llvm -o - %s | FileCheck %s --check-prefix=MSGS
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.10.0 -emit-llvm -o - %s -fobjc-convert-messages-to-runtime-calls | FileCheck %s --check-prefix=CALLS
+
+@interface NSObject
++ (id)alloc;
++ (id)alloc2;
+- (id)init;
+- (id)retain;
+- (void)release;
+- (id)autorelease;
+@end
+
+@interface NSString : NSObject
+@end
+
+// CHECK-LABEL: define {{.*}}void @test1
+void test1(id x) {
+  // MSGS: {{call.*@objc_msgSend}}
+  // MSGS: {{call.*@objc_msgSend}}
+  // MSGS: {{call.*@objc_msgSend}}
+  // MSGS: {{call.*@objc_msgSend}}
+  // CALLS: {{call.*@objc_alloc}}
+  // CALLS: {{call.*@objc_retain}}
+  // CALLS: {{call.*@objc_release}}
+  // CALLS: {{call.*@objc_autorelease}}
+  [NSObject alloc];
+  [x retain];
+  [x release];
+  [x autorelease];
+}
+
+// CHECK-LABEL: define {{.*}}void @test2
+void test2() {
+  // MSGS: {{call.*@objc_msgSend}}
+  // CALLS: {{call.*@objc_msgSend}}
+  // Make sure alloc has the correct name and number of types.
+  [NSObject alloc2];
+}
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -1519,6 +1519,9 @@
 if (Args.hasArg(OPT_fobjc_subscripting_legacy_runtime))
   Opts.ObjCSubscriptingLegacyRuntime =
 (Opts.ObjCRuntime.getKind() == ObjCRuntime::FragileMacOSX);
+
+if (Args.hasArg(OPT_fobjc_convert_messages_to_runtime_calls))
+  Opts.ObjCConvertMessagesToRuntimeCalls = 1;
   }
 
   if (Args.hasArg(OPT_fgnu89_inline)) {
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -4842,6 +4842,15 @@
 
   }
 
+  // Allow the user to control whether messages can be converted to runtime
+  // functions.
+  if (types::isObjC(InputType) &&
+  Args.hasFlag(options::OPT_fobjc_convert_messages_to_runtime_calls,
+   options::OPT_fno_objc_convert_messages_to_runtime_calls,
+   true) &&
+  objcRuntime.shouldUse

Lit test C++11 Compatibility Patch #4

2015-11-16 Thread Li, Charles via cfe-commits
Hi Everyone,

Here is the forth Lit tests C++11 compatibility patch.
This patch mainly added new diagnostics expected for C++11.
There are 34 tests in total. They fall into 3 categories.

  [2 tests]  New Warnings regarding storage class specifier "register"/"auto" 
being deprecated/not-allowed.
  [18 Tests] New Note "candidate constructor (the implicit move constructor) 
not viable" accompanying existing Error "no matching constructor"
  [14 Tests] New Note "candidate function (the implicit move assignment 
operator) not viable" accompanying existing Error "no viable overloaded '='"


There is a walkthrough of each test
CXX/basic/basic.lookup/basic.lookup.argdep/p4.cpp
  Added "move constructor" message

CXX/basic/basic.lookup/basic.lookup.qual/namespace.qual/p2.cpp
  Added "move constructor" message
  Note: Also restricted expected Warning "inline namespaces are a C++11 
feature" to C++98/03 and earlier

CXX/basic/basic.scope/basic.scope.hiding/p2.cpp
  Added "move constructor" message

CXX/dcl.dcl/basic.namespace/namespace.udecl/p1.cpp
  Added "move constructor" message

CXX/dcl.dcl/dcl.spec/dcl.stc/p2.cpp
  Added "auto" and "register" message.
  The 2 messages are:
 'auto' storage class specifier is not permitted in C++11, and will not be 
supported in future releases
 'register' storage class specifier is deprecated
  Note: The original run line has option "-Wno-c++0x-compat" This is the 
default behavior in C++98/03,
"-Wno-c++0x-compat" has no effect in C++11.
To avoid confusion, I kept the original run line as is and added 3 more 
run lines
which are default, C++98 and C++11

CXX/dcl.decl/dcl.init/dcl.init.ref/p5-var.cpp
  Added "move constructor" message

CXX/temp/temp.decls/temp.class/temp.static/p1-inst.cpp
  Added "move constructor" message

CXX/temp/temp.decls/temp.class/temp.static/p1.cpp
  Added "move constructor" message

CXX/temp/temp.param/p3.cpp
  Added "move constructor" message

CXX/temp/temp.spec/temp.explicit/p1.cpp
  Added "move constructor" message

OpenMP/for_reduction_messages.cpp
  Added "move assignment operator" message

OpenMP/for_simd_reduction_messages.cpp
  Added "move assignment operator" message

OpenMP/parallel_for_reduction_messages.cpp
  Added "move assignment operator" message

OpenMP/parallel_for_simd_reduction_messages.cpp
  Added "move assignment operator" message

OpenMP/parallel_reduction_messages.cpp
  Added "move assignment operator" message

OpenMP/parallel_sections_reduction_messages.cpp
  Added "move assignment operator" message

OpenMP/sections_reduction_messages.cpp
  Added "move assignment operator" message

OpenMP/simd_reduction_messages.cpp
  Added "move assignment operator" message

OpenMP/teams_reduction_messages.cpp
  Added "move assignment operator" message

SemaCXX/constructor-initializer.cpp
  Added "move constructor" message

SemaCXX/converting-constructor.cpp
  Added "move constructor" message

SemaCXX/crashes.cpp
  Added "move constructor" message

SemaCXX/default1.cpp
  Added "move constructor" message

SemaCXX/direct-initializer.cpp
  Added "move constructor" message

SemaCXX/expressions.cpp
 Added "'register' storage class specifier is deprecated" message

SemaCXX/namespace.cpp
  Added "move assignment operator" message

SemaCXX/overload-call-copycon.cpp
  Added "move constructor" message

SemaCXX/overloaded-builtin-operators.cpp
  Added "move assignment operator" message

SemaCXX/vector.cpp
  Added "move assignment operator" message

SemaTemplate/class-template-ctor-initializer.cpp
  Added "move assignment operator" message

SemaTemplate/constructor-template.cpp
  Added "move constructor" message

SemaTemplate/default-expr-arguments.cpp
  Added "move constructor" message

SemaTemplate/fun-template-def.cpp
  Added "move constructor" message

SemaTemplate/qualified-names-diag.cpp
  Added "move assignment operator" message


All feed backs are welcome.

Thank you.
Charles Li



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


Re: [PATCH] D14506: Porting shouldVisitImplicitCode to DataRecursiveASTVisitor.

2015-11-16 Thread Argyrios Kyrtzidis via cfe-commits
W00t! That’s awesome Richard!

> On Nov 16, 2015, at 5:10 PM, Richard Smith  wrote:
> 
> Attached patch makes RAV fully data-recursive when visiting statements, 
> except in cases where the derived class could tell the difference (when it 
> falls back to a normal recursive walk). The queue representation is slightly 
> less compact than before: instead of storing a child iterator, we now store a 
> list of all children. This allows us to handle any Stmt subclass that we can 
> traverse, not just those ones that finish by traversing all their children in 
> the usual order.
> 
> Thoughts?
> 
> On Mon, Nov 16, 2015 at 2:28 PM, Craig, Ben via cfe-commits 
> mailto:cfe-commits@lists.llvm.org>> wrote:
> I'm fine with this approach.  How about I leave the file in place, but 
> replace the contents with a "using DataRecursiveASTVisitor = 
> RecursiveASTVisitor;" and see what breaks?  That way I won't need to go 
> through a large retrofit.
> 
> 
> On 11/16/2015 3:28 PM, Richard Smith wrote:
>> Rather than trying to maintain the horrible duplication between 
>> DataRecursiveASTVisitor and RecursiveASTVisitor, can we just delete 
>> DataRecursiveASTVisitor? RecursiveASTVisitor is data-recursive too these 
>> days (and has a smarter implementation than DataRecursiveASTVisitor's from 
>> what I can see), but doesn't yet apply data recursion in so many cases.
>> 
>> On Mon, Nov 16, 2015 at 1:07 PM, Argyrios Kyrtzidis < 
>> akyr...@gmail.com > 
>> wrote:
>> LGTM.
>> 
>> > On Nov 16, 2015, at 12:32 PM, Ben Craig < 
>> > ben.cr...@codeaurora.org 
>> > > wrote:
>> >
>> > bcraig added a comment.
>> >
>> > Ping.  Note that the test is basically a copy / paste job, and the new 
>> > code in DataRecursiveASTVisitor.h is a very direct translation from the 
>> > 'regular' RecursiveASTVisitor.h.
>> >
>> >
>> > http://reviews.llvm.org/D14506 
>> >
>> >
>> >
>> 
>> 
> 
> -- 
> Employee of Qualcomm Innovation Center, Inc.
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux 
> Foundation Collaborative Project
> 
> ___
> 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] D14592: Qt (version 4 or 5) signal/method checker

2015-11-16 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko added a subscriber: Eugene.Zelenko.
Eugene.Zelenko added a comment.

There are dedicated project to Qt checks: https://github.com/KDE/clazy.


http://reviews.llvm.org/D14592



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


Re: r253012 - [modules] When a declaration has non-trivial visibility, check whether it's

2015-11-16 Thread Sean Silva via cfe-commits
On Sat, Nov 14, 2015 at 2:30 PM, Richard Smith 
wrote:

> On Nov 13, 2015 7:23 PM, "Sean Silva"  wrote:
> >
> >
> >
> > On Thu, Nov 12, 2015 at 9:14 PM, Richard Smith via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
> >>
> >> Author: rsmith
> >> Date: Thu Nov 12 23:14:45 2015
> >> New Revision: 253012
> >>
> >> URL: http://llvm.org/viewvc/llvm-project?rev=253012&view=rev
> >> Log:
> >> [modules] When a declaration has non-trivial visibility, check whether
> it's
> >
> >
> > What is "non-trivial visibility"? Is this "visibility" something that
> exists in the present C++ language? (e.g. `using namespace std` etc.) or is
> this a different notion?
>
> This is the modules notion of visibility (whether the declaration has been
> imported or not). Here, non-trivial visibility means "not known to be
> unconditionally visible", and corresponds to the Hidden flag on the Decl
> being true.
>

I just looked at the comment on the `Hidden` flag and it doesn't seem to
mention anything about being "trivial" or "non-trivial". Why say
"declaration has non-trivial visibility" instead of just "declaration is
hidden"? Do they mean different things?

-- Sean Silva


> > -- Sean Silva
> >
> >>
> >> actually hidden before we check its linkage. This avoids computing the
> linkage
> >> "too early" for an anonymous struct with a typedef name for linkage.
> >>
> >> Modified:
> >> cfe/trunk/include/clang/Sema/Lookup.h
> >> cfe/trunk/test/Modules/submodule-visibility.cpp
> >>
> >> Modified: cfe/trunk/include/clang/Sema/Lookup.h
> >> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Lookup.h?rev=253012&r1=253011&r2=253012&view=diff
> >>
> ==
> >> --- cfe/trunk/include/clang/Sema/Lookup.h (original)
> >> +++ cfe/trunk/include/clang/Sema/Lookup.h Thu Nov 12 23:14:45 2015
> >> @@ -303,8 +303,7 @@ public:
> >>  if (!D->isInIdentifierNamespace(IDNS))
> >>return nullptr;
> >>
> >> -if (!D->isHidden() || isHiddenDeclarationVisible(D) ||
> >> -isVisibleSlow(getSema(), D))
> >> +if (isVisible(getSema(), D) || isHiddenDeclarationVisible(D))
> >>return D;
> >>
> >>  return getAcceptableDeclSlow(D);
> >>
> >> Modified: cfe/trunk/test/Modules/submodule-visibility.cpp
> >> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/submodule-visibility.cpp?rev=253012&r1=253011&r2=253012&view=diff
> >>
> ==
> >> --- cfe/trunk/test/Modules/submodule-visibility.cpp (original)
> >> +++ cfe/trunk/test/Modules/submodule-visibility.cpp Thu Nov 12 23:14:45
> 2015
> >> @@ -28,3 +28,10 @@ int k = n + m; // OK, a and b are visibl
> >>  #ifndef B
> >>  #error B is not defined
> >>  #endif
> >> +
> >> +// Ensure we don't compute the linkage of this struct before we find
> it has a
> >> +// typedef name for linkage purposes.
> >> +typedef struct {
> >> +  int p;
> >> +  void (*f)(int p);
> >> +} name_for_linkage;
> >>
> >>
> >> ___
> >> 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: Lit test C++11 Compatibility Patch #4

2015-11-16 Thread Richard Smith via cfe-commits
On Mon, Nov 16, 2015 at 5:17 PM, Li, Charles <
charles...@playstation.sony.com> wrote:

> Hi Everyone,
>
>
>
> Here is the forth Lit tests C++11 compatibility patch.
>
> This patch mainly added new diagnostics expected for C++11.
>
> There are 34 tests in total. They fall into 3 categories.
>
>
>
>   [2 tests]  New Warnings regarding storage class specifier
> “register”/”auto” being deprecated/not-allowed.
>
>   [18 Tests] New Note “candidate constructor (the implicit move
> constructor) not viable” accompanying existing Error “no matching
> constructor”
>
>   [14 Tests] New Note “candidate function (the implicit move assignment
> operator) not viable” accompanying existing Error “no viable overloaded '='”
>
>
>
>
>
> There is a walkthrough of each test
>
> CXX/basic/basic.lookup/basic.lookup.argdep/p4.cpp
>
>   Added “move constructor” message
>
>
>
> CXX/basic/basic.lookup/basic.lookup.qual/namespace.qual/p2.cpp
>
>   Added “move constructor” message
>
>   Note: Also restricted expected Warning “inline namespaces are a C++11
> feature” to C++98/03 and earlier
>
>
>
> CXX/basic/basic.scope/basic.scope.hiding/p2.cpp
>
>   Added “move constructor” message
>
>
>
> CXX/dcl.dcl/basic.namespace/namespace.udecl/p1.cpp
>
>   Added “move constructor” message
>
>
>
> CXX/dcl.dcl/dcl.spec/dcl.stc/p2.cpp
>
>   Added “auto” and “register” message.
>
>   The 2 messages are:
>
>  'auto' storage class specifier is not permitted in C++11, and will
> not be supported in future releases
>
>  'register' storage class specifier is deprecated
>
>   Note: The original run line has option “-Wno-c++0x-compat” This is the
> default behavior in C++98/03,
>
> “-Wno-c++0x-compat” has no effect in C++11.
>
> To avoid confusion, I kept the original run line as is and added 3
> more run lines
>
> which are default, C++98 and C++11
>

Remove the original run line here. There's no point including a -Wno-* flag
that's not actually turning off any warnings.

Otherwise, this all looks fine.


> CXX/dcl.decl/dcl.init/dcl.init.ref/p5-var.cpp
>
>   Added “move constructor” message
>
>
>
> CXX/temp/temp.decls/temp.class/temp.static/p1-inst.cpp
>
>   Added “move constructor” message
>
>
>
> CXX/temp/temp.decls/temp.class/temp.static/p1.cpp
>
>   Added “move constructor” message
>
>
>
> CXX/temp/temp.param/p3.cpp
>
>   Added “move constructor” message
>
>
>
> CXX/temp/temp.spec/temp.explicit/p1.cpp
>
>   Added “move constructor” message
>
>
>
> OpenMP/for_reduction_messages.cpp
>
>   Added “move assignment operator” message
>
>
>
> OpenMP/for_simd_reduction_messages.cpp
>
>   Added “move assignment operator” message
>
>
>
> OpenMP/parallel_for_reduction_messages.cpp
>
>   Added “move assignment operator” message
>
>
>
> OpenMP/parallel_for_simd_reduction_messages.cpp
>
>   Added “move assignment operator” message
>
>
>
> OpenMP/parallel_reduction_messages.cpp
>
>   Added “move assignment operator” message
>
>
>
> OpenMP/parallel_sections_reduction_messages.cpp
>
>   Added “move assignment operator” message
>
>
>
> OpenMP/sections_reduction_messages.cpp
>
>   Added “move assignment operator” message
>
>
>
> OpenMP/simd_reduction_messages.cpp
>
>   Added “move assignment operator” message
>
>
>
> OpenMP/teams_reduction_messages.cpp
>
>   Added “move assignment operator” message
>
>
>
> SemaCXX/constructor-initializer.cpp
>
>   Added “move constructor” message
>
>
>
> SemaCXX/converting-constructor.cpp
>
>   Added “move constructor” message
>
>
>
> SemaCXX/crashes.cpp
>
>   Added “move constructor” message
>
>
>
> SemaCXX/default1.cpp
>
>   Added “move constructor” message
>
>
>
> SemaCXX/direct-initializer.cpp
>
>   Added “move constructor” message
>
>
>
> SemaCXX/expressions.cpp
>
>  Added “'register' storage class specifier is deprecated” message
>
>
>
> SemaCXX/namespace.cpp
>
>   Added “move assignment operator” message
>
>
>
> SemaCXX/overload-call-copycon.cpp
>
>   Added “move constructor” message
>
>
>
> SemaCXX/overloaded-builtin-operators.cpp
>
>   Added “move assignment operator” message
>
>
>
> SemaCXX/vector.cpp
>
>   Added “move assignment operator” message
>
>
>
> SemaTemplate/class-template-ctor-initializer.cpp
>
>   Added “move assignment operator” message
>
>
>
> SemaTemplate/constructor-template.cpp
>
>   Added “move constructor” message
>
>
>
> SemaTemplate/default-expr-arguments.cpp
>
>   Added “move constructor” message
>
>
>
> SemaTemplate/fun-template-def.cpp
>
>   Added “move constructor” message
>
>
>
> SemaTemplate/qualified-names-diag.cpp
>
>   Added “move assignment operator” message
>
>
>
>
>
> All feed backs are welcome.
>
>
>
> Thank you.
>
> Charles Li
>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r253283 - [modules] Fix some more cases where we used to reject a conflict between two

2015-11-16 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Mon Nov 16 21:02:41 2015
New Revision: 253283

URL: http://llvm.org/viewvc/llvm-project?rev=253283&view=rev
Log:
[modules] Fix some more cases where we used to reject a conflict between two
declarations that are not simultaneously visible, and where at least one of
them has internal/no linkage.

Modified:
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/lib/Sema/SemaLookup.cpp
cfe/trunk/test/Modules/Inputs/no-linkage/decls.h
cfe/trunk/test/Modules/no-linkage.cpp

Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=253283&r1=253282&r2=253283&view=diff
==
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Mon Nov 16 21:02:41 2015
@@ -279,6 +279,7 @@ class Sema {
 // with internal linkage.
 return isVisible(Old) || New->isExternallyVisible();
   }
+  bool shouldLinkPossiblyHiddenDecl(LookupResult &Old, const NamedDecl *New);
 
 public:
   typedef OpaquePtr DeclGroupPtrTy;

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=253283&r1=253282&r2=253283&view=diff
==
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Mon Nov 16 21:02:41 2015
@@ -1834,8 +1834,7 @@ static void filterNonConflictingPrevious
 continue;
 }
 
-if (!Old->isExternallyVisible())
-  Filter.erase();
+Filter.erase();
   }
 
   Filter.done();
@@ -3344,6 +3343,9 @@ void Sema::MergeVarDecl(VarDecl *New, Lo
   if (New->isInvalidDecl())
 return;
 
+  if (!shouldLinkPossiblyHiddenDecl(Previous, New))
+return;
+
   VarTemplateDecl *NewTemplate = New->getDescribedVarTemplate();
 
   // Verify the old decl was also a variable or variable template.
@@ -3375,9 +3377,6 @@ void Sema::MergeVarDecl(VarDecl *New, Lo
 return New->setInvalidDecl();
   }
 
-  if (!shouldLinkPossiblyHiddenDecl(Old, New))
-return;
-
   // Ensure the template parameters are compatible.
   if (NewTemplate &&
   !TemplateParameterListsAreEqual(NewTemplate->getTemplateParameters(),

Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=253283&r1=253282&r2=253283&view=diff
==
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Mon Nov 16 21:02:41 2015
@@ -8684,9 +8684,11 @@ Decl *Sema::ActOnNamespaceAliasDef(Scope
   assert(!R.isAmbiguous() && !R.empty());
 
   // Check if we have a previous declaration with the same name.
-  NamedDecl *PrevDecl = LookupSingleName(S, Alias, AliasLoc, 
LookupOrdinaryName,
- ForRedeclaration);
-  if (PrevDecl && !isDeclInScope(PrevDecl, CurContext, S))
+  LookupResult PrevR(*this, Alias, AliasLoc, LookupOrdinaryName,
+ ForRedeclaration);
+  LookupQualifiedName(PrevR, CurContext->getRedeclContext());
+  NamedDecl *PrevDecl = PrevR.getAsSingle();
+  if (PrevDecl && !isVisible(PrevDecl))
 PrevDecl = nullptr;
 
   NamedDecl *ND = R.getFoundDecl();

Modified: cfe/trunk/lib/Sema/SemaLookup.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=253283&r1=253282&r2=253283&view=diff
==
--- cfe/trunk/lib/Sema/SemaLookup.cpp (original)
+++ cfe/trunk/lib/Sema/SemaLookup.cpp Mon Nov 16 21:02:41 2015
@@ -1547,6 +1547,14 @@ bool Sema::isVisibleSlow(const NamedDecl
   return LookupResult::isVisible(*this, const_cast(D));
 }
 
+bool Sema::shouldLinkPossiblyHiddenDecl(LookupResult &R, const NamedDecl *New) 
{
+  for (auto *D : R) {
+if (isVisible(D))
+  return true;
+  }
+  return New->isExternallyVisible();
+}
+
 /// \brief Retrieve the visible declaration corresponding to D, if any.
 ///
 /// This routine determines whether the declaration D is visible in the current

Modified: cfe/trunk/test/Modules/Inputs/no-linkage/decls.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/no-linkage/decls.h?rev=253283&r1=253282&r2=253283&view=diff
==
--- cfe/trunk/test/Modules/Inputs/no-linkage/decls.h (original)
+++ cfe/trunk/test/Modules/Inputs/no-linkage/decls.h Mon Nov 16 21:02:41 2015
@@ -3,3 +3,9 @@ namespace NS = RealNS;
 typedef int Typedef;
 using AliasDecl = int;
 using RealNS::UsingDecl;
+struct Struct {};
+extern int Variable;
+namespace AnotherNS {}
+enum X { Enumerator };
+void Overloads();
+void Overloads(int);

Modified: cfe/trunk/test/Modules/no-linkage.cpp
URL: 
http://llvm.org/viewvc/llvm-proje

Re: r253012 - [modules] When a declaration has non-trivial visibility, check whether it's

2015-11-16 Thread Richard Smith via cfe-commits
On Mon, Nov 16, 2015 at 7:00 PM, Sean Silva  wrote:

> On Sat, Nov 14, 2015 at 2:30 PM, Richard Smith 
> wrote:
>
>> On Nov 13, 2015 7:23 PM, "Sean Silva"  wrote:
>> >
>> >
>> >
>> > On Thu, Nov 12, 2015 at 9:14 PM, Richard Smith via cfe-commits <
>> cfe-commits@lists.llvm.org> wrote:
>> >>
>> >> Author: rsmith
>> >> Date: Thu Nov 12 23:14:45 2015
>> >> New Revision: 253012
>> >>
>> >> URL: http://llvm.org/viewvc/llvm-project?rev=253012&view=rev
>> >> Log:
>> >> [modules] When a declaration has non-trivial visibility, check whether
>> it's
>> >
>> >
>> > What is "non-trivial visibility"? Is this "visibility" something that
>> exists in the present C++ language? (e.g. `using namespace std` etc.) or is
>> this a different notion?
>>
>> This is the modules notion of visibility (whether the declaration has
>> been imported or not). Here, non-trivial visibility means "not known to be
>> unconditionally visible", and corresponds to the Hidden flag on the Decl
>> being true.
>>
>
> I just looked at the comment on the `Hidden` flag and it doesn't seem to
> mention anything about being "trivial" or "non-trivial". Why say
> "declaration has non-trivial visibility" instead of just "declaration is
> hidden"? Do they mean different things?
>

Yes; the comment on that flag is out of date. Whether a declaration is
visible is a function of several factors and isn't as simple as checking
that flag. When performing template instantiation, names from unimported
modules (and module-private names from imported modules) can be made
visible if they were visible when the template was defined. When local
submodule visibility is enabled, the visibility of a declaration is
computed each time we reference it, because module visibility is not
monotonically increasing.

If the Hidden flag is false, the declararation is unconditionally visible.
If the Hidden flag is true, the declaration might still be visible,
depending on who's asking and from where.


> -- Sean Silva
>
>
>> > -- Sean Silva
>> >
>> >>
>> >> actually hidden before we check its linkage. This avoids computing the
>> linkage
>> >> "too early" for an anonymous struct with a typedef name for linkage.
>> >>
>> >> Modified:
>> >> cfe/trunk/include/clang/Sema/Lookup.h
>> >> cfe/trunk/test/Modules/submodule-visibility.cpp
>> >>
>> >> Modified: cfe/trunk/include/clang/Sema/Lookup.h
>> >> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Lookup.h?rev=253012&r1=253011&r2=253012&view=diff
>> >>
>> ==
>> >> --- cfe/trunk/include/clang/Sema/Lookup.h (original)
>> >> +++ cfe/trunk/include/clang/Sema/Lookup.h Thu Nov 12 23:14:45 2015
>> >> @@ -303,8 +303,7 @@ public:
>> >>  if (!D->isInIdentifierNamespace(IDNS))
>> >>return nullptr;
>> >>
>> >> -if (!D->isHidden() || isHiddenDeclarationVisible(D) ||
>> >> -isVisibleSlow(getSema(), D))
>> >> +if (isVisible(getSema(), D) || isHiddenDeclarationVisible(D))
>> >>return D;
>> >>
>> >>  return getAcceptableDeclSlow(D);
>> >>
>> >> Modified: cfe/trunk/test/Modules/submodule-visibility.cpp
>> >> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/submodule-visibility.cpp?rev=253012&r1=253011&r2=253012&view=diff
>> >>
>> ==
>> >> --- cfe/trunk/test/Modules/submodule-visibility.cpp (original)
>> >> +++ cfe/trunk/test/Modules/submodule-visibility.cpp Thu Nov 12
>> 23:14:45 2015
>> >> @@ -28,3 +28,10 @@ int k = n + m; // OK, a and b are visibl
>> >>  #ifndef B
>> >>  #error B is not defined
>> >>  #endif
>> >> +
>> >> +// Ensure we don't compute the linkage of this struct before we find
>> it has a
>> >> +// typedef name for linkage purposes.
>> >> +typedef struct {
>> >> +  int p;
>> >> +  void (*f)(int p);
>> >> +} name_for_linkage;
>> >>
>> >>
>> >> ___
>> >> cfe-commits mailing list
>> >> cfe-commits@lists.llvm.org
>> >> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>> >
>> >
>>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r253292 - Creating release directory for release_371.

2015-11-16 Thread Tom Stellard via cfe-commits
Author: tstellar
Date: Mon Nov 16 21:25:24 2015
New Revision: 253292

URL: http://llvm.org/viewvc/llvm-project?rev=253292&view=rev
Log:
Creating release directory for release_371.

Added:
libcxx/tags/RELEASE_371/

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


[libcxxabi] r253295 - Creating release candidate rc1 from release_371 branch

2015-11-16 Thread Tom Stellard via cfe-commits
Author: tstellar
Date: Mon Nov 16 21:25:31 2015
New Revision: 253295

URL: http://llvm.org/viewvc/llvm-project?rev=253295&view=rev
Log:
Creating release candidate rc1 from release_371 branch

Added:
libcxxabi/tags/RELEASE_371/rc1/   (props changed)
  - copied from r253294, libcxxabi/branches/release_37/

Propchange: libcxxabi/tags/RELEASE_371/rc1/
--
svn:mergeinfo = /libcxxabi/trunk:244004


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


[libcxxabi] r253294 - Creating release directory for release_371.

2015-11-16 Thread Tom Stellard via cfe-commits
Author: tstellar
Date: Mon Nov 16 21:25:28 2015
New Revision: 253294

URL: http://llvm.org/viewvc/llvm-project?rev=253294&view=rev
Log:
Creating release directory for release_371.

Added:
libcxxabi/tags/RELEASE_371/

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


[libcxx] r253293 - Creating release candidate rc1 from release_371 branch

2015-11-16 Thread Tom Stellard via cfe-commits
Author: tstellar
Date: Mon Nov 16 21:25:27 2015
New Revision: 253293

URL: http://llvm.org/viewvc/llvm-project?rev=253293&view=rev
Log:
Creating release candidate rc1 from release_371 branch

Added:
libcxx/tags/RELEASE_371/rc1/   (props changed)
  - copied from r253292, libcxx/branches/release_37/

Propchange: libcxx/tags/RELEASE_371/rc1/
--
--- svn:mergeinfo (added)
+++ svn:mergeinfo Mon Nov 16 21:25:27 2015
@@ -0,0 +1,2 @@
+/libcxx/branches/apple:136569-137939
+/libcxx/trunk:242377,242421,243530,243641,244003,244462


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


[libunwind] r253306 - Creating release directory for release_371.

2015-11-16 Thread Tom Stellard via cfe-commits
Author: tstellar
Date: Mon Nov 16 21:25:54 2015
New Revision: 253306

URL: http://llvm.org/viewvc/llvm-project?rev=253306&view=rev
Log:
Creating release directory for release_371.

Added:
libunwind/tags/RELEASE_371/

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


[libunwind] r253307 - Creating release candidate rc1 from release_371 branch

2015-11-16 Thread Tom Stellard via cfe-commits
Author: tstellar
Date: Mon Nov 16 21:25:56 2015
New Revision: 253307

URL: http://llvm.org/viewvc/llvm-project?rev=253307&view=rev
Log:
Creating release candidate rc1 from release_371 branch

Added:
libunwind/tags/RELEASE_371/rc1/   (props changed)
  - copied from r253306, libunwind/branches/release_37/

Propchange: libunwind/tags/RELEASE_371/rc1/
--
svn:mergeinfo = /libunwind/trunk:242642,243073,244005,244237


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


Re: r253012 - [modules] When a declaration has non-trivial visibility, check whether it's

2015-11-16 Thread Sean Silva via cfe-commits
On Mon, Nov 16, 2015 at 7:09 PM, Richard Smith 
wrote:

> On Mon, Nov 16, 2015 at 7:00 PM, Sean Silva  wrote:
>
>> On Sat, Nov 14, 2015 at 2:30 PM, Richard Smith 
>> wrote:
>>
>>> On Nov 13, 2015 7:23 PM, "Sean Silva"  wrote:
>>> >
>>> >
>>> >
>>> > On Thu, Nov 12, 2015 at 9:14 PM, Richard Smith via cfe-commits <
>>> cfe-commits@lists.llvm.org> wrote:
>>> >>
>>> >> Author: rsmith
>>> >> Date: Thu Nov 12 23:14:45 2015
>>> >> New Revision: 253012
>>> >>
>>> >> URL: http://llvm.org/viewvc/llvm-project?rev=253012&view=rev
>>> >> Log:
>>> >> [modules] When a declaration has non-trivial visibility, check
>>> whether it's
>>> >
>>> >
>>> > What is "non-trivial visibility"? Is this "visibility" something that
>>> exists in the present C++ language? (e.g. `using namespace std` etc.) or is
>>> this a different notion?
>>>
>>> This is the modules notion of visibility (whether the declaration has
>>> been imported or not). Here, non-trivial visibility means "not known to be
>>> unconditionally visible", and corresponds to the Hidden flag on the Decl
>>> being true.
>>>
>>
>> I just looked at the comment on the `Hidden` flag and it doesn't seem to
>> mention anything about being "trivial" or "non-trivial". Why say
>> "declaration has non-trivial visibility" instead of just "declaration is
>> hidden"? Do they mean different things?
>>
>
> Yes; the comment on that flag is out of date. Whether a declaration is
> visible is a function of several factors and isn't as simple as checking
> that flag. When performing template instantiation, names from unimported
> modules (and module-private names from imported modules) can be made
> visible if they were visible when the template was defined. When local
> submodule visibility is enabled, the visibility of a declaration is
> computed each time we reference it, because module visibility is not
> monotonically increasing.
>

Ah, that makes sense. Also that sounds scary complicated.

-- Sean Silva


>
> If the Hidden flag is false, the declararation is unconditionally visible.
> If the Hidden flag is true, the declaration might still be visible,
> depending on who's asking and from where.
>
>
>> -- Sean Silva
>>
>>
>>> > -- Sean Silva
>>> >
>>> >>
>>> >> actually hidden before we check its linkage. This avoids computing
>>> the linkage
>>> >> "too early" for an anonymous struct with a typedef name for linkage.
>>> >>
>>> >> Modified:
>>> >> cfe/trunk/include/clang/Sema/Lookup.h
>>> >> cfe/trunk/test/Modules/submodule-visibility.cpp
>>> >>
>>> >> Modified: cfe/trunk/include/clang/Sema/Lookup.h
>>> >> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Lookup.h?rev=253012&r1=253011&r2=253012&view=diff
>>> >>
>>> ==
>>> >> --- cfe/trunk/include/clang/Sema/Lookup.h (original)
>>> >> +++ cfe/trunk/include/clang/Sema/Lookup.h Thu Nov 12 23:14:45 2015
>>> >> @@ -303,8 +303,7 @@ public:
>>> >>  if (!D->isInIdentifierNamespace(IDNS))
>>> >>return nullptr;
>>> >>
>>> >> -if (!D->isHidden() || isHiddenDeclarationVisible(D) ||
>>> >> -isVisibleSlow(getSema(), D))
>>> >> +if (isVisible(getSema(), D) || isHiddenDeclarationVisible(D))
>>> >>return D;
>>> >>
>>> >>  return getAcceptableDeclSlow(D);
>>> >>
>>> >> Modified: cfe/trunk/test/Modules/submodule-visibility.cpp
>>> >> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/submodule-visibility.cpp?rev=253012&r1=253011&r2=253012&view=diff
>>> >>
>>> ==
>>> >> --- cfe/trunk/test/Modules/submodule-visibility.cpp (original)
>>> >> +++ cfe/trunk/test/Modules/submodule-visibility.cpp Thu Nov 12
>>> 23:14:45 2015
>>> >> @@ -28,3 +28,10 @@ int k = n + m; // OK, a and b are visibl
>>> >>  #ifndef B
>>> >>  #error B is not defined
>>> >>  #endif
>>> >> +
>>> >> +// Ensure we don't compute the linkage of this struct before we find
>>> it has a
>>> >> +// typedef name for linkage purposes.
>>> >> +typedef struct {
>>> >> +  int p;
>>> >> +  void (*f)(int p);
>>> >> +} name_for_linkage;
>>> >>
>>> >>
>>> >> ___
>>> >> 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


[clang-tools-extra] r253310 - modularize: add install rule

2015-11-16 Thread Saleem Abdulrasool via cfe-commits
Author: compnerd
Date: Mon Nov 16 23:09:18 2015
New Revision: 253310

URL: http://llvm.org/viewvc/llvm-project?rev=253310&view=rev
Log:
modularize: add install rule

This allows modularize to be installed.  Previously, no install rule would be
created for it.

Modified:
clang-tools-extra/trunk/modularize/CMakeLists.txt

Modified: clang-tools-extra/trunk/modularize/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/modularize/CMakeLists.txt?rev=253310&r1=253309&r2=253310&view=diff
==
--- clang-tools-extra/trunk/modularize/CMakeLists.txt (original)
+++ clang-tools-extra/trunk/modularize/CMakeLists.txt Mon Nov 16 23:09:18 2015
@@ -19,3 +19,7 @@ target_link_libraries(modularize
   clangLex
   clangTooling
   )
+
+install(TARGETS modularize
+RUNTIME DESTINATION bin
+COMPONENT clang-extras)


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


r253315 - [Sema] Combine similar diagnostics using %select. NFC

2015-11-16 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Mon Nov 16 23:40:09 2015
New Revision: 253315

URL: http://llvm.org/viewvc/llvm-project?rev=253315&view=rev
Log:
[Sema] Combine similar diagnostics using %select. NFC

Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/SemaChecking.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaExpr.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=253315&r1=253314&r2=253315&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Mon Nov 16 23:40:09 
2015
@@ -4909,9 +4909,8 @@ def warn_floatingpoint_eq : Warning<
   "comparing floating point with == or != is unsafe">,
   InGroup>, DefaultIgnore;
 
-def warn_division_by_zero : Warning<"division by zero is undefined">,
-  InGroup;
-def warn_remainder_by_zero : Warning<"remainder by zero is undefined">,
+def warn_remainder_division_by_zero : Warning<
+  "%select{remainder|division}0 by zero is undefined">,
   InGroup;
 def warn_shift_lhs_negative : Warning<"shifting a negative signed value is 
undefined">,
   InGroup>;
@@ -6677,10 +6676,8 @@ def err_anonymous_union_with_storage_spe
 def err_anonymous_struct_not_member : Error<
   "anonymous %select{structs|structs and classes}0 must be "
   "%select{struct or union|class}0 members">;
-def err_anonymous_union_member_redecl : Error<
-  "member of anonymous union redeclares %0">;
-def err_anonymous_struct_member_redecl : Error<
-  "member of anonymous struct redeclares %0">;
+def err_anonymous_record_member_redecl : Error<
+  "member of anonymous %select{struct|union}0 redeclares %1">;
 def err_anonymous_record_with_type : Error<
   "types cannot be declared in an anonymous %select{struct|union}0">;
 def ext_anonymous_record_with_type : Extension<
@@ -7033,17 +7030,12 @@ def warn_null_ret : Warning<
   InGroup;
 
 // CHECK: returning address/reference of stack memory
-def warn_ret_stack_addr : Warning<
-  "address of stack memory associated with local variable %0 returned">,
-  InGroup;
-def warn_ret_stack_ref : Warning<
-  "reference to stack memory associated with local variable %0 returned">,
-  InGroup;
-def warn_ret_local_temp_addr : Warning<
-  "returning address of local temporary object">,
+def warn_ret_stack_addr_ref : Warning<
+  "%select{address of|reference to}0 stack memory associated with local "
+  "variable %1 returned">,
   InGroup;
-def warn_ret_local_temp_ref : Warning<
-  "returning reference to local temporary object">,
+def warn_ret_local_temp_addr_ref : Warning<
+  "returning %select{address of|reference to}0 local temporary object">,
   InGroup;
 def warn_ret_addr_label : Warning<
   "returning address of label, which is local">,

Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=253315&r1=253314&r2=253315&view=diff
==
--- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
+++ cfe/trunk/lib/Sema/SemaChecking.cpp Mon Nov 16 23:40:09 2015
@@ -5646,17 +5646,15 @@ CheckReturnStackAddr(Sema &S, Expr *RetV
   }
 
   if (DeclRefExpr *DR = dyn_cast(stackE)) { //address of local 
var.
-S.Diag(diagLoc, lhsType->isReferenceType() ? diag::warn_ret_stack_ref
- : diag::warn_ret_stack_addr)
+S.Diag(diagLoc, diag::warn_ret_stack_addr_ref) << 
lhsType->isReferenceType()
  << DR->getDecl()->getDeclName() << diagRange;
   } else if (isa(stackE)) { // local block.
 S.Diag(diagLoc, diag::err_ret_local_block) << diagRange;
   } else if (isa(stackE)) { // address of label.
 S.Diag(diagLoc, diag::warn_ret_addr_label) << diagRange;
   } else { // local temporary.
-S.Diag(diagLoc, lhsType->isReferenceType() ? diag::warn_ret_local_temp_ref
-   : 
diag::warn_ret_local_temp_addr)
- << diagRange;
+S.Diag(diagLoc, diag::warn_ret_local_temp_addr_ref)
+ << lhsType->isReferenceType() << diagRange;
   }
 
   // Display the "trail" of reference variables that we followed until we

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=253315&r1=253314&r2=253315&view=diff
==
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Mon Nov 16 23:40:09 2015
@@ -3913,7 +3913,7 @@ static bool CheckAnonMemberRedeclaration
  DeclContext *Owner,
  DeclarationName Name,
  SourceLocation NameLoc,
- unsigned diag

r253314 - [Sema] Minor formatting fixes. NFC

2015-11-16 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Mon Nov 16 23:40:05 2015
New Revision: 253314

URL: http://llvm.org/viewvc/llvm-project?rev=253314&view=rev
Log:
[Sema] Minor formatting fixes. NFC

Modified:
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
cfe/trunk/lib/Sema/SemaDeclObjC.cpp
cfe/trunk/lib/Sema/SemaStmt.cpp
cfe/trunk/lib/Sema/SemaType.cpp

Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=253314&r1=253313&r2=253314&view=diff
==
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Mon Nov 16 23:40:05 2015
@@ -1628,7 +1628,7 @@ static void handleAnalyzerNoReturnAttr(S
 !VD->getType()->isFunctionPointerType())) {
   S.Diag(Attr.getLoc(),
  Attr.isCXX11Attribute() ? diag::err_attribute_wrong_decl_type
- : diag::warn_attribute_wrong_decl_type)
+ : diag::warn_attribute_wrong_decl_type)
 << Attr.getName() << ExpectedFunctionMethodOrBlock;
   return;
 }

Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=253314&r1=253313&r2=253314&view=diff
==
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Mon Nov 16 23:40:05 2015
@@ -2264,7 +2264,7 @@ static bool CheckMethodOverrideReturn(Se
 
   DiagID = 
 IsOverridingMode ? diag::warn_non_covariant_overriding_ret_types 
-  : diag::warn_non_covariant_ret_types;
+ : diag::warn_non_covariant_ret_types;
 }
   }
 
@@ -2348,7 +2348,7 @@ static bool CheckMethodOverrideParam(Sem
 
   DiagID = 
   IsOverridingMode ? diag::warn_non_contravariant_overriding_param_types 
-   :  diag::warn_non_contravariant_param_types;
+   : diag::warn_non_contravariant_param_types;
 }
   }
 
@@ -2357,7 +2357,7 @@ static bool CheckMethodOverrideParam(Sem
 << MethodImpl->getDeclName() << IfaceTy << ImplTy;
   S.Diag(IfaceVar->getLocation(), 
  (IsOverridingMode ? diag::note_previous_declaration 
-: diag::note_previous_definition))
+   : diag::note_previous_definition))
 << getTypeRange(IfaceVar->getTypeSourceInfo());
   return false;
 }

Modified: cfe/trunk/lib/Sema/SemaStmt.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaStmt.cpp?rev=253314&r1=253313&r2=253314&view=diff
==
--- cfe/trunk/lib/Sema/SemaStmt.cpp (original)
+++ cfe/trunk/lib/Sema/SemaStmt.cpp Mon Nov 16 23:40:05 2015
@@ -3216,7 +3216,7 @@ StmtResult Sema::BuildReturnStmt(SourceL
 }
 // return (some void expression); is legal in C++.
 else if (D != diag::ext_return_has_void_expr ||
-!getLangOpts().CPlusPlus) {
+ !getLangOpts().CPlusPlus) {
   NamedDecl *CurDecl = getCurFunctionOrMethodDecl();
 
   int FunctionKind = 0;

Modified: cfe/trunk/lib/Sema/SemaType.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=253314&r1=253313&r2=253314&view=diff
==
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Mon Nov 16 23:40:05 2015
@@ -2146,7 +2146,7 @@ QualType Sema::BuildArrayType(QualType T
 } else if (ASM != ArrayType::Normal || Quals != 0)
   Diag(Loc,
getLangOpts().CPlusPlus? diag::err_c99_array_usage_cxx
- : diag::ext_c99_array_usage) << ASM;
+  : diag::ext_c99_array_usage) << ASM;
   }
 
   if (T->isVariableArrayType()) {


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


r253316 - [Sema] Remove unnecessary typecast of bool to int when passing arguments to diagnostics. NFC

2015-11-16 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Mon Nov 16 23:40:12 2015
New Revision: 253316

URL: http://llvm.org/viewvc/llvm-project?rev=253316&view=rev
Log:
[Sema] Remove unnecessary typecast of bool to int when passing arguments to 
diagnostics. NFC

Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=253316&r1=253315&r2=253316&view=diff
==
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Mon Nov 16 23:40:12 2015
@@ -4160,7 +4160,7 @@ Decl *Sema::BuildAnonymousStructOrUnion(
 assert(FD->getAccess() != AS_none);
 if (FD->getAccess() != AS_public) {
   Diag(FD->getLocation(), diag::err_anonymous_record_nonpublic_member)
-<< (int)Record->isUnion() << (int)(FD->getAccess() == 
AS_protected);
+<< Record->isUnion() << (FD->getAccess() == AS_protected);
   Invalid = true;
 }
 
@@ -4184,11 +4184,11 @@ Decl *Sema::BuildAnonymousStructOrUnion(
   // Visual C++ allows type definition in anonymous struct or union.
   if (getLangOpts().MicrosoftExt)
 Diag(MemRecord->getLocation(), 
diag::ext_anonymous_record_with_type)
-  << (int)Record->isUnion();
+  << Record->isUnion();
   else {
 // This is a nested type declaration.
 Diag(MemRecord->getLocation(), 
diag::err_anonymous_record_with_type)
-  << (int)Record->isUnion();
+  << Record->isUnion();
 Invalid = true;
   }
 } else {
@@ -4197,7 +4197,7 @@ Decl *Sema::BuildAnonymousStructOrUnion(
   // not part of standard C++.
   Diag(MemRecord->getLocation(),
diag::ext_anonymous_record_with_anonymous_type)
-<< (int)Record->isUnion();
+<< Record->isUnion();
 }
   } else if (isa(Mem)) {
 // Any access specifier is fine.
@@ -4218,10 +4218,9 @@ Decl *Sema::BuildAnonymousStructOrUnion(
 if (getLangOpts().MicrosoftExt &&
 DK == diag::err_anonymous_record_with_type)
   Diag(Mem->getLocation(), diag::ext_anonymous_record_with_type)
-<< (int)Record->isUnion();
+<< Record->isUnion();
 else {
-  Diag(Mem->getLocation(), DK)
-  << (int)Record->isUnion();
+  Diag(Mem->getLocation(), DK) << Record->isUnion();
   Invalid = true;
 }
   }
@@ -4238,7 +4237,7 @@ Decl *Sema::BuildAnonymousStructOrUnion(
 
   if (!Record->isUnion() && !Owner->isRecord()) {
 Diag(Record->getLocation(), diag::err_anonymous_struct_not_member)
-  << (int)getLangOpts().CPlusPlus;
+  << getLangOpts().CPlusPlus;
 Invalid = true;
   }
 
@@ -13158,7 +13157,7 @@ bool Sema::CheckNontrivialField(FieldDec
 Diag(FD->getLocation(), getLangOpts().CPlusPlus11 ?
diag::warn_cxx98_compat_nontrivial_union_or_anon_struct_member :
diag::err_illegal_union_or_anon_struct_member)
-  << (int)FD->getParent()->isUnion() << FD->getDeclName() << member;
+  << FD->getParent()->isUnion() << FD->getDeclName() << member;
 DiagnoseNontrivial(RDecl, member);
 return !getLangOpts().CPlusPlus11;
   }


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