Skip to content

Commit e3f04a6

Browse files
authored
Merge branch 'main' into jroelofs/gvn-remarks
2 parents ea7e39a + 60a59e3 commit e3f04a6

File tree

704 files changed

+21001
-16160
lines changed

Some content is hidden

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

704 files changed

+21001
-16160
lines changed

bolt/lib/Passes/RetpolineInsertion.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ std::string createRetpolineFunctionTag(BinaryContext &BC,
195195

196196
TagOS << "+";
197197
if (MemRef.DispExpr)
198-
MemRef.DispExpr->print(TagOS, BC.AsmInfo.get());
198+
BC.AsmInfo->printExpr(TagOS, *MemRef.DispExpr);
199199
else
200200
TagOS << MemRef.DispImm;
201201

bolt/lib/Target/RISCV/RISCVMCPlusBuilder.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
#include "MCTargetDesc/RISCVMCExpr.h"
13+
#include "MCTargetDesc/RISCVMCAsmInfo.h"
1414
#include "MCTargetDesc/RISCVMCTargetDesc.h"
1515
#include "bolt/Core/MCPlusBuilder.h"
1616
#include "llvm/BinaryFormat/ELF.h"
@@ -33,8 +33,8 @@ class RISCVMCPlusBuilder : public MCPlusBuilder {
3333

3434
bool equals(const MCSpecifierExpr &A, const MCSpecifierExpr &B,
3535
CompFuncTy Comp) const override {
36-
const auto &RISCVExprA = cast<RISCVMCExpr>(A);
37-
const auto &RISCVExprB = cast<RISCVMCExpr>(B);
36+
const auto &RISCVExprA = cast<MCSpecifierExpr>(A);
37+
const auto &RISCVExprB = cast<MCSpecifierExpr>(B);
3838
if (RISCVExprA.getSpecifier() != RISCVExprB.getSpecifier())
3939
return false;
4040

@@ -245,7 +245,7 @@ class RISCVMCPlusBuilder : public MCPlusBuilder {
245245
MCContext *Ctx) {
246246
Inst.setOpcode(Opcode);
247247
Inst.clear();
248-
Inst.addOperand(MCOperand::createExpr(RISCVMCExpr::create(
248+
Inst.addOperand(MCOperand::createExpr(MCSpecifierExpr::create(
249249
MCSymbolRefExpr::create(Target, MCSymbolRefExpr::VK_None, *Ctx),
250250
ELF::R_RISCV_CALL_PLT, *Ctx)));
251251
}
@@ -342,7 +342,7 @@ class RISCVMCPlusBuilder : public MCPlusBuilder {
342342
}
343343

344344
const MCSymbol *getTargetSymbol(const MCExpr *Expr) const override {
345-
auto *RISCVExpr = dyn_cast<RISCVMCExpr>(Expr);
345+
auto *RISCVExpr = dyn_cast<MCSpecifierExpr>(Expr);
346346
if (RISCVExpr && RISCVExpr->getSubExpr())
347347
return getTargetSymbol(RISCVExpr->getSubExpr());
348348

@@ -435,19 +435,19 @@ class RISCVMCPlusBuilder : public MCPlusBuilder {
435435
case ELF::R_RISCV_TLS_GD_HI20:
436436
// The GOT is reused so no need to create GOT relocations
437437
case ELF::R_RISCV_PCREL_HI20:
438-
return RISCVMCExpr::create(Expr, ELF::R_RISCV_PCREL_HI20, Ctx);
438+
return MCSpecifierExpr::create(Expr, ELF::R_RISCV_PCREL_HI20, Ctx);
439439
case ELF::R_RISCV_PCREL_LO12_I:
440440
case ELF::R_RISCV_PCREL_LO12_S:
441-
return RISCVMCExpr::create(Expr, RISCVMCExpr::VK_PCREL_LO, Ctx);
441+
return MCSpecifierExpr::create(Expr, RISCV::S_PCREL_LO, Ctx);
442442
case ELF::R_RISCV_HI20:
443-
return RISCVMCExpr::create(Expr, ELF::R_RISCV_HI20, Ctx);
443+
return MCSpecifierExpr::create(Expr, ELF::R_RISCV_HI20, Ctx);
444444
case ELF::R_RISCV_LO12_I:
445445
case ELF::R_RISCV_LO12_S:
446-
return RISCVMCExpr::create(Expr, RISCVMCExpr::VK_LO, Ctx);
446+
return MCSpecifierExpr::create(Expr, RISCV::S_LO, Ctx);
447447
case ELF::R_RISCV_CALL:
448-
return RISCVMCExpr::create(Expr, ELF::R_RISCV_CALL_PLT, Ctx);
448+
return MCSpecifierExpr::create(Expr, ELF::R_RISCV_CALL_PLT, Ctx);
449449
case ELF::R_RISCV_CALL_PLT:
450-
return RISCVMCExpr::create(Expr, ELF::R_RISCV_CALL_PLT, Ctx);
450+
return MCSpecifierExpr::create(Expr, ELF::R_RISCV_CALL_PLT, Ctx);
451451
}
452452
}
453453

@@ -466,10 +466,10 @@ class RISCVMCPlusBuilder : public MCPlusBuilder {
466466
return false;
467467

468468
const auto *ImmExpr = ImmOp.getExpr();
469-
if (!isa<RISCVMCExpr>(ImmExpr))
469+
if (!isa<MCSpecifierExpr>(ImmExpr))
470470
return false;
471471

472-
switch (cast<RISCVMCExpr>(ImmExpr)->getSpecifier()) {
472+
switch (cast<MCSpecifierExpr>(ImmExpr)->getSpecifier()) {
473473
default:
474474
return false;
475475
case ELF::R_RISCV_CALL_PLT:

bolt/lib/Utils/CMakeLists.txt

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,25 @@ set(version_inc "${CMAKE_CURRENT_BINARY_DIR}/VCSVersion.inc")
66

77
set(generate_vcs_version_script "${LLVM_CMAKE_DIR}/GenerateVersionFromVCS.cmake")
88

9+
if(llvm_vc AND LLVM_APPEND_VC_REV)
10+
set(llvm_source_dir ${LLVM_MAIN_SRC_DIR})
11+
endif()
12+
if(LLVM_VC_REPOSITORY AND LLVM_VC_REVISION)
13+
set(llvm_source_dir ${LLVM_SOURCE_DIR})
14+
set(llvm_vc_repository ${LLVM_VC_REPOSITORY})
15+
set(llvm_vc_revision ${LLVM_VC_REVISION})
16+
endif()
17+
if(bolt_vc AND LLVM_APPEND_VC_REV)
18+
set(bolt_source_dir ${BOLT_SOURCE_DIR})
19+
endif()
20+
921
# Create custom target to generate the VC revision include.
1022
add_custom_command(OUTPUT "${version_inc}"
1123
DEPENDS "${llvm_vc}" "${bolt_vc}" "${generate_vcs_version_script}"
1224
COMMAND ${CMAKE_COMMAND} "-DNAMES=BOLT"
25+
"-DLLVM_SOURCE_DIR=${llvm_source_dir}"
26+
"-DBOLT_SOURCE_DIR=${bolt_source_dir}"
1327
"-DHEADER_FILE=${version_inc}"
14-
"-DBOLT_SOURCE_DIR=${BOLT_SOURCE_DIR}"
1528
"-DLLVM_VC_REPOSITORY=${llvm_vc_repository}"
1629
"-DLLVM_VC_REVISION=${llvm_vc_revision}"
1730
"-DLLVM_FORCE_VC_REVISION=${LLVM_FORCE_VC_REVISION}"

clang-tools-extra/clang-doc/Representation.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ mergeInfos(std::vector<std::unique_ptr<Info>> &Values) {
147147
return llvm::createStringError(llvm::inconvertibleErrorCode(),
148148
"unexpected info type");
149149
}
150+
llvm_unreachable("unhandled enumerator");
150151
}
151152

152153
bool CommentInfo::operator==(const CommentInfo &Other) const {

clang-tools-extra/clang-doc/Serialize.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,7 @@ std::string serialize(std::unique_ptr<Info> &I) {
392392
case InfoType::IT_default:
393393
return "";
394394
}
395+
llvm_unreachable("unhandled enumerator");
395396
}
396397

397398
static void parseFullComment(const FullComment *C, CommentInfo &CI) {

clang-tools-extra/clang-reorder-fields/ReorderFieldsAction.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ getNewFieldsOrder(const RecordDecl *Definition,
8686
static void
8787
addReplacement(SourceRange Old, SourceRange New, const ASTContext &Context,
8888
std::map<std::string, tooling::Replacements> &Replacements) {
89+
if (Old.getBegin().isMacroID())
90+
Old = Context.getSourceManager().getExpansionRange(Old).getAsRange();
91+
if (New.getBegin().isMacroID())
92+
New = Context.getSourceManager().getExpansionRange(New).getAsRange();
8993
StringRef NewText =
9094
Lexer::getSourceText(CharSourceRange::getTokenRange(New),
9195
Context.getSourceManager(), Context.getLangOpts());

clang-tools-extra/modularize/CoverageChecker.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -329,10 +329,8 @@ bool CoverageChecker::collectFileSystemHeaders() {
329329
else {
330330
// Otherwise we only look at the sub-trees specified by the
331331
// include paths.
332-
for (std::vector<std::string>::const_iterator I = IncludePaths.begin(),
333-
E = IncludePaths.end();
334-
I != E; ++I) {
335-
if (!collectFileSystemHeaders(*I))
332+
for (const std::string &IncludePath : IncludePaths) {
333+
if (!collectFileSystemHeaders(IncludePath))
336334
return false;
337335
}
338336
}

clang-tools-extra/modularize/Modularize.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,8 +339,8 @@ static std::string findInputFile(const CommandLineArguments &CLArgs) {
339339
llvm::opt::Visibility VisibilityMask(options::CC1Option);
340340
unsigned MissingArgIndex, MissingArgCount;
341341
SmallVector<const char *, 256> Argv;
342-
for (auto I = CLArgs.begin(), E = CLArgs.end(); I != E; ++I)
343-
Argv.push_back(I->c_str());
342+
for (const std::string &CLArg : CLArgs)
343+
Argv.push_back(CLArg.c_str());
344344
InputArgList Args = getDriverOptTable().ParseArgs(
345345
Argv, MissingArgIndex, MissingArgCount, VisibilityMask);
346346
std::vector<std::string> Inputs = Args.getAllArgValues(OPT_INPUT);

clang-tools-extra/modularize/ModularizeUtilities.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@ ModularizeUtilities *ModularizeUtilities::createModularizeUtilities(
6969
// Load all header lists and dependencies.
7070
std::error_code ModularizeUtilities::loadAllHeaderListsAndDependencies() {
7171
// For each input file.
72-
for (auto I = InputFilePaths.begin(), E = InputFilePaths.end(); I != E; ++I) {
73-
llvm::StringRef InputPath = *I;
72+
for (llvm::StringRef InputPath : InputFilePaths) {
7473
// If it's a module map.
7574
if (InputPath.ends_with(".modulemap")) {
7675
// Load the module map.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// RUN: clang-reorder-fields -record-name ::bar::Foo -fields-order z,y,x %s -- | FileCheck %s
2+
3+
namespace bar {
4+
5+
#define INT_DECL(NAME) int NAME // CHECK: {{^#define INT_DECL\(NAME\) int NAME}}
6+
#define MACRO_DECL int x; // CHECK-NEXT: {{^#define MACRO_DECL int x;}}
7+
8+
struct Foo {
9+
MACRO_DECL // CHECK: {{^ INT_DECL\(z\);}}
10+
int y; // CHECK-NEXT: {{^ int y;}}
11+
INT_DECL(z); // CHECK-NEXT: {{^ MACRO_DECL}}
12+
};
13+
14+
#define FOO 0 // CHECK: {{^#define FOO 0}}
15+
#define BAR 1 // CHECK-NEXT: {{^#define BAR 1}}
16+
#define BAZ 2 // CHECK-NEXT: {{^#define BAZ 2}}
17+
18+
struct Foo foo = {
19+
FOO, // CHECK: {{^ BAZ,}}
20+
BAR, // CHECK-NEXT: {{^ BAR,}}
21+
BAZ, // CHECK-NEXT: {{^ FOO,}}
22+
};
23+
24+
} // end namespace bar

0 commit comments

Comments
 (0)