[PATCH] D74499: Remove clang::ast_type_traits namespace in favor of clang

2020-02-12 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/D74499/new/

https://reviews.llvm.org/D74499



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


[PATCH] D74372: [OpenMP][IRBuilder] Perform finalization (incl. outlining) late

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

In D74372#1873623 , @plotfi wrote:

> Could this be reverted for the time being so that bots can go green? There 
> appear to be an awful lot of commits piling up on top of this one.


Should be fixed by now but you should revert if you feel it causes a problem.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74372



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


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

2020-02-12 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert accepted this revision.
jdoerfert 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/D74513/new/

https://reviews.llvm.org/D74513



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


[clang] 3f3ec9c - [OpenMP][FIX] Collect blocks to be outlined after finalization

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

Author: Johannes Doerfert
Date: 2020-02-13T00:42:22-06:00
New Revision: 3f3ec9c40b2574929b41b93ac38484081b49837b

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

LOG: [OpenMP][FIX] Collect blocks to be outlined after finalization

Finalization can introduce new blocks we need to outline as well so it
makes sense to identify the blocks that need to be outlined after
finalization happened. There was also a minor unit test adjustment to
account for the fact that we have a single outlined exit block now.

Added: 


Modified: 
clang/test/OpenMP/cancel_codegen.cpp
llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp

Removed: 




