[PATCH] D128977: [clangd] Support "usedAsMutableReference" in member initializations

2022-07-08 Thread Nathan Ridge via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb1fbc0519c52: [clangd] Support 
usedAsMutableReference in member initializations (authored by 
ckandeler, committed by nridge).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128977

Files:
  clang-tools-extra/clangd/SemanticHighlighting.cpp
  clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp

Index: clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
===
--- clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
+++ clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
@@ -745,6 +745,23 @@
 int [](int &);
 int operator[](int) const;
 };
+struct $Class_decl[[ClassWithStaticMember]] {
+static inline int $StaticField_decl_static[[j]] = 0;
+};
+struct $Class_decl[[ClassWithRefMembers]] {
+  $Class_decl[[ClassWithRefMembers]](int $Parameter_decl[[i]])
+: $Field[[i1]]($Parameter[[i]]),
+  $Field_readonly[[i2]]($Parameter[[i]]),
+  $Field[[i3]]($Parameter_usedAsMutableReference[[i]]),
+  $Field_readonly[[i4]]($Class[[ClassWithStaticMember]]::$StaticField_static[[j]]),
+  $Field[[i5]]($Class[[ClassWithStaticMember]]::$StaticField_static_usedAsMutableReference[[j]])
+  {}
+  int $Field_decl[[i1]];
+  const int &$Field_decl_readonly[[i2]];
+  int &$Field_decl[[i3]];
+  const int &$Field_decl_readonly[[i4]];
+  int &$Field_decl[[i5]];
+};
 void $Function_decl[[fun]](int, const int,
int*, const int*,
int&, const int&,
Index: clang-tools-extra/clangd/SemanticHighlighting.cpp
===
--- clang-tools-extra/clangd/SemanticHighlighting.cpp
+++ clang-tools-extra/clangd/SemanticHighlighting.cpp
@@ -523,6 +523,8 @@
 /// e.g. highlights dependent names and 'auto' as the underlying type.
 class CollectExtraHighlightings
 : public RecursiveASTVisitor {
+  using Base = RecursiveASTVisitor;
+
 public:
   CollectExtraHighlightings(HighlightingsBuilder ) : H(H) {}
 
@@ -533,6 +535,13 @@
 return true;
   }
 
+  bool TraverseConstructorInitializer(CXXCtorInitializer *Init) {
+if (Init->isMemberInitializer())
+  if (auto *Member = Init->getMember())
+highlightMutableReferenceArgument(Member->getType(), Init->getInit());
+return Base::TraverseConstructorInitializer(Init);
+  }
+
   bool VisitCallExpr(CallExpr *E) {
 // Highlighting parameters passed by non-const reference does not really
 // make sense for literals...
@@ -542,8 +551,8 @@
 // FIXME: consider highlighting parameters of some other overloaded
 // operators as well
 llvm::ArrayRef Args = {E->getArgs(), E->getNumArgs()};
-if (const auto callOp = dyn_cast(E)) {
-  switch (callOp->getOperator()) {
+if (auto *CallOp = dyn_cast(E)) {
+  switch (CallOp->getOperator()) {
   case OO_Call:
   case OO_Subscript:
 Args = Args.drop_front(); // Drop object parameter
@@ -559,6 +568,33 @@
 return true;
   }
 
+  void highlightMutableReferenceArgument(QualType T, const Expr *Arg) {
+if (!Arg)
+  return;
+
+// Is this parameter passed by non-const reference?
+// FIXME The condition T->idDependentType() could be relaxed a bit,
+// e.g. std::vector& is dependent but we would want to highlight it
+if (!T->isLValueReferenceType() ||
+T.getNonReferenceType().isConstQualified() || T->isDependentType()) {
+  return;
+}
+
+llvm::Optional Location;
+
+// FIXME Add "unwrapping" for ArraySubscriptExpr and UnaryOperator,
+//  e.g. highlight `a` in `a[i]`
+// FIXME Handle dependent expression types
+if (auto *DR = dyn_cast(Arg))
+  Location = DR->getLocation();
+else if (auto *M = dyn_cast(Arg))
+  Location = M->getMemberLoc();
+
+if (Location)
+  H.addExtraModifier(*Location,
+ HighlightingModifier::UsedAsMutableReference);
+  }
+
   void
   highlightMutableReferenceArguments(const FunctionDecl *FD,
  llvm::ArrayRef Args) {
@@ -571,31 +607,7 @@
   // highlighting modifier to the corresponding expression
   for (size_t I = 0;
I < std::min(size_t(ProtoType->getNumParams()), Args.size()); ++I) {
-auto T = ProtoType->getParamType(I);
-
-// Is this parameter passed by non-const reference?
-// FIXME The condition !T->idDependentType() could be relaxed a bit,
-// e.g. std::vector& is dependent but we would want to highlight it
-if (T->isLValueReferenceType() &&
- 

[clang-tools-extra] b1fbc05 - [clangd] Support "usedAsMutableReference" in member initializations

2022-07-08 Thread Nathan Ridge via cfe-commits

Author: Christian Kandeler
Date: 2022-07-08T23:16:20-04:00
New Revision: b1fbc0519c5224de44b2711f8a813b24d767dd3e

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

LOG: [clangd] Support "usedAsMutableReference" in member initializations

That is, mark constructor parameters being used to initialize
non-const reference members.

Reviewed By: nridge

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

Added: 


Modified: 
clang-tools-extra/clangd/SemanticHighlighting.cpp
clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp

Removed: 




diff  --git a/clang-tools-extra/clangd/SemanticHighlighting.cpp 
b/clang-tools-extra/clangd/SemanticHighlighting.cpp
index 5e0e3b2cc7dc..63d01deb3370 100644
--- a/clang-tools-extra/clangd/SemanticHighlighting.cpp
+++ b/clang-tools-extra/clangd/SemanticHighlighting.cpp
@@ -523,6 +523,8 @@ llvm::Optional scopeModifier(const 
Type *T) {
 /// e.g. highlights dependent names and 'auto' as the underlying type.
 class CollectExtraHighlightings
 : public RecursiveASTVisitor {
+  using Base = RecursiveASTVisitor;
+
 public:
   CollectExtraHighlightings(HighlightingsBuilder ) : H(H) {}
 
@@ -533,6 +535,13 @@ class CollectExtraHighlightings
 return true;
   }
 
+  bool TraverseConstructorInitializer(CXXCtorInitializer *Init) {
+if (Init->isMemberInitializer())
+  if (auto *Member = Init->getMember())
+highlightMutableReferenceArgument(Member->getType(), Init->getInit());
+return Base::TraverseConstructorInitializer(Init);
+  }
+
   bool VisitCallExpr(CallExpr *E) {
 // Highlighting parameters passed by non-const reference does not really
 // make sense for literals...
@@ -542,8 +551,8 @@ class CollectExtraHighlightings
 // FIXME: consider highlighting parameters of some other overloaded
 // operators as well
 llvm::ArrayRef Args = {E->getArgs(), E->getNumArgs()};
-if (const auto callOp = dyn_cast(E)) {
-  switch (callOp->getOperator()) {
+if (auto *CallOp = dyn_cast(E)) {
+  switch (CallOp->getOperator()) {
   case OO_Call:
   case OO_Subscript:
 Args = Args.drop_front(); // Drop object parameter
@@ -559,6 +568,33 @@ class CollectExtraHighlightings
 return true;
   }
 
+  void highlightMutableReferenceArgument(QualType T, const Expr *Arg) {
+if (!Arg)
+  return;
+
+// Is this parameter passed by non-const reference?
+// FIXME The condition T->idDependentType() could be relaxed a bit,
+// e.g. std::vector& is dependent but we would want to highlight it
+if (!T->isLValueReferenceType() ||
+T.getNonReferenceType().isConstQualified() || T->isDependentType()) {
+  return;
+}
+
+llvm::Optional Location;
+
+// FIXME Add "unwrapping" for ArraySubscriptExpr and UnaryOperator,
+//  e.g. highlight `a` in `a[i]`
+// FIXME Handle dependent expression types
+if (auto *DR = dyn_cast(Arg))
+  Location = DR->getLocation();
+else if (auto *M = dyn_cast(Arg))
+  Location = M->getMemberLoc();
+
+if (Location)
+  H.addExtraModifier(*Location,
+ HighlightingModifier::UsedAsMutableReference);
+  }
+
   void
   highlightMutableReferenceArguments(const FunctionDecl *FD,
  llvm::ArrayRef Args) {
@@ -571,31 +607,7 @@ class CollectExtraHighlightings
   // highlighting modifier to the corresponding expression
   for (size_t I = 0;
I < std::min(size_t(ProtoType->getNumParams()), Args.size()); ++I) {
-auto T = ProtoType->getParamType(I);
-
-// Is this parameter passed by non-const reference?
-// FIXME The condition !T->idDependentType() could be relaxed a bit,
-// e.g. std::vector& is dependent but we would want to highlight it
-if (T->isLValueReferenceType() &&
-!T.getNonReferenceType().isConstQualified() &&
-!T->isDependentType()) {
-  if (auto *Arg = Args[I]) {
-llvm::Optional Location;
-
-// FIXME Add "unwrapping" for ArraySubscriptExpr and UnaryOperator,
-//  e.g. highlight `a` in `a[i]`
-// FIXME Handle dependent expression types
-if (auto *DR = dyn_cast(Arg)) {
-  Location = DR->getLocation();
-} else if (auto *M = dyn_cast(Arg)) {
-  Location = M->getMemberLoc();
-}
-
-if (Location)
-  H.addExtraModifier(*Location,
- HighlightingModifier::UsedAsMutableReference);
-  }
-}
+highlightMutableReferenceArgument(ProtoType->getParamType(I), Args[I]);
   }
 }
   }

diff  --git a/clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp 

[PATCH] D102107: [OpenMP] Codegen aggregate for outlined function captures

2022-07-08 Thread Dhruva Chakrabarti via Phabricator via cfe-commits
dhruvachak added a comment.

make check-openmp passes on amdgpu. Need to check on nvptx.

Testing Time: 39.95s

  Unsupported  : 143
  Passed   : 563
  Expectedly Failed:  14

[100%] Built target check-openmp
[100%] Built target check-openmp


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102107

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


[PATCH] D102107: [OpenMP] Codegen aggregate for outlined function captures

2022-07-08 Thread Dhruva Chakrabarti via Phabricator via cfe-commits
dhruvachak added a comment.

Results from "make check-clang":

Failed Tests (14):

  Clang :: AST/ast-dump-openmp-distribute-parallel-for-simd.c
  Clang :: AST/ast-dump-openmp-distribute-parallel-for.c
  Clang :: AST/ast-dump-openmp-target-teams-distribute-parallel-for-simd.c
  Clang :: AST/ast-dump-openmp-target-teams-distribute-parallel-for.c
  Clang :: AST/ast-dump-openmp-teams-distribute-parallel-for-simd.c
  Clang :: AST/ast-dump-openmp-teams-distribute-parallel-for.c
  Clang :: CodeGenCXX/observe-noexcept.cpp
  Clang :: OpenMP/declare_variant_construct_codegen_1.c
  Clang :: OpenMP/nvptx_lambda_pointer_capturing.cpp
  Clang :: OpenMP/remarks_parallel_in_multiple_target_state_machines.c
  Clang :: OpenMP/remarks_parallel_in_target_state_machine.c
  Clang :: OpenMP/target_in_reduction_codegen.cpp
  Clang :: SemaCXX/static-assert.cpp
  Clang :: utils/update_cc_test_checks/generated-funcs.test

Testing Time: 29.33s

  Skipped  : 4
  Unsupported  :  1478
  Passed   : 29406
  Expectedly Failed:27
  Failed   :14

Need to check the following again.

clang/test/AST/ast-dump-openmp-distribute-parallel-for.c was regenerated and 
part of the patch but the test still fails. The other regenerated AST tests are 
not part of this patch, they seem to fail even after regen.

Need to regen CodeGenCXX, SemaCXX, and utils tests (3 total).

I tried converting the OpenMP manual CHECK tests to the autogen format. Some of 
them still fail as above, don't know why.

Need to know how to regen the OpenMP remarks tests.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102107

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


[PATCH] D128690: [ODRHash diagnostics] Preparation to minimize subsequent diffs. NFC.

2022-07-08 Thread Volodymyr Sapsai via Phabricator via cfe-commits
vsapsai updated this revision to Diff 443403.
vsapsai added a comment.

Rebase.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128690

Files:
  clang/lib/Serialization/ASTReader.cpp

Index: clang/lib/Serialization/ASTReader.cpp
===
--- clang/lib/Serialization/ASTReader.cpp
+++ clang/lib/Serialization/ASTReader.cpp
@@ -9444,6 +9444,38 @@
   PendingMergedDefinitionsToDeduplicate.clear();
 }
 
+static unsigned computeODRHash(QualType Ty) {
+  ODRHash Hasher;
+  Hasher.AddQualType(Ty);
+  return Hasher.CalculateHash();
+}
+
+static unsigned computeODRHash(const Stmt *S) {
+  ODRHash Hasher;
+  Hasher.AddStmt(S);
+  return Hasher.CalculateHash();
+}
+
+static unsigned computeODRHash(const Decl *D) {
+  assert(D);
+  ODRHash Hasher;
+  Hasher.AddSubDecl(D);
+  return Hasher.CalculateHash();
+}
+
+static unsigned computeODRHash(const TemplateArgument ) {
+  ODRHash Hasher;
+  Hasher.AddTemplateArgument(TA);
+  return Hasher.CalculateHash();
+}
+
+static unsigned computeODRHash(const TemplateParameterList *TPL) {
+  assert(TPL);
+  ODRHash Hasher;
+  Hasher.AddTemplateParameterList(TPL);
+  return Hasher.CalculateHash();
+}
+
 void ASTReader::diagnoseOdrViolations() {
   if (PendingOdrMergeFailures.empty() && PendingOdrMergeChecks.empty() &&
   PendingFunctionOdrMergeFailures.empty() &&
@@ -9583,42 +9615,6 @@
   // we're producing our diagnostics.
   Deserializing RecursionGuard(this);
 
-  // Common code for hashing helpers.
-  ODRHash Hash;
-  auto ComputeQualTypeODRHash = [](QualType Ty) {
-Hash.clear();
-Hash.AddQualType(Ty);
-return Hash.CalculateHash();
-  };
-
-  auto ComputeODRHash = [](const Stmt *S) {
-assert(S);
-Hash.clear();
-Hash.AddStmt(S);
-return Hash.CalculateHash();
-  };
-
-  auto ComputeSubDeclODRHash = [](const Decl *D) {
-assert(D);
-Hash.clear();
-Hash.AddSubDecl(D);
-return Hash.CalculateHash();
-  };
-
-  auto ComputeTemplateArgumentODRHash = [](const TemplateArgument ) {
-Hash.clear();
-Hash.AddTemplateArgument(TA);
-return Hash.CalculateHash();
-  };
-
-  auto ComputeTemplateParameterListODRHash =
-  [](const TemplateParameterList *TPL) {
-assert(TPL);
-Hash.clear();
-Hash.AddTemplateParameterList(TPL);
-return Hash.CalculateHash();
-  };
-
   // Used with err_module_odr_violation_mismatch_decl and
   // note_module_odr_violation_mismatch_decl
   // This list should be the same Decl's as in ODRHash::isDeclToBeProcessed
@@ -9638,49 +9634,13 @@
 Other
   };
 
-  // Used with err_module_odr_violation_record and
-  // note_module_odr_violation_record
-  enum ODRCXXRecordDifference {
-StaticAssertCondition,
-StaticAssertMessage,
-StaticAssertOnlyMessage,
-MethodName,
-MethodDeleted,
-MethodDefaulted,
-MethodVirtual,
-MethodStatic,
-MethodVolatile,
-MethodConst,
-MethodInline,
-MethodNumberParameters,
-MethodParameterType,
-MethodParameterName,
-MethodParameterSingleDefaultArgument,
-MethodParameterDifferentDefaultArgument,
-MethodNoTemplateArguments,
-MethodDifferentNumberTemplateArguments,
-MethodDifferentTemplateArgument,
-MethodSingleBody,
-MethodDifferentBody,
-FriendTypeFunction,
-FriendType,
-FriendFunction,
-FunctionTemplateDifferentNumberParameters,
-FunctionTemplateParameterDifferentKind,
-FunctionTemplateParameterName,
-FunctionTemplateParameterSingleDefaultArgument,
-FunctionTemplateParameterDifferentDefaultArgument,
-FunctionTemplateParameterDifferentType,
-FunctionTemplatePackParameter,
-  };
-
   // These lambdas have the common portions of the ODR diagnostics.  This
   // has the same return as Diag(), so addition parameters can be passed
   // in with operator<<
-  auto ODRDiagField = [this, , ](
-  NamedDecl *FirstRecord, StringRef FirstModule,
-  StringRef SecondModule, FieldDecl *FirstField,
-  FieldDecl *SecondField) {
+  auto ODRDiagField = [this](NamedDecl *FirstRecord, StringRef FirstModule,
+ StringRef SecondModule,
+ const FieldDecl *FirstField,
+ const FieldDecl *SecondField) {
 enum ODRFieldDifference {
   FieldName,
   FieldTypeName,
@@ -9718,8 +9678,7 @@
 
 QualType FirstType = FirstField->getType();
 QualType SecondType = SecondField->getType();
-if (ComputeQualTypeODRHash(FirstType) !=
-ComputeQualTypeODRHash(SecondType)) {
+if (computeODRHash(FirstType) != computeODRHash(SecondType)) {
   DiagError(FieldTypeName) << FirstII << FirstType;
   DiagNote(FieldTypeName) << SecondII << SecondType;
   return true;
@@ -9734,10 +9693,8 @@
 }
 
 if (IsFirstBitField && IsSecondBitField) {
-  

[PATCH] D129068: [AST] Accept identical TypeConstraint referring to other template parameters.

2022-07-08 Thread Volodymyr Sapsai via Phabricator via cfe-commits
vsapsai added a comment.

Thanks for the changes, they look good! While I was looking how we handle 
"requires" constraints in other cases, I've noticed that they are suspiciously 
similar. That's why I offer the following change to unify comparison of the 
constraint expressions

  diff --git a/clang/include/clang/AST/ASTContext.h 
b/clang/include/clang/AST/ASTContext.h
  index 92293622cc3d..555669f027a7 100644
  --- a/clang/include/clang/AST/ASTContext.h
  +++ b/clang/include/clang/AST/ASTContext.h
  @@ -2664,6 +2664,11 @@ public:
 /// that they may be used in declarations of the same template.
 bool isSameTemplateParameter(const NamedDecl *X, const NamedDecl *Y) const;
   
  +  /// Determine whether two 'requires' expressions are similar enough.
  +  /// Use of 'requires' isn't mandatory, works with constraints expressed in
  +  /// other ways too.
  +  bool isSameConstraintExpr(const Expr *XCE, const Expr *YCE) const;
  +
 /// Retrieve the "canonical" template argument.
 ///
 /// The canonical template argument is the simplest template argument
  diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
  index aced0ab39ace..f3937d6304f9 100644
  --- a/clang/lib/AST/ASTContext.cpp
  +++ b/clang/lib/AST/ASTContext.cpp
  @@ -6245,14 +6245,10 @@ bool ASTContext::isSameTemplateParameter(const 
NamedDecl *X,
   auto *TYTCArgs = TYTC->getTemplateArgsAsWritten();
   if (TXTCArgs->NumTemplateArgs != TYTCArgs->NumTemplateArgs)
 return false;
  -llvm::FoldingSetNodeID XID, YID;
  -for (auto  : TXTCArgs->arguments())
  -  ArgLoc.getArgument().Profile(XID, X->getASTContext());
  -for (auto  : TYTCArgs->arguments())
  -  ArgLoc.getArgument().Profile(YID, Y->getASTContext());
  -if (XID != YID)
  -  return false;
 }
  +  if (!isSameConstraintExpr(TXTC->getImmediatelyDeclaredConstraint(),
  +TYTC->getImmediatelyDeclaredConstraint()))
  +return false;
   }
   return true;
 }
  @@ -6279,15 +6275,20 @@ bool ASTContext::isSameTemplateParameterList(
   if (!isSameTemplateParameter(X->getParam(I), Y->getParam(I)))
 return false;
   
  -  const Expr *XRC = X->getRequiresClause();
  -  const Expr *YRC = Y->getRequiresClause();
  -  if (!XRC != !YRC)
  +  if (!isSameConstraintExpr(X->getRequiresClause(), Y->getRequiresClause()))
   return false;
  -  if (XRC) {
  -llvm::FoldingSetNodeID XRCID, YRCID;
  -XRC->Profile(XRCID, *this, /*Canonical=*/true);
  -YRC->Profile(YRCID, *this, /*Canonical=*/true);
  -if (XRCID != YRCID)
  +
  +  return true;
  +}
  +
  +bool ASTContext::isSameConstraintExpr(const Expr *XCE, const Expr *YCE) 
const {
  +  if (!XCE != !YCE)
  +return false;
  +  if (XCE) {
  +llvm::FoldingSetNodeID XCEID, YCEID;
  +XCE->Profile(XCEID, *this, /*Canonical=*/true);
  +YCE->Profile(YCEID, *this, /*Canonical=*/true);
  +if (XCEID != YCEID)
 return false;
 }
   
  @@ -6450,17 +6451,9 @@ bool ASTContext::isSameEntity(const NamedDecl *X, 
const NamedDecl *Y) const {
   return false;
   }
   
  -const Expr *XRC = FuncX->getTrailingRequiresClause();
  -const Expr *YRC = FuncY->getTrailingRequiresClause();
  -if (!XRC != !YRC)
  +if (!isSameConstraintExpr(FuncX->getTrailingRequiresClause(),
  +  FuncY->getTrailingRequiresClause()))
 return false;
  -if (XRC) {
  -  llvm::FoldingSetNodeID XRCID, YRCID;
  -  XRC->Profile(XRCID, *this, /*Canonical=*/true);
  -  YRC->Profile(YRCID, *this, /*Canonical=*/true);
  -  if (XRCID != YRCID)
  -return false;
  -}
   
   auto GetTypeAsWritten = [](const FunctionDecl *FD) {
 // Map to the first declaration that we've already merged into this 
one.

In `ASTContext::isSameTemplateParameter` it is exactly the same change as yours 
modulo comments.




Comment at: clang/test/Modules/concept.cppm:38
+  template <__integer_like _Tp, C<_Tp> Sentinel>
+  constexpr _Tp operator()(_Tp &&__t, Sentinel &) const {
+return __t;

In what cases `operator()` is critical for the test? I was thinking about 
replacing with something like "funcA", "funcB", "funcC", so that diagnostic 
verification is easier because it is tricky to understand which method 
"__fn::operator()" refers to.


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

https://reviews.llvm.org/D129068

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


[PATCH] D102107: [OpenMP] Codegen aggregate for outlined function captures

2022-07-08 Thread Dhruva Chakrabarti via Phabricator via cfe-commits
dhruvachak added inline comments.



Comment at: llvm/lib/Transforms/IPO/OpenMPOpt.cpp:4263
 case OMPRTL___kmpc_nvptx_end_reduce_nowait:
+case OMPRTL___kmpc_alloc_aggregate_arg:
   break;

dhruvachak wrote:
> @jdoerfert Is this enough to enable SPMDization or is further handling 
> required?
Just to be clear, this change does allow SPMDization now but want to make sure 
nothing else is missing.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102107

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


[PATCH] D102107: [OpenMP] Codegen aggregate for outlined function captures

2022-07-08 Thread Dhruva Chakrabarti via Phabricator via cfe-commits
dhruvachak added inline comments.



Comment at: llvm/lib/Transforms/IPO/OpenMPOpt.cpp:4263
 case OMPRTL___kmpc_nvptx_end_reduce_nowait:
+case OMPRTL___kmpc_alloc_aggregate_arg:
   break;

@jdoerfert Is this enough to enable SPMDization or is further handling required?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102107

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


[PATCH] D102107: [OpenMP] Codegen aggregate for outlined function captures

2022-07-08 Thread Dhruva Chakrabarti via Phabricator via cfe-commits
dhruvachak added a comment.

In D102107#3640232 , @jdoerfert wrote:

> In D102107#3640198 , @dhruvachak 
> wrote:
>
>> Thanks. I followed the above steps and regenerated a couple of the AST tests 
>> but they still fail. Perhaps I am missing some options?
>>
>> I currently have a handful of clang test failures where regen did not work. 
>> I am going to update the patch, post the current test results, and we can 
>> figure out how to regen the rest before we land this patch.
>
> So, generate check lines for new tests in a separate patch first.

Not sure what you mean by new tests. make check-clang has a few failures on 
existing tests. I think all of them are regen issues. I will post the results.

> For the AST ones, you need to take the run line of the test, not what I 
> posted there. If it doesn't work, one needs to check why. Hard to diagnose 
> and I don't remember if there is something else. Maybe you need to only 
> include part of it?

Yes, I took the run line of the test. The regen worked OK, I removed the old 
CHECK lines and added the new ones. But make check-clang still flags it as a 
failure. As you said, we need to understand why.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102107

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


[PATCH] D102107: [OpenMP] Codegen aggregate for outlined function captures

2022-07-08 Thread Dhruva Chakrabarti via Phabricator via cfe-commits
dhruvachak updated this revision to Diff 443399.
dhruvachak added a comment.
Herald added a subscriber: hiraditya.

Fixed opaque pointer miscompile.
Added alloc_aggregate_arg entry point to OpenMPOpt SPMD list.
Fixed nocapture attribute of __kmpc_alloc_aggregate_arg,
Added align attribute for call to __kmpc_alloc_shared.
Updated (most) failing clang tests.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102107

Files:
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/lib/CodeGen/CGOpenMPRuntime.h
  clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
  clang/lib/CodeGen/CGOpenMPRuntimeGPU.h
  clang/lib/CodeGen/CGStmtOpenMP.cpp
  clang/lib/CodeGen/CodeGenFunction.h
  clang/lib/Sema/SemaOpenMP.cpp
  clang/test/AST/ast-dump-openmp-distribute-parallel-for.c
  clang/test/OpenMP/cancel_codegen.cpp
  clang/test/OpenMP/cancellation_point_codegen.cpp
  clang/test/OpenMP/debug-info-complex-byval.cpp
  clang/test/OpenMP/debug-info-openmp-array.cpp
  clang/test/OpenMP/debug_threadprivate_copyin.c
  clang/test/OpenMP/declare_target_codegen_globalization.cpp
  clang/test/OpenMP/declare_variant_construct_codegen_1.c
  clang/test/OpenMP/distribute_codegen.cpp
  clang/test/OpenMP/distribute_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_num_threads_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_proc_bind_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_num_threads_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_proc_bind_codegen.cpp
  clang/test/OpenMP/distribute_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_codegen.cpp
  clang/test/OpenMP/distribute_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_reduction_codegen.cpp
  clang/test/OpenMP/for_firstprivate_codegen.cpp
  clang/test/OpenMP/for_lastprivate_codegen.cpp
  clang/test/OpenMP/for_linear_codegen.cpp
  clang/test/OpenMP/for_private_codegen.cpp
  clang/test/OpenMP/for_reduction_codegen.cpp
  clang/test/OpenMP/for_reduction_codegen_UDR.cpp
  clang/test/OpenMP/for_reduction_task_codegen.cpp
  clang/test/OpenMP/master_taskloop_in_reduction_codegen.cpp
  clang/test/OpenMP/master_taskloop_simd_in_reduction_codegen.cpp
  clang/test/OpenMP/metadirective_device_kind_codegen.c
  clang/test/OpenMP/metadirective_device_kind_codegen.cpp
  clang/test/OpenMP/metadirective_implementation_codegen.cpp
  clang/test/OpenMP/nvptx_allocate_codegen.cpp
  clang/test/OpenMP/nvptx_data_sharing.cpp
  clang/test/OpenMP/nvptx_distribute_parallel_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_multi_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_nested_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_for_codegen.cpp
  clang/test/OpenMP/nvptx_target_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_num_threads_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_reduction_codegen_tbaa_PR46146.cpp
  clang/test/OpenMP/nvptx_target_teams_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp
  
clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/nvptx_teams_codegen.cpp
  clang/test/OpenMP/nvptx_teams_reduction_codegen.cpp
  clang/test/OpenMP/openmp_win_codegen.cpp
  clang/test/OpenMP/parallel_codegen.cpp
  clang/test/OpenMP/parallel_copyin_codegen.cpp
  clang/test/OpenMP/parallel_firstprivate_codegen.cpp
  clang/test/OpenMP/parallel_for_codegen.cpp
  clang/test/OpenMP/parallel_for_lastprivate_conditional.cpp
  clang/test/OpenMP/parallel_for_linear_codegen.cpp
  clang/test/OpenMP/parallel_for_reduction_task_codegen.cpp
  clang/test/OpenMP/parallel_for_simd_aligned_codegen.cpp
  clang/test/OpenMP/parallel_if_codegen.cpp
  clang/test/OpenMP/parallel_if_codegen_PR51349.cpp
  clang/test/OpenMP/parallel_master_codegen.cpp
  

[PATCH] D102107: [OpenMP] Codegen aggregate for outlined function captures

2022-07-08 Thread Joseph Huber via Phabricator via cfe-commits
jhuber6 added a comment.

In D102107#3640198 , @dhruvachak 
wrote:

> Thanks. I followed the above steps and regenerated a couple of the AST tests 
> but they still fail. Perhaps I am missing some options?
>
> I currently have a handful of clang test failures where regen did not work. I 
> am going to update the patch, post the current test results, and we can 
> figure out how to regen the rest before we land this patch.

Sometimes if `update_cc_test_check.py -i ${test}` you either just need to run 
it twice so the line numbers get updated on the kernel functions, or you can 
try taking the command line directly from the top of the file and running it 
again with that instead of `-u`. A few options aren't handled properly via the 
update with `-u` and need to be run again completely.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102107

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


[PATCH] D129008: [Clang][OpenMP] Fix the issue that globalization doesn't work with byval struct function argument

2022-07-08 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert added a comment.

In D129008#3640194 , @tianshilei1992 
wrote:

> `callCStructCopyConstructor` is actually for Objective-C…Cannot use it here.

Don't we generate copies of things elsewhere already?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129008

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


[PATCH] D102107: [OpenMP] Codegen aggregate for outlined function captures

2022-07-08 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert added a comment.

In D102107#3640198 , @dhruvachak 
wrote:

> Thanks. I followed the above steps and regenerated a couple of the AST tests 
> but they still fail. Perhaps I am missing some options?
>
> I currently have a handful of clang test failures where regen did not work. I 
> am going to update the patch, post the current test results, and we can 
> figure out how to regen the rest before we land this patch.

So, generate check lines for new tests in a separate patch first.
For the AST ones, you need to take the run line of the test, not what I posted 
there. If it doesn't work, one needs to check why. Hard to diagnose and I don't 
remember if there is something else. Maybe you need to only include part of it?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102107

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


[PATCH] D102107: [OpenMP] Codegen aggregate for outlined function captures

2022-07-08 Thread Dhruva Chakrabarti via Phabricator via cfe-commits
dhruvachak added a comment.

In D102107#3639735 , @jdoerfert wrote:

> F23722893: ast_dump_2_check.py >>! In 
> D102107#3639615 , @dhruvachak wrote:
>
>> In D102107#3639556 , @jdoerfert 
>> wrote:
>>
>>> In D102107#3639551 , @dhruvachak 
>>> wrote:
>>>
 Is there an llvm/utils script to update clang tests that have RUN lines at 
 the top? An example is clang/test/OpenMP/debug_threadprivate_copyin.c.
>>>
>>> You can create the run lines with the `llvm/utils/update_cc_test_checks.py` 
>>> script but those tests have manual lines for now.
>>> I usually run `llvm/utils/update_cc_test_checks.py -u 
>>> clang/test/OpenMP/*.{c,cpp}` to update all autogenerated tests.
>>
>> Okay, I will convert those few manual OpenMP tests to autogen format.
>>
>> How about the AST ones? Do they have to be manually updated? Example: 
>> clang/test/AST/ast-dump-openmp-distribute-parallel-for-simd.c
>
> For these ones I have a script locally (attached) that need some manual doing 
> but it helps:
>
>   1. run the ast dump and store the result (same as RUN line), e.g.,
> {F23722650} clang -cc1 -internal-isystem 
> /data/build/llvm-project/lib/clang/13.0.0/include -nostdsysteminc -triple 
> x86_64-unknown-unknown -fopenmp -verify -ast-dump 
> /data/src/llvm-project/clang/test/AST/ast-dump-openmp-begin-declare-variant_template_4.cpp
>  &> /tmp/ast
>   2. python3 ast_dump_2_check.py /tmp/ast CHECK
>   3. replace the check lines with the content of /tmp/ast.check

Thanks. I followed the above steps and regenerated a couple of the AST tests 
but they still fail. Perhaps I am missing some options?

I currently have a handful of clang test failures where regen did not work. I 
am going to update the patch, post the current test results, and we can figure 
out how to regen the rest before we land this patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102107

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


[PATCH] D129008: [Clang][OpenMP] Fix the issue that globalization doesn't work with byval struct function argument

2022-07-08 Thread Shilei Tian via Phabricator via cfe-commits
tianshilei1992 planned changes to this revision.
tianshilei1992 added a comment.

`callCStructCopyConstructor` is actually for Objective-C…Cannot use it here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129008

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


[PATCH] D128950: Add 'sanitize_memtag' Global IR attribute

2022-07-08 Thread Mitch Phillips via Phabricator via cfe-commits
hctim updated this revision to Diff 443390.
hctim added a comment.
Herald added subscribers: cfe-commits, ormris, steven_wu.
Herald added a project: clang.

After talking with Evgenii offline, and testing, clearly we don't need an 
exclude mask. Update the patch to remove the exclude mask, and replace it with 
an include mask.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128950

Files:
  clang/lib/CodeGen/SanitizerMetadata.cpp
  clang/test/CodeGen/memtag-globals.cpp
  clang/test/CodeGen/sanitizer-special-case-list-globals.c
  llvm/include/llvm/AsmParser/LLToken.h
  llvm/include/llvm/IR/GlobalValue.h
  llvm/lib/AsmParser/LLLexer.cpp
  llvm/lib/AsmParser/LLParser.cpp
  llvm/lib/Bitcode/Reader/BitcodeReader.cpp
  llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
  llvm/lib/IR/AsmWriter.cpp
  llvm/test/Assembler/globalvariable-attributes.ll
  llvm/test/Bitcode/compatibility.ll

Index: llvm/test/Bitcode/compatibility.ll
===
--- llvm/test/Bitcode/compatibility.ll
+++ llvm/test/Bitcode/compatibility.ll
@@ -206,14 +206,16 @@
 ; Global Variables -- sanitizers
 @g.no_sanitize_address = global i32 0, no_sanitize_address
 @g.no_sanitize_hwaddress = global i32 0, no_sanitize_hwaddress
-@g.no_sanitize_memtag = global i32 0, no_sanitize_memtag
-@g.no_sanitize_multiple = global i32 0, no_sanitize_address, no_sanitize_hwaddress, no_sanitize_memtag
+@g.sanitize_memtag = global i32 0, sanitize_memtag
+@g.no_sanitize_multiple = global i32 0, no_sanitize_address, no_sanitize_hwaddress
 @g.sanitize_address_dyninit = global i32 0, sanitize_address_dyninit
+@g.sanitize_multiple = global i32 0, sanitize_memtag, sanitize_address_dyninit
 ; CHECK: @g.no_sanitize_address = global i32 0, no_sanitize_address
 ; CHECK: @g.no_sanitize_hwaddress = global i32 0, no_sanitize_hwaddress
-; CHECK: @g.no_sanitize_memtag = global i32 0, no_sanitize_memtag
-; CHECK: @g.no_sanitize_multiple = global i32 0, no_sanitize_address, no_sanitize_hwaddress, no_sanitize_memtag
+; CHECK: @g.sanitize_memtag = global i32 0, sanitize_memtag
+; CHECK: @g.no_sanitize_multiple = global i32 0, no_sanitize_address, no_sanitize_hwaddress
 ; CHECK: @g.sanitize_address_dyninit = global i32 0, sanitize_address_dyninit
+; CHECK: @g.sanitize_multiple = global i32 0, sanitize_memtag, sanitize_address_dyninit
 
 ;; Aliases
 ; Format: @ = [Linkage] [Visibility] [DLLStorageClass] [ThreadLocal]
Index: llvm/test/Assembler/globalvariable-attributes.ll
===
--- llvm/test/Assembler/globalvariable-attributes.ll
+++ llvm/test/Assembler/globalvariable-attributes.ll
@@ -6,9 +6,9 @@
 @g4 = global i32 2, align 4 "key5" = "value5" #0
 @g5 = global i32 2, no_sanitize_address, align 4
 @g6 = global i32 2, no_sanitize_hwaddress, align 4
-@g7 = global i32 2, no_sanitize_memtag, align 4
-@g8 = global i32 2, sanitize_address_dyninit, align 4
-@g9 = global i32 2, no_sanitize_address, no_sanitize_hwaddress, no_sanitize_memtag, align 4
+@g7 = global i32 2, sanitize_address_dyninit, align 4
+@g8 = global i32 2, sanitize_memtag, align 4
+@g9 = global i32 2, no_sanitize_address, no_sanitize_hwaddress, sanitize_memtag, align 4
 
 attributes #0 = { "string" = "value" nobuiltin norecurse }
 
@@ -18,9 +18,9 @@
 ; CHECK: @g4 = global i32 2, align 4 #3
 ; CHECK: @g5 = global i32 2, no_sanitize_address, align 4
 ; CHECK: @g6 = global i32 2, no_sanitize_hwaddress, align 4
-; CHECK: @g7 = global i32 2, no_sanitize_memtag, align 4
-; CHECK: @g8 = global i32 2, sanitize_address_dyninit, align 4
-; CHECK: @g9 = global i32 2, no_sanitize_address, no_sanitize_hwaddress, no_sanitize_memtag, align 4
+; CHECK: @g7 = global i32 2, sanitize_address_dyninit, align 4
+; CHECK: @g8 = global i32 2, sanitize_memtag, align 4
+; CHECK: @g9 = global i32 2, no_sanitize_address, no_sanitize_hwaddress, sanitize_memtag, align 4
 
 ; CHECK: attributes #0 = { "key"="value" "key2"="value2" }
 ; CHECK: attributes #1 = { "key3"="value3" }
Index: llvm/lib/IR/AsmWriter.cpp
===
--- llvm/lib/IR/AsmWriter.cpp
+++ llvm/lib/IR/AsmWriter.cpp
@@ -3542,8 +3542,8 @@
   Out << ", no_sanitize_address";
 if (MD.NoHWAddress)
   Out << ", no_sanitize_hwaddress";
-if (MD.NoMemtag)
-  Out << ", no_sanitize_memtag";
+if (MD.Memtag)
+  Out << ", sanitize_memtag";
 if (MD.IsDynInit)
   Out << ", sanitize_address_dyninit";
   }
Index: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
===
--- llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -1230,7 +1230,7 @@
 static unsigned
 serializeSanitizerMetadata(const GlobalValue::SanitizerMetadata ) {
   return Meta.NoAddress | (Meta.NoHWAddress << 1) |
- (Meta.NoMemtag << 2) | (Meta.IsDynInit << 3);
+  

[PATCH] D129389: [clang][deps] Override dependency and serialized diag files for modules

2022-07-08 Thread Ben Langmuir via Phabricator via cfe-commits
benlangmuir updated this revision to Diff 443379.
benlangmuir added a comment.

Updates:

- Made lookup of module outputs fallible. Not currently used by 
clang-scan-deps, but since the expectation is for a build system to provide 
these settings account for possibility of errors.
- Attempt to fix windows path issue in test


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129389

Files:
  clang/include/clang/Tooling/DependencyScanning/DependencyScanningTool.h
  clang/include/clang/Tooling/DependencyScanning/ModuleDepCollector.h
  clang/lib/Tooling/DependencyScanning/DependencyScanningTool.cpp
  clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
  clang/test/ClangScanDeps/Inputs/removed-args/cdb.json.template
  clang/test/ClangScanDeps/generate-modules-path-args.c
  clang/test/ClangScanDeps/preserved-args.c
  clang/test/ClangScanDeps/removed-args.c
  clang/tools/clang-scan-deps/ClangScanDeps.cpp

Index: clang/tools/clang-scan-deps/ClangScanDeps.cpp
===
--- clang/tools/clang-scan-deps/ClangScanDeps.cpp
+++ clang/tools/clang-scan-deps/ClangScanDeps.cpp
@@ -288,11 +288,16 @@
   Modules.insert(I, {{MD.ID, InputIndex}, std::move(MD)});
 }
 
-ID.CommandLine = GenerateModulesPathArgs
- ? FD.getCommandLine(
-   [&](ModuleID MID) { return lookupPCMPath(MID); })
- : FD.getCommandLineWithoutModulePaths();
-
+if (Inputs.size() == 0)
+  inferOutputOptions(FD.OriginalCommandLine);
+
+ID.CommandLine =
+GenerateModulesPathArgs
+? llvm::cantFail(FD.getCommandLine(
+  [&](ModuleID MID) -> const ModuleOutputOptions & {
+return lookupModuleOutputs(MID);
+  }))
+: FD.getCommandLineWithoutModulePaths();
 Inputs.push_back(std::move(ID));
   }
 
@@ -324,8 +329,10 @@
   {"clang-modulemap-file", MD.ClangModuleMapFile},
   {"command-line",
GenerateModulesPathArgs
-   ? MD.getCanonicalCommandLine(
- [&](ModuleID MID) { return lookupPCMPath(MID); })
+   ? llvm::cantFail(MD.getCanonicalCommandLine(
+ [&](ModuleID MID) -> const ModuleOutputOptions & {
+   return lookupModuleOutputs(MID);
+ }))
: MD.getCanonicalCommandLineWithoutModulePaths()},
   };
   OutModules.push_back(std::move(O));
@@ -352,11 +359,17 @@
   }
 
 private:
-  StringRef lookupPCMPath(ModuleID MID) {
-auto PCMPath = PCMPaths.insert({MID, ""});
-if (PCMPath.second)
-  PCMPath.first->second = constructPCMPath(MID);
-return PCMPath.first->second;
+  const ModuleOutputOptions (const ModuleID ) {
+auto MO = ModuleOutputs.insert({MID, {}});
+if (MO.second) {
+  ModuleOutputOptions  = MO.first->second;
+  Opts.ModuleFile = constructPCMPath(MID);
+  if (DependencyOutputFile)
+Opts.DependencyFile = Opts.ModuleFile + ".d";
+  if (SerializeDiags)
+Opts.DiagnosticSerializationFile = Opts.ModuleFile + ".diag";
+}
+return MO.first->second;
   }
 
   /// Construct a path for the explicitly built PCM.
@@ -375,6 +388,19 @@
 return std::string(ExplicitPCMPath);
   }
 
+  /// Infer whether modules should write serialized diagnostic, .d, etc.
+  ///
+  /// A build system should model this directly, but here we infer it from an
+  /// original TU command.
+  void inferOutputOptions(ArrayRef Args) {
+for (StringRef Arg : Args) {
+  if (Arg == "-serialize-diagnostics")
+SerializeDiags = true;
+  else if (Arg == "-M" || Arg == "-MM" || Arg == "-MMD" || Arg == "-MD")
+DependencyOutputFile = true;
+}
+  }
+
   struct IndexedModuleID {
 ModuleID ID;
 mutable size_t InputIndex;
@@ -404,8 +430,11 @@
   std::mutex Lock;
   std::unordered_map
   Modules;
-  std::unordered_map PCMPaths;
+  std::unordered_map
+  ModuleOutputs;
   std::vector Inputs;
+  bool SerializeDiags = false;
+  bool DependencyOutputFile = false;
 };
 
 static bool handleFullDependencyToolResult(
Index: clang/test/ClangScanDeps/removed-args.c
===
--- clang/test/ClangScanDeps/removed-args.c
+++ clang/test/ClangScanDeps/removed-args.c
@@ -29,6 +29,9 @@
 // CHECK-NOT:  "-fbuild-session-timestamp=
 // CHECK-NOT:  "-fmodules-prune-interval=
 // CHECK-NOT:  "-fmodules-prune-after=
+// CHECK-NOT:  "-dependency-file"
+// CHECK-NOT:  "-MT"
+// CHECK-NOT:  "-serialize-diagnostic-file"
 // CHECK:],
 // CHECK-NEXT:   "context-hash": "[[HASH_MOD_HEADER:.*]]",
 // CHECK-NEXT:   "file-deps": [
@@ -50,6 +53,9 @@
 // CHECK-NOT:  "-fbuild-session-timestamp=
 // CHECK-NOT:  

[PATCH] D128465: [llvm] cmake config groundwork to have ZSTD in LLVM

2022-07-08 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay reopened this revision.
MaskRay added a comment.
This revision is now accepted and ready to land.

This patch has changed a lot from what I have reviewed. The CMake change should 
be added along with `llvm::compression::zstd::*` functions.
Otherwise the change just introduces some CMake variables which cannot be 
tested.

Since you haven't touched flang, compiler-rt, etc. The patch should not updated 
their CMake files.

For lld/ELF, I've created D129406  to add the 
support. It will need to wait until you have landed these zstd changes.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128465

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


[PATCH] D129165: [AIX][clang/test] Set/propagate AIXTHREAD_STK for AIX

2022-07-08 Thread Hubert Tong via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGbd8b55e609c8: [AIX][clang/test] Set/propagate AIXTHREAD_STK 
for AIX (authored by hubert.reinterpretcast).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129165

Files:
  clang/test/Driver/arm-float-abi-lto.c
  clang/test/Index/lit.local.cfg
  clang/test/lit.cfg.py


Index: clang/test/lit.cfg.py
===
--- clang/test/lit.cfg.py
+++ clang/test/lit.cfg.py
@@ -264,3 +264,13 @@
   '/ASTMerge/anonymous-fields', 
'/ASTMerge/injected-class-name-decl'):
 exclude_unsupported_files_for_aix(config.test_source_root + directory)
 
+# Some tests perform deep recursion, which requires a larger pthread stack size
+# than the relatively low default of 192 KiB for 64-bit processes on AIX. The
+# `AIXTHREAD_STK` environment variable provides a non-intrusive way to request
+# a larger pthread stack size for the tests. Various applications and runtime
+# libraries on AIX use a default pthread stack size of 4 MiB, so we will use
+# that as a default value here.
+if 'AIXTHREAD_STK' in os.environ:
+config.environment['AIXTHREAD_STK'] = os.environ['AIXTHREAD_STK']
+elif platform.system() == 'AIX':
+config.environment['AIXTHREAD_STK'] = '4194304'
Index: clang/test/Index/lit.local.cfg
===
--- clang/test/Index/lit.local.cfg
+++ /dev/null
@@ -1,12 +0,0 @@
-import platform
-
-# Some tests perform deep recursion, which requires a larger pthread stack size
-# than the relatively low default of 192 KiB for 64-bit processes on AIX. The
-# `AIXTHREAD_STK` environment variable provides a non-intrusive way to request
-# a larger pthread stack size for the tests. Various applications and runtime
-# libraries on AIX use a default pthread stack size of 4 MiB, so we will use
-# that as a default value here.
-if 'AIXTHREAD_STK' in os.environ:
-config.environment['AIXTHREAD_STK'] = os.environ['AIXTHREAD_STK']
-elif platform.system() == 'AIX':
-config.environment['AIXTHREAD_STK'] = '4194304'
Index: clang/test/Driver/arm-float-abi-lto.c
===
--- clang/test/Driver/arm-float-abi-lto.c
+++ clang/test/Driver/arm-float-abi-lto.c
@@ -1,5 +1,3 @@
-// FIXME: Produces a segmentation fault on AIX after the introduction of 
opaque pointers (D125847). 
-// UNSUPPORTED: system-aix
 // REQUIRES: arm-registered-target
 
 // RUN: %clang --target=arm-none-eabi -mcpu=cortex-m33 -mfloat-abi=hard -O1 %s 
-S -o - -emit-llvm -DCALL_LIB -DDEFINE_LIB | FileCheck %s


Index: clang/test/lit.cfg.py
===
--- clang/test/lit.cfg.py
+++ clang/test/lit.cfg.py
@@ -264,3 +264,13 @@
   '/ASTMerge/anonymous-fields', '/ASTMerge/injected-class-name-decl'):
 exclude_unsupported_files_for_aix(config.test_source_root + directory)
 
+# Some tests perform deep recursion, which requires a larger pthread stack size
+# than the relatively low default of 192 KiB for 64-bit processes on AIX. The
+# `AIXTHREAD_STK` environment variable provides a non-intrusive way to request
+# a larger pthread stack size for the tests. Various applications and runtime
+# libraries on AIX use a default pthread stack size of 4 MiB, so we will use
+# that as a default value here.
+if 'AIXTHREAD_STK' in os.environ:
+config.environment['AIXTHREAD_STK'] = os.environ['AIXTHREAD_STK']
+elif platform.system() == 'AIX':
+config.environment['AIXTHREAD_STK'] = '4194304'
Index: clang/test/Index/lit.local.cfg
===
--- clang/test/Index/lit.local.cfg
+++ /dev/null
@@ -1,12 +0,0 @@
-import platform
-
-# Some tests perform deep recursion, which requires a larger pthread stack size
-# than the relatively low default of 192 KiB for 64-bit processes on AIX. The
-# `AIXTHREAD_STK` environment variable provides a non-intrusive way to request
-# a larger pthread stack size for the tests. Various applications and runtime
-# libraries on AIX use a default pthread stack size of 4 MiB, so we will use
-# that as a default value here.
-if 'AIXTHREAD_STK' in os.environ:
-config.environment['AIXTHREAD_STK'] = os.environ['AIXTHREAD_STK']
-elif platform.system() == 'AIX':
-config.environment['AIXTHREAD_STK'] = '4194304'
Index: clang/test/Driver/arm-float-abi-lto.c
===
--- clang/test/Driver/arm-float-abi-lto.c
+++ clang/test/Driver/arm-float-abi-lto.c
@@ -1,5 +1,3 @@
-// FIXME: Produces a segmentation fault on AIX after the introduction of opaque pointers (D125847). 
-// UNSUPPORTED: system-aix
 // REQUIRES: arm-registered-target
 
 // RUN: %clang --target=arm-none-eabi -mcpu=cortex-m33 -mfloat-abi=hard -O1 %s -S 

[clang] bd8b55e - [AIX][clang/test] Set/propagate AIXTHREAD_STK for AIX

2022-07-08 Thread Hubert Tong via cfe-commits

Author: Hubert Tong
Date: 2022-07-08T18:33:16-04:00
New Revision: bd8b55e609c825f1063a28ef94502a6bfed7a0fd

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

LOG: [AIX][clang/test] Set/propagate AIXTHREAD_STK for AIX

Some tests perform deep recursion, which requires a larger pthread stack
size than the relatively low default of 192 KiB for 64-bit processes on
AIX. The `AIXTHREAD_STK` environment variable provides a non-intrusive
way to request a larger pthread stack size for the tests. The required
pthread stack size depends on the build configuration.

A 4 MiB default is generous compared to the 512 KiB of macOS; however,
it is known that some compilers on AIX produce code that uses
comparatively more stack space.

This patch expands the solution from D65688 to apply to all Clang LIT
tests.

This also reverts commit c3c75d805c2174388417080f762230961b3433d6,
"[clang][test] Mark test arm-float-abi-lto.c unsupported on AIX".

The problem was caused by the test running up against the per-thread
stack limit on AIX. This is resolved by having the tests run with
`AIXTHREAD_STK` set for 4 MiB.

Reviewed By: xingxue

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

Added: 


Modified: 
clang/test/Driver/arm-float-abi-lto.c
clang/test/lit.cfg.py

Removed: 
clang/test/Index/lit.local.cfg



diff  --git a/clang/test/Driver/arm-float-abi-lto.c 
b/clang/test/Driver/arm-float-abi-lto.c
index bde61ce16441b..8b6d8ff6b5d7a 100644
--- a/clang/test/Driver/arm-float-abi-lto.c
+++ b/clang/test/Driver/arm-float-abi-lto.c
@@ -1,5 +1,3 @@
-// FIXME: Produces a segmentation fault on AIX after the introduction of 
opaque pointers (D125847). 
-// UNSUPPORTED: system-aix
 // REQUIRES: arm-registered-target
 
 // RUN: %clang --target=arm-none-eabi -mcpu=cortex-m33 -mfloat-abi=hard -O1 %s 
-S -o - -emit-llvm -DCALL_LIB -DDEFINE_LIB | FileCheck %s

diff  --git a/clang/test/Index/lit.local.cfg b/clang/test/Index/lit.local.cfg
deleted file mode 100644
index fb7d197d82388..0
--- a/clang/test/Index/lit.local.cfg
+++ /dev/null
@@ -1,12 +0,0 @@
-import platform
-
-# Some tests perform deep recursion, which requires a larger pthread stack size
-# than the relatively low default of 192 KiB for 64-bit processes on AIX. The
-# `AIXTHREAD_STK` environment variable provides a non-intrusive way to request
-# a larger pthread stack size for the tests. Various applications and runtime
-# libraries on AIX use a default pthread stack size of 4 MiB, so we will use
-# that as a default value here.
-if 'AIXTHREAD_STK' in os.environ:
-config.environment['AIXTHREAD_STK'] = os.environ['AIXTHREAD_STK']
-elif platform.system() == 'AIX':
-config.environment['AIXTHREAD_STK'] = '4194304'

diff  --git a/clang/test/lit.cfg.py b/clang/test/lit.cfg.py
index fd86353c8cc36..d95ea5d2da198 100644
--- a/clang/test/lit.cfg.py
+++ b/clang/test/lit.cfg.py
@@ -264,3 +264,13 @@ def exclude_unsupported_files_for_aix(dirname):
   '/ASTMerge/anonymous-fields', 
'/ASTMerge/injected-class-name-decl'):
 exclude_unsupported_files_for_aix(config.test_source_root + directory)
 
+# Some tests perform deep recursion, which requires a larger pthread stack size
+# than the relatively low default of 192 KiB for 64-bit processes on AIX. The
+# `AIXTHREAD_STK` environment variable provides a non-intrusive way to request
+# a larger pthread stack size for the tests. Various applications and runtime
+# libraries on AIX use a default pthread stack size of 4 MiB, so we will use
+# that as a default value here.
+if 'AIXTHREAD_STK' in os.environ:
+config.environment['AIXTHREAD_STK'] = os.environ['AIXTHREAD_STK']
+elif platform.system() == 'AIX':
+config.environment['AIXTHREAD_STK'] = '4194304'



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


[PATCH] D129373: [NFC] Minor cleanup of usage of FloatModeKind with bitmask enums

2022-07-08 Thread Shafik Yaghmour via Phabricator via cfe-commits
shafik added inline comments.



Comment at: clang/include/clang/Basic/TargetInfo.h:894
   bool useObjCFPRetForRealType(FloatModeKind T) const {
-return RealTypeUsesObjCFPRetMask & llvm::BitmaskEnumDetail::Underlying(T);
+return (int)((FloatModeKind)RealTypeUsesObjCFPRetMask & T);
   }

Why not just cast directly to `bool`? 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129373

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


[PATCH] D129404: Change default C dialect for PS5 to gnu17/gnu18.

2022-07-08 Thread Sunil Srivastava via Phabricator via cfe-commits
Sunil_Srivastava created this revision.
Sunil_Srivastava added reviewers: probinson, wristow.
Herald added a project: All.
Sunil_Srivastava requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D129404

Files:
  clang/lib/Basic/LangStandards.cpp
  clang/test/Preprocessor/init.c


Index: clang/test/Preprocessor/init.c
===
--- clang/test/Preprocessor/init.c
+++ clang/test/Preprocessor/init.c
@@ -1342,7 +1342,8 @@
 // PS4:#define __SSE2__ 1
 // PS4:#define __SSE_MATH__ 1
 // PS4:#define __SSE__ 1
-// PS4:#define __STDC_VERSION__ 199901L
+// PS4ONLY:#define __STDC_VERSION__ 199901L
+// PS5ONLY:#define __STDC_VERSION__ 201710L
 // PS4:#define __UINTMAX_TYPE__ long unsigned int
 // PS4:#define __USER_LABEL_PREFIX__
 // PS4:#define __WCHAR_MAX__ 65535
Index: clang/lib/Basic/LangStandards.cpp
===
--- clang/lib/Basic/LangStandards.cpp
+++ clang/lib/Basic/LangStandards.cpp
@@ -61,8 +61,8 @@
 if (CLANG_DEFAULT_STD_C != LangStandard::lang_unspecified)
   return CLANG_DEFAULT_STD_C;
 
-// The PS4 and PS5 use C99 as the default C standard.
-if (T.isPS())
+// The PS4 uses C99 as the default C standard.
+if (T.isPS4())
   return LangStandard::lang_gnu99;
 return LangStandard::lang_gnu17;
   case Language::ObjC:


Index: clang/test/Preprocessor/init.c
===
--- clang/test/Preprocessor/init.c
+++ clang/test/Preprocessor/init.c
@@ -1342,7 +1342,8 @@
 // PS4:#define __SSE2__ 1
 // PS4:#define __SSE_MATH__ 1
 // PS4:#define __SSE__ 1
-// PS4:#define __STDC_VERSION__ 199901L
+// PS4ONLY:#define __STDC_VERSION__ 199901L
+// PS5ONLY:#define __STDC_VERSION__ 201710L
 // PS4:#define __UINTMAX_TYPE__ long unsigned int
 // PS4:#define __USER_LABEL_PREFIX__
 // PS4:#define __WCHAR_MAX__ 65535
Index: clang/lib/Basic/LangStandards.cpp
===
--- clang/lib/Basic/LangStandards.cpp
+++ clang/lib/Basic/LangStandards.cpp
@@ -61,8 +61,8 @@
 if (CLANG_DEFAULT_STD_C != LangStandard::lang_unspecified)
   return CLANG_DEFAULT_STD_C;
 
-// The PS4 and PS5 use C99 as the default C standard.
-if (T.isPS())
+// The PS4 uses C99 as the default C standard.
+if (T.isPS4())
   return LangStandard::lang_gnu99;
 return LangStandard::lang_gnu17;
   case Language::ObjC:
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D128465: [llvm] cmake config groundwork to have ZSTD in LLVM

2022-07-08 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added inline comments.



Comment at: lld/test/lit.site.cfg.py.in:21
 config.have_zlib = @LLVM_ENABLE_ZLIB@
+config.have_zstd = @LLVM_ENABLE_ZSTD@
 config.have_libxar = @LLVM_HAVE_LIBXAR@

MaskRay wrote:
> This needs a change in lld/test/CMakeLists.txt
> 
> Looks like you haven't run `ninja check-lld` as I mentioned.
Actually I am preparing a lld patch and you probably should drop have_zstd from 
lld/ for this patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128465

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


[PATCH] D128465: [llvm] cmake config groundwork to have ZSTD in LLVM

2022-07-08 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added inline comments.



Comment at: lld/test/lit.site.cfg.py.in:21
 config.have_zlib = @LLVM_ENABLE_ZLIB@
+config.have_zstd = @LLVM_ENABLE_ZSTD@
 config.have_libxar = @LLVM_HAVE_LIBXAR@

This needs a change in lld/test/CMakeLists.txt

Looks like you haven't run `ninja check-lld` as I mentioned.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128465

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


[PATCH] D128036: [CMake] Option to select C++ library for runtimes that use it

2022-07-08 Thread Petr Hosek via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGdf90d22704d8: [CMake] Option to select C++ library for 
runtimes that use it (authored by phosek).

Changed prior to commit:
  https://reviews.llvm.org/D128036?vs=437819=443367#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128036

Files:
  clang/cmake/caches/Fuchsia-stage2.cmake
  compiler-rt/CMakeLists.txt
  compiler-rt/lib/fuzzer/CMakeLists.txt
  compiler-rt/lib/orc/CMakeLists.txt
  compiler-rt/lib/xray/CMakeLists.txt

Index: compiler-rt/lib/xray/CMakeLists.txt
===
--- compiler-rt/lib/xray/CMakeLists.txt
+++ compiler-rt/lib/xray/CMakeLists.txt
@@ -138,7 +138,9 @@
 include_directories(..)
 include_directories(../../include)
 
-set(XRAY_CFLAGS ${COMPILER_RT_COMMON_CFLAGS})
+set(XRAY_CFLAGS
+  ${COMPILER_RT_COMMON_CFLAGS}
+  ${COMPILER_RT_CXX_CFLAGS})
 set(XRAY_COMMON_DEFINITIONS XRAY_HAS_EXCEPTIONS=1)
 
 # Too many existing bugs, needs cleanup.
@@ -147,6 +149,9 @@
 # We don't need RTTI in XRay, so turn that off.
 append_rtti_flag(OFF XRAY_CFLAGS)
 
+set(XRAY_LINK_FLAGS ${COMPILER_RT_COMMON_LINK_FLAGS})
+set(XRAY_LINK_LIBS ${COMPILER_RT_CXX_LINK_LIBS})
+
 append_list_if(
   COMPILER_RT_HAS_XRAY_COMPILER_FLAG XRAY_SUPPORTED=1 XRAY_COMMON_DEFINITIONS)
 append_list_if(
@@ -164,7 +169,6 @@
 endif()
 
 if (APPLE)
-  set(XRAY_LINK_LIBS ${SANITIZER_COMMON_LINK_LIBS})
   add_asm_sources(XRAY_ASM_SOURCES xray_trampoline_x86_64.S)
 
   add_weak_symbols("sanitizer_common" WEAK_SYMBOL_LINK_FLAGS)
@@ -213,7 +217,7 @@
 RTSanitizerCommonLibc
 CFLAGS ${XRAY_CFLAGS}
 DEFS ${XRAY_COMMON_DEFINITIONS}
-LINK_FLAGS ${SANITIZER_COMMON_LINK_FLAGS} ${WEAK_SYMBOL_LINK_FLAGS}
+LINK_FLAGS ${XRAY_LINK_FLAGS} ${WEAK_SYMBOL_LINK_FLAGS}
 LINK_LIBS ${XRAY_LINK_LIBS}
 PARENT_TARGET xray)
   add_compiler_rt_runtime(clang_rt.xray-fdr
@@ -223,7 +227,7 @@
 OBJECT_LIBS RTXrayFDR
 CFLAGS ${XRAY_CFLAGS}
 DEFS ${XRAY_COMMON_DEFINITIONS}
-LINK_FLAGS ${SANITIZER_COMMON_LINK_FLAGS} ${WEAK_SYMBOL_LINK_FLAGS}
+LINK_FLAGS ${XRAY_LINK_FLAGS} ${WEAK_SYMBOL_LINK_FLAGS}
 LINK_LIBS ${XRAY_LINK_LIBS}
 PARENT_TARGET xray)
   add_compiler_rt_runtime(clang_rt.xray-basic
@@ -233,7 +237,7 @@
 OBJECT_LIBS RTXrayBASIC
 CFLAGS ${XRAY_CFLAGS}
 DEFS ${XRAY_COMMON_DEFINITIONS}
-LINK_FLAGS ${SANITIZER_COMMON_LINK_FLAGS} ${WEAK_SYMBOL_LINK_FLAGS}
+LINK_FLAGS ${XRAY_LINK_FLAGS} ${WEAK_SYMBOL_LINK_FLAGS}
 LINK_LIBS ${XRAY_LINK_LIBS}
 PARENT_TARGET xray)
   add_compiler_rt_runtime(clang_rt.xray-profiling
@@ -243,7 +247,7 @@
 OBJECT_LIBS RTXrayPROFILING
 CFLAGS ${XRAY_CFLAGS}
 DEFS ${XRAY_COMMON_DEFINITIONS}
-LINK_FLAGS ${SANITIZER_COMMON_LINK_FLAGS} ${WEAK_SYMBOL_LINK_FLAGS}
+LINK_FLAGS ${XRAY_LINK_FLAGS} ${WEAK_SYMBOL_LINK_FLAGS}
 LINK_LIBS ${XRAY_LINK_LIBS}
 PARENT_TARGET xray)
 else() # not Apple
@@ -285,6 +289,8 @@
  STATIC
  ARCHS ${arch}
  CFLAGS ${XRAY_CFLAGS}
+ LINK_FLAGS ${XRAY_LINK_FLAGS}
+ LINK_LIBS ${XRAY_LINK_LIBS}
  DEFS ${XRAY_COMMON_DEFINITIONS}
  OBJECT_LIBS ${XRAY_COMMON_RUNTIME_OBJECT_LIBS} RTXray
  PARENT_TARGET xray)
@@ -293,6 +299,8 @@
   STATIC
   ARCHS ${arch}
   CFLAGS ${XRAY_CFLAGS}
+  LINK_FLAGS ${XRAY_LINK_FLAGS}
+  LINK_LIBS ${XRAY_LINK_LIBS}
   DEFS ${XRAY_COMMON_DEFINITIONS}
   OBJECT_LIBS RTXrayFDR
   PARENT_TARGET xray)
@@ -301,6 +309,8 @@
   STATIC
   ARCHS ${arch}
   CFLAGS ${XRAY_CFLAGS}
+  LINK_FLAGS ${XRAY_LINK_FLAGS}
+  LINK_LIBS ${XRAY_LINK_LIBS}
   DEFS ${XRAY_COMMON_DEFINITIONS}
   OBJECT_LIBS RTXrayBASIC
   PARENT_TARGET xray)
@@ -309,6 +319,8 @@
  STATIC
  ARCHS ${arch}
  CFLAGS ${XRAY_CFLAGS}
+ LINK_FLAGS ${XRAY_LINK_FLAGS}
+ LINK_LIBS ${XRAY_LINK_LIBS}
  DEFS ${XRAY_COMMON_DEFINITIONS}
  OBJECT_LIBS RTXrayPROFILING
  PARENT_TARGET xray)
Index: compiler-rt/lib/orc/CMakeLists.txt
===
--- compiler-rt/lib/orc/CMakeLists.txt
+++ compiler-rt/lib/orc/CMakeLists.txt
@@ -49,7 +49,11 @@
 include_directories(..)
 include_directories(../../include)
 
-set(ORC_CFLAGS ${COMPILER_RT_COMMON_CFLAGS})
+set(ORC_CFLAGS
+  ${COMPILER_RT_COMMON_CFLAGS}
+  ${COMPILER_RT_CXX_CFLAGS})
+set(ORC_LINK_FLAGS ${COMPILER_RT_COMMON_LINK_FLAGS})
+set(ORC_LINK_LIBS ${COMPILER_RT_CXX_LINK_LIBS})
 
 # Allow the ORC runtime to reference LLVM headers.
 foreach (DIR ${LLVM_INCLUDE_DIR} ${LLVM_MAIN_INCLUDE_DIR})
@@ -83,7 +87,7 @@
 ARCHS ${ORC_SUPPORTED_ARCH}
 OBJECT_LIBS RTOrc
 CFLAGS ${ORC_CFLAGS}
-LINK_FLAGS ${SANITIZER_COMMON_LINK_FLAGS} ${WEAK_SYMBOL_LINK_FLAGS}
+LINK_FLAGS ${ORC_LINK_FLAGS} ${WEAK_SYMBOL_LINK_FLAGS}
 LINK_LIBS 

[clang] df90d22 - [CMake] Option to select C++ library for runtimes that use it

2022-07-08 Thread Petr Hosek via cfe-commits

Author: Petr Hosek
Date: 2022-07-08T22:10:24Z
New Revision: df90d22704d8743746fa00bc6d67e2789ca9ee9e

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

LOG: [CMake] Option to select C++ library for runtimes that use it

We currently have an option to select C++ ABI and C++ library for tests
but there are runtimes that use C++ library, specifically ORC and XRay,
which aren't covered by existing options. This change introduces a new
option to control the use of C++ libray for these runtimes.

Ideally, this option should become the default way to select C++ library
for all of compiler-rt replacing the existing options (the C++ ABI
option could remain as a hidden internal option).

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

Added: 


Modified: 
clang/cmake/caches/Fuchsia-stage2.cmake
compiler-rt/CMakeLists.txt
compiler-rt/lib/fuzzer/CMakeLists.txt
compiler-rt/lib/orc/CMakeLists.txt
compiler-rt/lib/xray/CMakeLists.txt

Removed: 




diff  --git a/clang/cmake/caches/Fuchsia-stage2.cmake 
b/clang/cmake/caches/Fuchsia-stage2.cmake
index 67c88b306a4d4..7d055ab27 100644
--- a/clang/cmake/caches/Fuchsia-stage2.cmake
+++ b/clang/cmake/caches/Fuchsia-stage2.cmake
@@ -110,6 +110,7 @@ foreach(target 
aarch64-unknown-linux-gnu;armv7-unknown-linux-gnueabihf;i386-unkn
 set(RUNTIMES_${target}_CMAKE_SHARED_LINKER_FLAGS "-fuse-ld=lld" CACHE 
STRING "")
 set(RUNTIMES_${target}_CMAKE_MODULE_LINKER_FLAGS "-fuse-ld=lld" CACHE 
STRING "")
 set(RUNTIMES_${target}_CMAKE_EXE_LINKER_FLAGS "-fuse-ld=lld" CACHE STRING 
"")
+set(RUNTIMES_${target}_COMPILER_RT_CXX_LIBRARY "libcxx" CACHE STRING "")
 set(RUNTIMES_${target}_COMPILER_RT_USE_BUILTINS_LIBRARY ON CACHE BOOL "")
 set(RUNTIMES_${target}_COMPILER_RT_USE_LLVM_UNWINDER ON CACHE BOOL "")
 set(RUNTIMES_${target}_COMPILER_RT_CAN_EXECUTE_TESTS ON CACHE BOOL "")
@@ -178,6 +179,7 @@ if(FUCHSIA_SDK)
 set(RUNTIMES_${target}_CMAKE_MODULE_LINKER_FLAGS 
${FUCHSIA_${target}_LINKER_FLAGS} CACHE STRING "")
 set(RUNTIMES_${target}_CMAKE_EXE_LINKER_FLAGS 
${FUCHSIA_${target}_LINKER_FLAGS} CACHE STRING "")
 set(RUNTIMES_${target}_CMAKE_SYSROOT ${FUCHSIA_${target}_SYSROOT} CACHE 
PATH "")
+set(RUNTIMES_${target}_COMPILER_RT_CXX_LIBRARY "libcxx" CACHE STRING "")
 set(RUNTIMES_${target}_COMPILER_RT_USE_BUILTINS_LIBRARY ON CACHE BOOL "")
 set(RUNTIMES_${target}_COMPILER_RT_USE_LLVM_UNWINDER ON CACHE BOOL "")
 set(RUNTIMES_${target}_LIBUNWIND_USE_COMPILER_RT ON CACHE BOOL "")

diff  --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt
index cdafdfc7ecc3b..405583a7de02f 100644
--- a/compiler-rt/CMakeLists.txt
+++ b/compiler-rt/CMakeLists.txt
@@ -199,6 +199,7 @@ endmacro()
 
 # This is either directly the C++ ABI library or the full C++ library
 # which pulls in the ABI transitively.
+# TODO: Mark this as internal flag, most users should use 
COMPILER_RT_CXX_LIBRARY.
 set(SANITIZER_CXX_ABI "default" CACHE STRING
 "Specify C++ ABI library to use.")
 set(CXXABIS none default libstdc++ libc++ libcxxabi)
@@ -206,6 +207,7 @@ set_property(CACHE SANITIZER_CXX_ABI PROPERTY STRINGS 
;${CXXABIS})
 handle_default_cxx_lib(SANITIZER_CXX_ABI)
 
 # This needs to be a full C++ library for linking gtest and unit tests.
+# TODO: Mark this as internal flag, most users should use 
COMPILER_RT_CXX_LIBRARY.
 set(SANITIZER_TEST_CXX "default" CACHE STRING
 "Specify C++ library to use for tests.")
 set(CXXLIBS none default libstdc++ libc++)
@@ -246,6 +248,15 @@ option(SANITIZER_USE_STATIC_TEST_CXX
   "Use static libc++ for tests." ${DEFAULT_SANITIZER_USE_STATIC_TEST_CXX})
 pythonize_bool(SANITIZER_USE_STATIC_TEST_CXX)
 
+set(COMPILER_RT_SUPPORTED_CXX_LIBRARIES none default libcxx)
+set(COMPILER_RT_CXX_LIBRARY "default" CACHE STRING "Specify C++ library to 
use. Supported values are ${COMPILER_RT_SUPPORTED_CXX_LIBRARIES}.")
+if (NOT "${COMPILER_RT_CXX_LIBRARY}" IN_LIST 
COMPILER_RT_SUPPORTED_CXX_LIBRARIES)
+  message(FATAL_ERROR "Unsupported C++ library: '${COMPILER_RT_CXX_LIBRARY}'. 
Supported values are ${COMPILER_RT_SUPPORTED_CXX_LIBRARIES}.")
+endif()
+cmake_dependent_option(COMPILER_RT_STATIC_CXX_LIBRARY
+  "Statically link the C++ library." OFF
+  "COMPILER_RT_CXX_LIBRARY" OFF)
+
 set(DEFAULT_COMPILER_RT_USE_BUILTINS_LIBRARY OFF)
 if (FUCHSIA)
   set(DEFAULT_COMPILER_RT_USE_BUILTINS_LIBRARY ON)
@@ -519,6 +530,26 @@ if(COMPILER_RT_USE_LLVM_UNWINDER)
   list(APPEND SANITIZER_CXX_ABI_LIBRARIES 
"$<$:$>")
 endif()
 
+if (COMPILER_RT_CXX_LIBRARY STREQUAL "libcxx")
+  # We are using the in-tree libc++ so avoid including the default one.
+  append_list_if(COMPILER_RT_HAS_NOSTDINCXX_FLAG -nostdinc++ 
COMPILER_RT_COMMON_CFLAGS)
+  append_list_if(COMPILER_RT_HAS_NOSTDLIBXX_FLAG -nostdlib++ 

[PATCH] D129377: [lldb/Fuzzer] Add fuzzer for expression evaluator

2022-07-08 Thread Chelsea Cassanova via Phabricator via cfe-commits
cassanova updated this revision to Diff 443362.
cassanova edited the summary of this revision.
cassanova added a comment.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Building the expression evaluator fuzzer is now conditional on the 
CLANG_ENABLE_PROTO_FUZZER CMake variable being enabled.

Copying the source and header files from is no longer being done in the 
top-level CMake file, this is instead added to the subdirectories of the clang 
fuzzer.

The fuzzer uses Clang's CMake modules for libprotobuf_mutator instead of 
copying the module into LLDB.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129377

Files:
  clang/tools/clang-fuzzer/handle-cxx/CMakeLists.txt
  clang/tools/clang-fuzzer/proto-to-cxx/CMakeLists.txt
  lldb/tools/lldb-fuzzer/lldb-expression-fuzzer/CMakeLists.txt

Index: lldb/tools/lldb-fuzzer/lldb-expression-fuzzer/CMakeLists.txt
===
--- lldb/tools/lldb-fuzzer/lldb-expression-fuzzer/CMakeLists.txt
+++ lldb/tools/lldb-fuzzer/lldb-expression-fuzzer/CMakeLists.txt
@@ -1,89 +1,50 @@
-set(LLVM_LINK_COMPONENTS
-  Support
-  )
-
-add_llvm_fuzzer(lldb-expression-fuzzer
-  EXCLUDE_FROM_ALL
-  lldb-expression-fuzzer.cpp
-  )
-
-if(TARGET lldb-expression-fuzzer)
-  target_include_directories(lldb-expression-fuzzer PRIVATE ..)
-
-  # Generate the necessary source and header files for using protobufs
-  find_package(Protobuf REQUIRED)
-  add_definitions(-DGOOGLE_PROTOBUF_NO_RTTI)
-  include_directories(${PROTOBUF_INCLUDE_DIRS})
-  include_directories(${CMAKE_CURRENT_BINARY_DIR})
-  protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS cxx_proto.proto)
-  protobuf_generate_cpp(LOOP_PROTO_SRCS LOOP_PROTO_HDRS cxx_loop_proto.proto)
-  set(LLVM_OPTIONAL_SOURCES ${LLVM_OPTIONAL_SOURCES} ${PROTO_SRCS})
-
-  # Place the source and header files into a library for use by LLDB's expression fuzzer
-  # FIXME: It would be better to use add_lldb_library, but using this will cause an error
-  # during cmake's file generation phase
-  add_library(lldbCXXProto
-${PROTO_SRCS}
-${PROTO_HDRS}
-)
-
-  # Build and include the libprotobuf-mutator repository
-  include(ProtobufMutator)
-  include_directories(${ProtobufMutator_INCLUDE_DIRS})
-
-  # Create a variable for the libraries generated by protobuf and protobuf mutator
-  set(COMMON_PROTO_FUZZ_LIBRARIES
-${ProtobufMutator_LIBRARIES}
-${PROTOBUF_LIBRARIES}
-)
-
-  # Link the protobuf libraries as well as the clang libraries used to
-  # convert protobufs to C/C++
-  target_link_libraries(lldb-expression-fuzzer
-PRIVATE
-${COMMON_PROTO_FUZZ_LIBRARIES}
-clangHandleCXX
-lldbCXXProto
-clangProtoToCXX
-liblldb
+if(CLANG_ENABLE_PROTO_FUZZER)
+  set(LLVM_LINK_COMPONENTS
+Support
 )
 
-  # The target for this fuzzer needs to depend on the protobuf mutator
-  # repository
-  add_dependencies(lldb-expression-fuzzer lldb_protobuf_mutator)
-
-  add_custom_command(TARGET lldb-expression-fuzzer PRE_BUILD
-
-# FIXME: Copying the source and header files is not the preferred way to implement these libraries
-# on the LLDB side. It would be preferable to have the libraries for protobuf fuzzers be located
-# in a more central location
-
-# Create directories to store the files for handle-cxx and proto-to-cxx since the protobuf mutator
-# depends on them
-COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/handle-cxx
-COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/proto-to-cxx
-
-# Copy the header and source files for handle-cxx from clang
-COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/../../../../clang/tools/clang-fuzzer/handle-cxx/handle_cxx.h ${CMAKE_CURRENT_BINARY_DIR}/handle-cxx
-COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/../../../../clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp ${CMAKE_CURRENT_BINARY_DIR}/handle-cxx
-
-# Copy the header and source files for proto-to-cxx from clang
-COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/../../../../clang/tools/clang-fuzzer/proto-to-cxx/proto_to_cxx.h ${CMAKE_CURRENT_BINARY_DIR}/proto-to-cxx
-COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/../../../../clang/tools/clang-fuzzer/proto-to-cxx/proto_to_cxx.cpp ${CMAKE_CURRENT_BINARY_DIR}/proto-to-cxx
-COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/../../../../clang/tools/clang-fuzzer/proto-to-cxx/proto_to_cxx_main.cpp ${CMAKE_CURRENT_BINARY_DIR}/proto-to-cxx
-
-# Create and compile a simple C program using the command line. This is
-# needed because LLDB's expression evaluator needs a legitmate target
-# instead of a dummy target
-COMMAND echo 'int main (int argc, char** argv) { return 0\; }' | clang -o main.out -xc -
+  add_llvm_fuzzer(lldb-expression-fuzzer
+EXCLUDE_FROM_ALL
+

[PATCH] D129393: [Clang] Fix the wrong features being derivec in the offload packager

2022-07-08 Thread Joseph Huber via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG24849c9eb504: [Clang] Fix the wrong features being derivec 
in the offload packager (authored by jhuber6).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129393

Files:
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/Driver/openmp-offload-gpu-new.c


Index: clang/test/Driver/openmp-offload-gpu-new.c
===
--- clang/test/Driver/openmp-offload-gpu-new.c
+++ clang/test/Driver/openmp-offload-gpu-new.c
@@ -120,3 +120,9 @@
 // RUN: -foffload-lto %s 2>&1 | FileCheck 
--check-prefix=CHECK-LTO-FEATURES %s
 
 // CHECK-LTO-FEATURES: 
clang-offload-packager{{.*}}--image={{.*}}feature=+ptx{{[0-9]+}}
+
+// RUN:   %clang -### --target=x86_64-unknown-linux-gnu -fopenmp 
--offload-arch=sm_52 -nogpulib \
+// RUN: -Xopenmp-target=nvptx64-nvidia-cuda --cuda-feature=+ptx64 
-foffload-lto %s 2>&1 \
+// RUN:| FileCheck --check-prefix=CHECK-SET-FEATURES %s
+
+// CHECK-SET-FEATURES: clang-offload-packager{{.*}}--image={{.*}}feature=+ptx64
Index: clang/lib/Driver/ToolChains/Clang.cpp
===
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -8325,7 +8325,8 @@
 
 ArgStringList Features;
 SmallVector FeatureArgs;
-getTargetFeatures(TC->getDriver(), TC->getTriple(), Args, Features, false);
+getTargetFeatures(TC->getDriver(), TC->getTriple(), TCArgs, Features,
+  false);
 llvm::copy_if(Features, std::back_inserter(FeatureArgs),
   [](StringRef Arg) { return !Arg.startswith("-target"); });
 


Index: clang/test/Driver/openmp-offload-gpu-new.c
===
--- clang/test/Driver/openmp-offload-gpu-new.c
+++ clang/test/Driver/openmp-offload-gpu-new.c
@@ -120,3 +120,9 @@
 // RUN: -foffload-lto %s 2>&1 | FileCheck --check-prefix=CHECK-LTO-FEATURES %s
 
 // CHECK-LTO-FEATURES: clang-offload-packager{{.*}}--image={{.*}}feature=+ptx{{[0-9]+}}
+
+// RUN:   %clang -### --target=x86_64-unknown-linux-gnu -fopenmp --offload-arch=sm_52 -nogpulib \
+// RUN: -Xopenmp-target=nvptx64-nvidia-cuda --cuda-feature=+ptx64 -foffload-lto %s 2>&1 \
+// RUN:| FileCheck --check-prefix=CHECK-SET-FEATURES %s
+
+// CHECK-SET-FEATURES: clang-offload-packager{{.*}}--image={{.*}}feature=+ptx64
Index: clang/lib/Driver/ToolChains/Clang.cpp
===
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -8325,7 +8325,8 @@
 
 ArgStringList Features;
 SmallVector FeatureArgs;
-getTargetFeatures(TC->getDriver(), TC->getTriple(), Args, Features, false);
+getTargetFeatures(TC->getDriver(), TC->getTriple(), TCArgs, Features,
+  false);
 llvm::copy_if(Features, std::back_inserter(FeatureArgs),
   [](StringRef Arg) { return !Arg.startswith("-target"); });
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 24849c9 - [Clang] Fix the wrong features being derivec in the offload packager

2022-07-08 Thread Joseph Huber via cfe-commits

Author: Joseph Huber
Date: 2022-07-08T17:26:20-04:00
New Revision: 24849c9eb504cad5b17f16ed23a88dab92882d5d

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

LOG: [Clang] Fix the wrong features being derivec in the offload packager

The offload packager embeds the features in the offloading binary when
performing LTO. This had an incorrect interaction with the
`--cuda-feature` option because we weren't deriving the features from
the CUDA toolchain arguments when it was being specified. This patch
fixes this so the features are correctly overrideen when using this
argument.

However, this brings up a question of how best to handle conflicting
target features. The user could compile many libraries with different
features, in this case we do not know which one to pick. This was not
previously a problem when we simply passed the features in from the CUDA
installation at link-link because we just defaulted to whatever was
current on the system.

Reviewed By: ye-luo

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

Added: 


Modified: 
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/Driver/openmp-offload-gpu-new.c

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index 2c4d39343183c..bc29dd8107a60 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -8325,7 +8325,8 @@ void OffloadPackager::ConstructJob(Compilation , const 
JobAction ,
 
 ArgStringList Features;
 SmallVector FeatureArgs;
-getTargetFeatures(TC->getDriver(), TC->getTriple(), Args, Features, false);
+getTargetFeatures(TC->getDriver(), TC->getTriple(), TCArgs, Features,
+  false);
 llvm::copy_if(Features, std::back_inserter(FeatureArgs),
   [](StringRef Arg) { return !Arg.startswith("-target"); });
 

diff  --git a/clang/test/Driver/openmp-offload-gpu-new.c 
b/clang/test/Driver/openmp-offload-gpu-new.c
index a59952a90e29e..9a421059a68fd 100644
--- a/clang/test/Driver/openmp-offload-gpu-new.c
+++ b/clang/test/Driver/openmp-offload-gpu-new.c
@@ -120,3 +120,9 @@
 // RUN: -foffload-lto %s 2>&1 | FileCheck 
--check-prefix=CHECK-LTO-FEATURES %s
 
 // CHECK-LTO-FEATURES: 
clang-offload-packager{{.*}}--image={{.*}}feature=+ptx{{[0-9]+}}
+
+// RUN:   %clang -### --target=x86_64-unknown-linux-gnu -fopenmp 
--offload-arch=sm_52 -nogpulib \
+// RUN: -Xopenmp-target=nvptx64-nvidia-cuda --cuda-feature=+ptx64 
-foffload-lto %s 2>&1 \
+// RUN:| FileCheck --check-prefix=CHECK-SET-FEATURES %s
+
+// CHECK-SET-FEATURES: clang-offload-packager{{.*}}--image={{.*}}feature=+ptx64



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


[PATCH] D129383: [LinkerWrapper] Fix use of string savers and correctly pass bitcode libraries

2022-07-08 Thread Joseph Huber via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGd36b96afb224: [LinkerWrapper] Fix use of string savers and 
correctly pass bitcode libraries (authored by jhuber6).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129383

Files:
  clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp


Index: clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
===
--- clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
+++ clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
@@ -525,17 +525,15 @@
   if (!TempFileOrErr)
 return TempFileOrErr.takeError();
 
-  BumpPtrAllocator Alloc;
-  StringSaver Saver(Alloc);
-
   SmallVector CmdArgs;
   CmdArgs.push_back(*FatBinaryPath);
   CmdArgs.push_back(Triple.isArch64Bit() ? "-64" : "-32");
   CmdArgs.push_back("--create");
   CmdArgs.push_back(*TempFileOrErr);
   for (const auto  : InputFiles)
-CmdArgs.push_back(Saver.save("--image=profile=" + std::get<1>(FileAndArch) 
+
- ",file=" + std::get<0>(FileAndArch)));
+CmdArgs.push_back(
+Args.MakeArgString("--image=profile=" + std::get<1>(FileAndArch) +
+   ",file=" + std::get<0>(FileAndArch)));
 
   if (Error Err = executeCommands(*FatBinaryPath, CmdArgs))
 return std::move(Err);
@@ -808,6 +806,8 @@
   SmallVector BitcodeInputFiles;
   DenseSet UsedInRegularObj;
   DenseSet UsedInSharedLib;
+  BumpPtrAllocator Alloc;
+  StringSaver Saver(Alloc);
 
   // Search for bitcode files in the input and create an LTO input file. If it
   // is not a bitcode file, scan its symbol table for symbols we need to save.
@@ -844,9 +844,9 @@
 
 // Record if we've seen these symbols in any object or shared 
libraries.
 if ((*ObjFile)->isRelocatableObject())
-  UsedInRegularObj.insert(*Name);
+  UsedInRegularObj.insert(Saver.save(*Name));
 else
-  UsedInSharedLib.insert(*Name);
+  UsedInSharedLib.insert(Saver.save(*Name));
   }
   continue;
 }
@@ -908,7 +908,8 @@
   // We will use this as the prevailing symbol definition in LTO unless
   // it is undefined or another definition has already been used.
   Res.Prevailing =
-  !Sym.isUndefined() && PrevailingSymbols.insert(Sym.getName()).second;
+  !Sym.isUndefined() &&
+  PrevailingSymbols.insert(Saver.save(Sym.getName())).second;
 
   // We need LTO to preseve the following global symbols:
   // 1) Symbols used in regular objects.
@@ -1193,8 +1194,6 @@
 InputsForTarget[File].emplace_back(std::move(File));
   LinkerInputFiles.clear();
 
-  BumpPtrAllocator Alloc;
-  UniqueStringSaver Saver(Alloc);
   DenseMap> Images;
   for (auto  : InputsForTarget) {
 SmallVector  = InputForTarget.getSecond();
@@ -1395,6 +1394,7 @@
 auto FileOrErr = getInputBitcodeLibrary(Library);
 if (!FileOrErr)
   reportError(FileOrErr.takeError());
+InputFiles.push_back(std::move(*FileOrErr));
   }
 
   DenseSet IsTargetUsed;


Index: clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
===
--- clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
+++ clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
@@ -525,17 +525,15 @@
   if (!TempFileOrErr)
 return TempFileOrErr.takeError();
 
-  BumpPtrAllocator Alloc;
-  StringSaver Saver(Alloc);
-
   SmallVector CmdArgs;
   CmdArgs.push_back(*FatBinaryPath);
   CmdArgs.push_back(Triple.isArch64Bit() ? "-64" : "-32");
   CmdArgs.push_back("--create");
   CmdArgs.push_back(*TempFileOrErr);
   for (const auto  : InputFiles)
-CmdArgs.push_back(Saver.save("--image=profile=" + std::get<1>(FileAndArch) +
- ",file=" + std::get<0>(FileAndArch)));
+CmdArgs.push_back(
+Args.MakeArgString("--image=profile=" + std::get<1>(FileAndArch) +
+   ",file=" + std::get<0>(FileAndArch)));
 
   if (Error Err = executeCommands(*FatBinaryPath, CmdArgs))
 return std::move(Err);
@@ -808,6 +806,8 @@
   SmallVector BitcodeInputFiles;
   DenseSet UsedInRegularObj;
   DenseSet UsedInSharedLib;
+  BumpPtrAllocator Alloc;
+  StringSaver Saver(Alloc);
 
   // Search for bitcode files in the input and create an LTO input file. If it
   // is not a bitcode file, scan its symbol table for symbols we need to save.
@@ -844,9 +844,9 @@
 
 // Record if we've seen these symbols in any object or shared libraries.
 if ((*ObjFile)->isRelocatableObject())
-  UsedInRegularObj.insert(*Name);
+  UsedInRegularObj.insert(Saver.save(*Name));
 else
-  UsedInSharedLib.insert(*Name);
+  UsedInSharedLib.insert(Saver.save(*Name));
   }
   continue;
 }
@@ -908,7 +908,8 @@
   // We will use this as the prevailing 

[clang] d36b96a - [LinkerWrapper] Fix use of string savers and correctly pass bitcode libraries

2022-07-08 Thread Joseph Huber via cfe-commits

Author: Joseph Huber
Date: 2022-07-08T17:22:35-04:00
New Revision: d36b96afb2245d791eaf9d9b1b1adfa52df1e498

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

LOG: [LinkerWrapper] Fix use of string savers and correctly pass bitcode 
libraries

This patch removes some uses of string savers that are no-longer needed.
We also create a new string saver when linking bitcode files. It seems
that occasionally the symbol string references can go out of scope when
they are added to the LTO input so we need to save these names that are
used for symbol resolution. Additionally, a previous patch added new
logic for handling bitcode libraries, but failed to actually add them to
the input. This bug has been fixed.

Fixes #56445

Reviewed By: ye-luo

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

Added: 


Modified: 
clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp

Removed: 




diff  --git a/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp 
b/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
index 06e5cf843da0a..f0509b68ee0b3 100644
--- a/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
+++ b/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
@@ -525,17 +525,15 @@ fatbinary(ArrayRef> 
InputFiles,
   if (!TempFileOrErr)
 return TempFileOrErr.takeError();
 
-  BumpPtrAllocator Alloc;
-  StringSaver Saver(Alloc);
-
   SmallVector CmdArgs;
   CmdArgs.push_back(*FatBinaryPath);
   CmdArgs.push_back(Triple.isArch64Bit() ? "-64" : "-32");
   CmdArgs.push_back("--create");
   CmdArgs.push_back(*TempFileOrErr);
   for (const auto  : InputFiles)
-CmdArgs.push_back(Saver.save("--image=profile=" + std::get<1>(FileAndArch) 
+
- ",file=" + std::get<0>(FileAndArch)));
+CmdArgs.push_back(
+Args.MakeArgString("--image=profile=" + std::get<1>(FileAndArch) +
+   ",file=" + std::get<0>(FileAndArch)));
 
   if (Error Err = executeCommands(*FatBinaryPath, CmdArgs))
 return std::move(Err);
@@ -808,6 +806,8 @@ Error linkBitcodeFiles(SmallVectorImpl 
,
   SmallVector BitcodeInputFiles;
   DenseSet UsedInRegularObj;
   DenseSet UsedInSharedLib;
+  BumpPtrAllocator Alloc;
+  StringSaver Saver(Alloc);
 
   // Search for bitcode files in the input and create an LTO input file. If it
   // is not a bitcode file, scan its symbol table for symbols we need to save.
@@ -844,9 +844,9 @@ Error linkBitcodeFiles(SmallVectorImpl 
,
 
 // Record if we've seen these symbols in any object or shared 
libraries.
 if ((*ObjFile)->isRelocatableObject())
-  UsedInRegularObj.insert(*Name);
+  UsedInRegularObj.insert(Saver.save(*Name));
 else
-  UsedInSharedLib.insert(*Name);
+  UsedInSharedLib.insert(Saver.save(*Name));
   }
   continue;
 }
@@ -908,7 +908,8 @@ Error linkBitcodeFiles(SmallVectorImpl 
,
   // We will use this as the prevailing symbol definition in LTO unless
   // it is undefined or another definition has already been used.
   Res.Prevailing =
-  !Sym.isUndefined() && PrevailingSymbols.insert(Sym.getName()).second;
+  !Sym.isUndefined() &&
+  PrevailingSymbols.insert(Saver.save(Sym.getName())).second;
 
   // We need LTO to preseve the following global symbols:
   // 1) Symbols used in regular objects.
@@ -1193,8 +1194,6 @@ linkAndWrapDeviceFiles(SmallVectorImpl 
,
 InputsForTarget[File].emplace_back(std::move(File));
   LinkerInputFiles.clear();
 
-  BumpPtrAllocator Alloc;
-  UniqueStringSaver Saver(Alloc);
   DenseMap> Images;
   for (auto  : InputsForTarget) {
 SmallVector  = InputForTarget.getSecond();
@@ -1395,6 +1394,7 @@ int main(int Argc, char **Argv) {
 auto FileOrErr = getInputBitcodeLibrary(Library);
 if (!FileOrErr)
   reportError(FileOrErr.takeError());
+InputFiles.push_back(std::move(*FileOrErr));
   }
 
   DenseSet IsTargetUsed;



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


[PATCH] D128314: [Clang-tidy] Fixing a bug in clang-tidy infinite-loop checker

2022-07-08 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 added a comment.

In D128314#3635861 , @njames93 wrote:

> Sorry to do this again, but could this be split up again, one patch for the 
> new matcher and the tests associated with it, then another for the actual bug 
> fix.
> Also cc @klimek as he is the code owner of ASTMatchers

Makes sense.  I have created a new review  request 
 for the ASTMatcher.   This patch now depends 
on it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128314

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


[PATCH] D129393: [Clang] Fix the wrong features being derivec in the offload packager

2022-07-08 Thread Ye Luo via Phabricator via cfe-commits
ye-luo accepted this revision.
ye-luo 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/D129393/new/

https://reviews.llvm.org/D129393

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


[PATCH] D129398: Adding a new ASTMatcher for callee declarations of Obj-C message expressions

2022-07-08 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 created this revision.
ziqingluo-90 added reviewers: NoQ, njames93, aaron.ballman, klimek, t-rasmud, 
usama54321, LegalizeAdulthood.
ziqingluo-90 added a project: clang.
Herald added a project: All.
ziqingluo-90 requested review of this revision.
Herald added a subscriber: cfe-commits.

For an Obj-C message expression `[o  m]`, the adding matcher will match the 
declaration of the method `m`.  This matcher is the Obj-C counterpart of the 
existing `callee` ASTMatcher which matches function/method declarations for 
C/C++ calls. So I think this matcher is general enough to be added to the 
`ASTMatcher.h`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D129398

Files:
  clang/docs/LibASTMatchersReference.html
  clang/include/clang/ASTMatchers/ASTMatchers.h
  clang/lib/ASTMatchers/Dynamic/Registry.cpp
  clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp

Index: clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
===
--- clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
+++ clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
@@ -2352,6 +2352,37 @@
argumentCountIs(0;
 }
 
+TEST(ASTMatchersTestObjC, ObjCMessageCallee) {
+  //  Will NOT match function callee:
+  EXPECT_TRUE(notMatchesObjC("void f() {"
+ "  f(); "
+ "}",
+ objcMessageExpr(objcMessageCallee(hasName("f");
+
+  StringRef Objc1String = "@interface I "
+  " - (void)instanceMethod;"
+  " + (void)classMethod;"
+  " + (void)uncalledMethod;"
+  "@end\n"
+  "int main(void) {\n"
+  "  [I classMethod];"
+  "  I *i = [[I alloc] init];"
+  "  [i instanceMethod];"
+  "}";
+  // Should find the two method declarations through the message expressions:
+  EXPECT_TRUE(
+  matchesObjC(Objc1String, objcMessageExpr(objcMessageCallee(
+   objcMethodDecl(hasName("classMethod"));
+  EXPECT_TRUE(matchesObjC(Objc1String,
+  objcMessageExpr(objcMessageCallee(
+  objcMethodDecl(hasName("instanceMethod"));
+  // Will NOT match a method declaration through `objcMessageCallee` if there is
+  // no such message expression:
+  EXPECT_FALSE(matchesObjC(Objc1String,
+   objcMessageExpr(objcMessageCallee(
+   objcMethodDecl(hasName("uncalledMethod"));
+}
+
 TEST(ASTMatchersTestObjC, ObjCStringLiteral) {
 
   StringRef Objc1String = "@interface NSObject "
Index: clang/lib/ASTMatchers/Dynamic/Registry.cpp
===
--- clang/lib/ASTMatchers/Dynamic/Registry.cpp
+++ clang/lib/ASTMatchers/Dynamic/Registry.cpp
@@ -501,6 +501,7 @@
   REGISTER_MATCHER(objcIvarDecl);
   REGISTER_MATCHER(objcIvarRefExpr);
   REGISTER_MATCHER(objcMessageExpr);
+  REGISTER_MATCHER(objcMessageCallee);
   REGISTER_MATCHER(objcMethodDecl);
   REGISTER_MATCHER(objcObjectPointerType);
   REGISTER_MATCHER(objcPropertyDecl);
Index: clang/include/clang/ASTMatchers/ASTMatchers.h
===
--- clang/include/clang/ASTMatchers/ASTMatchers.h
+++ clang/include/clang/ASTMatchers/ASTMatchers.h
@@ -3838,6 +3838,25 @@
   InnerMatcher.matches(*ExprNode, Finder, Builder));
 }
 
+/// matches if ObjCMessageExpr's callee declaration matches
+///
+/// Given
+/// \code
+///   @interface I: NSObject
+///   +(void)foo;
+///   @end
+///   ...
+///   [I foo]
+/// \endcode
+/// The example above matches \code [I foo] \endcode with
+/// objcMessageExpr(objcMessageCallee(objcMethodDecl(hasName("foo"
+AST_MATCHER_P(ObjCMessageExpr, objcMessageCallee,
+  internal::Matcher, InnerMatcher) {
+  const ObjCMethodDecl *msgDecl = Node.getMethodDecl();
+  return (msgDecl != nullptr &&
+  InnerMatcher.matches(*msgDecl, Finder, Builder));
+}
+
 /// Matches if the call expression's callee's declaration matches the
 /// given matcher.
 ///
Index: clang/docs/LibASTMatchersReference.html
===
--- clang/docs/LibASTMatchersReference.html
+++ clang/docs/LibASTMatchersReference.html
@@ -8867,6 +8867,20 @@
 
 
 
+Matcherhttps://clang.llvm.org/doxygen/classclang_1_1ObjCMessageExpr.html;>ObjCMessageExprobjcMessageCalleeMatcherhttps://clang.llvm.org/doxygen/classclang_1_1ObjCMethodDecl.html;>ObjCMethodDecl InnerMatcher
+matches if ObjCMessageExpr's callee declaration matches
+
+Given
+  @interface I: NSObject
+  +(void)foo;
+  @end
+  ...
+  [I foo]
+The example above matches [I foo] with
+objcMessageExpr(objcMessageCallee(objcMethodDecl(hasName("foo"
+
+

[PATCH] D129277: [clang] [Serialization] Fix swapped PPOpts/ExistingPPOpts parameters. NFC.

2022-07-08 Thread Martin Storsjö via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb069801ffb6d: [clang] [Serialization] Fix swapped 
PPOpts/ExistingPPOpts parameters. NFC. (authored by mstorsjo).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129277

Files:
  clang/lib/Serialization/ASTReader.cpp


Index: clang/lib/Serialization/ASTReader.cpp
===
--- clang/lib/Serialization/ASTReader.cpp
+++ clang/lib/Serialization/ASTReader.cpp
@@ -5171,8 +5171,9 @@
 bool ReadPreprocessorOptions(const PreprocessorOptions ,
  bool Complain,
  std::string ) override {
-  return checkPreprocessorOptions(ExistingPPOpts, PPOpts, nullptr, FileMgr,
-  SuggestedPredefines, ExistingLangOpts);
+  return checkPreprocessorOptions(PPOpts, ExistingPPOpts, 
/*Diags=*/nullptr,
+  FileMgr, SuggestedPredefines,
+  ExistingLangOpts);
 }
   };
 


Index: clang/lib/Serialization/ASTReader.cpp
===
--- clang/lib/Serialization/ASTReader.cpp
+++ clang/lib/Serialization/ASTReader.cpp
@@ -5171,8 +5171,9 @@
 bool ReadPreprocessorOptions(const PreprocessorOptions ,
  bool Complain,
  std::string ) override {
-  return checkPreprocessorOptions(ExistingPPOpts, PPOpts, nullptr, FileMgr,
-  SuggestedPredefines, ExistingLangOpts);
+  return checkPreprocessorOptions(PPOpts, ExistingPPOpts, /*Diags=*/nullptr,
+  FileMgr, SuggestedPredefines,
+  ExistingLangOpts);
 }
   };
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] b069801 - [clang] [Serialization] Fix swapped PPOpts/ExistingPPOpts parameters. NFC.

2022-07-08 Thread Martin Storsjö via cfe-commits

Author: Martin Storsjö
Date: 2022-07-09T00:11:45+03:00
New Revision: b069801ffb6d11143c2b611a220827120113c7a1

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

LOG: [clang] [Serialization] Fix swapped PPOpts/ExistingPPOpts parameters. NFC.

The two first parameters of checkPreprocessorOptions are "PPOpts, 
ExistingPPOpts".
All other callers of the function pass them consistently.

This avoids confusion when working on the code.

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

Added: 


Modified: 
clang/lib/Serialization/ASTReader.cpp

Removed: 




diff  --git a/clang/lib/Serialization/ASTReader.cpp 
b/clang/lib/Serialization/ASTReader.cpp
index 096f4a5514b17..bb98660717e70 100644
--- a/clang/lib/Serialization/ASTReader.cpp
+++ b/clang/lib/Serialization/ASTReader.cpp
@@ -5171,8 +5171,9 @@ namespace {
 bool ReadPreprocessorOptions(const PreprocessorOptions ,
  bool Complain,
  std::string ) override {
-  return checkPreprocessorOptions(ExistingPPOpts, PPOpts, nullptr, FileMgr,
-  SuggestedPredefines, ExistingLangOpts);
+  return checkPreprocessorOptions(PPOpts, ExistingPPOpts, 
/*Diags=*/nullptr,
+  FileMgr, SuggestedPredefines,
+  ExistingLangOpts);
 }
   };
 



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


[PATCH] D128927: [libc++] Always build c++experimental.a

2022-07-08 Thread Louis Dionne via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGbb939931a1ad: [libc++] Always build c++experimental.a 
(authored by ldionne).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128927

Files:
  clang/cmake/caches/Fuchsia-stage2.cmake
  clang/cmake/caches/Fuchsia.cmake
  compiler-rt/cmake/Modules/AddCompilerRT.cmake
  libcxx/CMakeLists.txt
  libcxx/appveyor.yml
  libcxx/cmake/caches/AIX.cmake
  libcxx/cmake/caches/Apple.cmake
  libcxx/cmake/caches/Generic-no-experimental.cmake
  libcxx/docs/BuildingLibcxx.rst
  libcxx/docs/UsingLibcxx.rst
  libcxx/src/CMakeLists.txt
  libcxx/test/CMakeLists.txt
  
libcxx/test/libcxx/experimental/memory/memory.resource.global/global_memory_resource_lifetime.pass.cpp
  
libcxx/test/libcxx/experimental/memory/memory.resource.global/new_delete_resource_lifetime.pass.cpp
  
libcxx/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.ctor/default.pass.cpp
  
libcxx/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.eq/equal.pass.cpp
  
libcxx/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.eq/not_equal.pass.cpp
  
libcxx/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/allocate.pass.cpp
  
libcxx/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair.pass.cpp
  
libcxx/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_const_lvalue_pair.pass.cpp
  
libcxx/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_rvalue.pass.cpp
  
libcxx/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_values.pass.cpp
  
libcxx/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_piecewise_pair.pass.cpp
  
libcxx/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_piecewise_pair_evil.pass.cpp
  
libcxx/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_types.pass.cpp
  
libcxx/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/deallocate.pass.cpp
  
libcxx/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/destroy.pass.cpp
  
libcxx/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/resource.pass.cpp
  
libcxx/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/select_on_container_copy_construction.pass.cpp
  
libcxx/test/std/experimental/memory/memory.resource.aliases/header_deque_synop.pass.cpp
  
libcxx/test/std/experimental/memory/memory.resource.aliases/header_forward_list_synop.pass.cpp
  
libcxx/test/std/experimental/memory/memory.resource.aliases/header_list_synop.pass.cpp
  
libcxx/test/std/experimental/memory/memory.resource.aliases/header_map_synop.pass.cpp
  
libcxx/test/std/experimental/memory/memory.resource.aliases/header_regex_synop.pass.cpp
  
libcxx/test/std/experimental/memory/memory.resource.aliases/header_set_synop.pass.cpp
  
libcxx/test/std/experimental/memory/memory.resource.aliases/header_string_synop.pass.cpp
  
libcxx/test/std/experimental/memory/memory.resource.aliases/header_unordered_map_synop.pass.cpp
  
libcxx/test/std/experimental/memory/memory.resource.aliases/header_unordered_set_synop.pass.cpp
  
libcxx/test/std/experimental/memory/memory.resource.aliases/header_vector_synop.pass.cpp
  
libcxx/test/std/experimental/memory/memory.resource.global/default_resource.pass.cpp
  
libcxx/test/std/experimental/memory/memory.resource.global/new_delete_resource.pass.cpp
  
libcxx/test/std/experimental/memory/memory.resource.global/null_memory_resource.pass.cpp
  libcxx/utils/ci/run-buildbot
  libcxx/utils/libcxx/test/params.py

Index: libcxx/utils/libcxx/test/params.py
===
--- libcxx/utils/libcxx/test/params.py
+++ libcxx/utils/libcxx/test/params.py
@@ -156,15 +156,19 @@
 ])),
 
   Parameter(name='enable_experimental', choices=[True, False], type=bool, default=True,
-help="Whether to enable tests for experimental C++ libraries (typically Library Fundamentals TSes).",
+help="Whether to enable tests for experimental C++ Library features.",
 actions=lambda experimental: [] if not experimental else [
-  AddFeature('c++experimental'),
   # When linking in MSVC mode via the Clang driver, a -l
   # maps to 

[clang] bb93993 - [libc++] Always build c++experimental.a

2022-07-08 Thread Louis Dionne via cfe-commits

Author: Louis Dionne
Date: 2022-07-08T16:58:22-04:00
New Revision: bb939931a1adb9a47a2de13c359d6a72aeb277c8

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

LOG: [libc++] Always build c++experimental.a

This is the first part of a plan to ship experimental features
by default while guarding them behind a compiler flag to avoid
users accidentally depending on them. Subsequent patches will
also encompass incomplete features (such as  and )
in that categorization. Basically, the idea is that we always
build and ship the c++experimental library, however users can't
use what's in it unless they pass the `-funstable` flag to Clang.

Note that this patch intentionally does not start guarding
existing  content behind the flag, because
that would merely break users that might be relying on such
content being in the headers unconditionally. Instead, we
should start guarding new TSes behind the flag, and get rid
of the existing TSes we have by shipping their Standard
counterpart.

Also, this patch must jump through a few hoops like defining
_LIBCPP_ENABLE_EXPERIMENTAL because we still support compilers
that do not implement -funstable yet.

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

Added: 


Modified: 
clang/cmake/caches/Fuchsia-stage2.cmake
clang/cmake/caches/Fuchsia.cmake
compiler-rt/cmake/Modules/AddCompilerRT.cmake
libcxx/CMakeLists.txt
libcxx/appveyor.yml
libcxx/cmake/caches/AIX.cmake
libcxx/cmake/caches/Apple.cmake
libcxx/cmake/caches/Generic-no-experimental.cmake
libcxx/docs/BuildingLibcxx.rst
libcxx/docs/UsingLibcxx.rst
libcxx/src/CMakeLists.txt
libcxx/test/CMakeLists.txt

libcxx/test/libcxx/experimental/memory/memory.resource.global/global_memory_resource_lifetime.pass.cpp

libcxx/test/libcxx/experimental/memory/memory.resource.global/new_delete_resource_lifetime.pass.cpp

libcxx/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.ctor/default.pass.cpp

libcxx/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.eq/equal.pass.cpp

libcxx/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.eq/not_equal.pass.cpp

libcxx/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/allocate.pass.cpp

libcxx/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair.pass.cpp

libcxx/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_const_lvalue_pair.pass.cpp

libcxx/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_rvalue.pass.cpp

libcxx/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_values.pass.cpp

libcxx/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_piecewise_pair.pass.cpp

libcxx/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_piecewise_pair_evil.pass.cpp

libcxx/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_types.pass.cpp

libcxx/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/deallocate.pass.cpp

libcxx/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/destroy.pass.cpp

libcxx/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/resource.pass.cpp

libcxx/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/select_on_container_copy_construction.pass.cpp

libcxx/test/std/experimental/memory/memory.resource.aliases/header_deque_synop.pass.cpp

libcxx/test/std/experimental/memory/memory.resource.aliases/header_forward_list_synop.pass.cpp

libcxx/test/std/experimental/memory/memory.resource.aliases/header_list_synop.pass.cpp

libcxx/test/std/experimental/memory/memory.resource.aliases/header_map_synop.pass.cpp

libcxx/test/std/experimental/memory/memory.resource.aliases/header_regex_synop.pass.cpp

libcxx/test/std/experimental/memory/memory.resource.aliases/header_set_synop.pass.cpp

libcxx/test/std/experimental/memory/memory.resource.aliases/header_string_synop.pass.cpp

libcxx/test/std/experimental/memory/memory.resource.aliases/header_unordered_map_synop.pass.cpp

libcxx/test/std/experimental/memory/memory.resource.aliases/header_unordered_set_synop.pass.cpp

libcxx/test/std/experimental/memory/memory.resource.aliases/header_vector_synop.pass.cpp

[PATCH] D128119: [clang] Enforce instantiation of constexpr template functions during non-constexpr evaluation

2022-07-08 Thread Shafik Yaghmour via Phabricator via cfe-commits
shafik accepted this revision.
shafik added a comment.

LGTM, thank you!


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

https://reviews.llvm.org/D128119

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


[PATCH] D128465: [llvm] cmake config groundwork to have ZSTD in LLVM

2022-07-08 Thread Louis Dionne via Phabricator via cfe-commits
ldionne added inline comments.



Comment at: llvm/CMakeLists.txt:441
 
+set(LLVM_ENABLE_ZSTD "ON" CACHE STRING "Use zstd for compression/decompression 
if available. Can be ON, OFF, or FORCE_ON")
+

This broke builds that do not specify `LLVM_ENABLE_ZSTD=OFF` explicitly on 
macOS, and I suspect on other platforms as well:

```
ld: library not found for -lzstd
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```

It looks to me like the build should not require `zstd` to be installed by 
default.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128465

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


[clang-tools-extra] 474c873 - Revert "[llvm] cmake config groundwork to have ZSTD in LLVM"

2022-07-08 Thread Leonard Chan via cfe-commits

Author: Leonard Chan
Date: 2022-07-08T13:48:05-07:00
New Revision: 474c873148b1441f1dd7a2b269441a1b20e30aa2

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

LOG: Revert "[llvm] cmake config groundwork to have ZSTD in LLVM"

This reverts commit f07caf20b9d35e45501c9d5d903fa182b3bdb95a which seems to 
break upstream https://lab.llvm.org/buildbot/#/builders/109/builds/42253.

Added: 


Modified: 
clang-tools-extra/clangd/CMakeLists.txt
clang-tools-extra/clangd/test/lit.cfg.py
clang-tools-extra/clangd/test/lit.site.cfg.py.in
clang/test/CMakeLists.txt
clang/test/lit.site.cfg.py.in
compiler-rt/lib/sanitizer_common/symbolizer/scripts/build_symbolizer.sh
compiler-rt/test/lit.common.cfg.py
compiler-rt/test/lit.common.configured.in
flang/CMakeLists.txt
lld/ELF/CMakeLists.txt
lld/test/lit.site.cfg.py.in
lldb/source/Plugins/Process/gdb-remote/CMakeLists.txt
lldb/test/Shell/lit.site.cfg.py.in
llvm/CMakeLists.txt
llvm/cmake/config-ix.cmake
llvm/cmake/modules/LLVMConfig.cmake.in
llvm/include/llvm/Config/llvm-config.h.cmake
llvm/test/lit.site.cfg.py.in
utils/bazel/llvm_configs/llvm-config.h.cmake

Removed: 
llvm/cmake/modules/FindZSTD.cmake



diff  --git a/clang-tools-extra/clangd/CMakeLists.txt 
b/clang-tools-extra/clangd/CMakeLists.txt
index bda9d8c1585eb..7cfbd6f95750e 100644
--- a/clang-tools-extra/clangd/CMakeLists.txt
+++ b/clang-tools-extra/clangd/CMakeLists.txt
@@ -29,7 +29,6 @@ llvm_canonicalize_cmake_booleans(
   CLANGD_MALLOC_TRIM
   CLANGD_TIDY_CHECKS
   LLVM_ENABLE_ZLIB
-  LLVM_ENABLE_ZSTD
 )
 
 configure_file(

diff  --git a/clang-tools-extra/clangd/test/lit.cfg.py 
b/clang-tools-extra/clangd/test/lit.cfg.py
index 8a31cd54de8ee..0f3d8b310b290 100644
--- a/clang-tools-extra/clangd/test/lit.cfg.py
+++ b/clang-tools-extra/clangd/test/lit.cfg.py
@@ -36,6 +36,3 @@ def calculate_arch_features(arch_string):
 
 if config.have_zlib:
   config.available_features.add('zlib')
-
-if config.have_zstd:
-  config.available_features.add('zstd')

diff  --git a/clang-tools-extra/clangd/test/lit.site.cfg.py.in 
b/clang-tools-extra/clangd/test/lit.site.cfg.py.in
index 83bfe322a9adc..20caa72af3da1 100644
--- a/clang-tools-extra/clangd/test/lit.site.cfg.py.in
+++ b/clang-tools-extra/clangd/test/lit.site.cfg.py.in
@@ -17,7 +17,6 @@ config.clangd_build_xpc = @CLANGD_BUILD_XPC@
 config.clangd_enable_remote = @CLANGD_ENABLE_REMOTE@
 config.clangd_tidy_checks = @CLANGD_TIDY_CHECKS@
 config.have_zlib = @LLVM_ENABLE_ZLIB@
-config.have_zstd = @LLVM_ENABLE_ZSTD@
 
 # Delegate logic to lit.cfg.py.
 lit_config.load_config(config, "@CMAKE_CURRENT_SOURCE_DIR@/lit.cfg.py")

diff  --git a/clang/test/CMakeLists.txt b/clang/test/CMakeLists.txt
index 5af7c30835996..5b604b2a3eeba 100644
--- a/clang/test/CMakeLists.txt
+++ b/clang/test/CMakeLists.txt
@@ -11,7 +11,6 @@ llvm_canonicalize_cmake_booleans(
   CLANG_SPAWN_CC1
   ENABLE_BACKTRACES
   LLVM_ENABLE_ZLIB
-  LLVM_ENABLE_ZSTD
   LLVM_ENABLE_PER_TARGET_RUNTIME_DIR
   LLVM_ENABLE_THREADS
   LLVM_WITH_Z3

diff  --git a/clang/test/lit.site.cfg.py.in b/clang/test/lit.site.cfg.py.in
index eb1013059e0ea..8a9849fe4549d 100644
--- a/clang/test/lit.site.cfg.py.in
+++ b/clang/test/lit.site.cfg.py.in
@@ -21,7 +21,6 @@ config.host_cc = "@CMAKE_C_COMPILER@"
 config.host_cxx = "@CMAKE_CXX_COMPILER@"
 config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@"
 config.have_zlib = @LLVM_ENABLE_ZLIB@
-config.have_zstd = @LLVM_ENABLE_ZSTD@
 config.clang_arcmt = @CLANG_ENABLE_ARCMT@
 config.clang_default_pie_on_linux = @CLANG_DEFAULT_PIE_ON_LINUX@
 config.clang_enable_opaque_pointers = @CLANG_ENABLE_OPAQUE_POINTERS_INTERNAL@

diff  --git 
a/compiler-rt/lib/sanitizer_common/symbolizer/scripts/build_symbolizer.sh 
b/compiler-rt/lib/sanitizer_common/symbolizer/scripts/build_symbolizer.sh
index f4f242feae013..b6f731566c19b 100755
--- a/compiler-rt/lib/sanitizer_common/symbolizer/scripts/build_symbolizer.sh
+++ b/compiler-rt/lib/sanitizer_common/symbolizer/scripts/build_symbolizer.sh
@@ -140,7 +140,6 @@ if [[ ! -d ${LLVM_BUILD} ]]; then
 -DLLVM_TABLEGEN=$TBLGEN \
 -DLLVM_DEFAULT_TARGET_TRIPLE="${TARGET_TRIPLE}" \
 -DLLVM_ENABLE_ZLIB=ON \
--DLLVM_ENABLE_ZSTD=ON \
 -DLLVM_ENABLE_TERMINFO=OFF \
 -DLLVM_ENABLE_THREADS=OFF \
   $LLVM_SRC

diff  --git a/compiler-rt/test/lit.common.cfg.py 
b/compiler-rt/test/lit.common.cfg.py
index a38c1308ecf43..62a73dd313968 100644
--- a/compiler-rt/test/lit.common.cfg.py
+++ b/compiler-rt/test/lit.common.cfg.py
@@ -217,9 +217,6 @@ def get_path_from_clang(args, allow_failure):
 
 if config.have_zlib == "1":
   config.available_features.add("zlib")
-  
-if config.have_zstd == "1":
-  config.available_features.add("zstd")
 
 # Use ugly construction to explicitly prohibit 

[PATCH] D128927: [libc++] Always build c++experimental.a

2022-07-08 Thread Louis Dionne via Phabricator via cfe-commits
ldionne updated this revision to Diff 443342.
ldionne added a comment.

Rebase onto main and remove references to -funstable since the design is still 
changing.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128927

Files:
  clang/cmake/caches/Fuchsia-stage2.cmake
  clang/cmake/caches/Fuchsia.cmake
  compiler-rt/cmake/Modules/AddCompilerRT.cmake
  libcxx/CMakeLists.txt
  libcxx/appveyor.yml
  libcxx/cmake/caches/AIX.cmake
  libcxx/cmake/caches/Apple.cmake
  libcxx/cmake/caches/Generic-no-experimental.cmake
  libcxx/docs/BuildingLibcxx.rst
  libcxx/docs/UsingLibcxx.rst
  libcxx/src/CMakeLists.txt
  libcxx/test/CMakeLists.txt
  
libcxx/test/libcxx/experimental/memory/memory.resource.global/global_memory_resource_lifetime.pass.cpp
  
libcxx/test/libcxx/experimental/memory/memory.resource.global/new_delete_resource_lifetime.pass.cpp
  
libcxx/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.ctor/default.pass.cpp
  
libcxx/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.eq/equal.pass.cpp
  
libcxx/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.eq/not_equal.pass.cpp
  
libcxx/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/allocate.pass.cpp
  
libcxx/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair.pass.cpp
  
libcxx/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_const_lvalue_pair.pass.cpp
  
libcxx/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_rvalue.pass.cpp
  
libcxx/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_values.pass.cpp
  
libcxx/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_piecewise_pair.pass.cpp
  
libcxx/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_piecewise_pair_evil.pass.cpp
  
libcxx/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_types.pass.cpp
  
libcxx/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/deallocate.pass.cpp
  
libcxx/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/destroy.pass.cpp
  
libcxx/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/resource.pass.cpp
  
libcxx/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/select_on_container_copy_construction.pass.cpp
  
libcxx/test/std/experimental/memory/memory.resource.aliases/header_deque_synop.pass.cpp
  
libcxx/test/std/experimental/memory/memory.resource.aliases/header_forward_list_synop.pass.cpp
  
libcxx/test/std/experimental/memory/memory.resource.aliases/header_list_synop.pass.cpp
  
libcxx/test/std/experimental/memory/memory.resource.aliases/header_map_synop.pass.cpp
  
libcxx/test/std/experimental/memory/memory.resource.aliases/header_regex_synop.pass.cpp
  
libcxx/test/std/experimental/memory/memory.resource.aliases/header_set_synop.pass.cpp
  
libcxx/test/std/experimental/memory/memory.resource.aliases/header_string_synop.pass.cpp
  
libcxx/test/std/experimental/memory/memory.resource.aliases/header_unordered_map_synop.pass.cpp
  
libcxx/test/std/experimental/memory/memory.resource.aliases/header_unordered_set_synop.pass.cpp
  
libcxx/test/std/experimental/memory/memory.resource.aliases/header_vector_synop.pass.cpp
  
libcxx/test/std/experimental/memory/memory.resource.global/default_resource.pass.cpp
  
libcxx/test/std/experimental/memory/memory.resource.global/new_delete_resource.pass.cpp
  
libcxx/test/std/experimental/memory/memory.resource.global/null_memory_resource.pass.cpp
  libcxx/utils/ci/run-buildbot
  libcxx/utils/libcxx/test/params.py

Index: libcxx/utils/libcxx/test/params.py
===
--- libcxx/utils/libcxx/test/params.py
+++ libcxx/utils/libcxx/test/params.py
@@ -156,15 +156,19 @@
 ])),
 
   Parameter(name='enable_experimental', choices=[True, False], type=bool, default=True,
-help="Whether to enable tests for experimental C++ libraries (typically Library Fundamentals TSes).",
+help="Whether to enable tests for experimental C++ Library features.",
 actions=lambda experimental: [] if not experimental else [
-  AddFeature('c++experimental'),
   # When linking in MSVC mode via the Clang driver, a -l
   # maps to .lib, so we need to use -llibc++experimental here
   # 

[clang] cc5b772 - [clang] Introduce -Warray-parameter

2022-07-08 Thread via cfe-commits

Author: serge-sans-paille
Date: 2022-07-08T22:36:05+02:00
New Revision: cc5b77273af3705b6f5cf574567b49d5158bb3a9

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

LOG: [clang] Introduce -Warray-parameter

This warning exist in GCC[0] and warns about re-declarations of functions
involving arguments of array or pointer types of inconsistent kinds or forms.

This is not the exact same implementation as GCC's : there's no warning level
and that flag has no effect on -Warray-bounds.

[0] 
https://gcc.gnu.org/onlinedocs/gcc-12.1.0/gcc/Warning-Options.html#index-Wno-array-parameter

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

Added: 
clang/test/Sema/array-parameter.c
clang/test/Sema/array-parameter.cpp

Modified: 
clang/docs/ReleaseNotes.rst
clang/include/clang/Basic/DiagnosticGroups.td
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/lib/Sema/SemaDecl.cpp
clang/test/Misc/warning-wall.c

Removed: 




diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 9d244ca5fbf0d..c6d36568099b4 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -321,6 +321,11 @@ New Compiler Flags
   removed in the future once clang supports all such operations.
 - Added the ``-print-diagnostic-options`` option, which prints a list of
   warnings the compiler supports.
+- Added the ``-Warray-parameter`` warning. It diagnoses 
diff erences between
+  array parameters between function redeclarations (arrays of 
diff erent extents,
+  etc). This flag is related to the same flag in GCC, but is 
diff erent in that
+  it does not accept an explicitly- specified warning level and use of this 
flag
+  has no effect on ``-Warray-bounds``.
 
 Deprecated Compiler Flags
 -

diff  --git a/clang/include/clang/Basic/DiagnosticGroups.td 
b/clang/include/clang/Basic/DiagnosticGroups.td
index 10da02ecbf7e8..0c9646e525e50 100644
--- a/clang/include/clang/Basic/DiagnosticGroups.td
+++ b/clang/include/clang/Basic/DiagnosticGroups.td
@@ -31,6 +31,7 @@ def GNUAnonymousStruct : DiagGroup<"gnu-anonymous-struct">;
 def GNUAutoType : DiagGroup<"gnu-auto-type">;
 def ArrayBounds : DiagGroup<"array-bounds">;
 def ArrayBoundsPointerArithmetic : 
DiagGroup<"array-bounds-pointer-arithmetic">;
+def ArrayParameter : DiagGroup<"array-parameter">;
 def AutoDisableVptrSanitizer : DiagGroup<"auto-disable-vptr-sanitizer">;
 def Availability : DiagGroup<"availability">;
 def Section : DiagGroup<"section">;
@@ -978,6 +979,7 @@ def Extra : DiagGroup<"extra", [
   ]>;
 
 def Most : DiagGroup<"most", [
+ArrayParameter,
 BoolOperation,
 CharSubscript,
 Comment,

diff  --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td 
b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index c811cd855d503..fd10bd9c70e6a 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -9400,6 +9400,12 @@ def warn_array_index_exceeds_max_addressable_bounds : 
Warning<
 def note_array_declared_here : Note<
   "array %0 declared here">;
 
+def warn_inconsistent_array_form : Warning<
+  "argument %0 of type %1 with mismatched bound">,
+  InGroup, DefaultIgnore;
+def note_previous_declaration_as : Note<
+  "previously declared as %0 here">;
+
 def warn_printf_insufficient_data_args : Warning<
   "more '%%' conversions than data arguments">, 
InGroup;
 def warn_printf_data_arg_not_used : Warning<

diff  --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index d6c89d525cdc2..927d81826425b 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -3207,6 +3207,39 @@ static void mergeParamDeclAttributes(ParmVarDecl 
*newDecl,
   if (!foundAny) newDecl->dropAttrs();
 }
 
+static bool EquivalentArrayTypes(QualType Old, QualType New,
+ const ASTContext ) {
+
+  auto NoSizeInfo = [](QualType Ty) {
+if (Ty->isIncompleteArrayType() || Ty->isPointerType())
+  return true;
+if (const auto *VAT = Ctx.getAsVariableArrayType(Ty))
+  return VAT->getSizeModifier() == ArrayType::ArraySizeModifier::Star;
+return false;
+  };
+
+  // `type[]` is equivalent to `type *` and `type[*]`.
+  if (NoSizeInfo(Old) && NoSizeInfo(New))
+return true;
+
+  // Don't try to compare VLA sizes, unless one of them has the star modifier.
+  if (Old->isVariableArrayType() && New->isVariableArrayType()) {
+const auto *OldVAT = Ctx.getAsVariableArrayType(Old);
+const auto *NewVAT = Ctx.getAsVariableArrayType(New);
+if ((OldVAT->getSizeModifier() == ArrayType::ArraySizeModifier::Star) ^
+(NewVAT->getSizeModifier() == ArrayType::ArraySizeModifier::Star))
+  return false;
+return true;
+  }
+
+  // Only compare size, 

[PATCH] D128449: [clang] Introduce -Warray-parameter

2022-07-08 Thread serge via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGcc5b77273af3: [clang] Introduce -Warray-parameter (authored 
by serge-sans-paille).

Changed prior to commit:
  https://reviews.llvm.org/D128449?vs=442844=443340#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128449

Files:
  clang/docs/ReleaseNotes.rst
  clang/include/clang/Basic/DiagnosticGroups.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Sema/SemaDecl.cpp
  clang/test/Misc/warning-wall.c
  clang/test/Sema/array-parameter.c
  clang/test/Sema/array-parameter.cpp

Index: clang/test/Sema/array-parameter.cpp
===
--- /dev/null
+++ clang/test/Sema/array-parameter.cpp
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fsyntax-only -Warray-parameter -verify %s
+
+template 
+void func(int i[10]); // expected-note {{previously declared as 'int[10]' here}}
+
+template 
+void func(int i[N]); // expected-warning {{argument 'i' of type 'int[N]' with mismatched bound}}
+
+template 
+void func(int ()[N]);
+
+template <>
+void func<10>(int ()[10]) {
+}
+
+static constexpr int Extent = 10;
+void funk(int i[10]);
+void funk(int i[Extent]); // no-warning
Index: clang/test/Sema/array-parameter.c
===
--- /dev/null
+++ clang/test/Sema/array-parameter.c
@@ -0,0 +1,35 @@
+// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fsyntax-only -Warray-parameter -verify %s
+void f0(int a[]);
+void f0(int *a); // no warning
+
+void f1(int a[]);  // expected-note {{previously declared as 'int[]' here}}
+void f1(int a[2]); // expected-warning {{argument 'a' of type 'int[2]' with mismatched bound}}
+
+void f2(int a[3]); // expected-note {{previously declared as 'int[3]' here}}
+void f2(int a[2]); // expected-warning {{argument 'a' of type 'int[2]' with mismatched bound}}
+
+void f3(int a[const 2]);
+void f3(int a[2]); // no warning
+
+void f4(int a[static 2]);
+void f4(int a[2]); // no warning
+
+void f5(int a[restrict 2]);
+void f5(int a[2]); // no warning
+
+void f6(int a[volatile 2]);
+void f6(int a[2]); // no warning
+
+void f7(int a[*]);
+void f7(int a[]); // no warning
+
+void f8(int n, int a[*]); // expected-note {{previously declared as 'int[*]' here}}
+void f8(int n, int a[n]); // expected-warning {{argument 'a' of type 'int[n]' with mismatched bound}}
+
+void f9(int *a);
+void f9(int a[2]);
+void f9(int a[]); // expected-warning {{argument 'a' of type 'int[]' with mismatched bound}}
+  // expected-note@-2 {{previously declared as 'int[2]' here}}
+void f9(int a[2]) // expected-warning {{argument 'a' of type 'int[2]' with mismatched bound}}
+  // expected-note@-3 {{previously declared as 'int[]' here}}
+{}
Index: clang/test/Misc/warning-wall.c
===
--- clang/test/Misc/warning-wall.c
+++ clang/test/Misc/warning-wall.c
@@ -3,6 +3,7 @@
 
  CHECK:-Wall
 CHECK-NEXT:  -Wmost
+CHECK-NEXT:-Warray-parameter
 CHECK-NEXT:-Wbool-operation
 CHECK-NEXT:-Wbitwise-instead-of-logical
 CHECK-NEXT:-Wchar-subscripts
Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -3207,6 +3207,39 @@
   if (!foundAny) newDecl->dropAttrs();
 }
 
+static bool EquivalentArrayTypes(QualType Old, QualType New,
+ const ASTContext ) {
+
+  auto NoSizeInfo = [](QualType Ty) {
+if (Ty->isIncompleteArrayType() || Ty->isPointerType())
+  return true;
+if (const auto *VAT = Ctx.getAsVariableArrayType(Ty))
+  return VAT->getSizeModifier() == ArrayType::ArraySizeModifier::Star;
+return false;
+  };
+
+  // `type[]` is equivalent to `type *` and `type[*]`.
+  if (NoSizeInfo(Old) && NoSizeInfo(New))
+return true;
+
+  // Don't try to compare VLA sizes, unless one of them has the star modifier.
+  if (Old->isVariableArrayType() && New->isVariableArrayType()) {
+const auto *OldVAT = Ctx.getAsVariableArrayType(Old);
+const auto *NewVAT = Ctx.getAsVariableArrayType(New);
+if ((OldVAT->getSizeModifier() == ArrayType::ArraySizeModifier::Star) ^
+(NewVAT->getSizeModifier() == ArrayType::ArraySizeModifier::Star))
+  return false;
+return true;
+  }
+
+  // Only compare size, ignore Size modifiers and CVR.
+  if (Old->isConstantArrayType() && New->isConstantArrayType())
+return Ctx.getAsConstantArrayType(Old)->getSize() ==
+   Ctx.getAsConstantArrayType(New)->getSize();
+
+  return Old == New;
+}
+
 static void mergeParamDeclTypes(ParmVarDecl *NewParam,
 const ParmVarDecl *OldParam,
 Sema ) {
@@ -3232,6 +3265,19 

[PATCH] D128449: [clang] Introduce -Warray-parameter

2022-07-08 Thread serge via Phabricator via cfe-commits
serge-sans-paille added inline comments.



Comment at: clang/lib/Sema/SemaDecl.cpp:3213
+static bool EquivalentArrayTypes(QualType Old, QualType New,
+ ASTContext const ) {
+

aaron.ballman wrote:
> East const? MONSTEROUS! ;-) (We tend to use west const mostly in the code 
> base.)
Whenever I don't have strict focus on my fingers, they go east!


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

https://reviews.llvm.org/D128449

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


[PATCH] D128119: [clang] Enforce instantiation of constexpr template functions during non-constexpr evaluation

2022-07-08 Thread serge via Phabricator via cfe-commits
serge-sans-paille added inline comments.



Comment at: clang/docs/ReleaseNotes.rst:184
   initializer is not allowed this is now diagnosed as an error.
+- Clang now correctly emit symbols for implicitly instanciated constexpr
+  template function. Fixes `Issue 55560 
`_.

aaron.ballman wrote:
> 
Thanks you for removing this french touch ;-)


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

https://reviews.llvm.org/D128119

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


[PATCH] D129383: [LinkerWrapper] Fix use of string savers and correctly pass bitcode libraries

2022-07-08 Thread Ye Luo via Phabricator via cfe-commits
ye-luo accepted this revision.
ye-luo added a comment.
This revision is now accepted and ready to land.

Confirm that #56445 is fixed now


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129383

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


[PATCH] D128119: [clang] Enforce instantiation of constexpr template functions during non-constexpr evaluation

2022-07-08 Thread serge via Phabricator via cfe-commits
serge-sans-paille updated this revision to Diff 443337.
serge-sans-paille added a comment.

++review


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

https://reviews.llvm.org/D128119

Files:
  clang/docs/ReleaseNotes.rst
  clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
  clang/test/CodeGenCXX/constexpr-late-instantiation.cpp
  clang/test/SemaCXX/constexpr-late-instantiation.cpp


Index: clang/test/SemaCXX/constexpr-late-instantiation.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/constexpr-late-instantiation.cpp
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 %s -fsyntax-only -verify
+
+template 
+constexpr T foo(T a);   // expected-note {{declared here}}
+
+int main() {
+  int k = foo(5);  // Ok
+  constexpr int j = // expected-error {{constexpr variable 'j' must be 
initialized by a constant expression}}
+  foo(5);  // expected-note {{undefined function 'foo' 
cannot be used in a constant expression}}
+}
+
+template 
+constexpr T foo(T a) {
+  return a;
+}
Index: clang/test/CodeGenCXX/constexpr-late-instantiation.cpp
===
--- /dev/null
+++ clang/test/CodeGenCXX/constexpr-late-instantiation.cpp
@@ -0,0 +1,17 @@
+// Make sure foo is instantiated and we don't get a link error
+// RUN: %clang_cc1 -S -emit-llvm %s -o- | FileCheck %s
+
+template 
+constexpr T foo(T a);
+
+// CHECK-LABEL: define {{.*}} @main
+int main() {
+  // CHECK: call {{.*}} @_Z3fooIiET_S0_
+  int k = foo(5);
+}
+// CHECK: }
+
+template 
+constexpr T foo(T a) {
+  return a;
+}
Index: clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
===
--- clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -4840,7 +4840,8 @@
  /*Complain*/DefinitionRequired)) {
 if (DefinitionRequired)
   Function->setInvalidDecl();
-else if (TSK == TSK_ExplicitInstantiationDefinition) {
+else if (TSK == TSK_ExplicitInstantiationDefinition ||
+ (Function->isConstexpr() && !Recursive)) {
   // Try again at the end of the translation unit (at which point a
   // definition will be required).
   assert(!Recursive);
@@ -4855,7 +4856,7 @@
 Diag(PatternDecl->getLocation(), diag::note_forward_template_decl);
 if (getLangOpts().CPlusPlus11)
   Diag(PointOfInstantiation, diag::note_inst_declaration_hint)
-<< Function;
+  << Function;
   }
 }
 
Index: clang/docs/ReleaseNotes.rst
===
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -181,6 +181,8 @@
   emitted as a dynamic initializer. Previously the variable would
   incorrectly be zero-initialized. In contexts where a dynamic
   initializer is not allowed this is now diagnosed as an error.
+- Clang now correctly emits symbols for implicitly instantiated constexpr
+  template function. Fixes `Issue 55560 
`_.
 
 Improvements to Clang's diagnostics
 ^^^


Index: clang/test/SemaCXX/constexpr-late-instantiation.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/constexpr-late-instantiation.cpp
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 %s -fsyntax-only -verify
+
+template 
+constexpr T foo(T a);   // expected-note {{declared here}}
+
+int main() {
+  int k = foo(5);  // Ok
+  constexpr int j = // expected-error {{constexpr variable 'j' must be initialized by a constant expression}}
+  foo(5);  // expected-note {{undefined function 'foo' cannot be used in a constant expression}}
+}
+
+template 
+constexpr T foo(T a) {
+  return a;
+}
Index: clang/test/CodeGenCXX/constexpr-late-instantiation.cpp
===
--- /dev/null
+++ clang/test/CodeGenCXX/constexpr-late-instantiation.cpp
@@ -0,0 +1,17 @@
+// Make sure foo is instantiated and we don't get a link error
+// RUN: %clang_cc1 -S -emit-llvm %s -o- | FileCheck %s
+
+template 
+constexpr T foo(T a);
+
+// CHECK-LABEL: define {{.*}} @main
+int main() {
+  // CHECK: call {{.*}} @_Z3fooIiET_S0_
+  int k = foo(5);
+}
+// CHECK: }
+
+template 
+constexpr T foo(T a) {
+  return a;
+}
Index: clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
===
--- clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -4840,7 +4840,8 @@
  /*Complain*/DefinitionRequired)) {
 if (DefinitionRequired)
   Function->setInvalidDecl();
-else if (TSK == TSK_ExplicitInstantiationDefinition) {
+else if (TSK == TSK_ExplicitInstantiationDefinition ||
+ (Function->isConstexpr() && !Recursive)) {

[PATCH] D102107: [OpenMP] Codegen aggregate for outlined function captures

2022-07-08 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert added a comment.

In D102107#3639615 , @dhruvachak 
wrote:

> In D102107#3639556 , @jdoerfert 
> wrote:
>
>> In D102107#3639551 , @dhruvachak 
>> wrote:
>>
>>> Is there an llvm/utils script to update clang tests that have RUN lines at 
>>> the top? An example is clang/test/OpenMP/debug_threadprivate_copyin.c.
>>
>> You can create the run lines with the `llvm/utils/update_cc_test_checks.py` 
>> script but those tests have manual lines for now.
>> I usually run `llvm/utils/update_cc_test_checks.py -u 
>> clang/test/OpenMP/*.{c,cpp}` to update all autogenerated tests.
>
> Okay, I will convert those few manual OpenMP tests to autogen format.
>
> How about the AST ones? Do they have to be manually updated? Example: 
> clang/test/AST/ast-dump-openmp-distribute-parallel-for-simd.c

For these ones I have a script locally (attached) that need some manual doing 
but it helps:

  1. run the ast dump and store the result (same as RUN line), e.g.,
{F23722650} clang -cc1 -internal-isystem 
/data/build/llvm-project/lib/clang/13.0.0/include -nostdsysteminc -triple 
x86_64-unknown-unknown -fopenmp -verify -ast-dump 
/data/src/llvm-project/clang/test/AST/ast-dump-openmp-begin-declare-variant_template_4.cpp
 &> /tmp/ast
  2. python3 ast_dump_2_check.py /tmp/ast CHECK
  3. replace the check lines with the content of /tmp/ast.check


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102107

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


[PATCH] D128927: [libc++] Always build c++experimental.a

2022-07-08 Thread Martin Storsjö via Phabricator via cfe-commits
mstorsjo added a comment.

In D128927#3638973 , @ldionne wrote:

> Thanks @mstorsjo! Regarding `_LIBCPP_EXPERIMENTAL_FUNC_VIS`, yes I think it 
> would make sense to use a different visibility macro for symbols that we know 
> are provided only as part of a static library. I would not call it 
> `_LIBCPP_EXPERIMENTAL_FUNC_VIS` though, I would call it something like 
> `_LIBCPP_STATIC_LIBRARY_FUNC_VIS` or something like that.

Sure, `_LIBCPP_STATIC_LIBRARY_FUNC_VIS` sounds good to me too.




Comment at: libcxx/utils/libcxx/test/params.py:68
+  if hasCompileFlag(cfg, '-funstable') and False: # TODO: Enable this once the 
design of `-funstable` is finished
+return '-funstable'
+  else:

ldionne wrote:
> mstorsjo wrote:
> > Actually, I'm not entirely convinced that this is a good way to handle 
> > linking against the library for tests.
> > 
> > When building tests, we don't rely on the compiler to implicitly link in 
> > our C++ library, but we link with `-nostdlib++` (or `-nodefaultlibs`) and 
> > explicitly tell the compiler how to link in specifically the C++ library 
> > we've just built (in the test config files).
> > 
> > So in general, if linking with `-nostdlib++ -fexperimental-library` I kinda 
> > wouldn't expect the compiler driver to link against the library at all? 
> > It's kinda the same as if you'd do `-stdlib=libstdc++ 
> > -fexperimental-library` - we can't have that add `-lc++experimental`, as 
> > that only makes sense as long as we have `-stdlib=libc++`. So subsequently 
> > I don't think the compiler driver should be adding `-lc++experimental` as 
> > long as we're passing `-nostdlib++` either?
> > 
> > But if libc++experimental is built unconditionally, wouldn't it be simplest 
> > to just always link against it in the test config files (just like how we 
> > force it to link against specifically the just-built libc++.a) - that would 
> > make it much more symmetrcial to how we handle the main `-lc++`?
> Interesting point. It does mean that we can never rely on `-funstable` adding 
> `-lc++experimental` from our test suite -- I think that's OK.
> 
> However, I'd like to avoid linking against `-lc++experimental` in the base 
> test configuration, simply because the base test configuration should mirror 
> the minimal way of invoking Clang to use libc++.
Yep. Also another example of why we can't really rely on the compiler driver 
adding it - technically I guess the compiler driver might even choose not to 
pass a generic `-lc++` or `-lc++experimental`, but pass an absolute path to the 
`libc++.{a,so,dylib}` that is bundled with the compiler (clang does this for 
compiler-rt builtins) - so we really do need to rely on `-nodefaultlibs` and/or 
`-nostdlib++` omitting the compiler-provided defaults.

Keeping adding `-lc++experimental` here instead of adding it in the base config 
files is fine with me.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128927

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


[PATCH] D129393: [Clang] Fix the wrong features being derivec in the offload packager

2022-07-08 Thread Joseph Huber via Phabricator via cfe-commits
jhuber6 created this revision.
jhuber6 added reviewers: jdoerfert, tianshilei1992, ye-luo, tra.
Herald added a project: All.
jhuber6 requested review of this revision.
Herald added subscribers: cfe-commits, sstefan1, MaskRay.
Herald added a project: clang.

The offload packager embeds the features in the offloading binary when
performing LTO. This had an incorrect interaction with the
`--cuda-feature` option because we weren't deriving the features from
the CUDA toolchain arguments when it was being specified. This patch
fixes this so the features are correctly overrideen when using this
argument.

However, this brings up a question of how best to handle conflicting
target features. The user could compile many libraries with different
features, in this case we do not know which one to pick. This was not
previously a problem when we simply passed the features in from the CUDA
installation at link-link because we just defaulted to whatever was
current on the system.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D129393

Files:
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/Driver/openmp-offload-gpu-new.c


Index: clang/test/Driver/openmp-offload-gpu-new.c
===
--- clang/test/Driver/openmp-offload-gpu-new.c
+++ clang/test/Driver/openmp-offload-gpu-new.c
@@ -120,3 +120,9 @@
 // RUN: -foffload-lto %s 2>&1 | FileCheck 
--check-prefix=CHECK-LTO-FEATURES %s
 
 // CHECK-LTO-FEATURES: 
clang-offload-packager{{.*}}--image={{.*}}feature=+ptx{{[0-9]+}}
+
+// RUN:   %clang -### --target=x86_64-unknown-linux-gnu -fopenmp 
--offload-arch=sm_52 -nogpulib \
+// RUN: -Xopenmp-target=nvptx64-nvidia-cuda --cuda-feature=+ptx64 
-foffload-lto %s 2>&1 \
+// RUN:| FileCheck --check-prefix=CHECK-SET-FEATURES %s
+
+// CHECK-SET-FEATURES: clang-offload-packager{{.*}}--image={{.*}}feature=+ptx64
Index: clang/lib/Driver/ToolChains/Clang.cpp
===
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -8325,7 +8325,8 @@
 
 ArgStringList Features;
 SmallVector FeatureArgs;
-getTargetFeatures(TC->getDriver(), TC->getTriple(), Args, Features, false);
+getTargetFeatures(TC->getDriver(), TC->getTriple(), TCArgs, Features,
+  false);
 llvm::copy_if(Features, std::back_inserter(FeatureArgs),
   [](StringRef Arg) { return !Arg.startswith("-target"); });
 


Index: clang/test/Driver/openmp-offload-gpu-new.c
===
--- clang/test/Driver/openmp-offload-gpu-new.c
+++ clang/test/Driver/openmp-offload-gpu-new.c
@@ -120,3 +120,9 @@
 // RUN: -foffload-lto %s 2>&1 | FileCheck --check-prefix=CHECK-LTO-FEATURES %s
 
 // CHECK-LTO-FEATURES: clang-offload-packager{{.*}}--image={{.*}}feature=+ptx{{[0-9]+}}
+
+// RUN:   %clang -### --target=x86_64-unknown-linux-gnu -fopenmp --offload-arch=sm_52 -nogpulib \
+// RUN: -Xopenmp-target=nvptx64-nvidia-cuda --cuda-feature=+ptx64 -foffload-lto %s 2>&1 \
+// RUN:| FileCheck --check-prefix=CHECK-SET-FEATURES %s
+
+// CHECK-SET-FEATURES: clang-offload-packager{{.*}}--image={{.*}}feature=+ptx64
Index: clang/lib/Driver/ToolChains/Clang.cpp
===
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -8325,7 +8325,8 @@
 
 ArgStringList Features;
 SmallVector FeatureArgs;
-getTargetFeatures(TC->getDriver(), TC->getTriple(), Args, Features, false);
+getTargetFeatures(TC->getDriver(), TC->getTriple(), TCArgs, Features,
+  false);
 llvm::copy_if(Features, std::back_inserter(FeatureArgs),
   [](StringRef Arg) { return !Arg.startswith("-target"); });
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D102107: [OpenMP] Codegen aggregate for outlined function captures

2022-07-08 Thread Dhruva Chakrabarti via Phabricator via cfe-commits
dhruvachak added a comment.

In D102107#3639556 , @jdoerfert wrote:

> In D102107#3639551 , @dhruvachak 
> wrote:
>
>> Is there an llvm/utils script to update clang tests that have RUN lines at 
>> the top? An example is clang/test/OpenMP/debug_threadprivate_copyin.c.
>
> You can create the run lines with the `llvm/utils/update_cc_test_checks.py` 
> script but those tests have manual lines for now.
> I usually run `llvm/utils/update_cc_test_checks.py -u 
> clang/test/OpenMP/*.{c,cpp}` to update all autogenerated tests.

Okay, I will convert those few manual OpenMP tests to autogen format.

How about the AST ones? Do they have to be manually updated? Example: 
clang/test/AST/ast-dump-openmp-distribute-parallel-for-simd.c


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102107

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


[PATCH] D129389: [clang][deps] Override dependency and serialized diag files for modules

2022-07-08 Thread Ben Langmuir via Phabricator via cfe-commits
benlangmuir created this revision.
benlangmuir added reviewers: jansvoboda11, Bigcheese.
Herald added a project: All.
benlangmuir requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

When building modules, override secondary outputs (dependency file, dependency 
targets, serialized diagnostic file) in addition to the pcm file path. This 
avoids inheriting per-TU command-line options that cause non-determinism in the 
results (non-deterministic command-line for the module build, non-determinism 
in which TU's .diag and .d files will contain the module outputs). In 
clang-scan-deps we infer whether to generate dependency or serialized 
diagnostic files based on an original command-line. In a real build system this 
should be modeled explicitly.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D129389

Files:
  clang/include/clang/Tooling/DependencyScanning/DependencyScanningTool.h
  clang/include/clang/Tooling/DependencyScanning/ModuleDepCollector.h
  clang/lib/Tooling/DependencyScanning/DependencyScanningTool.cpp
  clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
  clang/test/ClangScanDeps/Inputs/removed-args/cdb.json.template
  clang/test/ClangScanDeps/generate-modules-path-args.c
  clang/test/ClangScanDeps/preserved-args.c
  clang/test/ClangScanDeps/removed-args.c
  clang/tools/clang-scan-deps/ClangScanDeps.cpp

Index: clang/tools/clang-scan-deps/ClangScanDeps.cpp
===
--- clang/tools/clang-scan-deps/ClangScanDeps.cpp
+++ clang/tools/clang-scan-deps/ClangScanDeps.cpp
@@ -288,11 +288,16 @@
   Modules.insert(I, {{MD.ID, InputIndex}, std::move(MD)});
 }
 
-ID.CommandLine = GenerateModulesPathArgs
- ? FD.getCommandLine(
-   [&](ModuleID MID) { return lookupPCMPath(MID); })
- : FD.getCommandLineWithoutModulePaths();
-
+if (Inputs.size() == 0)
+  inferOutputOptions(FD.OriginalCommandLine);
+
+ID.CommandLine =
+GenerateModulesPathArgs
+? FD.getCommandLine(
+  [&](ModuleID MID) -> const ModuleOutputOptions & {
+return lookupModuleOutputs(MID);
+  })
+: FD.getCommandLineWithoutModulePaths();
 Inputs.push_back(std::move(ID));
   }
 
@@ -325,7 +330,9 @@
   {"command-line",
GenerateModulesPathArgs
? MD.getCanonicalCommandLine(
- [&](ModuleID MID) { return lookupPCMPath(MID); })
+ [&](ModuleID MID) -> const ModuleOutputOptions & {
+   return lookupModuleOutputs(MID);
+ })
: MD.getCanonicalCommandLineWithoutModulePaths()},
   };
   OutModules.push_back(std::move(O));
@@ -352,11 +359,17 @@
   }
 
 private:
-  StringRef lookupPCMPath(ModuleID MID) {
-auto PCMPath = PCMPaths.insert({MID, ""});
-if (PCMPath.second)
-  PCMPath.first->second = constructPCMPath(MID);
-return PCMPath.first->second;
+  const ModuleOutputOptions (const ModuleID ) {
+auto MO = ModuleOutputs.insert({MID, {}});
+if (MO.second) {
+  ModuleOutputOptions  = MO.first->second;
+  Opts.ModuleFile = constructPCMPath(MID);
+  if (DependencyOutputFile)
+Opts.DependencyFile = Opts.ModuleFile + ".d";
+  if (SerializeDiags)
+Opts.DiagnosticSerializationFile = Opts.ModuleFile + ".diag";
+}
+return MO.first->second;
   }
 
   /// Construct a path for the explicitly built PCM.
@@ -375,6 +388,19 @@
 return std::string(ExplicitPCMPath);
   }
 
+  /// Infer whether modules should write serialized diagnostic, .d, etc.
+  ///
+  /// A build system should model this directly, but here we infer it from an
+  /// original TU command.
+  void inferOutputOptions(ArrayRef Args) {
+for (StringRef Arg : Args) {
+  if (Arg == "-serialize-diagnostics")
+SerializeDiags = true;
+  else if (Arg == "-M" || Arg == "-MM" || Arg == "-MMD" || Arg == "-MD")
+DependencyOutputFile = true;
+}
+  }
+
   struct IndexedModuleID {
 ModuleID ID;
 mutable size_t InputIndex;
@@ -404,8 +430,11 @@
   std::mutex Lock;
   std::unordered_map
   Modules;
-  std::unordered_map PCMPaths;
+  std::unordered_map
+  ModuleOutputs;
   std::vector Inputs;
+  bool SerializeDiags = false;
+  bool DependencyOutputFile = false;
 };
 
 static bool handleFullDependencyToolResult(
Index: clang/test/ClangScanDeps/removed-args.c
===
--- clang/test/ClangScanDeps/removed-args.c
+++ clang/test/ClangScanDeps/removed-args.c
@@ -29,6 +29,9 @@
 // CHECK-NOT:  "-fbuild-session-timestamp=
 // CHECK-NOT:  "-fmodules-prune-interval=
 // CHECK-NOT:  "-fmodules-prune-after=
+// CHECK-NOT:  "-dependency-file"
+// CHECK-NOT:  "-MT"
+// CHECK-NOT:

[PATCH] D102107: [OpenMP] Codegen aggregate for outlined function captures

2022-07-08 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert added a comment.

In D102107#3639551 , @dhruvachak 
wrote:

> Is there an llvm/utils script to update clang tests that have RUN lines at 
> the top? An example is clang/test/OpenMP/debug_threadprivate_copyin.c.

You can create the run lines with the `llvm/utils/update_cc_test_checks.py` 
script but those tests have manual lines for now.
I usually run `llvm/utils/update_cc_test_checks.py -u 
clang/test/OpenMP/*.{c,cpp}` to update all autogenerated tests.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102107

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


[PATCH] D102107: [OpenMP] Codegen aggregate for outlined function captures

2022-07-08 Thread Dhruva Chakrabarti via Phabricator via cfe-commits
dhruvachak added a comment.

Is there an llvm/utils script to update clang tests that have RUN lines at the 
top? An example is clang/test/OpenMP/debug_threadprivate_copyin.c.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102107

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


[PATCH] D128465: [llvm] cmake config groundwork to have ZSTD in LLVM

2022-07-08 Thread Cole Kissane via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf07caf20b9d3: [llvm] cmake config groundwork to have ZSTD in 
LLVM (authored by ckissane).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128465

Files:
  clang-tools-extra/clangd/CMakeLists.txt
  clang-tools-extra/clangd/test/lit.cfg.py
  clang-tools-extra/clangd/test/lit.site.cfg.py.in
  clang/test/CMakeLists.txt
  clang/test/lit.site.cfg.py.in
  compiler-rt/lib/sanitizer_common/symbolizer/scripts/build_symbolizer.sh
  compiler-rt/test/lit.common.cfg.py
  compiler-rt/test/lit.common.configured.in
  flang/CMakeLists.txt
  lld/ELF/CMakeLists.txt
  lld/test/lit.site.cfg.py.in
  lldb/source/Plugins/Process/gdb-remote/CMakeLists.txt
  lldb/test/Shell/lit.site.cfg.py.in
  llvm/CMakeLists.txt
  llvm/cmake/config-ix.cmake
  llvm/cmake/modules/FindZSTD.cmake
  llvm/cmake/modules/LLVMConfig.cmake.in
  llvm/include/llvm/Config/llvm-config.h.cmake
  llvm/test/lit.site.cfg.py.in
  utils/bazel/llvm_configs/llvm-config.h.cmake

Index: utils/bazel/llvm_configs/llvm-config.h.cmake
===
--- utils/bazel/llvm_configs/llvm-config.h.cmake
+++ utils/bazel/llvm_configs/llvm-config.h.cmake
@@ -95,6 +95,9 @@
 /* Define if zlib compression is available */
 #cmakedefine01 LLVM_ENABLE_ZLIB
 
+/* Define if zstd compression is available */
+#cmakedefine01 LLVM_ENABLE_ZSTD
+
 /* Define if LLVM was built with a dependency to the libtensorflow dynamic library */
 #cmakedefine LLVM_HAVE_TF_API
 
Index: llvm/test/lit.site.cfg.py.in
===
--- llvm/test/lit.site.cfg.py.in
+++ llvm/test/lit.site.cfg.py.in
@@ -37,6 +37,7 @@
 config.llvm_use_intel_jitevents = @LLVM_USE_INTEL_JITEVENTS@
 config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@"
 config.have_zlib = @LLVM_ENABLE_ZLIB@
+config.have_zstd = @LLVM_ENABLE_ZSTD@
 config.have_libxar = @LLVM_HAVE_LIBXAR@
 config.have_libxml2 = @LLVM_ENABLE_LIBXML2@
 config.have_curl = @LLVM_ENABLE_CURL@
Index: llvm/include/llvm/Config/llvm-config.h.cmake
===
--- llvm/include/llvm/Config/llvm-config.h.cmake
+++ llvm/include/llvm/Config/llvm-config.h.cmake
@@ -95,6 +95,9 @@
 /* Define if zlib compression is available */
 #cmakedefine01 LLVM_ENABLE_ZLIB
 
+/* Define if zstd compression is available */
+#cmakedefine01 LLVM_ENABLE_ZSTD
+
 /* Define if LLVM was built with a dependency to the libtensorflow dynamic library */
 #cmakedefine LLVM_HAVE_TF_API
 
Index: llvm/cmake/modules/LLVMConfig.cmake.in
===
--- llvm/cmake/modules/LLVMConfig.cmake.in
+++ llvm/cmake/modules/LLVMConfig.cmake.in
@@ -73,6 +73,12 @@
   find_package(ZLIB)
 endif()
 
+set(LLVM_ENABLE_ZSTD @LLVM_ENABLE_ZSTD@)
+if(LLVM_ENABLE_ZSTD)
+  set(ZSTD_ROOT @ZSTD_ROOT@)
+  find_package(ZSTD)
+endif()
+
 set(LLVM_ENABLE_LIBXML2 @LLVM_ENABLE_LIBXML2@)
 if(LLVM_ENABLE_LIBXML2)
   find_package(LibXml2)
Index: llvm/cmake/modules/FindZSTD.cmake
===
--- /dev/null
+++ llvm/cmake/modules/FindZSTD.cmake
@@ -0,0 +1,21 @@
+find_path(ZSTD_INCLUDE_DIR
+  NAMES zstd.h
+  HINTS ${ZSTD_ROOT_DIR}/include)
+
+find_library(ZSTD_LIBRARY
+  NAMES zstd
+  HINTS ${ZSTD_ROOT_DIR}/lib)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(
+ZSTD DEFAULT_MSG
+ZSTD_LIBRARY ZSTD_INCLUDE_DIR)
+
+if(ZSTD_FOUND)
+set(ZSTD_LIBRARIES ${ZSTD_LIBRARY})
+set(ZSTD_INCLUDE_DIRS ${ZSTD_INCLUDE_DIR})
+endif()
+
+mark_as_advanced(
+  ZSTD_INCLUDE_DIR
+  ZSTD_LIBRARY)
Index: llvm/cmake/config-ix.cmake
===
--- llvm/cmake/config-ix.cmake
+++ llvm/cmake/config-ix.cmake
@@ -136,6 +136,27 @@
   set(LLVM_ENABLE_ZLIB "${HAVE_ZLIB}")
 endif()
 
+if(LLVM_ENABLE_ZSTD)
+  if(LLVM_ENABLE_ZSTD STREQUAL FORCE_ON)
+find_package(ZSTD REQUIRED)
+  elseif(NOT LLVM_USE_SANITIZER MATCHES "Memory.*")
+find_package(ZSTD)
+  endif()
+  if(ZSTD_FOUND)
+# Check if zstd we found is usable; for example, we may have found a 32-bit
+# library on a 64-bit system which would result in a link-time failure.
+cmake_push_check_state()
+list(APPEND CMAKE_REQUIRED_INCLUDES ${ZSTD_INCLUDE_DIR})
+list(APPEND CMAKE_REQUIRED_LIBRARIES ${ZSTD_LIBRARY})
+check_symbol_exists(ZSTD_compress zstd.h HAVE_ZSTD)
+cmake_pop_check_state()
+if(LLVM_ENABLE_ZSTD STREQUAL FORCE_ON AND NOT HAVE_ZSTD)
+  message(FATAL_ERROR "Failed to configure zstd")
+endif()
+  endif()
+  set(LLVM_ENABLE_ZSTD "${HAVE_ZSTD}")
+endif()
+
 if(LLVM_ENABLE_LIBXML2)
   if(LLVM_ENABLE_LIBXML2 STREQUAL FORCE_ON)
 find_package(LibXml2 REQUIRED)
Index: llvm/CMakeLists.txt

[PATCH] D128816: [OpenMP] Add loop tripcount argument to kernel launch and remove push function

2022-07-08 Thread Joseph Huber via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG5300263c70da: [OpenMP] Add loop tripcount argument to kernel 
launch and remove push function (authored by jhuber6).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128816

Files:
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/lib/CodeGen/CGOpenMPRuntime.h
  clang/test/OpenMP/distribute_codegen.cpp
  clang/test/OpenMP/distribute_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_num_threads_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_proc_bind_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_num_threads_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_proc_bind_codegen.cpp
  clang/test/OpenMP/distribute_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_codegen.cpp
  clang/test/OpenMP/distribute_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_reduction_codegen.cpp
  clang/test/OpenMP/nvptx_lambda_capturing.cpp
  clang/test/OpenMP/reduction_implicit_map.cpp
  clang/test/OpenMP/target_codegen_global_capture.cpp
  clang/test/OpenMP/target_map_codegen_03.cpp
  clang/test/OpenMP/target_map_codegen_hold.cpp
  clang/test/OpenMP/target_offload_mandatory_codegen.cpp
  clang/test/OpenMP/target_parallel_codegen.cpp
  clang/test/OpenMP/target_parallel_for_codegen.cpp
  clang/test/OpenMP/target_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/target_parallel_if_codegen.cpp
  clang/test/OpenMP/target_parallel_num_threads_codegen.cpp
  clang/test/OpenMP/target_teams_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_collapse_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_dist_schedule_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_firstprivate_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_lastprivate_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_parallel_for_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_parallel_for_collapse_codegen.cpp
  
clang/test/OpenMP/target_teams_distribute_parallel_for_dist_schedule_codegen.cpp
  
clang/test/OpenMP/target_teams_distribute_parallel_for_firstprivate_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_parallel_for_if_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_parallel_for_lastprivate_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_parallel_for_order_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_parallel_for_private_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_parallel_for_proc_bind_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_parallel_for_reduction_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_parallel_for_schedule_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_parallel_for_simd_codegen.cpp
  
clang/test/OpenMP/target_teams_distribute_parallel_for_simd_collapse_codegen.cpp
  
clang/test/OpenMP/target_teams_distribute_parallel_for_simd_dist_schedule_codegen.cpp
  
clang/test/OpenMP/target_teams_distribute_parallel_for_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_parallel_for_simd_if_codegen.cpp
  
clang/test/OpenMP/target_teams_distribute_parallel_for_simd_lastprivate_codegen.cpp
  
clang/test/OpenMP/target_teams_distribute_parallel_for_simd_private_codegen.cpp
  
clang/test/OpenMP/target_teams_distribute_parallel_for_simd_proc_bind_codegen.cpp
  
clang/test/OpenMP/target_teams_distribute_parallel_for_simd_reduction_codegen.cpp
  
clang/test/OpenMP/target_teams_distribute_parallel_for_simd_schedule_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_private_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_reduction_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_simd_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_simd_collapse_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_simd_dist_schedule_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_simd_firstprivate_codegen.cpp
  

[PATCH] D128550: [OpenMP] Change OpenMP code generation for target region entries

2022-07-08 Thread Joseph Huber via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1fff116645b3: [OpenMP] Change OpenMP code generation for 
target region entries (authored by jhuber6).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128550

Files:
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/test/OpenMP/capturing_in_templates.cpp
  clang/test/OpenMP/declare_mapper_codegen.cpp
  clang/test/OpenMP/declare_target_link_codegen.cpp
  clang/test/OpenMP/distribute_codegen.cpp
  clang/test/OpenMP/distribute_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_num_threads_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_proc_bind_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_reduction_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_num_threads_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_proc_bind_codegen.cpp
  clang/test/OpenMP/distribute_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_codegen.cpp
  clang/test/OpenMP/distribute_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_reduction_codegen.cpp
  clang/test/OpenMP/nvptx_lambda_capturing.cpp
  clang/test/OpenMP/nvptx_lambda_pointer_capturing.cpp
  clang/test/OpenMP/nvptx_target_requires_unified_shared_memory.cpp
  clang/test/OpenMP/openmp_offload_codegen.cpp
  clang/test/OpenMP/reduction_implicit_map.cpp
  clang/test/OpenMP/target_codegen.cpp
  clang/test/OpenMP/target_codegen_global_capture.cpp
  clang/test/OpenMP/target_data_member_codegen.cpp
  clang/test/OpenMP/target_data_use_device_ptr_if_codegen.cpp
  clang/test/OpenMP/target_defaultmap_codegen_01.cpp
  clang/test/OpenMP/target_defaultmap_codegen_02.cpp
  clang/test/OpenMP/target_depend_codegen.cpp
  clang/test/OpenMP/target_device_codegen.cpp
  clang/test/OpenMP/target_firstprivate_codegen.cpp
  clang/test/OpenMP/target_is_device_ptr_codegen.cpp
  clang/test/OpenMP/target_map_codegen_00.cpp
  clang/test/OpenMP/target_map_codegen_01.cpp
  clang/test/OpenMP/target_map_codegen_02.cpp
  clang/test/OpenMP/target_map_codegen_03.cpp
  clang/test/OpenMP/target_map_codegen_04.cpp
  clang/test/OpenMP/target_map_codegen_05.cpp
  clang/test/OpenMP/target_map_codegen_06.cpp
  clang/test/OpenMP/target_map_codegen_07.cpp
  clang/test/OpenMP/target_map_codegen_08.cpp
  clang/test/OpenMP/target_map_codegen_09.cpp
  clang/test/OpenMP/target_map_codegen_10.cpp
  clang/test/OpenMP/target_map_codegen_11.cpp
  clang/test/OpenMP/target_map_codegen_12.cpp
  clang/test/OpenMP/target_map_codegen_13.cpp
  clang/test/OpenMP/target_map_codegen_14.cpp
  clang/test/OpenMP/target_map_codegen_15.cpp
  clang/test/OpenMP/target_map_codegen_16.cpp
  clang/test/OpenMP/target_map_codegen_17.cpp
  clang/test/OpenMP/target_map_codegen_18.inc
  clang/test/OpenMP/target_map_codegen_19.cpp
  clang/test/OpenMP/target_map_codegen_20.cpp
  clang/test/OpenMP/target_map_codegen_21.cpp
  clang/test/OpenMP/target_map_codegen_22.cpp
  clang/test/OpenMP/target_map_codegen_23.cpp
  clang/test/OpenMP/target_map_codegen_24.cpp
  clang/test/OpenMP/target_map_codegen_25.cpp
  clang/test/OpenMP/target_map_codegen_26.cpp
  clang/test/OpenMP/target_map_codegen_27.cpp
  clang/test/OpenMP/target_map_codegen_28.cpp
  clang/test/OpenMP/target_map_codegen_29.cpp
  clang/test/OpenMP/target_map_codegen_30.cpp
  clang/test/OpenMP/target_map_codegen_31.cpp
  clang/test/OpenMP/target_map_codegen_32.cpp
  clang/test/OpenMP/target_map_codegen_33.cpp
  clang/test/OpenMP/target_map_codegen_34.cpp
  clang/test/OpenMP/target_map_codegen_35.cpp
  clang/test/OpenMP/target_map_codegen_hold.cpp
  clang/test/OpenMP/target_map_names.cpp
  clang/test/OpenMP/target_map_names_attr.cpp
  clang/test/OpenMP/target_offload_mandatory_codegen.cpp
  clang/test/OpenMP/target_parallel_codegen.cpp
  clang/test/OpenMP/target_parallel_depend_codegen.cpp
  clang/test/OpenMP/target_parallel_for_codegen.cpp
  clang/test/OpenMP/target_parallel_for_depend_codegen.cpp
  clang/test/OpenMP/target_parallel_for_simd_codegen.cpp
  

[PATCH] D128465: [llvm] cmake config groundwork to have ZSTD in LLVM

2022-07-08 Thread Cole Kissane via Phabricator via cfe-commits
ckissane updated this revision to Diff 443310.
ckissane added a comment.

- Merge remote-tracking branch 'origin/main' into ckissane.add-zstd.0-cmake


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128465

Files:
  clang-tools-extra/clangd/CMakeLists.txt
  clang-tools-extra/clangd/test/lit.cfg.py
  clang-tools-extra/clangd/test/lit.site.cfg.py.in
  clang/test/CMakeLists.txt
  clang/test/lit.site.cfg.py.in
  compiler-rt/lib/sanitizer_common/symbolizer/scripts/build_symbolizer.sh
  compiler-rt/test/lit.common.cfg.py
  compiler-rt/test/lit.common.configured.in
  flang/CMakeLists.txt
  lld/ELF/CMakeLists.txt
  lld/test/lit.site.cfg.py.in
  lldb/source/Plugins/Process/gdb-remote/CMakeLists.txt
  lldb/test/Shell/lit.site.cfg.py.in
  llvm/CMakeLists.txt
  llvm/cmake/config-ix.cmake
  llvm/cmake/modules/FindZSTD.cmake
  llvm/cmake/modules/LLVMConfig.cmake.in
  llvm/include/llvm/Config/llvm-config.h.cmake
  llvm/test/lit.site.cfg.py.in
  utils/bazel/llvm_configs/llvm-config.h.cmake

Index: utils/bazel/llvm_configs/llvm-config.h.cmake
===
--- utils/bazel/llvm_configs/llvm-config.h.cmake
+++ utils/bazel/llvm_configs/llvm-config.h.cmake
@@ -95,6 +95,9 @@
 /* Define if zlib compression is available */
 #cmakedefine01 LLVM_ENABLE_ZLIB
 
+/* Define if zstd compression is available */
+#cmakedefine01 LLVM_ENABLE_ZSTD
+
 /* Define if LLVM was built with a dependency to the libtensorflow dynamic library */
 #cmakedefine LLVM_HAVE_TF_API
 
Index: llvm/test/lit.site.cfg.py.in
===
--- llvm/test/lit.site.cfg.py.in
+++ llvm/test/lit.site.cfg.py.in
@@ -37,6 +37,7 @@
 config.llvm_use_intel_jitevents = @LLVM_USE_INTEL_JITEVENTS@
 config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@"
 config.have_zlib = @LLVM_ENABLE_ZLIB@
+config.have_zstd = @LLVM_ENABLE_ZSTD@
 config.have_libxar = @LLVM_HAVE_LIBXAR@
 config.have_libxml2 = @LLVM_ENABLE_LIBXML2@
 config.have_curl = @LLVM_ENABLE_CURL@
Index: llvm/include/llvm/Config/llvm-config.h.cmake
===
--- llvm/include/llvm/Config/llvm-config.h.cmake
+++ llvm/include/llvm/Config/llvm-config.h.cmake
@@ -95,6 +95,9 @@
 /* Define if zlib compression is available */
 #cmakedefine01 LLVM_ENABLE_ZLIB
 
+/* Define if zstd compression is available */
+#cmakedefine01 LLVM_ENABLE_ZSTD
+
 /* Define if LLVM was built with a dependency to the libtensorflow dynamic library */
 #cmakedefine LLVM_HAVE_TF_API
 
Index: llvm/cmake/modules/LLVMConfig.cmake.in
===
--- llvm/cmake/modules/LLVMConfig.cmake.in
+++ llvm/cmake/modules/LLVMConfig.cmake.in
@@ -73,6 +73,12 @@
   find_package(ZLIB)
 endif()
 
+set(LLVM_ENABLE_ZSTD @LLVM_ENABLE_ZSTD@)
+if(LLVM_ENABLE_ZSTD)
+  set(ZSTD_ROOT @ZSTD_ROOT@)
+  find_package(ZSTD)
+endif()
+
 set(LLVM_ENABLE_LIBXML2 @LLVM_ENABLE_LIBXML2@)
 if(LLVM_ENABLE_LIBXML2)
   find_package(LibXml2)
Index: llvm/cmake/modules/FindZSTD.cmake
===
--- /dev/null
+++ llvm/cmake/modules/FindZSTD.cmake
@@ -0,0 +1,21 @@
+find_path(ZSTD_INCLUDE_DIR
+  NAMES zstd.h
+  HINTS ${ZSTD_ROOT_DIR}/include)
+
+find_library(ZSTD_LIBRARY
+  NAMES zstd
+  HINTS ${ZSTD_ROOT_DIR}/lib)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(
+ZSTD DEFAULT_MSG
+ZSTD_LIBRARY ZSTD_INCLUDE_DIR)
+
+if(ZSTD_FOUND)
+set(ZSTD_LIBRARIES ${ZSTD_LIBRARY})
+set(ZSTD_INCLUDE_DIRS ${ZSTD_INCLUDE_DIR})
+endif()
+
+mark_as_advanced(
+  ZSTD_INCLUDE_DIR
+  ZSTD_LIBRARY)
Index: llvm/cmake/config-ix.cmake
===
--- llvm/cmake/config-ix.cmake
+++ llvm/cmake/config-ix.cmake
@@ -136,6 +136,27 @@
   set(LLVM_ENABLE_ZLIB "${HAVE_ZLIB}")
 endif()
 
+if(LLVM_ENABLE_ZSTD)
+  if(LLVM_ENABLE_ZSTD STREQUAL FORCE_ON)
+find_package(ZSTD REQUIRED)
+  elseif(NOT LLVM_USE_SANITIZER MATCHES "Memory.*")
+find_package(ZSTD)
+  endif()
+  if(ZSTD_FOUND)
+# Check if zstd we found is usable; for example, we may have found a 32-bit
+# library on a 64-bit system which would result in a link-time failure.
+cmake_push_check_state()
+list(APPEND CMAKE_REQUIRED_INCLUDES ${ZSTD_INCLUDE_DIR})
+list(APPEND CMAKE_REQUIRED_LIBRARIES ${ZSTD_LIBRARY})
+check_symbol_exists(ZSTD_compress zstd.h HAVE_ZSTD)
+cmake_pop_check_state()
+if(LLVM_ENABLE_ZSTD STREQUAL FORCE_ON AND NOT HAVE_ZSTD)
+  message(FATAL_ERROR "Failed to configure zstd")
+endif()
+  endif()
+  set(LLVM_ENABLE_ZSTD "${HAVE_ZSTD}")
+endif()
+
 if(LLVM_ENABLE_LIBXML2)
   if(LLVM_ENABLE_LIBXML2 STREQUAL FORCE_ON)
 find_package(LibXml2 REQUIRED)
Index: llvm/CMakeLists.txt
===
--- llvm/CMakeLists.txt
+++ 

[PATCH] D128465: [llvm] cmake config groundwork to have ZSTD in LLVM

2022-07-08 Thread Cole Kissane via Phabricator via cfe-commits
ckissane marked 2 inline comments as done.
ckissane added a comment.

marked fixed comments as done


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128465

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


[PATCH] D128465: [llvm] cmake config groundwork to have ZSTD in LLVM

2022-07-08 Thread Cole Kissane via Phabricator via cfe-commits
ckissane updated this revision to Diff 443308.
ckissane added a comment.

- Merge remote-tracking branch 'origin/main' into ckissane.add-zstd.0-cmake
- added have_zstd to compiler-rt/test/lit.common.cfg.py, 
clang-tools-extra/clangd/test/lit.cfg.py and several lit.site.cfg.py.in files


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128465

Files:
  clang-tools-extra/clangd/CMakeLists.txt
  clang-tools-extra/clangd/index/Serialization.cpp
  clang-tools-extra/clangd/test/lit.cfg.py
  clang-tools-extra/clangd/test/lit.site.cfg.py.in
  clang-tools-extra/clangd/unittests/SerializationTests.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Serialization/ASTReader.cpp
  clang/lib/Serialization/ASTWriter.cpp
  clang/test/CMakeLists.txt
  clang/test/lit.site.cfg.py.in
  compiler-rt/lib/sanitizer_common/symbolizer/scripts/build_symbolizer.sh
  compiler-rt/test/lit.common.cfg.py
  compiler-rt/test/lit.common.configured.in
  flang/CMakeLists.txt
  lld/ELF/CMakeLists.txt
  lld/ELF/Driver.cpp
  lld/ELF/InputSection.cpp
  lld/test/lit.site.cfg.py.in
  lldb/source/Plugins/Process/gdb-remote/CMakeLists.txt
  lldb/test/Shell/lit.site.cfg.py.in
  llvm/CMakeLists.txt
  llvm/cmake/config-ix.cmake
  llvm/cmake/modules/FindZSTD.cmake
  llvm/cmake/modules/LLVMConfig.cmake.in
  llvm/docs/ReleaseNotes.rst
  llvm/include/llvm/Config/llvm-config.h.cmake
  llvm/include/llvm/Support/Compression.h
  llvm/lib/MC/ELFObjectWriter.cpp
  llvm/lib/ObjCopy/ELF/ELFObject.cpp
  llvm/lib/Object/Decompressor.cpp
  llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp
  llvm/lib/ProfileData/Coverage/CoverageMappingWriter.cpp
  llvm/lib/ProfileData/InstrProf.cpp
  llvm/lib/ProfileData/SampleProfReader.cpp
  llvm/lib/ProfileData/SampleProfWriter.cpp
  llvm/lib/Support/Compression.cpp
  llvm/test/lit.site.cfg.py.in
  llvm/tools/llvm-mc/llvm-mc.cpp
  llvm/tools/llvm-objcopy/ObjcopyOptions.cpp
  llvm/unittests/ProfileData/InstrProfTest.cpp
  llvm/unittests/Support/CompressionTest.cpp
  utils/bazel/llvm_configs/llvm-config.h.cmake

Index: utils/bazel/llvm_configs/llvm-config.h.cmake
===
--- utils/bazel/llvm_configs/llvm-config.h.cmake
+++ utils/bazel/llvm_configs/llvm-config.h.cmake
@@ -95,6 +95,9 @@
 /* Define if zlib compression is available */
 #cmakedefine01 LLVM_ENABLE_ZLIB
 
+/* Define if zstd compression is available */
+#cmakedefine01 LLVM_ENABLE_ZSTD
+
 /* Define if LLVM was built with a dependency to the libtensorflow dynamic library */
 #cmakedefine LLVM_HAVE_TF_API
 
Index: llvm/unittests/Support/CompressionTest.cpp
===
--- llvm/unittests/Support/CompressionTest.cpp
+++ llvm/unittests/Support/CompressionTest.cpp
@@ -18,6 +18,7 @@
 #include "gtest/gtest.h"
 
 using namespace llvm;
+using namespace llvm::compression;
 
 namespace {
 
@@ -62,12 +63,6 @@
   TestZlibCompression(BinaryDataStr, zlib::DefaultCompression);
 }
 
-TEST(CompressionTest, ZlibCRC32) {
-  EXPECT_EQ(
-  0x414FA339U,
-  zlib::crc32(StringRef("The quick brown fox jumps over the lazy dog")));
-}
-
 #endif
 
 }
Index: llvm/unittests/ProfileData/InstrProfTest.cpp
===
--- llvm/unittests/ProfileData/InstrProfTest.cpp
+++ llvm/unittests/ProfileData/InstrProfTest.cpp
@@ -1147,14 +1147,16 @@
 // Compressing:
 std::string FuncNameStrings1;
 EXPECT_THAT_ERROR(collectPGOFuncNameStrings(
-  FuncNames1, (DoCompression && zlib::isAvailable()),
+  FuncNames1,
+  (DoCompression && compression::zlib::isAvailable()),
   FuncNameStrings1),
   Succeeded());
 
 // Compressing:
 std::string FuncNameStrings2;
 EXPECT_THAT_ERROR(collectPGOFuncNameStrings(
-  FuncNames2, (DoCompression && zlib::isAvailable()),
+  FuncNames2,
+  (DoCompression && compression::zlib::isAvailable()),
   FuncNameStrings2),
   Succeeded());
 
Index: llvm/tools/llvm-objcopy/ObjcopyOptions.cpp
===
--- llvm/tools/llvm-objcopy/ObjcopyOptions.cpp
+++ llvm/tools/llvm-objcopy/ObjcopyOptions.cpp
@@ -739,7 +739,7 @@
 .str()
 .c_str());
 }
-if (!zlib::isAvailable())
+if (!compression::zlib::isAvailable())
   return createStringError(
   errc::invalid_argument,
   "LLVM was not compiled with LLVM_ENABLE_ZLIB: can not compress");
@@ -998,7 +998,7 @@
 "--decompress-debug-sections");
   }
 
-  if (Config.DecompressDebugSections && !zlib::isAvailable())
+  if (Config.DecompressDebugSections && !compression::zlib::isAvailable())
 return createStringError(
   

[PATCH] D102107: [OpenMP] Codegen aggregate for outlined function captures

2022-07-08 Thread Dhruva Chakrabarti via Phabricator via cfe-commits
dhruvachak added inline comments.



Comment at: clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp:3541
 .getPointerType(CGF.getContext().getPointerType(
 CGF.getContext().VoidPtrTy))
 .castAs());

This should be VoidTy now that GlobalArgs type has changed.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102107

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


[clang] 7ecec30 - [Clang][Docs] Update the clang-linker-wrapper documentation.

2022-07-08 Thread Joseph Huber via cfe-commits

Author: Joseph Huber
Date: 2022-07-08T14:30:07-04:00
New Revision: 7ecec30e43987f4851130fc08423ab23fec234a4

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

LOG: [Clang][Docs] Update the clang-linker-wrapper documentation.

Added: 


Modified: 
clang/docs/ClangLinkerWrapper.rst

Removed: 




diff  --git a/clang/docs/ClangLinkerWrapper.rst 
b/clang/docs/ClangLinkerWrapper.rst
index 58fa7f9900e4..28c4086d6b5c 100644
--- a/clang/docs/ClangLinkerWrapper.rst
+++ b/clang/docs/ClangLinkerWrapper.rst
@@ -10,44 +10,56 @@ Clang Linker Wrapper
 Introduction
 
 
-This tool works as a wrapper over a linking job. The tool is used to create
-linked device images for offloading. It scans the linker's input for embedded
-device offloading data stored in sections ``.llvm.offloading..``
-and extracts it as a temporary file. The extracted device files will then be
-passed to a device linking job to create a final device image. The sections 
will
-also be stripped and the resulting file passed back to the host linker.
+This tool works as a wrapper of the normal host linking job. This tool is used
+to create linked device images for offloading and the necessary runtime calls 
to
+register them. It works by first scanning the linker's input for embedded 
device
+offloading data stored at the ``.llvm.offloading`` section. This section
+contains binary data created by the :doc:`ClangOffloadPackager`. The extracted
+device files will then be linked. The linked modules will then be wrapped into 
a
+new object file containing the code necessary to register it with the 
offloading
+runtime.
 
 Usage
 =
 
-This tool can be used with the following options. Arguments to the host linker
-being wrapper around are passed as positional arguments using the ``--`` flag 
to
-override parsing.
+This tool can be used with the following options. Any arguments not intended
+only for the linker wrapper will be forwarded to the wrapped linker job.
 
 .. code-block:: console
 
-  USAGE: clang-linker-wrapper [options] ...
+  USAGE: clang-linker-wrapper [options] -- 
   
   OPTIONS:
-  
-  Generic Options:
-  
---help- Display available options (--help-hidden for 
more)
---help-list   - Display list of available options 
(--help-list-hidden for more)
---version - Display the version of this program
-  
-  clang-linker-wrapper options:
-  
---host-triple= - Triple to use for the host compilation
---linker-path= - Path of linker binary
---opt-level=   - Optimization level for LTO
---ptxas-option=- Argument to pass to the ptxas invocation
---save-temps   - Save intermediary results.
---strip-sections   - Strip offloading sections from the host 
object file.
---target-embed-bc  - Embed linked bitcode instead of an executable 
device image
---target-feature=  - Target features for triple
---bitcode-library= - Path for the target bitcode library
--v - Verbose output from tools
+--bitcode-library=--=
+   Extra bitcode library to link
+--cuda-path=  Set the system CUDA path
+--device-debug Use debugging
+--device-linker= or =
+   Arguments to pass to the device linker invocation
+--dry-run  Print program arguments without running
+--embed-bitcodeEmbed linked bitcode in the module
+--help-hidden  Display all available options
+--help Display available options (--help-hidden for more)
+--host-triple= Triple to use for the host compilation
+--linker-path=   The linker executable to invoke
+-LAdd  to the library search path
+-lSearch for library 
+--opt-level=
+   Optimization level for LTO
+-o   Path to file to write output
+--pass-remarks-analysis=
+   Pass remarks for LTO
+--pass-remarks-missed=
+   Pass remarks for LTO
+--pass-remarks= Pass remarks for LTO
+--print-wrapped-module Print the wrapped module's IR for testing
+--ptxas-arg=Argument to pass to the 'ptxas' invocation
+--save-temps   Save intermediate results
+--sysroot   Set the system root
+--verbose  Verbose output from tools
+--vDisplay the version number and exit
+-- The separator for the wrapped linker arguments
+
 
 Example
 ===
@@ -59,4 +71,4 @@ section and run a device linking job on it.
 
 .. code-block:: console
 
-  clang-linker-wrapper -host-triple x86_64 -linker-path /usr/bin/ld -- 
+  

[PATCH] D129384: [objcxx] Fix `std::addressof` for `id`.

2022-07-08 Thread Zoe Carver 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 rG22c7a6ec: [objcxx] Fix `std::addressof` for `id`. 
(authored by zoecarver).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129384

Files:
  clang/lib/Sema/SemaChecking.cpp
  clang/test/SemaObjCXX/unsupported-signature-std-addressof-id.mm


Index: clang/test/SemaObjCXX/unsupported-signature-std-addressof-id.mm
===
--- /dev/null
+++ clang/test/SemaObjCXX/unsupported-signature-std-addressof-id.mm
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -fobjc-runtime-has-weak -verify %s
+// expected-no-diagnostics
+
+namespace std {
+template 
+T* addressof(T&);
+}
+
+void f(id obj) {
+(void)std::addressof(*obj);
+}
Index: clang/lib/Sema/SemaChecking.cpp
===
--- clang/lib/Sema/SemaChecking.cpp
+++ clang/lib/Sema/SemaChecking.cpp
@@ -2413,7 +2413,7 @@
 bool ReturnsPointer = BuiltinID == Builtin::BIaddressof ||
   BuiltinID == Builtin::BI__addressof;
 if (!(Param->isReferenceType() &&
-  (ReturnsPointer ? Result->isPointerType()
+  (ReturnsPointer ? Result->isAnyPointerType()
   : Result->isReferenceType()) &&
   Context.hasSameUnqualifiedType(Param->getPointeeType(),
  Result->getPointeeType( {


Index: clang/test/SemaObjCXX/unsupported-signature-std-addressof-id.mm
===
--- /dev/null
+++ clang/test/SemaObjCXX/unsupported-signature-std-addressof-id.mm
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -fobjc-runtime-has-weak -verify %s
+// expected-no-diagnostics
+
+namespace std {
+template 
+T* addressof(T&);
+}
+
+void f(id obj) {
+(void)std::addressof(*obj);
+}
Index: clang/lib/Sema/SemaChecking.cpp
===
--- clang/lib/Sema/SemaChecking.cpp
+++ clang/lib/Sema/SemaChecking.cpp
@@ -2413,7 +2413,7 @@
 bool ReturnsPointer = BuiltinID == Builtin::BIaddressof ||
   BuiltinID == Builtin::BI__addressof;
 if (!(Param->isReferenceType() &&
-  (ReturnsPointer ? Result->isPointerType()
+  (ReturnsPointer ? Result->isAnyPointerType()
   : Result->isReferenceType()) &&
   Context.hasSameUnqualifiedType(Param->getPointeeType(),
  Result->getPointeeType( {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 22c7a6d - [objcxx] Fix `std::addressof` for `id`.

2022-07-08 Thread via cfe-commits

Author: zoecarver
Date: 2022-07-08T11:29:30-07:00
New Revision: 22c7a6ec6d62e627ca66b886b60ba1ce1e7c

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

LOG: [objcxx] Fix `std::addressof` for `id`.

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

Added: 
clang/test/SemaObjCXX/unsupported-signature-std-addressof-id.mm

Modified: 
clang/lib/Sema/SemaChecking.cpp

Removed: 




diff  --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 4ac3fd38438ca..3ed745c5634c8 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -2413,7 +2413,7 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, 
unsigned BuiltinID,
 bool ReturnsPointer = BuiltinID == Builtin::BIaddressof ||
   BuiltinID == Builtin::BI__addressof;
 if (!(Param->isReferenceType() &&
-  (ReturnsPointer ? Result->isPointerType()
+  (ReturnsPointer ? Result->isAnyPointerType()
   : Result->isReferenceType()) &&
   Context.hasSameUnqualifiedType(Param->getPointeeType(),
  Result->getPointeeType( {

diff  --git a/clang/test/SemaObjCXX/unsupported-signature-std-addressof-id.mm 
b/clang/test/SemaObjCXX/unsupported-signature-std-addressof-id.mm
new file mode 100644
index 0..a591163714ee5
--- /dev/null
+++ b/clang/test/SemaObjCXX/unsupported-signature-std-addressof-id.mm
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -fobjc-runtime-has-weak -verify %s
+// expected-no-diagnostics
+
+namespace std {
+template 
+T* addressof(T&);
+}
+
+void f(id obj) {
+(void)std::addressof(*obj);
+}



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


[PATCH] D128754: [llvm] Remove unused and redundant crc32 funcction from llvm::compression::zlib namespace

2022-07-08 Thread Cole Kissane via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG96063bfa9088: [llvm] Remove unused and redundant crc32 
funcction from llvm::compression::zlib… (authored by ckissane).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128754

Files:
  llvm/docs/ReleaseNotes.rst
  llvm/include/llvm/Support/Compression.h
  llvm/lib/Support/Compression.cpp
  llvm/unittests/Support/CompressionTest.cpp


Index: llvm/unittests/Support/CompressionTest.cpp
===
--- llvm/unittests/Support/CompressionTest.cpp
+++ llvm/unittests/Support/CompressionTest.cpp
@@ -63,12 +63,6 @@
   TestZlibCompression(BinaryDataStr, zlib::DefaultCompression);
 }
 
-TEST(CompressionTest, ZlibCRC32) {
-  EXPECT_EQ(
-  0x414FA339U,
-  zlib::crc32(StringRef("The quick brown fox jumps over the lazy dog")));
-}
-
 #endif
 
 }
Index: llvm/lib/Support/Compression.cpp
===
--- llvm/lib/Support/Compression.cpp
+++ llvm/lib/Support/Compression.cpp
@@ -83,10 +83,6 @@
   return E;
 }
 
-uint32_t zlib::crc32(StringRef Buffer) {
-  return ::crc32(0, (const Bytef *)Buffer.data(), Buffer.size());
-}
-
 #else
 bool zlib::isAvailable() { return false; }
 void zlib::compress(StringRef InputBuffer,
@@ -102,7 +98,4 @@
size_t UncompressedSize) {
   llvm_unreachable("zlib::uncompress is unavailable");
 }
-uint32_t zlib::crc32(StringRef Buffer) {
-  llvm_unreachable("zlib::crc32 is unavailable");
-}
 #endif
Index: llvm/include/llvm/Support/Compression.h
===
--- llvm/include/llvm/Support/Compression.h
+++ llvm/include/llvm/Support/Compression.h
@@ -41,8 +41,6 @@
  SmallVectorImpl ,
  size_t UncompressedSize);
 
-uint32_t crc32(StringRef Buffer);
-
 } // End of namespace zlib
 
 } // End of namespace compression
Index: llvm/docs/ReleaseNotes.rst
===
--- llvm/docs/ReleaseNotes.rst
+++ llvm/docs/ReleaseNotes.rst
@@ -206,6 +206,7 @@
   introduction of alternatives to zlib compression in the llvm toolchain.
   Changes are as follows:
   * Relocate the ``llvm::zlib`` namespace to ``llvm::compression::zlib``.
+  * Remove crc32 from zlib compression namespace, people should use the 
``llvm::crc32`` instead.
 
 Changes to the Go bindings
 --


Index: llvm/unittests/Support/CompressionTest.cpp
===
--- llvm/unittests/Support/CompressionTest.cpp
+++ llvm/unittests/Support/CompressionTest.cpp
@@ -63,12 +63,6 @@
   TestZlibCompression(BinaryDataStr, zlib::DefaultCompression);
 }
 
-TEST(CompressionTest, ZlibCRC32) {
-  EXPECT_EQ(
-  0x414FA339U,
-  zlib::crc32(StringRef("The quick brown fox jumps over the lazy dog")));
-}
-
 #endif
 
 }
Index: llvm/lib/Support/Compression.cpp
===
--- llvm/lib/Support/Compression.cpp
+++ llvm/lib/Support/Compression.cpp
@@ -83,10 +83,6 @@
   return E;
 }
 
-uint32_t zlib::crc32(StringRef Buffer) {
-  return ::crc32(0, (const Bytef *)Buffer.data(), Buffer.size());
-}
-
 #else
 bool zlib::isAvailable() { return false; }
 void zlib::compress(StringRef InputBuffer,
@@ -102,7 +98,4 @@
size_t UncompressedSize) {
   llvm_unreachable("zlib::uncompress is unavailable");
 }
-uint32_t zlib::crc32(StringRef Buffer) {
-  llvm_unreachable("zlib::crc32 is unavailable");
-}
 #endif
Index: llvm/include/llvm/Support/Compression.h
===
--- llvm/include/llvm/Support/Compression.h
+++ llvm/include/llvm/Support/Compression.h
@@ -41,8 +41,6 @@
  SmallVectorImpl ,
  size_t UncompressedSize);
 
-uint32_t crc32(StringRef Buffer);
-
 } // End of namespace zlib
 
 } // End of namespace compression
Index: llvm/docs/ReleaseNotes.rst
===
--- llvm/docs/ReleaseNotes.rst
+++ llvm/docs/ReleaseNotes.rst
@@ -206,6 +206,7 @@
   introduction of alternatives to zlib compression in the llvm toolchain.
   Changes are as follows:
   * Relocate the ``llvm::zlib`` namespace to ``llvm::compression::zlib``.
+  * Remove crc32 from zlib compression namespace, people should use the ``llvm::crc32`` instead.
 
 Changes to the Go bindings
 --
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D128953: [NFC] Refactor llvm::zlib namespace

2022-07-08 Thread Cole Kissane via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGea61750c35a1: [NFC] Refactor llvm::zlib namespace (authored 
by ckissane).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128953

Files:
  clang-tools-extra/clangd/index/Serialization.cpp
  clang-tools-extra/clangd/unittests/SerializationTests.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Serialization/ASTReader.cpp
  clang/lib/Serialization/ASTWriter.cpp
  lld/ELF/Driver.cpp
  lld/ELF/InputSection.cpp
  llvm/docs/ReleaseNotes.rst
  llvm/include/llvm/Support/Compression.h
  llvm/lib/MC/ELFObjectWriter.cpp
  llvm/lib/ObjCopy/ELF/ELFObject.cpp
  llvm/lib/Object/Decompressor.cpp
  llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp
  llvm/lib/ProfileData/Coverage/CoverageMappingWriter.cpp
  llvm/lib/ProfileData/InstrProf.cpp
  llvm/lib/ProfileData/SampleProfReader.cpp
  llvm/lib/ProfileData/SampleProfWriter.cpp
  llvm/lib/Support/Compression.cpp
  llvm/tools/llvm-mc/llvm-mc.cpp
  llvm/tools/llvm-objcopy/ObjcopyOptions.cpp
  llvm/unittests/ProfileData/InstrProfTest.cpp
  llvm/unittests/Support/CompressionTest.cpp

Index: llvm/unittests/Support/CompressionTest.cpp
===
--- llvm/unittests/Support/CompressionTest.cpp
+++ llvm/unittests/Support/CompressionTest.cpp
@@ -18,6 +18,7 @@
 #include "gtest/gtest.h"
 
 using namespace llvm;
+using namespace llvm::compression;
 
 namespace {
 
Index: llvm/unittests/ProfileData/InstrProfTest.cpp
===
--- llvm/unittests/ProfileData/InstrProfTest.cpp
+++ llvm/unittests/ProfileData/InstrProfTest.cpp
@@ -1147,14 +1147,16 @@
 // Compressing:
 std::string FuncNameStrings1;
 EXPECT_THAT_ERROR(collectPGOFuncNameStrings(
-  FuncNames1, (DoCompression && zlib::isAvailable()),
+  FuncNames1,
+  (DoCompression && compression::zlib::isAvailable()),
   FuncNameStrings1),
   Succeeded());
 
 // Compressing:
 std::string FuncNameStrings2;
 EXPECT_THAT_ERROR(collectPGOFuncNameStrings(
-  FuncNames2, (DoCompression && zlib::isAvailable()),
+  FuncNames2,
+  (DoCompression && compression::zlib::isAvailable()),
   FuncNameStrings2),
   Succeeded());
 
Index: llvm/tools/llvm-objcopy/ObjcopyOptions.cpp
===
--- llvm/tools/llvm-objcopy/ObjcopyOptions.cpp
+++ llvm/tools/llvm-objcopy/ObjcopyOptions.cpp
@@ -739,7 +739,7 @@
 .str()
 .c_str());
 }
-if (!zlib::isAvailable())
+if (!compression::zlib::isAvailable())
   return createStringError(
   errc::invalid_argument,
   "LLVM was not compiled with LLVM_ENABLE_ZLIB: can not compress");
@@ -998,7 +998,7 @@
 "--decompress-debug-sections");
   }
 
-  if (Config.DecompressDebugSections && !zlib::isAvailable())
+  if (Config.DecompressDebugSections && !compression::zlib::isAvailable())
 return createStringError(
 errc::invalid_argument,
 "LLVM was not compiled with LLVM_ENABLE_ZLIB: cannot decompress");
Index: llvm/tools/llvm-mc/llvm-mc.cpp
===
--- llvm/tools/llvm-mc/llvm-mc.cpp
+++ llvm/tools/llvm-mc/llvm-mc.cpp
@@ -403,7 +403,7 @@
   MAI->setRelaxELFRelocations(RelaxELFRel);
 
   if (CompressDebugSections != DebugCompressionType::None) {
-if (!zlib::isAvailable()) {
+if (!compression::zlib::isAvailable()) {
   WithColor::error(errs(), ProgName)
   << "build tools with zlib to enable -compress-debug-sections";
   return 1;
Index: llvm/lib/Support/Compression.cpp
===
--- llvm/lib/Support/Compression.cpp
+++ llvm/lib/Support/Compression.cpp
@@ -22,11 +22,9 @@
 #endif
 
 using namespace llvm;
+using namespace llvm::compression;
 
 #if LLVM_ENABLE_ZLIB
-static Error createError(StringRef Err) {
-  return make_error(Err, inconvertibleErrorCode());
-}
 
 static StringRef convertZlibCodeToString(int Code) {
   switch (Code) {
@@ -70,15 +68,17 @@
   // Tell MemorySanitizer that zlib output buffer is fully initialized.
   // This avoids a false report when running LLVM with uninstrumented ZLib.
   __msan_unpoison(UncompressedBuffer, UncompressedSize);
-  return Res ? createError(convertZlibCodeToString(Res)) : Error::success();
+  return Res ? make_error(convertZlibCodeToString(Res),
+   inconvertibleErrorCode())
+ : Error::success();
 }
 
 Error zlib::uncompress(StringRef InputBuffer,

[clang] ea61750 - [NFC] Refactor llvm::zlib namespace

2022-07-08 Thread Cole Kissane via cfe-commits

Author: Cole Kissane
Date: 2022-07-08T11:19:07-07:00
New Revision: ea61750c35a11140e9245bd9cbeb383c37f6e031

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

LOG: [NFC] Refactor llvm::zlib namespace

* Refactor compression namespaces across the project, making way for a possible
  introduction of alternatives to zlib compression.
  Changes are as follows:
  * Relocate the `llvm::zlib` namespace to `llvm::compression::zlib`.

Reviewed By: MaskRay, leonardchan, phosek

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

Added: 


Modified: 
clang-tools-extra/clangd/index/Serialization.cpp
clang-tools-extra/clangd/unittests/SerializationTests.cpp
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Serialization/ASTReader.cpp
clang/lib/Serialization/ASTWriter.cpp
lld/ELF/Driver.cpp
lld/ELF/InputSection.cpp
llvm/docs/ReleaseNotes.rst
llvm/include/llvm/Support/Compression.h
llvm/lib/MC/ELFObjectWriter.cpp
llvm/lib/ObjCopy/ELF/ELFObject.cpp
llvm/lib/Object/Decompressor.cpp
llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp
llvm/lib/ProfileData/Coverage/CoverageMappingWriter.cpp
llvm/lib/ProfileData/InstrProf.cpp
llvm/lib/ProfileData/SampleProfReader.cpp
llvm/lib/ProfileData/SampleProfWriter.cpp
llvm/lib/Support/Compression.cpp
llvm/tools/llvm-mc/llvm-mc.cpp
llvm/tools/llvm-objcopy/ObjcopyOptions.cpp
llvm/unittests/ProfileData/InstrProfTest.cpp
llvm/unittests/Support/CompressionTest.cpp

Removed: 




diff  --git a/clang-tools-extra/clangd/index/Serialization.cpp 
b/clang-tools-extra/clangd/index/Serialization.cpp
index f7045f0be3fde..ee86ed5714ecc 100644
--- a/clang-tools-extra/clangd/index/Serialization.cpp
+++ b/clang-tools-extra/clangd/index/Serialization.cpp
@@ -190,9 +190,9 @@ class StringTableOut {
   RawTable.append(std::string(S));
   RawTable.push_back(0);
 }
-if (llvm::zlib::isAvailable()) {
+if (llvm::compression::zlib::isAvailable()) {
   llvm::SmallString<1> Compressed;
-  llvm::zlib::compress(RawTable, Compressed);
+  llvm::compression::zlib::compress(RawTable, Compressed);
   write32(RawTable.size(), OS);
   OS << Compressed;
 } else {
@@ -223,7 +223,7 @@ llvm::Expected 
readStringTable(llvm::StringRef Data) {
   llvm::SmallString<1> UncompressedStorage;
   if (UncompressedSize == 0) // No compression
 Uncompressed = R.rest();
-  else if (llvm::zlib::isAvailable()) {
+  else if (llvm::compression::zlib::isAvailable()) {
 // Don't allocate a massive buffer if UncompressedSize was corrupted
 // This is effective for sharded index, but not big monolithic ones, as
 // once compressed size reaches 4MB nothing can be ruled out.
@@ -233,8 +233,8 @@ llvm::Expected 
readStringTable(llvm::StringRef Data) {
   return error("Bad stri table: uncompress {0} -> {1} bytes is 
implausible",
R.rest().size(), UncompressedSize);
 
-if (llvm::Error E = llvm::zlib::uncompress(R.rest(), UncompressedStorage,
-   UncompressedSize))
+if (llvm::Error E = llvm::compression::zlib::uncompress(
+R.rest(), UncompressedStorage, UncompressedSize))
   return std::move(E);
 Uncompressed = UncompressedStorage;
   } else

diff  --git a/clang-tools-extra/clangd/unittests/SerializationTests.cpp 
b/clang-tools-extra/clangd/unittests/SerializationTests.cpp
index 70873efe5776c..e99626ba75d77 100644
--- a/clang-tools-extra/clangd/unittests/SerializationTests.cpp
+++ b/clang-tools-extra/clangd/unittests/SerializationTests.cpp
@@ -391,7 +391,7 @@ TEST(SerializationTest, NoCrashOnBadArraySize) {
 // Check we detect invalid string table size size without allocating it first.
 // If this detection fails, the test should allocate a huge array and crash.
 TEST(SerializationTest, NoCrashOnBadStringTableSize) {
-  if (!llvm::zlib::isAvailable()) {
+  if (!llvm::compression::zlib::isAvailable()) {
 log("skipping test, no zlib");
 return;
   }

diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index 10d2b9202b7c6..2c4d39343183c 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -1144,7 +1144,7 @@ static void RenderDebugInfoCompressionArgs(const ArgList 
,
 if (Value == "none") {
   CmdArgs.push_back("--compress-debug-sections=none");
 } else if (Value == "zlib") {
-  if (llvm::zlib::isAvailable()) {
+  if (llvm::compression::zlib::isAvailable()) {
 CmdArgs.push_back(
 Args.MakeArgString("--compress-debug-sections=" + Twine(Value)));
   } else {

diff  --git a/clang/lib/Serialization/ASTReader.cpp 
b/clang/lib/Serialization/ASTReader.cpp
index 

[clang-tools-extra] ea61750 - [NFC] Refactor llvm::zlib namespace

2022-07-08 Thread Cole Kissane via cfe-commits

Author: Cole Kissane
Date: 2022-07-08T11:19:07-07:00
New Revision: ea61750c35a11140e9245bd9cbeb383c37f6e031

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

LOG: [NFC] Refactor llvm::zlib namespace

* Refactor compression namespaces across the project, making way for a possible
  introduction of alternatives to zlib compression.
  Changes are as follows:
  * Relocate the `llvm::zlib` namespace to `llvm::compression::zlib`.

Reviewed By: MaskRay, leonardchan, phosek

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

Added: 


Modified: 
clang-tools-extra/clangd/index/Serialization.cpp
clang-tools-extra/clangd/unittests/SerializationTests.cpp
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Serialization/ASTReader.cpp
clang/lib/Serialization/ASTWriter.cpp
lld/ELF/Driver.cpp
lld/ELF/InputSection.cpp
llvm/docs/ReleaseNotes.rst
llvm/include/llvm/Support/Compression.h
llvm/lib/MC/ELFObjectWriter.cpp
llvm/lib/ObjCopy/ELF/ELFObject.cpp
llvm/lib/Object/Decompressor.cpp
llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp
llvm/lib/ProfileData/Coverage/CoverageMappingWriter.cpp
llvm/lib/ProfileData/InstrProf.cpp
llvm/lib/ProfileData/SampleProfReader.cpp
llvm/lib/ProfileData/SampleProfWriter.cpp
llvm/lib/Support/Compression.cpp
llvm/tools/llvm-mc/llvm-mc.cpp
llvm/tools/llvm-objcopy/ObjcopyOptions.cpp
llvm/unittests/ProfileData/InstrProfTest.cpp
llvm/unittests/Support/CompressionTest.cpp

Removed: 




diff  --git a/clang-tools-extra/clangd/index/Serialization.cpp 
b/clang-tools-extra/clangd/index/Serialization.cpp
index f7045f0be3fde..ee86ed5714ecc 100644
--- a/clang-tools-extra/clangd/index/Serialization.cpp
+++ b/clang-tools-extra/clangd/index/Serialization.cpp
@@ -190,9 +190,9 @@ class StringTableOut {
   RawTable.append(std::string(S));
   RawTable.push_back(0);
 }
-if (llvm::zlib::isAvailable()) {
+if (llvm::compression::zlib::isAvailable()) {
   llvm::SmallString<1> Compressed;
-  llvm::zlib::compress(RawTable, Compressed);
+  llvm::compression::zlib::compress(RawTable, Compressed);
   write32(RawTable.size(), OS);
   OS << Compressed;
 } else {
@@ -223,7 +223,7 @@ llvm::Expected 
readStringTable(llvm::StringRef Data) {
   llvm::SmallString<1> UncompressedStorage;
   if (UncompressedSize == 0) // No compression
 Uncompressed = R.rest();
-  else if (llvm::zlib::isAvailable()) {
+  else if (llvm::compression::zlib::isAvailable()) {
 // Don't allocate a massive buffer if UncompressedSize was corrupted
 // This is effective for sharded index, but not big monolithic ones, as
 // once compressed size reaches 4MB nothing can be ruled out.
@@ -233,8 +233,8 @@ llvm::Expected 
readStringTable(llvm::StringRef Data) {
   return error("Bad stri table: uncompress {0} -> {1} bytes is 
implausible",
R.rest().size(), UncompressedSize);
 
-if (llvm::Error E = llvm::zlib::uncompress(R.rest(), UncompressedStorage,
-   UncompressedSize))
+if (llvm::Error E = llvm::compression::zlib::uncompress(
+R.rest(), UncompressedStorage, UncompressedSize))
   return std::move(E);
 Uncompressed = UncompressedStorage;
   } else

diff  --git a/clang-tools-extra/clangd/unittests/SerializationTests.cpp 
b/clang-tools-extra/clangd/unittests/SerializationTests.cpp
index 70873efe5776c..e99626ba75d77 100644
--- a/clang-tools-extra/clangd/unittests/SerializationTests.cpp
+++ b/clang-tools-extra/clangd/unittests/SerializationTests.cpp
@@ -391,7 +391,7 @@ TEST(SerializationTest, NoCrashOnBadArraySize) {
 // Check we detect invalid string table size size without allocating it first.
 // If this detection fails, the test should allocate a huge array and crash.
 TEST(SerializationTest, NoCrashOnBadStringTableSize) {
-  if (!llvm::zlib::isAvailable()) {
+  if (!llvm::compression::zlib::isAvailable()) {
 log("skipping test, no zlib");
 return;
   }

diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index 10d2b9202b7c6..2c4d39343183c 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -1144,7 +1144,7 @@ static void RenderDebugInfoCompressionArgs(const ArgList 
,
 if (Value == "none") {
   CmdArgs.push_back("--compress-debug-sections=none");
 } else if (Value == "zlib") {
-  if (llvm::zlib::isAvailable()) {
+  if (llvm::compression::zlib::isAvailable()) {
 CmdArgs.push_back(
 Args.MakeArgString("--compress-debug-sections=" + Twine(Value)));
   } else {

diff  --git a/clang/lib/Serialization/ASTReader.cpp 
b/clang/lib/Serialization/ASTReader.cpp
index 

[PATCH] D128766: Update references to Discourse instead of the mailing lists.

2022-07-08 Thread Tanya Lattner via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGeb1ffd817c3c: Update references to Discourse instead of the 
mailing lists. (authored by tonic).

Changed prior to commit:
  https://reviews.llvm.org/D128766?vs=441800=443296#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128766

Files:
  clang/docs/ExternalClangExamples.rst
  clang/docs/InternalsManual.rst
  clang/docs/OpenCLSupport.rst
  clang/docs/OpenMPSupport.rst
  clang/docs/ReleaseNotes.rst
  clang/www/get_involved.html

Index: clang/www/get_involved.html
===
--- clang/www/get_involved.html
+++ clang/www/get_involved.html
@@ -28,41 +28,28 @@
 
 Follow what's going on
 
-Clang is a subproject of the https://llvm.org;>LLVM Project, but
-has its own mailing lists because the communities have people with different
-interests.  The two clang lists are:
+Clang is a subproject of the https://llvm.org;>LLVM Project
+and has a Discourse forum and mailing list:
 
 
 https://lists.llvm.org/mailman/listinfo/cfe-commits;>cfe-commits
  - This list is for patch submission/discussion.
 
-https://lists.llvm.org/mailman/listinfo/cfe-dev;>cfe-dev -
-This list is for everything else Clang related (questions and answers, design
+https://discourse.llvm.org/c/clang/6;>Clang Frontend Discourse forum -
+This forum is for everything else Clang related (questions and answers, design
 discussions, etc).
 
 
 
-If you are interested in clang only, these two lists should be all
-you need.  If you are interested in the LLVM optimizer and code generator,
-please consider signing up for https://lists.llvm.org/mailman/listinfo/llvm-dev;>llvm-dev and https://lists.llvm.org/mailman/listinfo/llvm-commits;>llvm-commits
-as well.
-
-
 The most common way to talk with other developers on the project is through
-the https://lists.llvm.org/mailman/listinfo/cfe-dev;>cfe-dev mailing
-list.  The clang mailing list is a very friendly place and we welcome
-newcomers.  In addition to the cfe-dev list, a significant amount of design
+the https://discourse.llvm.org/c/clang/6;>Clang Frontend Discourse forum
+.  The clang forum is a very friendly place and we welcome
+newcomers.  In addition to the forum, a significant amount of design
 discussion takes place on the https://lists.llvm.org/mailman/listinfo/cfe-commits;>cfe-commits mailing
 list.  All of these lists have archives, so you can browse through previous
 discussions or follow the list development on the web if you prefer.
 
-You can also follow the http://planet.clang.org/;>Planet Clang
-community news feed which offers a window into the world, work and lives of
-Clang developers, contributors and the standards they implement.
-
 If you're looking for something to work on, check out our Open Projects page or look through the https://github.com/llvm/llvm-project/issues/;>LLVM bug tracker.
Index: clang/docs/ReleaseNotes.rst
===
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -675,5 +675,5 @@
 tree.
 
 If you have any questions or comments about Clang, please feel free to
-contact us via the `mailing
-list `_.
+contact us on the Discourse forums (Clang Frontend category)
+`_.
Index: clang/docs/OpenMPSupport.rst
===
--- clang/docs/OpenMPSupport.rst
+++ clang/docs/OpenMPSupport.rst
@@ -110,8 +110,9 @@
 =
 
 The following table provides a quick overview over various OpenMP 5.0 features
-and their implementation status. Please contact *openmp-dev* at
-*lists.llvm.org* for more information or if you want to help with the
+and their implementation status. Please post on the
+`Discourse forums (Runtimes - OpenMP category)`_ for more 
+information or if you want to help with the
 implementation.
 
 +--+--+--+---+
@@ -256,8 +257,10 @@
 
 The following table provides a quick overview over various OpenMP 5.1 features
 and their implementation status, as defined in the technical report 8 (TR8).
-Please contact *openmp-dev* at *lists.llvm.org* for more information or if you
-want to help with the implementation.
+Please post on the 
+`Discourse forums (Runtimes - OpenMP category)`_ for more 
+information or if you want to help with the
+implementation.
 
 +--+--+--+---+
 |Category   

[clang] eb1ffd8 - Update references to Discourse instead of the mailing lists.

2022-07-08 Thread via cfe-commits

Author: tlattner
Date: 2022-07-08T11:16:47-07:00
New Revision: eb1ffd817c3ce5120c3f9d4152de65954314a8d5

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

LOG: Update references to Discourse instead of the mailing lists.

Update the references to the old Mailman mailing lists to point to Discourse 
forums.

Reviewed By: aaron.ballman

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

Added: 


Modified: 
clang/docs/ExternalClangExamples.rst
clang/docs/InternalsManual.rst
clang/docs/OpenCLSupport.rst
clang/docs/OpenMPSupport.rst
clang/docs/ReleaseNotes.rst
clang/www/get_involved.html

Removed: 




diff  --git a/clang/docs/ExternalClangExamples.rst 
b/clang/docs/ExternalClangExamples.rst
index 58c605a9a8363..080114740ddb8 100644
--- a/clang/docs/ExternalClangExamples.rst
+++ b/clang/docs/ExternalClangExamples.rst
@@ -18,9 +18,9 @@ where Clang is used are:
 - Static analysis.
 - Documentation/cross-reference generation.
 
-If you know of (or wrote!) a tool or project using Clang, please send an
-email to Clang's `development discussion mailing list
-`_ to have it added.
+If you know of (or wrote!) a tool or project using Clang, please post on 
+`the Discourse forums (Clang Frontend category)
+`_ to have it added.
 (or if you are already a Clang contributor, feel free to directly commit
 additions). Since the primary purpose of this page is to provide examples
 that can help developers, generally they must have code available.

diff  --git a/clang/docs/InternalsManual.rst b/clang/docs/InternalsManual.rst
index 72228fcc2e0ae..8d18ff01be043 100644
--- a/clang/docs/InternalsManual.rst
+++ b/clang/docs/InternalsManual.rst
@@ -537,7 +537,7 @@ token.  This concept maps directly to the "spelling 
location" for the token.
 ``SourceRange`` and ``CharSourceRange``
 ---
 
-.. mostly taken from 
https://lists.llvm.org/pipermail/cfe-dev/2010-August/010595.html
+.. mostly taken from 
https://discourse.llvm.org/t/code-ranges-of-tokens-ast-elements/16893/2
 
 Clang represents most source ranges by [first, last], where "first" and "last"
 each point to the beginning of their respective tokens.  For example consider

diff  --git a/clang/docs/OpenCLSupport.rst b/clang/docs/OpenCLSupport.rst
index 3fa0c774f5bc9..9372e63c0e621 100644
--- a/clang/docs/OpenCLSupport.rst
+++ b/clang/docs/OpenCLSupport.rst
@@ -408,8 +408,8 @@ Experimental features
 
 Clang provides the following new WIP features for the developers to experiment
 and provide early feedback or contribute with further improvements.
-Feel free to contact us on `cfe-dev
-`_ or file `a GitHub issue
+Feel free to contact us on `the Discourse forums (Clang Frontend category)
+`_ or file `a GitHub issue
 `_.
 
 .. _opencl_experimental_cxxlibs:

diff  --git a/clang/docs/OpenMPSupport.rst b/clang/docs/OpenMPSupport.rst
index c94bc0b0de362..efabe927d6df5 100644
--- a/clang/docs/OpenMPSupport.rst
+++ b/clang/docs/OpenMPSupport.rst
@@ -110,8 +110,9 @@ OpenMP 5.0 Implementation Details
 =
 
 The following table provides a quick overview over various OpenMP 5.0 features
-and their implementation status. Please contact *openmp-dev* at
-*lists.llvm.org* for more information or if you want to help with the
+and their implementation status. Please post on the
+`Discourse forums (Runtimes - OpenMP category)`_ for more 
+information or if you want to help with the
 implementation.
 
 
+--+--+--+---+
@@ -256,8 +257,10 @@ OpenMP 5.1 Implementation Details
 
 The following table provides a quick overview over various OpenMP 5.1 features
 and their implementation status, as defined in the technical report 8 (TR8).
-Please contact *openmp-dev* at *lists.llvm.org* for more information or if you
-want to help with the implementation.
+Please post on the 
+`Discourse forums (Runtimes - OpenMP category)`_ for more 
+information or if you want to help with the
+implementation.
 
 
+--+--+--+---+
 |Category  | Feature   
   | Status   | Reviews 
  |
@@ -362,12 

[PATCH] D127624: [C++20][Modules] Allow for redeclarations in partitions.

2022-07-08 Thread Iain Sandoe via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGbc2a6defc853: [C++20][Modules] Allow for redeclarations in 
partitions. (authored by iains).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D127624

Files:
  clang/lib/Sema/SemaDecl.cpp
  clang/test/Modules/cxx20-partition-redeclarations.cpp


Index: clang/test/Modules/cxx20-partition-redeclarations.cpp
===
--- /dev/null
+++ clang/test/Modules/cxx20-partition-redeclarations.cpp
@@ -0,0 +1,55 @@
+// RUN: rm -rf %t
+// RUN: split-file %s %t
+// RUN: cd %t
+
+// RUN: %clang_cc1 -std=c++20 A-intf-part.cpp -emit-module-interface \
+// RUN:  -o A-PubPart.pcm
+// RUN: %clang_cc1 -std=c++20 A-interface.cpp -emit-module-interface \
+// RUN:   -fmodule-file=A-PubPart.pcm -o A.pcm
+
+// RUN: %clang_cc1 -std=c++20 A-impl-top.cpp -fsyntax-only -fmodule-file=A.pcm
+// RUN: %clang_cc1 -std=c++20 A-impl-part.cpp -fsyntax-only -fmodule-file=A.pcm
+// RUN: %clang_cc1 -std=c++20 A-impl-1.cpp -fsyntax-only -fmodule-file=A.pcm
+// RUN: %clang_cc1 -std=c++20 A-impl-2.cpp -fsyntax-only -fmodule-file=A.pcm
+
+//--- A-interface.cpp
+export module A;
+
+export import :PubPart;
+
+export void do_something();
+
+void helper1();
+void helper3();
+
+//--- A-intf-part.cpp
+export module A:PubPart;
+
+void helper2();
+
+//--- A-impl-top.cpp
+
+module A;
+
+void do_something() {
+  helper1();
+  helper2();
+  helper3();
+}
+
+//--- A-impl-part.cpp
+module A:Secret;
+
+import A;
+
+void helper3() {}
+
+//--- A-impl-1.cpp
+module A;
+
+void helper1() {}
+
+//--- A-impl-2.cpp
+module A;
+
+void helper2() {}
Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -1625,22 +1625,20 @@
   Module *NewM = New->getOwningModule();
   Module *OldM = Old->getOwningModule();
 
-  if (NewM && NewM->Kind == Module::PrivateModuleFragment)
+  if (NewM && NewM->isPrivateModule())
 NewM = NewM->Parent;
-  if (OldM && OldM->Kind == Module::PrivateModuleFragment)
+  if (OldM && OldM->isPrivateModule())
 OldM = OldM->Parent;
 
-  // If we have a decl in a module partition, it is part of the containing
-  // module (which is the only thing that can be importing it).
-  if (NewM && OldM &&
-  (OldM->Kind == Module::ModulePartitionInterface ||
-   OldM->Kind == Module::ModulePartitionImplementation)) {
-return false;
-  }
-
   if (NewM == OldM)
 return false;
 
+  // Partitions are part of the module, but a partition could import another
+  // module, so verify that the PMIs agree.
+  if (NewM && OldM && (NewM->isModulePartition() || OldM->isModulePartition()))
+return NewM->getPrimaryModuleInterfaceName() ==
+   OldM->getPrimaryModuleInterfaceName();
+
   bool NewIsModuleInterface = NewM && NewM->isModulePurview();
   bool OldIsModuleInterface = OldM && OldM->isModulePurview();
   if (NewIsModuleInterface || OldIsModuleInterface) {


Index: clang/test/Modules/cxx20-partition-redeclarations.cpp
===
--- /dev/null
+++ clang/test/Modules/cxx20-partition-redeclarations.cpp
@@ -0,0 +1,55 @@
+// RUN: rm -rf %t
+// RUN: split-file %s %t
+// RUN: cd %t
+
+// RUN: %clang_cc1 -std=c++20 A-intf-part.cpp -emit-module-interface \
+// RUN:  -o A-PubPart.pcm
+// RUN: %clang_cc1 -std=c++20 A-interface.cpp -emit-module-interface \
+// RUN:   -fmodule-file=A-PubPart.pcm -o A.pcm
+
+// RUN: %clang_cc1 -std=c++20 A-impl-top.cpp -fsyntax-only -fmodule-file=A.pcm
+// RUN: %clang_cc1 -std=c++20 A-impl-part.cpp -fsyntax-only -fmodule-file=A.pcm
+// RUN: %clang_cc1 -std=c++20 A-impl-1.cpp -fsyntax-only -fmodule-file=A.pcm
+// RUN: %clang_cc1 -std=c++20 A-impl-2.cpp -fsyntax-only -fmodule-file=A.pcm
+
+//--- A-interface.cpp
+export module A;
+
+export import :PubPart;
+
+export void do_something();
+
+void helper1();
+void helper3();
+
+//--- A-intf-part.cpp
+export module A:PubPart;
+
+void helper2();
+
+//--- A-impl-top.cpp
+
+module A;
+
+void do_something() {
+  helper1();
+  helper2();
+  helper3();
+}
+
+//--- A-impl-part.cpp
+module A:Secret;
+
+import A;
+
+void helper3() {}
+
+//--- A-impl-1.cpp
+module A;
+
+void helper1() {}
+
+//--- A-impl-2.cpp
+module A;
+
+void helper2() {}
Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -1625,22 +1625,20 @@
   Module *NewM = New->getOwningModule();
   Module *OldM = Old->getOwningModule();
 
-  if (NewM && NewM->Kind == Module::PrivateModuleFragment)
+  if (NewM && NewM->isPrivateModule())
 NewM = NewM->Parent;
-  if (OldM && OldM->Kind == Module::PrivateModuleFragment)
+  if (OldM && OldM->isPrivateModule())

[clang] bc2a6de - [C++20][Modules] Allow for redeclarations in partitions.

2022-07-08 Thread Iain Sandoe via cfe-commits

Author: Iain Sandoe
Date: 2022-07-08T19:02:59+01:00
New Revision: bc2a6defc853553b3896cb853bb84fe663f6bfd0

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

LOG: [C++20][Modules] Allow for redeclarations in partitions.

The existing provision is not sufficient, it did not allow for the cases
where an implementation partition includes the primary module interface,
or for the case that an exported interface partition is contains a decl
that is then implemented in a regular implementation unit.

It is somewhat unfortunate that we have to compare top level module names
to achieve this, since built modules are not necessarily available.

TODO: It might be useful to cache a hash of the primary module name if
this test proves to be a  significant load.

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

Added: 
clang/test/Modules/cxx20-partition-redeclarations.cpp

Modified: 
clang/lib/Sema/SemaDecl.cpp

Removed: 




diff  --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 1139088ecde27..d6c89d525cdc2 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -1625,22 +1625,20 @@ bool Sema::CheckRedeclarationModuleOwnership(NamedDecl 
*New, NamedDecl *Old) {
   Module *NewM = New->getOwningModule();
   Module *OldM = Old->getOwningModule();
 
-  if (NewM && NewM->Kind == Module::PrivateModuleFragment)
+  if (NewM && NewM->isPrivateModule())
 NewM = NewM->Parent;
-  if (OldM && OldM->Kind == Module::PrivateModuleFragment)
+  if (OldM && OldM->isPrivateModule())
 OldM = OldM->Parent;
 
-  // If we have a decl in a module partition, it is part of the containing
-  // module (which is the only thing that can be importing it).
-  if (NewM && OldM &&
-  (OldM->Kind == Module::ModulePartitionInterface ||
-   OldM->Kind == Module::ModulePartitionImplementation)) {
-return false;
-  }
-
   if (NewM == OldM)
 return false;
 
+  // Partitions are part of the module, but a partition could import another
+  // module, so verify that the PMIs agree.
+  if (NewM && OldM && (NewM->isModulePartition() || OldM->isModulePartition()))
+return NewM->getPrimaryModuleInterfaceName() ==
+   OldM->getPrimaryModuleInterfaceName();
+
   bool NewIsModuleInterface = NewM && NewM->isModulePurview();
   bool OldIsModuleInterface = OldM && OldM->isModulePurview();
   if (NewIsModuleInterface || OldIsModuleInterface) {

diff  --git a/clang/test/Modules/cxx20-partition-redeclarations.cpp 
b/clang/test/Modules/cxx20-partition-redeclarations.cpp
new file mode 100644
index 0..f99ef009a79af
--- /dev/null
+++ b/clang/test/Modules/cxx20-partition-redeclarations.cpp
@@ -0,0 +1,55 @@
+// RUN: rm -rf %t
+// RUN: split-file %s %t
+// RUN: cd %t
+
+// RUN: %clang_cc1 -std=c++20 A-intf-part.cpp -emit-module-interface \
+// RUN:  -o A-PubPart.pcm
+// RUN: %clang_cc1 -std=c++20 A-interface.cpp -emit-module-interface \
+// RUN:   -fmodule-file=A-PubPart.pcm -o A.pcm
+
+// RUN: %clang_cc1 -std=c++20 A-impl-top.cpp -fsyntax-only -fmodule-file=A.pcm
+// RUN: %clang_cc1 -std=c++20 A-impl-part.cpp -fsyntax-only -fmodule-file=A.pcm
+// RUN: %clang_cc1 -std=c++20 A-impl-1.cpp -fsyntax-only -fmodule-file=A.pcm
+// RUN: %clang_cc1 -std=c++20 A-impl-2.cpp -fsyntax-only -fmodule-file=A.pcm
+
+//--- A-interface.cpp
+export module A;
+
+export import :PubPart;
+
+export void do_something();
+
+void helper1();
+void helper3();
+
+//--- A-intf-part.cpp
+export module A:PubPart;
+
+void helper2();
+
+//--- A-impl-top.cpp
+
+module A;
+
+void do_something() {
+  helper1();
+  helper2();
+  helper3();
+}
+
+//--- A-impl-part.cpp
+module A:Secret;
+
+import A;
+
+void helper3() {}
+
+//--- A-impl-1.cpp
+module A;
+
+void helper1() {}
+
+//--- A-impl-2.cpp
+module A;
+
+void helper2() {}



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


[PATCH] D128830: [Pipelines] Introduce DAE after ArgumentPromotion

2022-07-08 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks added a comment.

moving DAE after the function simplification pipeline makes sense

In D128830#3622736 , @psamolysov 
wrote:

> In D128830#3622467 , @fhahn wrote:
>
>> Do we need to retain the run of `DeadArgumentEliminationPass` in the 
>> original position or is a single run at the new position sufficient?
>
> Good point! I tried and also removed the guard that the DAE pass should run 
> with O3  only (currently it run 
> exactly as the pass in the original position did: with any O > 0). I have a 
> chance to run the LLVM :: Transforms tests only, one test failed - `LLVM :: 
> Transforms\InstCombine\unused-nonnull.ll`:
>
>   error: CHECK-SAME: expected string not found in input
>   ; CHECK-SAME: (i32 [[ARGC:%.*]], i8** nocapture readnone [[ARGV:%.*]]) 
> local_unnamed_addr #[[ATTR0:[0-9]+]] {
> ^
>   :7:17: note: scanning from here
>   define i32 @main(i32 %argc, i8** nocapture readonly %argv) 
> local_unnamed_addr #0 {
>
> The difference is that the `%argv` argument has the `readonly` attribute, not 
> `readnone`. I'm not sure whether this makes much sense (I guess this  could 
> because `readnone` can theoretically open a door for some optimizations for 
> which `readonly` cannot).

this would be fixed by running `PostOrderFunctionAttrsPass` after the function 
simplification pipeline which is something I've wanted to do but never got 
around to testing. we should be inferring more precise attributes after fully 
simplifying functions. the only case that might regress is recursive functions 
since when visiting the recursive calls we haven't computed attributes for the 
recursive functions yet

this test is regressing with this patch because previously DAE would replace 
passed arguments with poison if the argument isn't used in the function, 
removing the use of `%argv` in `@main` and func-attrs would mark `%argv` as 
readnone, but with this patch func-attrs runs on `@main` before the use of 
`%argv` is eliminated. the call to `@compute` is eliminated in all cases in the 
function simplification pipeline due to inferring the `returned` attribute on 
`%x`, which is why running func-attrs after the function simplification 
pipeline fixes this issue

  @@ -759,9 +758,6 @@ PassBuilder::buildInlinerPipeline(OptimizationLevel Level,
 if (AttributorRun & AttributorRunOption::CGSCC)
   MainCGPipeline.addPass(AttributorCGSCCPass());
   
  -  // Now deduce any function attributes based in the current code.
  -  MainCGPipeline.addPass(PostOrderFunctionAttrsPass());
  -
 // When at O3 add argument promotion to the pass pipeline.
 // FIXME: It isn't at all clear why this should be limited to O3.
 if (Level == OptimizationLevel::O3)
  @@ -781,6 +777,9 @@ PassBuilder::buildInlinerPipeline(OptimizationLevel Level,
 buildFunctionSimplificationPipeline(Level, Phase),
 PTO.EagerlyInvalidateAnalyses, EnableNoRerunSimplificationPipeline));
   
  +  // Now deduce any function attributes based in the current code.
  +  MainCGPipeline.addPass(PostOrderFunctionAttrsPass());
  +
 MainCGPipeline.addPass(CoroSplitPass(Level != OptimizationLevel::O0));


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128830

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


[PATCH] D129384: [objcxx] Fix `std::addressof` for `id`.

2022-07-08 Thread Zoe Carver via Phabricator via cfe-commits
zoecarver created this revision.
Herald added a project: All.
zoecarver requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D129384

Files:
  clang/lib/Sema/SemaChecking.cpp
  clang/test/SemaObjCXX/unsupported-signature-std-addressof-id.mm


Index: clang/test/SemaObjCXX/unsupported-signature-std-addressof-id.mm
===
--- /dev/null
+++ clang/test/SemaObjCXX/unsupported-signature-std-addressof-id.mm
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -fobjc-runtime-has-weak -verify %s
+// expected-no-diagnostics
+
+namespace std {
+template 
+T* addressof(T&);
+}
+
+void f(id obj) {
+(void)std::addressof(*obj);
+}
Index: clang/lib/Sema/SemaChecking.cpp
===
--- clang/lib/Sema/SemaChecking.cpp
+++ clang/lib/Sema/SemaChecking.cpp
@@ -2413,7 +2413,7 @@
 bool ReturnsPointer = BuiltinID == Builtin::BIaddressof ||
   BuiltinID == Builtin::BI__addressof;
 if (!(Param->isReferenceType() &&
-  (ReturnsPointer ? Result->isPointerType()
+  (ReturnsPointer ? Result->isAnyPointerType()
   : Result->isReferenceType()) &&
   Context.hasSameUnqualifiedType(Param->getPointeeType(),
  Result->getPointeeType( {


Index: clang/test/SemaObjCXX/unsupported-signature-std-addressof-id.mm
===
--- /dev/null
+++ clang/test/SemaObjCXX/unsupported-signature-std-addressof-id.mm
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -fobjc-runtime-has-weak -verify %s
+// expected-no-diagnostics
+
+namespace std {
+template 
+T* addressof(T&);
+}
+
+void f(id obj) {
+(void)std::addressof(*obj);
+}
Index: clang/lib/Sema/SemaChecking.cpp
===
--- clang/lib/Sema/SemaChecking.cpp
+++ clang/lib/Sema/SemaChecking.cpp
@@ -2413,7 +2413,7 @@
 bool ReturnsPointer = BuiltinID == Builtin::BIaddressof ||
   BuiltinID == Builtin::BI__addressof;
 if (!(Param->isReferenceType() &&
-  (ReturnsPointer ? Result->isPointerType()
+  (ReturnsPointer ? Result->isAnyPointerType()
   : Result->isReferenceType()) &&
   Context.hasSameUnqualifiedType(Param->getPointeeType(),
  Result->getPointeeType( {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D129301: [clang-offload-bundler][NFC] Library-ize ClangOffloadBundler (1/4)

2022-07-08 Thread Joseph Huber via Phabricator via cfe-commits
jhuber6 added a comment.

In D129301#3639318 , @yaxunl wrote:

> I think before the new binary format supports Windows and -fno-gpu-rdc and 
> HIP runtime support the new binary format, we cannot deprecate 
> clang-offload-bundler. I expect that would take some time.

Supporting `-fno-gpu-rdc` should be easy, this will just require a few tweaks 
to the driver phases and passing it to the host backend directly. Supporting 
Windows would be a little tougher, we would need to make sure we can embed / 
extract the device code with Windows. After that we would need to synthesize 
the start / stop pointers differently. There is a way to do this on Windows 
similar to how Unix linkers, there's some examples in ASAN or HWSAN I believe. 
It's definitely doable but would take some effort, so it definitely won't work 
in time for the 15 release. I personally don't have much interest in Mac or 
Windows, but if I want to make this format universal I may need to actually sit 
down and implement it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129301

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


[PATCH] D129383: [LinkerWrapper] Fix use of string savers and correctly pass bitcode libraries

2022-07-08 Thread Joseph Huber via Phabricator via cfe-commits
jhuber6 created this revision.
jhuber6 added reviewers: jdoerfert, ye-luo.
Herald added a project: All.
jhuber6 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This patch removes some uses of string savers that are no-longer needed.
We also create a new string saver when linking bitcode files. It seems
that occasionally the symbol string references can go out of scope when
they are added to the LTO input so we need to save these names that are
used for symbol resolution. Additionally, a previous patch added new
logic for handling bitcode libraries, but failed to actually add them to
the input. This bug has been fixed.

Fixes #56445


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D129383

Files:
  clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp


Index: clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
===
--- clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
+++ clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
@@ -525,17 +525,15 @@
   if (!TempFileOrErr)
 return TempFileOrErr.takeError();
 
-  BumpPtrAllocator Alloc;
-  StringSaver Saver(Alloc);
-
   SmallVector CmdArgs;
   CmdArgs.push_back(*FatBinaryPath);
   CmdArgs.push_back(Triple.isArch64Bit() ? "-64" : "-32");
   CmdArgs.push_back("--create");
   CmdArgs.push_back(*TempFileOrErr);
   for (const auto  : InputFiles)
-CmdArgs.push_back(Saver.save("--image=profile=" + std::get<1>(FileAndArch) 
+
- ",file=" + std::get<0>(FileAndArch)));
+CmdArgs.push_back(
+Args.MakeArgString("--image=profile=" + std::get<1>(FileAndArch) +
+   ",file=" + std::get<0>(FileAndArch)));
 
   if (Error Err = executeCommands(*FatBinaryPath, CmdArgs))
 return std::move(Err);
@@ -808,6 +806,8 @@
   SmallVector BitcodeInputFiles;
   DenseSet UsedInRegularObj;
   DenseSet UsedInSharedLib;
+  BumpPtrAllocator Alloc;
+  StringSaver Saver(Alloc);
 
   // Search for bitcode files in the input and create an LTO input file. If it
   // is not a bitcode file, scan its symbol table for symbols we need to save.
@@ -844,9 +844,9 @@
 
 // Record if we've seen these symbols in any object or shared 
libraries.
 if ((*ObjFile)->isRelocatableObject())
-  UsedInRegularObj.insert(*Name);
+  UsedInRegularObj.insert(Saver.save(*Name));
 else
-  UsedInSharedLib.insert(*Name);
+  UsedInSharedLib.insert(Saver.save(*Name));
   }
   continue;
 }
@@ -908,7 +908,8 @@
   // We will use this as the prevailing symbol definition in LTO unless
   // it is undefined or another definition has already been used.
   Res.Prevailing =
-  !Sym.isUndefined() && PrevailingSymbols.insert(Sym.getName()).second;
+  !Sym.isUndefined() &&
+  PrevailingSymbols.insert(Saver.save(Sym.getName())).second;
 
   // We need LTO to preseve the following global symbols:
   // 1) Symbols used in regular objects.
@@ -1193,8 +1194,6 @@
 InputsForTarget[File].emplace_back(std::move(File));
   LinkerInputFiles.clear();
 
-  BumpPtrAllocator Alloc;
-  UniqueStringSaver Saver(Alloc);
   DenseMap> Images;
   for (auto  : InputsForTarget) {
 SmallVector  = InputForTarget.getSecond();
@@ -1395,6 +1394,7 @@
 auto FileOrErr = getInputBitcodeLibrary(Library);
 if (!FileOrErr)
   reportError(FileOrErr.takeError());
+InputFiles.push_back(std::move(*FileOrErr));
   }
 
   DenseSet IsTargetUsed;


Index: clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
===
--- clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
+++ clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
@@ -525,17 +525,15 @@
   if (!TempFileOrErr)
 return TempFileOrErr.takeError();
 
-  BumpPtrAllocator Alloc;
-  StringSaver Saver(Alloc);
-
   SmallVector CmdArgs;
   CmdArgs.push_back(*FatBinaryPath);
   CmdArgs.push_back(Triple.isArch64Bit() ? "-64" : "-32");
   CmdArgs.push_back("--create");
   CmdArgs.push_back(*TempFileOrErr);
   for (const auto  : InputFiles)
-CmdArgs.push_back(Saver.save("--image=profile=" + std::get<1>(FileAndArch) +
- ",file=" + std::get<0>(FileAndArch)));
+CmdArgs.push_back(
+Args.MakeArgString("--image=profile=" + std::get<1>(FileAndArch) +
+   ",file=" + std::get<0>(FileAndArch)));
 
   if (Error Err = executeCommands(*FatBinaryPath, CmdArgs))
 return std::move(Err);
@@ -808,6 +806,8 @@
   SmallVector BitcodeInputFiles;
   DenseSet UsedInRegularObj;
   DenseSet UsedInSharedLib;
+  BumpPtrAllocator Alloc;
+  StringSaver Saver(Alloc);
 
   // Search for bitcode files in the input and create an LTO input file. If it
   // is not a bitcode file, scan its symbol table for symbols we need to save.
@@ -844,9 +844,9 @@
 
 // 

[PATCH] D129301: [clang-offload-bundler][NFC] Library-ize ClangOffloadBundler (1/4)

2022-07-08 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added a comment.

In D129301#3637641 , @lamb-j wrote:

> @yaxunl Are you recommending I combine all 4 patches down into 1 patch? Or 
> combine a subset of patches?

I recommend combining all patches as one.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129301

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


[PATCH] D129301: [clang-offload-bundler][NFC] Library-ize ClangOffloadBundler (1/4)

2022-07-08 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added a comment.

In D129301#3637664 , @jhuber6 wrote:

> In D129301#3637642 , @jdoerfert 
> wrote:
>
>> Isn't the offload bundler on it's "way out" (=replaced and then deleted 
>> soon)?
>
> HIP still uses it to create their `fatbinary` format for CUDA-like support 
> for multi-architecture binaries as well as their object file format. Once 
> D128914  is landed we can at least compile 
> HIP without it, but we would still need to use it to create the bundled image 
> until AMD decides to support my stuff in their runtime. Beyond that I'm not 
> aware of what the users will be now that OpenMP uses the new interface by 
> default. I'm not in a big hurry to delete this if people still have a use for 
> it, but I'd prefer things to use the new interface if possible. Are there any 
> other situations where we still need the `clang-offload-bundler`? If there's 
> anything the new interface is lacking I could add it in.

I think before the new binary format supports Windows and -fno-gpu-rdc and HIP 
runtime support the new binary format, we cannot deprecate 
clang-offload-bundler. I expect that would take some time.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129301

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


[PATCH] D128119: [clang] Enforce instantiation of constexpr template functions during non-constexpr evaluation

2022-07-08 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 some test changes, assuming that precommit CI comes back green.




Comment at: clang/docs/ReleaseNotes.rst:184
   initializer is not allowed this is now diagnosed as an error.
+- Clang now correctly emit symbols for implicitly instanciated constexpr
+  template function. Fixes `Issue 55560 
`_.





Comment at: clang/test/SemaCXX/constexpr-late-instantiation.cpp:1
+// Make sure foo is instantiated and we don't get a link error
+// RUN: not %clang_cc1 %s -fsyntax-only -verify

You can remove this comment since this is no longer testing the IR.



Comment at: clang/test/SemaCXX/constexpr-late-instantiation.cpp:2
+// Make sure foo is instantiated and we don't get a link error
+// RUN: not %clang_cc1 %s -fsyntax-only -verify
+

Oops, I missed that in my earlier suggestion!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128119

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


[PATCH] D111617: [RISCV] Lazily add RVV C intrinsics.

2022-07-08 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added inline comments.



Comment at: clang/include/clang/Support/RISCVVIntrinsicUtils.h:17
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Support/raw_ostream.h"
 #include 

Do we need the header or is a forward declaration enough?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111617

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


[PATCH] D111617: [RISCV] Lazily add RVV C intrinsics.

2022-07-08 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added inline comments.



Comment at: clang/test/Sema/riscv-bad-intrnisic-pragma.c:1
+// RUN: %clang_cc1 -triple riscv64 -target-feature +v %s -emit-llvm -o - \
+// RUN:2>&1 | FileCheck %s

this test file name is misspelled



Comment at: clang/test/Sema/riscv-intrnisic-pragma.c:1
+// RUN: %clang_cc1 -triple riscv64 -target-feature +v -emit-llvm -o - -verify 
%s
+

test file name is misspelled


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111617

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


[PATCH] D128119: [clang] Enforce instantiation of constexpr template functions during non-constexpr evaluation

2022-07-08 Thread serge via Phabricator via cfe-commits
serge-sans-paille updated this revision to Diff 443276.
serge-sans-paille added a comment.

+ release note
+ take review into account


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128119

Files:
  clang/docs/ReleaseNotes.rst
  clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
  clang/test/CodeGenCXX/constexpr-late-instantiation.cpp
  clang/test/SemaCXX/constexpr-late-instantiation.cpp


Index: clang/test/SemaCXX/constexpr-late-instantiation.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/constexpr-late-instantiation.cpp
@@ -0,0 +1,15 @@
+// Make sure foo is instantiated and we don't get a link error
+// RUN: not %clang_cc1 %s -fsyntax-only -verify
+
+template 
+constexpr T foo(T a);
+
+int main() {
+  int k = foo(5);   // Ok
+  constexpr int j = foo(5); // expected-error {{constexpr variable 'j' 
must be initialized by a constant expression}}
+}
+
+template 
+constexpr T foo(T a) {
+  return a;
+}
Index: clang/test/CodeGenCXX/constexpr-late-instantiation.cpp
===
--- /dev/null
+++ clang/test/CodeGenCXX/constexpr-late-instantiation.cpp
@@ -0,0 +1,17 @@
+// Make sure foo is instantiated and we don't get a link error
+// RUN: %clang_cc1 -S -emit-llvm %s -o- | FileCheck %s
+
+template 
+constexpr T foo(T a);
+
+// CHECK-LABEL: define {{.*}} @main
+int main() {
+  // CHECK: call {{.*}} @_Z3fooIiET_S0_
+  int k = foo(5);
+}
+// CHECK: }
+
+template 
+constexpr T foo(T a) {
+  return a;
+}
Index: clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
===
--- clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -4840,7 +4840,8 @@
  /*Complain*/DefinitionRequired)) {
 if (DefinitionRequired)
   Function->setInvalidDecl();
-else if (TSK == TSK_ExplicitInstantiationDefinition) {
+else if (TSK == TSK_ExplicitInstantiationDefinition ||
+ (Function->isConstexpr() && !Recursive)) {
   // Try again at the end of the translation unit (at which point a
   // definition will be required).
   assert(!Recursive);
@@ -4855,7 +4856,7 @@
 Diag(PatternDecl->getLocation(), diag::note_forward_template_decl);
 if (getLangOpts().CPlusPlus11)
   Diag(PointOfInstantiation, diag::note_inst_declaration_hint)
-<< Function;
+  << Function;
   }
 }
 
Index: clang/docs/ReleaseNotes.rst
===
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -181,6 +181,8 @@
   emitted as a dynamic initializer. Previously the variable would
   incorrectly be zero-initialized. In contexts where a dynamic
   initializer is not allowed this is now diagnosed as an error.
+- Clang now correctly emit symbols for implicitly instanciated constexpr
+  template function. Fixes `Issue 55560 
`_.
 
 Improvements to Clang's diagnostics
 ^^^


Index: clang/test/SemaCXX/constexpr-late-instantiation.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/constexpr-late-instantiation.cpp
@@ -0,0 +1,15 @@
+// Make sure foo is instantiated and we don't get a link error
+// RUN: not %clang_cc1 %s -fsyntax-only -verify
+
+template 
+constexpr T foo(T a);
+
+int main() {
+  int k = foo(5);   // Ok
+  constexpr int j = foo(5); // expected-error {{constexpr variable 'j' must be initialized by a constant expression}}
+}
+
+template 
+constexpr T foo(T a) {
+  return a;
+}
Index: clang/test/CodeGenCXX/constexpr-late-instantiation.cpp
===
--- /dev/null
+++ clang/test/CodeGenCXX/constexpr-late-instantiation.cpp
@@ -0,0 +1,17 @@
+// Make sure foo is instantiated and we don't get a link error
+// RUN: %clang_cc1 -S -emit-llvm %s -o- | FileCheck %s
+
+template 
+constexpr T foo(T a);
+
+// CHECK-LABEL: define {{.*}} @main
+int main() {
+  // CHECK: call {{.*}} @_Z3fooIiET_S0_
+  int k = foo(5);
+}
+// CHECK: }
+
+template 
+constexpr T foo(T a) {
+  return a;
+}
Index: clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
===
--- clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -4840,7 +4840,8 @@
  /*Complain*/DefinitionRequired)) {
 if (DefinitionRequired)
   Function->setInvalidDecl();
-else if (TSK == TSK_ExplicitInstantiationDefinition) {
+else if (TSK == TSK_ExplicitInstantiationDefinition ||
+ (Function->isConstexpr() && !Recursive)) {
   // Try again at the end of the translation 

[PATCH] D129362: Undeprecate ATOMIC_FLAG_INIT in C++

2022-07-08 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

In D129362#3639193 , @tambre wrote:

> In D129362#3638896 , @aaron.ballman 
> wrote:
>
>> In D129362#3638485 , @tambre wrote:
>>
>>> Makes sense to me, thanks!
>>
>> Thanks! Would you mind handling the libc++ side like last time, or do you 
>> prefer I handle it as part of the changes in this patch?
>
> Yeah, sure, see D129380 .

Thank you! :-)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129362

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


[PATCH] D119051: Extend the C++03 definition of POD to include defaulted functions

2022-07-08 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added a comment.

Ping


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119051

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


[PATCH] D121141: [Clang] Add `-funstable` flag to enable unstable and experimental features: follow-up fixes

2022-07-08 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added inline comments.



Comment at: clang/docs/ClangCommandLineReference.rst:276
+
+Enable unstable and experimental language and library features.
+

The doc is auto-generated by tablegen 
(https://discourse.llvm.org/t/clang-driver-options-td-docs-usersmanual-rst-and-docs-clangcommandlinereference-rst/56540).
For lengthy documentation, use `clang/docs/UsersManual.rst` instead


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121141

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


[PATCH] D129362: Undeprecate ATOMIC_FLAG_INIT in C++

2022-07-08 Thread Raul Tambre via Phabricator via cfe-commits
tambre added a comment.

In D129362#3638896 , @aaron.ballman 
wrote:

> In D129362#3638485 , @tambre wrote:
>
>> Makes sense to me, thanks!
>
> Thanks! Would you mind handling the libc++ side like last time, or do you 
> prefer I handle it as part of the changes in this patch?

Yeah, sure, see D129380 .


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129362

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


[PATCH] D75788: [OpenMP] Provide math functions in OpenMP device code via OpenMP variants

2022-07-08 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert added inline comments.



Comment at: clang/lib/Headers/CMakeLists.txt:145
 
 set(openmp_wrapper_files
   openmp_wrappers/math.h

chapuni wrote:
> It doesn't contain , intentional?
We don't wrap that yet. Do you need it?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75788

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


[clang] 0d7161a - [Clang] Fix test failing due to renamed arg

2022-07-08 Thread Joseph Huber via cfe-commits

Author: Joseph Huber
Date: 2022-07-08T11:50:56-04:00
New Revision: 0d7161af89f91db798f7be2a521568a4cd754214

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

LOG: [Clang] Fix test failing due to renamed arg

Added: 


Modified: 
clang/test/Driver/amdgpu-openmp-toolchain-new.c
clang/tools/clang-linker-wrapper/LinkerWrapperOpts.td

Removed: 




diff  --git a/clang/test/Driver/amdgpu-openmp-toolchain-new.c 
b/clang/test/Driver/amdgpu-openmp-toolchain-new.c
index 2ddc5a12c200..1551917ea50f 100644
--- a/clang/test/Driver/amdgpu-openmp-toolchain-new.c
+++ b/clang/test/Driver/amdgpu-openmp-toolchain-new.c
@@ -50,4 +50,4 @@
 // CHECK-EMIT-LLVM-IR: "-cc1" "-triple" "amdgcn-amd-amdhsa"{{.*}}"-emit-llvm"
 
 // RUN: %clang -### -target x86_64-pc-linux-gnu -fopenmp 
-fopenmp-targets=amdgcn-amd-amdhsa -Xopenmp-target=amdgcn-amd-amdhsa 
-march=gfx803 -lm --rocm-device-lib-path=%S/Inputs/rocm/amdgcn/bitcode 
-fopenmp-new-driver %s 2>&1 | FileCheck %s --check-prefix=CHECK-LIB-DEVICE-NEW
-// CHECK-LIB-DEVICE-NEW: 
{{.*}}clang-linker-wrapper{{.*}}-target-library=openmp-amdgcn-amd-amdhsa-gfx803={{.*}}ocml.bc"{{.*}}ockl.bc"{{.*}}oclc_daz_opt_on.bc"{{.*}}oclc_unsafe_math_off.bc"{{.*}}oclc_finite_only_off.bc"{{.*}}oclc_correctly_rounded_sqrt_on.bc"{{.*}}oclc_wavefrontsize64_on.bc"{{.*}}oclc_isa_version_803.bc"
+// CHECK-LIB-DEVICE-NEW: 
{{.*}}clang-linker-wrapper{{.*}}--bitcode-library=openmp-amdgcn-amd-amdhsa-gfx803={{.*}}ocml.bc"{{.*}}ockl.bc"{{.*}}oclc_daz_opt_on.bc"{{.*}}oclc_unsafe_math_off.bc"{{.*}}oclc_finite_only_off.bc"{{.*}}oclc_correctly_rounded_sqrt_on.bc"{{.*}}oclc_wavefrontsize64_on.bc"{{.*}}oclc_isa_version_803.bc"

diff  --git a/clang/tools/clang-linker-wrapper/LinkerWrapperOpts.td 
b/clang/tools/clang-linker-wrapper/LinkerWrapperOpts.td
index 0b0b2c901361..7620873aa8f6 100644
--- a/clang/tools/clang-linker-wrapper/LinkerWrapperOpts.td
+++ b/clang/tools/clang-linker-wrapper/LinkerWrapperOpts.td
@@ -75,27 +75,33 @@ def sysroot_EQ : Joined<["--"], "sysroot">, HelpText<"Set 
the system root">;
 
 def o : JoinedOrSeparate<["-"], "o">, MetaVarName<"">,
   HelpText<"Path to file to write output">;
-def output_EQ : Joined<["--"], "output=">, Alias, HelpText<"Alias for -o">;
-def output : Separate<["--"], "output">, Alias, HelpText<"Alias for -o">;
+def output_EQ : Joined<["--"], "output=">, Alias, Flags<[HelpHidden]>,
+  HelpText<"Alias for -o">;
+def output : Separate<["--"], "output">, Alias, Flags<[HelpHidden]>,
+  HelpText<"Alias for -o">;
 
 def library_path : JoinedOrSeparate<["-"], "L">, MetaVarName<"">,
   HelpText<"Add  to the library search path">;
-def library_path_S : Separate<["--", "-"], "library-path">, 
Alias;
-def library_path_EQ : Joined<["--", "-"], "library-path=">, 
Alias;
+def library_path_S : Separate<["--", "-"], "library-path">, 
Flags<[HelpHidden]>,
+  Alias;
+def library_path_EQ : Joined<["--", "-"], "library-path=">, 
Flags<[HelpHidden]>,
+  Alias;
 
 def library : JoinedOrSeparate<["-"], "l">, MetaVarName<"">,
   HelpText<"Search for library ">;
-def library_S : Separate<["--", "-"], "library">, Alias;
-def library_EQ : Joined<["--", "-"], "library=">, Alias;
+def library_S : Separate<["--", "-"], "library">, Flags<[HelpHidden]>,
+  Alias;
+def library_EQ : Joined<["--", "-"], "library=">, Flags<[HelpHidden]>,
+  Alias;
 
 def as_needed : Flag<["--", "-"], "as-needed">;
 def no_as_needed : Flag<["--", "-"], "no-as-needed">;
 
 def rpath : Separate<["--", "-"], "rpath">;
-def rpath_EQ : Joined<["--", "-"], "rpath=">, Alias;
+def rpath_EQ : Joined<["--", "-"], "rpath=">, Flags<[HelpHidden]>, 
Alias;
 
 def dynamic_linker : Separate<["--", "-"], "dynamic-linker">;
 def dynamic_linker_EQ : Joined<["--", "-"], "dynamic-linker=">, 
Alias;
 
 def v : Flag<["--", "-"], "v">, HelpText<"Display the version number and 
exit">;
-def version : Flag<["--", "-"], "version">, Alias;
+def version : Flag<["--", "-"], "version">, Flags<[HelpHidden]>, Alias;



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


[PATCH] D128182: [NFC] Switch FloatModeKind enum class to use bitmask enums

2022-07-08 Thread Jolanta Jensen via Phabricator via cfe-commits
jolanta.jensen added a comment.

@tahonermann, I addressed your comments in https://reviews.llvm.org/D129373. I 
just need to remove a tab that crept in and it seems to be more difficult than 
I thought as my code does not seem to have any tab and reformatting the code 
does not change the file.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128182

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


[clang] 74a8fce - [LinkerWrapper] Fix save-temps and argument name

2022-07-08 Thread Joseph Huber via cfe-commits

Author: Joseph Huber
Date: 2022-07-08T11:38:33-04:00
New Revision: 74a8fce6e87e81802b4fe69769daec19504753bf

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

LOG: [LinkerWrapper] Fix save-temps and argument name

Summary:
The previous path reworked some handling of temporary files which
exposed some bugs related to capturing local state by reference in the
callback labmda. Squashing this by copying in everything instead. There
was also a problem where the argument name was changed for
`--bitcode-library=` but clang still used `--target-library=`.

Added: 


Modified: 
clang/lib/Driver/ToolChains/Clang.cpp
clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index c11806ff692a..10d2b9202b7c 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -8393,7 +8393,7 @@ void LinkerWrapper::ConstructJob(Compilation , const 
JobAction ,
 
 for (StringRef LibName : BCLibs)
   CmdArgs.push_back(Args.MakeArgString(
-  "--target-library=" + Action::GetOffloadKindName(Action::OFK_OpenMP) 
+
+  "--bitcode-library=" + 
Action::GetOffloadKindName(Action::OFK_OpenMP) +
   "-" + TC->getTripleString() + "-" + Arch + "=" + LibName));
   }
 

diff  --git a/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp 
b/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
index 75e1a1b8a72c..06e5cf843da0 100644
--- a/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
+++ b/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
@@ -236,7 +236,7 @@ Expected createOutputFile(const Twine , 
StringRef Extension) {
   return createFileError(OutputFile, EC);
   }
 
-  TempFiles.push_back(OutputFile);
+  TempFiles.emplace_back(std::move(OutputFile));
   return TempFiles.back();
 }
 
@@ -771,16 +771,12 @@ std::unique_ptr createLTO(
   Conf.PTO.SLPVectorization = Conf.OptLevel > 1;
 
   if (SaveTemps) {
-Conf.PostInternalizeModuleHook = [&, Arch](size_t, const Module ) {
-  auto TempFileOrErr =
-  createOutputFile(sys::path::filename(ExecutableName) + "-" +
-   Triple.getTriple() + "-" + Arch,
-   "bc");
-  if (!TempFileOrErr)
-reportError(TempFileOrErr.takeError());
-
+std::string TempName = (sys::path::filename(ExecutableName) + "-" +
+Triple.getTriple() + "-" + Arch + ".bc")
+   .str();
+Conf.PostInternalizeModuleHook = [=](size_t, const Module ) {
   std::error_code EC;
-  raw_fd_ostream LinkedBitcode(*TempFileOrErr, EC, sys::fs::OF_None);
+  raw_fd_ostream LinkedBitcode(TempName, EC, sys::fs::OF_None);
   if (EC)
 reportError(errorCodeToError(EC));
   WriteBitcodeToFile(M, LinkedBitcode);



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


[PATCH] D128449: [clang] Introduce -Warray-parameter

2022-07-08 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, thank you for the new diagnostic!




Comment at: clang/lib/Sema/SemaDecl.cpp:3213
+static bool EquivalentArrayTypes(QualType Old, QualType New,
+ ASTContext const ) {
+

East const? MONSTEROUS! ;-) (We tend to use west const mostly in the code base.)


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

https://reviews.llvm.org/D128449

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


[PATCH] D129170: [Sema] Add deprecation warnings for some compiler provided __has_* type traits

2022-07-08 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments.



Comment at: clang/lib/Sema/SemaExprCXX.cpp:5400-5401
+SourceLocation KWLoc) {
+  if (!S.getLangOpts().CPlusPlus11)
+return;
+

royjacobson wrote:
> aaron.ballman wrote:
> > erichkeane wrote:
> > > royjacobson wrote:
> > > > erichkeane wrote:
> > > > > royjacobson wrote:
> > > > > > aaron.ballman wrote:
> > > > > > > I think we should always warn on these, not just in C++11.
> > > > > > I'm not convinced we should. My reasoning is that we need a pretty 
> > > > > > good reason to start issuing warnings for 20 years old code. The 
> > > > > > usage of those builtins with deleted functions after C++11 is 
> > > > > > pretty broken which is a pretty good reason, but for earlier 
> > > > > > language versions they work 'fine' and if people want to use C++03 
> > > > > > I prefer leaving them at peace :)
> > > > > > 
> > > > > > People on C++03 are also probably using pretty old versions of 
> > > > > > libstdc++ and/or boost type_traits, so this could have some impact.
> > > > > > 
> > > > > > WDYT?
> > > > > > 
> > > > > warnings don't get emitted for code in header files, so at least that 
> > > > > part isn't a concern.  
> > > > Any header files, or just system headers?
> > > Sorry, yes, Phab is a mess on a cell phone... in things included as 
> > > System Headers.
> > Agreed with Erich -- warnings in system headers (but not regular headers) 
> > are silenced by default, you need to pass `-Wsystem-headers` to enable them.
> To clarify my position, I think about those builtins as an unofficial part of 
> the C++03 standard and I think we should support them as long as we support 
> C++03.
> 
> Do you think that's reasonable?
> 
> I agree we should update the documentation in this case.
I still don't see the benefit of undeprecating these in C++03. The replacement 
interfaces are available for use in C++03 mode, so there's nothing that 
prevents a user from being pushed to use the supported interfaces instead, 
right? To me, the older interfaces were not clean/correct and the replacement 
interfaces are the ones that we want people to use, and that's language mode 
agnostic.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129170

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


[PATCH] D129373: [NFC] Minor cleanup of usage of FloatModeKind with bitmask enums

2022-07-08 Thread Jolanta Jensen via Phabricator via cfe-commits
jolanta.jensen updated this revision to Diff 443258.
jolanta.jensen added a comment.

Removing a tab.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129373

Files:
  clang/include/clang/Basic/TargetInfo.h
  clang/lib/Basic/Targets/X86.h


Index: clang/lib/Basic/Targets/X86.h
===
--- clang/lib/Basic/Targets/X86.h
+++ clang/lib/Basic/Targets/X86.h
@@ -421,8 +421,8 @@
 
 // Use fpret for all types.
 RealTypeUsesObjCFPRetMask =
-(int)(FloatModeKind::Float | FloatModeKind::Double |
-  FloatModeKind::LongDouble);
+(unsigned)(FloatModeKind::Float | FloatModeKind::Double |
+   FloatModeKind::LongDouble);
 
 // x86-32 has atomics up to 8 bytes
 MaxAtomicPromoteWidth = 64;
@@ -701,7 +701,7 @@
 "64-i64:64-f80:128-n8:16:32:64-S128");
 
 // Use fpret only for long double.
-RealTypeUsesObjCFPRetMask = (int)FloatModeKind::LongDouble;
+RealTypeUsesObjCFPRetMask = (unsigned)FloatModeKind::LongDouble;
 
 // Use fp2ret for _Complex long double.
 ComplexLongDoubleUsesFP2Ret = true;
Index: clang/include/clang/Basic/TargetInfo.h
===
--- clang/include/clang/Basic/TargetInfo.h
+++ clang/include/clang/Basic/TargetInfo.h
@@ -222,9 +222,7 @@
   mutable VersionTuple PlatformMinVersion;
 
   unsigned HasAlignMac68kSupport : 1;
-  unsigned RealTypeUsesObjCFPRetMask
-  : llvm::BitmaskEnumDetail::bitWidth(
-(int)FloatModeKind::LLVM_BITMASK_LARGEST_ENUMERATOR);
+  unsigned RealTypeUsesObjCFPRetMask : llvm::BitWidth;
   unsigned ComplexLongDoubleUsesFP2Ret : 1;
 
   unsigned HasBuiltinMSVaList : 1;
@@ -893,7 +891,7 @@
   /// Check whether the given real type should use the "fpret" flavor of
   /// Objective-C message passing on this target.
   bool useObjCFPRetForRealType(FloatModeKind T) const {
-return RealTypeUsesObjCFPRetMask & llvm::BitmaskEnumDetail::Underlying(T);
+return (int)((FloatModeKind)RealTypeUsesObjCFPRetMask & T);
   }
 
   /// Check whether _Complex long double should use the "fp2ret" flavor


Index: clang/lib/Basic/Targets/X86.h
===
--- clang/lib/Basic/Targets/X86.h
+++ clang/lib/Basic/Targets/X86.h
@@ -421,8 +421,8 @@
 
 // Use fpret for all types.
 RealTypeUsesObjCFPRetMask =
-(int)(FloatModeKind::Float | FloatModeKind::Double |
-  FloatModeKind::LongDouble);
+(unsigned)(FloatModeKind::Float | FloatModeKind::Double |
+   FloatModeKind::LongDouble);
 
 // x86-32 has atomics up to 8 bytes
 MaxAtomicPromoteWidth = 64;
@@ -701,7 +701,7 @@
 "64-i64:64-f80:128-n8:16:32:64-S128");
 
 // Use fpret only for long double.
-RealTypeUsesObjCFPRetMask = (int)FloatModeKind::LongDouble;
+RealTypeUsesObjCFPRetMask = (unsigned)FloatModeKind::LongDouble;
 
 // Use fp2ret for _Complex long double.
 ComplexLongDoubleUsesFP2Ret = true;
Index: clang/include/clang/Basic/TargetInfo.h
===
--- clang/include/clang/Basic/TargetInfo.h
+++ clang/include/clang/Basic/TargetInfo.h
@@ -222,9 +222,7 @@
   mutable VersionTuple PlatformMinVersion;
 
   unsigned HasAlignMac68kSupport : 1;
-  unsigned RealTypeUsesObjCFPRetMask
-  : llvm::BitmaskEnumDetail::bitWidth(
-(int)FloatModeKind::LLVM_BITMASK_LARGEST_ENUMERATOR);
+  unsigned RealTypeUsesObjCFPRetMask : llvm::BitWidth;
   unsigned ComplexLongDoubleUsesFP2Ret : 1;
 
   unsigned HasBuiltinMSVaList : 1;
@@ -893,7 +891,7 @@
   /// Check whether the given real type should use the "fpret" flavor of
   /// Objective-C message passing on this target.
   bool useObjCFPRetForRealType(FloatModeKind T) const {
-return RealTypeUsesObjCFPRetMask & llvm::BitmaskEnumDetail::Underlying(T);
+return (int)((FloatModeKind)RealTypeUsesObjCFPRetMask & T);
   }
 
   /// Check whether _Complex long double should use the "fp2ret" flavor
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] e0de264 - [LinkerWrapper][NFC] Move error handling to a common function

2022-07-08 Thread Joseph Huber via cfe-commits

Author: Joseph Huber
Date: 2022-07-08T11:18:38-04:00
New Revision: e0de264f6355c397e91927827a9cbb940c903607

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

LOG: [LinkerWrapper][NFC] Move error handling to a common function

Summary:
This patch merges all the error handling functions to a single function
call so we don't define the same lambda many times.

Added: 


Modified: 
clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp

Removed: 




diff  --git a/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp 
b/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
index 4e4f85cbcd02..75e1a1b8a72c 100644
--- a/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
+++ b/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
@@ -186,6 +186,13 @@ void printCommands(ArrayRef CmdArgs) {
 llvm::errs() << *IC << (std::next(IC) != IE ? " " : "\n");
 }
 
+[[noreturn]] void reportError(Error E) {
+  outs().flush();
+  logAllUnhandledErrors(std::move(E),
+WithColor::error(errs(), LinkerExecutable));
+  exit(EXIT_FAILURE);
+}
+
 /// Create an extra user-specified \p OffloadFile.
 /// TODO: We should find a way to wrap these as libraries instead.
 Expected getInputBitcodeLibrary(StringRef Input) {
@@ -764,23 +771,18 @@ std::unique_ptr createLTO(
   Conf.PTO.SLPVectorization = Conf.OptLevel > 1;
 
   if (SaveTemps) {
-auto HandleError = [=](Error Err) {
-  logAllUnhandledErrors(std::move(Err),
-WithColor::error(errs(), LinkerExecutable));
-  exit(1);
-};
 Conf.PostInternalizeModuleHook = [&, Arch](size_t, const Module ) {
   auto TempFileOrErr =
   createOutputFile(sys::path::filename(ExecutableName) + "-" +
Triple.getTriple() + "-" + Arch,
"bc");
   if (!TempFileOrErr)
-HandleError(TempFileOrErr.takeError());
+reportError(TempFileOrErr.takeError());
 
   std::error_code EC;
   raw_fd_ostream LinkedBitcode(*TempFileOrErr, EC, sys::fs::OF_None);
   if (EC)
-HandleError(errorCodeToError(EC));
+reportError(errorCodeToError(EC));
   WriteBitcodeToFile(M, LinkedBitcode);
   return true;
 };
@@ -863,12 +865,6 @@ Error linkBitcodeFiles(SmallVectorImpl 
,
   // Remove all the bitcode files that we moved from the original input.
   llvm::erase_if(InputFiles, [](OffloadFile ) { return !F.getBinary(); });
 
-  auto HandleError = [&](Error Err) {
-logAllUnhandledErrors(std::move(Err),
-  WithColor::error(errs(), LinkerExecutable));
-exit(1);
-  };
-
   // LTO Module hook to output bitcode without running the backend.
   SmallVector BitcodeOutput;
   auto OutputBitcode = [&](size_t Task, const Module ) {
@@ -876,12 +872,12 @@ Error linkBitcodeFiles(SmallVectorImpl 
,
   "-jit-" + Triple.getTriple(),
   "bc");
 if (!TempFileOrErr)
-  HandleError(TempFileOrErr.takeError());
+  reportError(TempFileOrErr.takeError());
 
 std::error_code EC;
 raw_fd_ostream LinkedBitcode(*TempFileOrErr, EC, sys::fs::OF_None);
 if (EC)
-  HandleError(errorCodeToError(EC));
+  reportError(errorCodeToError(EC));
 WriteBitcodeToFile(M, LinkedBitcode);
 BitcodeOutput.push_back(*TempFileOrErr);
 return false;
@@ -964,10 +960,10 @@ Error linkBitcodeFiles(SmallVectorImpl 
,
   "-device-" + Triple.getTriple(),
   Extension);
 if (!TempFileOrErr)
-  HandleError(TempFileOrErr.takeError());
+  reportError(TempFileOrErr.takeError());
 TempFile = *TempFileOrErr;
 if (std::error_code EC = sys::fs::openFileForWrite(TempFile, FD))
-  HandleError(errorCodeToError(EC));
+  reportError(errorCodeToError(EC));
 return std::make_unique(
 std::make_unique(FD, true));
   };
@@ -1323,10 +1319,6 @@ int main(int Argc, char **Argv) {
 
   LinkerExecutable = Argv[0];
   sys::PrintStackTraceOnErrorSignal(Argv[0]);
-  auto reportError = [Argv](Error E) {
-logAllUnhandledErrors(std::move(E), WithColor::error(errs(), Argv[0]));
-return EXIT_FAILURE;
-  };
 
   const OptTable  = getOptTable();
   BumpPtrAllocator Alloc;
@@ -1380,13 +1372,13 @@ int main(int Argc, char **Argv) {
 ErrorOr> BufferOrErr =
 MemoryBuffer::getFileOrSTDIN(Filename);
 if (std::error_code EC = BufferOrErr.getError())
-  return reportError(createFileError(Filename, EC));
+  reportError(createFileError(Filename, EC));
 
 bool IsLazy =
 identify_magic((*BufferOrErr)->getBuffer()) == file_magic::archive;
 if (Error Err = 

[clang] d2ead9e - [LinkerWrapper][NFC] Rework command line argument handling in the linker wrapper

2022-07-08 Thread Joseph Huber via cfe-commits

Author: Joseph Huber
Date: 2022-07-08T11:18:38-04:00
New Revision: d2ead9e324d4d268e8c0634849d6081e177c9dd7

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

LOG: [LinkerWrapper][NFC] Rework command line argument handling in the linker 
wrapper

Summary:
This patch reworks the command line argument handling in the linker
wrapper from using the LLVM `cl` interface to using the `Option`
interface with TableGen. This has several benefits compared to the old
method.

We use arguments from the linker arguments in the linker
wrapper, such as the libraries and input files, this allows us to
properly parse these. Additionally we can now easily set up aliases to
the linker wrapper arguments and pass them in the linker input directly.
That is, pass an option like `cuda-path=` as `--offload-arg=cuda-path=`
in the linker's inputs. This will allow us to handle offloading
compilation in the linker itself some day. Finally, this is also a much
cleaner interface for passing arguments to the individual device linking
jobs.

Added: 
clang/tools/clang-linker-wrapper/LinkerWrapperOpts.td

Modified: 
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/Driver/linker-wrapper-image.c
clang/test/Driver/linker-wrapper.c
clang/test/Driver/openmp-offload.c
clang/tools/clang-linker-wrapper/CMakeLists.txt
clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index bc437d66a03ce..c11806ff692a5 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -8393,7 +8393,7 @@ void LinkerWrapper::ConstructJob(Compilation , const 
JobAction ,
 
 for (StringRef LibName : BCLibs)
   CmdArgs.push_back(Args.MakeArgString(
-  "-target-library=" + Action::GetOffloadKindName(Action::OFK_OpenMP) +
+  "--target-library=" + Action::GetOffloadKindName(Action::OFK_OpenMP) 
+
   "-" + TC->getTripleString() + "-" + Arch + "=" + LibName));
   }
 
@@ -8413,41 +8413,35 @@ void LinkerWrapper::ConstructJob(Compilation , const 
JobAction ,
   } else if (A->getOption().matches(options::OPT_O0))
 OOpt = "0";
   if (!OOpt.empty())
-CmdArgs.push_back(Args.MakeArgString(Twine("-opt-level=O") + OOpt));
+CmdArgs.push_back(Args.MakeArgString(Twine("--opt-level=O") + OOpt));
 }
   }
 
-  CmdArgs.push_back("-host-triple");
-  CmdArgs.push_back(Args.MakeArgString(TheTriple.getTriple()));
+  CmdArgs.push_back(
+  Args.MakeArgString("--host-triple=" + TheTriple.getTriple()));
   if (Args.hasArg(options::OPT_v))
-CmdArgs.push_back("-v");
+CmdArgs.push_back("--verbose");
 
-  // Add debug information if present.
   if (const Arg *A = Args.getLastArg(options::OPT_g_Group)) {
-const Option  = A->getOption();
-if (Opt.matches(options::OPT_gN_Group)) {
-  if (Opt.matches(options::OPT_gline_directives_only) ||
-  Opt.matches(options::OPT_gline_tables_only))
-CmdArgs.push_back("-gline-directives-only");
-} else
-  CmdArgs.push_back("-g");
+if (!A->getOption().matches(options::OPT_g0))
+  CmdArgs.push_back("--device-debug");
   }
 
   for (const auto  : Args.getAllArgValues(options::OPT_Xcuda_ptxas))
-CmdArgs.push_back(Args.MakeArgString("-ptxas-args=" + A));
+CmdArgs.push_back(Args.MakeArgString("--ptxas-args=" + A));
 
   // Forward remarks passes to the LLVM backend in the wrapper.
   if (const Arg *A = Args.getLastArg(options::OPT_Rpass_EQ))
 CmdArgs.push_back(
-Args.MakeArgString(Twine("-pass-remarks=") + A->getValue()));
+Args.MakeArgString(Twine("--pass-remarks=") + A->getValue()));
   if (const Arg *A = Args.getLastArg(options::OPT_Rpass_missed_EQ))
 CmdArgs.push_back(
-Args.MakeArgString(Twine("-pass-remarks-missed=") + A->getValue()));
+Args.MakeArgString(Twine("--pass-remarks-missed=") + A->getValue()));
   if (const Arg *A = Args.getLastArg(options::OPT_Rpass_analysis_EQ))
 CmdArgs.push_back(
-Args.MakeArgString(Twine("-pass-remarks-analysis=") + A->getValue()));
+Args.MakeArgString(Twine("--pass-remarks-analysis=") + A->getValue()));
   if (Args.getLastArg(options::OPT_save_temps_EQ))
-CmdArgs.push_back("-save-temps");
+CmdArgs.push_back("--save-temps");
 
   // Construct the link job so we can wrap around it.
   Linker->ConstructJob(C, JA, Output, Inputs, Args, LinkingOutput);
@@ -8458,18 +8452,18 @@ void LinkerWrapper::ConstructJob(Compilation , const 
JobAction ,
 StringRef Val = Arg->getValue(0);
 if (Val.empty())
   CmdArgs.push_back(
-  Args.MakeArgString(Twine("-device-linker=") + Arg->getValue(1)));
+  Args.MakeArgString(Twine("--device-linker=") + 

[PATCH] D128927: [libc++] Always build c++experimental.a

2022-07-08 Thread Louis Dionne via Phabricator via cfe-commits
ldionne updated this revision to Diff 443252.
ldionne marked an inline comment as done.
ldionne added a comment.

Windows fixes.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128927

Files:
  clang/cmake/caches/Fuchsia-stage2.cmake
  clang/cmake/caches/Fuchsia.cmake
  compiler-rt/cmake/Modules/AddCompilerRT.cmake
  libcxx/CMakeLists.txt
  libcxx/appveyor.yml
  libcxx/cmake/caches/AIX.cmake
  libcxx/cmake/caches/Apple.cmake
  libcxx/cmake/caches/Generic-no-experimental.cmake
  libcxx/cmake/caches/MinGW.cmake
  libcxx/docs/BuildingLibcxx.rst
  libcxx/docs/ReleaseNotes.rst
  libcxx/docs/UsingLibcxx.rst
  libcxx/src/CMakeLists.txt
  libcxx/test/CMakeLists.txt
  
libcxx/test/libcxx/experimental/memory/memory.resource.global/global_memory_resource_lifetime.pass.cpp
  
libcxx/test/libcxx/experimental/memory/memory.resource.global/new_delete_resource_lifetime.pass.cpp
  
libcxx/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.ctor/default.pass.cpp
  
libcxx/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.eq/equal.pass.cpp
  
libcxx/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.eq/not_equal.pass.cpp
  
libcxx/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/allocate.pass.cpp
  
libcxx/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair.pass.cpp
  
libcxx/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_const_lvalue_pair.pass.cpp
  
libcxx/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_rvalue.pass.cpp
  
libcxx/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_values.pass.cpp
  
libcxx/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_piecewise_pair.pass.cpp
  
libcxx/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_piecewise_pair_evil.pass.cpp
  
libcxx/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_types.pass.cpp
  
libcxx/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/deallocate.pass.cpp
  
libcxx/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/destroy.pass.cpp
  
libcxx/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/resource.pass.cpp
  
libcxx/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/select_on_container_copy_construction.pass.cpp
  
libcxx/test/std/experimental/memory/memory.resource.aliases/header_deque_synop.pass.cpp
  
libcxx/test/std/experimental/memory/memory.resource.aliases/header_forward_list_synop.pass.cpp
  
libcxx/test/std/experimental/memory/memory.resource.aliases/header_list_synop.pass.cpp
  
libcxx/test/std/experimental/memory/memory.resource.aliases/header_map_synop.pass.cpp
  
libcxx/test/std/experimental/memory/memory.resource.aliases/header_regex_synop.pass.cpp
  
libcxx/test/std/experimental/memory/memory.resource.aliases/header_set_synop.pass.cpp
  
libcxx/test/std/experimental/memory/memory.resource.aliases/header_string_synop.pass.cpp
  
libcxx/test/std/experimental/memory/memory.resource.aliases/header_unordered_map_synop.pass.cpp
  
libcxx/test/std/experimental/memory/memory.resource.aliases/header_unordered_set_synop.pass.cpp
  
libcxx/test/std/experimental/memory/memory.resource.aliases/header_vector_synop.pass.cpp
  
libcxx/test/std/experimental/memory/memory.resource.global/default_resource.pass.cpp
  
libcxx/test/std/experimental/memory/memory.resource.global/new_delete_resource.pass.cpp
  
libcxx/test/std/experimental/memory/memory.resource.global/null_memory_resource.pass.cpp
  libcxx/utils/ci/run-buildbot
  libcxx/utils/libcxx/test/params.py

Index: libcxx/utils/libcxx/test/params.py
===
--- libcxx/utils/libcxx/test/params.py
+++ libcxx/utils/libcxx/test/params.py
@@ -156,15 +156,19 @@
 ])),
 
   Parameter(name='enable_experimental', choices=[True, False], type=bool, default=True,
-help="Whether to enable tests for experimental C++ libraries (typically Library Fundamentals TSes).",
+help="Whether to enable tests for experimental C++ Library features.",
 actions=lambda experimental: [] if not experimental else [
-  AddFeature('c++experimental'),
   # When linking in MSVC mode via the Clang driver, a -l
   # maps to .lib, so we need to use 

[PATCH] D128927: [libc++] Always build c++experimental.a

2022-07-08 Thread Louis Dionne via Phabricator via cfe-commits
ldionne marked an inline comment as done.
ldionne added a comment.

Thanks @mstorsjo! Regarding `_LIBCPP_EXPERIMENTAL_FUNC_VIS`, yes I think it 
would make sense to use a different visibility macro for symbols that we know 
are provided only as part of a static library. I would not call it 
`_LIBCPP_EXPERIMENTAL_FUNC_VIS` though, I would call it something like 
`_LIBCPP_STATIC_LIBRARY_FUNC_VIS` or something like that.




Comment at: libcxx/utils/libcxx/test/params.py:68
+  if hasCompileFlag(cfg, '-funstable') and False: # TODO: Enable this once the 
design of `-funstable` is finished
+return '-funstable'
+  else:

mstorsjo wrote:
> Actually, I'm not entirely convinced that this is a good way to handle 
> linking against the library for tests.
> 
> When building tests, we don't rely on the compiler to implicitly link in our 
> C++ library, but we link with `-nostdlib++` (or `-nodefaultlibs`) and 
> explicitly tell the compiler how to link in specifically the C++ library 
> we've just built (in the test config files).
> 
> So in general, if linking with `-nostdlib++ -fexperimental-library` I kinda 
> wouldn't expect the compiler driver to link against the library at all? It's 
> kinda the same as if you'd do `-stdlib=libstdc++ -fexperimental-library` - we 
> can't have that add `-lc++experimental`, as that only makes sense as long as 
> we have `-stdlib=libc++`. So subsequently I don't think the compiler driver 
> should be adding `-lc++experimental` as long as we're passing `-nostdlib++` 
> either?
> 
> But if libc++experimental is built unconditionally, wouldn't it be simplest 
> to just always link against it in the test config files (just like how we 
> force it to link against specifically the just-built libc++.a) - that would 
> make it much more symmetrcial to how we handle the main `-lc++`?
Interesting point. It does mean that we can never rely on `-funstable` adding 
`-lc++experimental` from our test suite -- I think that's OK.

However, I'd like to avoid linking against `-lc++experimental` in the base test 
configuration, simply because the base test configuration should mirror the 
minimal way of invoking Clang to use libc++.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128927

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


[PATCH] D129277: [clang] [Serialization] Fix swapped PPOpts/ExistingPPOpts parameters. NFC.

2022-07-08 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.

In D129277#3637317 , @mstorsjo wrote:

> In D129277#3636795 , @aaron.ballman 
> wrote:
>
>> In D129277#3636596 , @mstorsjo 
>> wrote:
>>
>>> In D129277#3636567 , 
>>> @aaron.ballman wrote:
>>>
 Thanks for catching this! Is it really an NFC change though (it seems like 
 it would change some of the diagnostic behavior and the list of suggested 
 predefines)? Can you add test coverage for the change?
>>>
>>> TBH I haven’t tried to follow exactly where this case would matter in the 
>>> current state of affairs - the function is called in three places, and 
>>> maybe the individual roles of the parameters currently only make a 
>>> difference in the other callers. As it didn’t break any tests I presumed 
>>> it’s NFC.
>>
>> Heh, I presumed we just lacked test coverage. :-) But I also don't know 
>> enough about this interface to know exactly how to test it. I would imagine 
>> that this would be caught through using a PCH that was compiled with 
>> different preprocessor options than the code consuming the header. I'm not 
>> certain if `-D` or `-U` is sufficient to demonstrate the issue or not, but 
>> maybe `-fallow-editor-placeholders` and `-fno-allow-editor-placeholders` 
>> would work?
>
> The thing is that this particular caller passes `nullptr` for `Diags`, so no 
> diagnostics are emitted, and the generated `SuggestedPredefines` string is 
> ignored by the one caller (`ASTReader::isAcceptableASTFile`). So within that 
> function, the only thing that is returned is a boolean for whether the two 
> (AST file and command line parameters) are compatible, and in that respect, 
> the two parameters are commutative - so I think it's not possible to observe 
> whether these two parameters are passed correctly or not, right now. Hence 
> NFC.

Ah, I see it now, this really is an NFC change, thank you for the explanation. 
LGTM!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129277

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


[PATCH] D129231: [Builtins] Do not claim all libfuncs are readnone with trapping math.

2022-07-08 Thread John Brawn via Phabricator via cfe-commits
john.brawn added a comment.

Looking at the descriptions of maths functions in C99 (and I expect C11 will be 
the same) it looks like there are three kinds:

- Those that can report error by errno and floating-point exeption, and may 
also raise the inexact exception
- Those that don't set errno, but may raise the inexact exception
- Those that neither set errno or raise an exception

Looking at this patch and the attributes of the various function intrinsics it 
looks like you have:

- Marked "e": Can set errno, can't raise exception
- Marked "eg": Can set errno and raise exception
- Marked "cg": Can't set errno, can raise an exception
- Marked "c": Can't set errno or raise an exception

Given that the functions that set errno also raise exceptions I think it would 
make sense to have the "e" attribute cover both errno and exceptions, and have 
"g" just for those that can only raise exceptions. Also "cg" looks like it's 
probably wrong and should be "g" (given that "c" means "always const" and "g" 
means "const only when we don't have exceptions", and that's also how "e" is 
used in that we don't have functions with "cg").


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129231

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


  1   2   >