Skip to content

Commit 85ce546

Browse files
authored
merge main into amd-staging (llvm#2521)
2 parents c888dcd + 20ac31b commit 85ce546

File tree

114 files changed

+3266
-821
lines changed

Some content is hidden

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

114 files changed

+3266
-821
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -849,6 +849,7 @@ Bug Fixes to C++ Support
849849
- Fixed an access checking bug when initializing non-aggregates in default arguments (#GH62444), (#GH83608)
850850
- Fixed a pack substitution bug in deducing class template partial specializations. (#GH53609)
851851
- Fixed a crash when constant evaluating some explicit object member assignment operators. (#GH142835)
852+
- Fixed an access checking bug when substituting into concepts (#GH115838)
852853

853854
Bug Fixes to AST Handling
854855
^^^^^^^^^^^^^^^^^^^^^^^^^

clang/include/clang/Basic/BuiltinsAMDGPU.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ TARGET_BUILTIN(__builtin_amdgcn_flat_atomic_fadd_v2bf16, "V2sV2s*0V2s", "t", "at
257257
TARGET_BUILTIN(__builtin_amdgcn_global_atomic_fadd_v2bf16, "V2sV2s*1V2s", "t", "atomic-global-pk-add-bf16-inst")
258258
TARGET_BUILTIN(__builtin_amdgcn_ds_atomic_fadd_v2bf16, "V2sV2s*3V2s", "t", "atomic-ds-pk-add-16-insts")
259259
TARGET_BUILTIN(__builtin_amdgcn_ds_atomic_fadd_v2f16, "V2hV2h*3V2h", "t", "atomic-ds-pk-add-16-insts")
260-
TARGET_BUILTIN(__builtin_amdgcn_load_to_lds, "vv*v*3IUiIiIUi", "t", "vmem-to-lds-load-insts")
260+
TARGET_BUILTIN(__builtin_amdgcn_load_to_lds, "vv*v*3IUiIiIUi", "", "vmem-to-lds-load-insts")
261261
TARGET_BUILTIN(__builtin_amdgcn_global_load_lds, "vv*1v*3IUiIiIUi", "t", "vmem-to-lds-load-insts")
262262

263263
//===----------------------------------------------------------------------===//

clang/include/clang/Basic/BuiltinsNVPTX.td

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ let Attributes = [NoReturn] in {
177177
}
178178
let Attributes = [NoThrow] in {
179179
def __nvvm_nanosleep : NVPTXBuiltinSMAndPTX<"void(unsigned int)", SM_70, PTX63>;
180+
def __nvvm_pm_event_mask : NVPTXBuiltin<"void(_Constant unsigned short)">;
180181
}
181182

182183
// Min Max

clang/include/clang/Sema/Template.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -587,16 +587,17 @@ enum class TemplateSubstitutionKind : char {
587587
/// specializations that will need to be instantiated after the
588588
/// enclosing class's instantiation is complete.
589589
SmallVector<std::pair<ClassTemplateDecl *,
590-
ClassTemplatePartialSpecializationDecl *>, 4>
591-
OutOfLinePartialSpecs;
590+
ClassTemplatePartialSpecializationDecl *>,
591+
1>
592+
OutOfLinePartialSpecs;
592593

593594
/// A list of out-of-line variable template partial
594595
/// specializations that will need to be instantiated after the
595596
/// enclosing variable's instantiation is complete.
596597
/// FIXME: Verify that this is needed.
597598
SmallVector<
598-
std::pair<VarTemplateDecl *, VarTemplatePartialSpecializationDecl *>, 4>
599-
OutOfLineVarPartialSpecs;
599+
std::pair<VarTemplateDecl *, VarTemplatePartialSpecializationDecl *>, 1>
600+
OutOfLineVarPartialSpecs;
600601

601602
public:
602603
TemplateDeclInstantiator(Sema &SemaRef, DeclContext *Owner,

clang/include/clang/StaticAnalyzer/Core/Checker.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -608,20 +608,6 @@ class EventDispatcher {
608608
}
609609
};
610610

611-
/// Tag that can use a checker name as a message provider
612-
/// (see SimpleProgramPointTag).
613-
/// FIXME: This is a cargo cult class which is copied into several checkers but
614-
/// does not provide anything useful.
615-
/// The only added functionality provided by this class (compared to
616-
/// SimpleProgramPointTag) is that it composes the tag description string from
617-
/// two arguments -- but tag descriptions only appear in debug output so there
618-
/// is no reason to bother with this.
619-
class CheckerProgramPointTag : public SimpleProgramPointTag {
620-
public:
621-
CheckerProgramPointTag(StringRef CheckerName, StringRef Msg);
622-
CheckerProgramPointTag(const CheckerBase *Checker, StringRef Msg);
623-
};
624-
625611
/// We dereferenced a location that may be null.
626612
struct ImplicitNullDerefEvent {
627613
SVal Location;

clang/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,9 @@ class CheckerContext {
171171
/// tag is specified, a default tag, unique to the given checker,
172172
/// will be used. Tags are used to prevent states generated at
173173
/// different sites from caching out.
174+
/// NOTE: If the State is unchanged and the Tag is nullptr, this may return a
175+
/// node which is not tagged (instead of using the default tag corresponding
176+
/// to the active checker). This is arguably a bug and should be fixed.
174177
ExplodedNode *addTransition(ProgramStateRef State = nullptr,
175178
const ProgramPointTag *Tag = nullptr) {
176179
return addTransitionImpl(State ? State : getState(), false, nullptr, Tag);
@@ -183,6 +186,9 @@ class CheckerContext {
183186
/// @param Pred The transition will be generated from the specified Pred node
184187
/// to the newly generated node.
185188
/// @param Tag The tag to uniquely identify the creation site.
189+
/// NOTE: If the State is unchanged and the Tag is nullptr, this may return a
190+
/// node which is not tagged (instead of using the default tag corresponding
191+
/// to the active checker). This is arguably a bug and should be fixed.
186192
ExplodedNode *addTransition(ProgramStateRef State, ExplodedNode *Pred,
187193
const ProgramPointTag *Tag = nullptr) {
188194
return addTransitionImpl(State, false, Pred, Tag);

clang/lib/CIR/CodeGen/CIRGenOpenACCClause.cpp

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
#include "CIRGenFunction.h"
1616

17+
#include "clang/AST/ExprCXX.h"
18+
1719
#include "mlir/Dialect/Arith/IR/Arith.h"
1820
#include "mlir/Dialect/OpenACC/OpenACC.h"
1921
#include "llvm/ADT/TypeSwitch.h"
@@ -188,7 +190,7 @@ class OpenACCClauseCIREmitter final
188190
struct DataOperandInfo {
189191
mlir::Location beginLoc;
190192
mlir::Value varValue;
191-
llvm::StringRef name;
193+
std::string name;
192194
llvm::SmallVector<mlir::Value> bounds;
193195
};
194196

@@ -226,6 +228,10 @@ class OpenACCClauseCIREmitter final
226228
mlir::Location exprLoc = cgf.cgm.getLoc(curVarExpr->getBeginLoc());
227229
llvm::SmallVector<mlir::Value> bounds;
228230

231+
std::string exprString;
232+
llvm::raw_string_ostream os(exprString);
233+
e->printPretty(os, nullptr, cgf.getContext().getPrintingPolicy());
234+
229235
// Assemble the list of bounds.
230236
while (isa<ArraySectionExpr, ArraySubscriptExpr>(curVarExpr)) {
231237
mlir::Location boundLoc = cgf.cgm.getLoc(curVarExpr->getBeginLoc());
@@ -267,20 +273,16 @@ class OpenACCClauseCIREmitter final
267273
bounds.push_back(createBound(boundLoc, lowerBound, upperBound, extent));
268274
}
269275

270-
// TODO: OpenACC: if this is a member expr, emit the VarPtrPtr correctly.
271-
if (isa<MemberExpr>(curVarExpr)) {
272-
cgf.cgm.errorNYI(curVarExpr->getSourceRange(),
273-
"OpenACC Data clause member expr");
274-
return {exprLoc, {}, {}, std::move(bounds)};
275-
}
276+
if (const auto *memExpr = dyn_cast<MemberExpr>(curVarExpr))
277+
return {exprLoc, cgf.emitMemberExpr(memExpr).getPointer(), exprString,
278+
std::move(bounds)};
276279

277280
// Sema has made sure that only 4 types of things can get here, array
278281
// subscript, array section, member expr, or DRE to a var decl (or the
279282
// former 3 wrapping a var-decl), so we should be able to assume this is
280283
// right.
281284
const auto *dre = cast<DeclRefExpr>(curVarExpr);
282-
const auto *vd = cast<VarDecl>(dre->getFoundDecl()->getCanonicalDecl());
283-
return {exprLoc, cgf.emitDeclRefLValue(dre).getPointer(), vd->getName(),
285+
return {exprLoc, cgf.emitDeclRefLValue(dre).getPointer(), exprString,
284286
std::move(bounds)};
285287
}
286288

clang/lib/Sema/SemaExpr.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6395,7 +6395,8 @@ static FunctionDecl *rewriteBuiltinFunctionDecl(Sema *Sema, ASTContext &Context,
63956395
return nullptr;
63966396
Expr *Arg = ArgRes.get();
63976397
QualType ArgType = Arg->getType();
6398-
if (!ParamType->isPointerType() || ParamType.hasAddressSpace() ||
6398+
if (!ParamType->isPointerType() ||
6399+
ParamType->getPointeeType().hasAddressSpace() ||
63996400
!ArgType->isPointerType() ||
64006401
!ArgType->getPointeeType().hasAddressSpace() ||
64016402
isPtrSizeAddressSpace(ArgType->getPointeeType().getAddressSpace())) {
@@ -6404,9 +6405,6 @@ static FunctionDecl *rewriteBuiltinFunctionDecl(Sema *Sema, ASTContext &Context,
64046405
}
64056406

64066407
QualType PointeeType = ParamType->getPointeeType();
6407-
if (PointeeType.hasAddressSpace())
6408-
continue;
6409-
64106408
NeedsNewDecl = true;
64116409
LangAS AS = ArgType->getPointeeType().getAddressSpace();
64126410

clang/lib/Sema/SemaTemplate.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4749,6 +4749,8 @@ Sema::CheckConceptTemplateId(const CXXScopeSpec &SS,
47494749
EnterExpressionEvaluationContext EECtx{
47504750
*this, ExpressionEvaluationContext::Unevaluated, CSD};
47514751

4752+
ContextRAII CurContext(*this, CSD->getDeclContext(),
4753+
/*NewThisContext=*/false);
47524754
if (!AreArgsDependent &&
47534755
CheckConstraintSatisfaction(
47544756
NamedConcept, AssociatedConstraint(NamedConcept->getConstraintExpr()),

clang/lib/Sema/SemaTemplateInstantiateDecl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2394,7 +2394,7 @@ Decl *TemplateDeclInstantiator::VisitVarTemplateDecl(VarTemplateDecl *D) {
23942394
// Queue up any out-of-line partial specializations of this member
23952395
// variable template; the client will force their instantiation once
23962396
// the enclosing class has been instantiated.
2397-
SmallVector<VarTemplatePartialSpecializationDecl *, 4> PartialSpecs;
2397+
SmallVector<VarTemplatePartialSpecializationDecl *, 1> PartialSpecs;
23982398
D->getPartialSpecializations(PartialSpecs);
23992399
for (unsigned I = 0, N = PartialSpecs.size(); I != N; ++I)
24002400
if (PartialSpecs[I]->getFirstDecl()->isOutOfLine())

0 commit comments

Comments
 (0)