Skip to content

Commit 5891ded

Browse files
committed
Merge branch 'fix/92847' of https://github.com/a-tarasyuk/llvm-project into fix/92847
2 parents bc9e0de + 707e807 commit 5891ded

File tree

354 files changed

+16135
-3871
lines changed

Some content is hidden

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

354 files changed

+16135
-3871
lines changed

bolt/include/bolt/Core/BinarySection.h

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -359,15 +359,9 @@ class BinarySection {
359359

360360
/// Add a new relocation at the given /p Offset.
361361
void addRelocation(uint64_t Offset, MCSymbol *Symbol, uint64_t Type,
362-
uint64_t Addend, uint64_t Value = 0,
363-
bool Pending = false) {
362+
uint64_t Addend, uint64_t Value = 0) {
364363
assert(Offset < getSize() && "offset not within section bounds");
365-
if (!Pending) {
366-
Relocations.emplace(Relocation{Offset, Symbol, Type, Addend, Value});
367-
} else {
368-
PendingRelocations.emplace_back(
369-
Relocation{Offset, Symbol, Type, Addend, Value});
370-
}
364+
Relocations.emplace(Relocation{Offset, Symbol, Type, Addend, Value});
371365
}
372366

373367
/// Add a dynamic relocation at the given /p Offset.

bolt/tools/driver/llvm-bolt.cpp

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -173,24 +173,14 @@ void boltMode(int argc, char **argv) {
173173
}
174174
}
175175

176-
static std::string GetExecutablePath(const char *Argv0) {
177-
SmallString<256> ExecutablePath(Argv0);
178-
// Do a PATH lookup if Argv0 isn't a valid path.
179-
if (!llvm::sys::fs::exists(ExecutablePath))
180-
if (llvm::ErrorOr<std::string> P =
181-
llvm::sys::findProgramByName(ExecutablePath))
182-
ExecutablePath = *P;
183-
return std::string(ExecutablePath);
184-
}
185-
186176
int main(int argc, char **argv) {
187177
// Print a stack trace if we signal out.
188178
sys::PrintStackTraceOnErrorSignal(argv[0]);
189179
PrettyStackTraceProgram X(argc, argv);
190180

191181
llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
192182

193-
std::string ToolPath = GetExecutablePath(argv[0]);
183+
std::string ToolPath = llvm::sys::fs::getMainExecutable(argv[0], nullptr);
194184

195185
// Initialize targets and assembly printers/parsers.
196186
llvm::InitializeAllTargetInfos();

bolt/unittests/Core/BinaryContext.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,13 @@ TEST_P(BinaryContextTester, FlushPendingRelocCALL26) {
9393
DataSize, 4);
9494
MCSymbol *RelSymbol1 = BC->getOrCreateGlobalSymbol(4, "Func1");
9595
ASSERT_TRUE(RelSymbol1);
96-
BS.addRelocation(8, RelSymbol1, ELF::R_AARCH64_CALL26, 0, 0, true);
96+
BS.addPendingRelocation(
97+
Relocation{8, RelSymbol1, ELF::R_AARCH64_CALL26, 0, 0});
9798
MCSymbol *RelSymbol2 = BC->getOrCreateGlobalSymbol(16, "Func2");
9899
ASSERT_TRUE(RelSymbol2);
99-
BS.addRelocation(12, RelSymbol2, ELF::R_AARCH64_CALL26, 0, 0, true);
100+
BS.addPendingRelocation(
101+
Relocation{12, RelSymbol2, ELF::R_AARCH64_CALL26, 0, 0});
100102

101-
std::error_code EC;
102103
SmallVector<char> Vect(DataSize);
103104
raw_svector_ostream OS(Vect);
104105

@@ -134,12 +135,13 @@ TEST_P(BinaryContextTester, FlushPendingRelocJUMP26) {
134135
(uint8_t *)Data, Size, 4);
135136
MCSymbol *RelSymbol1 = BC->getOrCreateGlobalSymbol(4, "Func1");
136137
ASSERT_TRUE(RelSymbol1);
137-
BS.addRelocation(8, RelSymbol1, ELF::R_AARCH64_JUMP26, 0, 0, true);
138+
BS.addPendingRelocation(
139+
Relocation{8, RelSymbol1, ELF::R_AARCH64_JUMP26, 0, 0});
138140
MCSymbol *RelSymbol2 = BC->getOrCreateGlobalSymbol(16, "Func2");
139141
ASSERT_TRUE(RelSymbol2);
140-
BS.addRelocation(12, RelSymbol2, ELF::R_AARCH64_JUMP26, 0, 0, true);
142+
BS.addPendingRelocation(
143+
Relocation{12, RelSymbol2, ELF::R_AARCH64_JUMP26, 0, 0});
141144

142-
std::error_code EC;
143145
SmallVector<char> Vect(Size);
144146
raw_svector_ostream OS(Vect);
145147

clang/cmake/modules/AddClang.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,10 @@ macro(add_clang_library name)
138138
ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
139139
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
140140

141+
if (LLVM_ENABLE_PDB)
142+
install(FILES $<TARGET_PDB_FILE:${name}> DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT ${name} OPTIONAL)
143+
endif()
144+
141145
if (NOT LLVM_ENABLE_IDE)
142146
add_llvm_install_targets(install-${lib}
143147
DEPENDS ${lib}

clang/include/clang/Basic/FPOptions.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ OPTION(FPEvalMethod, LangOptions::FPEvalMethodKind, 2, AllowApproxFunc)
2828
OPTION(Float16ExcessPrecision, LangOptions::ExcessPrecisionKind, 2, FPEvalMethod)
2929
OPTION(BFloat16ExcessPrecision, LangOptions::ExcessPrecisionKind, 2, Float16ExcessPrecision)
3030
OPTION(MathErrno, bool, 1, BFloat16ExcessPrecision)
31-
OPTION(ComplexRange, LangOptions::ComplexRangeKind, 2, MathErrno)
31+
OPTION(ComplexRange, LangOptions::ComplexRangeKind, 3, MathErrno)
3232
#undef OPTION

clang/include/clang/Basic/LangOptions.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ BENIGN_LANGOPT(NoSignedZero , 1, 0, "Permit Floating Point optimization wit
238238
BENIGN_LANGOPT(AllowRecip , 1, 0, "Permit Floating Point reciprocal")
239239
BENIGN_LANGOPT(ApproxFunc , 1, 0, "Permit Floating Point approximation")
240240

241-
ENUM_LANGOPT(ComplexRange, ComplexRangeKind, 2, CX_None, "Enable use of range reduction for complex arithmetics.")
241+
ENUM_LANGOPT(ComplexRange, ComplexRangeKind, 3, CX_None, "Enable use of range reduction for complex arithmetics.")
242242

243243
BENIGN_LANGOPT(ObjCGCBitmapPrint , 1, 0, "printing of GC's bitmap layout for __weak/__strong ivars")
244244

clang/include/clang/Basic/LangOptions.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -648,9 +648,12 @@ class LangOptions : public LangOptionsBase {
648648

649649
// Define accessors/mutators for language options of enumeration type.
650650
#define LANGOPT(Name, Bits, Default, Description)
651-
#define ENUM_LANGOPT(Name, Type, Bits, Default, Description) \
652-
Type get##Name() const { return static_cast<Type>(Name); } \
653-
void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
651+
#define ENUM_LANGOPT(Name, Type, Bits, Default, Description) \
652+
Type get##Name() const { return static_cast<Type>(Name); } \
653+
void set##Name(Type Value) { \
654+
assert(static_cast<unsigned>(Value) < (1u << Bits)); \
655+
Name = static_cast<unsigned>(Value); \
656+
}
654657
#include "clang/Basic/LangOptions.def"
655658

656659
/// Are we compiling a module?
@@ -959,11 +962,14 @@ class FPOptions {
959962
void applyChanges(FPOptionsOverride FPO);
960963

961964
// We can define most of the accessors automatically:
965+
// TODO: consider enforcing the assertion that value fits within bits
966+
// statically.
962967
#define OPTION(NAME, TYPE, WIDTH, PREVIOUS) \
963968
TYPE get##NAME() const { \
964969
return static_cast<TYPE>((Value & NAME##Mask) >> NAME##Shift); \
965970
} \
966971
void set##NAME(TYPE value) { \
972+
assert(storage_type(value) < (1u << WIDTH)); \
967973
Value = (Value & ~NAME##Mask) | (storage_type(value) << NAME##Shift); \
968974
}
969975
#include "clang/Basic/FPOptions.def"

clang/include/clang/Driver/Options.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3397,7 +3397,7 @@ def fno_objc_weak : Flag<["-"], "fno-objc-weak">, Group<f_Group>,
33973397
def fno_omit_frame_pointer : Flag<["-"], "fno-omit-frame-pointer">, Group<f_Group>,
33983398
Visibility<[ClangOption, FlangOption]>;
33993399
defm operator_names : BoolFOption<"operator-names",
3400-
LangOpts<"CXXOperatorNames">, Default<cplusplus.KeyPath>,
3400+
LangOpts<"CXXOperatorNames">, Default<!strconcat(cplusplus.KeyPath, " && !",hlsl.KeyPath)>,
34013401
NegFlag<SetFalse, [], [ClangOption, CC1Option],
34023402
"Do not treat C++ operator name keywords as synonyms for operators">,
34033403
PosFlag<SetTrue>>;

clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.def

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,16 @@ ANALYZER_OPTION(
294294
bool, ShouldUnrollLoops, "unroll-loops",
295295
"Whether the analysis should try to unroll loops with known bounds.", false)
296296

297+
ANALYZER_OPTION(
298+
bool, ShouldAssumeAtLeastOneIteration, "assume-at-least-one-iteration",
299+
"Whether the analyzer should always assume at least one iteration in "
300+
"loops where the loop condition is opaque (i.e. the analyzer cannot "
301+
"determine if it's true or false). Setting this to true eliminates some "
302+
"false positives (where e.g. a structure is nonempty, but the analyzer "
303+
"does not notice this); but it also eliminates some true positives (e.g. "
304+
"cases where a structure can be empty and this causes buggy behavior).",
305+
false)
306+
297307
ANALYZER_OPTION(
298308
bool, ShouldDisplayNotesAsEvents, "notes-as-events",
299309
"Whether the bug reporter should transparently treat extra note diagnostic "

clang/lib/AST/ByteCode/InterpBuiltin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1683,7 +1683,7 @@ static bool interp__builtin_operator_new(InterpState &S, CodePtr OpPC,
16831683
assert(!ElemT);
16841684
// Structs etc.
16851685
const Descriptor *Desc = S.P.createDescriptor(
1686-
Call, ElemType.getTypePtr(), Descriptor::InlineDescMD,
1686+
NewCall, ElemType.getTypePtr(), Descriptor::InlineDescMD,
16871687
/*IsConst=*/false, /*IsTemporary=*/false, /*IsMutable=*/false,
16881688
/*Init=*/nullptr);
16891689

0 commit comments

Comments
 (0)