Skip to content

Commit 1a2fa8b

Browse files
authored
Merge branch 'main' into clang/debuginfo-objc-property-test-2
2 parents 95b3671 + 90489ad commit 1a2fa8b

File tree

47 files changed

+1010
-103
lines changed

Some content is hidden

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

47 files changed

+1010
-103
lines changed

clang/include/clang/Basic/DiagnosticDriverKinds.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,9 @@ def warn_drv_unsupported_option_for_offload_arch_req_feature : Warning<
133133
def warn_drv_unsupported_option_for_target : Warning<
134134
"ignoring '%0' option as it is not currently supported for target '%1'">,
135135
InGroup<OptionIgnored>;
136+
def warn_drv_invalid_argument_for_flang : Warning<
137+
"'%0' is not valid for Fortran">,
138+
InGroup<OptionIgnored>;
136139
def warn_drv_unsupported_option_for_flang : Warning<
137140
"the argument '%0' is not supported for option '%1'. Mapping to '%1%2'">,
138141
InGroup<OptionIgnored>;

clang/include/clang/Driver/Options.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1955,7 +1955,7 @@ defm borland_extensions : BoolFOption<"borland-extensions",
19551955
"Accept non-standard constructs supported by the Borland compiler">,
19561956
NegFlag<SetFalse>>;
19571957
def fbuiltin : Flag<["-"], "fbuiltin">, Group<f_Group>,
1958-
Visibility<[ClangOption, CLOption, DXCOption]>;
1958+
Visibility<[ClangOption, CLOption, DXCOption, FlangOption, FC1Option]>;
19591959
def fbuiltin_module_map : Flag <["-"], "fbuiltin-module-map">, Group<f_Group>,
19601960
Flags<[]>, HelpText<"Load the clang builtins module map file.">;
19611961
defm caret_diagnostics : BoolFOption<"caret-diagnostics",
@@ -3563,7 +3563,7 @@ def fno_assume_sane_operator_new : Flag<["-"], "fno-assume-sane-operator-new">,
35633563
Visibility<[ClangOption, CC1Option]>,
35643564
MarshallingInfoNegativeFlag<CodeGenOpts<"AssumeSaneOperatorNew">>;
35653565
def fno_builtin : Flag<["-"], "fno-builtin">, Group<f_Group>,
3566-
Visibility<[ClangOption, CC1Option, CLOption, DXCOption]>,
3566+
Visibility<[ClangOption, CC1Option, CLOption, DXCOption, FlangOption, FC1Option]>,
35673567
HelpText<"Disable implicit builtin knowledge of functions">;
35683568
def fno_builtin_ : Joined<["-"], "fno-builtin-">, Group<f_Group>,
35693569
Visibility<[ClangOption, CC1Option, CLOption, DXCOption]>,

