[PATCH] D74634: Remove "ELF Only" restriction from section flags

2020-02-14 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74634



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


[PATCH] D72304: [OpenMP][OMPIRBuilder] Add Directives (master and critical) to OMPBuilder.

2020-02-14 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert added a comment.

I did run clang-format on the OMPIRBuilder files and replaced tabs with spaces. 
I think you need to teach your editor to use spaces in the future.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72304



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


[PATCH] D72304: [OpenMP][OMPIRBuilder] Add Directives (master and critical) to OMPBuilder.

2020-02-14 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

`test/CodeGen/opt-record-1.c` triggers an assertion failure.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72304



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


[PATCH] D72304: [OpenMP][OMPIRBuilder] Add Directives (master and critical) to OMPBuilder.

2020-02-14 Thread Johannes Doerfert via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7438059a9032: [OpenMP][OMPIRBuilder] Add Directives (master 
and critical) to OMPBuilder. (authored by fghanim, committed by jdoerfert).

Changed prior to commit:
  https://reviews.llvm.org/D72304?vs=244249=244818#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72304

Files:
  clang/lib/CodeGen/CGStmtOpenMP.cpp
  clang/test/OpenMP/critical_codegen.cpp
  clang/test/OpenMP/master_codegen.cpp
  llvm/include/llvm/Frontend/OpenMP/OMPConstants.h
  llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
  llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
  llvm/lib/Frontend/OpenMP/OMPConstants.cpp
  llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
  llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp

Index: llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
===
--- llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
+++ llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
@@ -622,4 +622,161 @@
   }
 }
 
