Skip to content
This repository was archived by the owner on Sep 15, 2025. It is now read-only.

Commit d168ced

Browse files
SC llvm teamSC llvm team
authored andcommitted
Merged main:c4e9e41199127bb288e84e9477da99f28941edb3 into amd-gfx:c5f22f9383e1
Local branch amd-gfx c5f22f9 Merged main:b5af667b01458e9083256f2614df175916c73e5a into amd-gfx:3ceb816dd24a Remote branch main c4e9e41 [Clang] Ensure ``if consteval`` consititute an immediate function context (llvm#91939)
2 parents c5f22f9 + c4e9e41 commit d168ced

File tree

183 files changed

+6112
-2524
lines changed

Some content is hidden

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

183 files changed

+6112
-2524
lines changed

.github/new-prs-labeler.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ mlir:dlti:
239239
- mlir/**/DLTI/**
240240

241241
mlir:emitc:
242-
- mlir/**/EmitC/**
242+
- mlir/**/*EmitC*/**
243243
- mlir/lib/Target/Cpp/**
244244

245245
mlir:func:
@@ -306,7 +306,7 @@ mlir:tensor:
306306
- mlir/**/Tensor/**
307307

308308
mlir:tosa:
309-
- mlir/**/Tosa/**
309+
- mlir/**/*Tosa*/**
310310

311311
mlir:ub:
312312
- mlir/**/UB/**

bolt/lib/Profile/DataAggregator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2000,7 +2000,7 @@ std::error_code DataAggregator::parseMMapEvents() {
20002000
std::pair<StringRef, MMapInfo> FileMMapInfo = FileMMapInfoRes.get();
20012001
if (FileMMapInfo.second.PID == -1)
20022002
continue;
2003-
if (FileMMapInfo.first.equals("(deleted)"))
2003+
if (FileMMapInfo.first == "(deleted)")
20042004
continue;
20052005

20062006
// Consider only the first mapping of the file for any given PID

bolt/lib/Profile/DataReader.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1205,8 +1205,7 @@ std::error_code DataReader::parse() {
12051205

12061206
// Add entry data for branches to another function or branches
12071207
// to entry points (including recursive calls)
1208-
if (BI.To.IsSymbol &&
1209-
(!BI.From.Name.equals(BI.To.Name) || BI.To.Offset == 0)) {
1208+
if (BI.To.IsSymbol && (BI.From.Name != BI.To.Name || BI.To.Offset == 0)) {
12101209
I = GetOrCreateFuncEntry(BI.To.Name);
12111210
I->second.EntryData.emplace_back(std::move(BI));
12121211
}

bolt/lib/Rewrite/DWARFRewriter.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1550,7 +1550,7 @@ CUOffsetMap DWARFRewriter::finalizeTypeSections(DIEBuilder &DIEBlder,
15501550
for (const SectionRef &Section : Obj->sections()) {
15511551
StringRef Contents = cantFail(Section.getContents());
15521552
StringRef Name = cantFail(Section.getName());
1553-
if (Name.equals(".debug_types"))
1553+
if (Name == ".debug_types")
15541554
BC.registerOrUpdateNoteSection(".debug_types", copyByteArray(Contents),
15551555
Contents.size());
15561556
}
@@ -1633,10 +1633,10 @@ void DWARFRewriter::finalizeDebugSections(
16331633
for (const SectionRef &Secs : Obj->sections()) {
16341634
StringRef Contents = cantFail(Secs.getContents());
16351635
StringRef Name = cantFail(Secs.getName());
1636-
if (Name.equals(".debug_abbrev")) {
1636+
if (Name == ".debug_abbrev") {
16371637
BC.registerOrUpdateNoteSection(".debug_abbrev", copyByteArray(Contents),
16381638
Contents.size());
1639-
} else if (Name.equals(".debug_info")) {
1639+
} else if (Name == ".debug_info") {
16401640
BC.registerOrUpdateNoteSection(".debug_info", copyByteArray(Contents),
16411641
Contents.size());
16421642
}
@@ -1771,7 +1771,7 @@ std::optional<StringRef> updateDebugData(
17711771
};
17721772
switch (SectionIter->second.second) {
17731773
default: {
1774-
if (!SectionName.equals("debug_str.dwo"))
1774+
if (SectionName != "debug_str.dwo")
17751775
errs() << "BOLT-WARNING: unsupported debug section: " << SectionName
17761776
<< "\n";
17771777
return SectionContents;
@@ -1959,7 +1959,7 @@ void DWARFRewriter::updateDWP(DWARFUnit &CU,
19591959
continue;
19601960
}
19611961

1962-
if (SectionName.equals("debug_str.dwo")) {
1962+
if (SectionName == "debug_str.dwo") {
19631963
CurStrSection = OutData;
19641964
} else {
19651965
// Since handleDebugDataPatching returned true, we already know this is

bolt/lib/Rewrite/SDTRewriter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ void SDTRewriter::readSection() {
8787

8888
StringRef Name = DE.getCStr(&Offset);
8989

90-
if (!Name.equals("stapsdt"))
90+
if (Name != "stapsdt")
9191
errs() << "BOLT-WARNING: SDT note name \"" << Name
9292
<< "\" is not expected\n";
9393

clang-tools-extra/clang-query/Query.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
//===----------------------------------------------------------------------===//
88

99
#include "Query.h"
10+
#include "QueryParser.h"
1011
#include "QuerySession.h"
1112
#include "clang/AST/ASTDumper.h"
1213
#include "clang/ASTMatchers/ASTMatchFinder.h"
@@ -281,5 +282,26 @@ const QueryKind SetQueryKind<bool>::value;
281282
const QueryKind SetQueryKind<OutputKind>::value;
282283
#endif
283284

285+
bool FileQuery::run(llvm::raw_ostream &OS, QuerySession &QS) const {
286+
auto Buffer = llvm::MemoryBuffer::getFile(StringRef{File}.trim());
287+
if (!Buffer) {
288+
if (Prefix.has_value())
289+
llvm::errs() << *Prefix << ": ";
290+
llvm::errs() << "cannot open " << File << ": "
291+
<< Buffer.getError().message() << "\n";
292+
return false;
293+
}
294+
295+
StringRef FileContentRef(Buffer.get()->getBuffer());
296+
297+
while (!FileContentRef.empty()) {
298+
QueryRef Q = QueryParser::parse(FileContentRef, QS);
299+
if (!Q->run(llvm::outs(), QS))
300+
return false;
301+
FileContentRef = Q->RemainingContent;
302+
}
303+
return true;
304+
}
305+
284306
} // namespace query
285307
} // namespace clang

clang-tools-extra/clang-query/Query.h

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ enum QueryKind {
3030
QK_SetTraversalKind,
3131
QK_EnableOutputKind,
3232
QK_DisableOutputKind,
33-
QK_Quit
33+
QK_Quit,
34+
QK_File
3435
};
3536

3637
class QuerySession;
@@ -188,6 +189,21 @@ struct DisableOutputQuery : SetNonExclusiveOutputQuery {
188189
}
189190
};
190191

192+
struct FileQuery : Query {
193+
FileQuery(StringRef File, StringRef Prefix = StringRef())
194+
: Query(QK_File), File(File),
195+
Prefix(!Prefix.empty() ? std::optional<std::string>(Prefix)
196+
: std::nullopt) {}
197+
198+
bool run(llvm::raw_ostream &OS, QuerySession &QS) const override;
199+
200+
static bool classof(const Query *Q) { return Q->Kind == QK_File; }
201+
202+
private:
203+
std::string File;
204+
std::optional<std::string> Prefix;
205+
};
206+
191207
} // namespace query
192208
} // namespace clang
193209

clang-tools-extra/clang-query/QueryParser.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,8 @@ enum ParsedQueryKind {
183183
PQK_Unlet,
184184
PQK_Quit,
185185
PQK_Enable,
186-
PQK_Disable
186+
PQK_Disable,
187+
PQK_File
187188
};
188189

189190
enum ParsedQueryVariable {
@@ -222,12 +223,14 @@ QueryRef QueryParser::doParse() {
222223
.Case("let", PQK_Let)
223224
.Case("m", PQK_Match, /*IsCompletion=*/false)
224225
.Case("match", PQK_Match)
225-
.Case("q", PQK_Quit, /*IsCompletion=*/false)
226+
.Case("q", PQK_Quit, /*IsCompletion=*/false)
226227
.Case("quit", PQK_Quit)
227228
.Case("set", PQK_Set)
228229
.Case("enable", PQK_Enable)
229230
.Case("disable", PQK_Disable)
230231
.Case("unlet", PQK_Unlet)
232+
.Case("f", PQK_File, /*IsCompletion=*/false)
233+
.Case("file", PQK_File)
231234
.Default(PQK_Invalid);
232235

