Skip to content

Commit b3ceb8d

Browse files
SC llvm teamSC llvm team
authored andcommitted
Merged main:cd5ee2715e89ad31982f91cc85fc3939977f2f4e into amd-gfx:d3020e417d38
Local branch amd-gfx d3020e4 Merged main:772b1b0cb26c66804d0a7e416dc7a5742b7f8db2 into amd-gfx:43125be5ad0d Remote branch main cd5ee27 [reland][flang] Initial debug info support for local variables (llvm#92304)
2 parents d3020e4 + cd5ee27 commit b3ceb8d

File tree

146 files changed

+3456
-2130
lines changed

Some content is hidden

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

146 files changed

+3456
-2130
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ C++ Specific Potentially Breaking Changes
5656

5757
- Clang now rejects pointer to member from parenthesized expression in unevaluated context such as ``decltype(&(foo::bar))``. (#GH40906).
5858

59+
- Clang now performs semantic analysis for unary operators with dependent operands
60+
that are known to be of non-class non-enumeration type prior to instantiation.
61+
5962
ABI Changes in This Version
6063
---------------------------
6164
- Fixed Microsoft name mangling of implicitly defined variables used for thread
@@ -567,6 +570,9 @@ Bug Fixes in This Version
567570
- Clang will no longer emit a duplicate -Wunused-value warning for an expression
568571
`(A, B)` which evaluates to glvalue `B` that can be converted to non ODR-use. (#GH45783)
569572

573+
- Clang now correctly disallows VLA type compound literals, e.g. ``(int[size]){}``,
574+
as the C standard mandates. (#GH89835)
575+
570576
Bug Fixes to Compiler Builtins
571577
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
572578

clang/include/clang/AST/Type.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8044,7 +8044,10 @@ inline bool Type::isUndeducedType() const {
80448044
/// Determines whether this is a type for which one can define
80458045
/// an overloaded operator.
80468046
inline bool Type::isOverloadableType() const {
8047-
return isDependentType() || isRecordType() || isEnumeralType();
8047+
if (!CanonicalType->isDependentType())
8048+
return isRecordType() || isEnumeralType();
8049+
return !isArrayType() && !isFunctionType() && !isAnyPointerType() &&
8050+
!isMemberPointerType();
80488051
}
80498052

80508053
/// Determines whether this type is written as a typedef-name.

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3371,6 +3371,8 @@ def err_field_with_address_space : Error<
33713371
"field may not be qualified with an address space">;
33723372
def err_compound_literal_with_address_space : Error<
33733373
"compound literal in function scope may not be qualified with an address space">;
3374+
def err_compound_literal_with_vla_type : Error<
3375+
"compound literal cannot be of variable-length array type">;
33743376
def err_address_space_mismatch_templ_inst : Error<
33753377
"conflicting address space qualifiers are provided between types %0 and %1">;
33763378
def err_attr_objc_ownership_redundant : Error<

clang/include/clang/Driver/Options.td

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6550,6 +6550,10 @@ def flang_deprecated_no_hlfir : Flag<["-"], "flang-deprecated-no-hlfir">,
65506550
Flags<[HelpHidden]>, Visibility<[FlangOption, FC1Option]>,
65516551
HelpText<"Do not use HLFIR lowering (deprecated)">;
65526552

6553+
def flang_experimental_integer_overflow : Flag<["-"], "flang-experimental-integer-overflow">,
6554+
Flags<[HelpHidden]>, Visibility<[FlangOption, FC1Option]>,
6555+
HelpText<"Add nsw flag to internal operations such as do-variable increment (experimental)">;
6556+
65536557
//===----------------------------------------------------------------------===//
65546558
// FLangOption + CoreOption + NoXarchOption
65556559
//===----------------------------------------------------------------------===//

clang/lib/AST/Interp/ByteCodeExprGen.cpp

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2531,6 +2531,51 @@ bool ByteCodeExprGen<Emitter>::VisitConvertVectorExpr(
25312531
return true;
25322532
}
25332533

2534+
template <class Emitter>
2535+
bool ByteCodeExprGen<Emitter>::VisitShuffleVectorExpr(
2536+
const ShuffleVectorExpr *E) {
2537+
assert(Initializing);
2538+
assert(E->getNumSubExprs() > 2);
2539+
2540+
const Expr *Vecs[] = {E->getExpr(0), E->getExpr(1)};
2541+
assert(Vecs[0]->getType() == Vecs[1]->getType());
2542+
2543+
const VectorType *VT = Vecs[0]->getType()->castAs<VectorType>();
2544+
PrimType ElemT = classifyPrim(VT->getElementType());
2545+
unsigned NumInputElems = VT->getNumElements();
2546+
unsigned NumOutputElems = E->getNumSubExprs() - 2;
2547+
assert(NumOutputElems > 0);
2548+
2549+
// Save both input vectors to a local variable.
2550+
unsigned VectorOffsets[2];
2551+
for (unsigned I = 0; I != 2; ++I) {
2552+
VectorOffsets[I] = this->allocateLocalPrimitive(
2553+
Vecs[I], PT_Ptr, /*IsConst=*/true, /*IsExtended=*/false);
2554+
if (!this->visit(Vecs[I]))
2555+
return false;
2556+
if (!this->emitSetLocal(PT_Ptr, VectorOffsets[I], E))
2557+
return false;
2558+
}
2559+
for (unsigned I = 0; I != NumOutputElems; ++I) {
2560+
APSInt ShuffleIndex = E->getShuffleMaskIdx(Ctx.getASTContext(), I);
2561+
if (ShuffleIndex == -1)
2562+
return this->emitInvalid(E); // FIXME: Better diagnostic.
2563+
2564+
assert(ShuffleIndex < (NumInputElems * 2));
2565+
if (!this->emitGetLocal(PT_Ptr,
2566+
VectorOffsets[ShuffleIndex >= NumInputElems], E))
2567+
return false;
2568+
unsigned InputVectorIndex = ShuffleIndex.getZExtValue() % NumInputElems;
2569+
if (!this->emitArrayElemPop(ElemT, InputVectorIndex, E))
2570+
return false;
2571+
2572+
if (!this->emitInitElem(ElemT, I, E))
2573+
return false;
2574+
}
2575+
2576+
return true;
2577+
}
2578+
25342579
template <class Emitter> bool ByteCodeExprGen<Emitter>::discard(const Expr *E) {
25352580
OptionScope<Emitter> Scope(this, /*NewDiscardResult=*/true,
25362581
/*NewInitializing=*/false);

clang/lib/AST/Interp/ByteCodeExprGen.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ class ByteCodeExprGen : public ConstStmtVisitor<ByteCodeExprGen<Emitter>, bool>,
124124
bool VisitRecoveryExpr(const RecoveryExpr *E);
125125
bool VisitAddrLabelExpr(const AddrLabelExpr *E);
126126
bool VisitConvertVectorExpr(const ConvertVectorExpr *E);
127+
bool VisitShuffleVectorExpr(const ShuffleVectorExpr *E);
127128

128129
protected:
129130
bool visitExpr(const Expr *E) override;

clang/lib/Driver/ToolChains/Flang.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ void Flang::addCodegenOptions(const ArgList &Args,
139139

140140
Args.addAllArgs(CmdArgs, {options::OPT_flang_experimental_hlfir,
141141
options::OPT_flang_deprecated_no_hlfir,
142+
options::OPT_flang_experimental_integer_overflow,
142143
options::OPT_fno_ppc_native_vec_elem_order,
143144
options::OPT_fppc_native_vec_elem_order});
144145
}

clang/lib/Format/UnwrappedLineParser.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ void printLine(llvm::raw_ostream &OS, const UnwrappedLine &Line,
4747
OS << Prefix;
4848
NewLine = false;
4949
}
50-
OS << I->Tok->Tok.getName() << "[" << "T=" << (unsigned)I->Tok->getType()
50+
OS << I->Tok->Tok.getName() << "["
51+
<< "T=" << (unsigned)I->Tok->getType()
5152
<< ", OC=" << I->Tok->OriginalColumn << ", \"" << I->Tok->TokenText
5253
<< "\"] ";
5354
for (SmallVectorImpl<UnwrappedLine>::const_iterator

0 commit comments

Comments
 (0)