[libclc] r351636 - Update the file headers across all of the LLVM projects in the monorepo

2019-01-19 Thread Chandler Carruth via cfe-commits
Author: chandlerc
Date: Sat Jan 19 00:50:56 2019
New Revision: 351636

URL: http://llvm.org/viewvc/llvm-project?rev=351636&view=rev
Log:
Update the file headers across all of the LLVM projects in the monorepo
to reflect the new license.

We understand that people may be surprised that we're moving the header
entirely to discuss the new license. We checked this carefully with the
Foundation's lawyer and we believe this is the correct approach.

Essentially, all code in the project is now made available by the LLVM
project under our new license, so you will see that the license headers
include that license only. Some of our contributors have contributed
code under our old license, and accordingly, we have retained a copy of
our old license notice in the top-level files in each project and
repository.

Modified:
libclc/trunk/generic/include/clc/misc/shuffle.h
libclc/trunk/generic/include/clc/misc/shuffle2.h
libclc/trunk/generic/lib/misc/shuffle.cl
libclc/trunk/generic/lib/misc/shuffle2.cl

Modified: libclc/trunk/generic/include/clc/misc/shuffle.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/misc/shuffle.h?rev=351636&r1=351635&r2=351636&view=diff
==
--- libclc/trunk/generic/include/clc/misc/shuffle.h (original)
+++ libclc/trunk/generic/include/clc/misc/shuffle.h Sat Jan 19 00:50:56 2019
@@ -1,9 +1,8 @@
 //===-- generic/include/clc/misc/shuffle.h --===//
 //
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under both the University of Illinois Open Source
-// License and the MIT license. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 
//===--===//
 

Modified: libclc/trunk/generic/include/clc/misc/shuffle2.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/misc/shuffle2.h?rev=351636&r1=351635&r2=351636&view=diff
==
--- libclc/trunk/generic/include/clc/misc/shuffle2.h (original)
+++ libclc/trunk/generic/include/clc/misc/shuffle2.h Sat Jan 19 00:50:56 2019
@@ -1,9 +1,8 @@
 //===-- generic/include/clc/misc/shuffle2.h --===//
 //
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under both the University of Illinois Open Source
-// License and the MIT license. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 
//===--===//
 

Modified: libclc/trunk/generic/lib/misc/shuffle.cl
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/misc/shuffle.cl?rev=351636&r1=351635&r2=351636&view=diff
==
--- libclc/trunk/generic/lib/misc/shuffle.cl (original)
+++ libclc/trunk/generic/lib/misc/shuffle.cl Sat Jan 19 00:50:56 2019
@@ -1,9 +1,8 @@
 //===-- generic/lib/misc/shuffle.cl --===//
 //
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under both the University of Illinois Open Source
-// License and the MIT license. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 
//===--===//
 

Modified: libclc/trunk/generic/lib/misc/shuffle2.cl
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/misc/shuffle2.cl?rev=351636&r1=351635&r2=351636&view=diff
==
--- libclc/trunk/generic/lib/misc/shuffle2.cl (original)
+++ libclc/trunk/generic/lib/misc/shuffle2.cl Sat Jan 19 00:50:56 2019
@@ -1,9 +1,8 @@
 //===-- generic/lib/misc/shuffle2.cl --===//
 //
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under both the University of Illinois Open Source
-// License and the MIT license. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 
//===--===//
 



r351637 - Move decl context dumping to TextNodeDumper

2019-01-19 Thread Stephen Kelly via cfe-commits
Author: steveire
Date: Sat Jan 19 01:05:55 2019
New Revision: 351637

URL: http://llvm.org/viewvc/llvm-project?rev=351637&view=rev
Log:
Move decl context dumping to TextNodeDumper

Summary: Only an obscure case is moved.

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

Modified:
cfe/trunk/lib/AST/ASTDumper.cpp
cfe/trunk/lib/AST/TextNodeDumper.cpp
cfe/trunk/test/AST/ast-dump-undeserialized.cpp

