Skip to content

Commit c164257

Browse files
author
Jenkins
committed
merge main into amd-staging
Change-Id: Id200063a64ee23ee9f52f068ea77d329be753e88
2 parents bcedb28 + 3496927 commit c164257

File tree

52 files changed

+422
-501
lines changed

Some content is hidden

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

52 files changed

+422
-501
lines changed

clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.cpp

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,16 +151,29 @@ StringRef getEquivalentBoolLiteralForExpr(const Expr *Expression,
151151
return {};
152152
}
153153

154+
bool needsSpacePrefix(SourceLocation Loc, ASTContext &Context) {
155+
SourceRange PrefixRange(Loc.getLocWithOffset(-1), Loc);
156+
StringRef SpaceBeforeStmtStr = Lexer::getSourceText(
157+
CharSourceRange::getCharRange(PrefixRange), Context.getSourceManager(),
158+
Context.getLangOpts(), nullptr);
159+
if (SpaceBeforeStmtStr.empty())
160+
return true;
161+
162+
const StringRef AllowedCharacters(" \t\n\v\f\r(){}[]<>;,+=-|&~!^*/");
163+
return !AllowedCharacters.contains(SpaceBeforeStmtStr.back());
164+
}
165+
154166
void fixGenericExprCastFromBool(DiagnosticBuilder &Diag,
155167
const ImplicitCastExpr *Cast,
156168
ASTContext &Context, StringRef OtherType) {
157169
const Expr *SubExpr = Cast->getSubExpr();
158-
bool NeedParens = !isa<ParenExpr>(SubExpr);
170+
const bool NeedParens = !isa<ParenExpr>(SubExpr->IgnoreImplicit());
171+
const bool NeedSpace = needsSpacePrefix(Cast->getBeginLoc(), Context);
159172

160173
Diag << FixItHint::CreateInsertion(
161-
Cast->getBeginLoc(),
162-
(Twine("static_cast<") + OtherType + ">" + (NeedParens ? "(" : ""))
163-
.str());
174+
Cast->getBeginLoc(), (Twine() + (NeedSpace ? " " : "") + "static_cast<" +
175+
OtherType + ">" + (NeedParens ? "(" : ""))
176+
.str());
164177