clang/lib/CodeGen/BackendUtil.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -713,14 +713,16 @@ static void addSanitizers(const Triple &TargetTriple,
713713
ThinOrFullLTOPhase) {
714714
if (CodeGenOpts.hasSanitizeCoverage()) {
715715
auto SancovOpts = getSancovOptsFromCGOpts(CodeGenOpts);
716-
MPM.addPass(SanitizerCoveragePass(
717-
SancovOpts, CodeGenOpts.SanitizeCoverageAllowlistFiles,
718-
CodeGenOpts.SanitizeCoverageIgnorelistFiles));
716+
MPM.addPass(
717+
SanitizerCoveragePass(SancovOpts, PB.getVirtualFileSystemPtr(),
718+
CodeGenOpts.SanitizeCoverageAllowlistFiles,
719+
CodeGenOpts.SanitizeCoverageIgnorelistFiles));
719720
}
720721

721722
if (CodeGenOpts.hasSanitizeBinaryMetadata()) {
722723
MPM.addPass(SanitizerBinaryMetadataPass(
723724
getSanitizerBinaryMetadataOptions(CodeGenOpts),
725+
PB.getVirtualFileSystemPtr(),
724726
CodeGenOpts.SanitizeMetadataIgnorelistFiles));
725727
}
726728

clang/lib/Driver/ToolChains/Flang.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -945,6 +945,13 @@ void Flang::ConstructJob(Compilation &C, const JobAction &JA,
945945
assert(false && "Unexpected action class for Flang tool.");
946946
}
947947

948+
// We support some options that are invalid for Fortran and have no effect.
949+
// These are solely for compatibility with other compilers. Emit a warning if
950+
// any such options are provided, then proceed normally.
951+
for (options::ID Opt : {options::OPT_fbuiltin, options::OPT_fno_builtin})
952+
if (const Arg *A = Args.getLastArg(Opt))
953+
D.Diag(diag::warn_drv_invalid_argument_for_flang) << A->getSpelling();
954+
948955
const InputInfo &Input = Inputs[0];
949956
types::ID InputType = Input.getType();
950957

clang/lib/Format/WhitespaceManager.cpp

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,9 @@ AlignTokenSequence(const FormatStyle &Style, unsigned Start, unsigned End,
288288
ArrayRef<unsigned> Matches,
289289
SmallVector<WhitespaceManager::Change, 16> &Changes) {
290290
int Shift = 0;
291+
// Set when the shift is applied anywhere in the line. Cleared when the line
292+
// ends.
293+
bool LineShifted = false;
291294

292295
// ScopeStack keeps track of the current scope depth. It contains the levels
293296
// of at most 2 scopes. The first one is the one that the matched token is
@@ -339,8 +342,11 @@ AlignTokenSequence(const FormatStyle &Style, unsigned Start, unsigned End,
339342
Changes[i - 1].Tok->is(tok::string_literal);
340343
bool SkipMatchCheck = InsideNestedScope || ContinuedStringLiteral;
341344

342-
if (CurrentChange.NewlinesBefore > 0 && !SkipMatchCheck)
343-
Shift = 0;
345+
if (CurrentChange.NewlinesBefore > 0) {
346+
LineShifted = false;
347+
if (!SkipMatchCheck)
348+
Shift = 0;
349+
}
344350

345351
// If this is the first matching token to be aligned, remember by how many
346352
// spaces it has to be shifted, so the rest of the changes on the line are
@@ -349,7 +355,6 @@ AlignTokenSequence(const FormatStyle &Style, unsigned Start, unsigned End,
349355
Shift = Column - (RightJustify ? CurrentChange.TokenLength : 0) -
350356
CurrentChange.StartOfTokenColumn;
351357
ScopeStack = {CurrentChange.indentAndNestingLevel()};
352-
CurrentChange.Spaces += Shift;
353358
}
354359

355360
if (Shift == 0)
@@ -358,8 +363,10 @@ AlignTokenSequence(const FormatStyle &Style, unsigned Start, unsigned End,
358363
// This is for lines that are split across multiple lines, as mentioned in
359364
// the ScopeStack comment. The stack size being 1 means that the token is
360365
// not in a scope that should not move.
361-
if (ScopeStack.size() == 1u && CurrentChange.NewlinesBefore > 0 &&
362-
(ContinuedStringLiteral || InsideNestedScope)) {
366+
if ((!Matches.empty() && Matches[0] == i) ||
367+
(ScopeStack.size() == 1u && CurrentChange.NewlinesBefore > 0 &&
368+
(ContinuedStringLiteral || InsideNestedScope))) {
369+
LineShifted = true;
363370
CurrentChange.Spaces += Shift;
364371
}
365372

@@ -369,9 +376,11 @@ AlignTokenSequence(const FormatStyle &Style, unsigned Start, unsigned End,
369376
static_cast<int>(Changes[i].Tok->SpacesRequiredBefore) ||
370377
CurrentChange.Tok->is(tok::eof));
371378

372-
CurrentChange.StartOfTokenColumn += Shift;
373-
if (i + 1 != Changes.size())
374-
Changes[i + 1].PreviousEndOfTokenColumn += Shift;
379+
if (LineShifted) {
380+
CurrentChange.StartOfTokenColumn += Shift;
381+
if (i + 1 != Changes.size())
382+
Changes[i + 1].PreviousEndOfTokenColumn += Shift;
383+
}
375384

376385
// If PointerAlignment is PAS_Right, keep *s or &s next to the token,
377386
// except if the token is equal, then a space is needed.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# objective-CXX is not supported on AIX and zOS
2+
unsupported_platforms = [ "system-aix", "system-zos" ]
3+
4+
if any(up in config.available_features for up in unsupported_platforms):
5+
config.unsupported = True

clang/unittests/Format/FormatTest.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19615,6 +19615,25 @@ TEST_F(FormatTest, AlignConsecutiveAssignments) {
1961519615
"};",
1961619616
Alignment);
1961719617

19618+
// Aligning lines should not mess up the comments. However, feel free to
19619+
// change the test if it turns out that comments inside the closure should not
19620+
// be aligned with those outside it.
19621+
verifyFormat("auto aaaaaaaaaaaaaaaaaaaaa = {}; //\n"
19622+
"auto b = [] { //\n"
19623+
" return; //\n"
19624+
"};",
19625+
Alignment);
19626+
verifyFormat("auto aaaaaaaaaaaaaaaaaaaaa = {}; //\n"
19627+
"auto b = [] { //\n"
19628+
" return aaaaaaaaaaaaaaaaaaaaa; //\n"
19629+
"};",
19630+
Alignment);
19631+
verifyFormat("auto aaaaaaaaaaaaaaa = {}; //\n"
19632+
"auto b = [] { //\n"
19633+
" return aaaaaaaaaaaaaaaaaaaaa; //\n"
19634+
"};",
19635+
Alignment);
19636+
1961819637
verifyFormat("auto b = f(aaaaaaaaaaaaaaaaaaaaaaaaa,\n"
1961919638
" ccc ? aaaaa : bbbbb,\n"
1962019639
" dddddddddddddddddddddddddd);",

flang/test/Driver/flang-f-opts.f90

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,16 @@
1313
! CHECK-PROFILE-GENERATE-LLVM: "-fprofile-generate"
1414
! RUN: %flang -### -S -fprofile-use=%S %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-USE-DIR %s
1515
! CHECK-PROFILE-USE-DIR: "-fprofile-use={{.*}}"
16+
17+
! RUN: %flang -### -fbuiltin %s 2>&1 \
18+
! RUN: | FileCheck %s -check-prefix=WARN-BUILTIN
19+
! WARN-BUILTIN: warning: '-fbuiltin' is not valid for Fortran
20+
21+
! RUN: %flang -### -fno-builtin %s 2>&1 \
22+
! RUN: | FileCheck %s -check-prefix=WARN-NO-BUILTIN
23+
! WARN-NO-BUILTIN: warning: '-fno-builtin' is not valid for Fortran
24+
25+
! RUN: %flang -### -fbuiltin -fno-builtin %s 2>&1 \
26+
! RUN: | FileCheck %s -check-prefix=WARN-BUILTIN-MULTIPLE
27+
! WARN-BUILTIN-MULTIPLE: warning: '-fbuiltin' is not valid for Fortran
28+
! WARN-BUILTIN-MULTIPLE: warning: '-fno-builtin' is not valid for Fortran

lldb/include/lldb/Host/MainLoopBase.h

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,23 @@ class MainLoopBase {
5757
// Add a pending callback that will be executed once after all the pending
5858
// events are processed. The callback will be executed even if termination
5959
// was requested.
60-
void AddPendingCallback(const Callback &callback) {
61-
AddCallback(callback, std::chrono::steady_clock::time_point());
60+
// Returns false if an interrupt was needed to get the loop to act on the new
61+
// callback, but the interrupt failed, true otherwise. Mostly used when the
62+
// pending callback is a RequestTermination, since if the interrupt fails for
63+
// that callback, waiting for the MainLoop thread to terminate could stall.
64+
bool AddPendingCallback(const Callback &callback) {
65+
return AddCallback(callback, std::chrono::steady_clock::time_point());
6266
}
6367

6468
// Add a callback that will be executed after a certain amount of time has
65-
// passed.
66-
void AddCallback(const Callback &callback, std::chrono::nanoseconds delay) {
67-
AddCallback(callback, std::chrono::steady_clock::now() + delay);
69+
// passed. See AddPendingCallback comment for the return value.
70+
bool AddCallback(const Callback &callback, std::chrono::nanoseconds delay) {
71+
return AddCallback(callback, std::chrono::steady_clock::now() + delay);
6872
}
6973

7074
// Add a callback that will be executed after a given point in time.
71-
void AddCallback(const Callback &callback, TimePoint point);
75+
// See AddPendingCallback comment for the return value.
76+
bool AddCallback(const Callback &callback, TimePoint point);
7277

7378
// Waits for registered events and invoke the proper callbacks. Returns when
7479
// all callbacks deregister themselves or when someone requests termination.
@@ -85,8 +90,9 @@ class MainLoopBase {
8590

8691
virtual void UnregisterReadObject(IOObject::WaitableHandle handle) = 0;
8792

88-
// Interrupt the loop that is currently waiting for events.
89-
virtual void Interrupt() = 0;
93+
/// Interrupt the loop that is currently waiting for events. Return true if
94+
/// the interrupt succeeded, false if it failed.
95+
virtual bool Interrupt() = 0;
9096

9197
void ProcessCallbacks();
9298

lldb/include/lldb/Host/posix/MainLoopPosix.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class MainLoopPosix : public MainLoopBase {
5454
void UnregisterReadObject(IOObject::WaitableHandle handle) override;
5555
void UnregisterSignal(int signo, std::list<Callback>::iterator callback_it);
5656

57-
void Interrupt() override;
57+
bool Interrupt() override;
5858

5959
private:
6060
void ProcessReadObject(IOObject::WaitableHandle handle);

0 commit comments

Comments
 (0)