Modified: cfe/trunk/lib/AST/ASTDumper.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTDumper.cpp?rev=351637&r1=351636&r2=351637&view=diff
==
--- cfe/trunk/lib/AST/ASTDumper.cpp (original)
+++ cfe/trunk/lib/AST/ASTDumper.cpp Sat Jan 19 01:05:55 2019
@@ -359,13 +359,6 @@ void ASTDumper::dumpDeclContext(const De
 
   for (auto *D : (Deserialize ? DC->decls() : DC->noload_decls()))
 dumpDecl(D);
-
-  if (DC->hasExternalLexicalStorage()) {
-dumpChild([=] {
-  ColorScope Color(OS, ShowColors, UndeserializedColor);
-  OS << "";
-});
-  }
 }
 
 void ASTDumper::dumpLookups(const DeclContext *DC, bool DumpDecls) {

Modified: cfe/trunk/lib/AST/TextNodeDumper.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/TextNodeDumper.cpp?rev=351637&r1=351636&r2=351637&view=diff
==
--- cfe/trunk/lib/AST/TextNodeDumper.cpp (original)
+++ cfe/trunk/lib/AST/TextNodeDumper.cpp Sat Jan 19 01:05:55 2019
@@ -255,6 +255,17 @@ void TextNodeDumper::Visit(const Decl *D
   if (const FunctionDecl *FD = dyn_cast(D))
 if (FD->isConstexpr())
   OS << " constexpr";
+
+  if (!isa(*D)) {
+const auto *MD = dyn_cast(D);
+if (!MD || !MD->isThisDeclarationADefinition()) {
+  const auto *DC = dyn_cast(D);
+  if (DC && DC->hasExternalLexicalStorage()) {
+ColorScope Color(OS, ShowColors, UndeserializedColor);
+OS << " ";
+  }
+}
+  }
 }
 
 void TextNodeDumper::Visit(const CXXCtorInitializer *Init) {

Modified: cfe/trunk/test/AST/ast-dump-undeserialized.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/AST/ast-dump-undeserialized.cpp?rev=351637&r1=351636&r2=351637&view=diff
==
--- cfe/trunk/test/AST/ast-dump-undeserialized.cpp (original)
+++ cfe/trunk/test/AST/ast-dump-undeserialized.cpp Sat Jan 19 01:05:55 2019
@@ -1,4 +1,3 @@
 // RUN: %clang_cc1 %s -chain-include %s -ast-dump | FileCheck 
-strict-whitespace %s
 
-// CHECK: TranslationUnitDecl 0x{{.+}} <> 
-// CHECK: `-
+// CHECK: TranslationUnitDecl 0x{{.+}} <>  



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


[PATCH] D56829: Move decl context dumping to TextNodeDumper

2019-01-19 Thread Stephen Kelly via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rC351637: Move decl context dumping to TextNodeDumper 
(authored by steveire, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D56829?vs=182607&id=182669#toc

Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56829/new/

https://reviews.llvm.org/D56829

Files:
  lib/AST/ASTDumper.cpp
  lib/AST/TextNodeDumper.cpp
  test/AST/ast-dump-undeserialized.cpp


Index: lib/AST/TextNodeDumper.cpp
===
--- lib/AST/TextNodeDumper.cpp
+++ lib/AST/TextNodeDumper.cpp
@@ -255,6 +255,17 @@
   if (const FunctionDecl *FD = dyn_cast(D))
 if (FD->isConstexpr())
   OS << " constexpr";
+
+  if (!isa(*D)) {
+const auto *MD = dyn_cast(D);
+if (!MD || !MD->isThisDeclarationADefinition()) {
+  const auto *DC = dyn_cast(D);
+  if (DC && DC->hasExternalLexicalStorage()) {
+ColorScope Color(OS, ShowColors, UndeserializedColor);
+OS << " ";
+  }
+}
+  }
 }
 
 void TextNodeDumper::Visit(const CXXCtorInitializer *Init) {
Index: lib/AST/ASTDumper.cpp
===
--- lib/AST/ASTDumper.cpp
+++ lib/AST/ASTDumper.cpp
@@ -359,13 +359,6 @@
 
   for (auto *D : (Deserialize ? DC->decls() : DC->noload_decls()))
 dumpDecl(D);
-
-  if (DC->hasExternalLexicalStorage()) {
-dumpChild([=] {
-  ColorScope Color(OS, ShowColors, UndeserializedColor);
-  OS << "";
-});
-  }
 }
 
 void ASTDumper::dumpLookups(const DeclContext *DC, bool DumpDecls) {
Index: test/AST/ast-dump-undeserialized.cpp
===
--- test/AST/ast-dump-undeserialized.cpp
+++ test/AST/ast-dump-undeserialized.cpp
@@ -1,4 +1,3 @@
 // RUN: %clang_cc1 %s -chain-include %s -ast-dump | FileCheck 
-strict-whitespace %s
 
-// CHECK: TranslationUnitDecl 0x{{.+}} <> 
-// CHECK: `-
+// CHECK: TranslationUnitDecl 0x{{.+}} <>  



Index: lib/AST/TextNodeDumper.cpp
===
--- lib/AST/TextNodeDumper.cpp
+++ lib/AST/TextNodeDumper.cpp
@@ -255,6 +255,17 @@
   if (const FunctionDecl *FD = dyn_cast(D))
 if (FD->isConstexpr())
   OS << " constexpr";
+
+  if (!isa(*D)) {
+const auto *MD = dyn_cast(D);
+if (!MD || !MD->isThisDeclarationADefinition()) {
+  const auto *DC = dyn_cast(D);
+  if (DC && DC->hasExternalLexicalStorage()) {
+ColorScope Color(OS, ShowColors, UndeserializedColor);
+OS << " ";
+  }
+}
+  }
 }
 
 void TextNodeDumper::Visit(const CXXCtorInitializer *Init) {
Index: lib/AST/ASTDumper.cpp
===
--- lib/AST/ASTDumper.cpp
+++ lib/AST/ASTDumper.cpp
@@ -359,13 +359,6 @@
 
   for (auto *D : (Deserialize ? DC->decls() : DC->noload_decls()))
 dumpDecl(D);
-
-  if (DC->hasExternalLexicalStorage()) {
-dumpChild([=] {
-  ColorScope Color(OS, ShowColors, UndeserializedColor);
-  OS << "";
-});
-  }
 }
 
 void ASTDumper::dumpLookups(const DeclContext *DC, bool DumpDecls) {
Index: test/AST/ast-dump-undeserialized.cpp
===
--- test/AST/ast-dump-undeserialized.cpp
+++ test/AST/ast-dump-undeserialized.cpp
@@ -1,4 +1,3 @@
 // RUN: %clang_cc1 %s -chain-include %s -ast-dump | FileCheck -strict-whitespace %s
 
-// CHECK: TranslationUnitDecl 0x{{.+}} <> 
-// CHECK: `-
+// CHECK: TranslationUnitDecl 0x{{.+}} <>  
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r351640 - Update the license header in this man-page file.

2019-01-19 Thread Chandler Carruth via cfe-commits
Author: chandlerc
Date: Sat Jan 19 01:24:38 2019
New Revision: 351640

URL: http://llvm.org/viewvc/llvm-project?rev=351640&view=rev
Log:
Update the license header in this man-page file.

It contains an `$Id$` expansion and so can only be updated from a true
Subversion client.

See the details of this update in r351636.

Modified:
cfe/trunk/tools/scan-build/man/scan-build.1

Modified: cfe/trunk/tools/scan-build/man/scan-build.1
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-build/man/scan-build.1?rev=351640&r1=351639&r2=351640&view=diff
==
--- cfe/trunk/tools/scan-build/man/scan-build.1 (original)
+++ cfe/trunk/tools/scan-build/man/scan-build.1 Sat Jan 19 01:24:38 2019
@@ -1,5 +1,6 @@
-.\" This file is distributed under the University of Illinois Open Source
-.\" License. See LICENSE.TXT for details.
+.\" Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+.\" See https://llvm.org/LICENSE.txt for license information.
+.\" SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 .\" $Id$
 .Dd May 25, 2012
 .Dt SCAN-BUILD 1


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


r351646 - [ASTDump] NFC: Use `const auto` in cxx_range_for loops

2019-01-19 Thread Stephen Kelly via cfe-commits
Author: steveire
Date: Sat Jan 19 01:57:51 2019
New Revision: 351646

URL: http://llvm.org/viewvc/llvm-project?rev=351646&view=rev
Log:
[ASTDump] NFC: Use `const auto` in cxx_range_for loops

This is coming up a lot in reviews. Better just to do them all at once.

Modified:
cfe/trunk/lib/AST/ASTDumper.cpp

Modified: cfe/trunk/lib/AST/ASTDumper.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTDumper.cpp?rev=351646&r1=351645&r2=351646&view=diff
==
--- cfe/trunk/lib/AST/ASTDumper.cpp (original)
+++ cfe/trunk/lib/AST/ASTDumper.cpp Sat Jan 19 01:57:51 2019
@@ -161,7 +161,7 @@ namespace  {
 }
 void VisitFunctionProtoType(const FunctionProtoType *T) {
   VisitFunctionType(T);
-  for (QualType PT : T->getParamTypes())
+  for (const QualType &PT : T->getParamTypes())
 dumpTypeAsChild(PT);
 }
 void VisitTypeOfExprType(const TypeOfExprType *T) {
@@ -186,7 +186,7 @@ namespace  {
   dumpTemplateArgument(T->getArgumentPack());
 }
 void VisitTemplateSpecializationType(const TemplateSpecializationType *T) {
-  for (auto &Arg : *T)
+  for (const auto &Arg : *T)
 dumpTemplateArgument(Arg);
   if (T->isTypeAlias())
 dumpTypeAsChild(T->getAliasedType());
@@ -357,7 +357,7 @@ void ASTDumper::dumpDeclContext(const De
   if (!DC)
 return;
 
-  for (auto *D : (Deserialize ? DC->decls() : DC->noload_decls()))
+  for (const auto *D : (Deserialize ? DC->decls() : DC->noload_decls()))
 dumpDecl(D);
 }
 
@@ -478,7 +478,7 @@ void ASTDumper::dumpObjCTypeParamList(co
   if (!typeParams)
 return;
 
-  for (auto typeParam : *typeParams) {
+  for (const auto &typeParam : *typeParams) {
 dumpDecl(typeParam);
   }
 }
@@ -555,7 +555,7 @@ void ASTDumper::VisitIndirectFieldDecl(c
   NodeDumper.dumpName(D);
   NodeDumper.dumpType(D->getType());
 
-  for (auto *Child : D->chain())
+  for (const auto *Child : D->chain())
 NodeDumper.dumpDeclRef(Child);
 }
 
@@ -688,14 +688,14 @@ void ASTDumper::VisitVarDecl(const VarDe
 
 void ASTDumper::VisitDecompositionDecl(const DecompositionDecl *D) {
   VisitVarDecl(D);
-  for (auto *B : D->bindings())
+  for (const auto *B : D->bindings())
 dumpDecl(B);
 }
 
 void ASTDumper::VisitBindingDecl(const BindingDecl *D) {
   NodeDumper.dumpName(D);
   NodeDumper.dumpType(D->getType());
-  if (auto *E = D->getBinding())
+  if (const auto *E = D->getBinding())
 dumpStmt(E);
 }
 
@@ -736,7 +736,7 @@ void ASTDumper::VisitCapturedDecl(const
 
//===--===//
 
 void ASTDumper::VisitOMPThreadPrivateDecl(const OMPThreadPrivateDecl *D) {
-  for (auto *E : D->varlists())
+  for (const auto *E : D->varlists())
 dumpStmt(E);
 }
 
@@ -766,7 +766,7 @@ void ASTDumper::VisitOMPDeclareReduction
 }
 
 void ASTDumper::VisitOMPRequiresDecl(const OMPRequiresDecl *D) {
-  for (auto *C : D->clauselists()) {
+  for (const auto *C : D->clauselists()) {
 dumpChild([=] {
   if (!C) {
 ColorScope Color(OS, ShowColors, NullColor);
@@ -974,7 +974,7 @@ void ASTDumper::dumpTemplateDeclSpeciali
bool DumpExplicitInst,
bool DumpRefOnly) {
   bool DumpedAny = false;
-  for (auto *RedeclWithBadType : D->redecls()) {
+  for (const auto *RedeclWithBadType : D->redecls()) {
 // FIXME: The redecls() range sometimes has elements of a less-specific
 // type. (In particular, ClassTemplateSpecializationDecl::redecls() gives
 // us TagDecls, and should give CXXRecordDecls).
@@ -1018,7 +1018,7 @@ void ASTDumper::dumpTemplateDecl(const T
 
   dumpDecl(D->getTemplatedDecl());
 
-  for (auto *Child : D->specializations())
+  for (const auto *Child : D->specializations())
 dumpTemplateDeclSpecialization(Child, DumpExplicitInst,
!D->isCanonicalDecl());
 }
@@ -1280,7 +1280,7 @@ void ASTDumper::VisitObjCCategoryImplDec
 void ASTDumper::VisitObjCProtocolDecl(const ObjCProtocolDecl *D) {
   NodeDumper.dumpName(D);
 
-  for (auto *Child : D->protocols())
+  for (const auto *Child : D->protocols())
 NodeDumper.dumpDeclRef(Child);
 }
 
@@ -1289,7 +1289,7 @@ void ASTDumper::VisitObjCInterfaceDecl(c
   NodeDumper.dumpDeclRef(D->getSuperClass(), "super");
 
   NodeDumper.dumpDeclRef(D->getImplementation());
-  for (auto *Child : D->protocols())
+  for (const auto *Child : D->protocols())
 NodeDumper.dumpDeclRef(Child);
   dumpObjCTypeParamList(D->getTypeParamListAsWritten());
 }
@@ -1374,7 +1374,7 @@ void ASTDumper::VisitBlockDecl(const Blo
   if (D->capturesCXXThis())
 OS << " captures_this";
 
-  for (auto I : D->parameters())
+  for (const auto &I : D->parameters())
 dumpDecl(I);
 
   for (const auto &I : D->captures())
@@ -1435,7 +1435,7 @@ void ASTDumper::VisitCapturedStmt(const
 void ASTDumper::Visit(const OMPClause *C) {
   du

r351647 - [ASTDump] NFC: Convert iterative loops to cxx_range_for

2019-01-19 Thread Stephen Kelly via cfe-commits
Author: steveire
Date: Sat Jan 19 01:57:59 2019
New Revision: 351647

URL: http://llvm.org/viewvc/llvm-project?rev=351647&view=rev
Log:
[ASTDump] NFC: Convert iterative loops to cxx_range_for

This is coming up a lot in reviews. Better just to change them all at
once.

Modified:
cfe/trunk/lib/AST/ASTDumper.cpp

Modified: cfe/trunk/lib/AST/ASTDumper.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTDumper.cpp?rev=351647&r1=351646&r2=351647&view=diff
==
--- cfe/trunk/lib/AST/ASTDumper.cpp (original)
+++ cfe/trunk/lib/AST/ASTDumper.cpp Sat Jan 19 01:57:59 2019
@@ -442,15 +442,14 @@ void ASTDumper::dumpTemplateParameters(c
   if (!TPL)
 return;
 
-  for (TemplateParameterList::const_iterator I = TPL->begin(), E = TPL->end();
-   I != E; ++I)
-dumpDecl(*I);
+  for (const auto &TP : *TPL)
+dumpDecl(TP);
 }
 
 void ASTDumper::dumpTemplateArgumentListInfo(
 const TemplateArgumentListInfo &TALI) {
-  for (unsigned i = 0, e = TALI.size(); i < e; ++i)
-dumpTemplateArgumentLoc(TALI[i]);
+  for (const auto &TA : TALI.arguments())
+dumpTemplateArgumentLoc(TA);
 }
 
 void ASTDumper::dumpTemplateArgumentLoc(const TemplateArgumentLoc &A,
@@ -495,9 +494,8 @@ void ASTDumper::dumpDecl(const Decl *D)
 
 ConstDeclVisitor::Visit(D);
 
-for (Decl::attr_iterator I = D->attr_begin(), E = D->attr_end(); I != E;
- ++I)
-  dumpAttr(*I);
+for (const auto &A : D->attrs())
+  dumpAttr(A);
 
 if (const FullComment *Comment =
 D->getASTContext().getLocalCommentForDeclUncached(D))
@@ -1264,10 +1262,8 @@ void ASTDumper::VisitObjCCategoryDecl(co
   NodeDumper.dumpName(D);
   NodeDumper.dumpDeclRef(D->getClassInterface());
   NodeDumper.dumpDeclRef(D->getImplementation());
-  for (ObjCCategoryDecl::protocol_iterator I = D->protocol_begin(),
-   E = D->protocol_end();
-   I != E; ++I)
-NodeDumper.dumpDeclRef(*I);
+  for (const auto *P : D->protocols())
+NodeDumper.dumpDeclRef(P);
   dumpObjCTypeParamList(D->getTypeParamList());
 }
 
@@ -1298,10 +1294,8 @@ void ASTDumper::VisitObjCImplementationD
   NodeDumper.dumpName(D);
   NodeDumper.dumpDeclRef(D->getSuperClass(), "super");
   NodeDumper.dumpDeclRef(D->getClassInterface());
-  for (ObjCImplementationDecl::init_const_iterator I = D->init_begin(),
-   E = D->init_end();
-   I != E; ++I)
-dumpCXXCtorInitializer(*I);
+  for (const auto &I : D->inits())
+dumpCXXCtorInitializer(I);
 }
 
 void ASTDumper::VisitObjCCompatibleAliasDecl(const ObjCCompatibleAliasDecl *D) 
{
@@ -1407,17 +1401,13 @@ void ASTDumper::dumpStmt(const Stmt *S,
 }
 
 void ASTDumper::VisitDeclStmt(const DeclStmt *Node) {
-  for (DeclStmt::const_decl_iterator I = Node->decl_begin(),
- E = Node->decl_end();
-   I != E; ++I)
-dumpDecl(*I);
+  for (const auto &D : Node->decls())
+dumpDecl(D);
 }
 
 void ASTDumper::VisitAttributedStmt(const AttributedStmt *Node) {
-  for (ArrayRef::iterator I = Node->getAttrs().begin(),
-E = Node->getAttrs().end();
-   I != E; ++I)
-dumpAttr(*I);
+  for (const auto *A : Node->getAttrs())
+dumpAttr(A);
 }
 
 void ASTDumper::VisitCXXCatchStmt(const CXXCatchStmt *Node) {


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


r351642 - [NFC] Generalize expected output for callback test

2019-01-19 Thread Johannes Doerfert via cfe-commits
Author: jdoerfert
Date: Sat Jan 19 01:40:08 2019
New Revision: 351642

URL: http://llvm.org/viewvc/llvm-project?rev=351642&view=rev
Log:
[NFC] Generalize expected output for callback test

Modified:
cfe/trunk/test/CodeGen/callback_pthread_create.c

Modified: cfe/trunk/test/CodeGen/callback_pthread_create.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/callback_pthread_create.c?rev=351642&r1=351641&r2=351642&view=diff
==
--- cfe/trunk/test/CodeGen/callback_pthread_create.c (original)
+++ cfe/trunk/test/CodeGen/callback_pthread_create.c Sat Jan 19 01:40:08 2019
@@ -1,7 +1,7 @@
 // RUN: %clang -O1 %s -S -c -emit-llvm -o - | FileCheck %s
 // RUN: %clang -O1 %s -S -c -emit-llvm -o - | opt -ipconstprop -S | FileCheck 
--check-prefix=IPCP %s
 
-// CHECK: declare !callback ![[cid:[0-9]+]] dso_local i32 @pthread_create
+// CHECK: declare !callback ![[cid:[0-9]+]] {{.*}}i32 @pthread_create
 // CHECK: ![[cid]] = !{![[cidb:[0-9]+]]}
 // CHECK: ![[cidb]] = !{i64 2, i64 3, i1 false}
 


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


r351643 - [FIX] Restrict callback pthreads_create test to linux only

2019-01-19 Thread Johannes Doerfert via cfe-commits
Author: jdoerfert
Date: Sat Jan 19 01:40:10 2019
New Revision: 351643

URL: http://llvm.org/viewvc/llvm-project?rev=351643&view=rev
Log:
[FIX] Restrict callback pthreads_create test to linux only

Modified:
cfe/trunk/test/CodeGen/callback_pthread_create.c

Modified: cfe/trunk/test/CodeGen/callback_pthread_create.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/callback_pthread_create.c?rev=351643&r1=351642&r2=351643&view=diff
==
--- cfe/trunk/test/CodeGen/callback_pthread_create.c (original)
+++ cfe/trunk/test/CodeGen/callback_pthread_create.c Sat Jan 19 01:40:10 2019
@@ -1,6 +1,9 @@
 // RUN: %clang -O1 %s -S -c -emit-llvm -o - | FileCheck %s
 // RUN: %clang -O1 %s -S -c -emit-llvm -o - | opt -ipconstprop -S | FileCheck 
--check-prefix=IPCP %s
 
+// This is a linux only test for now due to the include.
+// UNSUPPORTED: !linux
+
 // CHECK: declare !callback ![[cid:[0-9]+]] {{.*}}i32 @pthread_create
 // CHECK: ![[cid]] = !{![[cidb:[0-9]+]]}
 // CHECK: ![[cidb]] = !{i64 2, i64 3, i1 false}


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


r351629 - Emit !callback metadata and introduce the callback attribute

2019-01-19 Thread Johannes Doerfert via cfe-commits
Author: jdoerfert
Date: Fri Jan 18 21:36:54 2019
New Revision: 351629

URL: http://llvm.org/viewvc/llvm-project?rev=351629&view=rev
Log:
Emit !callback metadata and introduce the callback attribute

  With commit r351627, LLVM gained the ability to apply (existing) IPO
  optimizations on indirections through callbacks, or transitive calls.
  The general idea is that we use an abstraction to hide the middle man
  and represent the callback call in the context of the initial caller.
  It is described in more detail in the commit message of the LLVM patch
  r351627, the llvm::AbstractCallSite class description, and the
  language reference section on callback-metadata.

  This commit enables clang to emit !callback metadata that is
  understood by LLVM. It does so in three different cases:
1) For known broker functions declarations that are directly
   generated, e.g., __kmpc_fork_call for the OpenMP pragma parallel.
2) For known broker functions that are identified by their name and
   source location through the builtin detection, e.g.,
   pthread_create from the POSIX thread API.
3) For user annotated functions that carry the "callback(callee, ...)"
   attribute. The attribute has to include the name, or index, of
   the callback callee and how the passed arguments can be
   identified (as many as the callback callee has). See the callback
   attribute documentation for detailed information.

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

Added:
cfe/trunk/test/CodeGen/attr-callback.c
cfe/trunk/test/CodeGen/callback_annotated.c
cfe/trunk/test/CodeGen/callback_openmp.c
cfe/trunk/test/CodeGen/callback_pthread_create.c
cfe/trunk/test/CodeGenCXX/attr-callback.cpp
cfe/trunk/test/Sema/attr-callback-broken.c
cfe/trunk/test/Sema/attr-callback.c
cfe/trunk/test/SemaCXX/attr-callback-broken.cpp
cfe/trunk/test/SemaCXX/attr-callback.cpp
Modified:
cfe/trunk/include/clang/AST/ASTContext.h
cfe/trunk/include/clang/Basic/Attr.td
cfe/trunk/include/clang/Basic/AttrDocs.td
cfe/trunk/include/clang/Basic/Builtins.def
cfe/trunk/include/clang/Basic/Builtins.h
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/lib/Basic/Builtins.cpp
cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/lib/Parse/ParseDecl.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
cfe/trunk/test/Analysis/retain-release.m
cfe/trunk/test/Misc/pragma-attribute-supported-attributes-list.test
cfe/trunk/test/OpenMP/parallel_codegen.cpp
cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp

Modified: cfe/trunk/include/clang/AST/ASTContext.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=351629&r1=351628&r2=351629&view=diff
==
--- cfe/trunk/include/clang/AST/ASTContext.h (original)
+++ cfe/trunk/include/clang/AST/ASTContext.h Fri Jan 18 21:36:54 2019
@@ -2003,6 +2003,9 @@ public:
 /// No error
 GE_None,
 
+/// Missing a type
+GE_Missing_type,
+
 /// Missing a type from 
 GE_Missing_stdio,
 

Modified: cfe/trunk/include/clang/Basic/Attr.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=351629&r1=351628&r2=351629&view=diff
==
--- cfe/trunk/include/clang/Basic/Attr.td (original)
+++ cfe/trunk/include/clang/Basic/Attr.td Fri Jan 18 21:36:54 2019
@@ -190,6 +190,9 @@ class VariadicIdentifierArgument : Argument;
 
+// A list of identifiers matching parameters or ParamIdx indices.
+class VariadicParamOrParamIdxArgument : Argument;
+
 // Like VariadicParamIdxArgument but for a single function parameter index.
 class ParamIdxArgument : Argument;
 
@@ -1210,6 +1213,13 @@ def FormatArg : InheritableAttr {
   let Documentation = [Undocumented];
 }
 
+def Callback : InheritableAttr {
+  let Spellings = [Clang<"callback">];
+  let Args = [VariadicParamOrParamIdxArgument<"Encoding">];
+  let Subjects = SubjectList<[Function]>;
+  let Documentation = [CallbackDocs];
+}
+
 def GNUInline : InheritableAttr {
   let Spellings = [GCC<"gnu_inline">];
   let Subjects = SubjectList<[Function]>;

Modified: cfe/trunk/include/clang/Basic/AttrDocs.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/AttrDocs.td?rev=351629&r1=351628&r2=351629&view=diff
==
--- cfe/trunk/include/clang/Basic/AttrDocs.td (original)
+++ cfe/trunk/include/clang/Basic/AttrDocs.td Fri Jan 18 21:36:54 2019
@@ -3781,6 +3781,55 @@ it rather documents the programmer's int
   }];
 }
 
+def CallbackDocs : Documentation {
+  let Category = DocCatVariable;
+  let Content = [{
+The ``callback`` attribute specifies that the annotated functio

[PATCH] D56926: [Documentation] Use HTTPS whenever possible in clang-tools-extra

2019-01-19 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay accepted this revision.
MyDeveloperDay added a comment.

LGTM


Repository:
  rCTE Clang Tools Extra

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56926/new/

https://reviews.llvm.org/D56926



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


[libunwind] r351648 - Update more file headers across all of the LLVM projects in the monorepo

2019-01-19 Thread Chandler Carruth via cfe-commits
Author: chandlerc
Date: Sat Jan 19 02:56:40 2019
New Revision: 351648

URL: http://llvm.org/viewvc/llvm-project?rev=351648&view=rev
Log:
Update more file headers across all of the LLVM projects in the monorepo
to reflect the new license. These used slightly different spellings that
defeated my regular expressions.

We understand that people may be surprised that we're moving the header
entirely to discuss the new license. We checked this carefully with the
Foundation's lawyer and we believe this is the correct approach.

Essentially, all code in the project is now made available by the LLVM
project under our new license, so you will see that the license headers
include that license only. Some of our contributors have contributed
code under our old license, and accordingly, we have retained a copy of
our old license notice in the top-level files in each project and
repository.

Modified:
libunwind/trunk/include/__libunwind_config.h
libunwind/trunk/include/libunwind.h
libunwind/trunk/include/mach-o/compact_unwind_encoding.h
libunwind/trunk/include/unwind.h
libunwind/trunk/src/AddressSpace.hpp
libunwind/trunk/src/CompactUnwinder.hpp
libunwind/trunk/src/DwarfInstructions.hpp
libunwind/trunk/src/DwarfParser.hpp
libunwind/trunk/src/EHHeaderParser.hpp
libunwind/trunk/src/RWMutex.hpp
libunwind/trunk/src/Registers.hpp
libunwind/trunk/src/Unwind-EHABI.cpp
libunwind/trunk/src/Unwind-EHABI.h
libunwind/trunk/src/Unwind-seh.cpp
libunwind/trunk/src/Unwind-sjlj.c
libunwind/trunk/src/UnwindCursor.hpp
libunwind/trunk/src/UnwindLevel1-gcc-ext.c
libunwind/trunk/src/UnwindLevel1.c
libunwind/trunk/src/UnwindRegistersRestore.S
libunwind/trunk/src/UnwindRegistersSave.S
libunwind/trunk/src/Unwind_AppleExtras.cpp
libunwind/trunk/src/assembly.h
libunwind/trunk/src/config.h
libunwind/trunk/src/dwarf2.h
libunwind/trunk/src/libunwind.cpp
libunwind/trunk/src/libunwind_ext.h
libunwind/trunk/test/alignment.pass.cpp
libunwind/trunk/test/libunwind/test/config.py

Modified: libunwind/trunk/include/__libunwind_config.h
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/include/__libunwind_config.h?rev=351648&r1=351647&r2=351648&view=diff
==
--- libunwind/trunk/include/__libunwind_config.h (original)
+++ libunwind/trunk/include/__libunwind_config.h Sat Jan 19 02:56:40 2019
@@ -1,9 +1,8 @@
 //===- __libunwind_config.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.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 
//===--===//
 

Modified: libunwind/trunk/include/libunwind.h
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/include/libunwind.h?rev=351648&r1=351647&r2=351648&view=diff
==
--- libunwind/trunk/include/libunwind.h (original)
+++ libunwind/trunk/include/libunwind.h Sat Jan 19 02:56:40 2019
@@ -1,9 +1,8 @@
 //=== libunwind.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.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //
 // Compatible with libunwind API documented at:

Modified: libunwind/trunk/include/mach-o/compact_unwind_encoding.h
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/include/mach-o/compact_unwind_encoding.h?rev=351648&r1=351647&r2=351648&view=diff
==
--- libunwind/trunk/include/mach-o/compact_unwind_encoding.h (original)
+++ libunwind/trunk/include/mach-o/compact_unwind_encoding.h Sat Jan 19 
02:56:40 2019
@@ -1,9 +1,8 @@
 //===-- mach-o/compact_unwind_encoding.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.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //
 // Darwin's alternative to DWARF based unwind encodings.

Modified

r351651 - Update the license mentioned in this documentation.

2019-01-19 Thread Chandler Carruth via cfe-commits
Author: chandlerc
Date: Sat Jan 19 03:48:15 2019
New Revision: 351651

URL: http://llvm.org/viewvc/llvm-project?rev=351651&view=rev
Log:
Update the license mentioned in this documentation.

Modified:
cfe/trunk/tools/scan-build-py/README.md

Modified: cfe/trunk/tools/scan-build-py/README.md
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-build-py/README.md?rev=351651&r1=351650&r2=351651&view=diff
==
--- cfe/trunk/tools/scan-build-py/README.md (original)
+++ cfe/trunk/tools/scan-build-py/README.md Sat Jan 19 03:48:15 2019
@@ -138,7 +138,7 @@ how to fix it, include that as well. Pat
 License
 ---
 
-The project is licensed under University of Illinois/NCSA Open Source License.
+The project is licensed under Apache-2.0 with LLVM exceptions.
 See LICENSE.TXT for details.
 
   [1]: http://clang.llvm.org/docs/JSONCompilationDatabase.html


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


[PATCH] D56959: [AST] NFC: Introduce new class GenericSelectionExpr::Association

2019-01-19 Thread Stephen Kelly via Phabricator via cfe-commits
steveire created this revision.
steveire added a reviewer: aaron.ballman.
Herald added a subscriber: cfe-commits.

As a type, this can be visited upon.  This is similar in spirit to the
BlockDecl::Capture type.


Repository:
  rC Clang

https://reviews.llvm.org/D56959

Files:
  include/clang/AST/Expr.h
  include/clang/AST/RecursiveASTVisitor.h
  include/clang/AST/StmtDataCollectors.td
  lib/AST/ASTDumper.cpp
  lib/AST/StmtPrinter.cpp
  lib/AST/StmtProfile.cpp
  lib/Sema/SemaExprObjC.cpp
  lib/Sema/SemaPseudoObject.cpp
  lib/Sema/TreeTransform.h
  lib/Serialization/ASTWriterStmt.cpp

Index: lib/Serialization/ASTWriterStmt.cpp
===
--- lib/Serialization/ASTWriterStmt.cpp
+++ lib/Serialization/ASTWriterStmt.cpp
@@ -972,8 +972,9 @@
 
   Record.AddStmt(E->getControllingExpr());
   for (unsigned I = 0, N = E->getNumAssocs(); I != N; ++I) {
-Record.AddTypeSourceInfo(E->getAssocTypeSourceInfo(I));
-Record.AddStmt(E->getAssocExpr(I));
+auto Assoc = E->getAssociation(I);
+Record.AddTypeSourceInfo(Assoc.getTypeSourceInfo());
+Record.AddStmt(Assoc.getExpr());
   }
   Record.push_back(E->isResultDependent() ? -1U : E->getResultIndex());
 
Index: lib/Sema/TreeTransform.h
===
--- lib/Sema/TreeTransform.h
+++ lib/Sema/TreeTransform.h
@@ -9072,7 +9072,8 @@
   SmallVector AssocExprs;
   SmallVector AssocTypes;
   for (unsigned i = 0; i != E->getNumAssocs(); ++i) {
-TypeSourceInfo *TS = E->getAssocTypeSourceInfo(i);
+auto Assoc = E->getAssociation(i);
+TypeSourceInfo *TS = Assoc.getTypeSourceInfo();
 if (TS) {
   TypeSourceInfo *AssocType = getDerived().TransformType(TS);
   if (!AssocType)
@@ -9082,7 +9083,7 @@
   AssocTypes.push_back(nullptr);
 }
 
-ExprResult AssocExpr = getDerived().TransformExpr(E->getAssocExpr(i));
+ExprResult AssocExpr = getDerived().TransformExpr(Assoc.getExpr());
 if (AssocExpr.isInvalid())
   return ExprError();
 AssocExprs.push_back(AssocExpr.get());
Index: lib/Sema/SemaPseudoObject.cpp
===
--- lib/Sema/SemaPseudoObject.cpp
+++ lib/Sema/SemaPseudoObject.cpp
@@ -144,10 +144,11 @@
 SmallVector assocTypes(numAssocs);
 
 for (unsigned i = 0; i != numAssocs; ++i) {
-  Expr *assoc = gse->getAssocExpr(i);
+  auto A = gse->getAssociation(i);
+  Expr *assoc = A.getExpr();
   if (i == resultIndex) assoc = rebuild(assoc);
   assocs[i] = assoc;
-  assocTypes[i] = gse->getAssocTypeSourceInfo(i);
+  assocTypes[i] = A.getTypeSourceInfo();
 }
 
 return new (S.Context) GenericSelectionExpr(S.Context,
Index: lib/Sema/SemaExprObjC.cpp
===
--- lib/Sema/SemaExprObjC.cpp
+++ lib/Sema/SemaExprObjC.cpp
@@ -4335,8 +4335,9 @@
 SmallVector subExprs(n);
 SmallVector subTypes(n);
 for (unsigned i = 0; i != n; ++i) {
-  subTypes[i] = gse->getAssocTypeSourceInfo(i);
-  Expr *sub = gse->getAssocExpr(i);
+  auto Assoc = gse->getAssociation(i);
+  subTypes[i] = Assoc.getTypeSourceInfo();
+  Expr *sub = Assoc.getExpr();
   if (i == gse->getResultIndex())
 sub = stripARCUnbridgedCast(sub);
   subExprs[i] = sub;
Index: lib/AST/StmtProfile.cpp
===
--- lib/AST/StmtProfile.cpp
+++ lib/AST/StmtProfile.cpp
@@ -1260,12 +1260,13 @@
 void StmtProfiler::VisitGenericSelectionExpr(const GenericSelectionExpr *S) {
   VisitExpr(S);
   for (unsigned i = 0; i != S->getNumAssocs(); ++i) {
-QualType T = S->getAssocType(i);
+auto Assoc = S->getAssociation(i);
+QualType T = Assoc.getType();
 if (T.isNull())
   ID.AddPointer(nullptr);
 else
   VisitType(T);
-VisitExpr(S->getAssocExpr(i));
+VisitExpr(Assoc.getExpr());
   }
 }
 
Index: lib/AST/StmtPrinter.cpp
===
--- lib/AST/StmtPrinter.cpp
+++ lib/AST/StmtPrinter.cpp
@@ -1263,13 +1263,14 @@
   PrintExpr(Node->getControllingExpr());
   for (unsigned i = 0; i != Node->getNumAssocs(); ++i) {
 OS << ", ";
-QualType T = Node->getAssocType(i);
+auto Assoc = Node->getAssociation(i);
+QualType T = Assoc.getType();
 if (T.isNull())
   OS << "default";
 else
   T.print(OS, Policy);
 OS << ": ";
-PrintExpr(Node->getAssocExpr(i));
+PrintExpr(Assoc.getExpr());
   }
   OS << ")";
 }
Index: lib/AST/ASTDumper.cpp
===
--- lib/AST/ASTDumper.cpp
+++ lib/AST/ASTDumper.cpp
@@ -1464,19 +1464,21 @@
 
   for (unsigned I = 0, N = E->getNumAssocs(); I != N; ++I) {
 dumpChild([=] {
-  if (const TypeSourceInfo *TSI = E->getAssocTypeSourceInfo(I)) {
+  const auto Assoc = E->getAssociation(I);
+  

[PATCH] D56960: NFC: Implement GenericSelectionExpr::Association dump with Visitor

2019-01-19 Thread Stephen Kelly via Phabricator via cfe-commits
steveire created this revision.
steveire added a reviewer: aaron.ballman.
Herald added a subscriber: cfe-commits.

Repository:
  rC Clang

https://reviews.llvm.org/D56960

Files:
  include/clang/AST/TextNodeDumper.h
  lib/AST/ASTDumper.cpp
  lib/AST/TextNodeDumper.cpp


Index: lib/AST/TextNodeDumper.cpp
===
--- lib/AST/TextNodeDumper.cpp
+++ lib/AST/TextNodeDumper.cpp
@@ -312,6 +312,19 @@
 OS << " ";
 }
 
+void TextNodeDumper::Visit(const GenericSelectionExpr::Association &A) {
+  const TypeSourceInfo *TSI = A.getTypeSourceInfo();
+  if (TSI) {
+OS << "case ";
+dumpType(TSI->getType());
+  } else {
+OS << "default";
+  }
+
+  if (A.IsSelected())
+OS << " selected";
+}
+
 void TextNodeDumper::dumpPointer(const void *Ptr) {
   ColorScope Color(OS, ShowColors, AddressColor);
   OS << ' ' << Ptr;
Index: lib/AST/ASTDumper.cpp
===
--- lib/AST/ASTDumper.cpp
+++ lib/AST/ASTDumper.cpp
@@ -297,6 +297,7 @@
 void VisitInitListExpr(const InitListExpr *ILE);
 void VisitBlockExpr(const BlockExpr *Node);
 void VisitOpaqueValueExpr(const OpaqueValueExpr *Node);
+void Visit(const GenericSelectionExpr::Association &A);
 void VisitGenericSelectionExpr(const GenericSelectionExpr *E);
 
 // C++
@@ -1456,6 +1457,16 @@
 dumpStmt(Source);
 }
 
+void ASTDumper::Visit(const GenericSelectionExpr::Association &A) {
+  dumpChild([=] {
+NodeDumper.Visit(A);
+const TypeSourceInfo *TSI = A.getTypeSourceInfo();
+if (TSI)
+  dumpTypeAsChild(TSI->getType());
+dumpStmt(A.getExpr());
+  });
+}
+
 void ASTDumper::VisitGenericSelectionExpr(const GenericSelectionExpr *E) {
   if (E->isResultDependent())
 OS << " result_dependent";
@@ -1463,23 +1474,7 @@
   dumpTypeAsChild(E->getControllingExpr()->getType()); // FIXME: remove
 
   for (unsigned I = 0, N = E->getNumAssocs(); I != N; ++I) {
-dumpChild([=] {
-  const auto Assoc = E->getAssociation(I);
-  const TypeSourceInfo *TSI = Assoc.getTypeSourceInfo();
-  if (TSI) {
-OS << "case ";
-NodeDumper.dumpType(TSI->getType());
-  } else {
-OS << "default";
-  }
-
-  if (Assoc.IsSelected())
-OS << " selected";
-
-  if (TSI)
-dumpTypeAsChild(TSI->getType());
-  dumpStmt(Assoc.getExpr());
-});
+Visit(E->getAssociation(I));
   }
 }
 
Index: include/clang/AST/TextNodeDumper.h
===
--- include/clang/AST/TextNodeDumper.h
+++ include/clang/AST/TextNodeDumper.h
@@ -172,6 +172,8 @@
 
   void Visit(const BlockDecl::Capture &C);
 
+  void Visit(const GenericSelectionExpr::Association &A);
+
   void dumpPointer(const void *Ptr);
   void dumpLocation(SourceLocation Loc);
   void dumpSourceRange(SourceRange R);


Index: lib/AST/TextNodeDumper.cpp
===
--- lib/AST/TextNodeDumper.cpp
+++ lib/AST/TextNodeDumper.cpp
@@ -312,6 +312,19 @@
 OS << " ";
 }
 
+void TextNodeDumper::Visit(const GenericSelectionExpr::Association &A) {
+  const TypeSourceInfo *TSI = A.getTypeSourceInfo();
+  if (TSI) {
+OS << "case ";
+dumpType(TSI->getType());
+  } else {
+OS << "default";
+  }
+
+  if (A.IsSelected())
+OS << " selected";
+}
+
 void TextNodeDumper::dumpPointer(const void *Ptr) {
   ColorScope Color(OS, ShowColors, AddressColor);
   OS << ' ' << Ptr;
Index: lib/AST/ASTDumper.cpp
===
--- lib/AST/ASTDumper.cpp
+++ lib/AST/ASTDumper.cpp
@@ -297,6 +297,7 @@
 void VisitInitListExpr(const InitListExpr *ILE);
 void VisitBlockExpr(const BlockExpr *Node);
 void VisitOpaqueValueExpr(const OpaqueValueExpr *Node);
+void Visit(const GenericSelectionExpr::Association &A);
 void VisitGenericSelectionExpr(const GenericSelectionExpr *E);
 
 // C++
@@ -1456,6 +1457,16 @@
 dumpStmt(Source);
 }
 
+void ASTDumper::Visit(const GenericSelectionExpr::Association &A) {
+  dumpChild([=] {
+NodeDumper.Visit(A);
+const TypeSourceInfo *TSI = A.getTypeSourceInfo();
+if (TSI)
+  dumpTypeAsChild(TSI->getType());
+dumpStmt(A.getExpr());
+  });
+}
+
 void ASTDumper::VisitGenericSelectionExpr(const GenericSelectionExpr *E) {
   if (E->isResultDependent())
 OS << " result_dependent";
@@ -1463,23 +1474,7 @@
   dumpTypeAsChild(E->getControllingExpr()->getType()); // FIXME: remove
 
   for (unsigned I = 0, N = E->getNumAssocs(); I != N; ++I) {
-dumpChild([=] {
-  const auto Assoc = E->getAssociation(I);
-  const TypeSourceInfo *TSI = Assoc.getTypeSourceInfo();
-  if (TSI) {
-OS << "case ";
-NodeDumper.dumpType(TSI->getType());
-  } else {
-OS << "default";
-  }
-
-  if (Assoc.IsSelected())
-OS << " selected";
-
-  if (TSI)
-dumpTypeAsChild(TSI->getType());
- 

[PATCH] D56961: NFC: Move GenericSelectionExpr dump to NodeDumper

2019-01-19 Thread Stephen Kelly via Phabricator via cfe-commits
steveire created this revision.
steveire added a reviewer: aaron.ballman.
Herald added a subscriber: cfe-commits.

Repository:
  rC Clang

https://reviews.llvm.org/D56961

Files:
  include/clang/AST/TextNodeDumper.h
  lib/AST/ASTDumper.cpp
  lib/AST/TextNodeDumper.cpp


Index: lib/AST/TextNodeDumper.cpp
===
--- lib/AST/TextNodeDumper.cpp
+++ lib/AST/TextNodeDumper.cpp
@@ -776,6 +776,11 @@
   }
 }
 
+void TextNodeDumper::VisitGenericSelectionExpr(const GenericSelectionExpr *E) {
+  if (E->isResultDependent())
+OS << " result_dependent";
+}
+
 void TextNodeDumper::VisitUnaryOperator(const UnaryOperator *Node) {
   OS << " " << (Node->isPostfix() ? "postfix" : "prefix") << " '"
  << UnaryOperator::getOpcodeStr(Node->getOpcode()) << "'";
Index: lib/AST/ASTDumper.cpp
===
--- lib/AST/ASTDumper.cpp
+++ lib/AST/ASTDumper.cpp
@@ -1468,8 +1468,6 @@
 }
 
 void ASTDumper::VisitGenericSelectionExpr(const GenericSelectionExpr *E) {
-  if (E->isResultDependent())
-OS << " result_dependent";
   dumpStmt(E->getControllingExpr());
   dumpTypeAsChild(E->getControllingExpr()->getType()); // FIXME: remove
 
Index: include/clang/AST/TextNodeDumper.h
===
--- include/clang/AST/TextNodeDumper.h
+++ include/clang/AST/TextNodeDumper.h
@@ -237,6 +237,7 @@
   void VisitFloatingLiteral(const FloatingLiteral *Node);
   void VisitStringLiteral(const StringLiteral *Str);
   void VisitInitListExpr(const InitListExpr *ILE);
+  void VisitGenericSelectionExpr(const GenericSelectionExpr *E);
   void VisitUnaryOperator(const UnaryOperator *Node);
   void VisitUnaryExprOrTypeTraitExpr(const UnaryExprOrTypeTraitExpr *Node);
   void VisitMemberExpr(const MemberExpr *Node);


Index: lib/AST/TextNodeDumper.cpp
===
--- lib/AST/TextNodeDumper.cpp
+++ lib/AST/TextNodeDumper.cpp
@@ -776,6 +776,11 @@
   }
 }
 
+void TextNodeDumper::VisitGenericSelectionExpr(const GenericSelectionExpr *E) {
+  if (E->isResultDependent())
+OS << " result_dependent";
+}
+
 void TextNodeDumper::VisitUnaryOperator(const UnaryOperator *Node) {
   OS << " " << (Node->isPostfix() ? "postfix" : "prefix") << " '"
  << UnaryOperator::getOpcodeStr(Node->getOpcode()) << "'";
Index: lib/AST/ASTDumper.cpp
===
--- lib/AST/ASTDumper.cpp
+++ lib/AST/ASTDumper.cpp
@@ -1468,8 +1468,6 @@
 }
 
 void ASTDumper::VisitGenericSelectionExpr(const GenericSelectionExpr *E) {
-  if (E->isResultDependent())
-OS << " result_dependent";
   dumpStmt(E->getControllingExpr());
   dumpTypeAsChild(E->getControllingExpr()->getType()); // FIXME: remove
 
Index: include/clang/AST/TextNodeDumper.h
===
--- include/clang/AST/TextNodeDumper.h
+++ include/clang/AST/TextNodeDumper.h
@@ -237,6 +237,7 @@
   void VisitFloatingLiteral(const FloatingLiteral *Node);
   void VisitStringLiteral(const StringLiteral *Str);
   void VisitInitListExpr(const InitListExpr *ILE);
+  void VisitGenericSelectionExpr(const GenericSelectionExpr *E);
   void VisitUnaryOperator(const UnaryOperator *Node);
   void VisitUnaryExprOrTypeTraitExpr(const UnaryExprOrTypeTraitExpr *Node);
   void VisitMemberExpr(const MemberExpr *Node);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D56959: [AST] NFC: Introduce new class GenericSelectionExpr::Association

2019-01-19 Thread Bruno Ricci via Phabricator via cfe-commits
riccibruno added inline comments.



Comment at: include/clang/AST/Expr.h:5020
   Stmt **SubExprs;
   unsigned NumAssocs, ResultIndex;
   SourceLocation GenericLoc, DefaultLoc, RParenLoc;

I know that this is not part of this patch, but these arrays are begging
to be tail-allocated if you want to have a go at it.



Comment at: include/clang/AST/Expr.h:5047
+bool Selected;
+
+  public:

What about some comments ? I can guess but it is better to have
too much doc than not enough imho.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56959/new/

https://reviews.llvm.org/D56959



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


[PATCH] D56925: Do not use frame pointer by default for MSP430

2019-01-19 Thread George Rimar via Phabricator via cfe-commits
grimar added a comment.

Testcase?


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56925/new/

https://reviews.llvm.org/D56925



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


[PATCH] D56927: Disable PIC/PIE for MSP430 target

2019-01-19 Thread George Rimar via Phabricator via cfe-commits
grimar added a comment.

Can it be tested with a test case?


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56927/new/

https://reviews.llvm.org/D56927



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


[PATCH] D56965: [X86] Remove the cvtuqq2ps256/cvtqq2ps256 mask builtins. Replace with uitofp/sitofp and select.

2019-01-19 Thread Craig Topper via Phabricator via cfe-commits
craig.topper created this revision.
craig.topper added reviewers: RKSimon, spatel.
Herald added a subscriber: kristina.

Repository:
  rC Clang

https://reviews.llvm.org/D56965

Files:
  include/clang/Basic/BuiltinsX86.def
  lib/Headers/avx512vldqintrin.h
  test/CodeGen/avx512vldq-builtins.c

Index: test/CodeGen/avx512vldq-builtins.c
===
--- test/CodeGen/avx512vldq-builtins.c
+++ test/CodeGen/avx512vldq-builtins.c
@@ -479,19 +479,21 @@
 
 __m128 test_mm256_cvtepi64_ps(__m256i __A) {
   // CHECK-LABEL: @test_mm256_cvtepi64_ps
-  // CHECK: @llvm.x86.avx512.mask.cvtqq2ps.256
+  // CHECK: sitofp <4 x i64> %{{.*}} to <4 x float>
   return _mm256_cvtepi64_ps(__A); 
 }
 
 __m128 test_mm256_mask_cvtepi64_ps(__m128 __W, __mmask8 __U, __m256i __A) {
   // CHECK-LABEL: @test_mm256_mask_cvtepi64_ps
-  // CHECK: @llvm.x86.avx512.mask.cvtqq2ps.256
+  // CHECK: sitofp <4 x i64> %{{.*}} to <4 x float>
+  // select <4 x i1> %{{.*}}, <4 x float> %{{.*}}, <4 x float> %{{.*}}
   return _mm256_mask_cvtepi64_ps(__W, __U, __A); 
 }
 
 __m128 test_mm256_maskz_cvtepi64_ps(__mmask8 __U, __m256i __A) {
   // CHECK-LABEL: @test_mm256_maskz_cvtepi64_ps
-  // CHECK: @llvm.x86.avx512.mask.cvtqq2ps.256
+  // CHECK: sitofp <4 x i64> %{{.*}} to <4 x float>
+  // select <4 x i1> %{{.*}}, <4 x float> %{{.*}}, <4 x float> %{{.*}}
   return _mm256_maskz_cvtepi64_ps(__U, __A); 
 }
 
@@ -699,19 +701,21 @@
 
 __m128 test_mm256_cvtepu64_ps(__m256i __A) {
   // CHECK-LABEL: @test_mm256_cvtepu64_ps
-  // CHECK: @llvm.x86.avx512.mask.cvtuqq2ps.256
+  // CHECK: uitofp <4 x i64> %{{.*}} to <4 x float>
   return _mm256_cvtepu64_ps(__A); 
 }
 
 __m128 test_mm256_mask_cvtepu64_ps(__m128 __W, __mmask8 __U, __m256i __A) {
   // CHECK-LABEL: @test_mm256_mask_cvtepu64_ps
-  // CHECK: @llvm.x86.avx512.mask.cvtuqq2ps.256
+  // CHECK: uitofp <4 x i64> %{{.*}} to <4 x float>
+  // CHECK: select <4 x i1> %{{.*}}, <4 x float> %{{.*}}, <4 x float> %{{.*}}
   return _mm256_mask_cvtepu64_ps(__W, __U, __A); 
 }
 
 __m128 test_mm256_maskz_cvtepu64_ps(__mmask8 __U, __m256i __A) {
   // CHECK-LABEL: @test_mm256_maskz_cvtepu64_ps
-  // CHECK: @llvm.x86.avx512.mask.cvtuqq2ps.256
+  // CHECK: uitofp <4 x i64> %{{.*}} to <4 x float>
+  // CHECK: select <4 x i1> %{{.*}}, <4 x float> %{{.*}}, <4 x float> %{{.*}}
   return _mm256_maskz_cvtepu64_ps(__U, __A); 
 }
 
Index: lib/Headers/avx512vldqintrin.h
===
--- lib/Headers/avx512vldqintrin.h
+++ lib/Headers/avx512vldqintrin.h
@@ -523,23 +523,21 @@
 
 static __inline__ __m128 __DEFAULT_FN_ATTRS256
 _mm256_cvtepi64_ps (__m256i __A) {
-  return (__m128) __builtin_ia32_cvtqq2ps256_mask ((__v4di) __A,
-(__v4sf) _mm_setzero_ps(),
-(__mmask8) -1);
+  return (__m128)__builtin_convertvector((__v4di)__A, __v4sf);
 }
 
 static __inline__ __m128 __DEFAULT_FN_ATTRS256
 _mm256_mask_cvtepi64_ps (__m128 __W, __mmask8 __U, __m256i __A) {
-  return (__m128) __builtin_ia32_cvtqq2ps256_mask ((__v4di) __A,
-(__v4sf) __W,
-(__mmask8) __U);
+  return (__m128)__builtin_ia32_selectps_128((__mmask8)__U,
+ (__v4sf)_mm256_cvtepi64_ps(__A),
+ (__v4sf)__W);
 }
 
 static __inline__ __m128 __DEFAULT_FN_ATTRS256
 _mm256_maskz_cvtepi64_ps (__mmask8 __U, __m256i __A) {
-  return (__m128) __builtin_ia32_cvtqq2ps256_mask ((__v4di) __A,
-(__v4sf) _mm_setzero_ps(),
-(__mmask8) __U);
+  return (__m128)__builtin_ia32_selectps_128((__mmask8)__U,
+ (__v4sf)_mm256_cvtepi64_ps(__A),
+ (__v4sf)_mm_setzero_ps());
 }
 
 static __inline__ __m128i __DEFAULT_FN_ATTRS128
@@ -771,23 +769,21 @@
 
 static __inline__ __m128 __DEFAULT_FN_ATTRS256
 _mm256_cvtepu64_ps (__m256i __A) {
-  return (__m128) __builtin_ia32_cvtuqq2ps256_mask ((__v4di) __A,
-(__v4sf) _mm_setzero_ps(),
-(__mmask8) -1);
+  return (__m128)__builtin_convertvector((__v4du)__A, __v4sf);
 }
 
 static __inline__ __m128 __DEFAULT_FN_ATTRS256
 _mm256_mask_cvtepu64_ps (__m128 __W, __mmask8 __U, __m256i __A) {
-  return (__m128) __builtin_ia32_cvtuqq2ps256_mask ((__v4di) __A,
-(__v4sf) __W,
-(__mmask8) __U);
+  return (__m128)__builtin_ia32_selectps_128((__mmask8)__U,
+ (__v4sf)_mm256_cvtepu64_ps(__A),
+ (__v4sf)__W);
 }
 
 static __inline__ __m128 __DEFAULT_FN_ATTRS256
 _mm256_maskz_cvtepu64_ps (__mmask8 __U, __m256i __A) {
-  return (__m128) __builtin_ia32_cvtuqq2ps256_mask ((__v4di) __A,
-(__v4sf) _mm_setzero_ps(),
-(__mmask8) __U);
+  return (__m128)__builtin_ia32_selectps_128((__mmask8)__U,
+ (__v4sf)_mm

r351665 - [FIX] Generalize the expected results for callback clang tests

2019-01-19 Thread Johannes Doerfert via cfe-commits
Author: jdoerfert
Date: Sat Jan 19 12:46:10 2019
New Revision: 351665

URL: http://llvm.org/viewvc/llvm-project?rev=351665&view=rev
Log:
[FIX] Generalize the expected results for callback clang tests

Modified:
cfe/trunk/test/CodeGen/callback_annotated.c
cfe/trunk/test/CodeGen/callback_pthread_create.c

Modified: cfe/trunk/test/CodeGen/callback_annotated.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/callback_annotated.c?rev=351665&r1=351664&r2=351665&view=diff
==
--- cfe/trunk/test/CodeGen/callback_annotated.c (original)
+++ cfe/trunk/test/CodeGen/callback_annotated.c Sat Jan 19 12:46:10 2019
@@ -30,22 +30,20 @@ __attribute__((callback(4, d, 5, 2))) vo
 
 static void *VoidPtr2VoidPtr(void *payload) {
   // RUN2: ret i8* %payload
-  // IPCP:  ret i8* null
+  // IPCP: ret i8* null
   return payload;
 }
 
 static int ThreeInt2Int(int a, int b, int c) {
-  // RUN2:  define internal i32 @ThreeInt2Int(i32 %a, i32 %b, i32 %c)
-  // RUN2-NEXT: entry:
-  // RUN2-NEXT: %mul = mul nsw i32 %b, %a
-  // RUN2-NEXT: %add = add nsw i32 %mul, %c
-  // RUN2-NEXT: ret i32 %add
+  // RUN2:   define internal i32 @ThreeInt2Int(i32 %a, i32 %b, i32 %c)
+  // RUN2: %mul = mul nsw i32 %b, %a
+  // RUN2: %add = add nsw i32 %mul, %c
+  // RUN2: ret i32 %add
 
-  // IPCP:   define internal i32 @ThreeInt2Int(i32 %a, i32 %b, i32 %c)
-  // IPCP-NEXT:  entry:
-  // IPCP-NEXT:  %mul = mul nsw i32 4, %a
-  // IPCP-NEXT:  %add = add nsw i32 %mul, %c
-  // IPCP-NEXT:  ret i32 %add
+  // IPCP:   define internal i32 @ThreeInt2Int(i32 %a, i32 %b, i32 %c)
+  // IPCP: %mul = mul nsw i32 4, %a
+  // IPCP: %add = add nsw i32 %mul, %c
+  // IPCP: ret i32 %add
 
   return a * b + c;
 }

Modified: cfe/trunk/test/CodeGen/callback_pthread_create.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/callback_pthread_create.c?rev=351665&r1=351664&r2=351665&view=diff
==
--- cfe/trunk/test/CodeGen/callback_pthread_create.c (original)
+++ cfe/trunk/test/CodeGen/callback_pthread_create.c Sat Jan 19 12:46:10 2019
@@ -14,15 +14,13 @@ const int GlobalVar = 0;
 
 static void *callee0(void *payload) {
 // IPCP:  define internal i8* @callee0
-// IPCP-NEXT:   entry:
-// IPCP-NEXT: ret i8* null
+// IPCP:ret i8* null
   return payload;
 }
 
 static void *callee1(void *payload) {
 // IPCP:  define internal i8* @callee1
-// IPCP-NEXT:   entry:
-// IPCP-NEXT: ret i8* bitcast (i32* @GlobalVar to i8*)
+// IPCP:ret i8* bitcast (i32* @GlobalVar to i8*)
   return payload;
 }
 


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


[PATCH] D56966: [clang-tidy] misc-non-private-member-variables-in-classes: ignore implicit methods

2019-01-19 Thread Jonas Toth via Phabricator via cfe-commits
JonasToth added inline comments.



Comment at: clang-tidy/misc/NonPrivateMemberVariablesInClassesCheck.cpp:22
 AST_MATCHER(CXXRecordDecl, hasMethods) {
-  return std::distance(Node.method_begin(), Node.method_end()) != 0;
+  for (const auto &Method : Node.methods()) {
+if (Method->isImplicit())

maybe `return llvm::any_of(Node.methods(), [](const CXXMethodDecl /* dunno 
which type this would be */& M) { return !M->isImplicit(); });`?


Repository:
  rCTE Clang Tools Extra

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56966/new/

https://reviews.llvm.org/D56966



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


[PATCH] D56966: [clang-tidy] misc-non-private-member-variables-in-classes: ignore implicit methods

2019-01-19 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri requested changes to this revision.
lebedev.ri added a comment.
This revision now requires changes to proceed.

Some nits.




Comment at: clang-tidy/misc/NonPrivateMemberVariablesInClassesCheck.cpp:21
 
 AST_MATCHER(CXXRecordDecl, hasMethods) {
+  for (const auto &Method : Node.methods()) {

let's keep this one as-is.



Comment at: clang-tidy/misc/NonPrivateMemberVariablesInClassesCheck.cpp:31-34
 AST_MATCHER(CXXRecordDecl, hasNonStaticMethod) {
   return hasMethod(unless(isStaticStorageClass()))
   .matches(Node, Finder, Builder);
 }

And change this to something like
```
AST_MATCHER(CXXRecordDecl, hasNonStaticNonImplicitMethod) {
  return hasMethod(unless(anyOf(isStaticStorageClass(), isImplicit(
  .matches(Node, Finder, Builder);
}
```



Comment at: clang-tidy/misc/NonPrivateMemberVariablesInClassesCheck.cpp:74-76
   // We only want the records that not only contain the mutable data 
(non-static
   // member variables), but also have some logic (non-static member functions).
   // We may optionally ignore records where all the member variables are 
public.

Comment needs updating?



Comment at: 
docs/clang-tidy/checks/misc-non-private-member-variables-in-classes.rst:9
 
-Finds classes that contain non-static data members in addition to non-static
+Finds classes that contain non-static data members in addition to explicit 
non-static
 member functions and diagnose all data members declared with a non-``public``

I don't like the wording. We are not looking for `explicit` methods,
we are looking for user-provided methods, as opposed to compiler-provided 
methods.


Repository:
  rCTE Clang Tools Extra

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56966/new/

https://reviews.llvm.org/D56966



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


[PATCH] D56965: [X86] Remove the cvtuqq2ps256/cvtqq2ps256 mask builtins. Replace with uitofp/sitofp and select.

2019-01-19 Thread Simon Pilgrim via Phabricator via cfe-commits
RKSimon added a comment.

Just to confirm, this isn't driven by RC in any way? cvtsi642ps isn't so I 
don't expect it to be, but just to be sure..


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56965/new/

https://reviews.llvm.org/D56965



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


[PATCH] D56965: [X86] Remove the cvtuqq2ps256/cvtqq2ps256 mask builtins. Replace with uitofp/sitofp and select.

2019-01-19 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added a comment.

It uses current rounding mode for inexact conversions. cvtsi642ss should do the 
same. As does (u)dq2ps and (u)qq2pd. I think we use sitofp/uitofp for some 
lengths of those already.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56965/new/

https://reviews.llvm.org/D56965



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


[PATCH] D56967: Thread safety analysis: Improve diagnostics for double locking

2019-01-19 Thread Aaron Puchert via Phabricator via cfe-commits
aaronpuchert created this revision.
aaronpuchert added reviewers: aaron.ballman, delesley.
Herald added a subscriber: cfe-commits.

We use the existing diag::note_locked_here to tell the user where we saw
the first locking.


Repository:
  rC Clang

https://reviews.llvm.org/D56967

Files:
  include/clang/Analysis/Analyses/ThreadSafety.h
  lib/Analysis/ThreadSafety.cpp
  lib/Sema/AnalysisBasedWarnings.cpp
  test/SemaCXX/warn-thread-safety-analysis.cpp

Index: test/SemaCXX/warn-thread-safety-analysis.cpp
===
--- test/SemaCXX/warn-thread-safety-analysis.cpp
+++ test/SemaCXX/warn-thread-safety-analysis.cpp
@@ -239,7 +239,7 @@
 }
 
 void sls_fun_bad_2() {
-  sls_mu.Lock();
+  sls_mu.Lock(); // expected-note{{mutex acquired here}}
   sls_mu.Lock(); // \
 // expected-warning{{acquiring mutex 'sls_mu' that is already held}}
   sls_mu.Unlock();
@@ -365,7 +365,7 @@
 }
 
 void aa_fun_bad_2() {
-  glock.globalLock();
+  glock.globalLock(); // expected-note{{mutex acquired here}}
   glock.globalLock(); // \
 // expected-warning{{acquiring mutex 'aa_mu' that is already held}}
   glock.globalUnlock();
@@ -1691,7 +1691,7 @@
   }
 
   void foo3() {
-MutexLock mulock_a(&mu1);
+MutexLock mulock_a(&mu1); // expected-note{{mutex acquired here}}
 MutexLock mulock_b(&mu1); // \
   // expected-warning {{acquiring mutex 'mu1' that is already held}}
   }
@@ -2710,14 +2710,14 @@
 }
 
 void doubleLock1() {
-  RelockableExclusiveMutexLock scope(&mu);
+  RelockableExclusiveMutexLock scope(&mu); // expected-note{{mutex acquired here}}
   scope.Lock(); // expected-warning {{acquiring mutex 'mu' that is already held}}
 }
 
 void doubleLock2() {
   RelockableExclusiveMutexLock scope(&mu);
   scope.Unlock();
-  scope.Lock();
+  scope.Lock(); // expected-note{{mutex acquired here}}
   scope.Lock(); // expected-warning {{acquiring mutex 'mu' that is already held}}
 }
 
@@ -2754,7 +2754,7 @@
 };
 
 void relockShared2() {
-  MemberLock lock;
+  MemberLock lock; // expected-note{{mutex acquired here}}
   lock.Lock(); // expected-warning {{acquiring mutex 'lock.mutex' that is already held}}
 }
 
@@ -2861,7 +2861,7 @@
 
 void doubleLock() EXCLUSIVE_LOCKS_REQUIRED(mu) {
   MutexUnlock scope(&mu);
-  scope.Lock();
+  scope.Lock(); // expected-note{{mutex acquired here}}
   scope.Lock(); // expected-warning {{acquiring mutex 'mu' that is already held}}
 }
 
@@ -3164,7 +3164,7 @@
 
 
 void Foo::test8() {
-  mu_->Lock();
+  mu_->Lock();  // expected-note 2 {{mutex acquired here}}
   mu_.get()->Lock();// expected-warning {{acquiring mutex 'mu_' that is already held}}
   (*mu_).Lock();// expected-warning {{acquiring mutex 'mu_' that is already held}}
   mu_.get()->Unlock();
@@ -3298,7 +3298,7 @@
   foo.lock();
   foo.unlock();
 
-  foo.lock();
+  foo.lock(); // expected-note{{mutex acquired here}}
   foo.lock(); // expected-warning {{acquiring mutex 'foo' that is already held}}
   foo.unlock();
   foo.unlock();   // expected-warning {{releasing mutex 'foo' that was not held}}
@@ -3311,7 +3311,7 @@
   foo.a = 0;
   foo.unlock1();
 
-  foo.lock1();
+  foo.lock1();// expected-note{{mutex acquired here}}
   foo.lock1();// expected-warning {{acquiring mutex 'foo.mu1_' that is already held}}
   foo.a = 0;
   foo.unlock1();
@@ -3325,7 +3325,7 @@
   int d1 = foo.a;
   foo.unlock1();
 
-  foo.slock1();
+  foo.slock1();// expected-note{{mutex acquired here}}
   foo.slock1();// expected-warning {{acquiring mutex 'foo.mu1_' that is already held}}
   int d2 = foo.a;
   foo.unlock1();
@@ -3342,7 +3342,7 @@
   foo.c = 0;
   foo.unlock3();
 
-  foo.lock3();
+  foo.lock3(); // expected-note 3 {{mutex acquired here}}
   foo.lock3(); // \
 // expected-warning {{acquiring mutex 'foo.mu1_' that is already held}} \
 // expected-warning {{acquiring mutex 'foo.mu2_' that is already held}} \
@@ -3366,7 +3366,7 @@
   foo.c = 0;
   foo.unlocklots();
 
-  foo.locklots();
+  foo.locklots(); // expected-note 3 {{mutex acquired here}}
   foo.locklots(); // \
 // expected-warning {{acquiring mutex 'foo.mu1_' that is already held}} \
 // expected-warning {{acquiring mutex 'foo.mu2_' that is already held}} \
@@ -3524,7 +3524,7 @@
   LockAllGraphs();
   g2.mu_.Unlock();
 
-  LockAllGraphs();
+  LockAllGraphs(); // expected-note{{mutex acquired here}}
   g1.mu_.Lock();  // expected-warning {{acquiring mutex 'g1.mu_' that is already held}}
   g1.mu_.Unlock();
 }
Index: lib/Sema/AnalysisBasedWarnings.cpp
===
--- lib/Sema/AnalysisBasedWarnings.cpp
+++ lib/Sema/AnalysisBasedWarnings.cpp
@@ -1638,17 +1638,6 @@
 return ONS;
   }
 
-  // Helper functions
-  void warnLockMismatch(unsigned DiagID, StringRef Kind, Name LockName,
-SourceLocation Loc) {
-// Gracefully handle rare cases when the analysis can't get a more
-// precise source location.
-if (

[PATCH] D56972: [CMake][Fuchsia] Drop -DNDEBUG, re-enable modules

2019-01-19 Thread Petr Hosek via Phabricator via cfe-commits
phosek created this revision.
phosek added reviewers: mcgrathr, jakehehrlich, juliehockett.
Herald added subscribers: cfe-commits, mgorny.

-DNDEBUG is no longer needed now that we don't enable assertions, modules 
should improve build times for the second stage.


Repository:
  rC Clang

https://reviews.llvm.org/D56972

Files:
  clang/cmake/caches/Fuchsia-stage2.cmake


Index: clang/cmake/caches/Fuchsia-stage2.cmake
===
--- clang/cmake/caches/Fuchsia-stage2.cmake
+++ clang/cmake/caches/Fuchsia-stage2.cmake
@@ -9,6 +9,7 @@
   set(LLVM_ENABLE_LLD ON CACHE BOOL "")
 endif()
 set(LLVM_ENABLE_LTO ON CACHE BOOL "")
+set(LLVM_ENABLE_MODULES ON CACHE BOOL "")
 set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR ON CACHE BOOL "")
 set(LLVM_ENABLE_TERMINFO OFF CACHE BOOL "")
 set(LLVM_ENABLE_ZLIB ON CACHE BOOL "")
@@ -28,8 +29,8 @@
 set(ENABLE_X86_RELAX_RELOCATIONS ON CACHE BOOL "")
 
 set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "")
-set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 -gline-tables-only -DNDEBUG" CACHE 
STRING "")
-set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -gline-tables-only -DNDEBUG" CACHE 
STRING "")
+set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 -gline-tables-only" CACHE STRING "")
+set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -gline-tables-only" CACHE STRING "")
 
 if(APPLE)
   list(APPEND BUILTIN_TARGETS "default")


Index: clang/cmake/caches/Fuchsia-stage2.cmake
===
--- clang/cmake/caches/Fuchsia-stage2.cmake
+++ clang/cmake/caches/Fuchsia-stage2.cmake
@@ -9,6 +9,7 @@
   set(LLVM_ENABLE_LLD ON CACHE BOOL "")
 endif()
 set(LLVM_ENABLE_LTO ON CACHE BOOL "")
+set(LLVM_ENABLE_MODULES ON CACHE BOOL "")
 set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR ON CACHE BOOL "")
 set(LLVM_ENABLE_TERMINFO OFF CACHE BOOL "")
 set(LLVM_ENABLE_ZLIB ON CACHE BOOL "")
@@ -28,8 +29,8 @@
 set(ENABLE_X86_RELAX_RELOCATIONS ON CACHE BOOL "")
 
 set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "")
-set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 -gline-tables-only -DNDEBUG" CACHE STRING "")
-set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -gline-tables-only -DNDEBUG" CACHE STRING "")
+set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 -gline-tables-only" CACHE STRING "")
+set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -gline-tables-only" CACHE STRING "")
 
 if(APPLE)
   list(APPEND BUILTIN_TARGETS "default")
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits