Skip to content

Commit 8341e38

Browse files
authored
Merge branch 'main' into emptyenv
2 parents a01e29f + 973f26a commit 8341e38

File tree

95 files changed

+3520
-1827
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+3520
-1827
lines changed

.github/CODEOWNERS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,9 @@
132132
/mlir/**/Transforms/Mem2Reg.* @moxinilian
133133
/mlir/**/Transforms/SROA.* @moxinilian
134134

135+
# MLIR IRDL-related
136+
/mlir/**/*IRDL* @moxinilian
137+
135138
# BOLT
136139
/bolt/ @aaupov @maksfb @rafaelauler @ayermolo @yota9 @paschalis-mpeis @yozhu
137140

clang-tools-extra/clangd/InlayHints.cpp

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -633,13 +633,30 @@ class InlayHintVisitor : public RecursiveASTVisitor<InlayHintVisitor> {
633633
}
634634

635635
if (auto *AT = D->getType()->getContainedAutoType()) {
636-
if (AT->isDeduced() && !D->getType()->isDependentType()) {
637-
// Our current approach is to place the hint on the variable
638-
// and accordingly print the full type
639-
// (e.g. for `const auto& x = 42`, print `const int&`).
640-
// Alternatively, we could place the hint on the `auto`
641-
// (and then just print the type deduced for the `auto`).
642-
addTypeHint(D->getLocation(), D->getType(), /*Prefix=*/": ");
636+
if (AT->isDeduced()) {
637+
QualType T;
638+
// If the type is dependent, HeuristicResolver *may* be able to
639+
// resolve it to something that's useful to print. In other
640+
// cases, it can't, and the resultng type would just be printed
641+
// as "<dependent type>", in which case don't hint it at all.
642+
if (D->getType()->isDependentType()) {
643+
if (D->hasInit()) {
644+
QualType Resolved = Resolver->resolveExprToType(D->getInit());
645+
if (Resolved != AST.DependentTy) {
646+
T = Resolved;
647+
}
648+
}
649+
} else {
650+
T = D->getType();
651+
}
652+
if (!T.isNull()) {
653+
// Our current approach is to place the hint on the variable
654+
// and accordingly print the full type
655+
// (e.g. for `const auto& x = 42`, print `const int&`).
656+
// Alternatively, we could place the hint on the `auto`
657+
// (and then just print the type deduced for the `auto`).
658+
addTypeHint(D->getLocation(), T, /*Prefix=*/": ");
659+
}
643660
}
644661
}
645662

clang-tools-extra/clangd/unittests/InlayHintTests.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1441,7 +1441,8 @@ TEST(TypeHints, DependentType) {
14411441
void bar(T arg) {
14421442
auto [a, b] = arg;
14431443
}
1444-
)cpp");
1444+
)cpp",
1445+
ExpectedHint{": T", "var2"});
14451446
}
14461447

14471448
TEST(TypeHints, LongTypeName) {

clang/docs/OpenMPSupport.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,8 @@ implementation.
585585
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
586586
| defaultmap implicit-behavior 'storage' | :good:`done` | :none:`unclaimed` | https://github.com/llvm/llvm-project/pull/158336 |
587587
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
588+
| defaultmap implicit-behavior 'private' | :good:`done` | :none:`unclaimed` | https://github.com/llvm/llvm-project/pull/158712 |
589+
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
588590

589591
.. _OpenMP 6.1 implementation details:
590592

clang/docs/ReleaseNotes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,7 @@ OpenMP Support
537537
- Properly handle array section/assumed-size array privatization in C/C++.
538538
- Added support for ``variable-category`` modifier in ``default clause``.
539539
- Added support for ``defaultmap`` directive implicit-behavior ``storage``.
540+
- Added support for ``defaultmap`` directive implicit-behavior ``private``.
540541

541542
Improvements
542543
^^^^^^^^^^^^

clang/include/clang/AST/Type.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
#include "clang/AST/Decl.h"
2121
#include "clang/AST/DeclCXX.h"
22-
#include "clang/AST/TypeBase.h"
22+
#include "clang/AST/TypeBase.h" // IWYU pragma: export
2323

2424
namespace clang {
2525

clang/include/clang/Basic/OpenMPKinds.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ OPENMP_DEFAULTMAP_MODIFIER(none)
138138
OPENMP_DEFAULTMAP_MODIFIER(default)
139139
OPENMP_DEFAULTMAP_MODIFIER(present)
140140
OPENMP_DEFAULTMAP_MODIFIER(storage)
141+
OPENMP_DEFAULTMAP_MODIFIER(private)
141142

142143
// Static attributes for 'depend' clause.
143144
OPENMP_DEPEND_KIND(in)

clang/lib/Basic/OpenMPKinds.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ unsigned clang::getOpenMPSimpleClauseType(OpenMPClauseKind Kind, StringRef Str,
118118
.Case(#Name, static_cast<unsigned>(OMPC_DEFAULTMAP_MODIFIER_##Name))
119119
#include "clang/Basic/OpenMPKinds.def"
120120
.Default(OMPC_DEFAULTMAP_unknown);
121-
if (LangOpts.OpenMP < 60 && Type == OMPC_DEFAULTMAP_MODIFIER_storage)
121+
if (LangOpts.OpenMP < 60 && (Type == OMPC_DEFAULTMAP_MODIFIER_storage ||
122+
Type == OMPC_DEFAULTMAP_MODIFIER_private))
122123
return OMPC_DEFAULTMAP_MODIFIER_unknown;
123124
return Type;
124125
}

clang/lib/Sema/HLSLBuiltinTypeDeclBuilder.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "clang/AST/Decl.h"
1818
#include "clang/AST/DeclCXX.h"
1919
#include "clang/AST/Expr.h"
20+
#include "clang/AST/Stmt.h"
2021
#include "clang/AST/Type.h"
2122
#include "clang/Basic/SourceLocation.h"
2223
#include "clang/Basic/Specifiers.h"
@@ -48,6 +49,14 @@ static FunctionDecl *lookupBuiltinFunction(Sema &S, StringRef Name) {
4849
"Since this is a builtin it should always resolve!");
4950
return cast<FunctionDecl>(R.getFoundDecl());
5051
}
52+
53+
CXXConstructorDecl *lookupCopyConstructor(QualType ResTy) {
54+
assert(ResTy->isRecordType() && "not a CXXRecord type");
55+
for (auto *CD : ResTy->getAsCXXRecordDecl()->ctors())
56+
if (CD->isCopyConstructor())
57+
return CD;
58+
return nullptr;
59+
}
5160
} // namespace
5261

5362
// Builder for template arguments of builtin types. Used internally
@@ -580,6 +589,23 @@ BuiltinTypeMethodBuilder &BuiltinTypeMethodBuilder::returnValue(T ReturnValue) {
580589

581590
Expr *ReturnValueExpr = convertPlaceholder(ReturnValue);
582591
ASTContext &AST = DeclBuilder.SemaRef.getASTContext();
592+
593+
QualType Ty = ReturnValueExpr->getType();
594+
if (Ty->isRecordType()) {
595+
// For record types, create a call to copy constructor to ensure proper copy
596+
// semantics.
597+
auto *ICE =
598+
ImplicitCastExpr::Create(AST, Ty.withConst(), CK_NoOp, ReturnValueExpr,
599+
nullptr, VK_XValue, FPOptionsOverride());
600+
CXXConstructorDecl *CD = lookupCopyConstructor(Ty);
601+
assert(CD && "no copy constructor found");
602+
ReturnValueExpr = CXXConstructExpr::Create(
603+
AST, Ty, SourceLocation(), CD, /*Elidable=*/false, {ICE},
604+
/*HadMultipleCandidates=*/false, /*ListInitialization=*/false,
605+
/*StdInitListInitialization=*/false,
606+
/*ZeroInitListInitialization=*/false, CXXConstructionKind::Complete,
607+
SourceRange());
608+
}
583609
StmtsList.push_back(
584610
ReturnStmt::Create(AST, SourceLocation(), ReturnValueExpr, nullptr));
585611
return *this;

clang/lib/Sema/SemaAMDGPU.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ bool SemaAMDGPU::CheckAMDGCNBuiltinFunctionCall(unsigned BuiltinID,
100100
case AMDGPU::BI__builtin_amdgcn_cvt_scale_pk16_bf16_bf6:
101101
case AMDGPU::BI__builtin_amdgcn_cvt_scale_pk16_f32_fp6:
102102
case AMDGPU::BI__builtin_amdgcn_cvt_scale_pk16_f32_bf6:
103-
return SemaRef.BuiltinConstantArgRange(TheCall, 2, 0, 7);
103+
return SemaRef.BuiltinConstantArgRange(TheCall, 2, 0, 15);
104104
case AMDGPU::BI__builtin_amdgcn_cooperative_atomic_load_32x4B:
105105
case AMDGPU::BI__builtin_amdgcn_cooperative_atomic_load_16x8B:
106106
case AMDGPU::BI__builtin_amdgcn_cooperative_atomic_load_8x16B:

0 commit comments

Comments
 (0)