diff  --git a/clang/test/OpenMP/cancel_codegen.cpp 
b/clang/test/OpenMP/cancel_codegen.cpp
index b2ef1d519c8b..8402f0fef0df 100644
--- a/clang/test/OpenMP/cancel_codegen.cpp
+++ b/clang/test/OpenMP/cancel_codegen.cpp
@@ -194,8 +194,10 @@ for (int i = 0; i < argc; ++i) {
 // IRBUILDER: [[EXIT]]
 // IRBUILDER: br label %[[EXIT2:.+]]
 // IRBUILDER: [[EXIT2]]
-// IRBUILDER: br label %[[RETURN]]
+// IRBUILDER: br label %[[EXIT3:.+]]
 // IRBUILDER: [[CONTINUE]]
 // IRBUILDER: br label %[[ELSE:.+]]
+// IRBUILDER: [[EXIT3]]
+// IRBUILDER: br label %[[RETURN]]
 
 #endif

diff  --git a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp 
b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
index 3ed3e47dd521..d3f63d4ee8e7 100644
--- a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
+++ b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
@@ -110,6 +110,8 @@ void OpenMPIRBuilder::finalize() {
 /* Suffix */ ".omp_par");
 
 LLVM_DEBUG(dbgs() << "Before outlining: " << *OuterFn << "\n");
+assert(Extractor.isEligible() &&
+   "Expected OpenMP outlining to be possible!");
 
 Function *OutlinedFn = Extractor.extractCodeRegion(CEAC);
 
@@ -475,90 +477,6 @@ IRBuilder<>::InsertPoint OpenMPIRBuilder::CreateParallel(
 
   LLVM_DEBUG(dbgs() << "After  body codegen: " << *OuterFn << "\n");
 
-  OutlineInfo OI;
-  SmallPtrSet ParallelRegionBlockSet;
-  SmallVector Worklist;
-  ParallelRegionBlockSet.insert(PRegEntryBB);
-  ParallelRegionBlockSet.insert(PRegExitBB);
-
-  // Collect all blocks in-between PRegEntryBB and PRegExitBB.
-  Worklist.push_back(PRegEntryBB);
-  while (!Worklist.empty()) {
-BasicBlock *BB = Worklist.pop_back_val();
-OI.Blocks.push_back(BB);
-for (BasicBlock *SuccBB : successors(BB))
-  if (ParallelRegionBlockSet.insert(SuccBB).second)
-Worklist.push_back(SuccBB);
-  }
-
-  // Ensure a single exit node for the outlined region by creating one.
-  // We might have multiple incoming edges to the exit now due to 
finalizations,
-  // e.g., cancel calls that cause the control flow to leave the region.
-  BasicBlock *PRegOutlinedExitBB = PRegExitBB;
-  PRegExitBB = SplitBlock(PRegExitBB, &*PRegExitBB->getFirstInsertionPt());
-  OI.Blocks.push_back(PRegOutlinedExitBB);
-
-  CodeExtractorAnalysisCache CEAC(*OuterFn);
-  CodeExtractor Extractor(OI.Blocks, /* DominatorTree */ nullptr,
-  /* AggregateArgs */ false,
-  /* BlockFrequencyInfo */ nullptr,
-  /* BranchProbabilityInfo */ nullptr,
-  /* AssumptionCache */ nullptr,
-  /* AllowVarArgs */ true,
-  /* AllowAlloca */ true,
-  /* Suffix */ ".omp_par");
-
-  // Find inputs to, outputs from the code region.
-  BasicBlock *CommonExit = nullptr;
-  SetVector Inputs, Outputs, SinkingCands, HoistingCands;
-  Extractor.findAllocas(CEAC, SinkingCands, HoistingCands, CommonExit);
-  Extractor.findInputsOutputs(Inputs, Outputs, SinkingCands);
-
-  LLVM_DEBUG(dbgs() << "Before privatization: " << *OuterFn << "\n");
-
-  FunctionCallee TIDRTLFn =
-  getOrCreateRuntimeFunction(OMPRTL___kmpc_global_thread_num);
-
-  auto PrivHelper = [&](Value ) {
-if ( == TIDAddr ||  == ZeroAddr)
-  return;
-
-SmallVector Uses;
-for (Use  : V.uses())
-  if (auto *UserI = dyn_cast(U.getUser()))
-if (ParallelRegionBlockSet.count(UserI->getParent()))
-  Uses.push_back();
-
-Value *ReplacementValue = nullptr;
-CallInst *CI = dyn_cast();
-if (CI && CI->getCalledFunction() == TIDRTLFn.getCallee()) {
-  ReplacementValue = PrivTID;
-} else {
-  Builder.restoreIP(
-  PrivCB(AllocaIP, Builder.saveIP(), V, ReplacementValue));
-  assert(ReplacementValue &&
- "Expected copy/create callback to set replacement value!");
-  if (ReplacementValue == )
-return;
-}
-
-for (Use *UPtr : Uses)
-  UPtr->set(ReplacementValue);
-  };
-
-  for (Value *Input : Inputs) {
-LLVM_DEBUG(dbgs() << "Captured input: 

[PATCH] D74372: [OpenMP][IRBuilder] Perform finalization (incl. outlining) late

2020-02-12 Thread Puyan Lotfi via Phabricator via cfe-commits
plotfi added a comment.

Could this be reverted for the time being so that bots can go green? There 
appear to be an awful lot of commits piling up on top of this one.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74372



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


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

2020-02-12 Thread Atmn Patel via Phabricator via cfe-commits
atmnpatel updated this revision to Diff 244334.
atmnpatel added a comment.

Removes specified values in favor of defaults in the DefaultKind enum.


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
@@ -342,6 +342,26 @@
 
 ///}
 
+/// 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
@@ -12034,9 +12034,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),
@@ -12139,31 +12138,24 @@
   return std::string(Out.str());
 }
 
-OMPClause *Sema::ActOnOpenMPDefaultClause(OpenMPDefaultClauseKind Kind,
+OMPClause *Sema::ActOnOpenMPDefaultClause(DefaultKind Kind,
   

[PATCH] D74372: [OpenMP][IRBuilder] Perform finalization (incl. outlining) late

2020-02-12 Thread Vlad Vereschaka via Phabricator via cfe-commits
vvereschaka added a comment.

it also gets failed on the Linux builders

http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-ubuntu/builds/2843
http://lab.llvm.org:8011/builders/lld-x86_64-ubuntu-fast/builds/11581


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74372



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


[PATCH] D74372: [OpenMP][IRBuilder] Perform finalization (incl. outlining) late

2020-02-12 Thread Vlad Vereschaka via Phabricator via cfe-commits
vvereschaka added a comment.

Hello @jdoerfert,

`OpenMPIRBuilderTest.ParallelCancelBarrier` is failed on Windows builders:

http://lab.llvm.org:8011/builders/llvm-clang-x86_64-win-fast/builds/11242/steps/test-check-llvm-unit/logs/stdio
http://lab.llvm.org:8011/builders/llvm-clang-win-x-armv7l/builds/4537
http://lab.llvm.org:8011/builders/llvm-clang-win-x-aarch64/builds/4534

  
C:\buildbot\as-builder-3\llvm-clang-x86_64-win-fast\llvm-project\llvm\unittests\Frontend\OpenMPIRBuilderTest.cpp(612):
 error:   Expected: CI->getNextNode()->getSuccessor(0)
  
Which is: 00DC6479BEC0
  
  To be equal to: ExitBB
  
Which is: 00DC6479B140
  
  [  FAILED  ] OpenMPIRBuilderTest.ParallelCancelBarrier (4 ms)

Would you you fix the test or revert this commit?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74372



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


[clang] 70cac41 - Reapply "[OpenMP][IRBuilder] Perform finalization (incl. outlining) late"

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

Author: Johannes Doerfert
Date: 2020-02-12T22:29:07-06:00
New Revision: 70cac41a2b7e4a7a28c36a544c9813c833d494bb

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

LOG: Reapply "[OpenMP][IRBuilder] Perform finalization (incl. outlining) late"

Reapply 8a56d64d7620b3764f10f03f3a1e307fcdd72c2f with minor fixes.

The problem was that cancellation can cause new edges to the parallel
region exit block which is not outlined. The CodeExtractor will encode
the information which "exit" was taken as a return value. The fix is to
ensure we do not return any value from the outlined function, to prevent
control to value conversion we ensure a single exit block for the
outlined region.

This reverts commit 3aac953afa34885a72df96f2b703b65f85cbb149.

Added: 


Modified: 
clang/lib/CodeGen/CodeGenFunction.cpp
llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
llvm/lib/Transforms/Utils/CodeExtractor.cpp
llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp

Removed: 




diff  --git a/clang/lib/CodeGen/CodeGenFunction.cpp 
b/clang/lib/CodeGen/CodeGenFunction.cpp
index b7506b53030d..4798de044a64 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
@@ -32,6 +32,7 @@
 #include "clang/Basic/TargetInfo.h"
 #include "clang/CodeGen/CGFunctionInfo.h"
 #include "clang/Frontend/FrontendDiagnostic.h"
+#include "llvm/Frontend/OpenMP/OMPIRBuilder.h"
 #include "llvm/IR/DataLayout.h"
 #include "llvm/IR/Dominators.h"
 #include "llvm/IR/FPEnv.h"
@@ -104,6 +105,14 @@ CodeGenFunction::~CodeGenFunction() {
 
   if (getLangOpts().OpenMP && CurFn)
 CGM.getOpenMPRuntime().functionFinished(*this);
+
+  // If we have an OpenMPIRBuilder we want to finalize functions (incl.
+  // outlining etc) at some point. Doing it once the function codegen is done
+  // seems to be a reasonable spot. We do it here, as opposed to the deletion
+  // time of the CodeGenModule, because we have to ensure the IR has not yet
+  // been "emitted" to the outside, thus, modifications are still sensible.
+  if (llvm::OpenMPIRBuilder *OMPBuilder = CGM.getOpenMPIRBuilder())
+OMPBuilder->finalize();
 }
 
 // Map the LangOption for rounding mode into

diff  --git a/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h 
b/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
index 07ec82df14c1..a1470bc04958 100644
--- a/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
+++ b/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
@@ -34,6 +34,9 @@ class OpenMPIRBuilder {
   /// before any other method and only once!
   void initialize();
 
+  /// Finalize the underlying module, e.g., by outlining regions.
+  void finalize();
+
   /// Add attributes known for \p FnID to \p Fn.
   void addAttributes(omp::RuntimeFunction FnID, Function );
 
@@ -254,6 +257,20 @@ class OpenMPIRBuilder {
 
   /// Map to remember existing ident_t*.
   DenseMap, GlobalVariable *> IdentMap;
+
+  /// Helper that contains information about regions we need to outline
+  /// during finalization.
+  struct OutlineInfo {
+SmallVector Blocks;
+using PostOutlineCBTy = std::function;
+PostOutlineCBTy PostOutlineCB;
+  };
+
+  /// Collection of regions that need to be outlined during finalization.
+  SmallVector OutlineInfos;
+
+  /// Add a new region that will be outlined later.
+  void addOutlineInfo(OutlineInfo &) { OutlineInfos.emplace_back(OI); }
 };
 
 } // end namespace llvm

diff  --git a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp 
b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
index d45d1d02447a..3ed3e47dd521 100644
--- a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
+++ b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
@@ -93,6 +93,57 @@ Function 
*OpenMPIRBuilder::getOrCreateRuntimeFunction(RuntimeFunction FnID) {
 
 void OpenMPIRBuilder::initialize() { initializeTypes(M); }
 
+void OpenMPIRBuilder::finalize() {
+  for (OutlineInfo  : OutlineInfos) {
+assert(!OI.Blocks.empty() &&
+   "Outlined regions should have at least a single block!");
+BasicBlock *RegEntryBB = OI.Blocks.front();
+Function *OuterFn = RegEntryBB->getParent();
+CodeExtractorAnalysisCache CEAC(*OuterFn);
+CodeExtractor Extractor(OI.Blocks, /* DominatorTree */ nullptr,
+/* AggregateArgs */ false,
+/* BlockFrequencyInfo */ nullptr,
+/* BranchProbabilityInfo */ nullptr,
+/* AssumptionCache */ nullptr,
+/* AllowVarArgs */ true,
+/* AllowAlloca */ true,
+/* Suffix */ ".omp_par");
+
+LLVM_DEBUG(dbgs() << "Before outlining: " << *OuterFn << "\n");
+
+Function *OutlinedFn = 

[PATCH] D67414: [AST] Treat "inline gnu_inline" the same way as "extern inline gnu_inline" in C++ mode

2020-02-12 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added a comment.

I agree, it doesn't make sense to warn on static functions; the behavior didn't 
change, and there's only one reasonable result.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D67414



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


[PATCH] D67414: [AST] Treat "inline gnu_inline" the same way as "extern inline gnu_inline" in C++ mode

2020-02-12 Thread Shoaib Meenai via Phabricator via cfe-commits
smeenai added a comment.

In D67414#1873445 , @efriedma wrote:

> > https://gcc.godbolt.org/z/cY9-HQ
>
> gcc's behavior for your testcase makes no sense.  We have to emit the 
> definition of a static function: it can't be defined in any other translation 
> unit because it's impossible to name in any other translation unit.  Note the 
> "_ZL" prefix.  (Given the way ELF works, I guess you could get around that 
> limitation if the function is `extern "C"`, but still...)


You're right. Perhaps we should just not warn for the combination of `static` 
and `gnu_inline` then? On my end I'm just planning to drop the `gnu_inline` in 
the internal code though, since I can't fathom a reason for wanting the 
combination of the two.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D67414



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


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

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

One question (below) otherwise this looks good.




Comment at: llvm/include/llvm/Frontend/OpenMP/OMPKinds.def:358
+__OMP_DEFAULT_KIND(shared, 3)
+__OMP_DEFAULT_KIND(unknown, 4)
+

Why 2, 3, 4? Do we really need to specify the value here? If not, remove the 
`Value` part everywhere, or replace it with `unsigned(Enum)`, and we should be 
fine.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74513



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


[PATCH] D67414: [AST] Treat "inline gnu_inline" the same way as "extern inline gnu_inline" in C++ mode

2020-02-12 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added a comment.

> https://gcc.godbolt.org/z/cY9-HQ

gcc's behavior for your testcase makes no sense.  We have to emit the 
definition of a static function: it can't be defined in any other translation 
unit because it's impossible to name in any other translation unit.  Note the 
"_ZL" prefix.  (Given the way ELF works, I guess you could get around that 
limitation if the function is `extern "C"`, but still...)


Repository:
  rL LLVM

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

https://reviews.llvm.org/D67414



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


Re: [clang] 0e3a487 - PR12350: Handle remaining cases permitted by CWG DR 244.

2020-02-12 Thread Kostya Serebryany via cfe-commits
Could this have caused a new ubsan failure?

clang/lib/AST/NestedNameSpecifier.cpp:485:23: runtime error: null
pointer passed as argument 2, which is declared to never be null

http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/38698/steps/check-clang%20ubsan/logs/stdio

On Fri, Feb 7, 2020 at 6:41 PM Richard Smith via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

>
> Author: Richard Smith
> Date: 2020-02-07T18:40:41-08:00
> New Revision: 0e3a48778408b505946e465abf5c77a2ddd4918c
>
> URL:
> https://github.com/llvm/llvm-project/commit/0e3a48778408b505946e465abf5c77a2ddd4918c
> DIFF:
> https://github.com/llvm/llvm-project/commit/0e3a48778408b505946e465abf5c77a2ddd4918c.diff
>
> LOG: PR12350: Handle remaining cases permitted by CWG DR 244.
>
> Also add extension warnings for the cases that are disallowed by the
> current rules for destructor name lookup, refactor and simplify the
> lookup code, and improve the diagnostic quality when lookup fails.
>
> The special case we previously supported for converting
> p->N::S::~S() from naming a class template into naming a
> specialization thereof is subsumed by a more general rule here (which is
> also consistent with Clang's historical behavior and that of other
> compilers): if we can't find a suitable S in N, also look in N::S.
>
> The extension warnings are off by default, except for a warning when
> lookup for p->N::S::~T() looks for T in scope instead of in N (or N::S).
> That seems sufficiently heinous to warn on by default, especially since
> we can't support it for a dependent nested-name-specifier.
>
> Added:
>
>
> Modified:
> clang/include/clang/Basic/DiagnosticGroups.td
> clang/include/clang/Basic/DiagnosticSemaKinds.td
> clang/lib/AST/NestedNameSpecifier.cpp
> clang/lib/Sema/DeclSpec.cpp
> clang/lib/Sema/SemaExprCXX.cpp
> clang/test/CXX/class/class.mem/p13.cpp
> clang/test/CXX/drs/dr2xx.cpp
> clang/test/CXX/drs/dr3xx.cpp
> clang/test/FixIt/fixit.cpp
> clang/test/Parser/cxx-decl.cpp
> clang/test/SemaCXX/constructor.cpp
> clang/test/SemaCXX/destructor.cpp
> clang/test/SemaCXX/pseudo-destructors.cpp
>
> Removed:
>
>
>
>
> 
> diff  --git a/clang/include/clang/Basic/DiagnosticGroups.td
> b/clang/include/clang/Basic/DiagnosticGroups.td
> index a2bc29986a07..8c54723cdbab 100644
> --- a/clang/include/clang/Basic/DiagnosticGroups.td
> +++ b/clang/include/clang/Basic/DiagnosticGroups.td
> @@ -192,6 +192,7 @@ def CXX2aDesignator : DiagGroup<"c++2a-designator">;
>  // designators (including the warning controlled by -Wc++2a-designator).
>  def C99Designator : DiagGroup<"c99-designator", [CXX2aDesignator]>;
>  def GNUDesignator : DiagGroup<"gnu-designator">;
> +def DtorName : DiagGroup<"dtor-name">;
>
>  def DynamicExceptionSpec
>  : DiagGroup<"dynamic-exception-spec",
> [DeprecatedDynamicExceptionSpec]>;
>
> diff  --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td
> b/clang/include/clang/Basic/DiagnosticSemaKinds.td
> index 9de60d3a8d27..82861f0d5d72 100644
> --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
> +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
> @@ -1911,17 +1911,33 @@ def err_destructor_with_params : Error<"destructor
> cannot have any parameters">;
>  def err_destructor_variadic : Error<"destructor cannot be variadic">;
>  def err_destructor_typedef_name : Error<
>"destructor cannot be declared using a %select{typedef|type alias}1 %0
> of the class name">;
> +def err_undeclared_destructor_name : Error<
> +  "undeclared identifier %0 in destructor name">;
>  def err_destructor_name : Error<
>"expected the class name after '~' to name the enclosing class">;
> -def err_destructor_class_name : Error<
> -  "expected the class name after '~' to name a destructor">;
> -def err_ident_in_dtor_not_a_type : Error<
> +def err_destructor_name_nontype : Error<
> +  "identifier %0 after '~' in destructor name does not name a type">;
> +def err_destructor_expr_mismatch : Error<
> +  "identifier %0 in object destruction expression does not name the type "
> +  "%1 of the object being destroyed">;
> +def err_destructor_expr_nontype : Error<
>"identifier %0 in object destruction expression does not name a type">;
>  def err_destructor_expr_type_mismatch : Error<
>"destructor type %0 in object destruction expression does not match the
> "
>"type %1 of the object being destroyed">;
>  def note_destructor_type_here : Note<
> -  "type %0 is declared here">;
> +  "type %0 found by destructor name lookup">;
> +def note_destructor_nontype_here : Note<
> +  "non-type declaration found by destructor name lookup">;
> +def ext_dtor_named_in_wrong_scope : Extension<
> +  "ISO C++ requires the name after '::~' to be found in the same scope as
> "
> +  "the name before '::~'">, InGroup;
> +def ext_dtor_name_missing_template_arguments : Extension<
> +  "ISO C++ requires template argument 

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

2020-02-12 Thread Erik Pilkington via Phabricator via cfe-commits
erik.pilkington added inline comments.



Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:1005-1006
 def err_objc_direct_duplicate_decl : Error<
-  "%select{|direct }0method declaration conflicts "
-  "with previous %select{|direct }1declaration of method %2">;
+  "%select{|direct }0%select{method|property}1 declaration conflicts "
+  "with previous %select{|direct }2declaration of method %3">;
 def err_objc_direct_impl_decl_mismatch : Error<

This diagnostics reads a bit awkward when a property is conflicting with a 
property, since the the first half of the diagnostic is talking about the 
property declaration, but the second half is implicitly referring to the 
generated getter/setter.



Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:1023
+def err_objc_direct_dynamic_property : Error<
+  "property was previously declared to be direct">;
 

I think this might be more clear as: "direct property cannot be @dynamic"



Comment at: clang/lib/Sema/SemaExprObjC.cpp:3032
+  }
+  Builder.~DiagnosticBuilder();
   Diag(Method->getLocation(), diag::note_direct_method_declared_at)

I believe its UB to call a destructor twice. Please use a compound statement to 
control where the dtor will be called here.



Comment at: clang/lib/Sema/SemaExprObjC.cpp:3046
+  }
+  Builder.~DiagnosticBuilder();
   Diag(Method->getLocation(), diag::note_direct_method_declared_at)

ditto



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;

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.



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

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?



Comment at: clang/test/SemaObjC/method-direct.m:51
 
-__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

Can you leave this in so we have a test that has this attribute on an 
`@interface`?


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] D67414: [AST] Treat "inline gnu_inline" the same way as "extern inline gnu_inline" in C++ mode

2020-02-12 Thread Shoaib Meenai via Phabricator via cfe-commits
smeenai added a comment.

It looks like our behavior still differs from gcc in the case of a `static 
inline __attribute__((gnu_inline))` function: https://gcc.godbolt.org/z/cY9-HQ. 
We emit it and gcc doesn't. I don't think that combination makes a lot of 
sense, but I ran into it in some internal code while testing LLVM 10.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D67414



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


[clang] 3aac953 - Revert "[OpenMP][IRBuilder] Perform finalization (incl. outlining) late"

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

Author: Johannes Doerfert
Date: 2020-02-12T18:50:43-06:00
New Revision: 3aac953afa34885a72df96f2b703b65f85cbb149

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

LOG: Revert "[OpenMP][IRBuilder] Perform finalization (incl. outlining) late"

This reverts commit 8a56d64d7620b3764f10f03f3a1e307fcdd72c2f.

Will be recommitted once the clang test problem is addressed.

Added: 


Modified: 
clang/lib/CodeGen/CodeGenFunction.cpp
llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
llvm/lib/Transforms/Utils/CodeExtractor.cpp
llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp

Removed: 




diff  --git a/clang/lib/CodeGen/CodeGenFunction.cpp 
b/clang/lib/CodeGen/CodeGenFunction.cpp
index 4798de044a64..b7506b53030d 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
@@ -32,7 +32,6 @@
 #include "clang/Basic/TargetInfo.h"
 #include "clang/CodeGen/CGFunctionInfo.h"
 #include "clang/Frontend/FrontendDiagnostic.h"
-#include "llvm/Frontend/OpenMP/OMPIRBuilder.h"
 #include "llvm/IR/DataLayout.h"
 #include "llvm/IR/Dominators.h"
 #include "llvm/IR/FPEnv.h"
@@ -105,14 +104,6 @@ CodeGenFunction::~CodeGenFunction() {
 
   if (getLangOpts().OpenMP && CurFn)
 CGM.getOpenMPRuntime().functionFinished(*this);
-
-  // If we have an OpenMPIRBuilder we want to finalize functions (incl.
-  // outlining etc) at some point. Doing it once the function codegen is done
-  // seems to be a reasonable spot. We do it here, as opposed to the deletion
-  // time of the CodeGenModule, because we have to ensure the IR has not yet
-  // been "emitted" to the outside, thus, modifications are still sensible.
-  if (llvm::OpenMPIRBuilder *OMPBuilder = CGM.getOpenMPIRBuilder())
-OMPBuilder->finalize();
 }
 
 // Map the LangOption for rounding mode into

diff  --git a/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h 
b/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
index a1470bc04958..07ec82df14c1 100644
--- a/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
+++ b/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
@@ -34,9 +34,6 @@ class OpenMPIRBuilder {
   /// before any other method and only once!
   void initialize();
 
-  /// Finalize the underlying module, e.g., by outlining regions.
-  void finalize();
-
   /// Add attributes known for \p FnID to \p Fn.
   void addAttributes(omp::RuntimeFunction FnID, Function );
 
@@ -257,20 +254,6 @@ class OpenMPIRBuilder {
 
   /// Map to remember existing ident_t*.
   DenseMap, GlobalVariable *> IdentMap;
-
-  /// Helper that contains information about regions we need to outline
-  /// during finalization.
-  struct OutlineInfo {
-SmallVector Blocks;
-using PostOutlineCBTy = std::function;
-PostOutlineCBTy PostOutlineCB;
-  };
-
-  /// Collection of regions that need to be outlined during finalization.
-  SmallVector OutlineInfos;
-
-  /// Add a new region that will be outlined later.
-  void addOutlineInfo(OutlineInfo &) { OutlineInfos.emplace_back(OI); }
 };
 
 } // end namespace llvm

diff  --git a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp 
b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
index 241845958905..d45d1d02447a 100644
--- a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
+++ b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
@@ -93,55 +93,6 @@ Function 
*OpenMPIRBuilder::getOrCreateRuntimeFunction(RuntimeFunction FnID) {
 
 void OpenMPIRBuilder::initialize() { initializeTypes(M); }
 
-void OpenMPIRBuilder::finalize() {
-  for (OutlineInfo  : OutlineInfos) {
-assert(!OI.Blocks.empty() &&
-   "Outlined regions should have at least a single block!");
-BasicBlock *RegEntryBB = OI.Blocks.front();
-Function *OuterFn = RegEntryBB->getParent();
-CodeExtractorAnalysisCache CEAC(*OuterFn);
-CodeExtractor Extractor(OI.Blocks, /* DominatorTree */ nullptr,
-/* AggregateArgs */ false,
-/* BlockFrequencyInfo */ nullptr,
-/* BranchProbabilityInfo */ nullptr,
-/* AssumptionCache */ nullptr,
-/* AllowVarArgs */ true,
-/* AllowAlloca */ true,
-/* Suffix */ ".omp_par");
-
-LLVM_DEBUG(dbgs() << "Before outlining: " << *OuterFn << "\n");
-
-Function *OutlinedFn = Extractor.extractCodeRegion(CEAC);
-
-LLVM_DEBUG(dbgs() << "After  outlining: " << *OuterFn << "\n");
-LLVM_DEBUG(dbgs() << "   Outlined function: " << *OutlinedFn << "\n");
-
-// For compability with the clang CG we move the outlined function after 
the
-// one with the parallel region.
-OutlinedFn->removeFromParent();
-M.getFunctionList().insertAfter(OuterFn->getIterator(), 

[PATCH] D74372: [OpenMP][IRBuilder] Perform finalization (incl. outlining) late

2020-02-12 Thread Johannes Doerfert via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG8a56d64d7620: [OpenMP][IRBuilder] Perform finalization 
(incl. outlining) late (authored by jdoerfert).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74372

Files:
  clang/lib/CodeGen/CodeGenFunction.cpp
  llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
  llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
  llvm/lib/Transforms/Utils/CodeExtractor.cpp
  llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp

Index: llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
===
--- llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
+++ llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
@@ -96,7 +96,7 @@
   EXPECT_EQ(cast(Barrier)->getArgOperand(1), GTID);
 
   Builder.CreateUnreachable();
-  EXPECT_FALSE(verifyModule(*M));
+  EXPECT_FALSE(verifyModule(*M, ()));
 }
 
 TEST_F(OpenMPIRBuilderTest, CreateCancel) {
@@ -151,7 +151,7 @@
   OMPBuilder.popFinalizationCB();
 
   Builder.CreateUnreachable();
-  EXPECT_FALSE(verifyModule(*M));
+  EXPECT_FALSE(verifyModule(*M, ()));
 }
 
 TEST_F(OpenMPIRBuilderTest, CreateCancelIfCond) {
@@ -212,7 +212,7 @@
   OMPBuilder.popFinalizationCB();
 
   Builder.CreateUnreachable();
-  EXPECT_FALSE(verifyModule(*M));
+  EXPECT_FALSE(verifyModule(*M, ()));
 }
 
 TEST_F(OpenMPIRBuilderTest, CreateCancelBarrier) {
@@ -267,7 +267,7 @@
   OMPBuilder.popFinalizationCB();
 
   Builder.CreateUnreachable();
-  EXPECT_FALSE(verifyModule(*M));
+  EXPECT_FALSE(verifyModule(*M, ()));
 }
 
 TEST_F(OpenMPIRBuilderTest, DbgLoc) {
@@ -362,9 +362,9 @@
 
   auto FiniCB = [&](InsertPointTy CodeGenIP) { ++NumFinalizationPoints; };
 
-  IRBuilder<>::InsertPoint AfterIP = OMPBuilder.CreateParallel(
-  Loc, BodyGenCB, PrivCB, FiniCB, nullptr, nullptr, OMP_PROC_BIND_default, false);
-
+  IRBuilder<>::InsertPoint AfterIP =
+  OMPBuilder.CreateParallel(Loc, BodyGenCB, PrivCB, FiniCB, nullptr,
+nullptr, OMP_PROC_BIND_default, false);
   EXPECT_EQ(NumBodiesGenerated, 1U);
   EXPECT_EQ(NumPrivatizedVars, 1U);
   EXPECT_EQ(NumFinalizationPoints, 1U);
@@ -372,10 +372,12 @@
   Builder.restoreIP(AfterIP);
   Builder.CreateRetVoid();
 
+  OMPBuilder.finalize();
+
   EXPECT_NE(PrivAI, nullptr);
   Function *OutlinedFn = PrivAI->getFunction();
   EXPECT_NE(F, OutlinedFn);
-  EXPECT_FALSE(verifyModule(*M));
+  EXPECT_FALSE(verifyModule(*M, ()));
   EXPECT_TRUE(OutlinedFn->hasFnAttribute(Attribute::NoUnwind));
   EXPECT_TRUE(OutlinedFn->hasFnAttribute(Attribute::NoRecurse));
   EXPECT_TRUE(OutlinedFn->hasParamAttribute(0, Attribute::NoAlias));
@@ -470,6 +472,7 @@
 
   Builder.restoreIP(AfterIP);
   Builder.CreateRetVoid();
+  OMPBuilder.finalize();
 
   EXPECT_NE(PrivAI, nullptr);
   Function *OutlinedFn = PrivAI->getFunction();
@@ -595,6 +598,7 @@
 
   Builder.restoreIP(AfterIP);
   Builder.CreateRetVoid();
+  OMPBuilder.finalize();
 
   EXPECT_FALSE(verifyModule(*M, ()));
 
Index: llvm/lib/Transforms/Utils/CodeExtractor.cpp
===
--- llvm/lib/Transforms/Utils/CodeExtractor.cpp
+++ llvm/lib/Transforms/Utils/CodeExtractor.cpp
@@ -1405,11 +1405,7 @@
   DISubprogram *OldSP = OldFunc.getSubprogram();
   LLVMContext  = OldFunc.getContext();
 
-  // See llvm.org/PR44560, OpenMP passes an invalid subprogram to CodeExtractor.
-  bool NeedWorkaroundForOpenMPIRBuilderBug =
-  OldSP && OldSP->getRetainedNodes()->isTemporary();
-
-  if (!OldSP || NeedWorkaroundForOpenMPIRBuilderBug) {
+  if (!OldSP) {
 // Erase any debug info the new function contains.
 stripDebugInfo(NewFunc);
 // Make sure the old function doesn't contain any non-local metadata refs.
Index: llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
===
--- llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
+++ llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
@@ -93,6 +93,55 @@
 
 void OpenMPIRBuilder::initialize() { initializeTypes(M); }
 
+void OpenMPIRBuilder::finalize() {
+  for (OutlineInfo  : OutlineInfos) {
+assert(!OI.Blocks.empty() &&
+   "Outlined regions should have at least a single block!");
+BasicBlock *RegEntryBB = OI.Blocks.front();
+Function *OuterFn = RegEntryBB->getParent();
+CodeExtractorAnalysisCache CEAC(*OuterFn);
+CodeExtractor Extractor(OI.Blocks, /* DominatorTree */ nullptr,
+/* AggregateArgs */ false,
+/* BlockFrequencyInfo */ nullptr,
+/* BranchProbabilityInfo */ nullptr,
+/* AssumptionCache */ nullptr,
+/* AllowVarArgs */ true,
+/* AllowAlloca */ true,
+/* Suffix */ ".omp_par");
+
+LLVM_DEBUG(dbgs() << "Before outlining: " << *OuterFn << "\n");
+
+   

[clang] 8a56d64 - [OpenMP][IRBuilder] Perform finalization (incl. outlining) late

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

Author: Johannes Doerfert
Date: 2020-02-12T17:55:01-06:00
New Revision: 8a56d64d7620b3764f10f03f3a1e307fcdd72c2f

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

LOG: [OpenMP][IRBuilder] Perform finalization (incl. outlining) late

In order to fix PR44560 and to prepare for loop transformations we now
finalize a function late, which will also do the outlining late. The
logic is as before but the actual outlining step happens now after the
function was fully constructed. Once we have loop transformations we
can apply them in the finalize step before the outlining.

Reviewed By: JonChesterfield

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

Added: 


Modified: 
clang/lib/CodeGen/CodeGenFunction.cpp
llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
llvm/lib/Transforms/Utils/CodeExtractor.cpp
llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp

Removed: 




diff  --git a/clang/lib/CodeGen/CodeGenFunction.cpp 
b/clang/lib/CodeGen/CodeGenFunction.cpp
index b7506b53030d..4798de044a64 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
@@ -32,6 +32,7 @@
 #include "clang/Basic/TargetInfo.h"
 #include "clang/CodeGen/CGFunctionInfo.h"
 #include "clang/Frontend/FrontendDiagnostic.h"
+#include "llvm/Frontend/OpenMP/OMPIRBuilder.h"
 #include "llvm/IR/DataLayout.h"
 #include "llvm/IR/Dominators.h"
 #include "llvm/IR/FPEnv.h"
@@ -104,6 +105,14 @@ CodeGenFunction::~CodeGenFunction() {
 
   if (getLangOpts().OpenMP && CurFn)
 CGM.getOpenMPRuntime().functionFinished(*this);
+
+  // If we have an OpenMPIRBuilder we want to finalize functions (incl.
+  // outlining etc) at some point. Doing it once the function codegen is done
+  // seems to be a reasonable spot. We do it here, as opposed to the deletion
+  // time of the CodeGenModule, because we have to ensure the IR has not yet
+  // been "emitted" to the outside, thus, modifications are still sensible.
+  if (llvm::OpenMPIRBuilder *OMPBuilder = CGM.getOpenMPIRBuilder())
+OMPBuilder->finalize();
 }
 
 // Map the LangOption for rounding mode into

diff  --git a/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h 
b/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
index 07ec82df14c1..a1470bc04958 100644
--- a/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
+++ b/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
@@ -34,6 +34,9 @@ class OpenMPIRBuilder {
   /// before any other method and only once!
   void initialize();
 
+  /// Finalize the underlying module, e.g., by outlining regions.
+  void finalize();
+
   /// Add attributes known for \p FnID to \p Fn.
   void addAttributes(omp::RuntimeFunction FnID, Function );
 
@@ -254,6 +257,20 @@ class OpenMPIRBuilder {
 
   /// Map to remember existing ident_t*.
   DenseMap, GlobalVariable *> IdentMap;
+
+  /// Helper that contains information about regions we need to outline
+  /// during finalization.
+  struct OutlineInfo {
+SmallVector Blocks;
+using PostOutlineCBTy = std::function;
+PostOutlineCBTy PostOutlineCB;
+  };
+
+  /// Collection of regions that need to be outlined during finalization.
+  SmallVector OutlineInfos;
+
+  /// Add a new region that will be outlined later.
+  void addOutlineInfo(OutlineInfo &) { OutlineInfos.emplace_back(OI); }
 };
 
 } // end namespace llvm

diff  --git a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp 
b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
index d45d1d02447a..241845958905 100644
--- a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
+++ b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
@@ -93,6 +93,55 @@ Function 
*OpenMPIRBuilder::getOrCreateRuntimeFunction(RuntimeFunction FnID) {
 
 void OpenMPIRBuilder::initialize() { initializeTypes(M); }
 
+void OpenMPIRBuilder::finalize() {
+  for (OutlineInfo  : OutlineInfos) {
+assert(!OI.Blocks.empty() &&
+   "Outlined regions should have at least a single block!");
+BasicBlock *RegEntryBB = OI.Blocks.front();
+Function *OuterFn = RegEntryBB->getParent();
+CodeExtractorAnalysisCache CEAC(*OuterFn);
+CodeExtractor Extractor(OI.Blocks, /* DominatorTree */ nullptr,
+/* AggregateArgs */ false,
+/* BlockFrequencyInfo */ nullptr,
+/* BranchProbabilityInfo */ nullptr,
+/* AssumptionCache */ nullptr,
+/* AllowVarArgs */ true,
+/* AllowAlloca */ true,
+/* Suffix */ ".omp_par");
+
+LLVM_DEBUG(dbgs() << "Before outlining: " << *OuterFn << "\n");
+
+Function *OutlinedFn = Extractor.extractCodeRegion(CEAC);
+
+LLVM_DEBUG(dbgs() << "After  outlining: " << *OuterFn << "\n");
+

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

2020-02-12 Thread Atmn Patel via Phabricator via cfe-commits
atmnpatel created this revision.
atmnpatel added reviewers: jdoerfert, JonChesterfield.
Herald added subscribers: llvm-commits, cfe-commits, guansong.
Herald added projects: clang, LLVM.

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

This should not change any functionality.


Repository:
  rG LLVM Github Monorepo

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
@@ -342,6 +342,26 @@
 
 ///}
 
+/// Default kinds
+///
+///{
+
+#ifndef OMP_DEFAULT_KIND
+#define OMP_DEFAULT_KIND(Enum, Str, Value)
+#endif
+
+#define __OMP_DEFAULT_KIND(Name, Value)\
+  OMP_DEFAULT_KIND(OMP_DEFAULT_##Name, #Name, Value)
+
+__OMP_DEFAULT_KIND(none, 2)
+__OMP_DEFAULT_KIND(shared, 3)
+__OMP_DEFAULT_KIND(unknown, 4)
+
+#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, Value) Enum = Value,
+#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
@@ -12034,9 +12034,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),
@@ -12139,31 +12138,24 @@
   return std::string(Out.str());
 }
 

[PATCH] D74347: [CMake] Explicitly specify paths to libc++abi in CrossWinToARMLinux.cmake

2020-02-12 Thread Vlad Vereschaka via Phabricator via cfe-commits
vvereschaka accepted this revision.
vvereschaka 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/D74347/new/

https://reviews.llvm.org/D74347



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


[clang] 77b2ffc - Fix a reentrance bug with deserializing ObjC type parameters.

2020-02-12 Thread John McCall via cfe-commits

Author: John McCall
Date: 2020-02-12T18:44:19-05:00
New Revision: 77b2ffc498e92cce7546d191f6712a3046300501

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

LOG: Fix a reentrance bug with deserializing ObjC type parameters.

This is a longstanding bug that seems to have been hidden by
a combination of (1) the normal flow being to deserialize the
interface before deserializing its parameter and (2) a precise
ordering of work that was apparently recently disturbed,
perhaps by my abstract-serialization work or Bruno's ObjC
module merging work.

Fixes rdar://59153545.

Added: 
clang/test/Modules/Inputs/objc_type_param.h
clang/test/Modules/objc-type-param.m

Modified: 
clang/lib/Serialization/ASTReaderDecl.cpp
clang/test/Modules/Inputs/module.map

Removed: 




diff  --git a/clang/lib/Serialization/ASTReaderDecl.cpp 
b/clang/lib/Serialization/ASTReaderDecl.cpp
index 3d47274079fa..20a4f78f16e9 100644
--- a/clang/lib/Serialization/ASTReaderDecl.cpp
+++ b/clang/lib/Serialization/ASTReaderDecl.cpp
@@ -555,7 +555,7 @@ void ASTDeclReader::Visit(Decl *D) {
 
 void ASTDeclReader::VisitDecl(Decl *D) {
   if (D->isTemplateParameter() || D->isTemplateParameterPack() ||
-  isa(D)) {
+  isa(D) || isa(D)) {
 // We don't want to deserialize the DeclContext of a template
 // parameter or of a parameter of a function template immediately.   These
 // entities might be used in the formulation of its DeclContext (for

diff  --git a/clang/test/Modules/Inputs/module.map 
b/clang/test/Modules/Inputs/module.map
index 3f128c0bb0e0..ed220e667f05 100644
--- a/clang/test/Modules/Inputs/module.map
+++ b/clang/test/Modules/Inputs/module.map
@@ -193,6 +193,10 @@ module weird_objc {
   header "weird_objc.h"
 }
 
+module objc_type_param {
+  header "objc_type_param.h"
+}
+
 module ignored_macros {
   header "ignored_macros.h"
 }

diff  --git a/clang/test/Modules/Inputs/objc_type_param.h 
b/clang/test/Modules/Inputs/objc_type_param.h
new file mode 100644
index ..7728b68e28e9
--- /dev/null
+++ b/clang/test/Modules/Inputs/objc_type_param.h
@@ -0,0 +1,13 @@
+__attribute__((objc_root_class))
+@interface Root {
+  Class isa;
+}
+@end
+
+@interface A : Root
+@end
+
+@interface B : A
+typedef void (*BCallback)(T, U);
++ (id) newWithCallback: (BCallback) callback;
+@end

diff  --git a/clang/test/Modules/objc-type-param.m 
b/clang/test/Modules/objc-type-param.m
new file mode 100644
index ..3417d62b25ff
--- /dev/null
+++ b/clang/test/Modules/objc-type-param.m
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x 
objective-c -fmodule-name=objc_type_param -emit-module %S/Inputs/module.map
+// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I 
%S/Inputs %s -verify
+
+@import objc_type_param;
+
+id make(BCallback callback, id arg) {
+  return callback(arg); // expected-error {{too few arguments to function 
call}}
+}



___
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-12 Thread Erik Pilkington via Phabricator via cfe-commits
erik.pilkington added a comment.

This looks good, but please add a testcase.


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] D74372: [OpenMP][IRBuilder] Perform finalization (incl. outlining) late

2020-02-12 Thread Jon Chesterfield via Phabricator via cfe-commits
JonChesterfield accepted this revision.
JonChesterfield added a comment.
This revision is now accepted and ready to land.

Thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74372



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


[PATCH] D73245: Depend stddef.h to provide max_align_t for C++11 and provide better fallback in

2020-02-12 Thread Joerg Sonnenberger via Phabricator via cfe-commits
joerg added a comment.

Ping?


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

https://reviews.llvm.org/D73245



___
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-12 Thread Nicolás Alvarez via Phabricator via cfe-commits
nicolas17 added inline comments.



Comment at: clang/lib/StaticAnalyzer/Checkers/ContainerModeling.cpp:484
+const NoteTag *ChangeTag =
+  getChangeTag(C, "shrinked from the right by 1 position", ContReg, ContE);
 // For vector-like and deque-like containers invalidate the last and the

Past tense is "shrank", not "shrinked".


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

https://reviews.llvm.org/D73720



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


[PATCH] D69825: [Clang][Driver] Re-use the calling process instead of creating a new process for the cc1 invocation

2020-02-12 Thread Alexandre Ganea via Phabricator via cfe-commits
aganea added a comment.

Hello @plotfi and @hctim -- rG20f1abe306d0 
 should 
solve the initial issues you were seeing, please let me know if it doesn't.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69825



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


[PATCH] D74490: [Clang] Limit -fintegrated-cc1 to only one TU

2020-02-12 Thread Alexandre Ganea via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG20f1abe306d0: [Clang] Limit -fintegrated-cc1 to only one TU 
(authored by aganea).

Changed prior to commit:
  https://reviews.llvm.org/D74490?vs=244197=244276#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74490

Files:
  clang/include/clang/Driver/Job.h
  clang/lib/Driver/Driver.cpp
  clang/lib/Driver/Job.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/Driver/cc1-spawnprocess.c

Index: clang/test/Driver/cc1-spawnprocess.c
===
--- clang/test/Driver/cc1-spawnprocess.c
+++ clang/test/Driver/cc1-spawnprocess.c
@@ -1,22 +1,37 @@
-// RUN: %clang -fintegrated-cc1 -### %s 2>&1 | FileCheck %s --check-prefix=YES
-// RUN: %clang -fno-integrated-cc1 -### %s 2>&1 | FileCheck %s --check-prefix=NO
+// RUN: %clang -fintegrated-cc1 -c -### %s 2>&1 | FileCheck %s --check-prefix=YES
+// RUN: %clang -fno-integrated-cc1 -c -### %s 2>&1 | FileCheck %s --check-prefix=NO
 
-// RUN: %clang -fintegrated-cc1 -fno-integrated-cc1 -### %s 2>&1 \
+// RUN: %clang -fintegrated-cc1 -fno-integrated-cc1 -c -### %s 2>&1 \
 // RUN: | FileCheck %s --check-prefix=NO
-// RUN: %clang -fno-integrated-cc1 -fintegrated-cc1 -### %s 2>&1 \
+// RUN: %clang -fno-integrated-cc1 -fintegrated-cc1 -c -### %s 2>&1 \
 // RUN: | FileCheck %s --check-prefix=YES
 
-// RUN: %clang_cl -fintegrated-cc1 -### -- %s 2>&1 \
+// RUN: %clang_cl -fintegrated-cc1 -c -### -- %s 2>&1 \
 // RUN: | FileCheck %s --check-prefix=YES
-// RUN: %clang_cl -fno-integrated-cc1 -### -- %s 2>&1 \
+// RUN: %clang_cl -fno-integrated-cc1 -c -### -- %s 2>&1 \
 // RUN: | FileCheck %s --check-prefix=NO
 
 // RUN: env CCC_OVERRIDE_OPTIONS=+-fintegrated-cc1 \
-// RUN: %clang -fintegrated-cc1 -### %s 2>&1 \
+// RUN: %clang -fintegrated-cc1 -c -### %s 2>&1 \
 // RUN: | FileCheck %s --check-prefix=YES
 // RUN: env CCC_OVERRIDE_OPTIONS=+-fno-integrated-cc1 \
-// RUN: %clang -fintegrated-cc1 -### %s 2>&1 \
+// RUN: %clang -fintegrated-cc1 -c -### %s 2>&1 \
 // RUN: | FileCheck %s --check-prefix=NO
 
 // YES: (in-process)
 // NO-NOT: (in-process)
+
+// The following tests ensure that only one integrated-cc1 is executed.
+
+// Only one TU, one job, thus integrated-cc1 is enabled.
+// RUN: %clang -fintegrated-cc1 -c %s -### 2>&1 | FileCheck %s --check-prefix=YES
+
+// Only one TU, but we're linking, two jobs, thus integrated-cc1 is disabled.
+// RUN: %clang -fintegrated-cc1 %s -### 2>&1 | FileCheck %s --check-prefix=NO
+
+// RUN: echo 'int main() { return f() + g(); }' > %t1.cpp
+// RUN: echo 'int f() { return 1; }' > %t2.cpp
+// RUN: echo 'int g() { return 2; }' > %t3.cpp
+
+// Three jobs, thus integrated-cc1 is disabled.
+// RUN: %clang -fintegrated-cc1 -c %t1.cpp %t2.cpp %t3.cpp -### 2>&1 | FileCheck %s --check-prefix=NO
Index: clang/lib/Driver/ToolChains/Clang.cpp
===
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -6146,7 +6146,7 @@
   if (Output.getType() == types::TY_Object &&
   Args.hasFlag(options::OPT__SLASH_showFilenames,
options::OPT__SLASH_showFilenames_, false)) {
-C.getJobs().getJobs().back()->setPrintInputFilenames(true);
+C.getJobs().getJobs().back()->PrintInputFilenames = true;
   }
 
   if (Arg *A = Args.getLastArg(options::OPT_pg))
Index: clang/lib/Driver/Job.cpp
===
--- clang/lib/Driver/Job.cpp
+++ clang/lib/Driver/Job.cpp
@@ -371,14 +371,29 @@
/*memoryLimit*/ 0, ErrMsg, ExecutionFailed);
 }
 
+CC1Command::CC1Command(const Action , const Tool ,
+   const char *Executable,
+   const llvm::opt::ArgStringList ,
+   ArrayRef Inputs)
+: Command(Source, Creator, Executable, Arguments, Inputs) {
+  InProcess = true;
+}
+
 void CC1Command::Print(raw_ostream , const char *Terminator, bool Quote,
CrashReportInfo *CrashInfo) const {
-  OS << " (in-process)\n";
+  if (InProcess)
+OS << " (in-process)\n";
   Command::Print(OS, Terminator, Quote, CrashInfo);
 }
 
-int CC1Command::Execute(ArrayRef> /*Redirects*/,
+int CC1Command::Execute(ArrayRef> Redirects,
 std::string *ErrMsg, bool *ExecutionFailed) const {
+  // FIXME: Currently, if there're more than one job, we disable
+  // -fintegrate-cc1. If we're no longer a integrated-cc1 job, fallback to
+  // out-of-process execution. See discussion in https://reviews.llvm.org/D74447
+  if (!InProcess)
+return Command::Execute(Redirects, ErrMsg, ExecutionFailed);
+
   PrintFileNames();
 
   SmallVector Argv;
Index: clang/lib/Driver/Driver.cpp
===

[clang] 67f4e00 - [CMake][Fuchsia] Enable in-process cc1

2020-02-12 Thread Petr Hosek via cfe-commits

Author: Petr Hosek
Date: 2020-02-12T14:05:24-08:00
New Revision: 67f4e0011d318f446354ac3481e2382cd797e9a0

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

LOG: [CMake][Fuchsia] Enable in-process cc1

This is now supported by Goma so we can re-enable it.

Added: 


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

Removed: 




diff  --git a/clang/cmake/caches/Fuchsia-stage2.cmake 
b/clang/cmake/caches/Fuchsia-stage2.cmake
index 52d4c9ca1d43..b338f1b8a08f 100644
--- a/clang/cmake/caches/Fuchsia-stage2.cmake
+++ b/clang/cmake/caches/Fuchsia-stage2.cmake
@@ -24,7 +24,6 @@ if(NOT APPLE)
   set(CLANG_DEFAULT_OBJCOPY llvm-objcopy CACHE STRING "")
 endif()
 set(CLANG_DEFAULT_RTLIB compiler-rt CACHE STRING "")
-set(CLANG_SPAWN_CC1 ON CACHE BOOL "")
 set(CLANG_ENABLE_ARCMT OFF CACHE BOOL "")
 set(CLANG_ENABLE_STATIC_ANALYZER ON CACHE BOOL "")
 set(CLANG_PLUGIN_SUPPORT OFF CACHE BOOL "")



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


[clang] 20f1abe - [Clang] Limit -fintegrated-cc1 to only one TU

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

Author: Alexandre Ganea
Date: 2020-02-12T17:02:57-05:00
New Revision: 20f1abe306d030e99f56185a3aa077ffadf59b8a

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

LOG: [Clang] Limit -fintegrated-cc1 to only one TU

As discussed in https://reviews.llvm.org/D74447, this patch disables 
integrated-cc1 behavior if there's more than one job to be executed. This is 
meant to limit memory bloating, given that currently jobs don't clean up after 
execution (-disable-free is always active in cc1 mode).

I see this behavior as temporary until release 10.0 ships (to ease merging of 
this patch), then we'll reevaluate the situation, see if D74447 makes more 
sense on the long term.

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

Added: 


Modified: 
clang/include/clang/Driver/Job.h
clang/lib/Driver/Driver.cpp
clang/lib/Driver/Job.cpp
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/Driver/cc1-spawnprocess.c

Removed: 




diff  --git a/clang/include/clang/Driver/Job.h 
b/clang/include/clang/Driver/Job.h
index 0765b3c67d4e..9a3cad23363b 100644
--- a/clang/include/clang/Driver/Job.h
+++ b/clang/include/clang/Driver/Job.h
@@ -55,9 +55,6 @@ class Command {
   /// The list of program arguments which are inputs.
   llvm::opt::ArgStringList InputFilenames;
 
-  /// Whether to print the input filenames when executing.
-  bool PrintInputFilenames = false;
-
   /// Response file name, if this command is set to use one, or nullptr
   /// otherwise
   const char *ResponseFile = nullptr;
@@ -86,6 +83,12 @@ class Command {
   void writeResponseFile(raw_ostream ) const;
 
 public:
+  /// Whether to print the input filenames when executing.
+  bool PrintInputFilenames = false;
+
+  /// Whether the command will be executed in this process or not.
+  bool InProcess = false;
+
   Command(const Action , const Tool , const char *Executable,
   const llvm::opt::ArgStringList ,
   ArrayRef Inputs);
@@ -128,9 +131,6 @@ class Command {
   /// Print a command argument, and optionally quote it.
   static void printArg(llvm::raw_ostream , StringRef Arg, bool Quote);
 
-  /// Set whether to print the input filenames when executing.
-  void setPrintInputFilenames(bool P) { PrintInputFilenames = P; }
-
 protected:
   /// Optionally print the filenames to be compiled
   void PrintFileNames() const;
@@ -139,7 +139,9 @@ class Command {
 /// Use the CC1 tool callback when available, to avoid creating a new process
 class CC1Command : public Command {
 public:
-  using Command::Command;
+  CC1Command(const Action , const Tool , const char *Executable,
+ const llvm::opt::ArgStringList ,
+ ArrayRef Inputs);
 
   void Print(llvm::raw_ostream , const char *Terminator, bool Quote,
  CrashReportInfo *CrashInfo = nullptr) const override;

diff  --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index f35aab19e83d..642b00b57fb6 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -3753,6 +3753,11 @@ void Driver::BuildJobs(Compilation ) const {
/*TargetDeviceOffloadKind*/ Action::OFK_None);
   }
 
+  // If we have more than one job, then disable integrated-cc1 for now.
+  if (C.getJobs().size() > 1)
+for (auto  : C.getJobs())
+  J.InProcess = false;
+
   // If the user passed -Qunused-arguments or there were errors, don't warn
   // about any unused arguments.
   if (Diags.hasErrorOccurred() ||

diff  --git a/clang/lib/Driver/Job.cpp b/clang/lib/Driver/Job.cpp
index 7dab2a022d92..6d1e7e61ba1d 100644
--- a/clang/lib/Driver/Job.cpp
+++ b/clang/lib/Driver/Job.cpp
@@ -371,14 +371,29 @@ int Command::Execute(ArrayRef> 
Redirects,
/*memoryLimit*/ 0, ErrMsg, ExecutionFailed);
 }
 
+CC1Command::CC1Command(const Action , const Tool ,
+   const char *Executable,
+   const llvm::opt::ArgStringList ,
+   ArrayRef Inputs)
+: Command(Source, Creator, Executable, Arguments, Inputs) {
+  InProcess = true;
+}
+
 void CC1Command::Print(raw_ostream , const char *Terminator, bool Quote,
CrashReportInfo *CrashInfo) const {
-  OS << " (in-process)\n";
+  if (InProcess)
+OS << " (in-process)\n";
   Command::Print(OS, Terminator, Quote, CrashInfo);
 }
 
-int CC1Command::Execute(ArrayRef> /*Redirects*/,
+int CC1Command::Execute(ArrayRef> Redirects,
 std::string *ErrMsg, bool *ExecutionFailed) const {
+  // FIXME: Currently, if there're more than one job, we disable
+  // -fintegrate-cc1. If we're no longer a integrated-cc1 job, fallback to
+  // out-of-process execution. See discussion in 
https://reviews.llvm.org/D74447
+  if (!InProcess)
+return 

[clang] 60cba34 - [Clang] When -ftime-trace is used, clean CompilerInstance::OutputFiles before exiting cc_main()

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

Author: Alexandre Ganea
Date: 2020-02-12T17:02:57-05:00
New Revision: 60cba345ca395ea991d7f2596c4a93439fbf9924

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

LOG: [Clang] When -ftime-trace is used, clean CompilerInstance::OutputFiles 
before exiting cc_main()

This fixes cc1 execution when '-disable-free' is not used (currently not the 
case, that flag is always used for cc1).

Added: 


Modified: 
clang/tools/driver/cc1_main.cpp

Removed: 




diff  --git a/clang/tools/driver/cc1_main.cpp b/clang/tools/driver/cc1_main.cpp
index 6d1a67f2a4fa..d8c22f21706b 100644
--- a/clang/tools/driver/cc1_main.cpp
+++ b/clang/tools/driver/cc1_main.cpp
@@ -259,6 +259,7 @@ int cc1_main(ArrayRef Argv, const char 
*Argv0, void *MainAddr) {
   // FIXME(ibiryukov): make profilerOutput flush in destructor instead.
   profilerOutput->flush();
   llvm::timeTraceProfilerCleanup();
+  Clang->clearOutputFiles(false);
 }
   }
 



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


[PATCH] D72242: Fix crash on value dependent bitfields in if conditions in templates

2020-02-12 Thread Elizabeth Andrews via Phabricator via cfe-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rGa58017e5cae5: Fix type-dependency of bitfields in templates 
(authored by eandrews).
Herald added a project: clang.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72242

Files:
  clang/lib/AST/Expr.cpp
  clang/test/SemaTemplate/enum-argument.cpp
  clang/test/SemaTemplate/value-dependent-bitfield-cond.cpp


Index: clang/test/SemaTemplate/value-dependent-bitfield-cond.cpp
===
--- /dev/null
+++ clang/test/SemaTemplate/value-dependent-bitfield-cond.cpp
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
+
+template 
+class A {
+  int c : b;
+
+public:
+  void f() {
+if (c)
+  ;
+  }
+};
Index: clang/test/SemaTemplate/enum-argument.cpp
===
--- clang/test/SemaTemplate/enum-argument.cpp
+++ clang/test/SemaTemplate/enum-argument.cpp
@@ -1,4 +1,5 @@
 // RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
 
 enum Enum { val = 1 };
 template  struct C {
@@ -30,7 +31,7 @@
 unsigned long long bitfield : e0;
 
 void f(int j) {
-  bitfield + j; // expected-warning {{expression result unused}}
+  bitfield + j;
 }
   };
 }
Index: clang/lib/AST/Expr.cpp
===
--- clang/lib/AST/Expr.cpp
+++ clang/lib/AST/Expr.cpp
@@ -1680,6 +1680,11 @@
 CXXRecordDecl *RD = dyn_cast_or_null(DC);
 if (RD && RD->isDependentContext() && RD->isCurrentInstantiation(DC))
   E->setTypeDependent(T->isDependentType());
+
+// Bitfield with value-dependent width is type-dependent.
+FieldDecl *FD = dyn_cast(MemberDecl);
+if (FD && FD->isBitField() && FD->getBitWidth()->isValueDependent())
+  E->setTypeDependent(true);
   }
 
   if (HasQualOrFound) {


Index: clang/test/SemaTemplate/value-dependent-bitfield-cond.cpp
===
--- /dev/null
+++ clang/test/SemaTemplate/value-dependent-bitfield-cond.cpp
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
+
+template 
+class A {
+  int c : b;
+
+public:
+  void f() {
+if (c)
+  ;
+  }
+};
Index: clang/test/SemaTemplate/enum-argument.cpp
===
--- clang/test/SemaTemplate/enum-argument.cpp
+++ clang/test/SemaTemplate/enum-argument.cpp
@@ -1,4 +1,5 @@
 // RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
 
 enum Enum { val = 1 };
 template  struct C {
@@ -30,7 +31,7 @@
 unsigned long long bitfield : e0;
 
 void f(int j) {
-  bitfield + j; // expected-warning {{expression result unused}}
+  bitfield + j;
 }
   };
 }
Index: clang/lib/AST/Expr.cpp
===
--- clang/lib/AST/Expr.cpp
+++ clang/lib/AST/Expr.cpp
@@ -1680,6 +1680,11 @@
 CXXRecordDecl *RD = dyn_cast_or_null(DC);
 if (RD && RD->isDependentContext() && RD->isCurrentInstantiation(DC))
   E->setTypeDependent(T->isDependentType());
+
+// Bitfield with value-dependent width is type-dependent.
+FieldDecl *FD = dyn_cast(MemberDecl);
+if (FD && FD->isBitField() && FD->getBitWidth()->isValueDependent())
+  E->setTypeDependent(true);
   }
 
   if (HasQualOrFound) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D72242: Fix crash on value dependent bitfields in if conditions in templates

2020-02-12 Thread Elizabeth Andrews via Phabricator via cfe-commits
eandrews added a comment.

In D72242#1873017 , @smeenai wrote:

> I'm not sure why Phabricator is still showing Needs Review, but @rnk's 
> approval should make this count as accepted.


Ok. Thank you. I've pushed the patch.


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

https://reviews.llvm.org/D72242



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


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

2020-02-12 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert marked 14 inline comments as done.
jdoerfert added inline comments.



Comment at: clang/include/clang/Basic/Attr.td:185
+// An argument of type \p type with name \p name.
+class GenericPointerArgument : Argument {
+  string Type = type;

aaron.ballman wrote:
> The name seems a bit strange given that it's not a generic pointer, you 
> specify a type with it. It's unclear whether you are supposed to specify the 
> pointer type or the base type, which would help a bit. However, it's unclear 
> to me why we'd want this generic mechanism in the first place. These classes 
> are intended to help generate code to do checking automatically, and this 
> design is somewhat at odds with that goal compared to exposing a custom 
> argument type like we did for `VersionArgument`. Also, this type is marked 
> optional rather than leaving that up to the caller, and the default behavior 
> of a generic pointer argument always being default seems suspect.
> 
> I'm not saying "get rid of this", just wondering if you had considered the 
> more verbose approach and had strong rationale as to why this was a better 
> way.
> The name seems a bit strange given that it's not a generic pointer, you 
> specify a type with it.

The "template" is generic as it accepts any pointer type. All the code that 
work with `GenericPointerArgument` don't know what pointer it is, just that it 
is called "Type". Don't you think that is generic?


> Also, this type is marked optional rather than leaving that up to the caller, 
> and the default behavior of a generic pointer argument always being default 
> seems suspect.

That's an oversight. I mark it non-optional. I don't get the "always being 
default" part.

> However, it's unclear to me why we'd want this generic mechanism in the first 
> place. 
> [...]
> I'm not saying "get rid of this", just wondering if you had considered the 
> more verbose approach and had strong rationale as to why this was a better 
> way.

The "problem" is that we want to keep "complex" information around. The verbose 
approach is what we are doing right now for a subset of the information. For 
this subset we already track various variadic expr, variadic unsigned, and 
variadic string arguments and stitch them together later with complex and 
careful iteration over all containers at the same time. It's now 5 variadic XXX 
arguments and it would be >= 7 to support what this approach does.

This approach subsumes this as we can retain the original structure/nesting in 
the custom `OMPTraitInfo` object that is part of the `OMPDeclareVariant` 
instead. [FWIW, in the review for the verbose code we have now, in case you 
haven't seen that, I asked for a less verbose method to store the information 
because the iteration over the stuff, once flattend, is so brittle.]

That said, we can make a specialized argument here instead, e.g., 
OMPTraitInforArgument, which contains a OMPTraitInfo pointer. I figured this 
might not be the last time someone wants to keep a complex structure inside an 
attribute argument and creating new arguments all the time seems a lot of waste 
(due to all the boilerplate). If you think we should go that route, I will 
happily try it out.

(As noted below somewhere, this method avoids a lot of boilerplate by requiring 
a specialization of one AST reader/writer method.)



Comment at: clang/include/clang/Basic/Attr.td:3351
 ExprArgument<"VariantFuncRef">,
-VariadicExprArgument<"Scores">,
-VariadicUnsignedArgument<"CtxSelectorSets">,
-VariadicUnsignedArgument<"CtxSelectors">,
-VariadicStringArgument<"ImplVendors">,
-VariadicStringArgument<"DeviceKinds">
+GenericPointerArgument<"TraitInfos", "OMPTraitInfo*">,
   ];

aaron.ballman wrote:
> Just double-checking -- this is not a breaking change to existing code, 
> correct?
> 
> It's not yet clear to me how a "generic pointer argument" relates to an 
> `OMPTraitInfo` object that the end programmer will have no understanding of 
> because it's a compiler implementation detail.
> 
> I used to understand what this attribute accepted as arguments and I no 
> longer have the foggiest idea, which seems somewhat problematic.
> Just double-checking -- this is not a breaking change to existing code, 
> correct?

This actually fixes various errors in the existing code and adds a lot of 
missing functionality, no regressions are known to me.

> It's not yet clear to me how a "generic pointer argument" relates to an 
> OMPTraitInfo object that the end programmer will have no understanding of 
> because it's a compiler implementation detail.

This is not (supposed to be) user facing. This is generated from the `...` in 
`omp declare variant match(...)`.

> I used to understand what this attribute accepted as arguments and I no 
> longer have the foggiest idea, which seems somewhat problematic.

I don't understand? The attribute accepted a custom (=internal) encoding 

[clang] a58017e - Fix type-dependency of bitfields in templates

2020-02-12 Thread Elizabeth Andrews via cfe-commits

Author: Elizabeth Andrews
Date: 2020-02-12T13:31:41-08:00
New Revision: a58017e5cae5be948fd1913b68d46553e87aa622

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

LOG: Fix type-dependency of bitfields in templates

This patch is a follow up to 878a24ee244a24. Name of bitfields
with value-dependent width should be set as type-dependent. This
patch adds the required value-dependency check and sets the
type-dependency accordingly.

Patch fixes PR44886

Differential revision: https://reviews.llvm.org/D72242

Added: 
clang/test/SemaTemplate/value-dependent-bitfield-cond.cpp

Modified: 
clang/lib/AST/Expr.cpp
clang/test/SemaTemplate/enum-argument.cpp

Removed: 




diff  --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp
index d9291616c66a..7e8808f84ead 100644
--- a/clang/lib/AST/Expr.cpp
+++ b/clang/lib/AST/Expr.cpp
@@ -1680,6 +1680,11 @@ MemberExpr *MemberExpr::Create(
 CXXRecordDecl *RD = dyn_cast_or_null(DC);
 if (RD && RD->isDependentContext() && RD->isCurrentInstantiation(DC))
   E->setTypeDependent(T->isDependentType());
+
+// Bitfield with value-dependent width is type-dependent.
+FieldDecl *FD = dyn_cast(MemberDecl);
+if (FD && FD->isBitField() && FD->getBitWidth()->isValueDependent())
+  E->setTypeDependent(true);
   }
 
   if (HasQualOrFound) {

diff  --git a/clang/test/SemaTemplate/enum-argument.cpp 
b/clang/test/SemaTemplate/enum-argument.cpp
index a79ed8403e9f..7ff419613990 100644
--- a/clang/test/SemaTemplate/enum-argument.cpp
+++ b/clang/test/SemaTemplate/enum-argument.cpp
@@ -1,4 +1,5 @@
 // RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
 
 enum Enum { val = 1 };
 template  struct C {
@@ -30,7 +31,7 @@ namespace rdar8020920 {
 unsigned long long bitfield : e0;
 
 void f(int j) {
-  bitfield + j; // expected-warning {{expression result unused}}
+  bitfield + j;
 }
   };
 }

diff  --git a/clang/test/SemaTemplate/value-dependent-bitfield-cond.cpp 
b/clang/test/SemaTemplate/value-dependent-bitfield-cond.cpp
new file mode 100644
index ..873e4d48e837
--- /dev/null
+++ b/clang/test/SemaTemplate/value-dependent-bitfield-cond.cpp
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
+
+template 
+class A {
+  int c : b;
+
+public:
+  void f() {
+if (c)
+  ;
+  }
+};



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


[PATCH] D72242: Fix crash on value dependent bitfields in if conditions in templates

2020-02-12 Thread Shoaib Meenai via Phabricator via cfe-commits
smeenai added a comment.

I'm not sure why Phabricator is still showing Needs Review, but @rnk's approval 
should make this count as accepted.


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

https://reviews.llvm.org/D72242



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


[PATCH] D72242: Fix crash on value dependent bitfields in if conditions in templates

2020-02-12 Thread Elizabeth Andrews via Phabricator via cfe-commits
eandrews added a comment.

Actually I just noticed it still says 'Needs review' above. I'm not sure what 
the protocol is. Can I push the patch?


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

https://reviews.llvm.org/D72242



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


[PATCH] D74500: clang: Treat ieee mode as the default for denormal-fp-math

2020-02-12 Thread Matt Arsenault via Phabricator via cfe-commits
arsenm created this revision.
arsenm added reviewers: spatel, cameron.mcinally, andrew.w.kaylor.
Herald added subscribers: llvm-commits, kerbowa, dexonsmith, nhaehnle, wdng, 
jvesely.
Herald added a project: LLVM.

The IR hasn't switched the default yet, so explicitly add the ieee
attributes.


https://reviews.llvm.org/D74500

Files:
  clang/include/clang/Basic/CodeGenOptions.h
  clang/include/clang/Driver/ToolChain.h
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/CodeGenCUDA/flush-denormals.cu
  clang/test/CodeGenCUDA/propagate-metadata.cu
  clang/test/CodeGenOpenCL/amdgpu-features.cl
  clang/test/Driver/cuda-flush-denormals-to-zero.cu
  clang/test/Driver/denormal-fp-math.c
  clang/test/Driver/fp-model.c
  llvm/include/llvm/ADT/FloatingPointMode.h

Index: llvm/include/llvm/ADT/FloatingPointMode.h
===
--- llvm/include/llvm/ADT/FloatingPointMode.h
+++ llvm/include/llvm/ADT/FloatingPointMode.h
@@ -45,25 +45,25 @@
   /// floating-point instructions implicitly treat the input value as 0.
   DenormalModeKind Input = DenormalModeKind::Invalid;
 
-  DenormalMode() = default;
-  DenormalMode(DenormalModeKind Out, DenormalModeKind In) :
+  constexpr DenormalMode() = default;
+  constexpr DenormalMode(DenormalModeKind Out, DenormalModeKind In) :
 Output(Out), Input(In) {}
 
 
-  static DenormalMode getInvalid() {
+  static constexpr DenormalMode getInvalid() {
 return DenormalMode(DenormalModeKind::Invalid, DenormalModeKind::Invalid);
   }
 
-  static DenormalMode getIEEE() {
+  static constexpr DenormalMode getIEEE() {
 return DenormalMode(DenormalModeKind::IEEE, DenormalModeKind::IEEE);
   }
 
-  static DenormalMode getPreserveSign() {
+  static constexpr DenormalMode getPreserveSign() {
 return DenormalMode(DenormalModeKind::PreserveSign,
 DenormalModeKind::PreserveSign);
   }
 
-  static DenormalMode getPositiveZero() {
+  static constexpr DenormalMode getPositiveZero() {
 return DenormalMode(DenormalModeKind::PositiveZero,
 DenormalModeKind::PositiveZero);
   }
Index: clang/test/Driver/fp-model.c
===
--- clang/test/Driver/fp-model.c
+++ clang/test/Driver/fp-model.c
@@ -67,6 +67,10 @@
 // RUN:   | FileCheck --check-prefix=WARNf %s
 // WARNf: warning: overriding '-ffp-model=strict' option with '-Ofast' [-Woverriding-t-option]
 
+// RUN: %clang -### -ffp-model=strict -fdenormal-fp-math=preserve-sign,preserve-sign -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=WARN10 %s
+// WARN10: warning: overriding '-ffp-model=strict' option with '-fdenormal-fp-math=preserve-sign,preserve-sign' [-Woverriding-t-option]
+
 // RUN: %clang -### -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-NOROUND %s
 // CHECK-NOROUND: "-cc1"
Index: clang/test/Driver/denormal-fp-math.c
===
--- clang/test/Driver/denormal-fp-math.c
+++ clang/test/Driver/denormal-fp-math.c
@@ -8,7 +8,8 @@
 // RUN: not %clang -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=foo,ieee -v 2>&1 | FileCheck -check-prefix=CHECK-INVALID2 %s
 // RUN: not %clang -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=foo,foo -v 2>&1 | FileCheck -check-prefix=CHECK-INVALID3 %s
 
-// CHECK-IEEE: -fdenormal-fp-math=ieee,ieee
+// TODO: ieee is the implied default, and the flag is not passed.
+// CHECK-IEEE: "-fdenormal-fp-math=ieee,ieee"
 // CHECK-PS: "-fdenormal-fp-math=preserve-sign,preserve-sign"
 // CHECK-PZ: "-fdenormal-fp-math=positive-zero,positive-zero"
 // CHECK-NO-UNSAFE-NOT: "-fdenormal-fp-math=ieee"
Index: clang/test/Driver/cuda-flush-denormals-to-zero.cu
===
--- clang/test/Driver/cuda-flush-denormals-to-zero.cu
+++ clang/test/Driver/cuda-flush-denormals-to-zero.cu
@@ -9,5 +9,9 @@
 
 // CPUFTZ-NOT: -fdenormal-fp-math
 
+// FTZ-NOT: -fdenormal-fp-math-f32=
 // FTZ: "-fdenormal-fp-math-f32=preserve-sign,preserve-sign"
-// NOFTZ: "-fdenormal-fp-math=ieee,ieee"
+
+// The default of ieee is omitted
+// NOFTZ-NOT: "-fdenormal-fp-math"
+// NOFTZ-NOT: "-fdenormal-fp-math-f32"
Index: clang/test/CodeGenOpenCL/amdgpu-features.cl
===
--- clang/test/CodeGenOpenCL/amdgpu-features.cl
+++ clang/test/CodeGenOpenCL/amdgpu-features.cl
@@ -14,13 +14,13 @@
 // RUN: %clang_cc1 -triple amdgcn -target-cpu gfx600 -S -emit-llvm -o - %s | FileCheck --check-prefix=GFX600 %s
 // RUN: %clang_cc1 -triple amdgcn -target-cpu gfx601 -S -emit-llvm -o - %s | FileCheck --check-prefix=GFX601 %s
 
-// GFX904: "target-features"="+16-bit-insts,+ci-insts,+dpp,+flat-address-space,+fp64-fp16-denormals,+gfx8-insts,+gfx9-insts,+s-memrealtime,-fp32-denormals"
-// GFX906: 

[Diffusion] rG0e3a48778408: PR12350: Handle remaining cases permitted by CWG DR 244.

2020-02-12 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added subscribers: cfe-commits, rsmith, vsk, lebedev.ri.
lebedev.ri added a comment.

Post-commit review, although i'm not sure this is the commit that is the 
problem.


BRANCHES
  master

/clang/lib/AST/NestedNameSpecifier.cpp:485-487 Was this change intentional? 
It seems, 
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap-ubsan/builds/17720/steps/annotate/logs/stdio
 is pointing at this line/change with:
```
FAIL: Clang :: AST/ast-dump-expr.cpp (136 of 16826)
 TEST 'Clang :: AST/ast-dump-expr.cpp' FAILED 

Script:
--
: 'RUN: at line 1';   
/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/bin/clang -cc1 
-internal-isystem 
/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/lib/clang/11.0.0/include
 -nostdsysteminc -triple x86_64-unknown-unknown -Wno-unused-value 
-fcxx-exceptions -std=gnu++17 -ast-dump 
/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/clang/test/AST/ast-dump-expr.cpp
 | 
/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/bin/FileCheck 
-strict-whitespace 
/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/clang/test/AST/ast-dump-expr.cpp
--
Exit Code: 2

Command Output (stderr):
--
/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/clang/lib/AST/NestedNameSpecifier.cpp:485:23:
 runtime error: null pointer passed as argument 2, which is declared to never 
be null
/usr/include/string.h:43:28: note: nonnull attribute specified here
#0 0x5f80492 in Append(char*, char*, char*&, unsigned int&, unsigned int&) 
/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/clang/lib/AST/NestedNameSpecifier.cpp:485:5
#1 0x5f808ca in SaveSourceLocation(clang::SourceLocation, char*&, unsigned 
int&, unsigned int&) 
/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/clang/lib/AST/NestedNameSpecifier.cpp:500:3
#2 0x5f80a68 in 
clang::NestedNameSpecifierLocBuilder::Extend(clang::ASTContext&, 
clang::NamespaceDecl*, clang::SourceLocation, clang::SourceLocation) 
/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/clang/lib/AST/NestedNameSpecifier.cpp:603:3
#3 0x4f5f84a in clang::CXXScopeSpec::Extend(clang::ASTContext&, 
clang::NamespaceDecl*, clang::SourceLocation, clang::SourceLocation) 
/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/clang/lib/Sema/DeclSpec.cpp:73:11
#4 0x4fc1af9 in clang::Sema::BuildCXXNestedNameSpecifier(clang::Scope*, 
clang::Sema::NestedNameSpecInfo&, bool, clang::CXXScopeSpec&, 
clang::NamedDecl*, bool, bool*, bool) 
/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/clang/lib/Sema/SemaCXXScopeSpec.cpp:714:10
#5 0x4fc32b4 in clang::Sema::ActOnCXXNestedNameSpecifier(clang::Scope*, 
clang::Sema::NestedNameSpecInfo&, bool, clang::CXXScopeSpec&, bool, bool*, 
bool) 
/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/clang/lib/Sema/SemaCXXScopeSpec.cpp:841:10
#6 0x4efb997 in 
clang::Parser::ParseOptionalCXXScopeSpecifier(clang::CXXScopeSpec&, 
clang::OpaquePtr, bool, bool*, bool, clang::IdentifierInfo**, 
bool, bool) 
/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/clang/lib/Parse/ParseExprCXX.cpp:455:19
#7 0x4ea7c72 in clang::Parser::TryAnnotateCXXScopeToken(bool) 
/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/clang/lib/Parse/Parser.cpp:2045:7
#8 0x4ebd1d5 in clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, 
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, 
clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*) 
/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/clang/lib/Parse/ParseDecl.cpp:3359:13
#9 0x4ed0326 in 
clang::Parser::ParseParameterDeclarationClause(clang::DeclaratorContext, 
clang::ParsedAttributes&, 
llvm::SmallVectorImpl&, 
clang::SourceLocation&) 
/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/clang/lib/Parse/ParseDecl.cpp:6732:5
#10 0x4ece524 in clang::Parser::ParseFunctionDeclarator(clang::Declarator&, 
clang::ParsedAttributes&, clang::BalancedDelimiterTracker&, bool, bool) 
/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/clang/lib/Parse/ParseDecl.cpp:6444:7
#11 0x4ecc563 in clang::Parser::ParseDirectDeclarator(clang::Declarator&) 
/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/clang/lib/Parse/ParseDecl.cpp:6126:7
#12 0x4ecaf80 in clang::Parser::ParseDeclaratorInternal(clang::Declarator&, 
void (clang::Parser::*)(clang::Declarator&)) 
/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/clang/lib/Parse/ParseDecl.cpp:5679:7
#13 0x4ecb076 in clang::Parser::ParseDeclaratorInternal(clang::Declarator&, 
void (clang::Parser::*)(clang::Declarator&)) 
/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/clang/lib/Parse/ParseDecl.cpp:5702:5
#14 0x4ec0b24 in ParseDeclarator 
/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/clang/lib/Parse/ParseDecl.cpp:5547:3
#15 0x4ec0b24 

[clang] e26c24b - Revert "[IRGen] Emit lifetime intrinsics around temporary aggregate argument allocas"

2020-02-12 Thread Erik Pilkington via cfe-commits

Author: Erik Pilkington
Date: 2020-02-12T12:26:46-08:00
New Revision: e26c24b849211f35a988d001753e0cd15e4a9d7b

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

LOG: Revert "[IRGen] Emit lifetime intrinsics around temporary aggregate 
argument allocas"

This reverts commit fafc6e4fdf3673dcf557d6c8ae0c0a4bb3184402.

Should fix ppc stage2 failure: 
http://lab.llvm.org:8011/builders/clang-ppc64be-linux-multistage/builds/23546

Conflicts:
clang/lib/CodeGen/CGCall.cpp

Added: 


Modified: 
clang/lib/CodeGen/CGCall.cpp
clang/lib/CodeGen/CGCall.h
clang/test/CodeGenCXX/stack-reuse-miscompile.cpp

Removed: 
clang/test/CodeGen/lifetime-call-temp.c
clang/test/CodeGenCXX/amdgcn-call-with-aggarg.cpp



diff  --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index c90326362d66..432058bdc17a 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -3692,24 +3692,7 @@ void CodeGenFunction::EmitCallArg(CallArgList , 
const Expr *E,
 return;
   }
 
-  AggValueSlot ArgSlot = AggValueSlot::ignored();
-  Address ArgSlotAlloca = Address::invalid();
-  if (hasAggregateEvaluationKind(E->getType())) {
-ArgSlot = CreateAggTemp(E->getType(), "agg.tmp", );
-
-// Emit a lifetime start/end for this temporary. If the type has a
-// destructor, then we need to keep it alive. FIXME: We should still be 
able
-// to end the lifetime after the destructor returns.
-if (!E->getType().isDestructedType()) {
-  uint64_t size =
-  
CGM.getDataLayout().getTypeAllocSize(ConvertTypeForMem(E->getType()));
-  if (auto *lifetimeSize =
-  EmitLifetimeStart(size, ArgSlotAlloca.getPointer()))
-args.addLifetimeCleanup({ArgSlotAlloca.getPointer(), lifetimeSize});
-}
-  }
-
-  args.add(EmitAnyExpr(E, ArgSlot), type);
+  args.add(EmitAnyExprToTemp(E), type);
 }
 
 QualType CodeGenFunction::getVarArgType(const Expr *Arg) {
@@ -4810,9 +4793,6 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo 
,
   for (CallLifetimeEnd  : CallLifetimeEndAfterCall)
 LifetimeEnd.Emit(*this, /*Flags=*/{});
 
-  for (auto  : CallArgs.getLifetimeCleanups())
-EmitLifetimeEnd(LT.Size, LT.Addr);
-
   return Ret;
 }
 

diff  --git a/clang/lib/CodeGen/CGCall.h b/clang/lib/CodeGen/CGCall.h
index 3c574a12953b..28121af946f9 100644
--- a/clang/lib/CodeGen/CGCall.h
+++ b/clang/lib/CodeGen/CGCall.h
@@ -283,11 +283,6 @@ class CallArgList : public SmallVector {
 llvm::Instruction *IsActiveIP;
   };
 
-  struct EndLifetimeInfo {
-llvm::Value *Addr;
-llvm::Value *Size;
-  };
-
   void add(RValue rvalue, QualType type) { push_back(CallArg(rvalue, type)); }
 
   void addUncopiedAggregate(LValue LV, QualType type) {
@@ -304,9 +299,6 @@ class CallArgList : public SmallVector {
 CleanupsToDeactivate.insert(CleanupsToDeactivate.end(),
 other.CleanupsToDeactivate.begin(),
 other.CleanupsToDeactivate.end());
-LifetimeCleanups.insert(LifetimeCleanups.end(),
-other.LifetimeCleanups.begin(),
-other.LifetimeCleanups.end());
 assert(!(StackBase && other.StackBase) && "can't merge stackbases");
 if (!StackBase)
   StackBase = other.StackBase;
@@ -346,14 +338,6 @@ class CallArgList : public SmallVector {
   /// memory.
   bool isUsingInAlloca() const { return StackBase; }
 
-  void addLifetimeCleanup(EndLifetimeInfo Info) {
-LifetimeCleanups.push_back(Info);
-  }
-
-  ArrayRef getLifetimeCleanups() const {
-return LifetimeCleanups;
-  }
-
 private:
   SmallVector Writebacks;
 
@@ -362,10 +346,6 @@ class CallArgList : public SmallVector {
   /// occurs.
   SmallVector CleanupsToDeactivate;
 
-  /// Lifetime information needed to call llvm.lifetime.end for any temporary
-  /// argument allocas.
-  SmallVector LifetimeCleanups;
-
   /// The stacksave call.  It dominates all of the argument evaluation.
   llvm::CallInst *StackBase;
 };

diff  --git a/clang/test/CodeGen/lifetime-call-temp.c 
b/clang/test/CodeGen/lifetime-call-temp.c
deleted file mode 100644
index fa00980160c2..
--- a/clang/test/CodeGen/lifetime-call-temp.c
+++ /dev/null
@@ -1,83 +0,0 @@
-// RUN: %clang -cc1  -triple x86_64-apple-macos -O1 
-disable-llvm-passes %s -S -emit-llvm -o - | FileCheck %s 
--implicit-check-not=llvm.lifetime
-// RUN: %clang -cc1 -xc++ -std=c++17 -triple x86_64-apple-macos -O1 
-disable-llvm-passes %s -S -emit-llvm -o - | FileCheck %s 
--implicit-check-not=llvm.lifetime --check-prefix=CHECK --check-prefix=CXX
-// RUN: %clang -cc1 -xobjective-c-triple x86_64-apple-macos -O1 
-disable-llvm-passes %s -S -emit-llvm -o - | FileCheck %s 
--implicit-check-not=llvm.lifetime 

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

2020-02-12 Thread Fady Ghanim via Phabricator via cfe-commits
fghanim updated this revision to Diff 244249.
fghanim added a comment.

Remove unnecessary preservation of builder insertion point in 
`emitCommonDirectiveExit`


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
@@ -613,4 +613,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);
+  };
+
+  auto FiniCB = [&](InsertPointTy IP) {
+BasicBlock *IPBB = IP.getBlock();
+EXPECT_NE(IPBB->end(), IP.getPoint());
+  };
+
+  

[PATCH] D74498: [clang-tidy] Fix performance-noexcept-move-constructor-fix.cpp on non-English locale

2020-02-12 Thread Alexandre Ganea via Phabricator via cfe-commits
aganea updated this revision to Diff 244246.
aganea added a comment.

Better fix.


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

https://reviews.llvm.org/D74498

Files:
  clang-tools-extra/test/clang-tidy/check_clang_tidy.py


Index: clang-tools-extra/test/clang-tidy/check_clang_tidy.py
===
--- clang-tools-extra/test/clang-tidy/check_clang_tidy.py
+++ clang-tools-extra/test/clang-tidy/check_clang_tidy.py
@@ -159,7 +159,7 @@
 diff_output = e.output
 
   print('-- Fixes -\n' 
+
-diff_output.decode() +
+diff_output.decode(errors='ignore') +
 '\n--')
 
   if has_check_fixes:


Index: clang-tools-extra/test/clang-tidy/check_clang_tidy.py
===
--- clang-tools-extra/test/clang-tidy/check_clang_tidy.py
+++ clang-tools-extra/test/clang-tidy/check_clang_tidy.py
@@ -159,7 +159,7 @@
 diff_output = e.output
 
   print('-- Fixes -\n' +
-diff_output.decode() +
+diff_output.decode(errors='ignore') +
 '\n--')
 
   if has_check_fixes:
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71491: [ubsan] Check implicit casts in ObjC for-in statements

2020-02-12 Thread Vedant Kumar via Phabricator via cfe-commits
vsk added subscribers: erik.pilkington, ahatanak.
vsk added a comment.

+ Erik and Akira for IRgen expertise.


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

https://reviews.llvm.org/D71491



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


[PATCH] D72242: Fix crash on value dependent bitfields in if conditions in templates

2020-02-12 Thread Elizabeth Andrews via Phabricator via cfe-commits
eandrews added a comment.

Thanks! I'll push it shortly. Just running a final ninja check-all after 
updating workspace.


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

https://reviews.llvm.org/D72242



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


[PATCH] D74498: [clang-tidy] Fix performance-noexcept-move-constructor-fix.cpp on non-English locale

2020-02-12 Thread Alexandre Ganea via Phabricator via cfe-commits
aganea created this revision.
aganea added reviewers: rnk, alexfh.
Herald added subscribers: cfe-commits, xazax.hun.
Herald added a project: clang.

When running on Windows under the following locale:

  D:\llvm-project>python
  Python 3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:37:50) [MSC v.1916 64 bit 
(AMD64)] on win32
  Type "help", "copyright", "credits" or "license" for more information.
  >>> import locale
  >>> locale.getlocale()
  ('French_Canada', '1252')
  >>>

Fix the following issue:

  # command stderr:
  Traceback (most recent call last):
File 
"D:/llvm-project/clang-tools-extra/test/../test\clang-tidy\check_clang_tidy.py",
 line 249, in 
  main()
File 
"D:/llvm-project/clang-tools-extra/test/../test\clang-tidy\check_clang_tidy.py",
 line 245, in main
  run_test_once(args, extra_args)
File 
"D:/llvm-project/clang-tools-extra/test/../test\clang-tidy\check_clang_tidy.py",
 line 162, in run_test_once
  diff_output.decode() +
  UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe0 in position 2050: 
invalid continuation byte


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D74498

Files:
  clang-tools-extra/test/clang-tidy/check_clang_tidy.py


Index: clang-tools-extra/test/clang-tidy/check_clang_tidy.py
===
--- clang-tools-extra/test/clang-tidy/check_clang_tidy.py
+++ clang-tools-extra/test/clang-tidy/check_clang_tidy.py
@@ -31,7 +31,7 @@
 import re
 import subprocess
 import sys
-
+import locale
 
 def write_file(file_name, text):
   with open(file_name, 'w') as f:
@@ -151,6 +151,13 @@
 clang_tidy_output +
 '\n--')
 
+  try:
+locale.setlocale('en_US')
+  except:
+try:
+ locale.setlocale('en_US.uf8')
+   except:
+
   try:
 diff_output = subprocess.check_output(
 ['diff', '-u', original_file_name, temp_file_name],


Index: clang-tools-extra/test/clang-tidy/check_clang_tidy.py
===
--- clang-tools-extra/test/clang-tidy/check_clang_tidy.py
+++ clang-tools-extra/test/clang-tidy/check_clang_tidy.py
@@ -31,7 +31,7 @@
 import re
 import subprocess
 import sys
-
+import locale
 
 def write_file(file_name, text):
   with open(file_name, 'w') as f:
@@ -151,6 +151,13 @@
 clang_tidy_output +
 '\n--')
 
+  try:
+locale.setlocale('en_US')
+  except:
+try:
+	  locale.setlocale('en_US.uf8')
+	except:
+
   try:
 diff_output = subprocess.check_output(
 ['diff', '-u', original_file_name, temp_file_name],
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D73775: [clang-tidy] Cover cases like (b && c && b) in the redundant expression check

2020-02-12 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 aside from a minor nit.




Comment at: clang-tools-extra/clang-tidy/misc/RedundantExpressionCheck.cpp:355
+   collectOperands(Operands.second, AllOperands, OpKind);
+  } else {
+AllOperands.push_back(Part);

No `else` after a `return`.



Comment at: 
clang-tools-extra/test/clang-tidy/checkers/misc-redundant-expression.cpp:206
+
+  if (U && V && U && V) return true;
+  // CHECK-MESSAGES: :[[@LINE-1]]:19: warning: overloaded operator has 
equivalent nested operands

I think that this is reasonable behavior, however, once the user overloads the 
operator there's no way to know whether calling that operator has other side 
effects that make this not actually be equivalent to `U && V`. That said, 
unless this happens an awful lot in practice, this still seems like a 
reasonable heuristic.


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

https://reviews.llvm.org/D73775



___
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-12 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay accepted this revision.
MaskRay added a comment.

@rsmith Does `clang/test/utils/` (a new directory) look appropriate to you?


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] D70876: [clang-tidy] Add spuriously-wake-up-functions check

2020-02-12 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 aside from a test coverage request.




Comment at: 
clang-tools-extra/test/clang-tidy/bugprone-spuriously-wake-up-functions.c:26-30
+  if (list_c.next == NULL) {
+if (0 != cnd_wait(_c, )) {
+  // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: 'cnd_wait' should be placed 
inside a while statement [bugprone-spuriously-wake-up-functions]
+}
+  }

Can you add a test case to demonstrate the behavior when there's not a compound 
statement involved? And another one for a slightly more complex if predicate? 
e.g.,
```
if (list_c.next == NULL)
  if (0 != cnd_wait(_c, ))
;

if (list_c.next == NULL && 0 != cnd_wait(_c, ))
  ;
```
Both of these should be flagged similar to the form with the compound statement.


Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D70876



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


[PATCH] D72242: Fix crash on value dependent bitfields in if conditions in templates

2020-02-12 Thread Shoaib Meenai via Phabricator via cfe-commits
smeenai added a subscriber: hans.
smeenai added a comment.

CC @hans for the 10.0 branch.


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

https://reviews.llvm.org/D72242



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


[PATCH] D72242: Fix crash on value dependent bitfields in if conditions in templates

2020-02-12 Thread Reid Kleckner via Phabricator via cfe-commits
rnk accepted this revision.
rnk added a comment.

lgtm

The fix looks like what Richard asked for, so I feel comfortable approving 
this. Thanks for the fix!


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

https://reviews.llvm.org/D72242



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


[PATCH] D72242: Fix crash on value dependent bitfields in if conditions in templates

2020-02-12 Thread Shoaib Meenai via Phabricator via cfe-commits
smeenai added a comment.

This also fixes https://bugs.llvm.org/show_bug.cgi?id=44886


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

https://reviews.llvm.org/D72242



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


[clang] 3833316 - Completely ignore strict FP model and denormal-fp-math interaction

2020-02-12 Thread Matt Arsenault via cfe-commits

Author: Matt Arsenault
Date: 2020-02-12T13:26:46-05:00
New Revision: 38333164fc7dfc9d4cbf93e443e74809022ed78e

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

LOG: Completely ignore strict FP model and denormal-fp-math interaction

No behavior is going to make sense here until the default is IEEE.

Added: 


Modified: 
clang/lib/Driver/ToolChains/Clang.cpp

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index 79a518c2904c..e71fbae5ae77 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -2771,8 +2771,6 @@ static void RenderFloatingPointOptions(const ToolChain 
, const Driver ,
   if (HonorINFs && HonorNaNs &&
 !AssociativeMath && !ReciprocalMath &&
 SignedZeros && TrappingMath && RoundingFPMath &&
-// FIXME: This should check for IEEE when it's the default.
-DenormalFPMath != llvm::DenormalMode::getInvalid() &&
 FPContract.equals("off"))
 // OK: Current Arg doesn't conflict with -ffp-model=strict
 ;



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


[PATCH] D72362: [clang-tidy] misc-no-recursion: a new check

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



Comment at: clang-tools-extra/clang-tidy/misc/NoRecursionCheck.cpp:28
+// 2. it is immutable, the way it was constructed it will stay.
+template  class ImmutableSmartSet {
+  ArrayRef Vector;

"Smart" is not a descriptive term. This seems like it's an `ImmutableSmallSet`?



Comment at: clang-tools-extra/clang-tidy/misc/NoRecursionCheck.cpp:64
+  return llvm::find(Vector, V) == Vector.end() ? 0 : 1;
+} else {
+  return Set.count(V);

No `else` after `return`.



Comment at: clang-tools-extra/clang-tidy/misc/NoRecursionCheck.cpp:70
+
+template  class SmartSmallSetVector {
+public:

Same complaint here about `Smart` -- should probably just be a `SmallSetVector`.



Comment at: clang-tools-extra/clang-tidy/misc/NoRecursionCheck.cpp:203
+Decl *D = N->getDecl();
+diag(D->getLocation(), "function '%0' is part of call graph loop")
+<< cast(D)->getName();

I think "call graph loop" is a bit much for a diagnostic -- how about `%0 is 
within a recursive call chain` or something along those lines?



Comment at: clang-tools-extra/clang-tidy/misc/NoRecursionCheck.cpp:204
+diag(D->getLocation(), "function '%0' is part of call graph loop")
+<< cast(D)->getName();
+  }

Drop the call to `getName()` and remove the single quotes from the diagnostic 
around `%0`, and just pass in the `NamedDecl` -- the diagnostics engine will do 
the right thing (and it gives better names for strange things like operators).



Comment at: clang-tools-extra/clang-tidy/misc/NoRecursionCheck.cpp:230
+  diag(CycleEntryFn->getLocation(),
+   "Example call graph loop, starting from function '%0'",
+   DiagnosticIDs::Note)

Example -> example

I think "call graph group" might be a bit much for a diagnostic -- how about 
`example recursive call chain, starting from %0`



Comment at: clang-tools-extra/clang-tidy/misc/NoRecursionCheck.cpp:232
+   DiagnosticIDs::Note)
+  << cast(CycleEntryFn)->getName();
+  for (int CurFrame = 1, NumFrames = CyclicCallStack.size();

Same here (and elsewhere, I'll stop commenting on them).



Comment at: clang-tools-extra/clang-tidy/misc/NoRecursionCheck.cpp:249-250
+  diag(CyclicCallStack.back().CallExpr->getBeginLoc(),
+   "... which was the starting point of this call graph."
+   " This report is non-exhaustive, there may be other cycles.",
+   DiagnosticIDs::Note);

Diagnostic text should not be full sentences.

`... which was the starting point of the recursive call chain; there may be 
other cycles`



Comment at: clang-tools-extra/clang-tidy/misc/NoRecursionCheck.cpp:259
+  CG.addToCallGraph(const_cast(TU));
+  // CG.viewGraph();
+

Remove commented out code.



Comment at: clang-tools-extra/docs/clang-tidy/checks/misc-no-recursion.rst:8
+that are loops), diagnoses each function in the cycle,
+and displays one example of possible call graph loop (recursion).

Eugene.Zelenko wrote:
> It'll be reasonable to add links to relevant coding guidelines.
Agreed.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72362



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


[PATCH] D74385: [ARCMT][NFC] Reduce #include dependencies

2020-02-12 Thread serge via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG53fba65d2204: [ARCMT][NFC] Reduce #include dependencies 
(authored by nicolas17, committed by serge-sans-paille).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74385

Files:
  clang/lib/ARCMigrate/ARCMT.cpp
  clang/lib/ARCMigrate/Internals.h
  clang/lib/ARCMigrate/Transforms.cpp


Index: clang/lib/ARCMigrate/Transforms.cpp
===
--- clang/lib/ARCMigrate/Transforms.cpp
+++ clang/lib/ARCMigrate/Transforms.cpp
@@ -8,6 +8,7 @@
 
 #include "Transforms.h"
 #include "Internals.h"
+#include "clang/ARCMigrate/ARCMT.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/RecursiveASTVisitor.h"
 #include "clang/Analysis/DomainSpecific/CocoaConventions.h"
Index: clang/lib/ARCMigrate/Internals.h
===
--- clang/lib/ARCMigrate/Internals.h
+++ clang/lib/ARCMigrate/Internals.h
@@ -9,13 +9,15 @@
 #ifndef LLVM_CLANG_LIB_ARCMIGRATE_INTERNALS_H
 #define LLVM_CLANG_LIB_ARCMIGRATE_INTERNALS_H
 
-#include "clang/ARCMigrate/ARCMT.h"
+#include "clang/Basic/LangOptions.h"
 #include "clang/Basic/Diagnostic.h"
+#include "clang/Frontend/MigratorOptions.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/Optional.h"
 #include 
 
 namespace clang {
+  class ASTContext;
   class Sema;
   class Stmt;
 
Index: clang/lib/ARCMigrate/ARCMT.cpp
===
--- clang/lib/ARCMigrate/ARCMT.cpp
+++ clang/lib/ARCMigrate/ARCMT.cpp
@@ -7,6 +7,7 @@
 
//===--===//
 
 #include "Internals.h"
+#include "clang/ARCMigrate/ARCMT.h"
 #include "clang/AST/ASTConsumer.h"
 #include "clang/Basic/DiagnosticCategories.h"
 #include "clang/Frontend/ASTUnit.h"


Index: clang/lib/ARCMigrate/Transforms.cpp
===
--- clang/lib/ARCMigrate/Transforms.cpp
+++ clang/lib/ARCMigrate/Transforms.cpp
@@ -8,6 +8,7 @@
 
 #include "Transforms.h"
 #include "Internals.h"
+#include "clang/ARCMigrate/ARCMT.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/RecursiveASTVisitor.h"
 #include "clang/Analysis/DomainSpecific/CocoaConventions.h"
Index: clang/lib/ARCMigrate/Internals.h
===
--- clang/lib/ARCMigrate/Internals.h
+++ clang/lib/ARCMigrate/Internals.h
@@ -9,13 +9,15 @@
 #ifndef LLVM_CLANG_LIB_ARCMIGRATE_INTERNALS_H
 #define LLVM_CLANG_LIB_ARCMIGRATE_INTERNALS_H
 
-#include "clang/ARCMigrate/ARCMT.h"
+#include "clang/Basic/LangOptions.h"
 #include "clang/Basic/Diagnostic.h"
+#include "clang/Frontend/MigratorOptions.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/Optional.h"
 #include 
 
 namespace clang {
+  class ASTContext;
   class Sema;
   class Stmt;
 
Index: clang/lib/ARCMigrate/ARCMT.cpp
===
--- clang/lib/ARCMigrate/ARCMT.cpp
+++ clang/lib/ARCMigrate/ARCMT.cpp
@@ -7,6 +7,7 @@
 //===--===//
 
 #include "Internals.h"
+#include "clang/ARCMigrate/ARCMT.h"
 #include "clang/AST/ASTConsumer.h"
 #include "clang/Basic/DiagnosticCategories.h"
 #include "clang/Frontend/ASTUnit.h"
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D73852: [clang] detect switch fallthrough marked by a comment (PR43465)

2020-02-12 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers added a comment.

Doesn't GCC also support multiple different levels of this warning for all 
kinds of different spellings?
https://developers.redhat.com/blog/2017/03/10/wimplicit-fallthrough-in-gcc-7/

I have concerns about the performance of this warning.  We're going to parse 
every comment?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73852



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


[clang] 5dcffdf - Fix fp-model flag test failure on linux

2020-02-12 Thread Matt Arsenault via cfe-commits

Author: Matt Arsenault
Date: 2020-02-12T10:14:29-08:00
New Revision: 5dcffdf58a33b51028f6b52e44c4af25b5d159aa

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

LOG: Fix fp-model flag test failure on linux

We're still in the awkward state where IEEE is not the default
denormal mode.

Added: 


Modified: 
clang/lib/Driver/ToolChains/Clang.cpp

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index a11a5423b0b9..79a518c2904c 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -2771,7 +2771,8 @@ static void RenderFloatingPointOptions(const ToolChain 
, const Driver ,
   if (HonorINFs && HonorNaNs &&
 !AssociativeMath && !ReciprocalMath &&
 SignedZeros && TrappingMath && RoundingFPMath &&
-DenormalFPMath != llvm::DenormalMode::getIEEE() &&
+// FIXME: This should check for IEEE when it's the default.
+DenormalFPMath != llvm::DenormalMode::getInvalid() &&
 FPContract.equals("off"))
 // OK: Current Arg doesn't conflict with -ffp-model=strict
 ;



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


[clang] 53fba65 - [ARCMT][NFC] Reduce #include dependencies

2020-02-12 Thread via cfe-commits

Author: Nicolás Alvarez
Date: 2020-02-12T19:10:46+01:00
New Revision: 53fba65d220499ebc380755aca2da41a5eb33f02

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

LOG: [ARCMT][NFC] Reduce #include dependencies

Replace some #includes in ARCMigrate source files with more specific includes
and forward declarations. This reduces the number of files that need to be
rebuilt when a header changes (and saves like 1 second of build time). For
example, several files no longer need to be rebuilt when the list of static
analyzer checkers(!) changes.

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

Added: 


Modified: 
clang/lib/ARCMigrate/ARCMT.cpp
clang/lib/ARCMigrate/Internals.h
clang/lib/ARCMigrate/Transforms.cpp

Removed: 




diff  --git a/clang/lib/ARCMigrate/ARCMT.cpp b/clang/lib/ARCMigrate/ARCMT.cpp
index 54c32c27b9b4..e18def8a0b19 100644
--- a/clang/lib/ARCMigrate/ARCMT.cpp
+++ b/clang/lib/ARCMigrate/ARCMT.cpp
@@ -7,6 +7,7 @@
 
//===--===//
 
 #include "Internals.h"
+#include "clang/ARCMigrate/ARCMT.h"
 #include "clang/AST/ASTConsumer.h"
 #include "clang/Basic/DiagnosticCategories.h"
 #include "clang/Frontend/ASTUnit.h"

diff  --git a/clang/lib/ARCMigrate/Internals.h 
b/clang/lib/ARCMigrate/Internals.h
index 47fc09317500..ed0136e4867a 100644
--- a/clang/lib/ARCMigrate/Internals.h
+++ b/clang/lib/ARCMigrate/Internals.h
@@ -9,13 +9,15 @@
 #ifndef LLVM_CLANG_LIB_ARCMIGRATE_INTERNALS_H
 #define LLVM_CLANG_LIB_ARCMIGRATE_INTERNALS_H
 
-#include "clang/ARCMigrate/ARCMT.h"
+#include "clang/Basic/LangOptions.h"
 #include "clang/Basic/Diagnostic.h"
+#include "clang/Frontend/MigratorOptions.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/Optional.h"
 #include 
 
 namespace clang {
+  class ASTContext;
   class Sema;
   class Stmt;
 

diff  --git a/clang/lib/ARCMigrate/Transforms.cpp 
b/clang/lib/ARCMigrate/Transforms.cpp
index 59b80a917e56..e274a540e408 100644
--- a/clang/lib/ARCMigrate/Transforms.cpp
+++ b/clang/lib/ARCMigrate/Transforms.cpp
@@ -8,6 +8,7 @@
 
 #include "Transforms.h"
 #include "Internals.h"
+#include "clang/ARCMigrate/ARCMT.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/RecursiveASTVisitor.h"
 #include "clang/Analysis/DomainSpecific/CocoaConventions.h"



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


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

2020-02-12 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

In D71830#1871838 , @JonChesterfield 
wrote:

> Procedural note - adding someone as a blocking reviewer to someone else's 
> patch isn't great. What if the new reviewer never gets around to looking at 
> the patch?
>
> I've adjusted that to non-blocking, but feel free to leave a comment if I've 
> missed something.


I don't know that we have any formalized procedure here, but setting a code 
owner as the blocking reviewer in phab makes it crystal clear that the existing 
LG(s) are insufficient for some reason and someone needs to do a final 
sign-off. It solves the problem of getting a LG from someone who may not be 
familiar with the code base and then making a problematic commit by accident.




Comment at: clang/include/clang/AST/OpenMPClause.h:6543
 
+/// Helper datastructure representing the traits in a match clause of an
+/// `declare variant` or `metadirective`. The outer level is an ordered

datastructure -> data structure



Comment at: clang/include/clang/AST/OpenMPClause.h:6565
+
+  /// Create a variant match infor object from this trait info object. While 
the
+  /// former is a flat representation the actual main difference is that the

infor -> info



Comment at: clang/include/clang/AST/OpenMPClause.h:6573
+
+  /// Print a humand readable representation into \p OS.
+  void print(llvm::raw_ostream , const PrintingPolicy ) const;

humand -> human



Comment at: clang/include/clang/Basic/Attr.td:185
+// An argument of type \p type with name \p name.
+class GenericPointerArgument : Argument {
+  string Type = type;

The name seems a bit strange given that it's not a generic pointer, you specify 
a type with it. It's unclear whether you are supposed to specify the pointer 
type or the base type, which would help a bit. However, it's unclear to me why 
we'd want this generic mechanism in the first place. These classes are intended 
to help generate code to do checking automatically, and this design is somewhat 
at odds with that goal compared to exposing a custom argument type like we did 
for `VersionArgument`. Also, this type is marked optional rather than leaving 
that up to the caller, and the default behavior of a generic pointer argument 
always being default seems suspect.

I'm not saying "get rid of this", just wondering if you had considered the more 
verbose approach and had strong rationale as to why this was a better way.



Comment at: clang/include/clang/Basic/Attr.td:3351
 ExprArgument<"VariantFuncRef">,
-VariadicExprArgument<"Scores">,
-VariadicUnsignedArgument<"CtxSelectorSets">,
-VariadicUnsignedArgument<"CtxSelectors">,
-VariadicStringArgument<"ImplVendors">,
-VariadicStringArgument<"DeviceKinds">
+GenericPointerArgument<"TraitInfos", "OMPTraitInfo*">,
   ];

Just double-checking -- this is not a breaking change to existing code, correct?

It's not yet clear to me how a "generic pointer argument" relates to an 
`OMPTraitInfo` object that the end programmer will have no understanding of 
because it's a compiler implementation detail.

I used to understand what this attribute accepted as arguments and I no longer 
have the foggiest idea, which seems somewhat problematic.



Comment at: clang/include/clang/Basic/DiagnosticParseKinds.td:1262
+def warn_omp_declare_variant_string_literal_or_identifier : Warning<
+  "expected identifier or string literal describing a context 
%select{set|selector|property}0, %select{set|selector|property}0 skipped">,
+  InGroup;

80-col limit

Also, I think the comma should be a semicolon so it reads `...describing a 
context set; selector skipped`



Comment at: clang/include/clang/Basic/DiagnosticParseKinds.td:1267
+def warn_omp_declare_variant_expected : Warning<
+  "expected '%0' after the %1, '%0' assumed">,
+  InGroup;

Turn the comma into a semicolon



Comment at: clang/include/clang/Basic/DiagnosticParseKinds.td:1270
+def warn_omp_declare_variant_ctx_not_a_property : Warning<
+  "'%0' is not a valid context property for the context selector '%1' and the 
context set '%2', property ignored">,
+  InGroup;

80-col limit; please run the patch through clang-format (I'll stop commenting 
on these).



Comment at: clang/include/clang/Basic/DiagnosticParseKinds.td:1277
+def warn_omp_declare_variant_ctx_not_a_selector : Warning<
+  "'%0' is not a valid context selector for the context set '%1', selector 
ignored">,
+  InGroup;

Turn the comma into a semicolon



Comment at: clang/include/clang/Basic/DiagnosticParseKinds.td:1280
+def warn_omp_declare_variant_ctx_not_a_set : Warning<
+  "'%0' is not a valid context set in a `declare variant`, set 

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

2020-02-12 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri accepted this revision.
lebedev.ri added a comment.
This revision is now accepted and ready to land.

LGTM, i guess
Thank you.


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] D74336: [ARM,MVE] Add the vmovlbq,vmovltq intrinsic family.

2020-02-12 Thread Dave Green via Phabricator via cfe-commits
dmgreen accepted this revision.
dmgreen added a comment.
This revision is now accepted and ready to land.

I think these odd shuffle then extend patterns might come up in codegen too, so 
this looks like a nice change.

LGTM, if the test is just a test case problem.




Comment at: llvm/lib/Target/ARM/ARMInstrMVE.td:2397
 
+  let Predicates = [IsLE,HasMVEInt] in {
+def : Pat<(sext_inreg (v8i16 (bitconvert (ARMvrev16 (v16i8 MQPR:$src,

Perhaps move this down to outside of the `let Predicates = [HasMVEInt]` in 
block?

I also like it when Pats make it obvious what the input and the output are:
def : Pat<(ARMvbicImm (v8i16 (bitconvert (ARMvrev16 (v16i8 MQPR:$src,
  (i32 0xAFF)),
  (MVE_VMOVLu8th MQPR:$src)>;

Those are just minor Nitpicks though.



Comment at: llvm/test/CodeGen/Thumb2/mve-shuffleext.ll:40
 ; CHECK:   @ %bb.0: @ %entry
-; CHECK-NEXT:vrev32.16 q0, q0
-; CHECK-NEXT:vmovlb.u16 q0, q0
+; CHECK-NEXT:vmovlt.s16 q0, q0
 ; CHECK-NEXT:bx lr

vmovlt.u16? Does this need updating like the others?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74336



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


[PATCH] D74490: [Clang] Limit -fintegrated-cc1 to only one TU

2020-02-12 Thread Alexandre Ganea via Phabricator via cfe-commits
aganea marked 2 inline comments as done.
aganea added inline comments.



Comment at: clang/include/clang/Driver/Job.h:87
+  /// Whether to print the input filenames when executing.
+  bool PrintInputFilenames;
+

I forgot to put back the default value(s) here, I'll do it before landing.



Comment at: clang/tools/driver/cc1_main.cpp:262
   llvm::timeTraceProfilerCleanup();
+  Clang->clearOutputFiles(false);
 }

I'll commit this separately, this is not a requirement for this patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74490



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


[PATCH] D74399: [Driver][RISCV] Add RedHat Linux RISC-V triple

2020-02-12 Thread Luís Marques via Phabricator via cfe-commits
luismarques updated this revision to Diff 244211.
luismarques added a comment.

Correct paths.


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

https://reviews.llvm.org/D74399

Files:
  clang/lib/Driver/ToolChains/Gnu.cpp
  
clang/test/Driver/Inputs/fedora_31_riscv64_tree/usr/lib/gcc/riscv64-redhat-linux/9/crtbegin.o
  
clang/test/Driver/Inputs/fedora_31_riscv64_tree/usr/lib/gcc/riscv64-redhat-linux/9/crtend.o
  
clang/test/Driver/Inputs/fedora_31_riscv64_tree/usr/lib/gcc/riscv64-redhat-linux/9/crti.o
  
clang/test/Driver/Inputs/fedora_31_riscv64_tree/usr/lib/gcc/riscv64-redhat-linux/9/crtn.o
  clang/test/Driver/Inputs/fedora_31_riscv64_tree/usr/lib64/crt1.o
  clang/test/Driver/linux-ld.c


Index: clang/test/Driver/linux-ld.c
===
--- clang/test/Driver/linux-ld.c
+++ clang/test/Driver/linux-ld.c
@@ -769,6 +769,21 @@
 // CHECK-FEDORA-21-AARCH64: 
"{{.*}}/usr/lib/gcc/aarch64-redhat-linux/4.9.0{{/|}}crtend.o"
 // CHECK-FEDORA-21-AARCH64: 
"{{.*}}/usr/lib/gcc/aarch64-redhat-linux/4.9.0/../../../../lib64{{/|}}crtn.o"
 //
+// Check Fedora 31 on riscv64.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: --target=riscv64-redhat-linux -rtlib=platform \
+// RUN: --gcc-toolchain="" \
+// RUN: --sysroot=%S/Inputs/fedora_31_riscv64_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-FEDORA-31-RISCV64 %s
+// CHECK-FEDORA-31-RISCV64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-FEDORA-31-RISCV64: 
"{{.*}}/usr/lib/gcc/riscv64-redhat-linux/9/../../../../lib64{{/|}}crt1.o"
+// CHECK-FEDORA-31-RISCV64: 
"{{.*}}/usr/lib/gcc/riscv64-redhat-linux/9{{/|}}crti.o"
+// CHECK-FEDORA-31-RISCV64: 
"{{.*}}/usr/lib/gcc/riscv64-redhat-linux/9{{/|}}crtbegin.o"
+// CHECK-FEDORA-31-RISCV64: "-L[[SYSROOT]]/usr/lib/gcc/riscv64-redhat-linux/9"
+// CHECK-FEDORA-31-RISCV64: 
"-L[[SYSROOT]]/usr/lib/gcc/riscv64-redhat-linux/9/../../../../lib64"
+// CHECK-FEDORA-31-RISCV64: 
"{{.*}}/usr/lib/gcc/riscv64-redhat-linux/9{{/|}}crtend.o"
+// CHECK-FEDORA-31-RISCV64: 
"{{.*}}/usr/lib/gcc/riscv64-redhat-linux/9{{/|}}crtn.o"
+//
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
 // RUN: --target=arm-unknown-linux-gnueabi -rtlib=platform \
 // RUN: --gcc-toolchain="" \
Index: clang/lib/Driver/ToolChains/Gnu.cpp
===
--- clang/lib/Driver/ToolChains/Gnu.cpp
+++ clang/lib/Driver/ToolChains/Gnu.cpp
@@ -2090,6 +2090,7 @@
   static const char *const RISCV64Triples[] = {"riscv64-unknown-linux-gnu",
"riscv64-linux-gnu",
"riscv64-unknown-elf",
+   "riscv64-redhat-linux",
"riscv64-suse-linux"};
 
   static const char *const SPARCv8LibDirs[] = {"/lib32", "/lib"};


Index: clang/test/Driver/linux-ld.c
===
--- clang/test/Driver/linux-ld.c
+++ clang/test/Driver/linux-ld.c
@@ -769,6 +769,21 @@
 // CHECK-FEDORA-21-AARCH64: "{{.*}}/usr/lib/gcc/aarch64-redhat-linux/4.9.0{{/|}}crtend.o"
 // CHECK-FEDORA-21-AARCH64: "{{.*}}/usr/lib/gcc/aarch64-redhat-linux/4.9.0/../../../../lib64{{/|}}crtn.o"
 //
+// Check Fedora 31 on riscv64.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: --target=riscv64-redhat-linux -rtlib=platform \
+// RUN: --gcc-toolchain="" \
+// RUN: --sysroot=%S/Inputs/fedora_31_riscv64_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-FEDORA-31-RISCV64 %s
+// CHECK-FEDORA-31-RISCV64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-FEDORA-31-RISCV64: "{{.*}}/usr/lib/gcc/riscv64-redhat-linux/9/../../../../lib64{{/|}}crt1.o"
+// CHECK-FEDORA-31-RISCV64: "{{.*}}/usr/lib/gcc/riscv64-redhat-linux/9{{/|}}crti.o"
+// CHECK-FEDORA-31-RISCV64: "{{.*}}/usr/lib/gcc/riscv64-redhat-linux/9{{/|}}crtbegin.o"
+// CHECK-FEDORA-31-RISCV64: "-L[[SYSROOT]]/usr/lib/gcc/riscv64-redhat-linux/9"
+// CHECK-FEDORA-31-RISCV64: "-L[[SYSROOT]]/usr/lib/gcc/riscv64-redhat-linux/9/../../../../lib64"
+// CHECK-FEDORA-31-RISCV64: "{{.*}}/usr/lib/gcc/riscv64-redhat-linux/9{{/|}}crtend.o"
+// CHECK-FEDORA-31-RISCV64: "{{.*}}/usr/lib/gcc/riscv64-redhat-linux/9{{/|}}crtn.o"
+//
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
 // RUN: --target=arm-unknown-linux-gnueabi -rtlib=platform \
 // RUN: --gcc-toolchain="" \
Index: clang/lib/Driver/ToolChains/Gnu.cpp
===
--- clang/lib/Driver/ToolChains/Gnu.cpp
+++ clang/lib/Driver/ToolChains/Gnu.cpp
@@ -2090,6 +2090,7 @@
   static const char *const RISCV64Triples[] = {"riscv64-unknown-linux-gnu",
"riscv64-linux-gnu",

[clang] f6a3ac1 - Fix `-Wunused-variable` warning. NFC.

2020-02-12 Thread Michael Liao via cfe-commits

Author: Michael Liao
Date: 2020-02-12T12:45:14-05:00
New Revision: f6a3ac150b8d9f3458f526cf76ebcd545bfc1898

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

LOG: Fix `-Wunused-variable` warning. NFC.

Added: 


Modified: 
clang/lib/CodeGen/TargetInfo.cpp

Removed: 




diff  --git a/clang/lib/CodeGen/TargetInfo.cpp 
b/clang/lib/CodeGen/TargetInfo.cpp
index 905440febb51..e40f24d0ca4d 100644
--- a/clang/lib/CodeGen/TargetInfo.cpp
+++ b/clang/lib/CodeGen/TargetInfo.cpp
@@ -7578,7 +7578,7 @@ ABIArgInfo HexagonABIInfo::classifyReturnType(QualType 
RetTy) const {
   const TargetInfo  = CGT.getTarget();
   uint64_t Size = getContext().getTypeSize(RetTy);
 
-  if (const auto *VecTy = RetTy->getAs()) {
+  if (RetTy->getAs()) {
 // HVX vectors are returned in vector registers or register pairs.
 if (T.hasFeature("hvx")) {
   assert(T.hasFeature("hvx-length64b") || T.hasFeature("hvx-length128b"));



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


[PATCH] D72954: [clang-doc] Improving Markdown Output

2020-02-12 Thread Clayton Wilkinson via Phabricator via cfe-commits
Clayton updated this revision to Diff 244204.
Clayton added a comment.

Making paths in markdown files be posix style. This fixes the tests on windows 
hosts.


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

https://reviews.llvm.org/D72954

Files:
  clang-tools-extra/clang-doc/HTMLGenerator.cpp
  clang-tools-extra/clang-doc/MDGenerator.cpp
  clang-tools-extra/clang-doc/Representation.cpp
  clang-tools-extra/clang-doc/Representation.h
  clang-tools-extra/clang-doc/assets/index.js
  clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
  clang-tools-extra/test/clang-doc/single-file.cpp
  clang-tools-extra/unittests/clang-doc/HTMLGeneratorTest.cpp
  clang-tools-extra/unittests/clang-doc/MDGeneratorTest.cpp

Index: clang-tools-extra/unittests/clang-doc/MDGeneratorTest.cpp
===
--- clang-tools-extra/unittests/clang-doc/MDGeneratorTest.cpp
+++ clang-tools-extra/unittests/clang-doc/MDGeneratorTest.cpp
@@ -47,14 +47,12 @@
 
 ## Namespaces
 
-ChildNamespace
-
+* [ChildNamespace](../ChildNamespace/index.md)
 
 
 ## Records
 
-ChildStruct
-
+* [ChildStruct](../ChildStruct.md)
 
 
 ## Functions
@@ -106,7 +104,7 @@
   assert(!Err);
   std::string Expected = R"raw(# class r
 
-*Defined at line 10 of test.cpp*
+*Defined at test.cpp#10*
 
 Inherits from F, G
 
@@ -171,7 +169,7 @@
 
 *void f(int P)*
 
-*Defined at line 10 of test.cpp*
+*Defined at test.cpp#10*
 
 )raw";
 
@@ -202,7 +200,7 @@
 | X |
 
 
-*Defined at line 10 of test.cpp*
+*Defined at test.cpp#10*
 
 )raw";
 
@@ -331,7 +329,7 @@
 
 *void f(int I, int J)*
 
-*Defined at line 10 of test.cpp*
+*Defined at test.cpp#10*
 
 
 
Index: clang-tools-extra/unittests/clang-doc/HTMLGeneratorTest.cpp
===
--- clang-tools-extra/unittests/clang-doc/HTMLGeneratorTest.cpp
+++ clang-tools-extra/unittests/clang-doc/HTMLGeneratorTest.cpp
@@ -63,24 +63,24 @@
   std::string Expected = R"raw(
 
 namespace Namespace
-
-
-
+
+
+
 test-project
 
-  
+  
   
 namespace Namespace
 Namespaces
 
   
-ChildNamespace
+ChildNamespace
   
 
 Records
 
   
-ChildStruct
+ChildStruct
   
 
 Functions
@@ -196,14 +196,14 @@
 
   
 private 
-int
+int
  X
   
 
 Records
 
   
-ChildStruct
+ChildStruct
   
 
 Functions
Index: clang-tools-extra/test/clang-doc/single-file.cpp
===
--- clang-tools-extra/test/clang-doc/single-file.cpp
+++ clang-tools-extra/test/clang-doc/single-file.cpp
@@ -3,7 +3,7 @@
 // RUN: echo "" > %t/compile_flags.txt
 // RUN: cp "%s" "%t/test.cpp"
 // RUN: clang-doc --doxygen --executor=standalone -p %t %t/test.cpp -output=%t/docs
-// RUN: cat %t/docs/GlobalNamespace.yaml | FileCheck %s --check-prefix=CHECK
+// RUN: cat %t/docs/GlobalNamespace/index.yaml | FileCheck %s --check-prefix=CHECK
 // RUN: rm -rf %t
 
 void function(int x);
@@ -12,20 +12,20 @@
 
 // CHECK: ---
 // CHECK-NEXT: USR: '{{[0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z]}}'
-// CHECK-NEXT: ChildFunctions:  
+// CHECK-NEXT: ChildFunctions:
 // CHECK-NEXT:   - USR: '{{[0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z]}}'
 // CHECK-NEXT:Name:'function'
-// CHECK-NEXT:DefLocation: 
+// CHECK-NEXT:DefLocation:
 // CHECK-NEXT:  LineNumber:  [[@LINE-8]]
 // CHECK-NEXT:  Filename:'{{.*}}
-// CHECK-NEXT:Location:
+// CHECK-NEXT:Location:
 // CHECK-NEXT:  - LineNumber:  [[@LINE-13]]
 // CHECK-NEXT:Filename:'{{.*}}'
-// CHECK-NEXT:Params:  
-// CHECK-NEXT:  - Type:
+// CHECK-NEXT:Params:
+// CHECK-NEXT:  - Type:
 // CHECK-NEXT:  Name:'int'
 // CHECK-NEXT:Name:'x'
-// CHECK-NEXT:ReturnType:  
-// CHECK-NEXT:  Type:
+// CHECK-NEXT:ReturnType:
+// CHECK-NEXT:  Type:
 // CHECK-NEXT:Name:'void'
 // CHECK-NEXT:...
Index: clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
===
--- clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
+++ clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
@@ -294,8 +294,9 @@
   }
 
   doc::Info *I = 

[PATCH] D72954: [clang-doc] Improving Markdown Output

2020-02-12 Thread Clayton Wilkinson via Phabricator via cfe-commits
Clayton reopened this revision.
Clayton added a comment.
This revision is now accepted and ready to land.

Re-opening to  fix windows tests failures.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72954



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


[PATCH] D69979: clang: Guess at some platform FTZ/DAZ default settings

2020-02-12 Thread Matt Arsenault via Phabricator via cfe-commits
arsenm closed this revision.
arsenm added a comment.

fa7cd549d604bfd8f9dce5d649a19720cbc39cca 



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

https://reviews.llvm.org/D69979



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


[clang] fa7cd54 - clang: Guess at some platform FTZ/DAZ default settings

2020-02-12 Thread Matt Arsenault via cfe-commits

Author: Matt Arsenault
Date: 2020-02-12T12:09:26-05:00
New Revision: fa7cd549d604bfd8f9dce5d649a19720cbc39cca

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

LOG: clang: Guess at some platform FTZ/DAZ default settings

This is to avoid performance regressions when the default attribute
behavior is fixed to assume ieee.

I tested the default on x86_64 ubuntu, which seems to default to
FTZ/DAZ, but am guessing for x86 and PS4.

Added: 
clang/test/Driver/default-denormal-fp-math.c

Modified: 
clang/include/clang/Driver/ToolChain.h
clang/lib/Driver/ToolChain.cpp
clang/lib/Driver/ToolChains/Gnu.cpp
clang/lib/Driver/ToolChains/Linux.cpp
clang/lib/Driver/ToolChains/Linux.h
clang/lib/Driver/ToolChains/MinGW.cpp
clang/lib/Driver/ToolChains/PS4CPU.h

Removed: 




diff  --git a/clang/include/clang/Driver/ToolChain.h 
b/clang/include/clang/Driver/ToolChain.h
index 09f145844641..400ff9d86664 100644
--- a/clang/include/clang/Driver/ToolChain.h
+++ b/clang/include/clang/Driver/ToolChain.h
@@ -573,12 +573,19 @@ class ToolChain {
   virtual void AddCCKextLibArgs(const llvm::opt::ArgList ,
 llvm::opt::ArgStringList ) const;
 
+  /// If a runtime library exists that sets global flags for unsafe floating
+  /// point math, return true.
+  ///
+  /// This checks for presence of the -Ofast, -ffast-math or -funsafe-math 
flags.
+  virtual bool isFastMathRuntimeAvailable(
+const llvm::opt::ArgList , std::string ) const;
+
   /// AddFastMathRuntimeIfAvailable - If a runtime library exists that sets
   /// global flags for unsafe floating point math, add it and return true.
   ///
   /// This checks for presence of the -Ofast, -ffast-math or -funsafe-math 
flags.
-  virtual bool AddFastMathRuntimeIfAvailable(
-  const llvm::opt::ArgList , llvm::opt::ArgStringList ) const;
+  bool addFastMathRuntimeIfAvailable(
+const llvm::opt::ArgList , llvm::opt::ArgStringList ) const;
 
   /// addProfileRTLibs - When -fprofile-instr-profile is specified, try to pass
   /// a suitable profile runtime library to the linker.

diff  --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
index 8aef74f7389e..dad6a1ac08fb 100644
--- a/clang/lib/Driver/ToolChain.cpp
+++ b/clang/lib/Driver/ToolChain.cpp
@@ -917,28 +917,35 @@ void ToolChain::AddCCKextLibArgs(const ArgList ,
   CmdArgs.push_back("-lcc_kext");
 }
 
-bool ToolChain::AddFastMathRuntimeIfAvailable(const ArgList ,
-  ArgStringList ) const {
+bool ToolChain::isFastMathRuntimeAvailable(const ArgList ,
+   std::string ) const {
   // Do not check for -fno-fast-math or -fno-unsafe-math when -Ofast passed
   // (to keep the linker options consistent with gcc and clang itself).
   if (!isOptimizationLevelFast(Args)) {
 // Check if -ffast-math or -funsafe-math.
 Arg *A =
-Args.getLastArg(options::OPT_ffast_math, options::OPT_fno_fast_math,
-options::OPT_funsafe_math_optimizations,
-options::OPT_fno_unsafe_math_optimizations);
+  Args.getLastArg(options::OPT_ffast_math, options::OPT_fno_fast_math,
+  options::OPT_funsafe_math_optimizations,
+  options::OPT_fno_unsafe_math_optimizations);
 
 if (!A || A->getOption().getID() == options::OPT_fno_fast_math ||
 A->getOption().getID() == options::OPT_fno_unsafe_math_optimizations)
   return false;
   }
   // If crtfastmath.o exists add it to the arguments.
-  std::string Path = GetFilePath("crtfastmath.o");
-  if (Path == "crtfastmath.o") // Not found.
-return false;
+  Path = GetFilePath("crtfastmath.o");
+  return (Path != "crtfastmath.o"); // Not found.
+}
+
+bool ToolChain::addFastMathRuntimeIfAvailable(const ArgList ,
+  ArgStringList ) const {
+  std::string Path;
+  if (isFastMathRuntimeAvailable(Args, Path)) {
+CmdArgs.push_back(Args.MakeArgString(Path));
+return true;
+  }
 
-  CmdArgs.push_back(Args.MakeArgString(Path));
-  return true;
+  return false;
 }
 
 SanitizerMask ToolChain::getSupportedSanitizers() const {

diff  --git a/clang/lib/Driver/ToolChains/Gnu.cpp 
b/clang/lib/Driver/ToolChains/Gnu.cpp
index 79a7461a9a5a..bc67a7e0cdf9 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -502,7 +502,7 @@ void tools::gnutools::Linker::ConstructJob(Compilation , 
const JobAction ,
 }
 
 // Add crtfastmath.o if available and fast math is enabled.
-ToolChain.AddFastMathRuntimeIfAvailable(Args, CmdArgs);
+ToolChain.addFastMathRuntimeIfAvailable(Args, CmdArgs);
   }
 
   Args.AddAllArgs(CmdArgs, options::OPT_L);

diff  

[PATCH] D74490: [Clang] Limit -fintegrated-cc1 to only one TU

2020-02-12 Thread Reid Kleckner via Phabricator via cfe-commits
rnk accepted this revision.
rnk added a comment.
This revision is now accepted and ready to land.

lgtm




Comment at: clang/test/Driver/cc1-spawnprocess.c:9
 
-// RUN: %clang_cl -fintegrated-cc1 -### -- %s 2>&1 \
+// RUN: %clang_cl -fintegrated-cc1 -c -### -- %s 2>&1 \
 // RUN: | FileCheck %s --check-prefix=YES

aganea wrote:
> Out of curiosity: what does `--` means to do? (here used along with %s)
It indicates that the remaining args should be interpreted as inputs, not 
flags. We need `--` in the test suite on Mac where %s usually expands to 
`/Users/foo/bar.c`, which looks like `clang-cl /UMYMACRO`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74490



___
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-12 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment.

Ah, yes, we're laxer about these things in C than we are in C++.  If we do 
this, we'll need to go through `DiagnoseAssignmentResult` and make sure that 
everything (except `Compatible`, which we'll never pass) triggers an error in 
C++ mode.

Is there a good reason to just do this for pointer types instead of 
unconditionally calling `CheckAssignmentConstraints`?  It'd be nice to take 
advantage of any specialized diagnostics we have for C/ObjC/whatever in C++ 
mode, and that can apply to a lot of types that aren't pointer types.

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`.

And yeah, it's possible that we'll need to teach that function about some C++ 
cases that it currently never sees.  But I don't think that needs to include 
references, because IIRC reference-binding doesn't go through 
`ImplicitConversionSequence`.


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] D74222: [AArch64][SVE] Add mul/mla/mls lane & dup intrinsics

2020-02-12 Thread Sander de Smalen via Phabricator via cfe-commits
sdesmalen accepted this revision.
sdesmalen 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/D74222/new/

https://reviews.llvm.org/D74222



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


[PATCH] D74490: [Clang] Limit -fintegrated-cc1 to only one TU

2020-02-12 Thread Alexandre Ganea via Phabricator via cfe-commits
aganea marked an inline comment as done.
aganea added inline comments.



Comment at: clang/test/Driver/cc1-spawnprocess.c:9
 
-// RUN: %clang_cl -fintegrated-cc1 -### -- %s 2>&1 \
+// RUN: %clang_cl -fintegrated-cc1 -c -### -- %s 2>&1 \
 // RUN: | FileCheck %s --check-prefix=YES

Out of curiosity: what does `--` means to do? (here used along with %s)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74490



___
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-12 Thread Andy Kaylor via Phabricator via cfe-commits
andrew.w.kaylor added a comment.

lgtm


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] D74384: Use std::foo_t rather than std::foo in LLVM.

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

That landed in 17b77418121139c4e8cfb050d82ead3f29db7132 
. Sounds 
like there's more SFINAE to be fixed here, but my build is happy again. Thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74384



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


[PATCH] D74490: [Clang] Limit -fintegrated-cc1 to only one TU

2020-02-12 Thread Alexandre Ganea via Phabricator via cfe-commits
aganea created this revision.
aganea added reviewers: thakis, rnk, hans, erichkeane.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
aganea marked an inline comment as done.
aganea added inline comments.



Comment at: clang/test/Driver/cc1-spawnprocess.c:9
 
-// RUN: %clang_cl -fintegrated-cc1 -### -- %s 2>&1 \
+// RUN: %clang_cl -fintegrated-cc1 -c -### -- %s 2>&1 \
 // RUN: | FileCheck %s --check-prefix=YES

Out of curiosity: what does `--` means to do? (here used along with %s)


As discussed in D74447 , this patch disables 
integrated-cc1 behavior if there's more than one job to be executed. This is 
meant to limit memory bloating, given that currently jobs don't clean up after 
execution (`-disable-free` is always active in cc1 mode).

I see this behavior as temporary until release 10.0 ships, then we'll 
reevaluate the situation, see if D74447  makes 
more sense on the long term.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D74490

Files:
  clang/include/clang/Driver/Job.h
  clang/lib/Driver/Driver.cpp
  clang/lib/Driver/Job.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/Driver/cc1-spawnprocess.c
  clang/tools/driver/cc1_main.cpp

Index: clang/tools/driver/cc1_main.cpp
===
--- clang/tools/driver/cc1_main.cpp
+++ clang/tools/driver/cc1_main.cpp
@@ -259,6 +259,7 @@
   // FIXME(ibiryukov): make profilerOutput flush in destructor instead.
   profilerOutput->flush();
   llvm::timeTraceProfilerCleanup();
+  Clang->clearOutputFiles(false);
 }
   }
 
Index: clang/test/Driver/cc1-spawnprocess.c
===
--- clang/test/Driver/cc1-spawnprocess.c
+++ clang/test/Driver/cc1-spawnprocess.c
@@ -1,22 +1,37 @@
-// RUN: %clang -fintegrated-cc1 -### %s 2>&1 | FileCheck %s --check-prefix=YES
-// RUN: %clang -fno-integrated-cc1 -### %s 2>&1 | FileCheck %s --check-prefix=NO
+// RUN: %clang -fintegrated-cc1 -c -### %s 2>&1 | FileCheck %s --check-prefix=YES
+// RUN: %clang -fno-integrated-cc1 -c -### %s 2>&1 | FileCheck %s --check-prefix=NO
 
-// RUN: %clang -fintegrated-cc1 -fno-integrated-cc1 -### %s 2>&1 \
+// RUN: %clang -fintegrated-cc1 -fno-integrated-cc1 -c -### %s 2>&1 \
 // RUN: | FileCheck %s --check-prefix=NO
-// RUN: %clang -fno-integrated-cc1 -fintegrated-cc1 -### %s 2>&1 \
+// RUN: %clang -fno-integrated-cc1 -fintegrated-cc1 -c -### %s 2>&1 \
 // RUN: | FileCheck %s --check-prefix=YES
 
-// RUN: %clang_cl -fintegrated-cc1 -### -- %s 2>&1 \
+// RUN: %clang_cl -fintegrated-cc1 -c -### -- %s 2>&1 \
 // RUN: | FileCheck %s --check-prefix=YES
-// RUN: %clang_cl -fno-integrated-cc1 -### -- %s 2>&1 \
+// RUN: %clang_cl -fno-integrated-cc1 -c -### -- %s 2>&1 \
 // RUN: | FileCheck %s --check-prefix=NO
 
 // RUN: env CCC_OVERRIDE_OPTIONS=+-fintegrated-cc1 \
-// RUN: %clang -fintegrated-cc1 -### %s 2>&1 \
+// RUN: %clang -fintegrated-cc1 -c -### %s 2>&1 \
 // RUN: | FileCheck %s --check-prefix=YES
 // RUN: env CCC_OVERRIDE_OPTIONS=+-fno-integrated-cc1 \
-// RUN: %clang -fintegrated-cc1 -### %s 2>&1 \
+// RUN: %clang -fintegrated-cc1 -c -### %s 2>&1 \
 // RUN: | FileCheck %s --check-prefix=NO
 
 // YES: (in-process)
 // NO-NOT: (in-process)
+
+// The following tests ensure that only one integrated-cc1 is executed.
+
+// Only one TU, one job, thus integrated-cc1 is enabled.
+// RUN: %clang -fintegrated-cc1 -c %s -### 2>&1 | FileCheck %s --check-prefix=YES
+
+// Only one TU, but we're linking, two jobs, thus integrated-cc1 is disabled.
+// RUN: %clang -fintegrated-cc1 %s -### 2>&1 | FileCheck %s --check-prefix=NO
+
+// RUN: echo 'int main() { return f() + g(); }' > %t1.cpp
+// RUN: echo 'int f() { return 1; }' > %t2.cpp
+// RUN: echo 'int g() { return 2; }' > %t3.cpp
+
+// Three jobs, thus integrated-cc1 is disabled.
+// RUN: %clang -fintegrated-cc1 -c %t1.cpp %t2.cpp %t3.cpp -### 2>&1 | FileCheck %s --check-prefix=NO
Index: clang/lib/Driver/ToolChains/Clang.cpp
===
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -6147,7 +6147,7 @@
   if (Output.getType() == types::TY_Object &&
   Args.hasFlag(options::OPT__SLASH_showFilenames,
options::OPT__SLASH_showFilenames_, false)) {
-C.getJobs().getJobs().back()->setPrintInputFilenames(true);
+C.getJobs().getJobs().back()->PrintInputFilenames = true;
   }
 
   if (Arg *A = Args.getLastArg(options::OPT_pg))
Index: clang/lib/Driver/Job.cpp
===
--- clang/lib/Driver/Job.cpp
+++ clang/lib/Driver/Job.cpp
@@ -40,7 +40,7 @@
  const llvm::opt::ArgStringList ,
  ArrayRef Inputs)
 : Source(Source), Creator(Creator), 

[PATCH] D71579: [driver][darwin] Pass -platform_version flag to the linker instead of the -_version_min flag

2020-02-12 Thread dmajor via Phabricator via cfe-commits
dmajor added inline comments.



Comment at: clang/lib/Driver/ToolChains/Darwin.cpp:339
   // Add the deployment target.
-  MachOTC.addMinVersionArgs(Args, CmdArgs);
+  if (!Version[0] || Version[0] >= 520)
+MachOTC.addPlatformVersionArgs(Args, CmdArgs);

arphaman wrote:
> steven_wu wrote:
> > Why version '0' should go through the new path?
> Version `0` indicates that `-mlinker-version=` wasn't specified. We want to 
> use the new flag by default.
Hi. Just for anyone who isn't on the bugzilla thread: in 
https://bugs.llvm.org/show_bug.cgi?id=44813 I'd like to reconsider this 
decision about using the flag by default. It is a breaking change and is 
inconsistent with the other treatments of `Version` in this function. What do 
you all think? Thanks.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71579



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


[PATCH] D74385: [ARCMT][NFC] Reduce #include dependencies

2020-02-12 Thread Nicolás Alvarez via Phabricator via cfe-commits
nicolas17 added a comment.

In D74385#1872298 , @serge-sans-paille 
wrote:

> Sure, can you just confirm that you're this guy: https://github.com/nicolas17 
> (I need that for proper email attribution)


Yes that's me :)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74385



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


[PATCH] D74433: [llvm-objdump] Print file format in lowercase to match GNU output.

2020-02-12 Thread Jordan Rupprecht via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG60a8a504f16d: [llvm-objdump] Print file format in lowercase 
to match GNU output. (authored by rupprecht).

Changed prior to commit:
  https://reviews.llvm.org/D74433?vs=243991=244189#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74433

Files:
  clang/test/Modules/pch_container.m
  lld/test/COFF/savetemps.ll
  llvm/test/CodeGen/AArch64/arm64-simplest-elf.ll
  llvm/test/CodeGen/ARM/Windows/trivial-gnu-object.ll
  llvm/test/CodeGen/BPF/reloc-btf-2.ll
  llvm/test/CodeGen/BPF/reloc-btf.ll
  llvm/test/CodeGen/BPF/reloc.ll
  llvm/test/Object/AMDGPU/objdump.s
  llvm/test/Object/X86/objdump-disassembly-inline-relocations.test
  llvm/test/Object/X86/objdump-label.test
  llvm/test/Object/X86/objdump-trivial-object.test
  llvm/test/Object/dynamic-reloc.test
  llvm/test/Object/objdump-symbol-table.test
  llvm/test/tools/llvm-objdump/X86/disassemble-section-name.s
  llvm/test/tools/llvm-objdump/X86/elf-disassemble-symbol-labels-exec.test
  llvm/test/tools/llvm-objdump/X86/elf-dynamic-relocs.test
  llvm/test/tools/llvm-objdump/X86/output-ordering.test
  llvm/test/tools/llvm-objdump/X86/warn-missing-disasm-func.test
  llvm/test/tools/llvm-objdump/all-headers.test
  llvm/test/tools/llvm-objdump/archive-headers.test
  llvm/test/tools/llvm-objdump/file-headers-coff.test
  llvm/test/tools/llvm-objdump/file-headers-elf.test
  llvm/test/tools/llvm-objdump/non-archive-object.test
  llvm/test/tools/llvm-objdump/relocations-in-nonreloc.test
  llvm/tools/llvm-objdump/llvm-objdump.cpp

Index: llvm/tools/llvm-objdump/llvm-objdump.cpp
===
--- llvm/tools/llvm-objdump/llvm-objdump.cpp
+++ llvm/tools/llvm-objdump/llvm-objdump.cpp
@@ -2168,7 +2168,7 @@
   outs() << A->getFileName() << "(" << O->getFileName() << ")";
 else
   outs() << O->getFileName();
-outs() << ":\tfile format " << O->getFileFormatName() << "\n\n";
+outs() << ":\tfile format " << O->getFileFormatName().lower() << "\n\n";
   }
 
   if (StartAddress.getNumOccurrences() || StopAddress.getNumOccurrences())
Index: llvm/test/tools/llvm-objdump/relocations-in-nonreloc.test
===
--- llvm/test/tools/llvm-objdump/relocations-in-nonreloc.test
+++ llvm/test/tools/llvm-objdump/relocations-in-nonreloc.test
@@ -7,7 +7,7 @@
 # RUN: yaml2obj --docnum=3 %s -o %t3
 # RUN: llvm-objdump -r %t3 | FileCheck %s -DFILE=%t3 --check-prefixes=FMT,REL --implicit-check-not={{.}}
 
-# FMT: [[FILE]]: file format ELF64-x86-64
+# FMT: [[FILE]]: file format elf64-x86-64
 
 # REL:  RELOCATION RECORDS FOR []:
 # REL-NEXT: OFFSET   TYPE VALUE
Index: llvm/test/tools/llvm-objdump/non-archive-object.test
===
--- llvm/test/tools/llvm-objdump/non-archive-object.test
+++ llvm/test/tools/llvm-objdump/non-archive-object.test
@@ -2,7 +2,7 @@
 # RUN: llvm-objdump -a %t | FileCheck %s
 
 # If this test has not crashed, then this test passed.
-# CHECK: file format ELF64-x86-64
+# CHECK: file format elf64-x86-64
 
 !ELF
 FileHeader:
Index: llvm/test/tools/llvm-objdump/file-headers-elf.test
===
--- llvm/test/tools/llvm-objdump/file-headers-elf.test
+++ llvm/test/tools/llvm-objdump/file-headers-elf.test
@@ -10,7 +10,7 @@
   Machine: EM_X86_64
   Entry:   0x123456789abcde
 
-# ELF64: [[FILE]]: file format ELF64-x86-64
+# ELF64: [[FILE]]: file format elf64-x86-64
 # ELF64: architecture: x86_64
 # ELF64: start address: 0x00123456789abcde
 
@@ -18,7 +18,7 @@
 # RUN: llvm-objdump -f %t-i386 | FileCheck -DFILE=%t-i386 %s -check-prefix ELF32
 # RUN: llvm-objdump -file-headers %t-i386 | FileCheck %s -DFILE=%t-i386 -check-prefix ELF32
 
-# ELF32: [[FILE]]: file format ELF32-i386
+# ELF32: [[FILE]]: file format elf32-i386
 # ELF32: architecture: i386
 # ELF32: start address: 0x12345678
 
Index: llvm/test/tools/llvm-objdump/file-headers-coff.test
===
--- llvm/test/tools/llvm-objdump/file-headers-coff.test
+++ llvm/test/tools/llvm-objdump/file-headers-coff.test
@@ -9,6 +9,6 @@
 sections:
 symbols:
 
-# CHECK: [[FILE]]: file format COFF-i386
+# CHECK: [[FILE]]: file format coff-i386
 # CHECK: architecture: i386
 # CHECK: start address: 0x
Index: llvm/test/tools/llvm-objdump/archive-headers.test
===
--- llvm/test/tools/llvm-objdump/archive-headers.test
+++ llvm/test/tools/llvm-objdump/archive-headers.test
@@ -1,21 +1,21 @@
 # RUN: llvm-objdump -a %p/Inputs/liblong_filenames.a | FileCheck %s
 # RUN: llvm-objdump -archive-headers %p/Inputs/liblong_filenames.a | FileCheck %s
 
-# CHECK: 

[clang] 60a8a50 - [llvm-objdump] Print file format in lowercase to match GNU output.

2020-02-12 Thread Jordan Rupprecht via cfe-commits

Author: Jordan Rupprecht
Date: 2020-02-12T08:17:01-08:00
New Revision: 60a8a504f16dbbc5f2a6887ecb668ef4cb834949

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

LOG: [llvm-objdump] Print file format in lowercase to match GNU output.

Summary:
GNU objdump prints the file format in lowercase, e.g. `elf64-x86-64`. 
llvm-objdump prints `ELF64-x86-64` right now, even though piping that into 
llvm-objcopy refuses that as a valid arch to use.

As an example of a problem this causes, see: 
https://github.com/ClangBuiltLinux/linux/issues/779

Reviewers: MaskRay, jhenderson, alexshap

Reviewed By: MaskRay

Subscribers: tpimh, sbc100, grimar, jvesely, nhaehnle, kerbowa, cfe-commits, 
llvm-commits

Tags: #clang, #llvm

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

Added: 


Modified: 
clang/test/Modules/pch_container.m
lld/test/COFF/savetemps.ll
llvm/test/CodeGen/AArch64/arm64-simplest-elf.ll
llvm/test/CodeGen/ARM/Windows/trivial-gnu-object.ll
llvm/test/CodeGen/BPF/reloc-btf-2.ll
llvm/test/CodeGen/BPF/reloc-btf.ll
llvm/test/CodeGen/BPF/reloc.ll
llvm/test/Object/AMDGPU/objdump.s
llvm/test/Object/X86/objdump-disassembly-inline-relocations.test
llvm/test/Object/X86/objdump-label.test
llvm/test/Object/X86/objdump-trivial-object.test
llvm/test/Object/dynamic-reloc.test
llvm/test/Object/objdump-symbol-table.test
llvm/test/tools/llvm-objdump/X86/disassemble-section-name.s
llvm/test/tools/llvm-objdump/X86/elf-disassemble-symbol-labels-exec.test
llvm/test/tools/llvm-objdump/X86/elf-dynamic-relocs.test
llvm/test/tools/llvm-objdump/X86/output-ordering.test
llvm/test/tools/llvm-objdump/X86/warn-missing-disasm-func.test
llvm/test/tools/llvm-objdump/all-headers.test
llvm/test/tools/llvm-objdump/archive-headers.test
llvm/test/tools/llvm-objdump/file-headers-coff.test
llvm/test/tools/llvm-objdump/file-headers-elf.test
llvm/test/tools/llvm-objdump/non-archive-object.test
llvm/test/tools/llvm-objdump/relocations-in-nonreloc.test
llvm/tools/llvm-objdump/llvm-objdump.cpp

Removed: 




diff  --git a/clang/test/Modules/pch_container.m 
b/clang/test/Modules/pch_container.m
index 77cd5f352bc9..ed13baf2d26c 100644
--- a/clang/test/Modules/pch_container.m
+++ b/clang/test/Modules/pch_container.m
@@ -8,11 +8,11 @@
 
 
 // RUN: llvm-objdump --section-headers %t-MachO/DependsOnModule.pcm 
%t-ELF/DependsOnModule.pcm %t-COFF/DependsOnModule.pcm | FileCheck %s
-// CHECK: file format Mach-O 64-bit x86-64
+// CHECK: file format mach-o 64-bit x86-64
 // CHECK: __clangast   {{[0-9a-f]+}} {{[0-9a-f]+}} DATA
-// CHECK: file format ELF64-x86-64
+// CHECK: file format elf64-x86-64
 // CHECK: __clangast   {{[0-9a-f]+}} {{[0-9a-f]+}} DATA
-// CHECK: file format COFF-x86-64
+// CHECK: file format coff-x86-64
 // CHECK: clangast   {{[0-9a-f]+}} {{[0-9a-f]+}}
 
 // RUN: not llvm-objdump --section-headers %t-raw/DependsOnModule.pcm

diff  --git a/lld/test/COFF/savetemps.ll b/lld/test/COFF/savetemps.ll
index e755ba9920d3..46a4958d2f78 100644
--- a/lld/test/COFF/savetemps.ll
+++ b/lld/test/COFF/savetemps.ll
@@ -19,7 +19,7 @@
 ; RUN: FileCheck --check-prefix=CHECK-OBJDUMP %s
 
 ; CHECK: define i32 @main()
-; CHECK-OBJDUMP: file format COFF
+; CHECK-OBJDUMP: file format coff
 
 target datalayout = 
"e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-pc-windows-msvc"

diff  --git a/llvm/test/CodeGen/AArch64/arm64-simplest-elf.ll 
b/llvm/test/CodeGen/AArch64/arm64-simplest-elf.ll
index 1254365b8205..58691f8ffcd2 100644
--- a/llvm/test/CodeGen/AArch64/arm64-simplest-elf.ll
+++ b/llvm/test/CodeGen/AArch64/arm64-simplest-elf.ll
@@ -11,7 +11,7 @@ define void @foo() nounwind {
 
   ; Similarly make sure ELF output works and is vaguely sane: aarch64 target
   ; machine with correct section & symbol names.
-; CHECK-ELF: file format ELF64-aarch64
+; CHECK-ELF: file format elf64-aarch64
 
 ; CHECK-ELF: Disassembly of section .text
 ; CHECK-ELF-LABEL: foo:

diff  --git a/llvm/test/CodeGen/ARM/Windows/trivial-gnu-object.ll 
b/llvm/test/CodeGen/ARM/Windows/trivial-gnu-object.ll
index a242f39601cb..2d55f218ddce 100644
--- a/llvm/test/CodeGen/ARM/Windows/trivial-gnu-object.ll
+++ b/llvm/test/CodeGen/ARM/Windows/trivial-gnu-object.ll
@@ -2,7 +2,7 @@
 ; RUN: llc -mtriple=thumbv7-windows-gnu -filetype=obj -o - %s | llvm-objdump 
-d - | FileCheck %s
 
 define void @foo() {
-; CHECK: file format COFF-ARM
+; CHECK: file format coff-arm
 
 ; CHECK-LABEL: foo:
 ; CHECK: bx lr

diff  --git a/llvm/test/CodeGen/BPF/reloc-btf-2.ll 
b/llvm/test/CodeGen/BPF/reloc-btf-2.ll
index 2afeb24bae48..68f00081d7d7 100644
--- a/llvm/test/CodeGen/BPF/reloc-btf-2.ll
+++ b/llvm/test/CodeGen/BPF/reloc-btf-2.ll
@@ -21,7 +21,7 

[PATCH] D74399: [Driver][RISCV] Add RedHat Linux RISC-V triple

2020-02-12 Thread Luís Marques via Phabricator via cfe-commits
luismarques updated this revision to Diff 244187.
luismarques added a comment.
Herald added subscribers: apazos, pzheng, jocewei, the_o, brucehoult, 
MartinMosbeck, edward-jones, zzheng, niosHD, sabuasal, johnrusso, rbar.

Adds a test (using the RISC-V Fedora 31 paths).


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

https://reviews.llvm.org/D74399

Files:
  clang/lib/Driver/ToolChains/Gnu.cpp
  
clang/test/Driver/Inputs/fedora_31_riscv64_tree/usr/lib/gcc/riscv64-redhat-linux/9/crtbegin.o
  
clang/test/Driver/Inputs/fedora_31_riscv64_tree/usr/lib/gcc/riscv64-redhat-linux/9/crtend.o
  clang/test/Driver/Inputs/fedora_31_riscv64_tree/usr/lib64/crt1.o
  clang/test/Driver/Inputs/fedora_31_riscv64_tree/usr/lib64/crti.o
  clang/test/Driver/Inputs/fedora_31_riscv64_tree/usr/lib64/crtn.o
  clang/test/Driver/linux-ld.c


Index: clang/test/Driver/linux-ld.c
===
--- clang/test/Driver/linux-ld.c
+++ clang/test/Driver/linux-ld.c
@@ -769,6 +769,21 @@
 // CHECK-FEDORA-21-AARCH64: 
"{{.*}}/usr/lib/gcc/aarch64-redhat-linux/4.9.0{{/|}}crtend.o"
 // CHECK-FEDORA-21-AARCH64: 
"{{.*}}/usr/lib/gcc/aarch64-redhat-linux/4.9.0/../../../../lib64{{/|}}crtn.o"
 //
+// Check Fedora 31 on riscv64.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: --target=riscv64-redhat-linux -rtlib=platform \
+// RUN: --gcc-toolchain="" \
+// RUN: --sysroot=%S/Inputs/fedora_31_riscv64_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-FEDORA-31-RISCV64 %s
+// CHECK-FEDORA-31-RISCV64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-FEDORA-31-RISCV64: 
"{{.*}}/usr/lib/gcc/riscv64-redhat-linux/9/../../../../lib64{{/|}}crt1.o"
+// CHECK-FEDORA-31-RISCV64: 
"{{.*}}/usr/lib/gcc/riscv64-redhat-linux/9/../../../../lib64{{/|}}crti.o"
+// CHECK-FEDORA-31-RISCV64: 
"{{.*}}/usr/lib/gcc/riscv64-redhat-linux/9{{/|}}crtbegin.o"
+// CHECK-FEDORA-31-RISCV64: "-L[[SYSROOT]]/usr/lib/gcc/riscv64-redhat-linux/9"
+// CHECK-FEDORA-31-RISCV64: 
"-L[[SYSROOT]]/usr/lib/gcc/riscv64-redhat-linux/9/../../../../lib64"
+// CHECK-FEDORA-31-RISCV64: 
"{{.*}}/usr/lib/gcc/riscv64-redhat-linux/9{{/|}}crtend.o"
+// CHECK-FEDORA-31-RISCV64: 
"{{.*}}/usr/lib/gcc/riscv64-redhat-linux/9/../../../../lib64{{/|}}crtn.o"
+//
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
 // RUN: --target=arm-unknown-linux-gnueabi -rtlib=platform \
 // RUN: --gcc-toolchain="" \
Index: clang/lib/Driver/ToolChains/Gnu.cpp
===
--- clang/lib/Driver/ToolChains/Gnu.cpp
+++ clang/lib/Driver/ToolChains/Gnu.cpp
@@ -2090,6 +2090,7 @@
   static const char *const RISCV64Triples[] = {"riscv64-unknown-linux-gnu",
"riscv64-linux-gnu",
"riscv64-unknown-elf",
+   "riscv64-redhat-linux",
"riscv64-suse-linux"};
 
   static const char *const SPARCv8LibDirs[] = {"/lib32", "/lib"};


Index: clang/test/Driver/linux-ld.c
===
--- clang/test/Driver/linux-ld.c
+++ clang/test/Driver/linux-ld.c
@@ -769,6 +769,21 @@
 // CHECK-FEDORA-21-AARCH64: "{{.*}}/usr/lib/gcc/aarch64-redhat-linux/4.9.0{{/|}}crtend.o"
 // CHECK-FEDORA-21-AARCH64: "{{.*}}/usr/lib/gcc/aarch64-redhat-linux/4.9.0/../../../../lib64{{/|}}crtn.o"
 //
+// Check Fedora 31 on riscv64.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: --target=riscv64-redhat-linux -rtlib=platform \
+// RUN: --gcc-toolchain="" \
+// RUN: --sysroot=%S/Inputs/fedora_31_riscv64_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-FEDORA-31-RISCV64 %s
+// CHECK-FEDORA-31-RISCV64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-FEDORA-31-RISCV64: "{{.*}}/usr/lib/gcc/riscv64-redhat-linux/9/../../../../lib64{{/|}}crt1.o"
+// CHECK-FEDORA-31-RISCV64: "{{.*}}/usr/lib/gcc/riscv64-redhat-linux/9/../../../../lib64{{/|}}crti.o"
+// CHECK-FEDORA-31-RISCV64: "{{.*}}/usr/lib/gcc/riscv64-redhat-linux/9{{/|}}crtbegin.o"
+// CHECK-FEDORA-31-RISCV64: "-L[[SYSROOT]]/usr/lib/gcc/riscv64-redhat-linux/9"
+// CHECK-FEDORA-31-RISCV64: "-L[[SYSROOT]]/usr/lib/gcc/riscv64-redhat-linux/9/../../../../lib64"
+// CHECK-FEDORA-31-RISCV64: "{{.*}}/usr/lib/gcc/riscv64-redhat-linux/9{{/|}}crtend.o"
+// CHECK-FEDORA-31-RISCV64: "{{.*}}/usr/lib/gcc/riscv64-redhat-linux/9/../../../../lib64{{/|}}crtn.o"
+//
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
 // RUN: --target=arm-unknown-linux-gnueabi -rtlib=platform \
 // RUN: --gcc-toolchain="" \
Index: clang/lib/Driver/ToolChains/Gnu.cpp
===
--- clang/lib/Driver/ToolChains/Gnu.cpp
+++ clang/lib/Driver/ToolChains/Gnu.cpp
@@ -2090,6 +2090,7 @@
   

[PATCH] D74384: Use std::foo_t rather than std::foo in LLVM.

2020-02-12 Thread Justin Lebar via Phabricator via cfe-commits
jlebar added a comment.

In D74384#1872246 , @thakis wrote:

> Looks like this broke building on windows with clang-cl as host compiler in 
> some situations: http://45.33.8.238/win/8160/step_4.txt


I'm testing out the following fix, which we verified works for Nico.

No idea why this only affects clang-cl.  SFINAE is hard.

  commit 10cf8de244df1402c2b87205f427440fb4c0d7b9
  Author: Justin Lebar 
  Date:   Wed Feb 12 08:05:00 2020 -0800
  
  Fix compilation of Any.h header.
  
  In a previous patch I changed `std::decay::type` to `std::decay`
  rather than `std::decay_t`.  This seems to have broken the build
  *only for clang-cl*.  I don't know why.
  
  diff --git a/llvm/include/llvm/ADT/Any.h b/llvm/include/llvm/ADT/Any.h
  index 9d819841e3f..0aded628cda 100644
  --- a/llvm/include/llvm/ADT/Any.h
  +++ b/llvm/include/llvm/ADT/Any.h
  @@ -74,7 +74,7 @@ public:
   // adopting it to work-around usage of `Any` with types 
that
   // need to be implicitly convertible from an `Any`.
   llvm::negation>>,
  -std::is_copy_constructible>>::value,
  +std::is_copy_constructible>>::value,
   int> = 0>
 Any(T &) {
   Storage =


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74384



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


[PATCH] D74433: [llvm-objdump] Print file format in lowercase to match GNU output.

2020-02-12 Thread Sam Clegg via Phabricator via cfe-commits
sbc100 added a comment.

Wasm is not an acronym so we don't usually display it in uppercase.  So yes, I 
think we should change WasmObjectFile::getFileFormatName() to return lowercase.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74433



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


[PATCH] D74468: [clang-tidy] No misc-definitions-in-headers warning on C++14 variable templates.

2020-02-12 Thread Haojian Wu via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGa45ca670f5c4: [clang-tidy] No misc-definitions-in-headers 
warning on C++14 variable templates. (authored by hokein).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74468

Files:
  clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
  clang-tools-extra/docs/clang-tidy/checks/misc-definitions-in-headers.rst
  clang-tools-extra/test/clang-tidy/checkers/misc-definitions-in-headers-1z.hpp


Index: 
clang-tools-extra/test/clang-tidy/checkers/misc-definitions-in-headers-1z.hpp
===
--- 
clang-tools-extra/test/clang-tidy/checkers/misc-definitions-in-headers-1z.hpp
+++ 
clang-tools-extra/test/clang-tidy/checkers/misc-definitions-in-headers-1z.hpp
@@ -1,4 +1,4 @@
-// RUN: %check_clang_tidy %s misc-definitions-in-headers %t -- -- -std=c++1z
+// RUN: %check_clang_tidy -std=c++17-or-later %s misc-definitions-in-headers %t
 
 class CE {
   constexpr static int i = 5; // OK: inline variable definition.
@@ -8,3 +8,7 @@
 
 int b = 1;
 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: variable 'b' defined in a header 
file; variable definitions in header files can lead to ODR violations 
[misc-definitions-in-headers]
+
+// OK: C++14 variable template.
+template 
+constexpr T pi = T(3.1415926L);
Index: clang-tools-extra/docs/clang-tidy/checks/misc-definitions-in-headers.rst
===
--- clang-tools-extra/docs/clang-tidy/checks/misc-definitions-in-headers.rst
+++ clang-tools-extra/docs/clang-tidy/checks/misc-definitions-in-headers.rst
@@ -83,6 +83,10 @@
 
constexpr int f10() { return 0; } // OK: constexpr function implies inline.
 
+   // OK: C++14 variable templates are inline.
+   template 
+   constexpr T pi = T(3.1415926L);
+
 Options
 ---
 
Index: clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
===
--- clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
+++ clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
@@ -134,6 +134,9 @@
  DiagnosticIDs::Note)
 << FixItHint::CreateInsertion(FD->getInnerLocStart(), "inline ");
   } else if (const auto *VD = dyn_cast(ND)) {
+// C++14 variable templates are allowed.
+if (VD->getDescribedVarTemplate())
+  return;
 // Static data members of a class template are allowed.
 if (VD->getDeclContext()->isDependentContext() && VD->isStaticDataMember())
   return;


Index: clang-tools-extra/test/clang-tidy/checkers/misc-definitions-in-headers-1z.hpp
===
--- clang-tools-extra/test/clang-tidy/checkers/misc-definitions-in-headers-1z.hpp
+++ clang-tools-extra/test/clang-tidy/checkers/misc-definitions-in-headers-1z.hpp
@@ -1,4 +1,4 @@
-// RUN: %check_clang_tidy %s misc-definitions-in-headers %t -- -- -std=c++1z
+// RUN: %check_clang_tidy -std=c++17-or-later %s misc-definitions-in-headers %t
 
 class CE {
   constexpr static int i = 5; // OK: inline variable definition.
@@ -8,3 +8,7 @@
 
 int b = 1;
 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: variable 'b' defined in a header file; variable definitions in header files can lead to ODR violations [misc-definitions-in-headers]
+
+// OK: C++14 variable template.
+template 
+constexpr T pi = T(3.1415926L);
Index: clang-tools-extra/docs/clang-tidy/checks/misc-definitions-in-headers.rst
===
--- clang-tools-extra/docs/clang-tidy/checks/misc-definitions-in-headers.rst
+++ clang-tools-extra/docs/clang-tidy/checks/misc-definitions-in-headers.rst
@@ -83,6 +83,10 @@
 
constexpr int f10() { return 0; } // OK: constexpr function implies inline.
 
+   // OK: C++14 variable templates are inline.
+   template 
+   constexpr T pi = T(3.1415926L);
+
 Options
 ---
 
Index: clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
===
--- clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
+++ clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
@@ -134,6 +134,9 @@
  DiagnosticIDs::Note)
 << FixItHint::CreateInsertion(FD->getInnerLocStart(), "inline ");
   } else if (const auto *VD = dyn_cast(ND)) {
+// C++14 variable templates are allowed.
+if (VD->getDescribedVarTemplate())
+  return;
 // Static data members of a class template are allowed.
 if (VD->getDeclContext()->isDependentContext() && VD->isStaticDataMember())
   return;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 665dcda - Add missing newlines at EOF; NFC

2020-02-12 Thread Sven van Haastregt via cfe-commits

Author: Sven van Haastregt
Date: 2020-02-12T15:57:25Z
New Revision: 665dcdacc06b056c3279a1fccbcae4660d80f117

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

LOG: Add missing newlines at EOF; NFC

Added: 


Modified: 
clang/include/clang/AST/ASTConcept.h
clang/include/clang/AST/ExprConcepts.h
clang/lib/AST/DeclTemplate.cpp
clang/lib/DirectoryWatcher/DirectoryScanner.cpp
clang/lib/DirectoryWatcher/DirectoryScanner.h
clang/lib/DirectoryWatcher/default/DirectoryWatcher-not-implemented.cpp
clang/tools/libclang/FatalErrorHandler.cpp
llvm/include/llvm/DebugInfo/PDB/Native/NativeTypeFunctionSig.h
llvm/include/llvm/DebugInfo/PDB/Native/NativeTypePointer.h
llvm/include/llvm/DebugInfo/PDB/Native/NativeTypeTypedef.h
llvm/include/llvm/DebugInfo/PDB/Native/NativeTypeUDT.h
llvm/include/llvm/DebugInfo/PDB/Native/NativeTypeVTShape.h
llvm/lib/DebugInfo/PDB/Native/EnumTables.cpp
llvm/lib/DebugInfo/PDB/Native/NativeTypeArray.cpp
llvm/lib/IR/FPEnv.cpp
llvm/lib/Transforms/CFGuard/CFGuard.cpp

Removed: 




diff  --git a/clang/include/clang/AST/ASTConcept.h 
b/clang/include/clang/AST/ASTConcept.h
index 3ebaad4eafdd..71bf14a87865 100644
--- a/clang/include/clang/AST/ASTConcept.h
+++ b/clang/include/clang/AST/ASTConcept.h
@@ -193,4 +193,4 @@ class TypeConstraint : public ConceptReference {
 
 } // clang
 
-#endif // LLVM_CLANG_AST_ASTCONCEPT_H
\ No newline at end of file
+#endif // LLVM_CLANG_AST_ASTCONCEPT_H

diff  --git a/clang/include/clang/AST/ExprConcepts.h 
b/clang/include/clang/AST/ExprConcepts.h
index 271d487e2fc9..6137e0e4082b 100644
--- a/clang/include/clang/AST/ExprConcepts.h
+++ b/clang/include/clang/AST/ExprConcepts.h
@@ -550,4 +550,4 @@ class RequiresExpr final : public Expr,
 
 } // namespace clang
 
-#endif // LLVM_CLANG_AST_EXPRCONCEPTS_H
\ No newline at end of file
+#endif // LLVM_CLANG_AST_EXPRCONCEPTS_H

diff  --git a/clang/lib/AST/DeclTemplate.cpp b/clang/lib/AST/DeclTemplate.cpp
index b5e4ec2d7f43..e5b90e577f64 100755
--- a/clang/lib/AST/DeclTemplate.cpp
+++ b/clang/lib/AST/DeclTemplate.cpp
@@ -1430,4 +1430,4 @@ void TypeConstraint::print(llvm::raw_ostream , 
PrintingPolicy Policy) const {
   ArgLoc.getArgument().print(Policy, OS);
 OS << ">";
   }
-}
\ No newline at end of file
+}

diff  --git a/clang/lib/DirectoryWatcher/DirectoryScanner.cpp 
b/clang/lib/DirectoryWatcher/DirectoryScanner.cpp
index ecfec52f459e..1bc286236a0e 100644
--- a/clang/lib/DirectoryWatcher/DirectoryScanner.cpp
+++ b/clang/lib/DirectoryWatcher/DirectoryScanner.cpp
@@ -51,4 +51,4 @@ getAsFileEvents(const std::vector ) {
   return Events;
 }
 
-} // namespace clang
\ No newline at end of file
+} // namespace clang

diff  --git a/clang/lib/DirectoryWatcher/DirectoryScanner.h 
b/clang/lib/DirectoryWatcher/DirectoryScanner.h
index 55731225e251..feb8b4ea861e 100644
--- a/clang/lib/DirectoryWatcher/DirectoryScanner.h
+++ b/clang/lib/DirectoryWatcher/DirectoryScanner.h
@@ -26,4 +26,4 @@ getAsFileEvents(const std::vector );
 /// \returns llvm::None if \p Path doesn't exist or can't get the status.
 llvm::Optional getFileStatus(llvm::StringRef Path);
 
-} // namespace clang
\ No newline at end of file
+} // namespace clang

diff  --git 
a/clang/lib/DirectoryWatcher/default/DirectoryWatcher-not-implemented.cpp 
b/clang/lib/DirectoryWatcher/default/DirectoryWatcher-not-implemented.cpp
index 200e540624a6..bc410822d7ae 100644
--- a/clang/lib/DirectoryWatcher/default/DirectoryWatcher-not-implemented.cpp
+++ b/clang/lib/DirectoryWatcher/default/DirectoryWatcher-not-implemented.cpp
@@ -18,4 +18,4 @@ llvm::Expected> 
clang::DirectoryWatcher::creat
   return llvm::make_error(
   "DirectoryWatcher is not implemented for this platform!",
   llvm::inconvertibleErrorCode());
-}
\ No newline at end of file
+}

diff  --git a/clang/tools/libclang/FatalErrorHandler.cpp 
b/clang/tools/libclang/FatalErrorHandler.cpp
index eab17f3dfac7..6b435fcfcc95 100644
--- a/clang/tools/libclang/FatalErrorHandler.cpp
+++ b/clang/tools/libclang/FatalErrorHandler.cpp
@@ -27,4 +27,4 @@ void clang_install_aborting_llvm_fatal_error_handler(void) {
 void clang_uninstall_llvm_fatal_error_handler(void) {
   llvm::remove_fatal_error_handler();
 }
-}
\ No newline at end of file
+}

diff  --git a/llvm/include/llvm/DebugInfo/PDB/Native/NativeTypeFunctionSig.h 
b/llvm/include/llvm/DebugInfo/PDB/Native/NativeTypeFunctionSig.h
index a7ea287dffc8..358ddf5e2081 100644
--- a/llvm/include/llvm/DebugInfo/PDB/Native/NativeTypeFunctionSig.h
+++ b/llvm/include/llvm/DebugInfo/PDB/Native/NativeTypeFunctionSig.h
@@ -70,4 +70,4 @@ class NativeTypeFunctionSig : public NativeRawSymbol {
 } // namespace pdb
 } // namespace llvm
 
-#endif // LLVM_DEBUGINFO_PDB_NATIVE_NATIVETYPEPOINTER_H
\ No newline 

[clang-tools-extra] a45ca67 - [clang-tidy] No misc-definitions-in-headers warning on C++14 variable templates.

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

Author: Haojian Wu
Date: 2020-02-12T16:56:31+01:00
New Revision: a45ca670f5c43253d71018814d1e00443726f23a

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

LOG: [clang-tidy] No misc-definitions-in-headers warning on C++14 variable 
templates.

Reviewers: gribozavr2

Subscribers: xazax.hun, cfe-commits

Tags: #clang

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

Added: 


Modified: 
clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
clang-tools-extra/docs/clang-tidy/checks/misc-definitions-in-headers.rst

clang-tools-extra/test/clang-tidy/checkers/misc-definitions-in-headers-1z.hpp

Removed: 




diff  --git a/clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp 
b/clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
index 1d41edd2083e..7ff6c0d20f63 100644
--- a/clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
+++ b/clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
@@ -134,6 +134,9 @@ void DefinitionsInHeadersCheck::check(const 
MatchFinder::MatchResult ) {
  DiagnosticIDs::Note)
 << FixItHint::CreateInsertion(FD->getInnerLocStart(), "inline ");
   } else if (const auto *VD = dyn_cast(ND)) {
+// C++14 variable templates are allowed.
+if (VD->getDescribedVarTemplate())
+  return;
 // Static data members of a class template are allowed.
 if (VD->getDeclContext()->isDependentContext() && VD->isStaticDataMember())
   return;

diff  --git 
a/clang-tools-extra/docs/clang-tidy/checks/misc-definitions-in-headers.rst 
b/clang-tools-extra/docs/clang-tidy/checks/misc-definitions-in-headers.rst
index 1b6c2cd34438..235e5cd2306d 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/misc-definitions-in-headers.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/misc-definitions-in-headers.rst
@@ -83,6 +83,10 @@ from multiple translation units.
 
constexpr int f10() { return 0; } // OK: constexpr function implies inline.
 
+   // OK: C++14 variable templates are inline.
+   template 
+   constexpr T pi = T(3.1415926L);
+
 Options
 ---
 

diff  --git 
a/clang-tools-extra/test/clang-tidy/checkers/misc-definitions-in-headers-1z.hpp 
b/clang-tools-extra/test/clang-tidy/checkers/misc-definitions-in-headers-1z.hpp
index 79fb7bc0bd8a..fd02998a53d5 100644
--- 
a/clang-tools-extra/test/clang-tidy/checkers/misc-definitions-in-headers-1z.hpp
+++ 
b/clang-tools-extra/test/clang-tidy/checkers/misc-definitions-in-headers-1z.hpp
@@ -1,4 +1,4 @@
-// RUN: %check_clang_tidy %s misc-definitions-in-headers %t -- -- -std=c++1z
+// RUN: %check_clang_tidy -std=c++17-or-later %s misc-definitions-in-headers %t
 
 class CE {
   constexpr static int i = 5; // OK: inline variable definition.
@@ -8,3 +8,7 @@ inline int i = 5; // OK: inline variable definition.
 
 int b = 1;
 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: variable 'b' defined in a header 
file; variable definitions in header files can lead to ODR violations 
[misc-definitions-in-headers]
+
+// OK: C++14 variable template.
+template 
+constexpr T pi = T(3.1415926L);



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


[PATCH] D74447: [Clang] After integrated-cc1, ignore -disable-free when there are more than one job in the queue

2020-02-12 Thread Alexandre Ganea via Phabricator via cfe-commits
aganea added inline comments.



Comment at: clang/include/clang/Driver/Job.h:90
+  /// Whether the command will be executed in this process or not.
+  bool InProcess : 1;
+

hans wrote:
> I think Reid just meant put the bool fields after each other to minimize 
> padding. Using bitfields is taking it one step further. I think in LLVM we 
> generally use "unsigned" for bitfield types, but I'm not sure using bitfields 
> at all is worth it here.
Reid said "pack" and "field" and my Pavlovian reflex made me think "bitfields". 
Yes, plain bools are just fine.



Comment at: clang/include/clang/Driver/Job.h:134
 
-  /// Set whether to print the input filenames when executing.
-  void setPrintInputFilenames(bool P) { PrintInputFilenames = P; }
+  /// Prevent burying pointers, and ensure we free everything after execution.
+  void forceCleanUp();

hans wrote:
> I hadn't heard the term "burying pointers" before, and the name is also 
> pretty broad: "clean up" could refer to a lot more than just freeing memory.
> 
> Maybe "enableFree()" or something would be a better name?
"burying", as in 
https://github.com/llvm/llvm-project/blob/master/llvm/include/llvm/Support/BuryPointer.h

Changed the comment and the function to `enableFree()`.




Comment at: clang/lib/Driver/Job.cpp:325
+  llvm::erase_if(Arguments, RemoveDisableFree);
+}
+

hans wrote:
> I wish it were possible to avoid adding the -disable-free flag to 
> in-process-cc1 jobs in the first place, but I guess maybe that's not 
> practical.
That was my original intent, but the `-disable-free` flag is added by 
`Clang::ConstructJob()` and at that point we don't know yet how many jobs we 
will have, nor their nature.


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

https://reviews.llvm.org/D74447



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


[PATCH] D74468: [clang-tidy] No misc-definitions-in-headers warning on C++14 variable templates.

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

Address review comments.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74468

Files:
  clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
  clang-tools-extra/docs/clang-tidy/checks/misc-definitions-in-headers.rst
  clang-tools-extra/test/clang-tidy/checkers/misc-definitions-in-headers-1z.hpp


Index: 
clang-tools-extra/test/clang-tidy/checkers/misc-definitions-in-headers-1z.hpp
===
--- 
clang-tools-extra/test/clang-tidy/checkers/misc-definitions-in-headers-1z.hpp
+++ 
clang-tools-extra/test/clang-tidy/checkers/misc-definitions-in-headers-1z.hpp
@@ -1,4 +1,4 @@
-// RUN: %check_clang_tidy %s misc-definitions-in-headers %t -- -- -std=c++1z
+// RUN: %check_clang_tidy -std=c++17-or-later %s misc-definitions-in-headers %t
 
 class CE {
   constexpr static int i = 5; // OK: inline variable definition.
@@ -8,3 +8,7 @@
 
 int b = 1;
 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: variable 'b' defined in a header 
file; variable definitions in header files can lead to ODR violations 
[misc-definitions-in-headers]
+
+// OK: C++14 variable template.
+template 
+constexpr T pi = T(3.1415926L);
Index: clang-tools-extra/docs/clang-tidy/checks/misc-definitions-in-headers.rst
===
--- clang-tools-extra/docs/clang-tidy/checks/misc-definitions-in-headers.rst
+++ clang-tools-extra/docs/clang-tidy/checks/misc-definitions-in-headers.rst
@@ -83,6 +83,10 @@
 
constexpr int f10() { return 0; } // OK: constexpr function implies inline.
 
+   // OK: C++14 variable templates are inline.
+   template 
+   constexpr T pi = T(3.1415926L);
+
 Options
 ---
 
Index: clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
===
--- clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
+++ clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
@@ -134,6 +134,9 @@
  DiagnosticIDs::Note)
 << FixItHint::CreateInsertion(FD->getInnerLocStart(), "inline ");
   } else if (const auto *VD = dyn_cast(ND)) {
+// C++14 variable templates are allowed.
+if (VD->getDescribedVarTemplate())
+  return;
 // Static data members of a class template are allowed.
 if (VD->getDeclContext()->isDependentContext() && VD->isStaticDataMember())
   return;


Index: clang-tools-extra/test/clang-tidy/checkers/misc-definitions-in-headers-1z.hpp
===
--- clang-tools-extra/test/clang-tidy/checkers/misc-definitions-in-headers-1z.hpp
+++ clang-tools-extra/test/clang-tidy/checkers/misc-definitions-in-headers-1z.hpp
@@ -1,4 +1,4 @@
-// RUN: %check_clang_tidy %s misc-definitions-in-headers %t -- -- -std=c++1z
+// RUN: %check_clang_tidy -std=c++17-or-later %s misc-definitions-in-headers %t
 
 class CE {
   constexpr static int i = 5; // OK: inline variable definition.
@@ -8,3 +8,7 @@
 
 int b = 1;
 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: variable 'b' defined in a header file; variable definitions in header files can lead to ODR violations [misc-definitions-in-headers]
+
+// OK: C++14 variable template.
+template 
+constexpr T pi = T(3.1415926L);
Index: clang-tools-extra/docs/clang-tidy/checks/misc-definitions-in-headers.rst
===
--- clang-tools-extra/docs/clang-tidy/checks/misc-definitions-in-headers.rst
+++ clang-tools-extra/docs/clang-tidy/checks/misc-definitions-in-headers.rst
@@ -83,6 +83,10 @@
 
constexpr int f10() { return 0; } // OK: constexpr function implies inline.
 
+   // OK: C++14 variable templates are inline.
+   template 
+   constexpr T pi = T(3.1415926L);
+
 Options
 ---
 
Index: clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
===
--- clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
+++ clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
@@ -134,6 +134,9 @@
  DiagnosticIDs::Note)
 << FixItHint::CreateInsertion(FD->getInnerLocStart(), "inline ");
   } else if (const auto *VD = dyn_cast(ND)) {
+// C++14 variable templates are allowed.
+if (VD->getDescribedVarTemplate())
+  return;
 // Static data members of a class template are allowed.
 if (VD->getDeclContext()->isDependentContext() && VD->isStaticDataMember())
   return;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D74468: [clang-tidy] No misc-definitions-in-headers warning on C++14 variable templates.

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



Comment at: 
clang-tools-extra/test/clang-tidy/checkers/misc-definitions-in-headers-1z.hpp:14
+template
+constexpr T pi = T(3.1415926L);

gribozavr2 wrote:
> I would prefer if you could make the test compatible with all language modes 
> after C++11. You can do it by wrapping the variable template in `#if`s on the 
> `__cplusplus` macro that contains the language version.
I'd prefer keep it as it-is. using `__cplusplus` seems a bit hacky to me, and I 
think it only works for non-CHECK-MESSAGES cases.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74468



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


[PATCH] D73852: [clang] detect switch fallthrough marked by a comment (PR43465)

2020-02-12 Thread Luboš Luňák via Phabricator via cfe-commits
llunak marked an inline comment as done.
llunak added a comment.

In D73852#1872013 , @lebedev.ri wrote:

> This patch also omitted cfe-commits lists.


That is a Phabricator problem. 
https://llvm.org/docs/Phabricator.html#requesting-a-review-via-the-web-interface
 says to select 'Clang' as the repository, but after the monorepo switch that 
repository no longer exists and Phabricator says 'Inactive' for it. So I 
(presumably, I don't remember) selected the monorepo and tagged the issue with 
'Clang'. If it's still required to use 'Clang' as the repository, then it 
shouldn't be marked as inactive, or alternatively cfe-commits should be added 
on the 'Clang' tag.




Comment at: clang/lib/Sema/AnalysisBasedWarnings.cpp:1239
+  llvm::Regex("(/\\*[ \\t]*fall(s | |-)?thr(ough|u)\\.?[ 
\\t]*\\*/)"
+  "|(//[ \\t]*fall(s | |-)?thr(ough|u)\\.?[ \\t]*)",
+  llvm::Regex::IgnoreCase);

aaron.ballman wrote:
> thakis wrote:
> > Also, this adds a regex match for every comment line, yes? Isn't this 
> > terrible for build performance? Did you do any benchmarking of this?
> https://reviews.llvm.org/D73852#inline-671309
As said above, it's on-demand, and in code without unannotated fallthough it'll 
be triggered exactly zero times.



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73852



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


[PATCH] D74447: [Clang] After integrated-cc1, ignore -disable-free when there are more than one job in the queue

2020-02-12 Thread Alexandre Ganea via Phabricator via cfe-commits
aganea updated this revision to Diff 244172.
aganea marked 7 inline comments as done.
aganea added a comment.

Address @hans' comments.

While it'd be good to have a bot running without `-disable-free`, I concur with 
@thakis. This patch will probably introduce too much (untested) variability for 
release 10.0, if merged.
Let's enable `integrate-cc1` just for one TU for the 10.0, and then we'll see 
if we want to land this patch or not in the trunk for the 11.0.
I'll open another review.


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

https://reviews.llvm.org/D74447

Files:
  clang/include/clang/Driver/Job.h
  clang/lib/Driver/Driver.cpp
  clang/lib/Driver/Job.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/Driver/cc1-spawnprocess.c
  clang/tools/driver/cc1_main.cpp

Index: clang/tools/driver/cc1_main.cpp
===
--- clang/tools/driver/cc1_main.cpp
+++ clang/tools/driver/cc1_main.cpp
@@ -259,6 +259,7 @@
   // FIXME(ibiryukov): make profilerOutput flush in destructor instead.
   profilerOutput->flush();
   llvm::timeTraceProfilerCleanup();
+  Clang->clearOutputFiles(false);
 }
   }
 
Index: clang/test/Driver/cc1-spawnprocess.c
===
--- clang/test/Driver/cc1-spawnprocess.c
+++ clang/test/Driver/cc1-spawnprocess.c
@@ -20,3 +20,48 @@
 
 // YES: (in-process)
 // NO-NOT: (in-process)
+
+// The following tests ensure that only the last integrated-cc1 has -disable-free
+
+// RUN: echo 'int main() { return f() + g(); }' > %t1.cpp
+// RUN: echo 'int f() { return 1; }' > %t2.cpp
+// RUN: echo 'int g() { return 2; }' > %t3.cpp
+
+// Only one TU, one job, thus no cleanup is needed.
+// RUN: %clang -fintegrated-cc1 -c %t1.cpp -### 2>&1 | FileCheck %s --check-prefix=CLEAN
+// CLEAN: cc1
+// CLEAN-SAME: -disable-free
+
+// Three jobs, only the last invocation will skip clean up.
+// RUN: %clang -fintegrated-cc1 -c %t1.cpp %t2.cpp %t3.cpp -### 2>&1 | FileCheck %s --check-prefix=NOCLEAN-LAST
+// NOCLEAN-LAST: cc1
+// NOCLEAN-LAST-NOT: -disable-free
+// NOCLEAN-LAST-SAME: {{.*}}1.cpp
+// NOCLEAN-LAST: cc1
+// NOCLEAN-LAST-NOT: -disable-free
+// NOCLEAN-LAST-SAME: {{.*}}2.cpp
+// NOCLEAN-LAST: cc1
+// NOCLEAN-LAST-SAME: -disable-free
+// NOCLEAN-LAST-SAME: {{.*}}3.cpp
+
+// Four jobs, no invocation will skip clean up because the last job is linking.
+// RUN: %clang -fintegrated-cc1 %t1.cpp %t2.cpp %t3.cpp -### 2>&1 | FileCheck %s --check-prefix=ALL
+// ALL-NOT: -disable-free
+
+// In no-integrated-cc1 mode, no cleanup is needed, because we're running the
+// CC1 tool in a secondary process and the process' heap will be released
+// anyway when the process ends.
+// RUN: %clang -fno-integrated-cc1 -c %t1.cpp -### 2>&1 | FileCheck %s --check-prefix=CLEAN
+
+// RUN: %clang -fno-integrated-cc1 -c %t1.cpp %t2.cpp %t3.cpp -### 2>&1 | FileCheck %s --check-prefix=CLEANALL
+// CLEANALL: cc1
+// CLEANALL-SAME: -disable-free
+// CLEANALL-SAME: {{.*}}1.cpp
+// CLEANALL: cc1
+// CLEANALL-SAME: -disable-free
+// CLEANALL-SAME: {{.*}}2.cpp
+// CLEANALL: cc1
+// CLEANALL-SAME: -disable-free
+// CLEANALL-SAME: {{.*}}3.cpp
+
+// RUN: %clang -fno-integrated-cc1 %t1.cpp %t2.cpp %t3.cpp -### 2>&1 | FileCheck %s --check-prefix=CLEANALL
Index: clang/lib/Driver/ToolChains/Clang.cpp
===
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -6148,7 +6148,7 @@
   if (Output.getType() == types::TY_Object &&
   Args.hasFlag(options::OPT__SLASH_showFilenames,
options::OPT__SLASH_showFilenames_, false)) {
-C.getJobs().getJobs().back()->setPrintInputFilenames(true);
+C.getJobs().getJobs().back()->PrintInputFilenames = true;
   }
 
   if (Arg *A = Args.getLastArg(options::OPT_pg))
Index: clang/lib/Driver/Job.cpp
===
--- clang/lib/Driver/Job.cpp
+++ clang/lib/Driver/Job.cpp
@@ -40,7 +40,7 @@
  const llvm::opt::ArgStringList ,
  ArrayRef Inputs)
 : Source(Source), Creator(Creator), Executable(Executable),
-  Arguments(Arguments) {
+  Arguments(Arguments), PrintInputFilenames(false), InProcess(false) {
   for (const auto  : Inputs)
 if (II.isFilename())
   InputFilenames.push_back(II.getFilename());
@@ -315,6 +315,15 @@
   Environment.push_back(nullptr);
 }
 
+// In some cases when running the calling process, we need to clean up if there
+// are other Commands being executed after us, to prevent bloating the heap.
+void Command::enableFree() {
+  auto RemoveDisableFree = [](const char *A) {
+return StringRef(A).equals("-disable-free");
+  };
+  llvm::erase_if(Arguments, RemoveDisableFree);
+}
+
 void Command::PrintFileNames() const {
   if (PrintInputFilenames) {
 for (const char *Arg : InputFilenames)
@@ -371,6 +380,14 @@

[PATCH] D74385: [ARCMT][NFC] Reduce #include dependencies

2020-02-12 Thread serge via Phabricator via cfe-commits
serge-sans-paille added a comment.

In D74385#1869876 , @nicolas17 wrote:

> I don't have commit access, can someone push this for me?


Sure, can you just confirm that you're this guy: https://github.com/nicolas17 
(I need that for proper email attribution)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74385



___
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-12 Thread Melanie Blower via Phabricator via cfe-commits
mibintc marked 2 inline comments as done.
mibintc added a comment.

some replies to Andy. I'll upload another patch here which passed check-all 
locally. then i'll re-commit it.




Comment at: clang/docs/UsersManual.rst:1388
 
-   * ``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.

lebedev.ri wrote:
> I'm confused. Where in this patch the `This patch establishes the default 
> option for -ffp-model to select "precise".` happens? LHS of diff says it is 
> already default
yes you're right. sorry for the confusion.  i changed the title and description



Comment at: clang/lib/Driver/ToolChains/Clang.cpp:2661
 // the FPContract value has already been set to a string literal
 // and the Val string isn't a pertinent value.
 ;

andrew.w.kaylor wrote:
> Does this mean that "-ffp-model=precise -ffp-contract=off" will leave FP 
> contraction on? That doesn't seem right.
No.  When -ffp-model=precise is on the command line, we end up here because the 
code above changes optID to ffp_contract, and sets FPContract to "on". The Val 
string will be "precise", and it shouldn't be checked. I'll change the comment.


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-12 Thread Melanie Blower via Phabricator via cfe-commits
mibintc updated this revision to Diff 244178.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74436

Files:
  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

Index: clang/test/Driver/fp-model.c
===
--- clang/test/Driver/fp-model.c
+++ clang/test/Driver/fp-model.c
@@ -27,9 +27,9 @@
 // RUN:   | FileCheck --check-prefix=WARN5 %s
 // WARN5: warning: overriding '-ffp-model=strict' option with '-ffp-contract=fast' [-Woverriding-t-option]
 
-// RUN: %clang -### -ffp-model=strict -ffp-contract=off -c %s 2>&1 \
+// RUN: %clang -### -ffp-model=strict -ffp-contract=fast -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=WARN6 %s
-// WARN6: warning: overriding '-ffp-model=strict' option with '-ffp-contract=off' [-Woverriding-t-option]
+// WARN6: warning: overriding '-ffp-model=strict' option with '-ffp-contract=fast' [-Woverriding-t-option]
 
 // RUN: %clang -### -ffp-model=strict -ffp-contract=on -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=WARN7 %s
@@ -100,13 +100,14 @@
 // RUN: %clang -### -nostdinc -ffp-model=precise -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-FPM-PRECISE %s
 // CHECK-FPM-PRECISE: "-cc1"
-// CHECK-FPM-PRECISE: "-ffp-contract=fast"
+// CHECK-FPM-PRECISE: "-ffp-contract=on"
 // CHECK-FPM-PRECISE: "-fno-rounding-math"
 
 // RUN: %clang -### -nostdinc -ffp-model=strict -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-FPM-STRICT %s
 // CHECK-FPM-STRICT: "-cc1"
 // CHECK-FPM-STRICT: "-ftrapping-math"
+// CHECK-FPM-STRICT: "-ffp-contract=off"
 // CHECK-FPM-STRICT: "-frounding-math"
 // CHECK-FPM-STRICT: "-ffp-exception-behavior=strict"
 
Index: clang/test/CodeGen/ppc-xmmintrin.c
===
--- clang/test/CodeGen/ppc-xmmintrin.c
+++ clang/test/CodeGen/ppc-xmmintrin.c
@@ -2,9 +2,9 @@
 // REQUIRES: powerpc-registered-target
 
 // RUN: %clang -S -emit-llvm -target powerpc64-unknown-linux-gnu -mcpu=pwr8 -ffreestanding -DNO_WARN_X86_INTRINSICS %s \
-// RUN:   -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK,CHECK-BE
+// RUN:   -ffp-contract=off -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK,CHECK-BE
 // RUN: %clang -S -emit-llvm -target powerpc64le-unknown-linux-gnu -mcpu=pwr8 -ffreestanding -DNO_WARN_X86_INTRINSICS %s \
-// RUN:   -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK,CHECK-LE
+// RUN:   -ffp-contract=off -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK,CHECK-LE
 
 #include 
 
Index: clang/test/CodeGen/ppc-emmintrin.c
===
--- clang/test/CodeGen/ppc-emmintrin.c
+++ clang/test/CodeGen/ppc-emmintrin.c
@@ -2,9 +2,9 @@
 // REQUIRES: powerpc-registered-target
 
 // RUN: %clang -S -emit-llvm -target powerpc64-unknown-linux-gnu -mcpu=pwr8 -ffreestanding -DNO_WARN_X86_INTRINSICS %s \
-// RUN:  -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK,CHECK-BE
+// RUN:  -ffp-contract=off -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK,CHECK-BE
 // RUN: %clang -S -emit-llvm -target powerpc64le-unknown-linux-gnu -mcpu=pwr8 -ffreestanding -DNO_WARN_X86_INTRINSICS %s \
-// RUN:   -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK,CHECK-LE
+// RUN:   -ffp-contract=off -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK,CHECK-LE
 
 // CHECK-BE-DAG: @_mm_movemask_pd.perm_mask = internal constant <4 x i32> , align 16
 // CHECK-BE-DAG: @_mm_shuffle_epi32.permute_selectors = internal constant [4 x i32] [i32 66051, i32 67438087, i32 134810123, i32 202182159], align 4
Index: clang/lib/Driver/ToolChains/Clang.cpp
===
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -2525,10 +2525,9 @@
 
   llvm::DenormalMode DenormalFPMath = DefaultDenormalFPMath;
   llvm::DenormalMode DenormalFP32Math = DefaultDenormalFP32Math;
-  StringRef FPContract = "";
+  StringRef FPContract = "on";
   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());
@@ -2551,7 +2550,6 @@
   SignedZeros = true;
   // -fno_fast_math restores default denormal and fpcontract handling
   

[clang] abd0905 - Revert "Revert "Change clang option -ffp-model=precise to select ffp-contract=on""

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

Author: Melanie Blower
Date: 2020-02-12T07:30:43-08:00
New Revision: abd09053bc7aa6144873c196a7d50aa6ce6ca430

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

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

This reverts commit 99c5bcbce89f07e68ccd89891a0300346705d013.
Change clang option -ffp-model=precise to select ffp-contract=on
Including some small touch-ups to the original commit

Reviewers: rjmccall, Andy Kaylor

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

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 856d5e34bbcc..6c8c9f802082 100644
--- a/clang/docs/UsersManual.rst
+++ b/clang/docs/UsersManual.rst
@@ -1190,8 +1190,50 @@ installed.
 Controlling Floating Point Behavior
 ---
 
-Clang provides a number of ways to control floating point behavior. The options
-are listed below.
+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"
 
 .. option:: -ffast-math
 
@@ -1385,7 +1427,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=fast``).  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=on``).  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 4424d8e6f72c..a11a5423b0b9 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -2525,10 +2525,9 @@ static void RenderFloatingPointOptions(const ToolChain 
, const Driver ,
 
   llvm::DenormalMode DenormalFPMath = DefaultDenormalFPMath;
   llvm::DenormalMode DenormalFP32Math = DefaultDenormalFP32Math;
-  StringRef FPContract = "";
+  StringRef FPContract = "on";
   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());
@@ -2551,7 +2550,6 @@ static void RenderFloatingPointOptions(const ToolChain 
, const Driver ,
   SignedZeros = true;
   

[PATCH] D74473: [analyzer] StdLibraryFunctionsChecker: Use platform dependent EOF and UCharMax

2020-02-12 Thread Gabor Marton via Phabricator via cfe-commits
martong updated this revision to Diff 244173.
martong marked 6 inline comments as done.
martong added a comment.

- Move include of Preprocessor.h to CheckerHelpers.cpp
- Try -> try
- Use PP.getIdentifierInfo
- Handle parens in tryExpandAsInteger


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74473

Files:
  clang/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerHelpers.h
  clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
  clang/lib/StaticAnalyzer/Core/CheckerHelpers.cpp
  clang/test/Analysis/std-c-library-functions-eof.c

Index: clang/test/Analysis/std-c-library-functions-eof.c
===
--- /dev/null
+++ clang/test/Analysis/std-c-library-functions-eof.c
@@ -0,0 +1,26 @@
+// RUN: %clang_analyze_cc1 -analyzer-checker=apiModeling.StdCLibraryFunctions,debug.ExprInspection -verify -analyzer-config eagerly-assume=false %s
+// RUN: %clang_analyze_cc1 -triple i686-unknown-linux -analyzer-checker=apiModeling.StdCLibraryFunctions,debug.ExprInspection -verify -analyzer-config eagerly-assume=false %s
+// RUN: %clang_analyze_cc1 -triple x86_64-unknown-linux -analyzer-checker=apiModeling.StdCLibraryFunctions,debug.ExprInspection -verify -analyzer-config eagerly-assume=false %s
+// RUN: %clang_analyze_cc1 -triple armv7-a15-linux -analyzer-checker=apiModeling.StdCLibraryFunctions,debug.ExprInspection -verify -analyzer-config eagerly-assume=false %s
+// RUN: %clang_analyze_cc1 -triple thumbv7-a15-linux -analyzer-checker=apiModeling.StdCLibraryFunctions,debug.ExprInspection -verify -analyzer-config eagerly-assume=false %s
+
+void clang_analyzer_eval(int);
+
+typedef struct FILE FILE;
+// Unorthodox EOF value.
+#define EOF (-2)
+
+int getc(FILE *);
+void test_getc(FILE *fp) {
+
+  int x;
+  while ((x = getc(fp)) != EOF) {
+clang_analyzer_eval(x > 255); // expected-warning{{FALSE}}
+clang_analyzer_eval(x >= 0); // expected-warning{{TRUE}}
+  }
+
+  int y = getc(fp);
+  if (y < 0) {
+clang_analyzer_eval(y == -2); // expected-warning{{TRUE}}
+  }
+}
Index: clang/lib/StaticAnalyzer/Core/CheckerHelpers.cpp
===
--- clang/lib/StaticAnalyzer/Core/CheckerHelpers.cpp
+++ clang/lib/StaticAnalyzer/Core/CheckerHelpers.cpp
@@ -13,6 +13,7 @@
 #include "clang/StaticAnalyzer/Core/PathSensitive/CheckerHelpers.h"
 #include "clang/AST/Decl.h"
 #include "clang/AST/Expr.h"
+#include "clang/Lex/Preprocessor.h"
 
 namespace clang {
 
@@ -109,6 +110,45 @@
   return Nullability::Unspecified;
 }
 
+llvm::Optional tryExpandAsInteger(StringRef Macro,
+   const Preprocessor ) {
+  const auto *MacroII = PP.getIdentifierInfo(Macro);
+  if (!MacroII)
+return llvm::None;
+  const MacroInfo *MI = PP.getMacroInfo(MacroII);
+  if (!MI)
+return llvm::None;
+
+  // Filter out parens.
+  std::vector FilteredTokens;
+  FilteredTokens.reserve(MI->tokens().size());
+  for (auto  : MI->tokens())
+if (!T.isOneOf(tok::l_paren, tok::r_paren))
+  FilteredTokens.push_back(T);
+
+  if (FilteredTokens.size() > 2)
+return llvm::None;
+
+  // Parse an integer at the end of the macro definition.
+  const Token  = FilteredTokens.back();
+  if (!T.isLiteral())
+return llvm::None;
+  StringRef ValueStr = StringRef(T.getLiteralData(), T.getLength());
+  llvm::APInt IntValue;
+  constexpr unsigned AutoSenseRadix = 0;
+  if (ValueStr.getAsInteger(AutoSenseRadix, IntValue))
+return llvm::None;
+
+  // Parse an optional minus sign.
+  if (FilteredTokens.size() == 2) {
+if (FilteredTokens.front().is(tok::minus))
+  IntValue = -IntValue;
+else
+  return llvm::None;
+  }
+
+  return IntValue.getSExtValue();
+}
 
-} // end namespace ento
-} // end namespace clang
+} // namespace ento
+} // namespace clang
Index: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
===
--- clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
+++ clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
@@ -55,6 +55,7 @@
 #include "clang/StaticAnalyzer/Core/CheckerManager.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h"
+#include "clang/StaticAnalyzer/Core/PathSensitive/CheckerHelpers.h"
 
 using namespace clang;
 using namespace clang::ento;
@@ -241,7 +242,7 @@
 const CallExpr *CE,
 CheckerContext ) const;
 
-  void initFunctionSummaries(BasicValueFactory ) const;
+  void initFunctionSummaries(CheckerContext ) const;
 };
 } // end of anonymous namespace
 
@@ -312,10 +313,11 @@
 for (size_t I = 1; I != E; ++I) {
   const llvm::APSInt  = BVF.getValue(R[I - 1].second + 1ULL, T);
   const llvm::APSInt  = 

[PATCH] D74473: [analyzer] StdLibraryFunctionsChecker: Use platform dependent EOF and UCharMax

2020-02-12 Thread Gabor Marton via Phabricator via cfe-commits
martong marked 2 inline comments as done.
martong added inline comments.



Comment at: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:571
+.Case(
+{ReturnValueCondition(WithinRange, {{EOFv, EOFv}, {0, 
UCharMax}})});
   };

Szelethus wrote:
> Huh, what's happening here exactly? Doesn't `Range` take 2 `RangeInt`s as 
> ctor arguments? What does `{EOFv, EOFv}, {0, UCharMax}` mean in this context?
`Range` is a convenience function that creates a `IntRangeVector` from the two 
params. This way we can easily create a list of ranges from two ints. Range(-1, 
255) results a list of ranges with one list: {{-1, 255}}.
Now, because EOF's value can be less than the minimum value of the next range 
we have to explicitly enlist the ranges.
E.g. if EOF is -2 then we will have a list of {-2,-2} and {0, 255}.



Comment at: clang/lib/StaticAnalyzer/Core/CheckerHelpers.cpp:114-117
+  const auto MacroIt = llvm::find_if(
+  PP.macros(), [&](const auto ) { return K.first->getName() == Macro; });
+  if (MacroIt == PP.macro_end())
+return llvm::None;

Szelethus wrote:
> This seems a bit clunky even for the `Preprocessor` -- how about
> 
> ```lang=c++
> const auto *MacroII = PP.getIdentifierInfo(Macro);
> if (!MacroII)
>   return;
> const MacroInfo *MI = PP.getMacroInfo(MacroII);
> assert(MI);
> ```
Ok, but we cannot assert on `MI`, because there may be cases when the macro is 
not defined in a TU. In that case we should just return with None.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74473



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


[PATCH] D74384: Use std::foo_t rather than std::foo in LLVM.

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

Looks like this broke building on windows with clang-cl as host compiler in 
some situations: http://45.33.8.238/win/8160/step_4.txt

I'm not sure if that's a bug in the version of the host clang I'm using yet. 
I'll poke around a bit and let you know.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74384



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


[PATCH] D74447: [Clang] After integrated-cc1, ignore -disable-free when there are more than one job in the queue

2020-02-12 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added a comment.

The performance benefit of disable-free is still valuable, I'd not want to make 
every TU pay the price for a multiple TU invocation. Additionally, if we're 
willing to put up with the 3rd form (which i think is worth it), the multiple 
TU case cleaning up on all but the last makes sense.


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

https://reviews.llvm.org/D74447



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


[PATCH] D72872: [ObjC generics] Fix not inheriting type bounds in categories/extensions.

2020-02-12 Thread Hans Wennborg via Phabricator via cfe-commits
hans added a comment.

In D72872#1870256 , @vsapsai wrote:

> In D72872#1868989 , @hans wrote:
>
> > I don't have the context here. Was I added as a subscriber because it's 
> > related to the clang 10 release?
>
>
> It's not related to clang 10 release. I've added you because earlier you've 
> found a problem with a previous approach 
> https://github.com/llvm/llvm-project/commit/4c539e8da1b3de38a53ef3f7497f5c45a3243b61
>  So in case it breaks something else, you have extra visibility into the 
> change.


Thanks! I applied the patch and was able to build large parts of Chromium 
without any problems.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72872



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


[PATCH] D74483: [AArch64] Add Cortex-A34 Support for clang and llvm

2020-02-12 Thread Sjoerd Meijer via Phabricator via cfe-commits
SjoerdMeijer added a comment.

Ah, sorry, looks like this is all there is to it, both clang and llvm. It's 
just that a quick grep locally (for a similar core) showed some more results.

Can you (double) check if it needs adding to e.g. a switch in 
`llvm/lib/Support/Host.cpp`?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74483



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


[PATCH] D74447: [Clang] After integrated-cc1, ignore -disable-free when there are more than one job in the queue

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

I'd think that everyone debugging clang always passes a single TU to it, so I'm 
not sure debuggability does much here :)

The `-disable-free` code has never been used in normal compilations, so we 
didn't have to worry about this path. This patch here brings us to 3 modes 
(in-process cc1 with and without disable-free, out-of-process cc1). My 
suggestion keeps us to two modes (in-process cc1, out-of-process cc1).


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

https://reviews.llvm.org/D74447



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


  1   2   >