+TEST_F(OpenMPIRBuilderTest, MasterDirective) {
+  using InsertPointTy = OpenMPIRBuilder::InsertPointTy;
+  OpenMPIRBuilder OMPBuilder(*M);
+  OMPBuilder.initialize();
+  F->setName("func");
+  IRBuilder<> Builder(BB);
+
+  OpenMPIRBuilder::LocationDescription Loc({Builder.saveIP(), DL});
+
+  AllocaInst *PrivAI = nullptr;
+
+  BasicBlock *EntryBB = nullptr;
+  BasicBlock *ExitBB = nullptr;
+  BasicBlock *ThenBB = nullptr;
+
+  auto BodyGenCB = [&](InsertPointTy AllocaIP, InsertPointTy CodeGenIP,
+   BasicBlock ) {
+if (AllocaIP.isSet())
+  Builder.restoreIP(AllocaIP);
+else
+  Builder.SetInsertPoint(&*(F->getEntryBlock().getFirstInsertionPt()));
+PrivAI = Builder.CreateAlloca(F->arg_begin()->getType());
+Builder.CreateStore(F->arg_begin(), PrivAI);
+
+llvm::BasicBlock *CodeGenIPBB = CodeGenIP.getBlock();
+llvm::Instruction *CodeGenIPInst = &*CodeGenIP.getPoint();
+EXPECT_EQ(CodeGenIPBB->getTerminator(), CodeGenIPInst);
+
+Builder.restoreIP(CodeGenIP);
+
+// collect some info for checks later
+ExitBB = FiniBB.getUniqueSuccessor();
+ThenBB = Builder.GetInsertBlock();
+EntryBB = ThenBB->getUniquePredecessor();
+
+// simple instructions for body
+Value *PrivLoad = Builder.CreateLoad(PrivAI, "local.use");
+Builder.CreateICmpNE(F->arg_begin(), PrivLoad);
+  };
+
+  auto FiniCB = [&](InsertPointTy IP) {
+BasicBlock *IPBB = IP.getBlock();
+EXPECT_NE(IPBB->end(), IP.getPoint());
+  };
+
+  Builder.restoreIP(OMPBuilder.CreateMaster(Builder, BodyGenCB, FiniCB));
+  Value *EntryBBTI = EntryBB->getTerminator();
+  EXPECT_NE(EntryBBTI, nullptr);
+  EXPECT_TRUE(isa(EntryBBTI));
+  BranchInst *EntryBr = cast(EntryBB->getTerminator());
+  EXPECT_TRUE(EntryBr->isConditional());
+  EXPECT_EQ(EntryBr->getSuccessor(0), ThenBB);
+  EXPECT_EQ(ThenBB->getUniqueSuccessor(), ExitBB);
+  EXPECT_EQ(EntryBr->getSuccessor(1), ExitBB);
+
+  CmpInst *CondInst = cast(EntryBr->getCondition());
+  EXPECT_TRUE(isa(CondInst->getOperand(0)));
+
+  CallInst *MasterEntryCI = cast(CondInst->getOperand(0));
+  EXPECT_EQ(MasterEntryCI->getNumArgOperands(), 2U);
+  EXPECT_EQ(MasterEntryCI->getCalledFunction()->getName(), "__kmpc_master");
+  EXPECT_TRUE(isa(MasterEntryCI->getArgOperand(0)));
+
+  CallInst *MasterEndCI = nullptr;
+  for (auto  : *ThenBB) {
+Instruction *cur = 
+if (isa(cur)) {
+  MasterEndCI = cast(cur);
+  if (MasterEndCI->getCalledFunction()->getName() == "__kmpc_end_master")
+break;
+  MasterEndCI = nullptr;
+}
+  }
+  EXPECT_NE(MasterEndCI, nullptr);
+  EXPECT_EQ(MasterEndCI->getNumArgOperands(), 2U);
+  EXPECT_TRUE(isa(MasterEndCI->getArgOperand(0)));
+  EXPECT_EQ(MasterEndCI->getArgOperand(1), MasterEntryCI->getArgOperand(1));
+}
+
+TEST_F(OpenMPIRBuilderTest, CriticalDirective) {
+  using InsertPointTy = OpenMPIRBuilder::InsertPointTy;
+  OpenMPIRBuilder OMPBuilder(*M);
+  OMPBuilder.initialize();
+  F->setName("func");
+  IRBuilder<> Builder(BB);
+
+  OpenMPIRBuilder::LocationDescription Loc({Builder.saveIP(), DL});
+
+  AllocaInst *PrivAI = Builder.CreateAlloca(F->arg_begin()->getType());
+
+  BasicBlock *EntryBB = nullptr;
+
+  auto BodyGenCB = [&](InsertPointTy AllocaIP, InsertPointTy CodeGenIP,
+   BasicBlock ) {
+// collect some info for checks later
+EntryBB = FiniBB.getUniquePredecessor();
+
+// actual start for bodyCB
+llvm::BasicBlock *CodeGenIPBB = CodeGenIP.getBlock();
+llvm::Instruction *CodeGenIPInst = &*CodeGenIP.getPoint();
+EXPECT_EQ(CodeGenIPBB->getTerminator(), CodeGenIPInst);
+EXPECT_EQ(EntryBB, CodeGenIPBB);
+
+// body begin
+Builder.restoreIP(CodeGenIP);
+Builder.CreateStore(F->arg_begin(), PrivAI);
+Value *PrivLoad = Builder.CreateLoad(PrivAI, "local.use");
+Builder.CreateICmpNE(F->arg_begin(), PrivLoad);
+  

[clang-tools-extra] 803ad31 - [FIX] Repair clang-tidy check after D72304

2020-02-14 Thread Johannes Doerfert via cfe-commits

Author: Johannes Doerfert
Date: 2020-02-15T01:15:45-06:00
New Revision: 803ad3137b6b81afca487e6b661460e05089699b

URL: 
https://github.com/llvm/llvm-project/commit/803ad3137b6b81afca487e6b661460e05089699b
DIFF: 
https://github.com/llvm/llvm-project/commit/803ad3137b6b81afca487e6b661460e05089699b.diff

LOG: [FIX] Repair clang-tidy check after D72304

Added: 


Modified: 
clang-tools-extra/clang-tidy/openmp/UseDefaultNoneCheck.cpp

Removed: 




diff  --git a/clang-tools-extra/clang-tidy/openmp/UseDefaultNoneCheck.cpp 
b/clang-tools-extra/clang-tidy/openmp/UseDefaultNoneCheck.cpp
index d25498d5fc55..c8a88c64c503 100644
--- a/clang-tools-extra/clang-tidy/openmp/UseDefaultNoneCheck.cpp
+++ b/clang-tools-extra/clang-tidy/openmp/UseDefaultNoneCheck.cpp
@@ -48,7 +48,7 @@ void UseDefaultNoneCheck::check(const 
MatchFinder::MatchResult ) {
  "'default(none)' clause instead")
 << getOpenMPDirectiveName(Directive->getDirectiveKind())
 << getOpenMPSimpleClauseTypeName(Clause->getClauseKind(),
- Clause->getDefaultKind());
+ unsigned(Clause->getDefaultKind()));
 diag(Clause->getBeginLoc(), "existing 'default' clause specified here",
  DiagnosticIDs::Note);
 return;



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


[clang] 7438059 - [OpenMP][OMPIRBuilder] Add Directives (master and critical) to OMPBuilder.

2020-02-14 Thread Johannes Doerfert via cfe-commits

Author: Fady Ghanim
Date: 2020-02-15T01:15:45-06:00
New Revision: 7438059a90326d4fe46377bf1833180333b48fff

URL: 
https://github.com/llvm/llvm-project/commit/7438059a90326d4fe46377bf1833180333b48fff
DIFF: 
https://github.com/llvm/llvm-project/commit/7438059a90326d4fe46377bf1833180333b48fff.diff

LOG: [OpenMP][OMPIRBuilder] Add Directives (master and critical) to OMPBuilder.

Add support for Master and Critical directive in the OMPIRBuilder. Both make 
use of a new common interface for emitting inlined OMP regions called 
`emitInlinedRegion` which was added in this patch as well.

Also this patch modifies clang to use the new directives when  
`-fopenmp-enable-irbuilder` commandline option is passed.

Reviewed By: jdoerfert

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

Added: 


Modified: 
clang/lib/CodeGen/CGStmtOpenMP.cpp
clang/test/OpenMP/critical_codegen.cpp
clang/test/OpenMP/master_codegen.cpp
llvm/include/llvm/Frontend/OpenMP/OMPConstants.h
llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
llvm/lib/Frontend/OpenMP/OMPConstants.cpp
llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp

Removed: 




diff  --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp 
b/clang/lib/CodeGen/CGStmtOpenMP.cpp
index ea9617cc82ac..d7115e00836c 100644
--- a/clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -3146,11 +3146,147 @@ static void emitMaster(CodeGenFunction , const 
OMPExecutableDirective ) {
 }
 
 void CodeGenFunction::EmitOMPMasterDirective(const OMPMasterDirective ) {
+  if (llvm::OpenMPIRBuilder *OMPBuilder = CGM.getOpenMPIRBuilder()) {
+using InsertPointTy = llvm::OpenMPIRBuilder::InsertPointTy;
+
+const CapturedStmt *CS = S.getInnermostCapturedStmt();
+const Stmt *MasterRegionBodyStmt = CS->getCapturedStmt();
+
+// TODO: Replace with a generic helper function for finalization
+auto FiniCB = [this](InsertPointTy IP) {
+  CGBuilderTy::InsertPointGuard IPG(Builder);
+  assert(IP.getBlock()->end() != IP.getPoint() &&
+ "OpenMP IR Builder should cause terminated block!");
+
+  llvm::BasicBlock *IPBB = IP.getBlock();
+  llvm::BasicBlock *DestBB = IPBB->getUniqueSuccessor();
+  assert(DestBB && "Finalization block should have one successor!");
+
+  // erase and replace with cleanup branch.
+  IPBB->getTerminator()->eraseFromParent();
+  Builder.SetInsertPoint(IPBB);
+  CodeGenFunction::JumpDest Dest = getJumpDestInCurrentScope(DestBB);
+  EmitBranchThroughCleanup(Dest);
+};
+
+// TODO: Replace with a generic helper function for emitting body
+auto BodyGenCB = [MasterRegionBodyStmt, this](InsertPointTy AllocaIP,
+  InsertPointTy CodeGenIP,
+  llvm::BasicBlock ) {
+  // Alloca insertion block should be in the entry block of the containing
+  // function So it expects an empty AllocaIP in which case will reuse the
+  // old alloca insertion point, or a new AllocaIP in the same block as the
+  // old one
+  assert((!AllocaIP.isSet() ||
+  AllocaInsertPt->getParent() == AllocaIP.getBlock()) &&
+ "Insertion point should be in the entry block of containing "
+ "function!");
+  auto OldAllocaIP = AllocaInsertPt;
+  if (AllocaIP.isSet())
+AllocaInsertPt = &*AllocaIP.getPoint();
+  auto OldReturnBlock = ReturnBlock;
+  ReturnBlock = getJumpDestInCurrentScope();
+
+  llvm::BasicBlock *CodeGenIPBB = CodeGenIP.getBlock();
+  if (llvm::Instruction *CodeGenIPBBTI = CodeGenIPBB->getTerminator())
+CodeGenIPBBTI->eraseFromParent();
+
+  Builder.SetInsertPoint(CodeGenIPBB);
+
+  EmitStmt(MasterRegionBodyStmt);
+
+  if (Builder.saveIP().isSet())
+Builder.CreateBr();
+
+  AllocaInsertPt = OldAllocaIP;
+  ReturnBlock = OldReturnBlock;
+};
+CGCapturedStmtInfo CGSI(*CS, CR_OpenMP);
+CodeGenFunction::CGCapturedStmtRAII CapInfoRAII(*this, );
+Builder.restoreIP(OMPBuilder->CreateMaster(Builder, BodyGenCB, FiniCB));
+
+return;
+  }
   OMPLexicalScope Scope(*this, S, OMPD_unknown);
   emitMaster(*this, S);
 }
 
 void CodeGenFunction::EmitOMPCriticalDirective(const OMPCriticalDirective ) {
+  if (llvm::OpenMPIRBuilder *OMPBuilder = CGM.getOpenMPIRBuilder()) {
+using InsertPointTy = llvm::OpenMPIRBuilder::InsertPointTy;
+
+const CapturedStmt *CS = S.getInnermostCapturedStmt();
+const Stmt *CriticalRegionBodyStmt = CS->getCapturedStmt();
+const Expr *Hint = nullptr;
+if (const auto *HintClause = S.getSingleClause())
+  Hint = HintClause->getHint();
+
+// TODO: This is slightly 
diff erent from what's currently being done in
+// clang. Fix the Int32Ty to 

[PATCH] D74513: [OpenMP][NFCI] Use the libFrontend DefaultKind in Clang

2020-02-14 Thread Johannes Doerfert via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG577c9b02ab57: [OpenMP][NFCI] Use the libFrontend DefaultKind 
in Clang (authored by atmnpatel, committed by jdoerfert).

Changed prior to commit:
  https://reviews.llvm.org/D74513?vs=244334=244815#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74513

Files:
  clang/include/clang/AST/OpenMPClause.h
  clang/include/clang/ASTMatchers/ASTMatchers.h
  clang/include/clang/Basic/OpenMPKinds.def
  clang/include/clang/Basic/OpenMPKinds.h
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/OpenMPClause.cpp
  clang/lib/Basic/OpenMPKinds.cpp
  clang/lib/Sema/SemaOpenMP.cpp
  clang/lib/Sema/TreeTransform.h
  clang/lib/Serialization/ASTReader.cpp
  clang/lib/Serialization/ASTWriter.cpp
  llvm/include/llvm/Frontend/OpenMP/OMPConstants.h
  llvm/include/llvm/Frontend/OpenMP/OMPKinds.def

Index: llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
===
--- llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
+++ llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
@@ -344,6 +344,25 @@
 
 ///}
 
+/// Default kinds
+///
+///{
+
+#ifndef OMP_DEFAULT_KIND
+#define OMP_DEFAULT_KIND(Enum, Str)
+#endif
+
+#define __OMP_DEFAULT_KIND(Name) OMP_DEFAULT_KIND(OMP_DEFAULT_##Name, #Name)
+
+__OMP_DEFAULT_KIND(none)
+__OMP_DEFAULT_KIND(shared)
+__OMP_DEFAULT_KIND(unknown)
+
+#undef __OMP_DEFAULT_KIND
+#undef OMP_DEFAULT_KIND
+
+///}
+
 /// Proc bind kinds
 ///
 ///{
Index: llvm/include/llvm/Frontend/OpenMP/OMPConstants.h
===
--- llvm/include/llvm/Frontend/OpenMP/OMPConstants.h
+++ llvm/include/llvm/Frontend/OpenMP/OMPConstants.h
@@ -49,6 +49,16 @@
 #define OMP_RTL(Enum, ...) constexpr auto Enum = omp::RuntimeFunction::Enum;
 #include "llvm/Frontend/OpenMP/OMPKinds.def"
 
+/// IDs for the different default kinds.
+enum class DefaultKind {
+#define OMP_DEFAULT_KIND(Enum, Str) Enum,
+#include "llvm/Frontend/OpenMP/OMPKinds.def"
+};
+
+#define OMP_DEFAULT_KIND(Enum, ...)\
+  constexpr auto Enum = omp::DefaultKind::Enum;
+#include "llvm/Frontend/OpenMP/OMPKinds.def"
+
 /// IDs for the different proc bind kinds.
 enum class ProcBindKind {
 #define OMP_PROC_BIND_KIND(Enum, Str, Value) Enum = Value,
Index: clang/lib/Serialization/ASTWriter.cpp
===
--- clang/lib/Serialization/ASTWriter.cpp
+++ clang/lib/Serialization/ASTWriter.cpp
@@ -6097,7 +6097,7 @@
 }
 
 void OMPClauseWriter::VisitOMPDefaultClause(OMPDefaultClause *C) {
-  Record.push_back(C->getDefaultKind());
+  Record.push_back(unsigned(C->getDefaultKind()));
   Record.AddSourceLocation(C->getLParenLoc());
   Record.AddSourceLocation(C->getDefaultKindKwLoc());
 }
Index: clang/lib/Serialization/ASTReader.cpp
===
--- clang/lib/Serialization/ASTReader.cpp
+++ clang/lib/Serialization/ASTReader.cpp
@@ -11887,8 +11887,7 @@
 }
 
 void OMPClauseReader::VisitOMPDefaultClause(OMPDefaultClause *C) {
-  C->setDefaultKind(
-   static_cast(Record.readInt()));
+  C->setDefaultKind(static_cast(Record.readInt()));
   C->setLParenLoc(Record.readSourceLocation());
   C->setDefaultKindKwLoc(Record.readSourceLocation());
 }
Index: clang/lib/Sema/TreeTransform.h
===
--- clang/lib/Sema/TreeTransform.h
+++ clang/lib/Sema/TreeTransform.h
@@ -1602,8 +1602,7 @@
   ///
   /// By default, performs semantic analysis to build the new OpenMP clause.
   /// Subclasses may override this routine to provide different behavior.
-  OMPClause *RebuildOMPDefaultClause(OpenMPDefaultClauseKind Kind,
- SourceLocation KindKwLoc,
+  OMPClause *RebuildOMPDefaultClause(DefaultKind Kind, SourceLocation KindKwLoc,
  SourceLocation StartLoc,
  SourceLocation LParenLoc,
  SourceLocation EndLoc) {
Index: clang/lib/Sema/SemaOpenMP.cpp
===
--- clang/lib/Sema/SemaOpenMP.cpp
+++ clang/lib/Sema/SemaOpenMP.cpp
@@ -12009,9 +12009,8 @@
   OMPClause *Res = nullptr;
   switch (Kind) {
   case OMPC_default:
-Res =
-ActOnOpenMPDefaultClause(static_cast(Argument),
- ArgumentLoc, StartLoc, LParenLoc, EndLoc);
+Res = ActOnOpenMPDefaultClause(static_cast(Argument),
+   ArgumentLoc, StartLoc, LParenLoc, EndLoc);
 break;
   case OMPC_proc_bind:
 Res = ActOnOpenMPProcBindClause(static_cast(Argument),
@@ -12114,31 +12113,23 @@
   return std::string(Out.str());
 }
 
-OMPClause *Sema::ActOnOpenMPDefaultClause(OpenMPDefaultClauseKind Kind,
+OMPClause 

[clang] 5313abd - [OpenMP][NFC] Update OpenMPSupport table

2020-02-14 Thread Johannes Doerfert via cfe-commits

Author: Johannes Doerfert
Date: 2020-02-15T00:40:39-06:00
New Revision: 5313abdbca802d842ba1d27729420d186f653a2d

URL: 
https://github.com/llvm/llvm-project/commit/5313abdbca802d842ba1d27729420d186f653a2d
DIFF: 
https://github.com/llvm/llvm-project/commit/5313abdbca802d842ba1d27729420d186f653a2d.diff

LOG: [OpenMP][NFC] Update OpenMPSupport table

Added: 


Modified: 
clang/docs/OpenMPSupport.rst

Removed: 




diff  --git a/clang/docs/OpenMPSupport.rst b/clang/docs/OpenMPSupport.rst
index 91e1de61b456..49659e9bd5bd 100644
--- a/clang/docs/OpenMPSupport.rst
+++ b/clang/docs/OpenMPSupport.rst
@@ -229,13 +229,13 @@ implementation.
 
+--+--+--+---+
 | misc extension   | library shutdown (omp_pause_resource[_all])   
   | :none:`unclaimed parts`  | D55078  
  |
 
+--+--+--+---+
-| misc extension   | metadirectives
   | :none:`worked on`| 
  |
+| misc extension   | metadirectives
   | :part:`worked on`| 
  |
 
+--+--+--+---+
 | misc extension   | conditional modifier for lastprivate clause   
   | :good:`done` | 
  |
 
+--+--+--+---+
 | misc extension   | iterator and multidependences 
   | :part:`claimed`  | 
  |
 
+--+--+--+---+
-| misc extension   | user-defined function variants
   | :part:`worked on`| D67294, D64095  
  |
+| misc extension   | user-defined function variants
   | :part:`worked on`| D67294, D64095, D71847, D71830  
  |
 
+--+--+--+---+
 | misc extension   | pointer/reference to pointer based array 
reductions  | :none:`unclaimed`|
   |
 
+--+--+--+---+
@@ -258,5 +258,7 @@ want to help with the implementation.
 
+==+==+==+===+
 | misc extension   | user-defined function variants with #ifdef 
protection| :part:`worked on`| D71179   
 |
 
+--+--+--+---+
+| misc extension   | default(firstprivate) & default(private)  
   | :part:`worked on`| 
  |
++--+--+--+---+
 | loop extension   | Loop tiling transformation
   | :part:`claimed`  | 
  |
 

[clang] 577c9b0 - [OpenMP][NFCI] Use the libFrontend DefaultKind in Clang

2020-02-14 Thread Johannes Doerfert via cfe-commits

Author: Atmn Patel
Date: 2020-02-15T00:38:12-06:00
New Revision: 577c9b02ab572b7767420a34b4de8d5e19347117

URL: 
https://github.com/llvm/llvm-project/commit/577c9b02ab572b7767420a34b4de8d5e19347117
DIFF: 
https://github.com/llvm/llvm-project/commit/577c9b02ab572b7767420a34b4de8d5e19347117.diff

LOG: [OpenMP][NFCI] Use the libFrontend DefaultKind in Clang

This swaps out the OpenMPDefaultClauseKind enum with a
llvm::omp::DefaultKind enum which is stored in OMPConstants.h.

This should not change any functionality.

Reviewed By: jdoerfert

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

Added: 


Modified: 
clang/include/clang/AST/OpenMPClause.h
clang/include/clang/ASTMatchers/ASTMatchers.h
clang/include/clang/Basic/OpenMPKinds.def
clang/include/clang/Basic/OpenMPKinds.h
clang/include/clang/Sema/Sema.h
clang/lib/AST/OpenMPClause.cpp
clang/lib/Basic/OpenMPKinds.cpp
clang/lib/Sema/SemaOpenMP.cpp
clang/lib/Sema/TreeTransform.h
clang/lib/Serialization/ASTReader.cpp
clang/lib/Serialization/ASTWriter.cpp
llvm/include/llvm/Frontend/OpenMP/OMPConstants.h
llvm/include/llvm/Frontend/OpenMP/OMPKinds.def

Removed: 




diff  --git a/clang/include/clang/AST/OpenMPClause.h 
b/clang/include/clang/AST/OpenMPClause.h
index ec470100f4ca..a3831fd5950f 100644
--- a/clang/include/clang/AST/OpenMPClause.h
+++ b/clang/include/clang/AST/OpenMPClause.h
@@ -867,7 +867,7 @@ class OMPDefaultClause : public OMPClause {
   SourceLocation LParenLoc;
 
   /// A kind of the 'default' clause.
-  OpenMPDefaultClauseKind Kind = OMPC_DEFAULT_unknown;
+  llvm::omp::DefaultKind Kind = llvm::omp::OMP_DEFAULT_unknown;
 
   /// Start location of the kind in source code.
   SourceLocation KindKwLoc;
@@ -875,7 +875,7 @@ class OMPDefaultClause : public OMPClause {
   /// Set kind of the clauses.
   ///
   /// \param K Argument of clause.
-  void setDefaultKind(OpenMPDefaultClauseKind K) { Kind = K; }
+  void setDefaultKind(llvm::omp::DefaultKind K) { Kind = K; }
 
   /// Set argument location.
   ///
@@ -890,7 +890,7 @@ class OMPDefaultClause : public OMPClause {
   /// \param StartLoc Starting location of the clause.
   /// \param LParenLoc Location of '('.
   /// \param EndLoc Ending location of the clause.
-  OMPDefaultClause(OpenMPDefaultClauseKind A, SourceLocation ALoc,
+  OMPDefaultClause(llvm::omp::DefaultKind A, SourceLocation ALoc,
SourceLocation StartLoc, SourceLocation LParenLoc,
SourceLocation EndLoc)
   : OMPClause(OMPC_default, StartLoc, EndLoc), LParenLoc(LParenLoc),
@@ -907,7 +907,7 @@ class OMPDefaultClause : public OMPClause {
   SourceLocation getLParenLoc() const { return LParenLoc; }
 
   /// Returns kind of the clause.
-  OpenMPDefaultClauseKind getDefaultKind() const { return Kind; }
+  llvm::omp::DefaultKind getDefaultKind() const { return Kind; }
 
   /// Returns location of clause kind.
   SourceLocation getDefaultKindKwLoc() const { return KindKwLoc; }

diff  --git a/clang/include/clang/ASTMatchers/ASTMatchers.h 
b/clang/include/clang/ASTMatchers/ASTMatchers.h
index 122a92093a8c..5565417c7c1f 100644
--- a/clang/include/clang/ASTMatchers/ASTMatchers.h
+++ b/clang/include/clang/ASTMatchers/ASTMatchers.h
@@ -7049,7 +7049,7 @@ extern const 
internal::VariadicDynCastAllOfMatcher
 ///
 /// ``ompDefaultClause(isNoneKind())`` matches only ``default(none)``.
 AST_MATCHER(OMPDefaultClause, isNoneKind) {
-  return Node.getDefaultKind() == OMPC_DEFAULT_none;
+  return Node.getDefaultKind() == llvm::omp::OMP_DEFAULT_none;
 }
 
 /// Matches if the OpenMP ``default`` clause has ``shared`` kind specified.
@@ -7064,7 +7064,7 @@ AST_MATCHER(OMPDefaultClause, isNoneKind) {
 ///
 /// ``ompDefaultClause(isSharedKind())`` matches only ``default(shared)``.
 AST_MATCHER(OMPDefaultClause, isSharedKind) {
-  return Node.getDefaultKind() == OMPC_DEFAULT_shared;
+  return Node.getDefaultKind() == llvm::omp::OMP_DEFAULT_shared;
 }
 
 /// Matches if the OpenMP directive is allowed to contain the specified OpenMP

diff  --git a/clang/include/clang/Basic/OpenMPKinds.def 
b/clang/include/clang/Basic/OpenMPKinds.def
index 3ab69a1bb3f1..f2913fe8e9bb 100644
--- a/clang/include/clang/Basic/OpenMPKinds.def
+++ b/clang/include/clang/Basic/OpenMPKinds.def
@@ -107,9 +107,6 @@
 #ifndef OPENMP_DISTRIBUTE_CLAUSE
 #define OPENMP_DISTRIBUTE_CLAUSE(Name)
 #endif
-#ifndef OPENMP_DEFAULT_KIND
-#  define OPENMP_DEFAULT_KIND(Name)
-#endif
 #ifndef OPENMP_SCHEDULE_KIND
 #define OPENMP_SCHEDULE_KIND(Name)
 #endif
@@ -351,10 +348,6 @@ OPENMP_SINGLE_CLAUSE(allocate)
 // Clauses allowed for OpenMP directive 'cancel'.
 OPENMP_CANCEL_CLAUSE(if)
 
-// Static attributes for 'default' clause.
-OPENMP_DEFAULT_KIND(none)
-OPENMP_DEFAULT_KIND(shared)
-
 // Static attributes for 'schedule' clause.
 OPENMP_SCHEDULE_KIND(static)
 OPENMP_SCHEDULE_KIND(dynamic)
@@ -1103,7 +1096,6 @@ 

[PATCH] D74571: [OpenMP][CUDA] Add CUDA 10.2 support

2020-02-14 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert added a comment.

In D74571#1877000 , @kkwli0 wrote:

> > I am not sure I understand. Do we need to modify stuff outside of 
> > `/openmp`? I was hoping it is our CMake that can be adjusted to make this 
> > work as described earlier. TBH, he warning is even not my biggest problem. 
> > As long as we get a libomptarget.bc we should be fine.
>
> @jdoerfert  Yes.  The warning message affects the outcome of another test in 
> cmake.  With the approach of ignoring the warning message, we need to modify 
> stuff outside of `/openmp`.  For me, I don't mind to have the warning 
> messages all over the places.  The problem we have here is unable to build 
> libomp.so.


I was naively hoping we can say `-Wno-unknown-cuda-version` somewhere "early" 
in `openmp/CMake...` to ensure we can build the runtime.


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

https://reviews.llvm.org/D74571



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


[PATCH] D74562: [OpenMP][OMPIRBuilder] Introducing the `OMPBuilderCBHelpers` helper class

2020-02-14 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert added a comment.

This is great, thanks a lot! I only have two comments where I am not sure I 
understand the code/change.




Comment at: clang/lib/CodeGen/CGStmtOpenMP.cpp:3134
 
 // TODO: Replace with a generic helper function for emitting body
 auto BodyGenCB = [MasterRegionBodyStmt, this](InsertPointTy AllocaIP,

These TODOs are now obsolete ;)



Comment at: clang/lib/CodeGen/CodeGenFunction.h:354
+
+FinilizationBlock = CGF.getJumpDestInCurrentScope();
+  }

Don't we have to set/reset the `CGF.ReturnBlock` ? If not, why do we need 
`FinilizationBlock` here?



Comment at: clang/test/OpenMP/parallel_codegen.cpp:143
 // CHECK-DEBUG:   define internal void [[OMP_OUTLINED_DEBUG:@.+]](i32* 
noalias %.global_tid., i32* noalias %.bound_tid., i8*** 
dereferenceable({{4|8}}) %argc, i64 %{{.+}})
-// IRBUILDER-DEBUG:   define internal void [[OMP_OUTLINED_DEBUG:@.+]](i32* 
noalias %{{.*}}, i32* noalias %{{.*}}, i8*** [[ARGC_REF:%.*]], i64 %{{.+}})
+// IRBUILDER-DEBUG:   define internal void [[OMP_OUTLINED_DEBUG:@.+]](i32* 
noalias %{{.*}}, i32* noalias %{{.*}}, i8*** [[ARGC_REF:%.*]], double** 
[[VAR]], i64 %{{.+}})
 // CHECK-DEBUG:   store i8*** %argc, i8 [[ARGC_PTR_ADDR:%.+]],

Do you know why this changed? Is this variable used in the parallel region?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74562



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


[PATCH] D69471: [Coverage] Revise format to reduce binary size

2020-02-14 Thread Vedant Kumar via Phabricator via cfe-commits
vsk updated this revision to Diff 244790.
vsk added a comment.

Rebase.

Sorry this hasn't seen any update: at this point in our release cycle I've had 
to put this on the back burner.


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

https://reviews.llvm.org/D69471

Files:
  clang/lib/CodeGen/CoverageMappingGen.cpp
  clang/lib/CodeGen/CoverageMappingGen.h
  clang/test/CoverageMapping/abspath.cpp
  clang/test/CoverageMapping/ir.c
  clang/test/Profile/def-assignop.cpp
  clang/test/Profile/def-ctors.cpp
  clang/test/Profile/def-dtors.cpp
  compiler-rt/include/profile/InstrProfData.inc
  llvm/docs/CoverageMappingFormat.rst
  llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h
  llvm/include/llvm/ProfileData/Coverage/CoverageMappingReader.h
  llvm/include/llvm/ProfileData/Coverage/CoverageMappingWriter.h
  llvm/include/llvm/ProfileData/InstrProf.h
  llvm/include/llvm/ProfileData/InstrProfData.inc
  llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
  llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
  llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp
  llvm/lib/ProfileData/Coverage/CoverageMappingWriter.cpp
  llvm/lib/ProfileData/InstrProf.cpp
  llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
  llvm/test/Instrumentation/InstrProfiling/X86/alloc.ll
  llvm/test/tools/llvm-cov/Inputs/binary-formats.v3.macho64l
  llvm/test/tools/llvm-cov/binary-formats.c
  llvm/unittests/ProfileData/CoverageMappingTest.cpp

Index: llvm/unittests/ProfileData/CoverageMappingTest.cpp
===
--- llvm/unittests/ProfileData/CoverageMappingTest.cpp
+++ llvm/unittests/ProfileData/CoverageMappingTest.cpp
@@ -895,4 +895,29 @@
   std::pair({true, false}),
   std::pair({true, true})),);
 
+TEST(CoverageMappingTest, filename_roundtrip) {
+  std::vector Paths({"a", "b", "c", "d", "e"});
+
+  for (bool Compress : {false, true}) {
+std::string EncodedFilenames;
+{
+  raw_string_ostream OS(EncodedFilenames);
+  CoverageFilenamesSectionWriter Writer(Paths);
+  Writer.write(OS, Compress);
+}
+
+std::vector ReadFilenames;
+RawCoverageFilenamesReader Reader(EncodedFilenames, ReadFilenames);
+BinaryCoverageReader::DecompressedData Decompressed;
+EXPECT_THAT_ERROR(Reader.read(CovMapVersion::CurrentVersion, Decompressed),
+  Succeeded());
+if (!Compress)
+  ASSERT_EQ(Decompressed.size(), 0U);
+
+ASSERT_EQ(ReadFilenames.size(), Paths.size());
+for (unsigned I = 0; I < Paths.size(); ++I)
+  ASSERT_TRUE(ReadFilenames[I] == Paths[I]);
+  }
+}
+
 } // end anonymous namespace
Index: llvm/test/tools/llvm-cov/binary-formats.c
===
--- llvm/test/tools/llvm-cov/binary-formats.c
+++ llvm/test/tools/llvm-cov/binary-formats.c
@@ -7,5 +7,6 @@
 // RUN: llvm-cov show %S/Inputs/binary-formats.macho32l -instr-profile %t.profdata -path-equivalence=/tmp,%S %s | FileCheck %s
 // RUN: llvm-cov show %S/Inputs/binary-formats.macho64l -instr-profile %t.profdata -path-equivalence=/tmp,%S %s | FileCheck %s
 // RUN: llvm-cov show %S/Inputs/binary-formats.macho32b -instr-profile %t.profdata -path-equivalence=/tmp,%S %s | FileCheck %s
+// RUN: llvm-cov show %S/Inputs/binary-formats.v3.macho64l -instr-profile %t.profdata -path-equivalence=/tmp,%S %s | FileCheck %s
 
 // RUN: llvm-cov export %S/Inputs/binary-formats.macho64l -instr-profile %t.profdata | FileCheck %S/Inputs/binary-formats.canonical.json
Index: llvm/test/Instrumentation/InstrProfiling/X86/alloc.ll
===
--- llvm/test/Instrumentation/InstrProfiling/X86/alloc.ll
+++ llvm/test/Instrumentation/InstrProfiling/X86/alloc.ll
@@ -1,6 +1,8 @@
 ;; Ensure that SHF_ALLOC section flag is not set for the __llvm_covmap section on Linux.
 ; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu | FileCheck %s
 
+@covfun = linkonce_odr hidden constant i32 0, section "__llvm_covfun"
 @__llvm_coverage_mapping = internal constant i32 0, section "__llvm_covmap"
 
+; CHECK-DAG: .section	__llvm_covfun,""
 ; CHECK-DAG: .section	__llvm_covmap,""
Index: llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
===
--- llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
+++ llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
@@ -74,10 +74,6 @@
 
 namespace {
 
-cl::opt DoNameCompression("enable-name-compression",
-cl::desc("Enable name string compression"),
-cl::init(true));
-
 cl::opt DoHashBasedCounterSplit(
 "hash-based-counter-split",
 cl::desc("Rename counter variable of a comdat function based on cfg hash"),
@@ -973,7 +969,7 @@
 
   std::string CompressedNameStr;
   if (Error E = collectPGOFuncNameStrings(ReferencedNames, 

[PATCH] D69868: Allow "callbr" to return non-void values

2020-02-14 Thread Bill Wendling via Phabricator via cfe-commits
void added a comment.

Another friendly ping. :-)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69868



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


[PATCH] D73755: [objc_direct] Small updates to help with adoption.

2020-02-14 Thread Erik Pilkington via Phabricator via cfe-commits
erik.pilkington accepted this revision.
erik.pilkington added a comment.
This revision is now accepted and ready to land.

LGTM, thanks.




Comment at: clang/lib/Sema/SemaObjCProperty.cpp:2436
+  if (!GetterMethod) {
+if (const ObjCCategoryDecl *CatDecl = dyn_cast(CD)) {
+  auto *ExistingGetter = CatDecl->getClassInterface()->lookupMethod(

MadCoder wrote:
> erik.pilkington wrote:
> > Just to be clear: so we need this check because the getter/setters of a 
> > property declared in a category aren't considered to override any 
> > getters/setters of the extended class, so the existing 
> > CheckObjCMethodOverrides checks below don't work?
> not quite, it's because people do things like this:
> 
> ```
> @interface Foo (Cat)
> @property int bar;
> @end
> ```
> 
> But implement the property in the main `@implementation` (or the other way 
> around) and this is not considered as overrides today, or even worse, many 
> many times the Category doesn't even have a corresponding `@implementation` 
> anywhere. Tthere's one direction of this that has a possible optional warning 
> though today in the compiler.
> 
> But direct method resolution requires to not cross streams else the incorrect 
> symbol is formed (because the category is an actual different namespace). 
> With dynamism it actually doesn't matter which is why the compiler doesn't 
> care today.
Okay, thanks for clarifying.


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

https://reviews.llvm.org/D73755



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


[clang] 859654c - [FIX] Add missing InGroup to warning introduced as part of D71830

2020-02-14 Thread Johannes Doerfert via cfe-commits

Author: Johannes Doerfert
Date: 2020-02-14T17:22:40-06:00
New Revision: 859654c065583a320d3621d22a09cad89abfc3e9

URL: 
https://github.com/llvm/llvm-project/commit/859654c065583a320d3621d22a09cad89abfc3e9
DIFF: 
https://github.com/llvm/llvm-project/commit/859654c065583a320d3621d22a09cad89abfc3e9.diff

LOG: [FIX] Add missing InGroup to warning introduced as part of D71830

Added: 


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

Removed: 




diff  --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td 
b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index afaafb1daf8d..70897cb2816b 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -9912,7 +9912,8 @@ def err_omp_declare_variant_incompat_attributes : Error<
   "'#pragma omp declare variant' is not compatible with any target-specific 
attributes">;
 def warn_omp_declare_variant_score_not_constant
 : Warning<"score expressions in the OpenMP context selector need to be "
-  "constant; %0 is not and will be ignored">;
+  "constant; %0 is not and will be ignored">,
+  InGroup;
 def err_omp_declare_variant_user_condition_not_constant
 : Error<"the user condition in the OpenMP context selector needs to be "
 "constant; %0 is not">;



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


[PATCH] D69471: [Coverage] Revise format to reduce binary size

2020-02-14 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added a comment.

I haven't forgotten about this, even though it's been two months. Hopefully I 
get to it soon.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69471



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


[PATCH] D74436: Change clang option -ffp-model=precise to select ffp-contract=on

2020-02-14 Thread Dávid Bolvanský via Phabricator via cfe-commits
xbolva00 added a comment.

>> Perhaps we can also see what the defaults are for GCC and unify with those?

+1


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74436



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


[PATCH] D74436: Change clang option -ffp-model=precise to select ffp-contract=on

2020-02-14 Thread Andy Kaylor via Phabricator via cfe-commits
andrew.w.kaylor added a comment.

In D74436#1875315 , @nemanjai wrote:

> > You're right, -O0 shouldn't generate FMA. I'm preparing to revert this now 
> > -- just verifying the build.
>
> Perhaps this should be
>  `off` with no optimization
>  `on` with `-O1/-O2/-O3/-Os/-Oz`
>  `fast` with fast math
>
> Just a suggestion, I'm not sure whether that would be the best breakdown. 
> Perhaps we can also see what the defaults are for GCC and unify with those?


GCC doesn't support "on" so I'm not sure it's possible to distinguish their 
intentions. I think it would be better to define what we think is best for 
clang and encourage GCC to unify with that.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74436



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


[PATCH] D74631: [clang][XCOFF] Indicate that XCOFF does not support COMDATs

2020-02-14 Thread Xiangling Liao via Phabricator via cfe-commits
Xiangling_L added a comment.

In D74631#1876995 , @sfertile wrote:

>




> Will we report an error somewhere in the backend if we encounter a COMDAT?

I hit this when I was doing my static init patch as well:  `error in backend: 
COMDAT not yet supported by AIX.`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74631



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


[PATCH] D73755: [objc_direct] Small updates to help with adoption.

2020-02-14 Thread Pierre Habouzit via Phabricator via cfe-commits
MadCoder added inline comments.



Comment at: clang/lib/Sema/SemaObjCProperty.cpp:1630-1637
+  if (PIDecl->getPropertyImplementation() == ObjCPropertyImplDecl::Dynamic &&
+  PIDecl->getPropertyDecl() &&
+  PIDecl->getPropertyDecl()->isDirectProperty()) {
+Diag(PropertyLoc, diag::err_objc_direct_dynamic_property) << PropertyId;
+Diag(PIDecl->getPropertyDecl()->getLocation(),
+ diag::note_previous_declaration);
+return nullptr;

erik.pilkington wrote:
> Would you mind adding a test for this diagnostic? It looks like 
> err_objc_direct_dynamic_property doesn't take a parameter too, so there isn't 
> any reason to do `<< PropertyId` unless you add one.
there were some, I forgot to add the test case to the commit ...



Comment at: clang/lib/Sema/SemaObjCProperty.cpp:2436
+  if (!GetterMethod) {
+if (const ObjCCategoryDecl *CatDecl = dyn_cast(CD)) {
+  auto *ExistingGetter = CatDecl->getClassInterface()->lookupMethod(

erik.pilkington wrote:
> Just to be clear: so we need this check because the getter/setters of a 
> property declared in a category aren't considered to override any 
> getters/setters of the extended class, so the existing 
> CheckObjCMethodOverrides checks below don't work?
not quite, it's because people do things like this:

```
@interface Foo (Cat)
@property int bar;
@end
```

But implement the property in the main `@implementation` (or the other way 
around) and this is not considered as overrides today, or even worse, many many 
times the Category doesn't even have a corresponding `@implementation` 
anywhere. Tthere's one direction of this that has a possible optional warning 
though today in the compiler.

But direct method resolution requires to not cross streams else the incorrect 
symbol is formed (because the category is an actual different namespace). With 
dynamism it actually doesn't matter which is why the compiler doesn't care 
today.


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

https://reviews.llvm.org/D73755



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


[PATCH] D73755: [objc_direct] Small updates to help with adoption.

2020-02-14 Thread Pierre Habouzit via Phabricator via cfe-commits
MadCoder updated this revision to Diff 244773.
MadCoder marked 10 inline comments as done.
MadCoder added a comment.

@erik.pilkington review feedback


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

https://reviews.llvm.org/D73755

Files:
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/AttrDocs.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Sema/SemaDeclObjC.cpp
  clang/lib/Sema/SemaExprObjC.cpp
  clang/lib/Sema/SemaObjCProperty.cpp
  clang/test/FixIt/fixit-objc-direct.m
  clang/test/Misc/pragma-attribute-supported-attributes-list.test
  clang/test/SemaObjC/category-direct-properties.m
  clang/test/SemaObjC/dynamic-direct-properties.m
  clang/test/SemaObjC/method-direct.m

Index: clang/test/SemaObjC/method-direct.m
===
--- clang/test/SemaObjC/method-direct.m
+++ clang/test/SemaObjC/method-direct.m
@@ -18,6 +18,7 @@
 + (void)classRootDirect __attribute__((objc_direct)); // expected-note {{previous declaration is here}};
 - (void)otherRootDirect __attribute__((objc_direct)); // expected-note {{direct method 'otherRootDirect' declared here}}
 + (void)otherClassRootDirect __attribute__((objc_direct)); // expected-note {{direct method 'otherClassRootDirect' declared here}}
++ (void)otherOtherClassRootDirect __attribute__((objc_direct)); // expected-note {{direct method 'otherOtherClassRootDirect' declared here}}
 - (void)notDirectInIface; // expected-note {{previous declaration is here}}
 + (void)classNotDirectInIface;// expected-note {{previous declaration is here}}
 @end
@@ -48,8 +49,9 @@
 + (void)classRootCategoryDirect2 __attribute__((objc_direct)); // expected-note {{previous declaration is here}}
 @end
 
-__attribute__((objc_root_class, objc_direct_members)) // expected-error {{'objc_direct_members' attribute only applies to Objective-C implementation declarations and Objective-C containers}}
-@interface SubDirectFail : Root
+__attribute__((objc_direct_members))
+@interface SubDirectMembers : Root
+@property int foo; // expected-note {{previous declaration is here}}
 - (instancetype)init;
 @end
 
@@ -94,6 +96,8 @@
 + (void)otherClassRootDirect {
   [self someRootDirectMethod]; // expected-error {{messaging a Class with a method that is possibly direct}}
 }
++ (void)otherOtherClassRootDirect {
+}
 - (void)rootExtensionDirect {
 }
 + (void)classRootExtensionDirect {
@@ -135,6 +139,16 @@
 - (void)someValidSubMethod {
   [super otherRootDirect]; // expected-error {{messaging super with a direct method}}
 }
++ (void)someValidSubMethod {
+  [super otherOtherClassRootDirect]; // expected-error {{messaging super with a direct method}}
+}
+@end
+
+@implementation SubDirectMembers
+@dynamic foo; // expected-error {{direct property cannot be @dynamic}}
+- (instancetype)init {
+  return self;
+}
 @end
 
 extern void callMethod(id obj, Class cls);
Index: clang/test/SemaObjC/dynamic-direct-properties.m
===
--- /dev/null
+++ clang/test/SemaObjC/dynamic-direct-properties.m
@@ -0,0 +1,22 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -Wselector-type-mismatch %s
+
+__attribute__((objc_root_class))
+@interface Foo
+@property() int dynamic_property;
+@property(direct) int direct_property; // expected-note {{previous declaration is here}}
+@end
+
+@implementation Foo
+@dynamic dynamic_property;
+@dynamic direct_property; // expected-error {{direct property cannot be @dynamic}}
+@end
+
+@interface Foo (Bar)
+@property() int dynamic_category_property;
+@property(direct) int direct_category_property; // expected-note {{previous declaration is here}}
+@end
+
+@implementation Foo (Bar)
+@dynamic dynamic_category_property;
+@dynamic direct_category_property; // expected-error {{direct property cannot be @dynamic}}
+@end
Index: clang/test/SemaObjC/category-direct-properties.m
===
--- /dev/null
+++ clang/test/SemaObjC/category-direct-properties.m
@@ -0,0 +1,273 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -Wselector-type-mismatch %s
+
+__attribute__((objc_root_class))
+@interface Inteface_Implementation
+@property(nonatomic, readonly) int normal_normal;
+@property(nonatomic, readonly, direct) int direct_normal;
+@property(nonatomic, readonly) int normal_direct; // expected-note {{previous declaration is here}}
+@property(nonatomic, readonly, direct) int direct_direct;
+@end
+
+@implementation Inteface_Implementation
+- (int)normal_normal {
+  return 42;
+}
+- (int)direct_normal {
+  return 42;
+}
+- (int)normal_direct __attribute__((objc_direct)) { // expected-error {{direct method implementation was previously declared not direct}}
+  return 42;
+}
+- (int)direct_direct __attribute__((objc_direct)) {
+  return 42;
+}
+@end
+
+__attribute__((objc_root_class))
+@interface Inteface_Extension
+@property(nonatomic, readonly) int normal_normal;

[PATCH] D74643: [Parse] Consider attributes in `TryParsePtrOperatorSeq`.

2020-02-14 Thread Michele Scandale via Phabricator via cfe-commits
michele.scandale created this revision.
michele.scandale added reviewers: rjmccall, rsmith.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
michele.scandale updated this revision to Diff 244756.
michele.scandale added a comment.

Missed GNU style attributes


The syntax rules for `ptr-operator` allow attributes after `*`, `&`,
`&&`, therefore we should be able to parse the following:

  void fn() {
  void (*[[attr]] x)() = 
  void (&[[attr]] y)() = fn;
  void (&&[[attr]] z)() = fn;
  }

However the current logic in `TryParsePtrOperatorSeq` does not consider
the presence of attributes leading to unexpected parsing errors.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D74643

Files:
  clang/lib/Parse/ParseTentative.cpp
  clang/test/CXX/dcl.decl/p4-0x.cpp


Index: clang/test/CXX/dcl.decl/p4-0x.cpp
===
--- clang/test/CXX/dcl.decl/p4-0x.cpp
+++ clang/test/CXX/dcl.decl/p4-0x.cpp
@@ -1,5 +1,4 @@
 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
-// expected-no-diagnostics
 
 struct X {
   void f() &;
@@ -7,3 +6,11 @@
 };
 
 void (X::*pmf)() & = ::f;
+
+void fn() {
+  void (*[[attr]] fn_ptr)() =  // expected-warning{{unknown attribute 
'attr' ignored}}
+  void (*[[attrA]] *[[attrB]] fn_ptr_ptr)() = _ptr; // 
expected-warning{{unknown attribute 'attrA' ignored}} expected-warning{{unknown 
attribute 'attrB' ignored}}
+
+  void (&[[attr]] fn_lref)() = fn; // expected-warning{{unknown attribute 
'attr' ignored}}
+  void (&&[[attr]] fn_rref)() = fn; // expected-warning{{unknown attribute 
'attr' ignored}}
+}
Index: clang/lib/Parse/ParseTentative.cpp
===
--- clang/lib/Parse/ParseTentative.cpp
+++ clang/lib/Parse/ParseTentative.cpp
@@ -790,6 +790,24 @@
 (Tok.is(tok::annot_cxxscope) && NextToken().is(tok::star))) {
   // ptr-operator
   ConsumeAnyToken();
+
+  // Skip attributes.
+  while (Tok.isOneOf(tok::l_square, tok::kw___attribute, 
tok::kw___declspec,
+ tok::kw_alignas)) {
+if (Tok.is(tok::l_square)) {
+  ConsumeBracket();
+  if (!SkipUntil(tok::r_square))
+return TPResult::Error;
+} else {
+  ConsumeToken();
+  if (Tok.isNot(tok::l_paren))
+return TPResult::Error;
+  ConsumeParen();
+  if (!SkipUntil(tok::r_paren))
+return TPResult::Error;
+}
+  }
+
   while (Tok.isOneOf(tok::kw_const, tok::kw_volatile, tok::kw_restrict,
  tok::kw__Nonnull, tok::kw__Nullable,
  tok::kw__Null_unspecified))


Index: clang/test/CXX/dcl.decl/p4-0x.cpp
===
--- clang/test/CXX/dcl.decl/p4-0x.cpp
+++ clang/test/CXX/dcl.decl/p4-0x.cpp
@@ -1,5 +1,4 @@
 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
-// expected-no-diagnostics
 
 struct X {
   void f() &;
@@ -7,3 +6,11 @@
 };
 
 void (X::*pmf)() & = ::f;
+
+void fn() {
+  void (*[[attr]] fn_ptr)() =  // expected-warning{{unknown attribute 'attr' ignored}}
+  void (*[[attrA]] *[[attrB]] fn_ptr_ptr)() = _ptr; // expected-warning{{unknown attribute 'attrA' ignored}} expected-warning{{unknown attribute 'attrB' ignored}}
+
+  void (&[[attr]] fn_lref)() = fn; // expected-warning{{unknown attribute 'attr' ignored}}
+  void (&&[[attr]] fn_rref)() = fn; // expected-warning{{unknown attribute 'attr' ignored}}
+}
Index: clang/lib/Parse/ParseTentative.cpp
===
--- clang/lib/Parse/ParseTentative.cpp
+++ clang/lib/Parse/ParseTentative.cpp
@@ -790,6 +790,24 @@
 (Tok.is(tok::annot_cxxscope) && NextToken().is(tok::star))) {
   // ptr-operator
   ConsumeAnyToken();
+
+  // Skip attributes.
+  while (Tok.isOneOf(tok::l_square, tok::kw___attribute, tok::kw___declspec,
+ tok::kw_alignas)) {
+if (Tok.is(tok::l_square)) {
+  ConsumeBracket();
+  if (!SkipUntil(tok::r_square))
+return TPResult::Error;
+} else {
+  ConsumeToken();
+  if (Tok.isNot(tok::l_paren))
+return TPResult::Error;
+  ConsumeParen();
+  if (!SkipUntil(tok::r_paren))
+return TPResult::Error;
+}
+  }
+
   while (Tok.isOneOf(tok::kw_const, tok::kw_volatile, tok::kw_restrict,
  tok::kw__Nonnull, tok::kw__Nullable,
  tok::kw__Null_unspecified))
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D73755: [objc_direct] Small updates to help with adoption.

2020-02-14 Thread Pierre Habouzit via Phabricator via cfe-commits
MadCoder added a comment.

In D73755#1874962 , @plotfi wrote:

> @MadCoder Could there be a way to mark objc_direct methods as something like 
> __attribute__((visibility("default"))) or __declspec(dllexport) to denote 
> that a given method should be directly callable but still retain the metadata 
> to be called through an objc_msgSend from an external dylib? Could that help 
> to boost adoption?


I'm not sure how that is relevant to this review. secondly this kind of defeats 
the entire point of `objc_direct` which is to _not_ generate all that metadata.


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

https://reviews.llvm.org/D73755



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


[PATCH] D74643: [Parse] Consider attributes in `TryParsePtrOperatorSeq`.

2020-02-14 Thread Michele Scandale via Phabricator via cfe-commits
michele.scandale updated this revision to Diff 244756.
michele.scandale added a comment.

Missed GNU style attributes


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74643

Files:
  clang/lib/Parse/ParseTentative.cpp
  clang/test/CXX/dcl.decl/p4-0x.cpp


Index: clang/test/CXX/dcl.decl/p4-0x.cpp
===
--- clang/test/CXX/dcl.decl/p4-0x.cpp
+++ clang/test/CXX/dcl.decl/p4-0x.cpp
@@ -1,5 +1,4 @@
 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
-// expected-no-diagnostics
 
 struct X {
   void f() &;
@@ -7,3 +6,11 @@
 };
 
 void (X::*pmf)() & = ::f;
+
+void fn() {
+  void (*[[attr]] fn_ptr)() =  // expected-warning{{unknown attribute 
'attr' ignored}}
+  void (*[[attrA]] *[[attrB]] fn_ptr_ptr)() = _ptr; // 
expected-warning{{unknown attribute 'attrA' ignored}} expected-warning{{unknown 
attribute 'attrB' ignored}}
+
+  void (&[[attr]] fn_lref)() = fn; // expected-warning{{unknown attribute 
'attr' ignored}}
+  void (&&[[attr]] fn_rref)() = fn; // expected-warning{{unknown attribute 
'attr' ignored}}
+}
Index: clang/lib/Parse/ParseTentative.cpp
===
--- clang/lib/Parse/ParseTentative.cpp
+++ clang/lib/Parse/ParseTentative.cpp
@@ -790,6 +790,24 @@
 (Tok.is(tok::annot_cxxscope) && NextToken().is(tok::star))) {
   // ptr-operator
   ConsumeAnyToken();
+
+  // Skip attributes.
+  while (Tok.isOneOf(tok::l_square, tok::kw___attribute, 
tok::kw___declspec,
+ tok::kw_alignas)) {
+if (Tok.is(tok::l_square)) {
+  ConsumeBracket();
+  if (!SkipUntil(tok::r_square))
+return TPResult::Error;
+} else {
+  ConsumeToken();
+  if (Tok.isNot(tok::l_paren))
+return TPResult::Error;
+  ConsumeParen();
+  if (!SkipUntil(tok::r_paren))
+return TPResult::Error;
+}
+  }
+
   while (Tok.isOneOf(tok::kw_const, tok::kw_volatile, tok::kw_restrict,
  tok::kw__Nonnull, tok::kw__Nullable,
  tok::kw__Null_unspecified))


Index: clang/test/CXX/dcl.decl/p4-0x.cpp
===
--- clang/test/CXX/dcl.decl/p4-0x.cpp
+++ clang/test/CXX/dcl.decl/p4-0x.cpp
@@ -1,5 +1,4 @@
 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
-// expected-no-diagnostics
 
 struct X {
   void f() &;
@@ -7,3 +6,11 @@
 };
 
 void (X::*pmf)() & = ::f;
+
+void fn() {
+  void (*[[attr]] fn_ptr)() =  // expected-warning{{unknown attribute 'attr' ignored}}
+  void (*[[attrA]] *[[attrB]] fn_ptr_ptr)() = _ptr; // expected-warning{{unknown attribute 'attrA' ignored}} expected-warning{{unknown attribute 'attrB' ignored}}
+
+  void (&[[attr]] fn_lref)() = fn; // expected-warning{{unknown attribute 'attr' ignored}}
+  void (&&[[attr]] fn_rref)() = fn; // expected-warning{{unknown attribute 'attr' ignored}}
+}
Index: clang/lib/Parse/ParseTentative.cpp
===
--- clang/lib/Parse/ParseTentative.cpp
+++ clang/lib/Parse/ParseTentative.cpp
@@ -790,6 +790,24 @@
 (Tok.is(tok::annot_cxxscope) && NextToken().is(tok::star))) {
   // ptr-operator
   ConsumeAnyToken();
+
+  // Skip attributes.
+  while (Tok.isOneOf(tok::l_square, tok::kw___attribute, tok::kw___declspec,
+ tok::kw_alignas)) {
+if (Tok.is(tok::l_square)) {
+  ConsumeBracket();
+  if (!SkipUntil(tok::r_square))
+return TPResult::Error;
+} else {
+  ConsumeToken();
+  if (Tok.isNot(tok::l_paren))
+return TPResult::Error;
+  ConsumeParen();
+  if (!SkipUntil(tok::r_paren))
+return TPResult::Error;
+}
+  }
+
   while (Tok.isOneOf(tok::kw_const, tok::kw_volatile, tok::kw_restrict,
  tok::kw__Nonnull, tok::kw__Nullable,
  tok::kw__Null_unspecified))
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D74639: Add linkage check to ASTNodeImporter::hasSameVisibilityContext and rename to hasSameVisibilityContextAndLinkage

2020-02-14 Thread Shafik Yaghmour via Phabricator via cfe-commits
shafik added a comment.

I would love to have a minimal test case for this but every approach I tried 
has failed, so I would appreciate if there are ideas here.


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

https://reviews.llvm.org/D74639



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


[PATCH] D74639: Add linkage check to ASTNodeImporter::hasSameVisibilityContext and rename to hasSameVisibilityContextAndLinkage

2020-02-14 Thread Shafik Yaghmour via Phabricator via cfe-commits
shafik created this revision.
shafik added reviewers: martong, teemperor, balazske, a_sidorin.
Herald added a subscriber: rnkovacs.

This fixed is based on the assert in `LinkageComputer::getLVForDecl(…)` which 
assumes that all the decls in a redecl chain have the same linkage.

This change was trigged by a bug that came up when debugging `llc` and running 
the following expression in while in `SelectionDAG::getNode(…)

  p VT.getVectorElementType() == Operand.getValueType()

Evaluating this expression leads to import of an `operator==` for I believe a 
`std::set` iterator. One with external linkage and one with unique external 
linkage but they end in the same redecl chain which triggers the assert in 
`LinkageComputer::getLVForDecl(…)`.

This case has proven difficult to reduce to a minimal test case.


https://reviews.llvm.org/D74639

Files:
  clang/lib/AST/ASTImporter.cpp

Index: clang/lib/AST/ASTImporter.cpp
===
--- clang/lib/AST/ASTImporter.cpp
+++ clang/lib/AST/ASTImporter.cpp
@@ -463,7 +463,7 @@
 ParmVarDecl *ToParam);
 
 template 
-bool hasSameVisibilityContext(T *Found, T *From);
+bool hasSameVisibilityContextAndLinkage(T *Found, T *From);
 
 bool IsStructuralMatch(Decl *From, Decl *To, bool Complain);
 bool IsStructuralMatch(RecordDecl *FromRecord, RecordDecl *ToRecord,
@@ -973,7 +973,10 @@
 }
 
 template 
-bool ASTNodeImporter::hasSameVisibilityContext(T *Found, T *From) {
+bool ASTNodeImporter::hasSameVisibilityContextAndLinkage(T *Found, T *From) {
+  if (Found->getLinkageInternal() != From->getLinkageInternal())
+return false;
+
   if (From->hasExternalFormalLinkage())
 return Found->hasExternalFormalLinkage();
   if (Importer.GetFromTU(Found) != From->getTranslationUnitDecl())
@@ -986,8 +989,11 @@
 }
 
 template <>
-bool ASTNodeImporter::hasSameVisibilityContext(TypedefNameDecl *Found,
+bool ASTNodeImporter::hasSameVisibilityContextAndLinkage(TypedefNameDecl *Found,
TypedefNameDecl *From) {
+  if (Found->getLinkageInternal() != From->getLinkageInternal())
+return false;
+
   if (From->isInAnonymousNamespace() && Found->isInAnonymousNamespace())
 return Importer.GetFromTU(Found) == From->getTranslationUnitDecl();
   return From->isInAnonymousNamespace() == Found->isInAnonymousNamespace();
@@ -2392,7 +2398,7 @@
   if (!FoundDecl->isInIdentifierNamespace(IDNS))
 continue;
   if (auto *FoundTypedef = dyn_cast(FoundDecl)) {
-if (!hasSameVisibilityContext(FoundTypedef, D))
+if (!hasSameVisibilityContextAndLinkage(FoundTypedef, D))
   continue;
 
 QualType FromUT = D->getUnderlyingType();
@@ -2592,7 +2598,7 @@
   }
 
   if (auto *FoundEnum = dyn_cast(FoundDecl)) {
-if (!hasSameVisibilityContext(FoundEnum, D))
+if (!hasSameVisibilityContextAndLinkage(FoundEnum, D))
   continue;
 if (IsStructuralMatch(D, FoundEnum))
   return Importer.MapImported(D, FoundEnum);
@@ -2709,7 +2715,7 @@
   if (!IsStructuralMatch(D, FoundRecord, false))
 continue;
 
-if (!hasSameVisibilityContext(FoundRecord, D))
+if (!hasSameVisibilityContextAndLinkage(FoundRecord, D))
   continue;
 
 if (IsStructuralMatch(D, FoundRecord)) {
@@ -3157,7 +3163,7 @@
 continue;
 
   if (auto *FoundFunction = dyn_cast(FoundDecl)) {
-if (!hasSameVisibilityContext(FoundFunction, D))
+if (!hasSameVisibilityContextAndLinkage(FoundFunction, D))
   continue;
 
 if (IsStructuralMatch(D, FoundFunction)) {
@@ -3779,7 +3785,7 @@
 continue;
 
   if (auto *FoundVar = dyn_cast(FoundDecl)) {
-if (!hasSameVisibilityContext(FoundVar, D))
+if (!hasSameVisibilityContextAndLinkage(FoundVar, D))
   continue;
 if (Importer.IsStructurallyEquivalent(D->getType(),
   FoundVar->getType())) {
@@ -5185,7 +5191,7 @@
   Decl *Found = FoundDecl;
   auto *FoundTemplate = dyn_cast(Found);
   if (FoundTemplate) {
-if (!hasSameVisibilityContext(FoundTemplate, D))
+if (!hasSameVisibilityContextAndLinkage(FoundTemplate, D))
   continue;
 
 if (IsStructuralMatch(D, FoundTemplate)) {
@@ -5713,7 +5719,7 @@
 continue;
 
   if (auto *FoundTemplate = dyn_cast(FoundDecl)) {
-if (!hasSameVisibilityContext(FoundTemplate, D))
+if (!hasSameVisibilityContextAndLinkage(FoundTemplate, D))
   continue;
 if (IsStructuralMatch(D, FoundTemplate)) {
   FunctionTemplateDecl *TemplateWithDef =
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D74631: [clang][XCOFF] Indicate that XCOFF does not support COMDATs

2020-02-14 Thread Sean Fertile via Phabricator via cfe-commits
sfertile added a comment.

1. We should probably update the COMDAT section of the lang ref to mention 
XCOFF doens't support COMDATS.
2. Will we report an error somewhere in the backend if we encounter a COMDAT?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74631



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


[PATCH] D74571: [OpenMP][CUDA] Add CUDA 10.2 support

2020-02-14 Thread Kelvin Li via Phabricator via cfe-commits
kkwli0 added a comment.

> I am not sure I understand. Do we need to modify stuff outside of `/openmp`? 
> I was hoping it is our CMake that can be adjusted to make this work as 
> described earlier. TBH, he warning is even not my biggest problem. As long as 
> we get a libomptarget.bc we should be fine.

@jdoerfert  Yes.  The warning message affects the outcome of another test in 
cmake.  With the approach of ignoring the warning message, we need to modify 
stuff outside of `/openmp`.  For me, I don't mind to have the warning messages 
all over the places.  The problem we have here is unable to build libomp.so.


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

https://reviews.llvm.org/D74571



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


[PATCH] D69782: Summary: Instead of dropping all the ranges associated with a Diagnostic when converting them to a ClangTidy error, instead attach them to the ClangTidyError, so they can be consumed b

2020-02-14 Thread Joe Turner via Phabricator via cfe-commits
compositeprimes updated this revision to Diff 244737.
compositeprimes added a comment.

Updated to serialize the ranges in yaml. This required making a few 
abstractions around the representation of CharSourceRange.


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

https://reviews.llvm.org/D69782

Files:
  include/clang/Tooling/Core/Diagnostic.h
  include/clang/Tooling/DiagnosticsYaml.h
  lib/Tooling/Core/Diagnostic.cpp

Index: lib/Tooling/Core/Diagnostic.cpp
===
--- lib/Tooling/Core/Diagnostic.cpp
+++ lib/Tooling/Core/Diagnostic.cpp
@@ -11,6 +11,7 @@
 //===--===//
 
 #include "clang/Tooling/Core/Diagnostic.h"
+#include "third_party/llvm/llvm-project/clang/include/clang/Basic/SourceLocation.h"
 #include "clang/Basic/SourceManager.h"
 #include "llvm/ADT/STLExtras.h"
 
@@ -34,6 +35,23 @@
 FileOffset = Sources.getFileOffset(Loc);
 }
 
+DiagnosticAssociatedRange::DiagnosticAssociatedRange(
+const SourceManager , CharSourceRange Range)
+: FileOffset(0), Length(0) {
+  FilePath = std::string(Sources.getFilename(Range.getBegin()));
+  if (!FilePath.empty()) {
+FileOffset = Sources.getFileOffset(Range.getBegin());
+Length = Sources.getFileOffset(Range.getEnd()) - FileOffset;
+  }
+}
+
+DiagnosticAssociatedRanges::DiagnosticAssociatedRanges(
+const SourceManager , ArrayRef SourceRanges) {
+  for (const CharSourceRange  : SourceRanges) {
+Ranges.emplace_back(DiagnosticAssociatedRange(Sources, Range));
+  }
+}
+
 Diagnostic::Diagnostic(llvm::StringRef DiagnosticName,
Diagnostic::Level DiagLevel, StringRef BuildDirectory)
 : DiagnosticName(DiagnosticName), DiagLevel(DiagLevel),
@@ -42,9 +60,10 @@
 Diagnostic::Diagnostic(llvm::StringRef DiagnosticName,
const DiagnosticMessage ,
const SmallVector ,
-   Level DiagLevel, llvm::StringRef BuildDirectory)
+   Level DiagLevel, llvm::StringRef BuildDirectory,
+   const DiagnosticAssociatedRanges )
 : DiagnosticName(DiagnosticName), Message(Message), Notes(Notes),
-  DiagLevel(DiagLevel), BuildDirectory(BuildDirectory) {}
+  DiagLevel(DiagLevel), BuildDirectory(BuildDirectory), Ranges(Ranges) {}
 
 const llvm::StringMap *selectFirstFix(const Diagnostic& D) {
if (!D.Message.Fix.empty())
Index: include/clang/Tooling/DiagnosticsYaml.h
===
--- include/clang/Tooling/DiagnosticsYaml.h
+++ include/clang/Tooling/DiagnosticsYaml.h
@@ -20,12 +20,27 @@
 #include "llvm/Support/YAMLTraits.h"
 #include 
 
+LLVM_YAML_IS_SEQUENCE_VECTOR(clang::tooling::DiagnosticAssociatedRange)
 LLVM_YAML_IS_SEQUENCE_VECTOR(clang::tooling::Diagnostic)
 LLVM_YAML_IS_SEQUENCE_VECTOR(clang::tooling::DiagnosticMessage)
 
 namespace llvm {
 namespace yaml {
 
+template <> struct MappingTraits {
+  static void mapping(IO , clang::tooling::DiagnosticAssociatedRange ) {
+Io.mapRequired("FilePath", R.FilePath);
+Io.mapRequired("FileOffset", R.FileOffset);
+Io.mapRequired("Length", R.Length);
+  }
+};
+
+template <> struct MappingTraits {
+  static void mapping(IO , clang::tooling::DiagnosticAssociatedRanges ) {
+Io.mapRequired("Ranges", R.Ranges);
+  }
+};
+
 template <> struct MappingTraits {
   static void mapping(IO , clang::tooling::DiagnosticMessage ) {
 Io.mapRequired("Message", M.Message);
@@ -58,11 +73,12 @@
 
 NormalizedDiagnostic(const IO &, const clang::tooling::Diagnostic )
 : DiagnosticName(D.DiagnosticName), Message(D.Message), Notes(D.Notes),
-  DiagLevel(D.DiagLevel), BuildDirectory(D.BuildDirectory) {}
+  DiagLevel(D.DiagLevel), BuildDirectory(D.BuildDirectory),
+  Ranges(D.Ranges) {}
 
 clang::tooling::Diagnostic denormalize(const IO &) {
   return clang::tooling::Diagnostic(DiagnosticName, Message, Notes,
-DiagLevel, BuildDirectory);
+DiagLevel, BuildDirectory, Ranges);
 }
 
 std::string DiagnosticName;
@@ -71,6 +87,7 @@
 SmallVector Notes;
 clang::tooling::Diagnostic::Level DiagLevel;
 std::string BuildDirectory;
+clang::tooling::DiagnosticAssociatedRanges Ranges;
   };
 
   static void mapping(IO , clang::tooling::Diagnostic ) {
@@ -79,6 +96,7 @@
 Io.mapRequired("DiagnosticName", Keys->DiagnosticName);
 Io.mapRequired("DiagnosticMessage", Keys->Message);
 Io.mapOptional("Notes", Keys->Notes);
+Io.mapOptional("Ranges", Keys->Ranges);
 
 // FIXME: Export properly all the different fields.
   }
Index: include/clang/Tooling/Core/Diagnostic.h
===
--- include/clang/Tooling/Core/Diagnostic.h
+++ include/clang/Tooling/Core/Diagnostic.h
@@ -47,6 +47,28 @@
   

[PATCH] D74602: Fix standalone build interaction with compiler extension

2020-02-14 Thread Marc-Antoine Perennou via Phabricator via cfe-commits
Keruspe accepted this revision.
Keruspe added a comment.
This revision is now accepted and ready to land.

Fixes the regression introduced in D74464  
when running cmake inside the clang directory


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74602



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


[clang] 87e80e5 - fix some comment typos to cycle bots

2020-02-14 Thread Nico Weber via cfe-commits

Author: Nico Weber
Date: 2020-02-14T15:18:50-05:00
New Revision: 87e80e5e289249cb9c1b6ed0f9502434375335a9

URL: 
https://github.com/llvm/llvm-project/commit/87e80e5e289249cb9c1b6ed0f9502434375335a9
DIFF: 
https://github.com/llvm/llvm-project/commit/87e80e5e289249cb9c1b6ed0f9502434375335a9.diff

LOG: fix some comment typos to cycle bots

Added: 


Modified: 
clang/include/clang-c/BuildSystem.h
clang/include/clang-c/Index.h
clang/include/clang/AST/DeclObjC.h

Removed: 




diff  --git a/clang/include/clang-c/BuildSystem.h 
b/clang/include/clang-c/BuildSystem.h
index 4e9f6dee0279..296e61247cef 100644
--- a/clang/include/clang-c/BuildSystem.h
+++ b/clang/include/clang-c/BuildSystem.h
@@ -117,7 +117,7 @@ 
clang_ModuleMapDescriptor_setFrameworkModuleName(CXModuleMapDescriptor,
  const char *name);
 
 /**
- * Sets the umbrealla header name that the module.map describes.
+ * Sets the umbrella header name that the module.map describes.
  * \returns 0 for success, non-zero to indicate an error.
  */
 CINDEX_LINKAGE enum CXErrorCode

diff  --git a/clang/include/clang-c/Index.h b/clang/include/clang-c/Index.h
index b653995ebbd0..efb96f3cc5b6 100644
--- a/clang/include/clang-c/Index.h
+++ b/clang/include/clang-c/Index.h
@@ -3745,7 +3745,7 @@ CINDEX_LINKAGE unsigned 
clang_Type_getNumObjCProtocolRefs(CXType T);
 CINDEX_LINKAGE CXCursor clang_Type_getObjCProtocolDecl(CXType T, unsigned i);
 
 /**
- * Retreive the number of type arguments associated with an ObjC object.
+ * Retrieve the number of type arguments associated with an ObjC object.
  *
  * If the type is not an ObjC object, 0 is returned.
  */

diff  --git a/clang/include/clang/AST/DeclObjC.h 
b/clang/include/clang/AST/DeclObjC.h
index 73dc4ddab898..954b9bc15789 100644
--- a/clang/include/clang/AST/DeclObjC.h
+++ b/clang/include/clang/AST/DeclObjC.h
@@ -402,7 +402,7 @@ class ObjCMethodDecl : public NamedDecl, public DeclContext 
{
   }
 
   /// createImplicitParams - Used to lazily create the self and cmd
-  /// implict parameters. This must be called prior to using getSelfDecl()
+  /// implicit parameters. This must be called prior to using getSelfDecl()
   /// or getCmdDecl(). The call is ignored if the implicit parameters
   /// have already been created.
   void createImplicitParams(ASTContext , const ObjCInterfaceDecl *ID);



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


[PATCH] D74571: [OpenMP][CUDA] Add CUDA 10.2 support

2020-02-14 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert added a comment.

In D74571#1876952 , @kkwli0 wrote:

> It turns out that having the warning message also affects the C_SUPPORTS_FPIC 
> test in `cmake/modules/HandleLLVMOptions.cmake`.  As a result, `cmake` thinks 
> that `-fPIC` is not supported.  Eventually, it leads to error in 
> `libclang-cpp.so`.
>
>   ../../lib/CodeGen/CMakeFiles/obj.clangCodeGen.dir/CodeGenModule.cpp.o: In 
> function `clang::CodeGen::CodeGenModule::~CodeGenModule()':
>   CodeGenModule.cpp:(.text+0x1134): call to `std::_Rb_tree const, llvm::TinyPtrVector >, std::_Select1st const, llvm::TinyPtrVector > >, std::less, 
> std::allocator > > 
> >::_M_erase(std::_Rb_tree_node llvm::TinyPtrVector > >*)' lacks nop, can't restore toc; 
> recompile with -fPIC
>   ...
>
>
> I don't think it is a good idea to modify this test which explicitly 
> specifies -Werror.


I am not sure I understand. Do we need to modify stuff outside of `/openmp`? I 
was hoping it is our CMake that can be adjusted to make this work as described 
earlier. TBH, he warning is even not my biggest problem. As long as we get a 
libomptarget.bc we should be fine.


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

https://reviews.llvm.org/D74571



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


[PATCH] D74571: [OpenMP][CUDA] Add CUDA 10.2 support

2020-02-14 Thread Kelvin Li via Phabricator via cfe-commits
kkwli0 added a comment.

It turns out that having the warning message also affects the C_SUPPORTS_FPIC 
test in `cmake/modules/HandleLLVMOptions.cmake`.  As a result, `cmake` thinks 
that `-fPIC` is not supported.  Eventually, it leads to error in 
`libclang-cpp.so`.

  ../../lib/CodeGen/CMakeFiles/obj.clangCodeGen.dir/CodeGenModule.cpp.o: In 
function `clang::CodeGen::CodeGenModule::~CodeGenModule()':
  CodeGenModule.cpp:(.text+0x1134): call to `std::_Rb_tree >, std::_Select1st > >, std::less, 
std::allocator > > 
>::_M_erase(std::_Rb_tree_node > >*)' lacks nop, can't restore toc; 
recompile with -fPIC
  ...

I don't think it is a good idea to modify this test which explicitly specifies 
-Werror.

Any other ideas are definitely welcome!


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

https://reviews.llvm.org/D74571



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


[PATCH] D74634: Remove "ELF Only" restriction from section flags

2020-02-14 Thread Reid Kleckner via Phabricator via cfe-commits
rnk created this revision.
rnk added reviewers: hans, aaron.ballman.
Herald added subscribers: sunfish, aheejin.
Herald added a project: clang.

-ffunction-sections and -fdata-sections are well supported by many
object file formats:

- ELF
- COFF
- XCOFF
- wasm

Only MachO ignores this flag.

While here, remove it from -funique-section-names. Wasm honors this
option.

Addresses PR44910.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D74634

Files:
  clang/include/clang/Driver/Options.td


Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -1952,10 +1952,10 @@
 def fzero_initialized_in_bss : Flag<["-"], "fzero-initialized-in-bss">, 
Group;
 def ffunction_sections : Flag<["-"], "ffunction-sections">, Group,
   Flags<[CC1Option]>,
-  HelpText<"Place each function in its own section (ELF Only)">;
+  HelpText<"Place each function in its own section">;
 def fno_function_sections : Flag<["-"], "fno-function-sections">, 
Group;
 def fdata_sections : Flag <["-"], "fdata-sections">, Group,
- Flags<[CC1Option]>, HelpText<"Place each data in its own section (ELF Only)">;
+ Flags<[CC1Option]>, HelpText<"Place each data in its own section">;
 def fno_data_sections : Flag <["-"], "fno-data-sections">, Group;
 def fstack_size_section : Flag<["-"], "fstack-size-section">, Group, 
Flags<[CC1Option]>,
   HelpText<"Emit section containing metadata on function stack sizes">;
@@ -1964,7 +1964,7 @@
 
 def funique_section_names : Flag <["-"], "funique-section-names">,
   Group,
-  HelpText<"Use unique names for text and data sections (ELF Only)">;
+  HelpText<"Use unique names for text and data sections">;
 def fno_unique_section_names : Flag <["-"], "fno-unique-section-names">,
   Group, Flags<[CC1Option]>;
 


Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -1952,10 +1952,10 @@
 def fzero_initialized_in_bss : Flag<["-"], "fzero-initialized-in-bss">, Group;
 def ffunction_sections : Flag<["-"], "ffunction-sections">, Group,
   Flags<[CC1Option]>,
-  HelpText<"Place each function in its own section (ELF Only)">;
+  HelpText<"Place each function in its own section">;
 def fno_function_sections : Flag<["-"], "fno-function-sections">, Group;
 def fdata_sections : Flag <["-"], "fdata-sections">, Group,
- Flags<[CC1Option]>, HelpText<"Place each data in its own section (ELF Only)">;
+ Flags<[CC1Option]>, HelpText<"Place each data in its own section">;
 def fno_data_sections : Flag <["-"], "fno-data-sections">, Group;
 def fstack_size_section : Flag<["-"], "fstack-size-section">, Group, Flags<[CC1Option]>,
   HelpText<"Emit section containing metadata on function stack sizes">;
@@ -1964,7 +1964,7 @@
 
 def funique_section_names : Flag <["-"], "funique-section-names">,
   Group,
-  HelpText<"Use unique names for text and data sections (ELF Only)">;
+  HelpText<"Use unique names for text and data sections">;
 def fno_unique_section_names : Flag <["-"], "fno-unique-section-names">,
   Group, Flags<[CC1Option]>;
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D74417: [clang][ARC] Remove invalid assertion that can crash clangd

2020-02-14 Thread David Goldman via Phabricator via cfe-commits
dgoldman added a comment.

In D74417#1874826 , @erik.pilkington 
wrote:

> In D74417#1874747 , @dgoldman wrote:
>
> > Added but it's still failing due to a different assertion failure, do you 
> > think this could be because the abbreviation is different for the 
> > ParamVars? I'm not sure how to handle this...
>
>
> Yeah, that looks to be the problem, the parameter abbreviation is assumed to 
> be a literal zero (since it was previously impossible) for the ParmVarDecl 
> case, i.e:
>
>   Abv->Add(BitCodeAbbrevOp(0));   // ARCPseudoStrong
>   
>
> But we really want it to look like the VarDecl case, where we actually get a 
> bit for it:
>
>   Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isARCPseudoStrong
>   
>
> I think you can fix the crash by changing the BitCodeAbbrevOp(0) to 
> BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1).


Okay, I've added this, it seems to fix the test but I'm not sure if it's fully 
correct since the place where it was modified is under the `VarDecl` comment 
instead of `ParmVarDecl`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74417



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


[PATCH] D74417: [clang][ARC] Remove invalid assertion that can crash clangd

2020-02-14 Thread David Goldman via Phabricator via cfe-commits
dgoldman updated this revision to Diff 244728.
dgoldman added a comment.

- Fix parameter abbreviation for ParamVarDecl


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74417

Files:
  clang/lib/Serialization/ASTWriterDecl.cpp
  clang/test/PCH/externally-retained.m


Index: clang/test/PCH/externally-retained.m
===
--- /dev/null
+++ clang/test/PCH/externally-retained.m
@@ -0,0 +1,30 @@
+// Test for assertion failure due to objc_externally_retained on a function.
+
+// Without PCH
+// RUN: %clang_cc1 -fsyntax-only -verify -fobjc-arc -include %s %s
+
+// With PCH
+// RUN: %clang_cc1 %s -emit-pch -fobjc-arc -o %t
+// RUN: %clang_cc1 -emit-llvm-only -verify %s -fobjc-arc -include-pch %t 
-debug-info-kind=limited
+
+// expected-no-diagnostics
+
+#ifndef HEADER
+#define HEADER
+//===--===//
+// Header
+
+__attribute__((objc_externally_retained)) void doSomething(id someObject);
+
+id sharedObject = 0;
+
+//===--===//
+#else
+//===--===//
+
+void callDoSomething() {
+  doSomething(sharedObject);
+}
+
+//===--===//
+#endif
Index: clang/lib/Serialization/ASTWriterDecl.cpp
===
--- clang/lib/Serialization/ASTWriterDecl.cpp
+++ clang/lib/Serialization/ASTWriterDecl.cpp
@@ -1089,8 +1089,6 @@
 Record.AddStmt(D->getUninstantiatedDefaultArg());
   Code = serialization::DECL_PARM_VAR;
 
-  assert(!D->isARCPseudoStrong()); // can be true of ImplicitParamDecl
-
   // If the assumptions about the DECL_PARM_VAR abbrev are true, use it.  Here
   // we dynamically check for the properties that we optimize for, but don't
   // know are true of all PARM_VAR_DECLs.
@@ -2110,7 +2108,7 @@
   Abv->Add(BitCodeAbbrevOp(0));   // SClass
   Abv->Add(BitCodeAbbrevOp(0));   // TSCSpec
   Abv->Add(BitCodeAbbrevOp(0));   // InitStyle
-  Abv->Add(BitCodeAbbrevOp(0));   // ARCPseudoStrong
+  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isARCPseudoStrong
   Abv->Add(BitCodeAbbrevOp(0));   // Linkage
   Abv->Add(BitCodeAbbrevOp(0));   // HasInit
   Abv->Add(BitCodeAbbrevOp(0));   // 
HasMemberSpecializationInfo


Index: clang/test/PCH/externally-retained.m
===
--- /dev/null
+++ clang/test/PCH/externally-retained.m
@@ -0,0 +1,30 @@
+// Test for assertion failure due to objc_externally_retained on a function.
+
+// Without PCH
+// RUN: %clang_cc1 -fsyntax-only -verify -fobjc-arc -include %s %s
+
+// With PCH
+// RUN: %clang_cc1 %s -emit-pch -fobjc-arc -o %t
+// RUN: %clang_cc1 -emit-llvm-only -verify %s -fobjc-arc -include-pch %t -debug-info-kind=limited
+
+// expected-no-diagnostics
+
+#ifndef HEADER
+#define HEADER
+//===--===//
+// Header
+
+__attribute__((objc_externally_retained)) void doSomething(id someObject);
+
+id sharedObject = 0;
+
+//===--===//
+#else
+//===--===//
+
+void callDoSomething() {
+  doSomething(sharedObject);
+}
+
+//===--===//
+#endif
Index: clang/lib/Serialization/ASTWriterDecl.cpp
===
--- clang/lib/Serialization/ASTWriterDecl.cpp
+++ clang/lib/Serialization/ASTWriterDecl.cpp
@@ -1089,8 +1089,6 @@
 Record.AddStmt(D->getUninstantiatedDefaultArg());
   Code = serialization::DECL_PARM_VAR;
 
-  assert(!D->isARCPseudoStrong()); // can be true of ImplicitParamDecl
-
   // If the assumptions about the DECL_PARM_VAR abbrev are true, use it.  Here
   // we dynamically check for the properties that we optimize for, but don't
   // know are true of all PARM_VAR_DECLs.
@@ -2110,7 +2108,7 @@
   Abv->Add(BitCodeAbbrevOp(0));   // SClass
   Abv->Add(BitCodeAbbrevOp(0));   // TSCSpec
   Abv->Add(BitCodeAbbrevOp(0));   // InitStyle
-  Abv->Add(BitCodeAbbrevOp(0));   // ARCPseudoStrong
+  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isARCPseudoStrong
   Abv->Add(BitCodeAbbrevOp(0));   // Linkage
   Abv->Add(BitCodeAbbrevOp(0));   // HasInit
   Abv->Add(BitCodeAbbrevOp(0));   // HasMemberSpecializationInfo
___
cfe-commits mailing 

RE: [PATCH] D74436: Change clang option -ffp-model=precise to select ffp-contract=on

2020-02-14 Thread Jinsong Ji via cfe-commits
Thanks Melanie.

I have pushed one fix to test-suite to explicitly add -ffp-contract=off to
unblock our internal buildbot for now.
https://github.com/llvm/llvm-test-suite/commit/c04a7178a3a50fe919964df59b041c5671db50f7

Our buildbot are OK now.

I think you can proceed as long as the change is intended and reasonable.
Thanks.


Best,

Jinsong Ji (纪金松), PhD.

XL/LLVM on Power Compiler Development
E-mail: j...@us.ibm.com



From:   "Blower, Melanie I" 
To: "reviews+d74436+public+e2b40a7853ffb...@reviews.llvm.org"
,
"lebedev...@gmail.com" ,
"rjmcc...@gmail.com" ,
"sepavl...@gmail.com" 
Cc: "mask...@google.com" , "j...@us.ibm.com"
, "david.bolvan...@gmail.com"
, "mar...@martin.st"
, "Wang, Pengfei" ,
"wuz...@cn.ibm.com" ,
"nemanja.i@gmail.com" ,
"kit.bar...@gmail.com" ,
"cfe-commits@lists.llvm.org" ,
"mlek...@skidmore.edu" ,
"blitzrak...@gmail.com" ,
"shen...@google.com" ,
"peter.wal...@arm.com" 
Date:   02/14/2020 10:34 AM
Subject:[EXTERNAL] RE: [PATCH] D74436: Change clang option
-ffp-model=precise to select ffp-contract=on



I reverted MaskRay's "reland" since the original patch is causing trouble
on PowerPC, check-all is passing on my box.  Sorry for the trouble.

> -Original Message-
> From: Andy Kaylor via Phabricator 
> Sent: Thursday, February 13, 2020 9:20 PM
> To: Blower, Melanie I ; lebedev...@gmail.com;
> rjmcc...@gmail.com; sepavl...@gmail.com
> Cc: mask...@google.com; j...@us.ibm.com; david.bolvan...@gmail.com;
> mar...@martin.st; Wang, Pengfei ;
> wuz...@cn.ibm.com; nemanja.i@gmail.com; kit.bar...@gmail.com; cfe-
> comm...@lists.llvm.org; mlek...@skidmore.edu; blitzrak...@gmail.com;
> shen...@google.com; peter.wal...@arm.com
> Subject: [PATCH] D74436: Change clang option -ffp-model=precise to select
ffp-
> contract=on
>
> andrew.w.kaylor added a subscriber: MaskRay.
> andrew.w.kaylor added a comment.
>
> In D74436#1875386 <
https://urldefense.proofpoint.com/v2/url?u=https-3A__reviews.llvm.org_D74436-231875386=DwIFAg=jf_iaSHvJObTbx-siA1ZOg=DvnnfavFQBGT2CDyHzTr_Q=cvHv8MkmryQUMVKDW_JEP3rPsAVn_T77lN-oqkY9X2Y=4moq7_F2LQUHDL0EsCHrNKUtm43d0NQb2Fmh4CISYOM=
 >, @thakis
> wrote:
>
> > The revert of this breaks tests everywhere, as far as I can tell.
>
>
> It looks like something strange happened with the revert:
>
> > clang-11: warning: overriding '-ffp-model=strict' option with '-ffp-
> model=strict' [-Woverriding-t-option]
>
> I believe the problem is that the original change that was being reverted
> contained this:
>
>   clang/lib/Driver/ToolChains/Clang.cpp
>   @@ -2768,7 +2766,7 @@ static void RenderFloatingPointOptions(const
> ToolChain , const Driver ,
>   !AssociativeMath && !ReciprocalMath &&
>   SignedZeros && TrappingMath && RoundingFPMath &&
>   DenormalFPMath != llvm::DenormalMode::getIEEE() &&
>   +FPContract.empty())
>   -(FPContract.equals("off") || FPContract.empty()))
>
> But sometime in the land-revert-land-revert cycle the line above that
changed,
> causing the merge to miss this change in the most recent revert. I see
that
> @MaskRay has since re-landed this change set, but it's going to cause
problems
> for PowerPC. If someone needs to revert this yet again, I think it can be
safely
> done by recovering the change above.
>
> Apologies for the mess!
>
>
> Repository:
>   rG LLVM Github Monorepo
>
> CHANGES SINCE LAST ACTION
>
https://urldefense.proofpoint.com/v2/url?u=https-3A__reviews.llvm.org_D74436_new_=DwIFAg=jf_iaSHvJObTbx-siA1ZOg=DvnnfavFQBGT2CDyHzTr_Q=cvHv8MkmryQUMVKDW_JEP3rPsAVn_T77lN-oqkY9X2Y=x-uw-PdxKFtF2QXI5p8pFIGwDP53ma6WcFfJSt7NiPY=

>
>
https://urldefense.proofpoint.com/v2/url?u=https-3A__reviews.llvm.org_D74436=DwIFAg=jf_iaSHvJObTbx-siA1ZOg=DvnnfavFQBGT2CDyHzTr_Q=cvHv8MkmryQUMVKDW_JEP3rPsAVn_T77lN-oqkY9X2Y=VJzMi9ZvFzcqz_BCC84nlLx_A4agCXEmi9bNsJMnkJQ=

>
>



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


[PATCH] D74436: Change clang option -ffp-model=precise to select ffp-contract=on

2020-02-14 Thread Jinsong Ji via Phabricator via cfe-commits
jsji added a comment.

> We normally default to `-ffp-contract=on ` only for -O3 and above (for legacy 
> compilers XL/gcc on PowerPC).

Correction:  XL on PowerPC default to generate FMA at -O0 as well. The 
corresponding option is -qfloat=maf.
https://www.ibm.com/support/knowledgecenter/SSXVZZ_16.1.1/com.ibm.xlcpp1611.lelinux.doc/compiler_ref/opt_float.html


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74436



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


[PATCH] D74262: [clang-offload-bundler] Enable handling of partially-linked fat objects

2020-02-14 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added a comment.

In D74262#1876835 , @grokos wrote:

> In D74262#1867245 , @ABataev wrote:
>
> > Partial linking may lead to some incorrect results with global 
> > constructors. How are you going to handle this?
>
>
> Can you give me an example of what can break? I remember reading a 
> conversation about some linker patch some time ago but I cannot recall the 
> details.


See the discussion here https://reviews.llvm.org/D65819


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74262



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


LLVM buildmaster will be updated and restarted tonight

2020-02-14 Thread Galina Kistanova via cfe-commits
 Hello everyone,

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

Thanks

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


[PATCH] D66919: Warn about zero-parameter K definitions in -Wstrict-prototypes

2020-02-14 Thread Aaron Puchert via Phabricator via cfe-commits
aaronpuchert added a comment.

Just FYI, I had to fix some tests after this in 
rG705306526b5ca7eed2fa28ebf832873cbb5085ec 
.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66919



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


[PATCH] D74262: [clang-offload-bundler] Enable handling of partially-linked fat objects

2020-02-14 Thread George Rokos via Phabricator via cfe-commits
grokos marked 2 inline comments as done.
grokos added a comment.

In D74262#1867245 , @ABataev wrote:

> Partial linking may lead to some incorrect results with global constructors. 
> How are you going to handle this?


Can you give me an example of what can break? I remember reading a conversation 
about some linker patch some time ago but I cannot recall the details.




Comment at: clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp:84
"  o   - object\n"
+   "  oo  - object; output file is a list of unbundled 
objects\n"
"  gch - precompiled-header\n"

jdoerfert wrote:
> ABataev wrote:
> > Hmm, are you going to introduce a new kind of output? It really requires 
> > RFC.
> This is the offload-bundler tool, right? Who is using that except OpenMP (and 
> SYCL)?
> 
> Is there a reason for `oo`? `uo` (=unboundled object), or `do` (=device 
> object)?
No one else (at least for now). But I can send out an RFC regarding the new 
output anyway.

`oo` is related to the fact that under this scheme we can have multiple `.o` 
files as output (many `o`'s). But if you think some of the other abbreviations 
makes more sense, I'm happy to change it.



Comment at: clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp:160
+  }
+
   /// Write the header of the bundled file to \a OS based on the information

jdoerfert wrote:
> I don't understand the comment. If \p FileName is a list of outputs, how does 
> this work?
The scheme is described in the attached pdf. In short, when the host liner 
fetches dependencies from a static library, alongside the host bundle it also 
fetches the device bundle. Now, if we have multiple dependencies from multiple 
objects inside a static library (or multiple static libraries) the host linker 
will perform a partial linking between all fetched bundles for the targets we 
are interested in. The result is a fat object in which each target bundle is 
the result of concatenating the individual bundles for that target we fetched 
from each static library. We also keep track of the size of each fetched bundle 
(we use a new sizes section per target inside the fat object for this purpose) 
so that the unbundler can separate the partially-linked bundle into the 
original object files it was assembled from. Usually, we don't know a priori 
how many dependencies will be brought in, so we don't know how many objects 
we're going to have at outputs. Therefore, in `oo` unbundling mode, the user 
specifies a single output file per target (just like in any other unbundling 
mode) which the unbundler populates with the paths to the actual output device 
objects. Then the driver reads those paths and passes them on to the device 
linker.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74262



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


[PATCH] D74571: [OpenMP][CUDA] Add CUDA 10.2 support

2020-02-14 Thread Artem Belevich via Phabricator via cfe-commits
tra added a comment.

In D74571#1876647 , @jdoerfert wrote:

> That sounds like the right approach for OpenMP. We require a minimal CUDA 
> version, based on what we use internally, but no maximal version if possible 
> since we don't use new features anyway.


SGTM, with a caveat.

Word of caution -- it's not just the features. New CUDA versions also come with 
sometimes substantially different header files. Clang pre-includes a lot of 
them, so if the new headers have something funky, clang may need extra changes 
before it can compile anything, even if you don't use the new features.

If you silence compiler with the option set during build config, it may be 
prudent to tell the user that CUDA compilation *may* fail if the CUDA version 
if not one of the known "not quite supported, but usable on par with the oldest 
supported version."


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

https://reviews.llvm.org/D74571



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


[PATCH] D74572: [WIP][BPF] implement intrinsic function __builtin__btf_type_id()

2020-02-14 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song updated this revision to Diff 244709.
yonghong-song edited the summary of this revision.
yonghong-song added a comment.

Addressing some Alexei's comments:

  Change comments in clang CGBuiltin.cpp to make it easier to understand.
  Remove BPFMIPreserveDIType.cpp and fold into existing 
BPFMISimplifyPatchable.cpp.
  Other Simplifications.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74572

Files:
  clang/include/clang/Basic/BuiltinsBPF.def
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/Sema/SemaChecking.cpp
  llvm/include/llvm/IR/IntrinsicsBPF.td
  llvm/lib/Target/BPF/BPF.h
  llvm/lib/Target/BPF/BPFCORE.h
  llvm/lib/Target/BPF/BPFMISimplifyPatchable.cpp
  llvm/lib/Target/BPF/BPFPreserveDIType.cpp
  llvm/lib/Target/BPF/BPFTargetMachine.cpp
  llvm/lib/Target/BPF/BTFDebug.cpp
  llvm/lib/Target/BPF/BTFDebug.h
  llvm/lib/Target/BPF/CMakeLists.txt
  llvm/test/CodeGen/BPF/BTF/builtin-btf-type-id.ll

Index: llvm/test/CodeGen/BPF/BTF/builtin-btf-type-id.ll
===
--- /dev/null
+++ llvm/test/CodeGen/BPF/BTF/builtin-btf-type-id.ll
@@ -0,0 +1,147 @@
+; RUN: llc -march=bpfel -filetype=asm -o - %s | FileCheck -check-prefixes=CHECK %s
+; RUN: llc -march=bpfeb -filetype=asm -o - %s | FileCheck -check-prefixes=CHECK %s
+; RUN: llc -march=bpfel -mattr=+alu32 -filetype=asm -o - %s | FileCheck -check-prefixes=CHECK %s
+; RUN: llc -march=bpfeb -mattr=+alu32 -filetype=asm -o - %s | FileCheck -check-prefixes=CHECK %s
+;
+; Source code:
+;   static int (*bpf_log)(unsigned tid, void *data, int data_size) = (void *)999;
+;   struct {
+; char f1[100];
+; typeof(3) f2;
+;   } tmp__abc = {1, 3};
+;   void prog1() {
+; bpf_log(__builtin_btf_type_id(tmp__abc), __abc, sizeof(tmp__abc));
+;   }
+;   void prog2() {
+; bpf_log(__builtin_btf_type_id(__abc), __abc, sizeof(tmp__abc));
+;   }
+;   void prog3() {
+; bpf_log(__builtin_btf_type_id(tmp__abc.f1[3]), __abc, sizeof(tmp__abc));
+;   }
+; Compilation flag:
+;   clang -target bpf -O2 -g -S -emit-llvm test.c
+
+%struct.anon = type { [100 x i8], i32 }
+
+@tmp__abc = dso_local global { <{ i8, i8, [98 x i8] }>, i32 } { <{ i8, i8, [98 x i8] }> <{ i8 1, i8 3, [98 x i8] zeroinitializer }>, i32 0 }, align 4, !dbg !0
+
+; Function Attrs: nounwind
+define dso_local void @prog1() local_unnamed_addr #0 !dbg !28 {
+entry:
+  %0 = tail call i32 @llvm.bpf.btf.type.id.p0s_struct.anons.i32(%struct.anon* bitcast ({ <{ i8, i8, [98 x i8] }>, i32 }* @tmp__abc to %struct.anon*), i32 1), !dbg !31, !llvm.preserve.access.index !7
+  %call = tail call i32 inttoptr (i64 999 to i32 (i32, i8*, i32)*)(i32 %0, i8* getelementptr inbounds ({ <{ i8, i8, [98 x i8] }>, i32 }, { <{ i8, i8, [98 x i8] }>, i32 }* @tmp__abc, i64 0, i32 0, i32 0), i32 104) #2, !dbg !32
+  ret void, !dbg !33
+}
+
+; Function Attrs: nounwind readnone
+declare i32 @llvm.bpf.btf.type.id.p0s_struct.anons.i32(%struct.anon*, i32) #1
+
+; Function Attrs: nounwind
+define dso_local void @prog2() local_unnamed_addr #0 !dbg !34 {
+entry:
+  %0 = tail call i32 @llvm.bpf.btf.type.id.p0s_struct.anons.i32(%struct.anon* bitcast ({ <{ i8, i8, [98 x i8] }>, i32 }* @tmp__abc to %struct.anon*), i32 0), !dbg !35, !llvm.preserve.access.index !6
+  %call = tail call i32 inttoptr (i64 999 to i32 (i32, i8*, i32)*)(i32 %0, i8* getelementptr inbounds ({ <{ i8, i8, [98 x i8] }>, i32 }, { <{ i8, i8, [98 x i8] }>, i32 }* @tmp__abc, i64 0, i32 0, i32 0), i32 104) #2, !dbg !36
+  ret void, !dbg !37
+}
+
+; Function Attrs: nounwind
+define dso_local void @prog3() local_unnamed_addr #0 !dbg !38 {
+entry:
+  %0 = tail call i32 @llvm.bpf.btf.type.id.p0i8.i32(i8* getelementptr inbounds ({ <{ i8, i8, [98 x i8] }>, i32 }, { <{ i8, i8, [98 x i8] }>, i32 }* @tmp__abc, i64 0, i32 0, i32 2, i64 1), i32 1), !dbg !39, !llvm.preserve.access.index !11
+  %call = tail call i32 inttoptr (i64 999 to i32 (i32, i8*, i32)*)(i32 %0, i8* getelementptr inbounds ({ <{ i8, i8, [98 x i8] }>, i32 }, { <{ i8, i8, [98 x i8] }>, i32 }* @tmp__abc, i64 0, i32 0, i32 0), i32 104) #2, !dbg !40
+  ret void, !dbg !41
+}
+
+; CHECK-LABEL:   prog1
+; CHECK: r1 = 3
+; CHECK-LABEL:   prog2
+; CHECK: r1 = 10
+; CHECK-LABEL:   prog3
+; CHECK: r1 = 4
+;
+; CHECK: .long   0   # BTF_KIND_STRUCT(id = 3)
+; CHECK-NEXT:.long   67108866# 0x402
+; CHECK-NEXT:.long   104
+; CHECK-NEXT:.long   13
+; CHECK-NEXT:.long   5
+; CHECK-NEXT:.long   0   # 0x0
+; CHECK-NEXT:.long   16
+; CHECK-NEXT:.long   7
+; CHECK-NEXT:.long   800 # 0x320
+; CHECK-NEXT:.long   19  # BTF_KIND_INT(id = 4)
+; CHECK-NEXT:.long   16777216# 0x100
+; CHECK-NEXT:.long   1
+; CHECK-NEXT:.long   16777224# 0x108
+; CHECK: .long   0   # 

[PATCH] D74015: [AIX][Frontend] C++ ABI customizations for AIX boilerplate

2020-02-14 Thread Xiangling Liao via Phabricator via cfe-commits
Xiangling_L marked 3 inline comments as done.
Xiangling_L added inline comments.



Comment at: clang/lib/CodeGen/ItaniumCXXABI.cpp:520
+
+class XLCXXABI final : public ItaniumCXXABI {
+public:

sfertile wrote:
> Xiangling_L wrote:
> > sfertile wrote:
> > > Here would be a good place to add a comment to indicate that XL has 
> > > several C++ ABIs, but this represents the one used in 'xlClang++'.
> > You mean we have legacy XLC and XLClang++ ABI? But for static init, they 
> > have same implementation. So it's not a must to point it out. 
> > 
> > And also AFAIK, `static init` is the only thing we will differ from Generic 
> > Itanium ABI in the frontend, so basically it's the only thing we will add 
> > in this ABI.
> > 
> > I am okay with either way with a little concern that legacy XLC user may 
> > wonder is there any difference of static init implementation between XLC 
> > and XLClang++ ABI if we add the comment.
> Sorry, I had a matching comment on the 'XL' enum, but I must have deleted it 
> accidentally before submitting. I said I agreed with using just 'XL' since 
> there is only one XL C++ ABI implemented in Clang we don't have to worry 
> about differentiating between the 'legacy' XL and the C++11 XL ABIs. If you 
> did want to clarify then adding a comment here would be the only thing I 
> suggest.
I see. Thank you for your clarification.


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

https://reviews.llvm.org/D74015



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


[clang] 7053065 - Fix tests after previous commit

2020-02-14 Thread Aaron Puchert via cfe-commits

Author: Aaron Puchert
Date: 2020-02-14T19:41:01+01:00
New Revision: 705306526b5ca7eed2fa28ebf832873cbb5085ec

URL: 
https://github.com/llvm/llvm-project/commit/705306526b5ca7eed2fa28ebf832873cbb5085ec
DIFF: 
https://github.com/llvm/llvm-project/commit/705306526b5ca7eed2fa28ebf832873cbb5085ec.diff

LOG: Fix tests after previous commit

We don't want to test for this warning, so we just fix it.

Added: 


Modified: 
clang/test/Preprocessor/Weverything_pragma.c
clang/test/Preprocessor/pragma_diagnostic.c
clang/test/Preprocessor/pushable-diagnostics.c
clang/test/Sema/warn-unused-parameters.c

Removed: 




diff  --git a/clang/test/Preprocessor/Weverything_pragma.c 
b/clang/test/Preprocessor/Weverything_pragma.c
index 1815f554fffd..f2cf97ed4a1c 100644
--- a/clang/test/Preprocessor/Weverything_pragma.c
+++ b/clang/test/Preprocessor/Weverything_pragma.c
@@ -6,7 +6,7 @@
 // but -Weverything forces it
 #define UNUSED_MACRO1 1 // expected-warning{{macro is not used}}
 
-void foo() // expected-warning {{no previous prototype for function}}
+void foo(void) // expected-warning {{no previous prototype for function}}
 // expected-note@-1{{declare 'static' if the function is not intended to be 
used outside of this translation unit}}
 {
  // A diagnostic without DefaultIgnore, and not part of a group.

diff  --git a/clang/test/Preprocessor/pragma_diagnostic.c 
b/clang/test/Preprocessor/pragma_diagnostic.c
index 99724623207f..75d2bbc7190f 100644
--- a/clang/test/Preprocessor/pragma_diagnostic.c
+++ b/clang/test/Preprocessor/pragma_diagnostic.c
@@ -35,19 +35,19 @@
 #endif
 
 // Testing pragma clang diagnostic with -Weverything
-void ppo(){} // First test that we do not diagnose on this.
+void ppo(void){} // First test that we do not diagnose on this.
 
 #pragma clang diagnostic warning "-Weverything"
-void ppp(){} // expected-warning {{no previous prototype for function 'ppp'}}
+void ppp(void){} // expected-warning {{no previous prototype for function 
'ppp'}}
 // expected-note@-1{{declare 'static' if the function is not intended to be 
used outside of this translation unit}}
 
 #pragma clang diagnostic ignored "-Weverything" // Reset it.
-void ppq(){}
+void ppq(void){}
 
 #pragma clang diagnostic error "-Weverything" // Now set to error
-void ppr(){} // expected-error {{no previous prototype for function 'ppr'}}
+void ppr(void){} // expected-error {{no previous prototype for function 'ppr'}}
 // expected-note@-1{{declare 'static' if the function is not intended to be 
used outside of this translation unit}}
 
 #pragma clang diagnostic warning "-Weverything" // This should not be effective
-void pps(){} // expected-error {{no previous prototype for function 'pps'}}
+void pps(void){} // expected-error {{no previous prototype for function 'pps'}}
 // expected-note@-1{{declare 'static' if the function is not intended to be 
used outside of this translation unit}}

diff  --git a/clang/test/Preprocessor/pushable-diagnostics.c 
b/clang/test/Preprocessor/pushable-diagnostics.c
index 4a0dd895a78e..9eaf87d58f82 100644
--- a/clang/test/Preprocessor/pushable-diagnostics.c
+++ b/clang/test/Preprocessor/pushable-diagnostics.c
@@ -18,28 +18,28 @@ int c = 'df';  // expected-warning{{multi-character 
character constant}}
 
 // Test -Weverything
 
-void ppo0(){} // first verify that we do not give anything on this
+void ppo0(void){} // first verify that we do not give anything on this
 #pragma clang diagnostic push // now push
 
 #pragma clang diagnostic warning "-Weverything" 
-void ppr1(){} // expected-warning {{no previous prototype for function 'ppr1'}}
+void ppr1(void){} // expected-warning {{no previous prototype for function 
'ppr1'}}
 // expected-note@-1{{declare 'static' if the function is not intended to be 
used outside of this translation unit}}
 
 #pragma clang diagnostic push // push again
 #pragma clang diagnostic ignored "-Weverything"  // Set to ignore in this 
level.
-void pps2(){}
+void pps2(void){}
 #pragma clang diagnostic warning "-Weverything"  // Set to warning in this 
level.
-void ppt2(){} // expected-warning {{no previous prototype for function 'ppt2'}}
+void ppt2(void){} // expected-warning {{no previous prototype for function 
'ppt2'}}
 // expected-note@-1{{declare 'static' if the function is not intended to be 
used outside of this translation unit}}
 #pragma clang diagnostic error "-Weverything"  // Set to error in this level.
-void ppt3(){} // expected-error {{no previous prototype for function 'ppt3'}}
+void ppt3(void){} // expected-error {{no previous prototype for function 
'ppt3'}}
 // expected-note@-1{{declare 'static' if the function is not intended to be 
used outside of this translation unit}}
 #pragma clang diagnostic pop // pop should go back to warning level
 
-void pps1(){} // expected-warning {{no previous prototype for function 'pps1'}}
+void pps1(void){} // expected-warning {{no previous 

[PATCH] D74631: [clang][XCOFF] Indicate that XCOFF does not support COMDATs

2020-02-14 Thread David Tenty via Phabricator via cfe-commits
daltenty updated this revision to Diff 244708.
daltenty added a comment.

- Add missing newline


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74631

Files:
  clang/test/CodeGen/xcoff-comdat.cpp
  llvm/include/llvm/ADT/Triple.h


Index: llvm/include/llvm/ADT/Triple.h
===
--- llvm/include/llvm/ADT/Triple.h
+++ llvm/include/llvm/ADT/Triple.h
@@ -743,7 +743,7 @@
 
   /// Tests whether the target supports comdat
   bool supportsCOMDAT() const {
-return !isOSBinFormatMachO();
+return !(isOSBinFormatMachO() || isOSBinFormatXCOFF());
   }
 
   /// Tests whether the target uses emulated TLS as default.
Index: clang/test/CodeGen/xcoff-comdat.cpp
===
--- /dev/null
+++ clang/test/CodeGen/xcoff-comdat.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -triple powerpc-ibm-aix -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple powerpc64-ibm-aix -emit-llvm -o - %s | FileCheck %s
+
+class a {
+  virtual void d() {}
+  virtual void e();
+};
+void a::e() {}
+
+// CHECK-NOT: = comdat


Index: llvm/include/llvm/ADT/Triple.h
===
--- llvm/include/llvm/ADT/Triple.h
+++ llvm/include/llvm/ADT/Triple.h
@@ -743,7 +743,7 @@
 
   /// Tests whether the target supports comdat
   bool supportsCOMDAT() const {
-return !isOSBinFormatMachO();
+return !(isOSBinFormatMachO() || isOSBinFormatXCOFF());
   }
 
   /// Tests whether the target uses emulated TLS as default.
Index: clang/test/CodeGen/xcoff-comdat.cpp
===
--- /dev/null
+++ clang/test/CodeGen/xcoff-comdat.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -triple powerpc-ibm-aix -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple powerpc64-ibm-aix -emit-llvm -o - %s | FileCheck %s
+
+class a {
+  virtual void d() {}
+  virtual void e();
+};
+void a::e() {}
+
+// CHECK-NOT: = comdat
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D74631: [clang][XCOFF] Indicate that XCOFF does not support COMDATs

2020-02-14 Thread David Tenty via Phabricator via cfe-commits
daltenty created this revision.
daltenty added reviewers: stevewan, sfertile, Xiangling_L.
Herald added subscribers: llvm-commits, cfe-commits, dexonsmith.
Herald added projects: clang, LLVM.
daltenty updated this revision to Diff 244708.
daltenty added a comment.

- Add missing newline


XCOFF doesn't support COMDATs, so clang shouldn't emit them.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D74631

Files:
  clang/test/CodeGen/xcoff-comdat.cpp
  llvm/include/llvm/ADT/Triple.h


Index: llvm/include/llvm/ADT/Triple.h
===
--- llvm/include/llvm/ADT/Triple.h
+++ llvm/include/llvm/ADT/Triple.h
@@ -743,7 +743,7 @@
 
   /// Tests whether the target supports comdat
   bool supportsCOMDAT() const {
-return !isOSBinFormatMachO();
+return !(isOSBinFormatMachO() || isOSBinFormatXCOFF());
   }
 
   /// Tests whether the target uses emulated TLS as default.
Index: clang/test/CodeGen/xcoff-comdat.cpp
===
--- /dev/null
+++ clang/test/CodeGen/xcoff-comdat.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -triple powerpc-ibm-aix -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple powerpc64-ibm-aix -emit-llvm -o - %s | FileCheck %s
+
+class a {
+  virtual void d() {}
+  virtual void e();
+};
+void a::e() {}
+
+// CHECK-NOT: = comdat


Index: llvm/include/llvm/ADT/Triple.h
===
--- llvm/include/llvm/ADT/Triple.h
+++ llvm/include/llvm/ADT/Triple.h
@@ -743,7 +743,7 @@
 
   /// Tests whether the target supports comdat
   bool supportsCOMDAT() const {
-return !isOSBinFormatMachO();
+return !(isOSBinFormatMachO() || isOSBinFormatXCOFF());
   }
 
   /// Tests whether the target uses emulated TLS as default.
Index: clang/test/CodeGen/xcoff-comdat.cpp
===
--- /dev/null
+++ clang/test/CodeGen/xcoff-comdat.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -triple powerpc-ibm-aix -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple powerpc64-ibm-aix -emit-llvm -o - %s | FileCheck %s
+
+class a {
+  virtual void d() {}
+  virtual void e();
+};
+void a::e() {}
+
+// CHECK-NOT: = comdat
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D74436: Change clang option -ffp-model=precise to select ffp-contract=on

2020-02-14 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment.

Yeah, I agree with Steve here.  The great virtue of `-ffp-contract=on` over the 
more aggressive modes is that FMA formation is purely local to a single source 
expression, which means there's really no obstacle to treating it as 
implementation-guaranteed semantics.  Such behavior should be done consistently 
across compiler settings rather than potentially making the numeric result of 
an expression subject to optimizer settings and choices; the latter is fine for 
"fast" modes but not really acceptable as the default compiler behavior.  If a 
backend needs to legalize the intrinsic back to separate multiply + add 
instructions, that's okay, but it should do so consistently rather than only 
under a specific optimization level.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74436



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


[PATCH] D66919: Warn about zero-parameter K definitions in -Wstrict-prototypes

2020-02-14 Thread Aaron Puchert via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
aaronpuchert marked an inline comment as done.
Closed by commit rG2f26bc554270: Warn about zero-parameter KR definitions 
in -Wstrict-prototypes (authored by aaronpuchert).

Changed prior to commit:
  https://reviews.llvm.org/D66919?vs=217751=244705#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66919

Files:
  clang/lib/Sema/SemaDecl.cpp
  clang/test/Sema/warn-strict-prototypes.c
  clang/test/Sema/warn-strict-prototypes.cpp
  clang/test/Sema/warn-strict-prototypes.m


Index: clang/test/Sema/warn-strict-prototypes.m
===
--- clang/test/Sema/warn-strict-prototypes.m
+++ clang/test/Sema/warn-strict-prototypes.m
@@ -10,7 +10,7 @@
 
 @end
 
-void foo() {
+void foo() { // expected-warning {{this old-style function definition is not 
preceded by a prototype}}
   void (^block)() = // expected-warning {{this block declaration is not a 
prototype}}
 ^void(int arg) { // no warning
   };
Index: clang/test/Sema/warn-strict-prototypes.cpp
===
--- /dev/null
+++ clang/test/Sema/warn-strict-prototypes.cpp
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -verify -fsyntax-only -Wstrict-prototypes %s
+// expected-no-diagnostics
+
+void decl();
+void decl_void(void);
+
+void def() {}
+void def_void(void) {}
Index: clang/test/Sema/warn-strict-prototypes.c
===
--- clang/test/Sema/warn-strict-prototypes.c
+++ clang/test/Sema/warn-strict-prototypes.c
@@ -1,15 +1,18 @@
 // RUN: %clang_cc1 -triple i386-pc-unknown -fsyntax-only -Wstrict-prototypes 
-Wno-implicit-function-declaration -verify %s
 // RUN: %clang_cc1 -triple i386-pc-unknown -fsyntax-only -Wstrict-prototypes 
-fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
 
+// function definition with 0 params, no prototype, no preceding declaration.
+void foo0() {} // expected-warning {{this old-style function definition is not 
preceded by a prototype}}
+
 // function declaration with unspecified params
 void foo1(); // expected-warning {{this function declaration is not a 
prototype}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:11-[[@LINE-1]]:11}:"void"
 // function declaration with 0 params
 void foo2(void);
 
-// function definition with 0 params(for both cases),
-// valid according to 6.7.5.3/14
-void foo1() {}
+// function definition with 0 params, no prototype.
+void foo1() {} // expected-warning {{this old-style function definition is not 
preceded by a prototype}}
+// function definition with 0 params, prototype.
 void foo2(void) {}
 
 // function type typedef unspecified params
Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -14154,11 +14154,7 @@
   //   Warn if K function is defined without a previous declaration.
   //   This warning is issued only if the definition itself does not 
provide
   //   a prototype. Only K definitions do not provide a prototype.
-  //   An empty list in a function declarator that is part of a definition
-  //   of that function specifies that the function has no parameters
-  //   (C99 6.7.5.3p14)
-  if (!FD->hasWrittenPrototype() && FD->getNumParams() > 0 &&
-  !LangOpts.CPlusPlus) {
+  if (!FD->hasWrittenPrototype()) {
 TypeSourceInfo *TI = FD->getTypeSourceInfo();
 TypeLoc TL = TI->getTypeLoc();
 FunctionTypeLoc FTL = TL.getAsAdjusted();


Index: clang/test/Sema/warn-strict-prototypes.m
===
--- clang/test/Sema/warn-strict-prototypes.m
+++ clang/test/Sema/warn-strict-prototypes.m
@@ -10,7 +10,7 @@
 
 @end
 
-void foo() {
+void foo() { // expected-warning {{this old-style function definition is not preceded by a prototype}}
   void (^block)() = // expected-warning {{this block declaration is not a prototype}}
 ^void(int arg) { // no warning
   };
Index: clang/test/Sema/warn-strict-prototypes.cpp
===
--- /dev/null
+++ clang/test/Sema/warn-strict-prototypes.cpp
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -verify -fsyntax-only -Wstrict-prototypes %s
+// expected-no-diagnostics
+
+void decl();
+void decl_void(void);
+
+void def() {}
+void def_void(void) {}
Index: clang/test/Sema/warn-strict-prototypes.c
===
--- clang/test/Sema/warn-strict-prototypes.c
+++ clang/test/Sema/warn-strict-prototypes.c
@@ -1,15 +1,18 @@
 // RUN: %clang_cc1 -triple i386-pc-unknown -fsyntax-only -Wstrict-prototypes -Wno-implicit-function-declaration -verify %s
 // RUN: %clang_cc1 -triple i386-pc-unknown -fsyntax-only 

[PATCH] D74555: [clangd] Add a flag for setting isIncomplete flag true in all responses

2020-02-14 Thread Kirill Bobyrev via Phabricator via cfe-commits
kbobyrev abandoned this revision.
kbobyrev added a comment.

Okay, makes sense!


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

https://reviews.llvm.org/D74555



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


[clang] 2f26bc5 - Warn about zero-parameter K definitions in -Wstrict-prototypes

2020-02-14 Thread Aaron Puchert via cfe-commits

Author: Aaron Puchert
Date: 2020-02-14T19:25:02+01:00
New Revision: 2f26bc5542705c390bf17af2fdfc31e056147ea9

URL: 
https://github.com/llvm/llvm-project/commit/2f26bc5542705c390bf17af2fdfc31e056147ea9
DIFF: 
https://github.com/llvm/llvm-project/commit/2f26bc5542705c390bf17af2fdfc31e056147ea9.diff

LOG: Warn about zero-parameter K definitions in -Wstrict-prototypes

Summary:
Zero-parameter K definitions specify that the function has no
parameters, but they are still not prototypes, so calling the function
with the wrong number of parameters is just a warning, not an error.

The C11 standard doesn't seem to directly define what a prototype is,
but it can be inferred from 6.9.1p7: "If the declarator includes a
parameter type list, the list also specifies the types of all the
parameters; such a declarator also serves as a function prototype
for later calls to the same function in the same translation unit."
This refers to 6.7.6.3p5: "If, in the declaration “T D1”, D1 has
the form
D(parameter-type-list)
or
D(identifier-list_opt)
[...]". Later in 6.11.7 it also refers only to the parameter-type-list
variant as prototype: "The use of function definitions with separate
parameter identifier and declaration lists (not prototype-format
parameter type and identifier declarators) is an obsolescent feature."

We already correctly treat an empty parameter list as non-prototype
declaration, so we can just take that information.

GCC also warns about this with -Wstrict-prototypes.

This shouldn't affect C++, because there all FunctionType's are
FunctionProtoTypes. I added a simple test for that.

Reviewed By: aaron.ballman

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

Added: 
clang/test/Sema/warn-strict-prototypes.cpp

Modified: 
clang/lib/Sema/SemaDecl.cpp
clang/test/Sema/warn-strict-prototypes.c
clang/test/Sema/warn-strict-prototypes.m

Removed: 




diff  --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index ff0bd939613c..4c088aa47f55 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -14154,11 +14154,7 @@ Decl *Sema::ActOnFinishFunctionBody(Decl *dcl, Stmt 
*Body,
   //   Warn if K function is defined without a previous declaration.
   //   This warning is issued only if the definition itself does not 
provide
   //   a prototype. Only K definitions do not provide a prototype.
-  //   An empty list in a function declarator that is part of a definition
-  //   of that function specifies that the function has no parameters
-  //   (C99 6.7.5.3p14)
-  if (!FD->hasWrittenPrototype() && FD->getNumParams() > 0 &&
-  !LangOpts.CPlusPlus) {
+  if (!FD->hasWrittenPrototype()) {
 TypeSourceInfo *TI = FD->getTypeSourceInfo();
 TypeLoc TL = TI->getTypeLoc();
 FunctionTypeLoc FTL = TL.getAsAdjusted();

diff  --git a/clang/test/Sema/warn-strict-prototypes.c 
b/clang/test/Sema/warn-strict-prototypes.c
index 5565a09060fc..50b0f7d060f2 100644
--- a/clang/test/Sema/warn-strict-prototypes.c
+++ b/clang/test/Sema/warn-strict-prototypes.c
@@ -1,15 +1,18 @@
 // RUN: %clang_cc1 -triple i386-pc-unknown -fsyntax-only -Wstrict-prototypes 
-Wno-implicit-function-declaration -verify %s
 // RUN: %clang_cc1 -triple i386-pc-unknown -fsyntax-only -Wstrict-prototypes 
-fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
 
+// function definition with 0 params, no prototype, no preceding declaration.
+void foo0() {} // expected-warning {{this old-style function definition is not 
preceded by a prototype}}
+
 // function declaration with unspecified params
 void foo1(); // expected-warning {{this function declaration is not a 
prototype}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:11-[[@LINE-1]]:11}:"void"
 // function declaration with 0 params
 void foo2(void);
 
-// function definition with 0 params(for both cases),
-// valid according to 6.7.5.3/14
-void foo1() {}
+// function definition with 0 params, no prototype.
+void foo1() {} // expected-warning {{this old-style function definition is not 
preceded by a prototype}}
+// function definition with 0 params, prototype.
 void foo2(void) {}
 
 // function type typedef unspecified params

diff  --git a/clang/test/Sema/warn-strict-prototypes.cpp 
b/clang/test/Sema/warn-strict-prototypes.cpp
new file mode 100644
index ..6a3839ff9367
--- /dev/null
+++ b/clang/test/Sema/warn-strict-prototypes.cpp
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -verify -fsyntax-only -Wstrict-prototypes %s
+// expected-no-diagnostics
+
+void decl();
+void decl_void(void);
+
+void def() {}
+void def_void(void) {}

diff  --git a/clang/test/Sema/warn-strict-prototypes.m 
b/clang/test/Sema/warn-strict-prototypes.m
index 66d574f75f80..e2fde8ee38fc 100644
--- a/clang/test/Sema/warn-strict-prototypes.m
+++ b/clang/test/Sema/warn-strict-prototypes.m
@@ -10,7 +10,7 @@ @interface Foo
 
 @end
 

[PATCH] D66919: Warn about zero-parameter K definitions in -Wstrict-prototypes

2020-02-14 Thread Aaron Puchert via Phabricator via cfe-commits
aaronpuchert marked 5 inline comments as done.
aaronpuchert added a comment.

Thanks!




Comment at: clang/test/Sema/warn-strict-prototypes.c:11
+// function definition with 0 params, no prototype.
+void foo1() {} // expected-warning {{this old-style function definition is not 
preceded by a prototype}}
+// function definition with 0 params, prototype.

aaron.ballman wrote:
> aaronpuchert wrote:
> > aaronpuchert wrote:
> > > aaron.ballman wrote:
> > > > I'd like a few more test cases:
> > > > ```
> > > > // Test that a non-prototyped definition with no preceding prototype 
> > > > whines about lacking a preceding prototype
> > > > void fooN() {} // expected-warning {{this old-style function definition 
> > > > is not preceded by a prototype}}
> > > > 
> > > > // Test that an existing declaration with no prototype still warns that 
> > > > a corresponding definition with a type list is still not preceded by a 
> > > > prototype.
> > > > void fooN1(); // expected-warning {{this function declaration is not a 
> > > > prototype}}
> > > > void fooN1(void) {} // expected-warning {{this old-style function 
> > > > definition is not preceded by a prototype}}
> > > > ```
> > > I guess we want the warning only on the declaration of `fooN1`, not the 
> > > definition? Because that's not an old-style function definition.
> > Yeah, I'm not sure about `fooN1`. We can't emit the warning on the 
> > definition (and I think we also don't need to, as we diagnose that before), 
> > and the warning on the declaration is kind of tested already. (Note that 
> > there is also `-Wmissing-prototypes`.)
> > 
> > But `fooN` definitely makes sense, I'll add that.
> I think you're right about the `fooN1` definition not needing a warning -- I 
> was thinking we wanted to warn because there was no preceding prototype, but 
> it's not an old-style declaration at that definition. You can ignore that 
> suggestion.
Ok, then I'll submit this with `fooN`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66919



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


[PATCH] D74436: Change clang option -ffp-model=precise to select ffp-contract=on

2020-02-14 Thread Andy Kaylor via Phabricator via cfe-commits
andrew.w.kaylor added a subscriber: scanon.
andrew.w.kaylor added a comment.

In D74436#1875320 , @mibintc wrote:

> However you are right we don't want the frontend to create FMA when 
> optimizations are disabled -O0


I've been discussing this with @scanon on the cfe-dev mailing list, and he has 
convinced me that we should create FMA options at -O0 if the fp-contract 
setting is "on" -- including when it is on by default. The reasoning that 
persuaded me was, "preserving FMA formation at O0 _helps_ debuggability, 
because it means that numerical behavior is more likely to match what a user 
observed at Os, allowing them to debug the problem."


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74436



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


[PATCH] D66919: Warn about zero-parameter K definitions in -Wstrict-prototypes

2020-02-14 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments.



Comment at: clang/test/Sema/warn-strict-prototypes.c:11
+// function definition with 0 params, no prototype.
+void foo1() {} // expected-warning {{this old-style function definition is not 
preceded by a prototype}}
+// function definition with 0 params, prototype.

aaronpuchert wrote:
> aaronpuchert wrote:
> > aaron.ballman wrote:
> > > I'd like a few more test cases:
> > > ```
> > > // Test that a non-prototyped definition with no preceding prototype 
> > > whines about lacking a preceding prototype
> > > void fooN() {} // expected-warning {{this old-style function definition 
> > > is not preceded by a prototype}}
> > > 
> > > // Test that an existing declaration with no prototype still warns that a 
> > > corresponding definition with a type list is still not preceded by a 
> > > prototype.
> > > void fooN1(); // expected-warning {{this function declaration is not a 
> > > prototype}}
> > > void fooN1(void) {} // expected-warning {{this old-style function 
> > > definition is not preceded by a prototype}}
> > > ```
> > I guess we want the warning only on the declaration of `fooN1`, not the 
> > definition? Because that's not an old-style function definition.
> Yeah, I'm not sure about `fooN1`. We can't emit the warning on the definition 
> (and I think we also don't need to, as we diagnose that before), and the 
> warning on the declaration is kind of tested already. (Note that there is 
> also `-Wmissing-prototypes`.)
> 
> But `fooN` definitely makes sense, I'll add that.
I think you're right about the `fooN1` definition not needing a warning -- I 
was thinking we wanted to warn because there was no preceding prototype, but 
it's not an old-style declaration at that definition. You can ignore that 
suggestion.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66919



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


[PATCH] D66919: Warn about zero-parameter K definitions in -Wstrict-prototypes

2020-02-14 Thread Aaron Puchert via Phabricator via cfe-commits
aaronpuchert added inline comments.



Comment at: clang/test/Sema/warn-strict-prototypes.c:11
+// function definition with 0 params, no prototype.
+void foo1() {} // expected-warning {{this old-style function definition is not 
preceded by a prototype}}
+// function definition with 0 params, prototype.

aaronpuchert wrote:
> aaron.ballman wrote:
> > I'd like a few more test cases:
> > ```
> > // Test that a non-prototyped definition with no preceding prototype whines 
> > about lacking a preceding prototype
> > void fooN() {} // expected-warning {{this old-style function definition is 
> > not preceded by a prototype}}
> > 
> > // Test that an existing declaration with no prototype still warns that a 
> > corresponding definition with a type list is still not preceded by a 
> > prototype.
> > void fooN1(); // expected-warning {{this function declaration is not a 
> > prototype}}
> > void fooN1(void) {} // expected-warning {{this old-style function 
> > definition is not preceded by a prototype}}
> > ```
> I guess we want the warning only on the declaration of `fooN1`, not the 
> definition? Because that's not an old-style function definition.
Yeah, I'm not sure about `fooN1`. We can't emit the warning on the definition 
(and I think we also don't need to, as we diagnose that before), and the 
warning on the declaration is kind of tested already. (Note that there is also 
`-Wmissing-prototypes`.)

But `fooN` definitely makes sense, I'll add that.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66919



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


[PATCH] D66919: Warn about zero-parameter K definitions in -Wstrict-prototypes

2020-02-14 Thread Aaron Puchert via Phabricator via cfe-commits
aaronpuchert added inline comments.



Comment at: clang/test/Sema/warn-strict-prototypes.c:11
+// function definition with 0 params, no prototype.
+void foo1() {} // expected-warning {{this old-style function definition is not 
preceded by a prototype}}
+// function definition with 0 params, prototype.

aaron.ballman wrote:
> I'd like a few more test cases:
> ```
> // Test that a non-prototyped definition with no preceding prototype whines 
> about lacking a preceding prototype
> void fooN() {} // expected-warning {{this old-style function definition is 
> not preceded by a prototype}}
> 
> // Test that an existing declaration with no prototype still warns that a 
> corresponding definition with a type list is still not preceded by a 
> prototype.
> void fooN1(); // expected-warning {{this function declaration is not a 
> prototype}}
> void fooN1(void) {} // expected-warning {{this old-style function definition 
> is not preceded by a prototype}}
> ```
I guess we want the warning only on the declaration of `fooN1`, not the 
definition? Because that's not an old-style function definition.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66919



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


[PATCH] D74116: [Sema][C++] Strawman patch to propagate conversion type in order to specialize the diagnostics

2020-02-14 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment.

The C diagnostic changes seem like improvements, yeah.  The virtue of re-using 
the same infrastructure across language modes.




Comment at: clang/lib/Sema/SemaExprCXX.cpp:3880
+ToType, From->getType(), From, Action);
+// assert(Diagnosed && "failed to diagnose bad conversion");
+(void)Diagnosed;

This assertion seems important; can we make it work?


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

https://reviews.llvm.org/D74116



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


[PATCH] D74116: [Sema][C++] Strawman patch to propagate conversion type in order to specialize the diagnostics

2020-02-14 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia added a comment.



> It looks like there's already some type analysis in 
> `DiagnoseAssignmentResult` to get a specialized diagnostic for certain cases 
> of function-pointer assignment.  That could probably be easily moved into 
> `CheckAssignmentConstraints` by just adding a few more cases to 
> `AssignConvertResult`.

One interesting effect I get after modifying this that some extra tests in C 
mode started to report function pointer instead of generic pointer warning. I 
feel this is because in `checkPointerTypesForAssignment`  we use canonical 
types and in `DiagnoseAssignmentResult` we don't.

Perhaps this way is better? I can update the test if so and then finalize some 
other bits.

  FAIL: Clang :: Sema/block-return.c (9341 of 16808)
   TEST 'Clang :: Sema/block-return.c' FAILED 

  Script:
  --
  : 'RUN: at line 1';   <...>build/bin/clang -cc1 -internal-isystem 
<...>build/lib/clang/11.0.0/include -nostdsysteminc -Wno-int-to-pointer-cast 
-pedantic -fsyntax-only <...>clang/test/Sema/block-return.c -verify -fblocks
  --
  Exit Code: 1
  
  Command Output (stderr):
  --
  error: 'warning' diagnostics expected but not seen: 
File <...>clang/test/Sema/block-return.c Line 82: incompatible pointer 
types initializing 'int (*)(const char *)' with an expression of type 'int 
(char *)'
  error: 'warning' diagnostics seen but not expected: 
File <...>clang/test/Sema/block-return.c Line 82: incompatible function 
pointer types initializing 'int (*)(const char *)' with an expression of type 
'int (char *)'
  2 errors generated.
  
  --
  
  
  FAIL: Clang :: Sema/callingconv-ms_abi.c (9396 of 16808)
   TEST 'Clang :: Sema/callingconv-ms_abi.c' FAILED 

  Script:
  --
  : 'RUN: at line 1';   <...>build/bin/clang -cc1 -internal-isystem 
<...>build/lib/clang/11.0.0/include -nostdsysteminc -fsyntax-only -verify 
-triple x86_64-pc-win32 <...>clang/test/Sema/callingconv-ms_abi.c
  --
  Exit Code: 1
  
  Command Output (stderr):
  --
  error: 'warning' diagnostics expected but not seen: 
File <...>clang/test/Sema/callingconv-ms_abi.c Line 7: incompatible pointer 
types
File <...>clang/test/Sema/callingconv-ms_abi.c Line 9: incompatible pointer 
types
  error: 'warning' diagnostics seen but not expected: 
File <...>clang/test/Sema/callingconv-ms_abi.c Line 7: incompatible 
function pointer types initializing 'void (*)(void)' with an expression of type 
'void (void) __attribute__((sysv_abi))'
File <...>clang/test/Sema/callingconv-ms_abi.c Line 9: incompatible 
function pointer types initializing 'void (*)(void) __attribute__((sysv_abi))' 
with an expression of type 'void (void) __attribute__((ms_abi))'
  4 errors generated.
  
  --
  
  
  FAIL: Clang :: Sema/callingconv-sysv_abi.c (9397 of 16808)
   TEST 'Clang :: Sema/callingconv-sysv_abi.c' FAILED 

  Script:
  --
  : 'RUN: at line 1';   <...>build/bin/clang -cc1 -internal-isystem 
<...>build/lib/clang/11.0.0/include -nostdsysteminc -fsyntax-only -verify 
-triple x86_64-pc-linux-gnu <...>clang/test/Sema/callingconv-sysv_abi.c
  --
  Exit Code: 1
  
  Command Output (stderr):
  --
  error: 'warning' diagnostics expected but not seen: 
File <...>clang/test/Sema/callingconv-sysv_abi.c Line 4: incompatible 
pointer types
File <...>clang/test/Sema/callingconv-sysv_abi.c Line 9: incompatible 
pointer types
  error: 'warning' diagnostics seen but not expected: 
File <...>clang/test/Sema/callingconv-sysv_abi.c Line 4: incompatible 
function pointer types initializing 'void (*)(void)' with an expression of type 
'void (void) __attribute__((ms_abi))'
File <...>clang/test/Sema/callingconv-sysv_abi.c Line 9: incompatible 
function pointer types initializing 'void (*)(void) __attribute__((ms_abi))' 
with an expression of type 'void (void) __attribute__((sysv_abi))'
  4 errors generated.
  
  --
  
  
  FAIL: Clang :: Sema/callingconv.c (9398 of 16808)
   TEST 'Clang :: Sema/callingconv.c' FAILED 

  Script:
  --
  : 'RUN: at line 1';   <...>build/bin/clang -cc1 -internal-isystem 
<...>build/lib/clang/11.0.0/include -nostdsysteminc 
<...>clang/test/Sema/callingconv.c -fsyntax-only -triple i386-unknown-unknown 
-verify
  : 'RUN: at line 2';   <...>build/bin/clang -cc1 -internal-isystem 
<...>build/lib/clang/11.0.0/include -nostdsysteminc 
<...>clang/test/Sema/callingconv.c -fsyntax-only -triple i386-unknown-unknown 
-fms-compatibility -DWIN -verify
  --
  Exit Code: 1
  
  Command Output (stderr):
  --
  error: 'warning' diagnostics expected but not seen: 
File <...>clang/test/Sema/callingconv.c Line 34: incompatible pointer types
  error: 'warning' diagnostics seen but not expected: 
File <...>clang/test/Sema/callingconv.c Line 34: incompatible function 
pointer types initializing 'void (*)(void) 

[PATCH] D74116: [Sema][C++] Strawman patch to propagate conversion type in order to specialize the diagnostics

2020-02-14 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia updated this revision to Diff 244691.
Anastasia added a comment.
Herald added a reviewer: jdoerfert.

- Switched to using `CheckAssignmentConstraints`
- Duplicated all extensions and warnings as errors for C++ mode
- Added `IncompatibleFunctionPointer`


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

https://reviews.llvm.org/D74116

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Sema/Sema.h
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaExprCXX.cpp
  clang/test/CXX/conv/conv.fctptr/p1.cpp
  clang/test/CXX/drs/dr3xx.cpp
  clang/test/CXX/except/except.handle/p16.cpp
  clang/test/CXX/expr/p13.cpp
  clang/test/CXX/temp/temp.spec/temp.expl.spec/p19.cpp
  clang/test/CXX/temp/temp.spec/temp.explicit/p10.cpp
  clang/test/CXX/temp/temp.spec/temp.explicit/p9.cpp
  clang/test/OpenMP/allocate_allocator_messages.cpp
  clang/test/SemaCXX/addr-of-overloaded-function.cpp
  clang/test/SemaCXX/decl-microsoft-call-conv.cpp
  clang/test/SemaCXX/goto.cpp
  clang/test/SemaCXX/int-ptr-cast-SFINAE.cpp
  clang/test/SemaCXX/ms-property-error.cpp
  clang/test/SemaObjCXX/arc-type-conversion.mm
  clang/test/SemaObjCXX/comptypes-1.mm
  clang/test/SemaObjCXX/comptypes-7.mm
  clang/test/SemaObjCXX/instantiate-expr.mm
  clang/test/SemaObjCXX/instantiate-stmt.mm
  clang/test/SemaObjCXX/noescape.mm
  clang/test/SemaObjCXX/nullability-pragmas.mm
  clang/test/SemaObjCXX/objc-container-subscripting.mm
  clang/test/SemaObjCXX/parameterized_classes_subst.mm
  clang/test/SemaObjCXX/property-invalid-type.mm
  clang/test/SemaOpenCL/address-spaces-conversions-cl2.0.cl
  clang/test/SemaOpenCL/address-spaces.cl
  clang/test/SemaTemplate/extern-templates.cpp
  clang/test/SemaTemplate/instantiate-member-class.cpp
  clang/test/SemaTemplate/member-access-expr.cpp
  clang/test/SemaTemplate/temp_arg_nontype.cpp

Index: clang/test/SemaTemplate/temp_arg_nontype.cpp
===
--- clang/test/SemaTemplate/temp_arg_nontype.cpp
+++ clang/test/SemaTemplate/temp_arg_nontype.cpp
@@ -194,7 +194,7 @@
   template
   struct Y {
 static void f(T x) { 
-  x = 1; // expected-error{{assigning to 'int *' from incompatible type 'int'}}
+  x = 1; // expected-error{{incompatible integer to pointer conversion assigning to 'int *' from 'int'}}
 }
   };
 
Index: clang/test/SemaTemplate/member-access-expr.cpp
===
--- clang/test/SemaTemplate/member-access-expr.cpp
+++ clang/test/SemaTemplate/member-access-expr.cpp
@@ -156,7 +156,7 @@
 void get(B **ptr) {
   // It's okay if at some point we figure out how to diagnose this
   // at instantiation time.
-  *ptr = field; // expected-error {{assigning to 'test6::B *' from incompatible type 'test6::A *}}
+  *ptr = field; // expected-error {{incompatible pointer types assigning to 'test6::B *' from 'test6::A *'}}
 }
   };
 }
Index: clang/test/SemaTemplate/instantiate-member-class.cpp
===
--- clang/test/SemaTemplate/instantiate-member-class.cpp
+++ clang/test/SemaTemplate/instantiate-member-class.cpp
@@ -43,8 +43,8 @@
 X::X *xf; // expected-error{{qualified reference to 'X' is a constructor name rather than a type}}
 
 void test_naming() {
-  c1 = c2; // expected-error{{assigning to 'X::C *' from incompatible type 'X::C *'}}
-  xi = xf;  // expected-error{{assigning to 'X::X *' from incompatible type 'X::X *'}}
+  c1 = c2; // expected-error{{incompatible pointer types assigning to 'X::C *' from 'X::C *'}}
+  xi = xf;  // expected-error{{incompatible pointer types assigning to 'X::X *' from 'X::X *'}}
 // FIXME: error above doesn't print the type X::X cleanly!
 }
 
Index: clang/test/SemaTemplate/extern-templates.cpp
===
--- clang/test/SemaTemplate/extern-templates.cpp
+++ clang/test/SemaTemplate/extern-templates.cpp
@@ -23,9 +23,9 @@
 template
 void X0::Inner::g(T t) {
 #ifdef MS
-  t = 17; // expected-error{{assigning to 'long *' from incompatible}} expected-error{{assigning to 'int *' from incompatible}}
+  t = 17; // expected-error{{incompatible integer to pointer conversion assigning to 'long *'}} expected-error{{incompatible integer to pointer conversion assigning to 'int *'}}
 #else
-  t = 17; // expected-error{{assigning to 'long *' from incompatible}}
+  t = 17; // expected-error{{incompatible integer to pointer conversion assigning to 'long *'}}
 #endif
 }
 
Index: clang/test/SemaOpenCL/address-spaces.cl
===
--- clang/test/SemaOpenCL/address-spaces.cl
+++ clang/test/SemaOpenCL/address-spaces.cl
@@ -20,7 +20,7 @@
 #if !__OPENCL_CPP_VERSION__
 // expected-error@-2 {{assigning '__constant int *' to '__generic int *__private' changes address space of pointer}}
 #else
-// expected-error@-4 {{assigning to '__generic int *' 

[PATCH] D71830: [OpenMP][Part 2] Use reusable OpenMP context/traits handling

2020-02-14 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.

LGTM aside from some small nits.




Comment at: clang/include/clang/Basic/Attr.td:186-192
+// an OMPTraitInfo object. The structure of an OMPTraitInfo object is a
+// tree as defined below:
+//
+//   OMPTraitInfo := {list}
+//   OMPTraitSet  := {Kind, list}
+//   OMPTraitSelector := {Kind, Expr, list}
+//   OMPTraitProperty := {Kind}

Rather than describing the internal data structure form, I am hoping for 
comments that show the format of the user-facing pragma arguments. e.g., what 
information is in what position. Basically, something so I can mentally map 
from "OMPTraitsInfoArgument" to "oh, that's right, the arguments are specified 
in this order with these types" (roughly -- a general idea of the argument is 
all I'm looking for).



Comment at: clang/lib/Parse/ParseOpenMP.cpp:1379
   // Parse inner context selectors.
-  SmallVector Data;
-  if (!parseOpenMPContextSelectors(Loc, Data)) {
-// Parse ')'.
-(void)T.consumeClose();
-// 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_variant);
-}
-  }
+  OMPTraitInfo *TI = new OMPTraitInfo();
+  parseOMPContextSelectors(Loc, *TI);

jdoerfert wrote:
> jdoerfert wrote:
> > aaron.ballman wrote:
> > > What is responsible for freeing this memory?
> > Will check and fix if needed.
> I made sure all OMPTraitInfo are freed, I think. If an 
> `OMPDeclareVariantAttr` is build its taking owenership and calls delete in 
> the destructor.
That is reasonable enough -- any chance we can easily turn it into a 
`std::unique_ptr<>` and then get rid of the destructor entirely? I don't 
insist, but it would be cleaner, to my thinking.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71830



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


[PATCH] D74571: [OpenMP][CUDA] Add CUDA 10.2 support

2020-02-14 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert added a comment.

In D74571#1876617 , @kkwli0 wrote:

> Thanks for all the comments.  It makes sense to keep the warning there before 
> any ptx65 features are added.  The warning should also apply to both the CUDA 
> and OpenMP compile paths.  As a result, I will pursue to ignore the warning 
> in the build of libomp (i.e. libomp_check_linker_flag function in 
> LibompCheckLinkerFlag.cmake).  I think it is less pervasive and also can 
> avoid similar occurrence when a new version of CUDA toolkit is available.
>
> If users are annoyed by many many warning messages in the build, as @tra 
> suggested, users can just use -Wno-unknown-cuda-version to suppress it.
>
> Comments?


That sounds like the right approach for OpenMP. We require a minimal CUDA 
version, based on what we use internally, but no maximal version if possible 
since we don't use new features anyway.


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

https://reviews.llvm.org/D74571



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


[PATCH] D74620: [ARM,MVE] Add vector-scalar intrinsics

2020-02-14 Thread Mikhail Maltsev via Phabricator via cfe-commits
miyuki added a comment.

I would prefer not to format the Clang test cases to avoid code churn.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74620



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


[PATCH] D74571: [OpenMP][CUDA] Add CUDA 10.2 support

2020-02-14 Thread Kelvin Li via Phabricator via cfe-commits
kkwli0 added a comment.

Thanks for all the comments.  It makes sense to keep the warning there before 
any ptx65 features are added.  The warning should also apply to both the CUDA 
and OpenMP compile paths.  As a result, I will pursue to ignore the warning in 
the build of libomp (i.e. libomp_check_linker_flag function in 
LibompCheckLinkerFlag.cmake).  I think it is less pervasive and also can avoid 
similar occurrence when a new version of CUDA toolkit is available.

Comments?


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

https://reviews.llvm.org/D74571



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


[PATCH] D73951: [Clang] [Driver]Add logic to search for flang frontend

2020-02-14 Thread Caroline via Phabricator via cfe-commits
CarolineConcatto marked an inline comment as done.
CarolineConcatto added inline comments.



Comment at: clang/test/Driver/flang/clang-driver-2-frontend01.f90:10
+! RUN: cp %clang %t1
+! RUN: %clang --driver-mode=flang -fortran-fe %basename_t.tmp1 -### %s 2>&1 | 
FileCheck --check-prefixes=ALL %s
+

richard.barton.arm wrote:
> Does %t1 not work again on this line?
If I don't create the fake link getProgramPath will only return the name, not 
the entire path.
t1 here is the path for the frontend.  
For instance:
clang --driver-mode=flang -fortran-fe %test
the frontend name is test, but when running it should print:
 /test -fc1
 without the link it will only print:
test -fc1
Like I said before it is more a preference that actually a requisite.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73951



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


[PATCH] D73951: [Clang] [Driver]Add logic to search for flang frontend

2020-02-14 Thread Richard Barton via Phabricator via cfe-commits
richard.barton.arm added inline comments.



Comment at: clang/include/clang/Driver/Options.td:268
+def fortran_fe : Separate<["-"], "fortran-fe">, InternalDriverOpt,
+  HelpText<"Name for native Fortran compiler">;
 

richard.barton.arm wrote:
> This is not right. I think the option points the driver at the name of the 
> Fortran frontend to call. I don't think that has to be native or otherwise. 
> Suggest changing this string to "Name for Fortran frontend"
I prefer the new option name though - thanks.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73951



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


[PATCH] D73951: [Clang] [Driver]Add logic to search for flang frontend

2020-02-14 Thread Richard Barton via Phabricator via cfe-commits
richard.barton.arm added a comment.

Still not sure why all the tests are needed here. The first one looks fine, 
i.e. we test that --fortran-fe= 
calls to that copy. The second one appears to test the default behaviour with 
no option, but why does it do it via a different name for clang, why would that 
make a difference? The second uses a different name for both driver and 
frontend. Why is that test relevant to the change you have made? As far as I 
can see, the name of the driver binary has no bearing on its behaviour wrt. 
calling a frontend binary. What am I missing?




Comment at: clang/include/clang/Driver/Options.td:268
+def fortran_fe : Separate<["-"], "fortran-fe">, InternalDriverOpt,
+  HelpText<"Name for native Fortran compiler">;
 

This is not right. I think the option points the driver at the name of the 
Fortran frontend to call. I don't think that has to be native or otherwise. 
Suggest changing this string to "Name for Fortran frontend"



Comment at: clang/test/Driver/flang/clang-driver-2-frontend01.f90:10
+! RUN: cp %clang %t1
+! RUN: %clang --driver-mode=flang -fortran-fe %basename_t.tmp1 -### %s 2>&1 | 
FileCheck --check-prefixes=ALL %s
+

Does %t1 not work again on this line?



Comment at: clang/test/Driver/flang/flang-driver-2-frontend01.f90:10
+
+! The invocations should begin with .tmp1 -fc1.
+! ALL-LABEL: "{{[^"]*}}flang" "-fc1"

No they shouldn't ?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73951



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


[PATCH] D74436: Change clang option -ffp-model=precise to select ffp-contract=on

2020-02-14 Thread Jinsong Ji via Phabricator via cfe-commits
jsji added a comment.

In D74436#1875320 , @mibintc wrote:

> @jsji Will your backend tolerate -ffp-contract=on if optimizations are not 
> disabled, e.g. -O2?  We are proposing that the default floating point model 
> be -ffp-model=precise, and with precise model, the ffp-contract=on. However 
> you are right we don't want the frontend to create FMA when optimizations are 
> disabled -O0


We normally default to `-ffp-contract=on ` only for -O3 and above (for legacy 
compilers XL/gcc on PowerPC).
But yes, I think we are OK to accept  `-ffp-contract=on` (not 
`-ffp-contract=fast`)  at -O2 if there are strong justifications to do so on 
clang.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74436



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


[PATCH] D74555: [clangd] Add a flag for setting isIncomplete flag true in all responses

2020-02-14 Thread Sam McCall via Phabricator via cfe-commits
sammccall added a comment.

The idea is this is an easy option for the user to work-around editors that do 
client-side filtering badly (everyone lets you add flags).
But as mentioned offline, I don't think we actually have an example of an 
editor this fixes (I think it fixes neither vscode nor coc.nvim). So in that 
case we shouldn't land it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74555



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


[PATCH] D73898: [analyzer] StdLibraryFunctionsChecker: Add argument constraints

2020-02-14 Thread Balázs Kéri via Phabricator via cfe-commits
balazske added a comment.

Probably a better solution can be:
For every "case" build a single `SVal` that contains all argument constraints 
for that case. It is possible using multiple `evalBinOp` calls (with <=, >=, 
logical or) to build such a condition (or repeated calls to other assume 
functions to cut off outer ranges). If the condition can be satisfied (by 
assume) add the new state, the condition for return value can be added here 
too. Repeat this for every different case. If no applicable case is found none 
of the conditions can be assumed, this means argument constraint error.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73898



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


[PATCH] D74591: [Driver] Rename AddGoldPlugin to addLTOOptions. NFC

2020-02-14 Thread Fangrui Song via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG597dfb3bd56c: [Driver] Rename AddGoldPlugin to 
addLTOOptions. NFC (authored by MaskRay).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74591

Files:
  clang/lib/Driver/ToolChains/Ananas.cpp
  clang/lib/Driver/ToolChains/CloudABI.cpp
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/lib/Driver/ToolChains/CommonArgs.h
  clang/lib/Driver/ToolChains/FreeBSD.cpp
  clang/lib/Driver/ToolChains/Fuchsia.cpp
  clang/lib/Driver/ToolChains/Gnu.cpp


Index: clang/lib/Driver/ToolChains/Gnu.cpp
===
--- clang/lib/Driver/ToolChains/Gnu.cpp
+++ clang/lib/Driver/ToolChains/Gnu.cpp
@@ -512,7 +512,7 @@
 
   if (D.isUsingLTO()) {
 assert(!Inputs.empty() && "Must have at least one input.");
-AddGoldPlugin(ToolChain, Args, CmdArgs, Output, Inputs[0],
+addLTOOptions(ToolChain, Args, CmdArgs, Output, Inputs[0],
   D.getLTOMode() == LTOK_Thin);
   }
 
Index: clang/lib/Driver/ToolChains/Fuchsia.cpp
===
--- clang/lib/Driver/ToolChains/Fuchsia.cpp
+++ clang/lib/Driver/ToolChains/Fuchsia.cpp
@@ -111,7 +111,7 @@
 
   if (D.isUsingLTO()) {
 assert(!Inputs.empty() && "Must have at least one input.");
-AddGoldPlugin(ToolChain, Args, CmdArgs, Output, Inputs[0],
+addLTOOptions(ToolChain, Args, CmdArgs, Output, Inputs[0],
   D.getLTOMode() == LTOK_Thin);
   }
 
Index: clang/lib/Driver/ToolChains/FreeBSD.cpp
===
--- clang/lib/Driver/ToolChains/FreeBSD.cpp
+++ clang/lib/Driver/ToolChains/FreeBSD.cpp
@@ -275,7 +275,7 @@
 
   if (D.isUsingLTO()) {
 assert(!Inputs.empty() && "Must have at least one input.");
-AddGoldPlugin(ToolChain, Args, CmdArgs, Output, Inputs[0],
+addLTOOptions(ToolChain, Args, CmdArgs, Output, Inputs[0],
   D.getLTOMode() == LTOK_Thin);
   }
 
Index: clang/lib/Driver/ToolChains/CommonArgs.h
===
--- clang/lib/Driver/ToolChains/CommonArgs.h
+++ clang/lib/Driver/ToolChains/CommonArgs.h
@@ -58,7 +58,7 @@
 const JobAction , const llvm::opt::ArgList ,
 const InputInfo , const char *OutFile);
 
-void AddGoldPlugin(const ToolChain , const llvm::opt::ArgList ,
+void addLTOOptions(const ToolChain , const llvm::opt::ArgList ,
llvm::opt::ArgStringList , const InputInfo ,
const InputInfo , bool IsThinLTO);
 
Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -353,7 +353,7 @@
   return Triple.getOS() == llvm::Triple::CloudABI;
 }
 
-void tools::AddGoldPlugin(const ToolChain , const ArgList ,
+void tools::addLTOOptions(const ToolChain , const ArgList ,
   ArgStringList , const InputInfo ,
   const InputInfo , bool IsThinLTO) {
   const char *Linker = Args.MakeArgString(ToolChain.GetLinkerPath());
Index: clang/lib/Driver/ToolChains/CloudABI.cpp
===
--- clang/lib/Driver/ToolChains/CloudABI.cpp
+++ clang/lib/Driver/ToolChains/CloudABI.cpp
@@ -75,7 +75,7 @@
 
   if (D.isUsingLTO()) {
 assert(!Inputs.empty() && "Must have at least one input.");
-AddGoldPlugin(ToolChain, Args, CmdArgs, Output, Inputs[0],
+addLTOOptions(ToolChain, Args, CmdArgs, Output, Inputs[0],
   D.getLTOMode() == LTOK_Thin);
   }
 
Index: clang/lib/Driver/ToolChains/Ananas.cpp
===
--- clang/lib/Driver/ToolChains/Ananas.cpp
+++ clang/lib/Driver/ToolChains/Ananas.cpp
@@ -103,7 +103,7 @@
 
   if (D.isUsingLTO()) {
 assert(!Inputs.empty() && "Must have at least one input.");
-AddGoldPlugin(ToolChain, Args, CmdArgs, Output, Inputs[0],
+addLTOOptions(ToolChain, Args, CmdArgs, Output, Inputs[0],
   D.getLTOMode() == LTOK_Thin);
   }
 


Index: clang/lib/Driver/ToolChains/Gnu.cpp
===
--- clang/lib/Driver/ToolChains/Gnu.cpp
+++ clang/lib/Driver/ToolChains/Gnu.cpp
@@ -512,7 +512,7 @@
 
   if (D.isUsingLTO()) {
 assert(!Inputs.empty() && "Must have at least one input.");
-AddGoldPlugin(ToolChain, Args, CmdArgs, Output, Inputs[0],
+addLTOOptions(ToolChain, Args, CmdArgs, Output, Inputs[0],
   D.getLTOMode() == LTOK_Thin);
   }
 
Index: clang/lib/Driver/ToolChains/Fuchsia.cpp
===
--- clang/lib/Driver/ToolChains/Fuchsia.cpp
+++ 

[PATCH] D74617: [ARM] Keeping sign information on bitcasts for Neon vdot_lane intrinsics

2020-02-14 Thread Lucas Prates via Phabricator via cfe-commits
pratlucas created this revision.
Herald added subscribers: cfe-commits, kristof.beyls.
Herald added a project: clang.

Sign information was being lost on Neon's vdot_lane intrinsics arguments
when bitcasting explicitly to uint32 vector types. This patch introduces
a new cast option to allow casting the operand to the equivalent vector
type of 32-bit integers, keeping the sign information.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D74617

Files:
  clang/include/clang/Basic/arm_neon.td
  clang/include/clang/Basic/arm_neon_incl.td
  clang/utils/TableGen/NeonEmitter.cpp


Index: clang/utils/TableGen/NeonEmitter.cpp
===
--- clang/utils/TableGen/NeonEmitter.cpp
+++ clang/utils/TableGen/NeonEmitter.cpp
@@ -238,6 +238,11 @@
 NumVectors = 1;
   }
 
+  void make32BitElement() {
+assert_with_loc(Bitwidth > 32, "Not enough bits to make it 32!");
+ElementBitwidth = 32;
+  }
+
   void doubleLanes() {
 assert_with_loc(Bitwidth != 128, "Can't get bigger than 128!");
 Bitwidth = 128;
@@ -1486,6 +1491,8 @@
 castToType.doubleLanes();
   } else if (SI->getAsUnquotedString() == "8") {
 castToType.makeInteger(8, true);
+  } else if (SI->getAsUnquotedString() == "32") {
+castToType.make32BitElement();
   } else {
 castToType = Type::fromTypedefName(SI->getAsUnquotedString());
 assert_with_loc(!castToType.isVoid(), "Unknown typedef");
Index: clang/include/clang/Basic/arm_neon_incl.td
===
--- clang/include/clang/Basic/arm_neon_incl.td
+++ clang/include/clang/Basic/arm_neon_incl.td
@@ -79,6 +79,7 @@
 //  - "D" - Double the number of lanes in the type.
 //  - "8" - Convert type to an equivalent vector of 8-bit signed
 //  integers.
+//  - "32" - Convert type to an equivalent vector of 32-bit integers.
 // example: (cast "R", "U", $p0) -> "(uint32x4_t)__p0" (assuming the return
 //   value is of type "int32x4_t".
 //  (cast $p0, "D", "8", $p1) -> "(int8x16_t)__p1" (assuming __p0
Index: clang/include/clang/Basic/arm_neon.td
===
--- clang/include/clang/Basic/arm_neon.td
+++ clang/include/clang/Basic/arm_neon.td
@@ -207,10 +207,10 @@
 
 def OP_DOT_LN
 : Op<(call "vdot", $p0, $p1,
-  (bitcast $p1, (splat(bitcast "uint32x2_t", $p2), $p3)))>;
+  (bitcast $p1, (splat(bitcast "32", $p2), $p3)))>;
 def OP_DOT_LNQ
 : Op<(call "vdot", $p0, $p1,
-  (bitcast $p1, (splat(bitcast "uint32x4_t", $p2), $p3)))>;
+  (bitcast $p1, (splat(bitcast "32", $p2), $p3)))>;
 
 def OP_FMLAL_LN : Op<(call "vfmlal_low", $p0, $p1,
(dup_typed $p1, (call "vget_lane", $p2, $p3)))>;


Index: clang/utils/TableGen/NeonEmitter.cpp
===
--- clang/utils/TableGen/NeonEmitter.cpp
+++ clang/utils/TableGen/NeonEmitter.cpp
@@ -238,6 +238,11 @@
 NumVectors = 1;
   }
 
+  void make32BitElement() {
+assert_with_loc(Bitwidth > 32, "Not enough bits to make it 32!");
+ElementBitwidth = 32;
+  }
+
   void doubleLanes() {
 assert_with_loc(Bitwidth != 128, "Can't get bigger than 128!");
 Bitwidth = 128;
@@ -1486,6 +1491,8 @@
 castToType.doubleLanes();
   } else if (SI->getAsUnquotedString() == "8") {
 castToType.makeInteger(8, true);
+  } else if (SI->getAsUnquotedString() == "32") {
+castToType.make32BitElement();
   } else {
 castToType = Type::fromTypedefName(SI->getAsUnquotedString());
 assert_with_loc(!castToType.isVoid(), "Unknown typedef");
Index: clang/include/clang/Basic/arm_neon_incl.td
===
--- clang/include/clang/Basic/arm_neon_incl.td
+++ clang/include/clang/Basic/arm_neon_incl.td
@@ -79,6 +79,7 @@
 //  - "D" - Double the number of lanes in the type.
 //  - "8" - Convert type to an equivalent vector of 8-bit signed
 //  integers.
+//  - "32" - Convert type to an equivalent vector of 32-bit integers.
 // example: (cast "R", "U", $p0) -> "(uint32x4_t)__p0" (assuming the return
 //   value is of type "int32x4_t".
 //  (cast $p0, "D", "8", $p1) -> "(int8x16_t)__p1" (assuming __p0
Index: clang/include/clang/Basic/arm_neon.td
===
--- clang/include/clang/Basic/arm_neon.td
+++ clang/include/clang/Basic/arm_neon.td
@@ -207,10 +207,10 @@
 
 def OP_DOT_LN
 : Op<(call "vdot", $p0, $p1,
-  (bitcast $p1, (splat(bitcast "uint32x2_t", $p2), $p3)))>;
+  (bitcast $p1, (splat(bitcast "32", $p2), $p3)))>;
 def OP_DOT_LNQ
 : Op<(call "vdot", $p0, $p1,
-  (bitcast $p1, (splat(bitcast "uint32x4_t", $p2), $p3)))>;
+  (bitcast $p1, 

[PATCH] D74051: Move update_cc_test_checks.py tests to clang

2020-02-14 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment.

Yep, thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74051



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


[PATCH] D74618: [ARM] Creating 'call_mangled' for Neon intrinsics definitions

2020-02-14 Thread Lucas Prates via Phabricator via cfe-commits
pratlucas created this revision.
Herald added subscribers: cfe-commits, kristof.beyls.
Herald added a project: clang.

As multiple versions ofthe same Neon intrinsic can be created through
the same TableGen definition with the same argument types, the existing
'call' operator is not always able to properly perform overload
resolutions.

As these different intrinsic versions are diferentiated later on by the
NeonEmitter through name mangling, this patch introduces a new
'call_mangled' operator to the TableGen definitions, which allows a call
for an otherwise ambiguous intrinsic by matching its mangled name with
the mangled variation of the caller.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D74618

Files:
  clang/include/clang/Basic/arm_neon_incl.td
  clang/utils/TableGen/NeonEmitter.cpp

Index: clang/utils/TableGen/NeonEmitter.cpp
===
--- clang/utils/TableGen/NeonEmitter.cpp
+++ clang/utils/TableGen/NeonEmitter.cpp
@@ -27,6 +27,7 @@
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/None.h"
+#include "llvm/ADT/Optional.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/StringExtras.h"
@@ -523,7 +524,7 @@
 std::pair emitDagDupTyped(DagInit *DI);
 std::pair emitDagShuffle(DagInit *DI);
 std::pair emitDagCast(DagInit *DI, bool IsBitCast);
-std::pair emitDagCall(DagInit *DI);
+std::pair emitDagCall(DagInit *DI, bool MatchMangledName);
 std::pair emitDagNameReplace(DagInit *DI);
 std::pair emitDagLiteral(DagInit *DI);
 std::pair emitDagOp(DagInit *DI);
@@ -551,7 +552,8 @@
 public:
   /// Called by Intrinsic - this attempts to get an intrinsic that takes
   /// the given types as arguments.
-  Intrinsic (StringRef Name, ArrayRef Types);
+  Intrinsic (StringRef Name, ArrayRef Types,
+  Optional MangledName);
 
   /// Called by Intrinsic - returns a globally-unique number.
   unsigned getUniqueNumber() { return UniqueNumber++; }
@@ -1388,8 +1390,8 @@
 return emitDagSaveTemp(DI);
   if (Op == "op")
 return emitDagOp(DI);
-  if (Op == "call")
-return emitDagCall(DI);
+  if (Op == "call" || Op == "call_mangled")
+return emitDagCall(DI, Op == "call_mangled");
   if (Op == "name_replace")
 return emitDagNameReplace(DI);
   if (Op == "literal")
@@ -1416,7 +1418,8 @@
   }
 }
 
-std::pair Intrinsic::DagEmitter::emitDagCall(DagInit *DI) {
+std::pair Intrinsic::DagEmitter::emitDagCall(DagInit *DI,
+bool MatchMangledName) {
   std::vector Types;
   std::vector Values;
   for (unsigned I = 0; I < DI->getNumArgs() - 1; ++I) {
@@ -1432,7 +1435,12 @@
 N = SI->getAsUnquotedString();
   else
 N = emitDagArg(DI->getArg(0), "").second;
-  Intrinsic  = Intr.Emitter.getIntrinsic(N, Types);
+  Optional MangledName;
+  if (MatchMangledName) {
+if (Intr.getRecord()->getValueAsBit("isLaneQ")) N += "q";
+MangledName = Intr.mangleName(N, ClassS);
+  }
+  Intrinsic  = Intr.Emitter.getIntrinsic(N, Types, MangledName);
 
   // Make sure the callee is known as an early def.
   Callee.setNeededEarly();
@@ -1839,7 +1847,8 @@
 // NeonEmitter implementation
 //===--===//
 
-Intrinsic ::getIntrinsic(StringRef Name, ArrayRef Types) {
+Intrinsic ::getIntrinsic(StringRef Name, ArrayRef Types,
+ Optional MangledName) {
   // First, look up the name in the intrinsic map.
   assert_with_loc(IntrinsicMap.find(Name.str()) != IntrinsicMap.end(),
   ("Intrinsic '" + Name + "' not found!").str());
@@ -1878,6 +1887,9 @@
 break;
   }
 }
+if (MangledName)
+  Good &= I.getMangledName(true) == MangledName;
+
 if (Good)
   GoodVec.push_back();
   }
Index: clang/include/clang/Basic/arm_neon_incl.td
===
--- clang/include/clang/Basic/arm_neon_incl.td
+++ clang/include/clang/Basic/arm_neon_incl.td
@@ -60,6 +60,11 @@
 // example: (call "vget_high", $p0) -> "vgetq_high_s16(__p0)"
 //(assuming $p0 has type int16x8_t).
 def call;
+// call_mangled - Invoke another intrinsic matching the mangled name variation
+//of the caller's base type. If there is no intrinsic defined
+//that has the variation and takes the given types, an error
+//is generated at tblgen time.
+def call_mangled;
 // cast - Perform a cast to a different type. This gets emitted as a static
 //C-style cast. For a pure reinterpret cast (T x = *(T*)), use
 //"bitcast".
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D74616: [ARM] Setting missing isLaneQ attribute on Neon Intrisics definitions

2020-02-14 Thread Lucas Prates via Phabricator via cfe-commits
pratlucas created this revision.
Herald added subscribers: cfe-commits, kristof.beyls.
Herald added a project: clang.

Some of the '*_laneq' intrinsics defined in arm_neon.td were missing the
setting of the 'isLaneQ' attribute. This patch sets the attribute on the
re lated definitions, as they will be required to properly perform range
checks on their lane arguments.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D74616

Files:
  clang/include/clang/Basic/arm_neon.td

Index: clang/include/clang/Basic/arm_neon.td
===
--- clang/include/clang/Basic/arm_neon.td
+++ clang/include/clang/Basic/arm_neon.td
@@ -881,16 +881,22 @@
 def COPYQ_LANE : IOpInst<"vcopy_lane", "..IqI",
 "QcQsQiQlQUcQUsQUiQUlQPcQPsQfQdQPl", OP_COPY_LN>;
 def COPY_LANEQ : IOpInst<"vcopy_laneq", "..IQI",
- "csilPcPsPlUcUsUiUlfd", OP_COPY_LN>;
+ "csilPcPsPlUcUsUiUlfd", OP_COPY_LN> {
+  let isLaneQ = 1;
+}
 def COPYQ_LANEQ : IOpInst<"vcopy_laneq", "..I.I",
- "QcQsQiQlQUcQUsQUiQUlQPcQPsQfQdQPl", OP_COPY_LN>;
+ "QcQsQiQlQUcQUsQUiQUlQPcQPsQfQdQPl", OP_COPY_LN> {
+  let isLaneQ = 1;
+}
 
 
 // Set all lanes to same value
 def VDUP_LANE1: WOpInst<"vdup_lane", ".qI", "hdQhQdPlQPl", OP_DUP_LN>;
 def VDUP_LANE2: WOpInst<"vdup_laneq", ".QI",
   "csilUcUsUiUlPcPshfdQcQsQiQlQPcQPsQUcQUsQUiQUlQhQfQdPlQPl",
-OP_DUP_LN>;
+OP_DUP_LN> {
+  let isLaneQ = 1;
+}
 def DUP_N   : WOpInst<"vdup_n", ".1", "dQdPlQPl", OP_DUP>;
 def MOV_N   : WOpInst<"vmov_n", ".1", "dQdPlQPl", OP_DUP>;
 
@@ -906,38 +912,60 @@
 
 
 def VMLA_LANEQ   : IOpInst<"vmla_laneq", "...QI",
-   "siUsUifQsQiQUsQUiQf", OP_MLA_LN>;
+   "siUsUifQsQiQUsQUiQf", OP_MLA_LN> {
+  let isLaneQ = 1;
+}
 def VMLS_LANEQ   : IOpInst<"vmls_laneq", "...QI",
-   "siUsUifQsQiQUsQUiQf", OP_MLS_LN>;
+   "siUsUifQsQiQUsQUiQf", OP_MLS_LN> {
+  let isLaneQ = 1;
+}
 
 def VFMA_LANE: IInst<"vfma_lane", "...qI", "fdQfQd">;
 def VFMA_LANEQ   : IInst<"vfma_laneq", "...QI", "fdQfQd"> {
   let isLaneQ = 1;
 }
 def VFMS_LANE: IOpInst<"vfms_lane", "...qI", "fdQfQd", OP_FMS_LN>;
-def VFMS_LANEQ   : IOpInst<"vfms_laneq", "...QI", "fdQfQd", OP_FMS_LNQ>;
+def VFMS_LANEQ   : IOpInst<"vfms_laneq", "...QI", "fdQfQd", OP_FMS_LNQ> {
+  let isLaneQ = 1;
+}
 
-def VMLAL_LANEQ  : SOpInst<"vmlal_laneq", "(>Q)(>Q).QI", "siUsUi", OP_MLAL_LN>;
+def VMLAL_LANEQ  : SOpInst<"vmlal_laneq", "(>Q)(>Q).QI", "siUsUi", OP_MLAL_LN> {
+  let isLaneQ = 1;
+}
 def VMLAL_HIGH_LANE   : SOpInst<"vmlal_high_lane", "(>Q)(>Q)Q.I", "siUsUi",
 OP_MLALHi_LN>;
 def VMLAL_HIGH_LANEQ  : SOpInst<"vmlal_high_laneq", "(>Q)(>Q)QQI", "siUsUi",
-OP_MLALHi_LN>;
-def VMLSL_LANEQ  : SOpInst<"vmlsl_laneq", "(>Q)(>Q).QI", "siUsUi", OP_MLSL_LN>;
+OP_MLALHi_LN> {
+  let isLaneQ = 1;
+}
+def VMLSL_LANEQ  : SOpInst<"vmlsl_laneq", "(>Q)(>Q).QI", "siUsUi", OP_MLSL_LN> {
+  let isLaneQ = 1;
+}
 def VMLSL_HIGH_LANE   : SOpInst<"vmlsl_high_lane", "(>Q)(>Q)Q.I", "siUsUi",
 OP_MLSLHi_LN>;
 def VMLSL_HIGH_LANEQ  : SOpInst<"vmlsl_high_laneq", "(>Q)(>Q)QQI", "siUsUi",
-OP_MLSLHi_LN>;
+OP_MLSLHi_LN> {
+  let isLaneQ = 1;
+}
 
-def VQDMLAL_LANEQ  : SOpInst<"vqdmlal_laneq", "(>Q)(>Q).QI", "si", OP_QDMLAL_LN>;
+def VQDMLAL_LANEQ  : SOpInst<"vqdmlal_laneq", "(>Q)(>Q).QI", "si", OP_QDMLAL_LN> {
+  let isLaneQ = 1;
+}
 def VQDMLAL_HIGH_LANE   : SOpInst<"vqdmlal_high_lane", "(>Q)(>Q)Q.I", "si",
 OP_QDMLALHi_LN>;
 def VQDMLAL_HIGH_LANEQ  : SOpInst<"vqdmlal_high_laneq", "(>Q)(>Q)QQI", "si",
-OP_QDMLALHi_LN>;
-def VQDMLSL_LANEQ  : SOpInst<"vqdmlsl_laneq", "(>Q)(>Q).QI", "si", OP_QDMLSL_LN>;
+OP_QDMLALHi_LN> {
+  let isLaneQ = 1;
+}
+def VQDMLSL_LANEQ  : SOpInst<"vqdmlsl_laneq", "(>Q)(>Q).QI", "si", OP_QDMLSL_LN> {
+  let isLaneQ = 1;
+}
 def VQDMLSL_HIGH_LANE   : SOpInst<"vqdmlsl_high_lane", "(>Q)(>Q)Q.I", "si",
 OP_QDMLSLHi_LN>;
 def VQDMLSL_HIGH_LANEQ  : SOpInst<"vqdmlsl_high_laneq", "(>Q)(>Q)QQI", "si",
-OP_QDMLSLHi_LN>;
+OP_QDMLSLHi_LN> {
+  let isLaneQ = 1;
+}
 
 // Newly add double parameter for vmul_lane in aarch64
 // Note: d type is handled by SCALAR_VMUL_LANE
@@ -945,32 +973,48 @@
 
 // Note: d type is handled by SCALAR_VMUL_LANEQ
 def VMUL_LANEQ   : IOpInst<"vmul_laneq", "..QI",
-   

[clang] 597dfb3 - [Driver] Rename AddGoldPlugin to addLTOOptions. NFC

2020-02-14 Thread Fangrui Song via cfe-commits

Author: Fangrui Song
Date: 2020-02-14T08:06:37-08:00
New Revision: 597dfb3bd56cdb65a89c67775ce348f10af36aa0

URL: 
https://github.com/llvm/llvm-project/commit/597dfb3bd56cdb65a89c67775ce348f10af36aa0
DIFF: 
https://github.com/llvm/llvm-project/commit/597dfb3bd56cdb65a89c67775ce348f10af36aa0.diff

LOG: [Driver] Rename AddGoldPlugin to addLTOOptions. NFC

AddGoldPlugin does more than adding `-plugin path/to/LLVMgold.so`.
It works with lld and GNU ld, and adds other LTO options.
So AddGoldPlugin is no longer a suitable name.

Reviewed By: tejohnson

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

Added: 


Modified: 
clang/lib/Driver/ToolChains/Ananas.cpp
clang/lib/Driver/ToolChains/CloudABI.cpp
clang/lib/Driver/ToolChains/CommonArgs.cpp
clang/lib/Driver/ToolChains/CommonArgs.h
clang/lib/Driver/ToolChains/FreeBSD.cpp
clang/lib/Driver/ToolChains/Fuchsia.cpp
clang/lib/Driver/ToolChains/Gnu.cpp

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/Ananas.cpp 
b/clang/lib/Driver/ToolChains/Ananas.cpp
index 2f11c9739a0e..10e4ea70db41 100644
--- a/clang/lib/Driver/ToolChains/Ananas.cpp
+++ b/clang/lib/Driver/ToolChains/Ananas.cpp
@@ -103,7 +103,7 @@ void ananas::Linker::ConstructJob(Compilation , const 
JobAction ,
 
   if (D.isUsingLTO()) {
 assert(!Inputs.empty() && "Must have at least one input.");
-AddGoldPlugin(ToolChain, Args, CmdArgs, Output, Inputs[0],
+addLTOOptions(ToolChain, Args, CmdArgs, Output, Inputs[0],
   D.getLTOMode() == LTOK_Thin);
   }
 

diff  --git a/clang/lib/Driver/ToolChains/CloudABI.cpp 
b/clang/lib/Driver/ToolChains/CloudABI.cpp
index 77672a99d989..0602e4f6d0b3 100644
--- a/clang/lib/Driver/ToolChains/CloudABI.cpp
+++ b/clang/lib/Driver/ToolChains/CloudABI.cpp
@@ -75,7 +75,7 @@ void cloudabi::Linker::ConstructJob(Compilation , const 
JobAction ,
 
   if (D.isUsingLTO()) {
 assert(!Inputs.empty() && "Must have at least one input.");
-AddGoldPlugin(ToolChain, Args, CmdArgs, Output, Inputs[0],
+addLTOOptions(ToolChain, Args, CmdArgs, Output, Inputs[0],
   D.getLTOMode() == LTOK_Thin);
   }
 

diff  --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp 
b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index 0b2f8ce455f6..51b2e5f3c34d 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -353,7 +353,7 @@ bool tools::isUseSeparateSections(const llvm::Triple 
) {
   return Triple.getOS() == llvm::Triple::CloudABI;
 }
 
-void tools::AddGoldPlugin(const ToolChain , const ArgList ,
+void tools::addLTOOptions(const ToolChain , const ArgList ,
   ArgStringList , const InputInfo ,
   const InputInfo , bool IsThinLTO) {
   const char *Linker = Args.MakeArgString(ToolChain.GetLinkerPath());

diff  --git a/clang/lib/Driver/ToolChains/CommonArgs.h 
b/clang/lib/Driver/ToolChains/CommonArgs.h
index bf1ab8153de7..984f3ee98af1 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.h
+++ b/clang/lib/Driver/ToolChains/CommonArgs.h
@@ -58,7 +58,7 @@ void SplitDebugInfo(const ToolChain , Compilation , 
const Tool ,
 const JobAction , const llvm::opt::ArgList ,
 const InputInfo , const char *OutFile);
 
-void AddGoldPlugin(const ToolChain , const llvm::opt::ArgList ,
+void addLTOOptions(const ToolChain , const llvm::opt::ArgList ,
llvm::opt::ArgStringList , const InputInfo ,
const InputInfo , bool IsThinLTO);
 

diff  --git a/clang/lib/Driver/ToolChains/FreeBSD.cpp 
b/clang/lib/Driver/ToolChains/FreeBSD.cpp
index c5c6f530f48c..3f3d6e7c72eb 100644
--- a/clang/lib/Driver/ToolChains/FreeBSD.cpp
+++ b/clang/lib/Driver/ToolChains/FreeBSD.cpp
@@ -275,7 +275,7 @@ void freebsd::Linker::ConstructJob(Compilation , const 
JobAction ,
 
   if (D.isUsingLTO()) {
 assert(!Inputs.empty() && "Must have at least one input.");
-AddGoldPlugin(ToolChain, Args, CmdArgs, Output, Inputs[0],
+addLTOOptions(ToolChain, Args, CmdArgs, Output, Inputs[0],
   D.getLTOMode() == LTOK_Thin);
   }
 

diff  --git a/clang/lib/Driver/ToolChains/Fuchsia.cpp 
b/clang/lib/Driver/ToolChains/Fuchsia.cpp
index 1e1f003daf83..6114829ac8e1 100644
--- a/clang/lib/Driver/ToolChains/Fuchsia.cpp
+++ b/clang/lib/Driver/ToolChains/Fuchsia.cpp
@@ -111,7 +111,7 @@ void fuchsia::Linker::ConstructJob(Compilation , const 
JobAction ,
 
   if (D.isUsingLTO()) {
 assert(!Inputs.empty() && "Must have at least one input.");
-AddGoldPlugin(ToolChain, Args, CmdArgs, Output, Inputs[0],
+addLTOOptions(ToolChain, Args, CmdArgs, Output, Inputs[0],
   D.getLTOMode() == LTOK_Thin);
   }
 

diff  --git a/clang/lib/Driver/ToolChains/Gnu.cpp 
b/clang/lib/Driver/ToolChains/Gnu.cpp
index dadbfa288a03..2652c05d844f 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ 

[PATCH] D73898: [analyzer] StdLibraryFunctionsChecker: Add argument constraints

2020-02-14 Thread Balázs Kéri via Phabricator via cfe-commits
balazske added inline comments.



Comment at: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:403
+return;
+  case nonloc::ConcreteIntKind: {
+

This check works now with concrete int values. We have a known value and a list 
of ranges with known limits, so testing for //in any of the ranges// does work 
the same way as testing for //out of all ranges//. And testing if the value is 
inside one of the ranges is more simple code.

But I think the symbolic evaluation with "eval" and "assume" functions would be 
more generic here (and more simple code). Then the way of cutting-of the bad 
ranges is usable (probably still there is other solution).



Comment at: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:464
+}
+
 void StdLibraryFunctionsChecker::checkPostCall(const CallEvent ,

If `evalCall` is used it could be more simple to test and apply the constraints 
for arguments and return value in a "single step".


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73898



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


[PATCH] D62525: [Analyzer] Add new visitor to the iterator checkers

2020-02-14 Thread Balogh, Ádám via Phabricator via cfe-commits
baloghadamsoftware abandoned this revision.
baloghadamsoftware added a comment.

Superseded by [[ https://reviews.llvm.org/D73720 | [Analyzer] Use note tags to 
track container begin and and changes ]], [[ https://reviews.llvm.org/D74541 | 
[Analyzer] Use note tags to track iterator increments and decrements ]] and [[ 
https://reviews.llvm.org/D74615 | [Analyzer] Add visitor to track iterator 
invalidation ]].


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

https://reviews.llvm.org/D62525



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


[PATCH] D73534: [DebugInfo] Enable the debug entry values feature by default

2020-02-14 Thread David Stenberg via Phabricator via cfe-commits
dstenb added inline comments.



Comment at: llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp:870
 if (MI->isCandidateForCallSiteEntry() &&
-DAG->getTarget().Options.EnableDebugEntryValues)
+DAG->getTarget().Options.SupportsDebugEntryValues)
   MF.addCallArgsForwardingRegs(MI, DAG->getSDCallSiteInfo(Node));

djtodoro wrote:
> dstenb wrote:
> > I'm sorry for commenting on this so late, but when now adapting this patch 
> > for our downstream target, for which we will not enable call site info by 
> > default yet, I noticed that the call site information wasn't added. I think 
> > that this should be `ShouldEmitDebugEntryValues()`.
> I thought to restrict the production of the call site info here and only to 
> allow a hand-made testing, but I think you are right, we should use the 
> `ShouldEmitDebugEntryValues()`. I'll update the patch, thanks!
Thanks! It is perhaps a bit of a corner case, and we're moving towards enabling 
call site info by default, but I guess this might be useful when experimenting 
with adding call site info for other targets in the future.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73534



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


[PATCH] D73720: [Analyzer] Use note tags to track container begin and and changes

2020-02-14 Thread Balogh, Ádám via Phabricator via cfe-commits
baloghadamsoftware updated this revision to Diff 244667.
baloghadamsoftware added a comment.

Minor update: ignore parentheses and casts when taking the name of the 
expression.


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

https://reviews.llvm.org/D73720

Files:
  clang/lib/StaticAnalyzer/Checkers/ContainerModeling.cpp
  clang/lib/StaticAnalyzer/Checkers/DebugContainerModeling.cpp
  clang/lib/StaticAnalyzer/Checkers/IteratorRangeChecker.cpp
  clang/test/Analysis/container-modeling.cpp
  clang/test/Analysis/iterator-range.cpp

Index: clang/test/Analysis/iterator-range.cpp
===
--- clang/test/Analysis/iterator-range.cpp
+++ clang/test/Analysis/iterator-range.cpp
@@ -1,5 +1,5 @@
-// RUN: %clang_analyze_cc1 -std=c++11 -analyzer-checker=core,cplusplus,alpha.cplusplus.IteratorRange -analyzer-config aggressive-binary-operation-simplification=true -analyzer-config c++-container-inlining=false %s -verify
-// RUN: %clang_analyze_cc1 -std=c++11 -analyzer-checker=core,cplusplus,alpha.cplusplus.IteratorRange -analyzer-config aggressive-binary-operation-simplification=true -analyzer-config c++-container-inlining=true -DINLINE=1 %s -verify
+// RUN: %clang_analyze_cc1 -std=c++11 -analyzer-checker=core,cplusplus,alpha.cplusplus.IteratorRange -analyzer-config aggressive-binary-operation-simplification=true -analyzer-config c++-container-inlining=false -analyzer-output=text %s -verify
+// RUN: %clang_analyze_cc1 -std=c++11 -analyzer-checker=core,cplusplus,alpha.cplusplus.IteratorRange -analyzer-config aggressive-binary-operation-simplification=true -analyzer-config c++-container-inlining=true -DINLINE=1 -analyzer-output=text %s -verify
 
 #include "Inputs/system-header-simulator-cxx.h"
 
@@ -32,6 +32,7 @@
 void deref_end(const std::vector ) {
   auto i = V.end();
   *i; // expected-warning{{Past-the-end iterator dereferenced}}
+  // expected-note@-1{{Past-the-end iterator dereferenced}}
 }
 
 // Prefix increment - operator++()
@@ -59,6 +60,7 @@
 void incr_end(const std::vector ) {
   auto i = V.end();
   ++i; // expected-warning{{Iterator incremented behind the past-the-end iterator}}
+   // expected-note@-1{{Iterator incremented behind the past-the-end iterator}}
 }
 
 // Postfix increment - operator++(int)
@@ -86,6 +88,7 @@
 void end_incr(const std::vector ) {
   auto i = V.end();
   i++; // expected-warning{{Iterator incremented behind the past-the-end iterator}}
+   // expected-note@-1{{Iterator incremented behind the past-the-end iterator}}
 }
 
 // Prefix decrement - operator--()
@@ -93,6 +96,7 @@
 void decr_begin(const std::vector ) {
   auto i = V.begin();
   --i; // expected-warning{{Iterator decremented ahead of its valid range}}
+   // expected-note@-1{{Iterator decremented ahead of its valid range}}
 }
 
 void decr_behind_begin(const std::vector ) {
@@ -120,6 +124,7 @@
 void begin_decr(const std::vector ) {
   auto i = V.begin();
   i--; // expected-warning{{Iterator decremented ahead of its valid range}}
+   // expected-note@-1{{Iterator decremented ahead of its valid range}}
 }
 
 void behind_begin_decr(const std::vector ) {
@@ -168,11 +173,13 @@
 void incr_by_2_ahead_of_end(const std::vector ) {
   auto i = --V.end();
   i += 2; // expected-warning{{Iterator incremented behind the past-the-end iterator}}
+  // expected-note@-1{{Iterator incremented behind the past-the-end iterator}}
 }
 
 void incr_by_2_end(const std::vector ) {
   auto i = V.end();
   i += 2; // expected-warning{{Iterator incremented behind the past-the-end iterator}}
+  // expected-note@-1{{Iterator incremented behind the past-the-end iterator}}
 }
 
 // Addition - operator+(int)
@@ -201,11 +208,13 @@
 void incr_by_2_copy_ahead_of_end(const std::vector ) {
   auto i = --V.end();
   auto j = i + 2; // expected-warning{{Iterator incremented behind the past-the-end iterator}}
+  // expected-note@-1{{Iterator incremented behind the past-the-end iterator}}
 }
 
 void incr_by_2_copy_end(const std::vector ) {
   auto i = V.end();
   auto j = i + 2; // expected-warning{{Iterator incremented behind the past-the-end iterator}}
+  // expected-note@-1{{Iterator incremented behind the past-the-end iterator}}
 }
 
 // Subtraction assignment - operator-=(int)
@@ -213,11 +222,13 @@
 void decr_by_2_begin(const std::vector ) {
   auto i = V.begin();
   i -= 2; // expected-warning{{Iterator decremented ahead of its valid range}}
+  // expected-note@-1{{Iterator decremented ahead of its valid range}}
 }
 
 void decr_by_2_behind_begin(const std::vector ) {
   auto i = ++V.begin();
   i -= 2; // expected-warning{{Iterator decremented ahead of its valid range}}
+  // expected-note@-1{{Iterator decremented ahead of its valid range}}
 }
 
 void decr_by_2_behind_begin_by_2(const std::vector ) {
@@ -246,11 +257,13 @@
 void decr_by_2_copy_begin(const std::vector ) {
   auto i = V.begin();
   auto j = 

[PATCH] D74615: [Analyzer] Add visitor to track iterator invalidation

2020-02-14 Thread Balogh, Ádám via Phabricator via cfe-commits
baloghadamsoftware created this revision.
baloghadamsoftware added reviewers: NoQ, Szelethus.
baloghadamsoftware added a project: clang.
Herald added subscribers: steakhal, Charusso, donat.nagy, mikhail.ramalho, 
a.sidorin, rnkovacs, szepet, xazax.hun.

To understand the bug report issued by the `InvalidatedIterator` checker it is 
essential to see the point where the iterator was invalidated and also to track 
the assignemnts of the already invalidated iterator up to its errorneous 
access. Since iterator invalidation is neither "done" by `InvalidatedIterator` 
checker nor by `IteratorModeling` but "happens" upon container modifications 
(modeled by `ContainerModeling`) the proper solution here seems to be a 
`BugReporterVisitor` instead of `NoteTag`s.


Repository:
  rC Clang

https://reviews.llvm.org/D74615

Files:
  clang/lib/StaticAnalyzer/Checkers/InvalidatedIteratorChecker.cpp
  clang/test/Analysis/invalidated-iterator.cpp

Index: clang/test/Analysis/invalidated-iterator.cpp
===
--- clang/test/Analysis/invalidated-iterator.cpp
+++ clang/test/Analysis/invalidated-iterator.cpp
@@ -1,5 +1,5 @@
-// RUN: %clang_analyze_cc1 -std=c++11 -analyzer-checker=core,cplusplus,alpha.cplusplus.InvalidatedIterator -analyzer-config aggressive-binary-operation-simplification=true -analyzer-config c++-container-inlining=false %s -verify
-// RUN: %clang_analyze_cc1 -std=c++11 -analyzer-checker=core,cplusplus,alpha.cplusplus.InvalidatedIterator -analyzer-config aggressive-binary-operation-simplification=true -analyzer-config c++-container-inlining=true -DINLINE=1 %s -verify
+// RUN: %clang_analyze_cc1 -std=c++11 -analyzer-checker=core,cplusplus,alpha.cplusplus.InvalidatedIterator -analyzer-config aggressive-binary-operation-simplification=true -analyzer-config c++-container-inlining=false -analyzer-output=text %s -verify
+// RUN: %clang_analyze_cc1 -std=c++11 -analyzer-checker=core,cplusplus,alpha.cplusplus.InvalidatedIterator -analyzer-config aggressive-binary-operation-simplification=true -analyzer-config c++-container-inlining=true -DINLINE=1 -analyzer-output=text %s -verify
 
 #include "Inputs/system-header-simulator-cxx.h"
 
@@ -12,8 +12,9 @@
 
 void invalidated_dereference(std::vector ) {
   auto i = V.cbegin();
-  V.erase(i);
+  V.erase(i); // expected-note{{Iterator 'i' invalidated}}
   *i; // expected-warning{{Invalidated iterator accessed}}
+  // expected-note@-1{{Invalidated iterator accessed}}
 }
 
 void normal_prefix_increment(std::vector ) {
@@ -23,8 +24,9 @@
 
 void invalidated_prefix_increment(std::vector ) {
   auto i = V.cbegin();
-  V.erase(i);
+  V.erase(i); // expected-note{{Iterator 'i' invalidated}}
   ++i; // expected-warning{{Invalidated iterator accessed}}
+   // expected-note@-1{{Invalidated iterator accessed}}
 }
 
 void normal_prefix_decrement(std::vector ) {
@@ -34,8 +36,9 @@
 
 void invalidated_prefix_decrement(std::vector ) {
   auto i = ++V.cbegin();
-  V.erase(i);
+  V.erase(i); // expected-note{{Iterator 'i' invalidated}}
   --i; // expected-warning{{Invalidated iterator accessed}}
+   // expected-note@-1{{Invalidated iterator accessed}}
 }
 
 void normal_postfix_increment(std::vector ) {
@@ -45,8 +48,9 @@
 
 void invalidated_postfix_increment(std::vector ) {
   auto i = V.cbegin();
-  V.erase(i);
+  V.erase(i); // expected-note{{Iterator 'i' invalidated}}
   i++; // expected-warning{{Invalidated iterator accessed}}
+   // expected-note@-1{{Invalidated iterator accessed}}
 }
 
 void normal_postfix_decrement(std::vector ) {
@@ -56,8 +60,9 @@
 
 void invalidated_postfix_decrement(std::vector ) {
   auto i = ++V.cbegin();
-  V.erase(i);
+  V.erase(i); // expected-note{{Iterator 'i' invalidated}}
   i--; // expected-warning{{Invalidated iterator accessed}}
+   // expected-note@-1{{Invalidated iterator accessed}}
 }
 
 void normal_increment_by_2(std::vector ) {
@@ -67,8 +72,9 @@
 
 void invalidated_increment_by_2(std::vector ) {
   auto i = V.cbegin();
-  V.erase(i);
+  V.erase(i); // expected-note{{Iterator 'i' invalidated}}
   i += 2; // expected-warning{{Invalidated iterator accessed}}
+  // expected-note@-1{{Invalidated iterator accessed}}
 }
 
 void normal_increment_by_2_copy(std::vector ) {
@@ -78,8 +84,9 @@
 
 void invalidated_increment_by_2_copy(std::vector ) {
   auto i = V.cbegin();
-  V.erase(i);
+  V.erase(i); // expected-note{{Iterator 'i' invalidated}}
   auto j = i + 2; // expected-warning{{Invalidated iterator accessed}}
+  // expected-note@-1{{Invalidated iterator accessed}}
 }
 
 void normal_decrement_by_2(std::vector ) {
@@ -89,8 +96,9 @@
 
 void invalidated_decrement_by_2(std::vector ) {
   auto i = V.cbegin();
-  V.erase(i);
+  V.erase(i); // expected-note{{Iterator 'i' invalidated}}
   i -= 2; // expected-warning{{Invalidated iterator accessed}}
+  // expected-note@-1{{Invalidated iterator accessed}}
 }
 
 void normal_decrement_by_2_copy(std::vector ) {
@@ 

RE: [PATCH] D74436: Change clang option -ffp-model=precise to select ffp-contract=on

2020-02-14 Thread Blower, Melanie I via cfe-commits
I reverted MaskRay's "reland" since the original patch is causing trouble on 
PowerPC, check-all is passing on my box.  Sorry for the trouble. 

> -Original Message-
> From: Andy Kaylor via Phabricator 
> Sent: Thursday, February 13, 2020 9:20 PM
> To: Blower, Melanie I ; lebedev...@gmail.com;
> rjmcc...@gmail.com; sepavl...@gmail.com
> Cc: mask...@google.com; j...@us.ibm.com; david.bolvan...@gmail.com;
> mar...@martin.st; Wang, Pengfei ;
> wuz...@cn.ibm.com; nemanja.i@gmail.com; kit.bar...@gmail.com; cfe-
> comm...@lists.llvm.org; mlek...@skidmore.edu; blitzrak...@gmail.com;
> shen...@google.com; peter.wal...@arm.com
> Subject: [PATCH] D74436: Change clang option -ffp-model=precise to select ffp-
> contract=on
> 
> andrew.w.kaylor added a subscriber: MaskRay.
> andrew.w.kaylor added a comment.
> 
> In D74436#1875386 , @thakis
> wrote:
> 
> > The revert of this breaks tests everywhere, as far as I can tell.
> 
> 
> It looks like something strange happened with the revert:
> 
> > clang-11: warning: overriding '-ffp-model=strict' option with '-ffp-
> model=strict' [-Woverriding-t-option]
> 
> I believe the problem is that the original change that was being reverted
> contained this:
> 
>   clang/lib/Driver/ToolChains/Clang.cpp
>   @@ -2768,7 +2766,7 @@ static void RenderFloatingPointOptions(const
> ToolChain , const Driver ,
>   !AssociativeMath && !ReciprocalMath &&
>   SignedZeros && TrappingMath && RoundingFPMath &&
>   DenormalFPMath != llvm::DenormalMode::getIEEE() &&
>   +FPContract.empty())
>   -(FPContract.equals("off") || FPContract.empty()))
> 
> But sometime in the land-revert-land-revert cycle the line above that changed,
> causing the merge to miss this change in the most recent revert. I see that
> @MaskRay has since re-landed this change set, but it's going to cause problems
> for PowerPC. If someone needs to revert this yet again, I think it can be 
> safely
> done by recovering the change above.
> 
> Apologies for the mess!
> 
> 
> Repository:
>   rG LLVM Github Monorepo
> 
> CHANGES SINCE LAST ACTION
>   https://reviews.llvm.org/D74436/new/
> 
> https://reviews.llvm.org/D74436
> 
> 

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


[clang] 9122b92 - Revert "Reland D74436 "Change clang option -ffp-model=precise to select ffp-contract=on""

2020-02-14 Thread Melanie Blower via cfe-commits

Author: Melanie Blower
Date: 2020-02-14T07:32:09-08:00
New Revision: 9122b92f8e046bfeabdc503d978cf098c86f6e49

URL: 
https://github.com/llvm/llvm-project/commit/9122b92f8e046bfeabdc503d978cf098c86f6e49
DIFF: 
https://github.com/llvm/llvm-project/commit/9122b92f8e046bfeabdc503d978cf098c86f6e49.diff

LOG: Revert "Reland D74436 "Change clang option -ffp-model=precise to select 
ffp-contract=on""

This reverts commit 0a1123eb43f945593b26dd037490e0c909fa3c4f.
Want to revert this because it's causing trouble for PowerPC
I also fixed test fp-model.c which was looking for an incorrect error message

Added: 


Modified: 
clang/docs/UsersManual.rst
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/CodeGen/ppc-emmintrin.c
clang/test/CodeGen/ppc-xmmintrin.c
clang/test/Driver/fp-model.c

Removed: 




diff  --git a/clang/docs/UsersManual.rst b/clang/docs/UsersManual.rst
index 6c8c9f802082..856d5e34bbcc 100644
--- a/clang/docs/UsersManual.rst
+++ b/clang/docs/UsersManual.rst
@@ -1190,50 +1190,8 @@ installed.
 Controlling Floating Point Behavior
 ---
 
-Clang provides a number of ways to control floating point behavior, including
-with command line options and source pragmas. This section
-describes the various floating point semantic modes and the corresponding 
options.
-
-.. csv-table:: Floating Point Semantic Modes
-  :header: "Mode", "Values"
-  :widths: 15, 30, 30
-
-  "except_behavior", "{ignore, strict, may_trap}", "ffp-exception-behavior"
-  "fenv_access", "{off, on}", "(none)"
-  "rounding_mode", "{dynamic, tonearest, downward, upward, towardzero}", 
"frounding-math"
-  "contract", "{on, off, fast}", "ffp-contract"
-  "denormal_fp_math", "{IEEE, PreserveSign, PositiveZero}", "fdenormal-fp-math"
-  "denormal_fp32_math", "{IEEE, PreserveSign, PositiveZero}", 
"fdenormal-fp-math-fp32"
-  "support_math_errno", "{on, off}", "fmath-errno"
-  "no_honor_nans", "{on, off}", "fhonor-nans"
-  "no_honor_infinities", "{on, off}", "fhonor-infinities"
-  "no_signed_zeros", "{on, off}", "fsigned-zeros"
-  "allow_reciprocal", "{on, off}", "freciprocal-math"
-  "allow_approximate_fns", "{on, off}", "(none)"
-  "allow_reassociation", "{on, off}", "fassociative-math"
-
-
-This table describes the option settings that correspond to the three
-floating point semantic models: precise (the default), strict, and fast.
-
-
-.. csv-table:: Floating Point Models
-  :header: "Mode", "Precise", "Strict", "Fast"
-  :widths: 25, 15, 15, 15
-
-  "except_behavior", "ignore", "strict", "ignore"
-  "fenv_access", "off", "on", "off"
-  "rounding_mode", "tonearest", "dynamic", "tonearest"
-  "contract", "on", "off", "fast"
-  "denormal_fp_math", "IEEE", "IEEE", "PreserveSign"
-  "denormal_fp32_math", "IEEE","IEEE", "PreserveSign"
-  "support_math_errno", "on", "on", "off"
-  "no_honor_nans", "off", "off", "on"
-  "no_honor_infinities", "off", "off", "on"
-  "no_signed_zeros", "off", "off", "on"
-  "allow_reciprocal", "off", "off", "on"
-  "allow_approximate_fns", "off", "off", "on"
-  "allow_reassociation", "off", "off", "on"
+Clang provides a number of ways to control floating point behavior. The options
+are listed below.
 
 .. option:: -ffast-math
 
@@ -1427,7 +1385,7 @@ Note that floating-point operations performed as part of 
constant initialization
and ``fast``.
Details:
 
-   * ``precise`` Disables optimizations that are not value-safe on 
floating-point data, although FP contraction (FMA) is enabled 
(``-ffp-contract=on``).  This is the default behavior.
+   * ``precise`` Disables optimizations that are not value-safe on 
floating-point data, although FP contraction (FMA) is enabled 
(``-ffp-contract=fast``).  This is the default behavior.
* ``strict`` Enables ``-frounding-math`` and 
``-ffp-exception-behavior=strict``, and disables contractions (FMA).  All of 
the ``-ffast-math`` enablements are disabled.
* ``fast`` Behaves identically to specifying both ``-ffast-math`` and 
``ffp-contract=fast``
 

diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index d1197556aeef..2585a5fa05da 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -2525,9 +2525,10 @@ static void RenderFloatingPointOptions(const ToolChain 
, const Driver ,
 
   llvm::DenormalMode DenormalFPMath = DefaultDenormalFPMath;
   llvm::DenormalMode DenormalFP32Math = DefaultDenormalFP32Math;
-  StringRef FPContract = "on";
+  StringRef FPContract = "";
   bool StrictFPModel = false;
 
+
   if (const Arg *A = Args.getLastArg(options::OPT_flimited_precision_EQ)) {
 CmdArgs.push_back("-mlimit-float-precision");
 CmdArgs.push_back(A->getValue());
@@ -2550,6 +2551,7 @@ static void RenderFloatingPointOptions(const ToolChain 
, const Driver ,
   SignedZeros = true;
   // -fno_fast_math restores default denormal and fpcontract 

[PATCH] D74569: [clang-scan-deps] Switch to using a ThreadPool

2020-02-14 Thread Alexandre Ganea via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGd9049e871f30: [clang-scan-deps] Switch to using a ThreadPool 
(authored by aganea).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74569

Files:
  clang/tools/clang-scan-deps/ClangScanDeps.cpp


Index: clang/tools/clang-scan-deps/ClangScanDeps.cpp
===
--- clang/tools/clang-scan-deps/ClangScanDeps.cpp
+++ clang/tools/clang-scan-deps/ClangScanDeps.cpp
@@ -18,6 +18,7 @@
 #include "llvm/Support/JSON.h"
 #include "llvm/Support/Program.h"
 #include "llvm/Support/Signals.h"
+#include "llvm/Support/ThreadPool.h"
 #include "llvm/Support/Threading.h"
 #include 
 #include 
@@ -490,6 +491,7 @@
 #else
   unsigned NumWorkers = 1;
 #endif
+  llvm::ThreadPool Pool(NumWorkers);
   std::vector> WorkerTools;
   for (unsigned I = 0; I < NumWorkers; ++I)
 WorkerTools.push_back(std::make_unique(Service));
@@ -499,7 +501,6 @@
AdjustingCompilations->getAllCompileCommands())
 Inputs.emplace_back(Cmd);
 
-  std::vector WorkerThreads;
   std::atomic HadErrors(false);
   FullDeps FD;
   std::mutex Lock;
@@ -510,8 +511,8 @@
  << " files using " << NumWorkers << " workers\n";
   }
   for (unsigned I = 0; I < NumWorkers; ++I) {
-auto Worker = [I, , , , , , ,
-   , ]() {
+Pool.async([I, , , , , , ,
+, ]() {
   llvm::StringSet<> AlreadySeenModules;
   while (true) {
 const SingleCommandCompilationDatabase *Input;
@@ -543,16 +544,9 @@
 HadErrors = true;
 }
   }
-};
-#if LLVM_ENABLE_THREADS
-WorkerThreads.emplace_back(std::move(Worker));
-#else
-// Run the worker without spawning a thread when threads are disabled.
-Worker();
-#endif
+});
   }
-  for (auto  : WorkerThreads)
-W.join();
+  Pool.wait();
 
   if (Format == ScanningOutputFormat::Full)
 FD.printFullOutput(llvm::outs());


Index: clang/tools/clang-scan-deps/ClangScanDeps.cpp
===
--- clang/tools/clang-scan-deps/ClangScanDeps.cpp
+++ clang/tools/clang-scan-deps/ClangScanDeps.cpp
@@ -18,6 +18,7 @@
 #include "llvm/Support/JSON.h"
 #include "llvm/Support/Program.h"
 #include "llvm/Support/Signals.h"
+#include "llvm/Support/ThreadPool.h"
 #include "llvm/Support/Threading.h"
 #include 
 #include 
@@ -490,6 +491,7 @@
 #else
   unsigned NumWorkers = 1;
 #endif
+  llvm::ThreadPool Pool(NumWorkers);
   std::vector> WorkerTools;
   for (unsigned I = 0; I < NumWorkers; ++I)
 WorkerTools.push_back(std::make_unique(Service));
@@ -499,7 +501,6 @@
AdjustingCompilations->getAllCompileCommands())
 Inputs.emplace_back(Cmd);
 
-  std::vector WorkerThreads;
   std::atomic HadErrors(false);
   FullDeps FD;
   std::mutex Lock;
@@ -510,8 +511,8 @@
  << " files using " << NumWorkers << " workers\n";
   }
   for (unsigned I = 0; I < NumWorkers; ++I) {
-auto Worker = [I, , , , , , ,
-   , ]() {
+Pool.async([I, , , , , , ,
+, ]() {
   llvm::StringSet<> AlreadySeenModules;
   while (true) {
 const SingleCommandCompilationDatabase *Input;
@@ -543,16 +544,9 @@
 HadErrors = true;
 }
   }
-};
-#if LLVM_ENABLE_THREADS
-WorkerThreads.emplace_back(std::move(Worker));
-#else
-// Run the worker without spawning a thread when threads are disabled.
-Worker();
-#endif
+});
   }
-  for (auto  : WorkerThreads)
-W.join();
+  Pool.wait();
 
   if (Format == ScanningOutputFormat::Full)
 FD.printFullOutput(llvm::outs());
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71775: [ThreadPool] On Windows, extend usage to all CPU sockets and all NUMA groups

2020-02-14 Thread Alexandre Ganea via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG8404aeb56a73: [Support] On Windows, ensure 
hardware_concurrency() extends to all CPU sockets… (authored by aganea).

Changed prior to commit:
  https://reviews.llvm.org/D71775?vs=237197=244664#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71775

Files:
  clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
  clang-tools-extra/clangd/TUScheduler.cpp
  clang-tools-extra/clangd/index/Background.cpp
  clang-tools-extra/clangd/index/Background.h
  clang-tools-extra/clangd/index/BackgroundRebuild.h
  clang/lib/Tooling/AllTUsExecution.cpp
  clang/lib/Tooling/DependencyScanning/DependencyScanningFilesystem.cpp
  clang/tools/clang-scan-deps/ClangScanDeps.cpp
  lld/ELF/SyntheticSections.cpp
  llvm/include/llvm/LTO/LTO.h
  llvm/include/llvm/Support/ThreadPool.h
  llvm/include/llvm/Support/Threading.h
  llvm/lib/CodeGen/ParallelCG.cpp
  llvm/lib/DWARFLinker/DWARFLinker.cpp
  llvm/lib/DebugInfo/GSYM/DwarfTransformer.cpp
  llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
  llvm/lib/LTO/LTO.cpp
  llvm/lib/LTO/LTOBackend.cpp
  llvm/lib/LTO/ThinLTOCodeGenerator.cpp
  llvm/lib/Support/Host.cpp
  llvm/lib/Support/Parallel.cpp
  llvm/lib/Support/ThreadPool.cpp
  llvm/lib/Support/Threading.cpp
  llvm/lib/Support/Unix/Threading.inc
  llvm/lib/Support/Windows/Threading.inc
  llvm/tools/dsymutil/dsymutil.cpp
  llvm/tools/gold/gold-plugin.cpp
  llvm/tools/llvm-cov/CodeCoverage.cpp
  llvm/tools/llvm-cov/CoverageExporterJson.cpp
  llvm/tools/llvm-cov/CoverageReport.cpp
  llvm/tools/llvm-lto2/llvm-lto2.cpp
  llvm/tools/llvm-profdata/llvm-profdata.cpp
  llvm/unittests/Support/Host.cpp
  llvm/unittests/Support/TaskQueueTest.cpp
  llvm/unittests/Support/ThreadPool.cpp
  llvm/unittests/Support/Threading.cpp
  mlir/lib/Pass/Pass.cpp

Index: mlir/lib/Pass/Pass.cpp
===
--- mlir/lib/Pass/Pass.cpp
+++ mlir/lib/Pass/Pass.cpp
@@ -411,7 +411,8 @@
   // Create the async executors if they haven't been created, or if the main
   // pipeline has changed.
   if (asyncExecutors.empty() || hasSizeMismatch(asyncExecutors.front(), mgrs))
-asyncExecutors.assign(llvm::hardware_concurrency(), mgrs);
+asyncExecutors.assign(llvm::hardware_concurrency().compute_thread_count(),
+  mgrs);
 
   // Run a prepass over the module to collect the operations to execute over.
   // This ensures that an analysis manager exists for each operation, as well as
Index: llvm/unittests/Support/Threading.cpp
===
--- llvm/unittests/Support/Threading.cpp
+++ llvm/unittests/Support/Threading.cpp
@@ -21,7 +21,8 @@
   auto Num = heavyweight_hardware_concurrency();
   // Since Num is unsigned this will also catch us trying to
   // return -1.
-  ASSERT_LE(Num, thread::hardware_concurrency());
+  ASSERT_LE(Num.compute_thread_count(),
+hardware_concurrency().compute_thread_count());
 }
 
 #if LLVM_ENABLE_THREADS
Index: llvm/unittests/Support/ThreadPool.cpp
===
--- llvm/unittests/Support/ThreadPool.cpp
+++ llvm/unittests/Support/ThreadPool.cpp
@@ -8,11 +8,13 @@
 
 #include "llvm/Support/ThreadPool.h"
 
+#include "llvm/ADT/DenseSet.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/Triple.h"
 #include "llvm/Support/Host.h"
 #include "llvm/Support/TargetSelect.h"
+#include "llvm/Support/Threading.h"
 
 #include "gtest/gtest.h"
 
@@ -69,6 +71,8 @@
 
   void SetUp() override { MainThreadReady = false; }
 
+  void TestAllThreads(ThreadPoolStrategy S);
+
   std::condition_variable WaitMainThread;
   std::mutex WaitMainThreadMutex;
   bool MainThreadReady = false;
@@ -131,7 +135,7 @@
 
 TEST_F(ThreadPoolTest, GetFuture) {
   CHECK_UNSUPPORTED();
-  ThreadPool Pool{2};
+  ThreadPool Pool(hardware_concurrency(2));
   std::atomic_int i{0};
   Pool.async([this, ] {
 waitForMainThread();
@@ -162,3 +166,45 @@
   }
   ASSERT_EQ(5, checked_in);
 }
+
+#if LLVM_ENABLE_THREADS == 1
+
+void ThreadPoolTest::TestAllThreads(ThreadPoolStrategy S) {
+  // FIXME: Skip these tests on non-Windows because multi-socket system were not
+  // tested on Unix yet, and llvm::get_thread_affinity_mask() isn't implemented
+  // for Unix.
+  Triple Host(Triple::normalize(sys::getProcessTriple()));
+  if (!Host.isOSWindows())
+return;
+
+  llvm::DenseSet ThreadsUsed;
+  std::mutex Lock;
+  unsigned Threads = 0;
+  {
+ThreadPool Pool(S);
+Threads = Pool.getThreadCount();
+for (size_t I = 0; I < 1; ++I) {
+  Pool.async([&] {
+waitForMainThread();
+std::lock_guard Guard(Lock);
+auto Mask = llvm::get_thread_affinity_mask();
+ThreadsUsed.insert(Mask);
+  });
+}
+ASSERT_EQ(true, ThreadsUsed.empty());
+

[PATCH] D74051: Move update_cc_test_checks.py tests to clang

2020-02-14 Thread Alexander Richardson via Phabricator via cfe-commits
arichardson added a comment.

Turns out those scripts use different code to write the updated file. The 
failure should hopefully be fixed in rGc29310707e9a85e70a226277657cd9d9182a5d04 



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74051



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


[clang] d9049e8 - [clang-scan-deps] Switch to using a ThreadPool

2020-02-14 Thread Alexandre Ganea via cfe-commits

Author: Alexandre Ganea
Date: 2020-02-14T10:24:22-05:00
New Revision: d9049e871f309199a3d8fd7d3c0f76c86af9db91

URL: 
https://github.com/llvm/llvm-project/commit/d9049e871f309199a3d8fd7d3c0f76c86af9db91
DIFF: 
https://github.com/llvm/llvm-project/commit/d9049e871f309199a3d8fd7d3c0f76c86af9db91.diff

LOG: [clang-scan-deps] Switch to using a ThreadPool

Use a ThreadPool instead of plain std::threads in clang-scan-deps.
This is needed to further support https://reviews.llvm.org/D71775.

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

Added: 


Modified: 
clang/tools/clang-scan-deps/ClangScanDeps.cpp

Removed: 




diff  --git a/clang/tools/clang-scan-deps/ClangScanDeps.cpp 
b/clang/tools/clang-scan-deps/ClangScanDeps.cpp
index 50788cb7cf8b..c499048fdb52 100644
--- a/clang/tools/clang-scan-deps/ClangScanDeps.cpp
+++ b/clang/tools/clang-scan-deps/ClangScanDeps.cpp
@@ -18,6 +18,7 @@
 #include "llvm/Support/JSON.h"
 #include "llvm/Support/Program.h"
 #include "llvm/Support/Signals.h"
+#include "llvm/Support/ThreadPool.h"
 #include "llvm/Support/Threading.h"
 #include 
 #include 
@@ -490,6 +491,7 @@ int main(int argc, const char **argv) {
 #else
   unsigned NumWorkers = 1;
 #endif
+  llvm::ThreadPool Pool(NumWorkers);
   std::vector> WorkerTools;
   for (unsigned I = 0; I < NumWorkers; ++I)
 WorkerTools.push_back(std::make_unique(Service));
@@ -499,7 +501,6 @@ int main(int argc, const char **argv) {
AdjustingCompilations->getAllCompileCommands())
 Inputs.emplace_back(Cmd);
 
-  std::vector WorkerThreads;
   std::atomic HadErrors(false);
   FullDeps FD;
   std::mutex Lock;
@@ -510,8 +511,8 @@ int main(int argc, const char **argv) {
  << " files using " << NumWorkers << " workers\n";
   }
   for (unsigned I = 0; I < NumWorkers; ++I) {
-auto Worker = [I, , , , , , ,
-   , ]() {
+Pool.async([I, , , , , , ,
+, ]() {
   llvm::StringSet<> AlreadySeenModules;
   while (true) {
 const SingleCommandCompilationDatabase *Input;
@@ -543,16 +544,9 @@ int main(int argc, const char **argv) {
 HadErrors = true;
 }
   }
-};
-#if LLVM_ENABLE_THREADS
-WorkerThreads.emplace_back(std::move(Worker));
-#else
-// Run the worker without spawning a thread when threads are disabled.
-Worker();
-#endif
+});
   }
-  for (auto  : WorkerThreads)
-W.join();
+  Pool.wait();
 
   if (Format == ScanningOutputFormat::Full)
 FD.printFullOutput(llvm::outs());



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


[clang-tools-extra] 8404aeb - [Support] On Windows, ensure hardware_concurrency() extends to all CPU sockets and all NUMA groups

2020-02-14 Thread Alexandre Ganea via cfe-commits

Author: Alexandre Ganea
Date: 2020-02-14T10:24:22-05:00
New Revision: 8404aeb56a73ab24f9b295111de3b37a37f0b841

URL: 
https://github.com/llvm/llvm-project/commit/8404aeb56a73ab24f9b295111de3b37a37f0b841
DIFF: 
https://github.com/llvm/llvm-project/commit/8404aeb56a73ab24f9b295111de3b37a37f0b841.diff

LOG: [Support] On Windows, ensure hardware_concurrency() extends to all CPU 
sockets and all NUMA groups

The goal of this patch is to maximize CPU utilization on multi-socket or high 
core count systems, so that parallel computations such as LLD/ThinLTO can use 
all hardware threads in the system. Before this patch, on Windows, a maximum of 
64 hardware threads could be used at most, in some cases dispatched only on one 
CPU socket.

== Background ==
Windows doesn't have a flat cpu_set_t like Linux. Instead, it projects hardware 
CPUs (or NUMA nodes) to applications through a concept of "processor groups". A 
"processor" is the smallest unit of execution on a CPU, that is, an 
hyper-thread if SMT is active; a core otherwise. There's a limit of 32-bit 
processors on older 32-bit versions of Windows, which later was raised to 
64-processors with 64-bit versions of Windows. This limit comes from the 
affinity mask, which historically is represented by the sizeof(void*). 
Consequently, the concept of "processor groups" was introduced for dealing with 
systems with more than 64 hyper-threads.

By default, the Windows OS assigns only one "processor group" to each starting 
application, in a round-robin manner. If the application wants to use more 
processors, it needs to programmatically enable it, by assigning threads to 
other "processor groups". This also means that affinity cannot cross "processor 
group" boundaries; one can only specify a "preferred" group on start-up, but 
the application is free to allocate more groups if it wants to.

This creates a peculiar situation, where newer CPUs like the AMD EPYC 7702P 
(64-cores, 128-hyperthreads) are projected by the OS as two (2) "processor 
groups". This means that by default, an application can only use half of the 
cores. This situation could only get worse in the years to come, as dies with 
more cores will appear on the market.

== The problem ==
The heavyweight_hardware_concurrency() API was introduced so that only *one 
hardware thread per core* was used. Once that API returns, that original 
intention is lost, only the number of threads is retained. Consider a 
situation, on Windows, where the system has 2 CPU sockets, 18 cores each, each 
core having 2 hyper-threads, for a total of 72 hyper-threads. Both 
heavyweight_hardware_concurrency() and hardware_concurrency() currently return 
36, because on Windows they are simply wrappers over 
std::thread::hardware_concurrency() -- which can only return processors from 
the current "processor group".

== The changes in this patch ==
To solve this situation, we capture (and retain) the initial intention until 
the point of usage, through a new ThreadPoolStrategy class. The number of 
threads to use is deferred as late as possible, until the moment where the 
std::threads are created (ThreadPool in the case of ThinLTO).

When using hardware_concurrency(), setting ThreadCount to 0 now means to use 
all the possible hardware CPU (SMT) threads. Providing a ThreadCount above to 
the maximum number of threads will have no effect, the maximum will be used 
instead.
The heavyweight_hardware_concurrency() is similar to hardware_concurrency(), 
except that only one thread per hardware *core* will be used.

When LLVM_ENABLE_THREADS is OFF, the threading APIs will always return 1, to 
ensure any caller loops will be exercised at least once.

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

Added: 


Modified: 
clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
clang-tools-extra/clangd/TUScheduler.cpp
clang-tools-extra/clangd/index/Background.cpp
clang-tools-extra/clangd/index/Background.h
clang-tools-extra/clangd/index/BackgroundRebuild.h
clang/lib/Tooling/AllTUsExecution.cpp
clang/lib/Tooling/DependencyScanning/DependencyScanningFilesystem.cpp
clang/tools/clang-scan-deps/ClangScanDeps.cpp
lld/ELF/SyntheticSections.cpp
llvm/include/llvm/LTO/LTO.h
llvm/include/llvm/Support/ThreadPool.h
llvm/include/llvm/Support/Threading.h
llvm/lib/CodeGen/ParallelCG.cpp
llvm/lib/DWARFLinker/DWARFLinker.cpp
llvm/lib/DebugInfo/GSYM/DwarfTransformer.cpp
llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
llvm/lib/LTO/LTO.cpp
llvm/lib/LTO/LTOBackend.cpp
llvm/lib/LTO/ThinLTOCodeGenerator.cpp
llvm/lib/Support/Host.cpp
llvm/lib/Support/Parallel.cpp
llvm/lib/Support/ThreadPool.cpp
llvm/lib/Support/Threading.cpp
llvm/lib/Support/Unix/Threading.inc
llvm/lib/Support/Windows/Threading.inc
llvm/tools/dsymutil/dsymutil.cpp
llvm/tools/gold/gold-plugin.cpp
llvm/tools/llvm-cov/CodeCoverage.cpp
llvm/tools/llvm-cov/CoverageExporterJson.cpp

[PATCH] D74051: Move update_cc_test_checks.py tests to clang

2020-02-14 Thread Alexander Richardson via Phabricator via cfe-commits
arichardson added a comment.

In D74051#1876291 , @thakis wrote:

> Fails on windows, looks like line endings: 
> http://45.33.8.238/win/8350/step_7.txt


Are the other update_test_checks.py and update_llc_test_checks.py tests running 
on that bot? I would expect them to fail in the same way otherwise?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74051



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


[PATCH] D73138: [libcxx] [test] Correct asserted type in subspan test; subspan with count should never produce dynamic_extent

2020-02-14 Thread Louis Dionne via Phabricator via cfe-commits
ldionne added a comment.

I think this was addressed by https://reviews.llvm.org/D71997.


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

https://reviews.llvm.org/D73138



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


[clang-tools-extra] 13700c3 - Revert "[clang-tools-extra] fix the check for if '-latomic' is necessary"

2020-02-14 Thread Luís Marques via cfe-commits

Author: Luís Marques
Date: 2020-02-14T15:01:52Z
New Revision: 13700c383fdbb172fac281bff6738a62989631c5

URL: 
https://github.com/llvm/llvm-project/commit/13700c383fdbb172fac281bff6738a62989631c5
DIFF: 
https://github.com/llvm/llvm-project/commit/13700c383fdbb172fac281bff6738a62989631c5.diff

LOG: Revert "[clang-tools-extra] fix the check for if '-latomic' is necessary"

This reverts commit 1d40c4150630729a9c1ce5119a8027dac93a5b2d.
This seemed to have caused build failures on ARM/AArch64.

Added: 


Modified: 
clang-tools-extra/clangd/CMakeLists.txt

Removed: 




diff  --git a/clang-tools-extra/clangd/CMakeLists.txt 
b/clang-tools-extra/clangd/CMakeLists.txt
index fc5a07e69e9d..e3eccb50a496 100644
--- a/clang-tools-extra/clangd/CMakeLists.txt
+++ b/clang-tools-extra/clangd/CMakeLists.txt
@@ -30,7 +30,7 @@ if(CLANG_BUILT_STANDALONE)
 endif()
 
 set(CLANGD_ATOMIC_LIB "")
-if(NOT HAVE_CXX_ATOMICS_WITHOUT_LIB OR NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB)
+if(NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB)
   list(APPEND CLANGD_ATOMIC_LIB "atomic")
 endif()
 



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


[PATCH] D74051: Move update_cc_test_checks.py tests to clang

2020-02-14 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment.

Fails on windows, looks like line endings: 
http://45.33.8.238/win/8350/step_7.txt


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74051



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


[PATCH] D74609: [clangd] Update the CompletionItemKind.

2020-02-14 Thread Haojian Wu via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG5dc2314d5ecf: [clangd] Update the CompletionItemKind. 
(authored by hokein).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74609

Files:
  clang-tools-extra/clangd/CodeComplete.cpp
  clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp


Index: clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
===
--- clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
+++ clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
@@ -481,7 +481,7 @@
   AllOf(Has("function", CompletionItemKind::Function),
 Has("variable", CompletionItemKind::Variable),
 Has("int", CompletionItemKind::Keyword),
-Has("Struct", CompletionItemKind::Class),
+Has("Struct", CompletionItemKind::Struct),
 Has("MACRO", CompletionItemKind::Text),
 Has("indexFunction", CompletionItemKind::Function),
 Has("indexVariable", CompletionItemKind::Variable),
@@ -529,6 +529,17 @@
   AllOf(Named("complete_variable"), 
Kind(CompletionItemKind::Variable)),
   AllOf(Named("complete_static_member"),
 Kind(CompletionItemKind::Property;
+
+   Results = completions(
+  R"cpp(
+enum Color {
+  Red
+};
+Color u = ^
+  )cpp");
+   EXPECT_THAT(Results.Completions,
+   Contains(
+   AllOf(Named("Red"), Kind(CompletionItemKind::EnumMember;
 }
 
 TEST(CompletionTest, NoDuplicates) {
Index: clang-tools-extra/clangd/CodeComplete.cpp
===
--- clang-tools-extra/clangd/CodeComplete.cpp
+++ clang-tools-extra/clangd/CodeComplete.cpp
@@ -87,9 +87,8 @@
 return CompletionItemKind::Text;
   case SK::Enum:
 return CompletionItemKind::Enum;
-  // FIXME(ioeric): use LSP struct instead of class when it is suppoted in the
-  // protocol.
   case SK::Struct:
+return CompletionItemKind::Struct;
   case SK::Class:
   case SK::Protocol:
   case SK::Extension:
@@ -102,8 +101,6 @@
   case SK::Using:
 return CompletionItemKind::Reference;
   case SK::Function:
-  // FIXME(ioeric): this should probably be an operator. This should be fixed
-  // when `Operator` is support type in the protocol.
   case SK::ConversionFunction:
 return CompletionItemKind::Function;
   case SK::Variable:
@@ -112,9 +109,8 @@
 return CompletionItemKind::Variable;
   case SK::Field:
 return CompletionItemKind::Field;
-  // FIXME(ioeric): use LSP enum constant when it is supported in the protocol.
   case SK::EnumConstant:
-return CompletionItemKind::Value;
+return CompletionItemKind::EnumMember;
   case SK::InstanceMethod:
   case SK::ClassMethod:
   case SK::StaticMethod:


Index: clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
===
--- clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
+++ clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
@@ -481,7 +481,7 @@
   AllOf(Has("function", CompletionItemKind::Function),
 Has("variable", CompletionItemKind::Variable),
 Has("int", CompletionItemKind::Keyword),
-Has("Struct", CompletionItemKind::Class),
+Has("Struct", CompletionItemKind::Struct),
 Has("MACRO", CompletionItemKind::Text),
 Has("indexFunction", CompletionItemKind::Function),
 Has("indexVariable", CompletionItemKind::Variable),
@@ -529,6 +529,17 @@
   AllOf(Named("complete_variable"), Kind(CompletionItemKind::Variable)),
   AllOf(Named("complete_static_member"),
 Kind(CompletionItemKind::Property;
+
+   Results = completions(
+  R"cpp(
+enum Color {
+  Red
+};
+Color u = ^
+  )cpp");
+   EXPECT_THAT(Results.Completions,
+   Contains(
+   AllOf(Named("Red"), Kind(CompletionItemKind::EnumMember;
 }
 
 TEST(CompletionTest, NoDuplicates) {
Index: clang-tools-extra/clangd/CodeComplete.cpp
===
--- clang-tools-extra/clangd/CodeComplete.cpp
+++ clang-tools-extra/clangd/CodeComplete.cpp
@@ -87,9 +87,8 @@
 return CompletionItemKind::Text;
   case SK::Enum:
 return CompletionItemKind::Enum;
-  // FIXME(ioeric): use LSP struct instead of class when it is suppoted in the
-  // protocol.
   case SK::Struct:
+return CompletionItemKind::Struct;
   case SK::Class:
   case SK::Protocol:
   case SK::Extension:
@@ -102,8 +101,6 @@
   case SK::Using:
 return CompletionItemKind::Reference;
   case SK::Function:
-  // 

[clang-tools-extra] 5dc2314 - [clangd] Update the CompletionItemKind.

2020-02-14 Thread Haojian Wu via cfe-commits

Author: Haojian Wu
Date: 2020-02-14T15:48:30+01:00
New Revision: 5dc2314d5ecf3fe246ee0134f519183844287456

URL: 
https://github.com/llvm/llvm-project/commit/5dc2314d5ecf3fe246ee0134f519183844287456
DIFF: 
https://github.com/llvm/llvm-project/commit/5dc2314d5ecf3fe246ee0134f519183844287456.diff

LOG: [clangd] Update the CompletionItemKind.

Summary: Fix some FIXMEs.

Reviewers: kadircet

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits

Tags: #clang

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

Added: 


Modified: 
clang-tools-extra/clangd/CodeComplete.cpp
clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp

Removed: 




diff  --git a/clang-tools-extra/clangd/CodeComplete.cpp 
b/clang-tools-extra/clangd/CodeComplete.cpp
index f7c6f105cb9a..3fbf98970cce 100644
--- a/clang-tools-extra/clangd/CodeComplete.cpp
+++ b/clang-tools-extra/clangd/CodeComplete.cpp
@@ -87,9 +87,8 @@ CompletionItemKind toCompletionItemKind(index::SymbolKind 
Kind) {
 return CompletionItemKind::Text;
   case SK::Enum:
 return CompletionItemKind::Enum;
-  // FIXME(ioeric): use LSP struct instead of class when it is suppoted in the
-  // protocol.
   case SK::Struct:
+return CompletionItemKind::Struct;
   case SK::Class:
   case SK::Protocol:
   case SK::Extension:
@@ -102,8 +101,6 @@ CompletionItemKind toCompletionItemKind(index::SymbolKind 
Kind) {
   case SK::Using:
 return CompletionItemKind::Reference;
   case SK::Function:
-  // FIXME(ioeric): this should probably be an operator. This should be fixed
-  // when `Operator` is support type in the protocol.
   case SK::ConversionFunction:
 return CompletionItemKind::Function;
   case SK::Variable:
@@ -112,9 +109,8 @@ CompletionItemKind toCompletionItemKind(index::SymbolKind 
Kind) {
 return CompletionItemKind::Variable;
   case SK::Field:
 return CompletionItemKind::Field;
-  // FIXME(ioeric): use LSP enum constant when it is supported in the protocol.
   case SK::EnumConstant:
-return CompletionItemKind::Value;
+return CompletionItemKind::EnumMember;
   case SK::InstanceMethod:
   case SK::ClassMethod:
   case SK::StaticMethod:

diff  --git a/clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp 
b/clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
index a39c7431044f..f9ffe1167338 100644
--- a/clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
+++ b/clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
@@ -481,7 +481,7 @@ TEST(CompletionTest, Kinds) {
   AllOf(Has("function", CompletionItemKind::Function),
 Has("variable", CompletionItemKind::Variable),
 Has("int", CompletionItemKind::Keyword),
-Has("Struct", CompletionItemKind::Class),
+Has("Struct", CompletionItemKind::Struct),
 Has("MACRO", CompletionItemKind::Text),
 Has("indexFunction", CompletionItemKind::Function),
 Has("indexVariable", CompletionItemKind::Variable),
@@ -529,6 +529,17 @@ TEST(CompletionTest, Kinds) {
   AllOf(Named("complete_variable"), 
Kind(CompletionItemKind::Variable)),
   AllOf(Named("complete_static_member"),
 Kind(CompletionItemKind::Property;
+
+   Results = completions(
+  R"cpp(
+enum Color {
+  Red
+};
+Color u = ^
+  )cpp");
+   EXPECT_THAT(Results.Completions,
+   Contains(
+   AllOf(Named("Red"), Kind(CompletionItemKind::EnumMember;
 }
 
 TEST(CompletionTest, NoDuplicates) {



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


[PATCH] D74051: Move update_cc_test_checks.py tests to clang

2020-02-14 Thread Alexander Richardson via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG61dd0603bd8a: Move update_cc_test_checks.py tests to clang 
(authored by arichardson).

Changed prior to commit:
  https://reviews.llvm.org/D74051?vs=243859=244650#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74051

Files:
  clang/test/utils/update_cc_test_checks/Inputs/def-and-decl.c
  clang/test/utils/update_cc_test_checks/Inputs/def-and-decl.c.expected
  clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c
  clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c.expected
  clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c.funcsig.expected
  clang/test/utils/update_cc_test_checks/def-and-decl.test
  clang/test/utils/update_cc_test_checks/lit.local.cfg
  clang/test/utils/update_cc_test_checks/mangled_names.test
  llvm/test/tools/UpdateTestChecks/lit.local.cfg
  llvm/test/tools/UpdateTestChecks/update_cc_test_checks/Inputs/def-and-decl.c
  
llvm/test/tools/UpdateTestChecks/update_cc_test_checks/Inputs/def-and-decl.c.expected
  llvm/test/tools/UpdateTestChecks/update_cc_test_checks/Inputs/mangled_names.c
  
llvm/test/tools/UpdateTestChecks/update_cc_test_checks/Inputs/mangled_names.c.expected
  
llvm/test/tools/UpdateTestChecks/update_cc_test_checks/Inputs/mangled_names.c.funcsig.expected
  llvm/test/tools/UpdateTestChecks/update_cc_test_checks/def-and-decl.test
  llvm/test/tools/UpdateTestChecks/update_cc_test_checks/lit.local.cfg
  llvm/test/tools/UpdateTestChecks/update_cc_test_checks/mangled_names.test


Index: llvm/test/tools/UpdateTestChecks/update_cc_test_checks/lit.local.cfg
===
--- llvm/test/tools/UpdateTestChecks/update_cc_test_checks/lit.local.cfg
+++ /dev/null
@@ -1,3 +0,0 @@
-# These tests require clang.
-if 'clang-binary' not in config.available_features:
-config.unsupported = True
Index: llvm/test/tools/UpdateTestChecks/lit.local.cfg
===
--- llvm/test/tools/UpdateTestChecks/lit.local.cfg
+++ llvm/test/tools/UpdateTestChecks/lit.local.cfg
@@ -42,11 +42,3 @@
 config.available_features.add('llvm-mca-binary')
 mca_arg = '--llvm-mca-binary ' + shell_quote(llvm_mca_path)
 add_update_script_substition('%update_test_checks', extra_args=mca_arg)
-
-clang_path = os.path.join(config.llvm_tools_dir, 'clang')
-if os.path.isfile(clang_path):
-config.available_features.add('clang-binary')
-extra_args = '--clang ' + shell_quote(clang_path)
-if os.path.isfile(opt_path):
-extra_args += ' --opt ' + shell_quote(opt_path)
-add_update_script_substition('%update_cc_test_checks', 
extra_args=extra_args)
Index: clang/test/utils/update_cc_test_checks/lit.local.cfg
===
--- /dev/null
+++ clang/test/utils/update_cc_test_checks/lit.local.cfg
@@ -0,0 +1,25 @@
+import os
+
+import lit.util
+
+# python 2.7 backwards compatibility
+try:
+from shlex import quote as shell_quote
+except ImportError:
+from pipes import quote as shell_quote
+
+
+config.test_format = lit.formats.ShTest(execute_external=False)
+config.suffixes = ['.test']
+
+clang_path = os.path.join(config.clang_tools_dir, 'clang')
+extra_args = '--clang ' + shell_quote(clang_path)
+opt_path = os.path.join(config.llvm_tools_dir, 'opt')
+extra_args += ' --opt ' + shell_quote(opt_path)
+script_path = os.path.join(config.llvm_src_root, 'utils',
+   'update_cc_test_checks.py')
+assert os.path.isfile(script_path)
+config.substitutions.append(
+('%update_cc_test_checks', "%s %s %s" % (
+shell_quote(config.python_executable), shell_quote(script_path),
+extra_args)))


Index: llvm/test/tools/UpdateTestChecks/update_cc_test_checks/lit.local.cfg
===
--- llvm/test/tools/UpdateTestChecks/update_cc_test_checks/lit.local.cfg
+++ /dev/null
@@ -1,3 +0,0 @@
-# These tests require clang.
-if 'clang-binary' not in config.available_features:
-config.unsupported = True
Index: llvm/test/tools/UpdateTestChecks/lit.local.cfg
===
--- llvm/test/tools/UpdateTestChecks/lit.local.cfg
+++ llvm/test/tools/UpdateTestChecks/lit.local.cfg
@@ -42,11 +42,3 @@
 config.available_features.add('llvm-mca-binary')
 mca_arg = '--llvm-mca-binary ' + shell_quote(llvm_mca_path)
 add_update_script_substition('%update_test_checks', extra_args=mca_arg)
-
-clang_path = os.path.join(config.llvm_tools_dir, 'clang')
-if os.path.isfile(clang_path):
-config.available_features.add('clang-binary')
-extra_args = '--clang ' + shell_quote(clang_path)
-if os.path.isfile(opt_path):
-extra_args += ' --opt ' + shell_quote(opt_path)
-

[PATCH] D74609: [clangd] Update the CompletionItemKind.

2020-02-14 Thread Haojian Wu via Phabricator via cfe-commits
hokein added inline comments.



Comment at: clang-tools-extra/clangd/CodeComplete.cpp:106
+  case SK::ConversionFunction:
+return CompletionItemKind::Operator;
   case SK::Variable:

kadircet wrote:
> I believe `function` still captures the intend better here, as you can only 
> see the completion if you are literally completing for `Foo.operator X()` 
> (btw, I am not even sure if we show completions for those, we might have 
> another bug around this one).
> 
> So I would keep it the same, but up to you.
hmm, I'm not sure we will actually encounter this case in practice, the 
completion didn't show up on `Foo.^` or `Foo.operat^or`,   `Foo.opeator ^` 
shows completion results, but seems not running into this code path. 

Reverted back, and removed the fixme.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74609



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


[PATCH] D74395: [clangd] Add tracer to the rename workflow, NFC

2020-02-14 Thread Haojian Wu via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG74c97ca1b4b7: [clangd] Add tracer to the rename workflow, 
NFC (authored by hokein).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74395

Files:
  clang-tools-extra/clangd/refactor/Rename.cpp

Index: clang-tools-extra/clangd/refactor/Rename.cpp
===
--- clang-tools-extra/clangd/refactor/Rename.cpp
+++ clang-tools-extra/clangd/refactor/Rename.cpp
@@ -13,6 +13,7 @@
 #include "ParsedAST.h"
 #include "Selection.h"
 #include "SourceCode.h"
+#include "Trace.h"
 #include "index/SymbolCollector.h"
 #include "clang/AST/DeclCXX.h"
 #include "clang/AST/DeclTemplate.h"
@@ -124,6 +125,7 @@
   StringRef MainFilePath,
   const SymbolIndex *Index,
   bool CrossFile) {
+  trace::Span Tracer("Renameable");
   // Filter out symbols that are unsupported in both rename modes.
   if (llvm::isa())
 return ReasonToReject::UnsupportedSymbol;
@@ -225,6 +227,7 @@
 // Return all rename occurrences in the main file.
 std::vector findOccurrencesWithinFile(ParsedAST ,
   const NamedDecl ) {
+  trace::Span Tracer("FindOccurrenceeWithinFile");
   // If the cursor is at the underlying CXXRecordDecl of the
   // ClassTemplateDecl, ND will be the CXXRecordDecl. In this case, we need to
   // get the primary template maunally.
@@ -260,6 +263,7 @@
 llvm::Expected
 renameWithinFile(ParsedAST , const NamedDecl ,
  llvm::StringRef NewName) {
+  trace::Span Tracer("RenameWithinFile");
   const SourceManager  = AST.getSourceManager();
 
   tooling::Replacements FilteredChanges;
@@ -319,6 +323,7 @@
 llvm::Expected>>
 findOccurrencesOutsideFile(const NamedDecl ,
llvm::StringRef MainFile, const SymbolIndex ) {
+  trace::Span Tracer("FindOccurrencesOutsideFile");
   RefsRequest RQuest;
   RQuest.IDs.insert(*getSymbolID());
   // Classes and their constructors are different symbols, and have different
@@ -361,6 +366,9 @@
 auto  = FileAndOccurrences.getValue();
 llvm::sort(Ranges);
 Ranges.erase(std::unique(Ranges.begin(), Ranges.end()), Ranges.end());
+
+SPAN_ATTACH(Tracer, FileAndOccurrences.first(),
+static_cast(Ranges.size()));
   }
   return AffectedFiles;
 }
@@ -381,6 +389,7 @@
 const NamedDecl , llvm::StringRef MainFilePath,
 llvm::StringRef NewName, const SymbolIndex ,
 llvm::function_ref(PathRef)> GetFileContent) {
+  trace::Span Tracer("RenameOutsideFile");
   auto AffectedFiles =
   findOccurrencesOutsideFile(RenameDecl, MainFilePath, Index);
   if (!AffectedFiles)
@@ -463,6 +472,7 @@
 } // namespace
 
 llvm::Expected rename(const RenameInputs ) {
+  trace::Span Tracer("Rename flow");
   ParsedAST  = RInputs.AST;
   const SourceManager  = AST.getSourceManager();
   llvm::StringRef MainFileCode = SM.getBufferData(SM.getMainFileID());
@@ -555,6 +565,11 @@
  llvm::StringRef InitialCode,
  std::vector Occurrences,
  llvm::StringRef NewName) {
+  trace::Span Tracer("BuildRenameEdit");
+  SPAN_ATTACH(Tracer, "file_path", AbsFilePath);
+  SPAN_ATTACH(Tracer, "rename_occurrences",
+  static_cast(Occurrences.size()));
+
   assert(std::is_sorted(Occurrences.begin(), Occurrences.end()));
   assert(std::unique(Occurrences.begin(), Occurrences.end()) ==
  Occurrences.end() &&
@@ -618,6 +633,7 @@
 llvm::Optional>
 adjustRenameRanges(llvm::StringRef DraftCode, llvm::StringRef Identifier,
std::vector Indexed, const LangOptions ) {
+  trace::Span Tracer("AdjustRenameRanges");
   assert(!Indexed.empty());
   assert(std::is_sorted(Indexed.begin(), Indexed.end()));
   std::vector Lexed =
@@ -628,12 +644,16 @@
 
 llvm::Optional> getMappedRanges(ArrayRef Indexed,
ArrayRef Lexed) {
+  trace::Span Tracer("GetMappedRanges");
   assert(!Indexed.empty());
   assert(std::is_sorted(Indexed.begin(), Indexed.end()));
   assert(std::is_sorted(Lexed.begin(), Lexed.end()));
 
   if (Indexed.size() > Lexed.size()) {
 vlog("The number of lexed occurrences is less than indexed occurrences");
+SPAN_ATTACH(
+Tracer, "error",
+"The number of lexed occurrences is less than indexed occurrences");
 return llvm::None;
   }
   // Fast check for the special subset case.
@@ -660,15 +680,18 @@
});
   if (HasMultiple) {
 vlog("The best near miss is not unique.");
+SPAN_ATTACH(Tracer, "error", "The best near miss is not unique");
 return llvm::None;
   }
   if (Best.empty()) {
 vlog("Didn't find a near miss.");
+

[clang-tools-extra] 74c97ca - [clangd] Add tracer to the rename workflow, NFC

2020-02-14 Thread Haojian Wu via cfe-commits

Author: Haojian Wu
Date: 2020-02-14T15:39:29+01:00
New Revision: 74c97ca1b4b7d1a7497cebc0c9c91d2764a6f4b4

URL: 
https://github.com/llvm/llvm-project/commit/74c97ca1b4b7d1a7497cebc0c9c91d2764a6f4b4
DIFF: 
https://github.com/llvm/llvm-project/commit/74c97ca1b4b7d1a7497cebc0c9c91d2764a6f4b4.diff

LOG: [clangd] Add tracer to the rename workflow, NFC

Reviewers: kbobyrev

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, 
cfe-commits

Tags: #clang

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

Added: 


Modified: 
clang-tools-extra/clangd/refactor/Rename.cpp

Removed: 




diff  --git a/clang-tools-extra/clangd/refactor/Rename.cpp 
b/clang-tools-extra/clangd/refactor/Rename.cpp
index 8b9b1d0033a5..c5dd09b99508 100644
--- a/clang-tools-extra/clangd/refactor/Rename.cpp
+++ b/clang-tools-extra/clangd/refactor/Rename.cpp
@@ -13,6 +13,7 @@
 #include "ParsedAST.h"
 #include "Selection.h"
 #include "SourceCode.h"
+#include "Trace.h"
 #include "index/SymbolCollector.h"
 #include "clang/AST/DeclCXX.h"
 #include "clang/AST/DeclTemplate.h"
@@ -124,6 +125,7 @@ llvm::Optional renameable(const NamedDecl 
,
   StringRef MainFilePath,
   const SymbolIndex *Index,
   bool CrossFile) {
+  trace::Span Tracer("Renameable");
   // Filter out symbols that are unsupported in both rename modes.
   if (llvm::isa())
 return ReasonToReject::UnsupportedSymbol;
@@ -225,6 +227,7 @@ llvm::Error makeError(ReasonToReject Reason) {
 // Return all rename occurrences in the main file.
 std::vector findOccurrencesWithinFile(ParsedAST ,
   const NamedDecl ) {
+  trace::Span Tracer("FindOccurrenceeWithinFile");
   // If the cursor is at the underlying CXXRecordDecl of the
   // ClassTemplateDecl, ND will be the CXXRecordDecl. In this case, we need to
   // get the primary template maunally.
@@ -260,6 +263,7 @@ std::vector 
findOccurrencesWithinFile(ParsedAST ,
 llvm::Expected
 renameWithinFile(ParsedAST , const NamedDecl ,
  llvm::StringRef NewName) {
+  trace::Span Tracer("RenameWithinFile");
   const SourceManager  = AST.getSourceManager();
 
   tooling::Replacements FilteredChanges;
@@ -319,6 +323,7 @@ std::vector 
getConstructors(const NamedDecl *ND) {
 llvm::Expected>>
 findOccurrencesOutsideFile(const NamedDecl ,
llvm::StringRef MainFile, const SymbolIndex ) 
{
+  trace::Span Tracer("FindOccurrencesOutsideFile");
   RefsRequest RQuest;
   RQuest.IDs.insert(*getSymbolID());
   // Classes and their constructors are 
diff erent symbols, and have 
diff erent
@@ -361,6 +366,9 @@ findOccurrencesOutsideFile(const NamedDecl ,
 auto  = FileAndOccurrences.getValue();
 llvm::sort(Ranges);
 Ranges.erase(std::unique(Ranges.begin(), Ranges.end()), Ranges.end());
+
+SPAN_ATTACH(Tracer, FileAndOccurrences.first(),
+static_cast(Ranges.size()));
   }
   return AffectedFiles;
 }
@@ -381,6 +389,7 @@ llvm::Expected renameOutsideFile(
 const NamedDecl , llvm::StringRef MainFilePath,
 llvm::StringRef NewName, const SymbolIndex ,
 llvm::function_ref(PathRef)> GetFileContent) {
+  trace::Span Tracer("RenameOutsideFile");
   auto AffectedFiles =
   findOccurrencesOutsideFile(RenameDecl, MainFilePath, Index);
   if (!AffectedFiles)
@@ -463,6 +472,7 @@ void findNearMiss(
 } // namespace
 
 llvm::Expected rename(const RenameInputs ) {
+  trace::Span Tracer("Rename flow");
   ParsedAST  = RInputs.AST;
   const SourceManager  = AST.getSourceManager();
   llvm::StringRef MainFileCode = SM.getBufferData(SM.getMainFileID());
@@ -555,6 +565,11 @@ llvm::Expected buildRenameEdit(llvm::StringRef 
AbsFilePath,
  llvm::StringRef InitialCode,
  std::vector Occurrences,
  llvm::StringRef NewName) {
+  trace::Span Tracer("BuildRenameEdit");
+  SPAN_ATTACH(Tracer, "file_path", AbsFilePath);
+  SPAN_ATTACH(Tracer, "rename_occurrences",
+  static_cast(Occurrences.size()));
+
   assert(std::is_sorted(Occurrences.begin(), Occurrences.end()));
   assert(std::unique(Occurrences.begin(), Occurrences.end()) ==
  Occurrences.end() &&
@@ -618,6 +633,7 @@ llvm::Expected buildRenameEdit(llvm::StringRef 
AbsFilePath,
 llvm::Optional>
 adjustRenameRanges(llvm::StringRef DraftCode, llvm::StringRef Identifier,
std::vector Indexed, const LangOptions ) {
+  trace::Span Tracer("AdjustRenameRanges");
   assert(!Indexed.empty());
   assert(std::is_sorted(Indexed.begin(), Indexed.end()));
   std::vector Lexed =
@@ -628,12 +644,16 @@ adjustRenameRanges(llvm::StringRef DraftCode, 
llvm::StringRef Identifier,
 
 llvm::Optional> getMappedRanges(ArrayRef Indexed,
 

[clang] 61dd060 - Move update_cc_test_checks.py tests to clang

2020-02-14 Thread Alex Richardson via cfe-commits

Author: Alex Richardson
Date: 2020-02-14T14:39:55Z
New Revision: 61dd0603bd8afeaa0d467d19c1522b5fbcf0104c

URL: 
https://github.com/llvm/llvm-project/commit/61dd0603bd8afeaa0d467d19c1522b5fbcf0104c
DIFF: 
https://github.com/llvm/llvm-project/commit/61dd0603bd8afeaa0d467d19c1522b5fbcf0104c.diff

LOG: Move update_cc_test_checks.py tests to clang

Having tests that depend on clang inside llvm/ are not a good idea since
it can break incremental `ninja check-llvm`.

Fixes https://llvm.org/PR44798

Reviewed By: lebedev.ri, MaskRay, rsmith
Differential Revision: https://reviews.llvm.org/D74051

Added: 
clang/test/utils/update_cc_test_checks/Inputs/def-and-decl.c
clang/test/utils/update_cc_test_checks/Inputs/def-and-decl.c.expected
clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c
clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c.expected

clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c.funcsig.expected
clang/test/utils/update_cc_test_checks/def-and-decl.test
clang/test/utils/update_cc_test_checks/lit.local.cfg
clang/test/utils/update_cc_test_checks/mangled_names.test

Modified: 
llvm/test/tools/UpdateTestChecks/lit.local.cfg

Removed: 
llvm/test/tools/UpdateTestChecks/update_cc_test_checks/Inputs/def-and-decl.c

llvm/test/tools/UpdateTestChecks/update_cc_test_checks/Inputs/def-and-decl.c.expected

llvm/test/tools/UpdateTestChecks/update_cc_test_checks/Inputs/mangled_names.c

llvm/test/tools/UpdateTestChecks/update_cc_test_checks/Inputs/mangled_names.c.expected

llvm/test/tools/UpdateTestChecks/update_cc_test_checks/Inputs/mangled_names.c.funcsig.expected
llvm/test/tools/UpdateTestChecks/update_cc_test_checks/def-and-decl.test
llvm/test/tools/UpdateTestChecks/update_cc_test_checks/lit.local.cfg
llvm/test/tools/UpdateTestChecks/update_cc_test_checks/mangled_names.test



diff  --git 
a/llvm/test/tools/UpdateTestChecks/update_cc_test_checks/Inputs/def-and-decl.c 
b/clang/test/utils/update_cc_test_checks/Inputs/def-and-decl.c
similarity index 100%
rename from 
llvm/test/tools/UpdateTestChecks/update_cc_test_checks/Inputs/def-and-decl.c
rename to clang/test/utils/update_cc_test_checks/Inputs/def-and-decl.c

diff  --git 
a/llvm/test/tools/UpdateTestChecks/update_cc_test_checks/Inputs/def-and-decl.c.expected
 b/clang/test/utils/update_cc_test_checks/Inputs/def-and-decl.c.expected
similarity index 100%
rename from 
llvm/test/tools/UpdateTestChecks/update_cc_test_checks/Inputs/def-and-decl.c.expected
rename to clang/test/utils/update_cc_test_checks/Inputs/def-and-decl.c.expected

diff  --git 
a/llvm/test/tools/UpdateTestChecks/update_cc_test_checks/Inputs/mangled_names.c 
b/clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c
similarity index 100%
rename from 
llvm/test/tools/UpdateTestChecks/update_cc_test_checks/Inputs/mangled_names.c
rename to clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c

diff  --git 
a/llvm/test/tools/UpdateTestChecks/update_cc_test_checks/Inputs/mangled_names.c.expected
 b/clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c.expected
similarity index 100%
rename from 
llvm/test/tools/UpdateTestChecks/update_cc_test_checks/Inputs/mangled_names.c.expected
rename to clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c.expected

diff  --git 
a/llvm/test/tools/UpdateTestChecks/update_cc_test_checks/Inputs/mangled_names.c.funcsig.expected
 
b/clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c.funcsig.expected
similarity index 100%
rename from 
llvm/test/tools/UpdateTestChecks/update_cc_test_checks/Inputs/mangled_names.c.funcsig.expected
rename to 
clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c.funcsig.expected

diff  --git 
a/llvm/test/tools/UpdateTestChecks/update_cc_test_checks/def-and-decl.test 
b/clang/test/utils/update_cc_test_checks/def-and-decl.test
similarity index 100%
rename from 
llvm/test/tools/UpdateTestChecks/update_cc_test_checks/def-and-decl.test
rename to clang/test/utils/update_cc_test_checks/def-and-decl.test

diff  --git a/clang/test/utils/update_cc_test_checks/lit.local.cfg 
b/clang/test/utils/update_cc_test_checks/lit.local.cfg
new file mode 100644
index ..0250446423cb
--- /dev/null
+++ b/clang/test/utils/update_cc_test_checks/lit.local.cfg
@@ -0,0 +1,25 @@
+import os
+
+import lit.util
+
+# python 2.7 backwards compatibility
+try:
+from shlex import quote as shell_quote
+except ImportError:
+from pipes import quote as shell_quote
+
+
+config.test_format = lit.formats.ShTest(execute_external=False)
+config.suffixes = ['.test']
+
+clang_path = os.path.join(config.clang_tools_dir, 'clang')
+extra_args = '--clang ' + shell_quote(clang_path)
+opt_path = os.path.join(config.llvm_tools_dir, 'opt')
+extra_args += ' --opt ' + shell_quote(opt_path)
+script_path = os.path.join(config.llvm_src_root, 'utils',
+  

[PATCH] D74609: [clangd] Update the CompletionItemKind.

2020-02-14 Thread Haojian Wu via Phabricator via cfe-commits
hokein updated this revision to Diff 244646.
hokein marked 2 inline comments as done.
hokein added a comment.

address comment


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74609

Files:
  clang-tools-extra/clangd/CodeComplete.cpp
  clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp


Index: clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
===
--- clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
+++ clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
@@ -481,7 +481,7 @@
   AllOf(Has("function", CompletionItemKind::Function),
 Has("variable", CompletionItemKind::Variable),
 Has("int", CompletionItemKind::Keyword),
-Has("Struct", CompletionItemKind::Class),
+Has("Struct", CompletionItemKind::Struct),
 Has("MACRO", CompletionItemKind::Text),
 Has("indexFunction", CompletionItemKind::Function),
 Has("indexVariable", CompletionItemKind::Variable),
@@ -529,6 +529,17 @@
   AllOf(Named("complete_variable"), 
Kind(CompletionItemKind::Variable)),
   AllOf(Named("complete_static_member"),
 Kind(CompletionItemKind::Property;
+
+   Results = completions(
+  R"cpp(
+enum Color {
+  Red
+};
+Color u = ^
+  )cpp");
+   EXPECT_THAT(Results.Completions,
+   Contains(
+   AllOf(Named("Red"), Kind(CompletionItemKind::EnumMember;
 }
 
 TEST(CompletionTest, NoDuplicates) {
Index: clang-tools-extra/clangd/CodeComplete.cpp
===
--- clang-tools-extra/clangd/CodeComplete.cpp
+++ clang-tools-extra/clangd/CodeComplete.cpp
@@ -87,9 +87,8 @@
 return CompletionItemKind::Text;
   case SK::Enum:
 return CompletionItemKind::Enum;
-  // FIXME(ioeric): use LSP struct instead of class when it is suppoted in the
-  // protocol.
   case SK::Struct:
+return CompletionItemKind::Struct;
   case SK::Class:
   case SK::Protocol:
   case SK::Extension:
@@ -102,8 +101,6 @@
   case SK::Using:
 return CompletionItemKind::Reference;
   case SK::Function:
-  // FIXME(ioeric): this should probably be an operator. This should be fixed
-  // when `Operator` is support type in the protocol.
   case SK::ConversionFunction:
 return CompletionItemKind::Function;
   case SK::Variable:
@@ -112,9 +109,8 @@
 return CompletionItemKind::Variable;
   case SK::Field:
 return CompletionItemKind::Field;
-  // FIXME(ioeric): use LSP enum constant when it is supported in the protocol.
   case SK::EnumConstant:
-return CompletionItemKind::Value;
+return CompletionItemKind::EnumMember;
   case SK::InstanceMethod:
   case SK::ClassMethod:
   case SK::StaticMethod:


Index: clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
===
--- clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
+++ clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
@@ -481,7 +481,7 @@
   AllOf(Has("function", CompletionItemKind::Function),
 Has("variable", CompletionItemKind::Variable),
 Has("int", CompletionItemKind::Keyword),
-Has("Struct", CompletionItemKind::Class),
+Has("Struct", CompletionItemKind::Struct),
 Has("MACRO", CompletionItemKind::Text),
 Has("indexFunction", CompletionItemKind::Function),
 Has("indexVariable", CompletionItemKind::Variable),
@@ -529,6 +529,17 @@
   AllOf(Named("complete_variable"), Kind(CompletionItemKind::Variable)),
   AllOf(Named("complete_static_member"),
 Kind(CompletionItemKind::Property;
+
+   Results = completions(
+  R"cpp(
+enum Color {
+  Red
+};
+Color u = ^
+  )cpp");
+   EXPECT_THAT(Results.Completions,
+   Contains(
+   AllOf(Named("Red"), Kind(CompletionItemKind::EnumMember;
 }
 
 TEST(CompletionTest, NoDuplicates) {
Index: clang-tools-extra/clangd/CodeComplete.cpp
===
--- clang-tools-extra/clangd/CodeComplete.cpp
+++ clang-tools-extra/clangd/CodeComplete.cpp
@@ -87,9 +87,8 @@
 return CompletionItemKind::Text;
   case SK::Enum:
 return CompletionItemKind::Enum;
-  // FIXME(ioeric): use LSP struct instead of class when it is suppoted in the
-  // protocol.
   case SK::Struct:
+return CompletionItemKind::Struct;
   case SK::Class:
   case SK::Protocol:
   case SK::Extension:
@@ -102,8 +101,6 @@
   case SK::Using:
 return CompletionItemKind::Reference;
   case SK::Function:
-  // FIXME(ioeric): this should probably be an 

  1   2   >