165178
if (NeedParens) {
166179
SourceLocation EndLoc = Lexer::getLocForEndOfToken(

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,11 @@ Changes in existing checks
174174
<clang-tidy/checks/modernize/use-override>` check to also remove any trailing
175175
whitespace when deleting the ``virtual`` keyword.
176176

177+
- Improved :doc:`readability-implicit-bool-conversion
178+
<clang-tidy/checks/readability/implicit-bool-conversion>` check to provide
179+
valid fix suggestions for ``static_cast`` without a preceding space and
180+
fixed problem with duplicate parentheses in double implicit casts.
181+
177182
- Improved :doc:`readability-redundant-inline-specifier
178183
<clang-tidy/checks/readability/redundant-inline-specifier>` check to properly
179184
emit warnings for static data member with an in-class initializer.

clang-tools-extra/test/clang-tidy/checkers/readability/implicit-bool-conversion.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,3 +524,12 @@ namespace PR71867 {
524524
// CHECK-FIXES: return (x ? 1 : 0) != 0;
525525
}
526526
}
527+
528+
namespace PR71848 {
529+
int fun() {
530+
bool foo = false;
531+
return( foo );
532+
// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: implicit conversion 'bool' -> 'int' [readability-implicit-bool-conversion]
533+
// CHECK-FIXES: return static_cast<int>( foo );
534+
}
535+
}

clang/lib/CodeGen/CodeGenModule.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3994,8 +3994,7 @@ bool CodeGenModule::shouldEmitFunction(GlobalDecl GD) {
39943994
// behavior may break ABI compatibility of the current unit.
39953995
if (const Module *M = F->getOwningModule();
39963996
M && M->getTopLevelModule()->isNamedModule() &&
3997-
getContext().getCurrentNamedModule() != M->getTopLevelModule() &&
3998-
!F->hasAttr<AlwaysInlineAttr>())
3997+
getContext().getCurrentNamedModule() != M->getTopLevelModule())
39993998
return false;
40003999

40014000
if (F->hasAttr<NoInlineAttr>())

clang/test/CodeGenCXX/module-funcs-from-imports.cppm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ int use() {
5353
return exported_func() + always_inline_func();
5454
}
5555

56-
// Checks that none of the function (except the always_inline_func) in the importees
56+
// Checks that none of the function in the importees
5757
// are generated in the importer's code.
5858
// CHECK-O0: define{{.*}}_Z3usev(
5959
// CHECK-O0: declare{{.*}}_ZW1M13exported_funcv(
60-
// CHECK-O0: define{{.*}}available_externally{{.*}}_ZW1M18always_inline_funcv(
60+
// CHECK-O0: declare{{.*}}_ZW1M18always_inline_funcv(
6161
// CHECK-O0-NOT: func_in_gmf
6262
// CHECK-O0-NOT: func_in_gmf_not_called
6363
// CHECK-O0-NOT: non_exported_func
@@ -68,7 +68,7 @@ int use() {
6868
// O0 to keep consistent ABI.
6969
// CHECK-O1: define{{.*}}_Z3usev(
7070
// CHECK-O1: declare{{.*}}_ZW1M13exported_funcv(
71-
// CHECK-O1: define{{.*}}available_externally{{.*}}_ZW1M18always_inline_funcv(
71+
// CHECK-O1: declare{{.*}}_ZW1M18always_inline_funcv(
7272
// CHECK-O1-NOT: func_in_gmf
7373
// CHECK-O1-NOT: func_in_gmf_not_called
7474
// CHECK-O1-NOT: non_exported_func

flang/lib/Lower/OpenMP.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2640,7 +2640,8 @@ genParallelOp(Fortran::lower::AbstractConverter &converter,
26402640
? nullptr
26412641
: mlir::ArrayAttr::get(converter.getFirOpBuilder().getContext(),
26422642
reductionDeclSymbols),
2643-
procBindKindAttr);
2643+
procBindKindAttr, /*private_vars=*/llvm::SmallVector<mlir::Value>{},
2644+
/*privatizers=*/nullptr);
26442645
}
26452646

26462647
static mlir::omp::SectionOp

lldb/bindings/interface/SBStatisticsOptionsDocstrings.i

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,3 @@
66
) lldb::SBStatisticsOptions::SetSummaryOnly;
77
%feature("docstring", "Gets whether the statistics only dump a summary."
88
) lldb::SBStatisticsOptions::GetSummaryOnly;
9-
%feature("docstring", "
10-
Sets whether the statistics will force loading all possible debug info."
11-
) lldb::SBStatisticsOptions::SetReportAllAvailableDebugInfo;
12-
%feature("docstring", "
13-
Gets whether the statistics will force loading all possible debug info."
14-
) lldb::SBStatisticsOptions::GetReportAllAvailableDebugInfo;

lldb/include/lldb/API/SBStatisticsOptions.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,6 @@ class LLDB_API SBStatisticsOptions {
2525
void SetSummaryOnly(bool b);
2626
bool GetSummaryOnly();
2727

28-
/// If set to true, the debugger will load all debug info that is available
29-
/// and report statistics on the total amount. If this is set to false, then
30-
/// only report statistics on the currently loaded debug information.
31-
/// This can avoid loading debug info from separate files just so it can
32-
/// report the total size which can slow down statistics reporting.
33-
void SetReportAllAvailableDebugInfo(bool b);
34-
bool GetReportAllAvailableDebugInfo();
35-
3628
protected:
3729
friend class SBTarget;
3830
const lldb_private::StatisticsOptions &ref() const;

lldb/include/lldb/Symbol/SymbolFile.h

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -381,8 +381,7 @@ class SymbolFile : public PluginInterface {
381381

382382
/// Metrics gathering functions
383383

384-
/// Return the size in bytes of all loaded debug information or total possible
385-
/// debug info in the symbol file.
384+
/// Return the size in bytes of all debug information in the symbol file.
386385
///
387386
/// If the debug information is contained in sections of an ObjectFile, then
388387
/// this call should add the size of all sections that contain debug
@@ -392,14 +391,7 @@ class SymbolFile : public PluginInterface {
392391
/// entire file should be returned. The default implementation of this
393392
/// function will iterate over all sections in a module and add up their
394393
/// debug info only section byte sizes.
395-
///
396-
/// \param load_all_debug_info
397-
/// If true, force loading any symbol files if they are not yet loaded and
398-
/// add to the total size. Default to false.
399-
///
400-
/// \returns
401-
/// Total currently loaded debug info size in bytes
402-
virtual uint64_t GetDebugInfoSize(bool load_all_debug_info = false) = 0;
394+
virtual uint64_t GetDebugInfoSize() = 0;
403395

404396
/// Return the time taken to parse the debug information.
405397
///
@@ -542,7 +534,7 @@ class SymbolFileCommon : public SymbolFile {
542534

543535
void Dump(Stream &s) override;
544536

545-
uint64_t GetDebugInfoSize(bool load_all_debug_info = false) override;
537+
uint64_t GetDebugInfoSize() override;
546538

547539
bool GetDebugInfoIndexWasLoadedFromCache() const override {
548540
return m_index_was_loaded_from_cache;

lldb/include/lldb/Symbol/SymbolFileOnDemand.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ class SymbolFileOnDemand : public lldb_private::SymbolFile {
178178

179179
void PreloadSymbols() override;
180180

181-
uint64_t GetDebugInfoSize(bool load_all_debug_info = false) override;
181+
uint64_t GetDebugInfoSize() override;
182182
lldb_private::StatsDuration::Duration GetDebugInfoParseTime() override;
183183
lldb_private::StatsDuration::Duration GetDebugInfoIndexTime() override;
184184

0 commit comments

Comments
 (0)