Skip to content

Commit a905655

Browse files
committed
Merge remote-tracking branch 'upstream/release/20.x' into ldc-release/20.x
2 parents 356e996 + a7166c3 commit a905655

File tree

41 files changed

+448
-107
lines changed

Some content is hidden

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

41 files changed

+448
-107
lines changed

clang-tools-extra/clang-tidy/tool/run-clang-tidy.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def find_compilation_database(path: str) -> str:
8787

8888

8989
def get_tidy_invocation(
90-
f: str,
90+
f: Optional[str],
9191
clang_tidy_binary: str,
9292
checks: str,
9393
tmpdir: Optional[str],
@@ -147,7 +147,8 @@ def get_tidy_invocation(
147147
start.append(f"--warnings-as-errors={warnings_as_errors}")
148148
if allow_no_checks:
149149
start.append("--allow-no-checks")
150-
start.append(f)
150+
if f:
151+
start.append(f)
151152
return start
152153

153154

@@ -490,7 +491,7 @@ async def main() -> None:
490491

491492
try:
492493
invocation = get_tidy_invocation(
493-
"",
494+
None,
494495
clang_tidy_binary,
495496
args.checks,
496497
None,

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,9 @@ Improvements to clang-tidy
190190
- Fixed bug in :program:`clang-tidy` by which `HeaderFilterRegex` did not take
191191
effect when passed via the `.clang-tidy` file.
192192

193+
- Fixed bug in :program:`run_clang_tidy.py` where the program would not
194+
correctly display the checks enabled by the top-level `.clang-tidy` file.
195+
193196
New checks
194197
^^^^^^^^^^
195198

clang/include/clang/Driver/Distro.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ class Distro {
3939
DebianBullseye,
4040
DebianBookworm,
4141
DebianTrixie,
42+
DebianForky,
43+
DebianDuke,
4244
Exherbo,
4345
RHEL5,
4446
RHEL6,
@@ -128,7 +130,7 @@ class Distro {
128130
bool IsOpenSUSE() const { return DistroVal == OpenSUSE; }
129131

130132
bool IsDebian() const {
131-
return DistroVal >= DebianLenny && DistroVal <= DebianTrixie;
133+
return DistroVal >= DebianLenny && DistroVal <= DebianDuke;
132134
}
133135

134136
bool IsUbuntu() const {

clang/include/clang/Interpreter/Interpreter.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ class Interpreter {
116116
/// Compiler instance performing the incremental compilation.
117117
std::unique_ptr<CompilerInstance> CI;
118118

119+
/// An optional compiler instance for CUDA offloading
120+
std::unique_ptr<CompilerInstance> DeviceCI;
121+
119122
protected:
120123
// Derived classes can use an extended interface of the Interpreter.
121124
Interpreter(std::unique_ptr<CompilerInstance> Instance, llvm::Error &Err,

clang/lib/Driver/Distro.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,10 @@ static Distro::DistroType DetectDistro(llvm::vfs::FileSystem &VFS) {
160160
return Distro::DebianBookworm;
161161
case 13:
162162
return Distro::DebianTrixie;
163+
case 14:
164+
return Distro::DebianForky;
165+
case 15:
166+
return Distro::DebianDuke;
163167
default:
164168
return Distro::UnknownDistro;
165169
}
@@ -173,6 +177,8 @@ static Distro::DistroType DetectDistro(llvm::vfs::FileSystem &VFS) {
173177
.Case("bullseye/sid", Distro::DebianBullseye)
174178
.Case("bookworm/sid", Distro::DebianBookworm)
175179
.Case("trixie/sid", Distro::DebianTrixie)
180+
.Case("forky/sid", Distro::DebianForky)
181+
.Case("duke/sid", Distro::DebianDuke)
176182
.Default(Distro::UnknownDistro);
177183
}
178184

clang/lib/Format/UnwrappedLineParser.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2581,7 +2581,8 @@ bool UnwrappedLineParser::parseParens(TokenType AmpAmpTokenType) {
25812581
if (Prev) {
25822582
auto OptionalParens = [&] {
25832583
if (MightBeStmtExpr || MightBeFoldExpr || Line->InMacroBody ||
2584-
SeenComma || Style.RemoveParentheses == FormatStyle::RPS_Leave) {
2584+
SeenComma || Style.RemoveParentheses == FormatStyle::RPS_Leave ||
2585+
RParen->getPreviousNonComment() == LParen) {
25852586
return false;
25862587
}
25872588
const bool DoubleParens =

clang/lib/Interpreter/DeviceOffload.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,12 @@
2525
namespace clang {
2626

2727
IncrementalCUDADeviceParser::IncrementalCUDADeviceParser(
28-
std::unique_ptr<CompilerInstance> DeviceInstance,
29-
CompilerInstance &HostInstance,
28+
CompilerInstance &DeviceInstance, CompilerInstance &HostInstance,
3029
llvm::IntrusiveRefCntPtr<llvm::vfs::InMemoryFileSystem> FS,
3130
llvm::Error &Err, const std::list<PartialTranslationUnit> &PTUs)
32-
: IncrementalParser(*DeviceInstance, Err), PTUs(PTUs), VFS(FS),
31+
: IncrementalParser(DeviceInstance, Err), PTUs(PTUs), VFS(FS),
3332
CodeGenOpts(HostInstance.getCodeGenOpts()),
34-
TargetOpts(DeviceInstance->getTargetOpts()) {
33+
TargetOpts(DeviceInstance.getTargetOpts()) {
3534
if (Err)
3635
return;
3736
StringRef Arch = TargetOpts.CPU;
@@ -41,7 +40,6 @@ IncrementalCUDADeviceParser::IncrementalCUDADeviceParser(
4140
llvm::inconvertibleErrorCode()));
4241
return;
4342
}
44-
DeviceCI = std::move(DeviceInstance);
4543
}
4644

4745
llvm::Expected<llvm::StringRef> IncrementalCUDADeviceParser::GeneratePTX() {

clang/lib/Interpreter/DeviceOffload.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ class IncrementalCUDADeviceParser : public IncrementalParser {
2828

2929
public:
3030
IncrementalCUDADeviceParser(
31-
std::unique_ptr<CompilerInstance> DeviceInstance,
32-
CompilerInstance &HostInstance,
31+
CompilerInstance &DeviceInstance, CompilerInstance &HostInstance,
3332
llvm::IntrusiveRefCntPtr<llvm::vfs::InMemoryFileSystem> VFS,
3433
llvm::Error &Err, const std::list<PartialTranslationUnit> &PTUs);
3534

@@ -42,7 +41,6 @@ class IncrementalCUDADeviceParser : public IncrementalParser {
4241
~IncrementalCUDADeviceParser();
4342

4443
protected:
45-
std::unique_ptr<CompilerInstance> DeviceCI;
4644
int SMVersion;
4745
llvm::SmallString<1024> PTXCode;
4846
llvm::SmallVector<char, 1024> FatbinContent;

clang/lib/Interpreter/Interpreter.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,10 @@ Interpreter::Interpreter(std::unique_ptr<CompilerInstance> Instance,
416416
Interpreter::~Interpreter() {
417417
IncrParser.reset();
418418
Act->FinalizeAction();
419+
if (DeviceParser)
420+
DeviceParser.reset();
421+
if (DeviceAct)
422+
DeviceAct->FinalizeAction();
419423
if (IncrExecutor) {
420424
if (llvm::Error Err = IncrExecutor->cleanUp())
421425
llvm::report_fatal_error(
@@ -501,8 +505,11 @@ Interpreter::createWithCUDA(std::unique_ptr<CompilerInstance> CI,
501505

502506
DCI->ExecuteAction(*Interp->DeviceAct);
503507

508+
Interp->DeviceCI = std::move(DCI);
509+
504510
auto DeviceParser = std::make_unique<IncrementalCUDADeviceParser>(
505-
std::move(DCI), *Interp->getCompilerInstance(), IMVFS, Err, Interp->PTUs);
511+
*Interp->DeviceCI, *Interp->getCompilerInstance(), IMVFS, Err,
512+
Interp->PTUs);
506513

507514
if (Err)
508515
return std::move(Err);

clang/lib/Parse/ParseExpr.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2237,8 +2237,6 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) {
22372237
if (PP.isCodeCompletionReached() && !CalledSignatureHelp)
22382238
RunSignatureHelp();
22392239
LHS = ExprError();
2240-
} else if (!HasError && HasTrailingComma) {
2241-
Diag(Tok, diag::err_expected_expression);
22422240
} else if (LHS.isInvalid()) {
22432241
for (auto &E : ArgExprs)
22442242
Actions.CorrectDelayedTyposInExpr(E);
@@ -3738,7 +3736,6 @@ bool Parser::ParseExpressionList(SmallVectorImpl<Expr *> &Exprs,
37383736
if (Tok.is(tok::r_paren)) {
37393737
if (HasTrailingComma)
37403738
*HasTrailingComma = true;
3741-
break;
37423739
}
37433740
}
37443741
if (SawError) {

0 commit comments

Comments
 (0)