Skip to content

Commit 5e85473

Browse files
committed
[AutoBump] Merge with ccd3def (Feb 19)
2 parents d35535f + ccd3def commit 5e85473

File tree

382 files changed

+7514
-4586
lines changed

Some content is hidden

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

382 files changed

+7514
-4586
lines changed

.github/new-prs-labeler.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,7 @@ clang:static analyzer:
499499
- clang/tools/scan-build/**
500500
- clang/utils/analyzer/**
501501
- clang/docs/analyzer/**
502+
- clang/test/Analysis/**
502503

503504
pgo:
504505
- llvm/lib/Transforms/Instrumentation/CGProfile.cpp

clang-tools-extra/clangd/CollectMacros.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,13 @@
1818
namespace clang {
1919
namespace clangd {
2020

21-
Range MacroOccurrence::toRange(const SourceManager &SM) const {
21+
CharSourceRange MacroOccurrence::toSourceRange(const SourceManager &SM) const {
2222
auto MainFile = SM.getMainFileID();
23-
return halfOpenToRange(
24-
SM, syntax::FileRange(MainFile, StartOffset, EndOffset).toCharRange(SM));
23+
return syntax::FileRange(MainFile, StartOffset, EndOffset).toCharRange(SM);
24+
}
25+
26+
Range MacroOccurrence::toRange(const SourceManager &SM) const {
27+
return halfOpenToRange(SM, toSourceRange(SM));
2528
}
2629

2730
void CollectMainFileMacros::add(const Token &MacroNameTok, const MacroInfo *MI,

clang-tools-extra/clangd/CollectMacros.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ struct MacroOccurrence {
3131
// True if the occurence is used in a conditional directive, e.g. #ifdef MACRO
3232
bool InConditionalDirective;
3333

34+
CharSourceRange toSourceRange(const SourceManager &SM) const;
3435
Range toRange(const SourceManager &SM) const;
3536
};
3637

clang-tools-extra/clangd/index/SymbolCollector.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,8 @@ void SymbolCollector::handleMacros(const MainFileMacros &MacroRefsToIndex) {
713713
// Add macro references.
714714
for (const auto &IDToRefs : MacroRefsToIndex.MacroRefs) {
715715
for (const auto &MacroRef : IDToRefs.second) {
716-
const auto &Range = MacroRef.toRange(SM);
716+
const auto &SR = MacroRef.toSourceRange(SM);
717+
auto Range = halfOpenToRange(SM, SR);
717718
bool IsDefinition = MacroRef.IsDefinition;
718719
Ref R;
719720
R.Location.Start.setLine(Range.start.line);
@@ -726,9 +727,7 @@ void SymbolCollector::handleMacros(const MainFileMacros &MacroRefsToIndex) {
726727
if (IsDefinition) {
727728
Symbol S;
728729
S.ID = IDToRefs.first;
729-
auto StartLoc = cantFail(sourceLocationInMainFile(SM, Range.start));
730-
auto EndLoc = cantFail(sourceLocationInMainFile(SM, Range.end));
731-
S.Name = toSourceCode(SM, SourceRange(StartLoc, EndLoc));
730+
S.Name = toSourceCode(SM, SR.getAsRange());
732731
S.SymInfo.Kind = index::SymbolKind::Macro;
733732
S.SymInfo.SubKind = index::SymbolSubKind::None;
734733
S.SymInfo.Properties = index::SymbolPropertySet();

clang/docs/ReleaseNotes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ Bug Fixes to C++ Support
170170
- Clang is now better at keeping track of friend function template instance contexts. (#GH55509)
171171
- The initialization kind of elements of structured bindings
172172
direct-list-initialized from an array is corrected to direct-initialization.
173+
- Clang no longer crashes when a coroutine is declared ``[[noreturn]]``. (#GH127327)
173174

174175
Bug Fixes to AST Handling
175176
^^^^^^^^^^^^^^^^^^^^^^^^^

clang/include/clang/AST/Expr.h

Lines changed: 76 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4579,25 +4579,97 @@ class ShuffleVectorExpr : public Expr {
45794579
/// ConvertVectorExpr - Clang builtin function __builtin_convertvector
45804580
/// This AST node provides support for converting a vector type to another
45814581
/// vector type of the same arity.
4582-
class ConvertVectorExpr : public Expr {
4582+
class ConvertVectorExpr final
4583+
: public Expr,
4584+
private llvm::TrailingObjects<ConvertVectorExpr, FPOptionsOverride> {
45834585
private:
45844586
Stmt *SrcExpr;
45854587
TypeSourceInfo *TInfo;
45864588
SourceLocation BuiltinLoc, RParenLoc;
45874589

4590+
friend TrailingObjects;
45884591
friend class ASTReader;
45894592
friend class ASTStmtReader;
4590-
explicit ConvertVectorExpr(EmptyShell Empty) : Expr(ConvertVectorExprClass, Empty) {}
4593+
explicit ConvertVectorExpr(bool HasFPFeatures, EmptyShell Empty)
4594+
: Expr(ConvertVectorExprClass, Empty) {
4595+
ConvertVectorExprBits.HasFPFeatures = HasFPFeatures;
4596+
}
45914597

4592-
public:
45934598
ConvertVectorExpr(Expr *SrcExpr, TypeSourceInfo *TI, QualType DstType,
45944599
ExprValueKind VK, ExprObjectKind OK,
4595-
SourceLocation BuiltinLoc, SourceLocation RParenLoc)
4600+
SourceLocation BuiltinLoc, SourceLocation RParenLoc,
4601+
FPOptionsOverride FPFeatures)
45964602
: Expr(ConvertVectorExprClass, DstType, VK, OK), SrcExpr(SrcExpr),
45974603
TInfo(TI), BuiltinLoc(BuiltinLoc), RParenLoc(RParenLoc) {
4604+
ConvertVectorExprBits.HasFPFeatures = FPFeatures.requiresTrailingStorage();
4605+
if (hasStoredFPFeatures())
4606+
setStoredFPFeatures(FPFeatures);
45984607
setDependence(computeDependence(this));
45994608
}
46004609

4610+
size_t numTrailingObjects(OverloadToken<FPOptionsOverride>) const {
4611+
return ConvertVectorExprBits.HasFPFeatures ? 1 : 0;
4612+
}
4613+
4614+
FPOptionsOverride &getTrailingFPFeatures() {
4615+
assert(ConvertVectorExprBits.HasFPFeatures);
4616+
return *getTrailingObjects<FPOptionsOverride>();
4617+
}
4618+
4619+
const FPOptionsOverride &getTrailingFPFeatures() const {
4620+
assert(ConvertVectorExprBits.HasFPFeatures);
4621+
return *getTrailingObjects<FPOptionsOverride>();
4622+
}
4623+
4624+
public:
4625+
static ConvertVectorExpr *CreateEmpty(const ASTContext &C,
4626+
bool hasFPFeatures);
4627+
4628+
static ConvertVectorExpr *Create(const ASTContext &C, Expr *SrcExpr,
4629+
TypeSourceInfo *TI, QualType DstType,
4630+
ExprValueKind VK, ExprObjectKind OK,
4631+
SourceLocation BuiltinLoc,
4632+
SourceLocation RParenLoc,
4633+
FPOptionsOverride FPFeatures);
4634+
4635+
/// Get the FP contractibility status of this operator. Only meaningful for
4636+
/// operations on floating point types.
4637+
bool isFPContractableWithinStatement(const LangOptions &LO) const {
4638+
return getFPFeaturesInEffect(LO).allowFPContractWithinStatement();
4639+
}
4640+
4641+
/// Is FPFeatures in Trailing Storage?
4642+
bool hasStoredFPFeatures() const {
4643+
return ConvertVectorExprBits.HasFPFeatures;
4644+
}
4645+
4646+
/// Get FPFeatures from trailing storage.
4647+
FPOptionsOverride getStoredFPFeatures() const {
4648+
return getTrailingFPFeatures();
4649+
}
4650+
4651+
/// Get the store FPOptionsOverride or default if not stored.
4652+
FPOptionsOverride getStoredFPFeaturesOrDefault() const {
4653+
return hasStoredFPFeatures() ? getStoredFPFeatures() : FPOptionsOverride();
4654+
}
4655+
4656+
/// Set FPFeatures in trailing storage, used by Serialization & ASTImporter.
4657+
void setStoredFPFeatures(FPOptionsOverride F) { getTrailingFPFeatures() = F; }
4658+
4659+
/// Get the FP features status of this operator. Only meaningful for
4660+
/// operations on floating point types.
4661+
FPOptions getFPFeaturesInEffect(const LangOptions &LO) const {
4662+
if (ConvertVectorExprBits.HasFPFeatures)
4663+
return getStoredFPFeatures().applyOverrides(LO);
4664+
return FPOptions::defaultWithoutTrailingStorage(LO);
4665+
}
4666+
4667+
FPOptionsOverride getFPOptionsOverride() const {
4668+
if (ConvertVectorExprBits.HasFPFeatures)
4669+
return getStoredFPFeatures();
4670+
return FPOptionsOverride();
4671+
}
4672+
46014673
/// getSrcExpr - Return the Expr to be converted.
46024674
Expr *getSrcExpr() const { return cast<Expr>(SrcExpr); }
46034675

clang/include/clang/AST/Stmt.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1215,6 +1215,20 @@ class alignas(void *) Stmt {
12151215
SourceLocation Loc;
12161216
};
12171217

1218+
class ConvertVectorExprBitfields {
1219+
friend class ConvertVectorExpr;
1220+
1221+
LLVM_PREFERRED_TYPE(ExprBitfields)
1222+
unsigned : NumExprBits;
1223+
1224+
//
1225+
/// This is only meaningful for operations on floating point
1226+
/// types when additional values need to be in trailing storage.
1227+
/// It is 0 otherwise.
1228+
LLVM_PREFERRED_TYPE(bool)
1229+
unsigned HasFPFeatures : 1;
1230+
};
1231+
12181232
union {
12191233
// Same order as in StmtNodes.td.
12201234
// Statements
@@ -1293,6 +1307,7 @@ class alignas(void *) Stmt {
12931307

12941308
// Clang Extensions
12951309
OpaqueValueExprBitfields OpaqueValueExprBits;
1310+
ConvertVectorExprBitfields ConvertVectorExprBits;
12961311
};
12971312

12981313
public:

clang/include/clang/AST/TextNodeDumper.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,7 @@ class TextNodeDumper
425425
void VisitOpenACCAsteriskSizeExpr(const OpenACCAsteriskSizeExpr *S);
426426
void VisitEmbedExpr(const EmbedExpr *S);
427427
void VisitAtomicExpr(const AtomicExpr *AE);
428+
void VisitConvertVectorExpr(const ConvertVectorExpr *S);
428429
};
429430

430431
} // namespace clang

clang/include/clang/Basic/Cuda.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,6 @@ enum class OffloadArch {
106106
GFX90a,
107107
GFX90c,
108108
GFX9_4_GENERIC,
109-
GFX940,
110-
GFX941,
111109
GFX942,
112110
GFX950,
113111
GFX10_1_GENERIC,

clang/include/clang/CIR/Dialect/IR/CIRDialect.td

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ def CIR_Dialect : Dialect {
2828
let useDefaultTypePrinterParser = 0;
2929

3030
let extraClassDeclaration = [{
31+
static llvm::StringRef getTripleAttrName() { return "cir.triple"; }
32+
3133
void registerAttributes();
3234
void registerTypes();
3335

0 commit comments

Comments
 (0)