233236
switch (QKind) {
@@ -351,6 +354,9 @@ QueryRef QueryParser::doParse() {
351354
return endQuery(new LetQuery(Name, VariantValue()));
352355
}
353356

357+
case PQK_File:
358+
return new FileQuery(Line);
359+
354360
case PQK_Invalid:
355361
return new InvalidQuery("unknown command: " + CommandStr);
356362
}

clang-tools-extra/clang-query/tool/ClangQuery.cpp

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -74,22 +74,8 @@ static cl::opt<std::string> PreloadFile(
7474

7575
bool runCommandsInFile(const char *ExeName, std::string const &FileName,
7676
QuerySession &QS) {
77-
auto Buffer = llvm::MemoryBuffer::getFile(FileName);
78-
if (!Buffer) {
79-
llvm::errs() << ExeName << ": cannot open " << FileName << ": "
80-
<< Buffer.getError().message() << "\n";
81-
return true;
82-
}
83-
84-
StringRef FileContentRef(Buffer.get()->getBuffer());
85-
86-
while (!FileContentRef.empty()) {
87-
QueryRef Q = QueryParser::parse(FileContentRef, QS);
88-
if (!Q->run(llvm::outs(), QS))
89-
return true;
90-
FileContentRef = Q->RemainingContent;
91-
}
92-
return false;
77+
FileQuery Query(FileName, ExeName);
78+
return !Query.run(llvm::errs(), QS);
9379
}
9480

9581
int main(int argc, const char **argv) {

clang-tools-extra/clang-tidy/ClangTidyCheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ std::optional<int64_t> ClangTidyCheck::OptionsView::getEnumInt(
171171
if (IgnoreCase) {
172172
if (Value.equals_insensitive(NameAndEnum.second))
173173
return NameAndEnum.first;
174-
} else if (Value.equals(NameAndEnum.second)) {
174+
} else if (Value == NameAndEnum.second) {
175175
return NameAndEnum.first;
176176
} else if (Value.equals_insensitive(NameAndEnum.second)) {
177177
Closest = NameAndEnum.second;

0 commit comments

Comments
 (0)