Skip to content

Commit f04d8d9

Browse files
authored
merge main into amd-staging (llvm#1400)
2 parents 411ee79 + be5d122 commit f04d8d9

File tree

431 files changed

+56499
-51117
lines changed

Some content is hidden

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

431 files changed

+56499
-51117
lines changed

bolt/include/bolt/Core/Relocation.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ class Relocation {
5757
uint32_t Type;
5858

5959
private:
60-
/// Relocations added by optimizations can be optional.
60+
/// Relocations added by optimizations can be optional, meaning they can be
61+
/// omitted under certain circumstances.
6162
bool Optional = false;
6263

6364
public:
@@ -72,10 +73,10 @@ class Relocation {
7273
/// Return size in bytes of the given relocation \p Type.
7374
static size_t getSizeForType(uint32_t Type);
7475

75-
/// Some relocations added by optimizations are optional, meaning they can be
76-
/// omitted under certain circumstances.
7776
void setOptional() { Optional = true; }
7877

78+
bool isOptional() { return Optional; }
79+
7980
/// Return size of this relocation.
8081
size_t getSize() const { return getSizeForType(Type); }
8182

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,6 +1078,11 @@ static llvm::Error serializeIndex(ClangDocContext &CDCtx) {
10781078
std::replace(RootPathEscaped.begin(), RootPathEscaped.end(), '\\', '/');
10791079
OS << "var RootPath = \"" << RootPathEscaped << "\";\n";
10801080

1081+
llvm::SmallString<128> Base(CDCtx.Base);
1082+
std::string BaseEscaped = Base.str().str();
1083+
std::replace(BaseEscaped.begin(), BaseEscaped.end(), '\\', '/');
1084+
OS << "var Base = \"" << BaseEscaped << "\";\n";
1085+
10811086
CDCtx.Idx.sort();
10821087
llvm::json::OStream J(OS, 2);
10831088
std::function<void(Index)> IndexToJSON = [&](const Index &I) {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,10 +367,10 @@ void Index::sort() {
367367
ClangDocContext::ClangDocContext(tooling::ExecutionContext *ECtx,
368368
StringRef ProjectName, bool PublicOnly,
369369
StringRef OutDirectory, StringRef SourceRoot,
370-
StringRef RepositoryUrl,
370+
StringRef RepositoryUrl, StringRef Base,
371371
std::vector<std::string> UserStylesheets)
372372
: ECtx(ECtx), ProjectName(ProjectName), PublicOnly(PublicOnly),
373-
OutDirectory(OutDirectory), UserStylesheets(UserStylesheets) {
373+
OutDirectory(OutDirectory), UserStylesheets(UserStylesheets), Base(Base) {
374374
llvm::SmallString<128> SourceRootDir(SourceRoot);
375375
if (SourceRoot.empty())
376376
// If no SourceRoot was provided the current path is used as the default

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ struct ClangDocContext {
507507
ClangDocContext() = default;
508508
ClangDocContext(tooling::ExecutionContext *ECtx, StringRef ProjectName,
509509
bool PublicOnly, StringRef OutDirectory, StringRef SourceRoot,
510-
StringRef RepositoryUrl,
510+
StringRef RepositoryUrl, StringRef Base,
511511
std::vector<std::string> UserStylesheets);
512512
tooling::ExecutionContext *ECtx;
513513
std::string ProjectName; // Name of project clang-doc is documenting.
@@ -523,6 +523,7 @@ struct ClangDocContext {
523523
std::vector<std::string> UserStylesheets;
524524
// JavaScript files that will be imported in all HTML files.
525525
std::vector<std::string> JsScripts;
526+
StringRef Base;
526527
Index Idx;
527528
};
528529

clang-tools-extra/clang-doc/assets/index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
function genLink(Ref) {
22
// we treat the file paths different depending on if we're
33
// serving via a http server or viewing from a local
4-
var Path = window.location.protocol.startsWith("file") ?
5-
`${window.location.protocol}//${RootPath}/${Ref.Path}` :
6-
`${window.location.protocol}//${window.location.host}/${Ref.Path}`;
4+
var Path = window.location.protocol.startsWith("file")
5+
? `${window.location.protocol}//${RootPath}/${Ref.Path}`
6+
: `${window.location.protocol}//${window.location.host}/${
7+
Base}/${Ref.Path}`;
78
if (Ref.RefType === "namespace") {
89
Path = `${Path}/index.html`
910
} else if (Ref.Path === "") {

clang-tools-extra/clang-doc/tool/ClangDocMain.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ static llvm::cl::opt<std::string>
6767
llvm::cl::desc("Directory for outputting generated files."),
6868
llvm::cl::init("docs"), llvm::cl::cat(ClangDocCategory));
6969

70+
static llvm::cl::opt<std::string>
71+
BaseDirectory("base",
72+
llvm::cl::desc(R"(Base Directory for generated documentation.
73+
URLs will be rooted at this directory for HTML links.)"),
74+
llvm::cl::init(""), llvm::cl::cat(ClangDocCategory));
75+
7076
static llvm::cl::opt<bool>
7177
PublicOnly("public", llvm::cl::desc("Document only public declarations."),
7278
llvm::cl::init(false), llvm::cl::cat(ClangDocCategory));
@@ -141,8 +147,7 @@ llvm::Error getAssetFiles(clang::doc::ClangDocContext &CDCtx) {
141147
using DirIt = llvm::sys::fs::directory_iterator;
142148
std::error_code FileErr;
143149
llvm::SmallString<128> FilePath(UserAssetPath);
144-
for (DirIt DirStart = DirIt(UserAssetPath, FileErr),
145-
DirEnd;
150+
for (DirIt DirStart = DirIt(UserAssetPath, FileErr), DirEnd;
146151
!FileErr && DirStart != DirEnd; DirStart.increment(FileErr)) {
147152
FilePath = DirStart->path();
148153
if (llvm::sys::fs::is_regular_file(FilePath)) {
@@ -268,8 +273,8 @@ Example usage for a project using a compile commands database:
268273
OutDirectory,
269274
SourceRoot,
270275
RepositoryUrl,
271-
{UserStylesheets.begin(), UserStylesheets.end()}
272-
};
276+
BaseDirectory,
277+
{UserStylesheets.begin(), UserStylesheets.end()}};
273278

274279
if (Format == "html") {
275280
if (auto Err = getHtmlAssetFiles(argv[0], CDCtx)) {

clang-tools-extra/clang-tidy/misc/UseInternalLinkageCheck.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,10 @@ void UseInternalLinkageCheck::registerMatchers(MatchFinder *Finder) {
130130
isMain())))
131131
.bind("fn"),
132132
this);
133-
Finder->addMatcher(varDecl(Common, hasGlobalStorage()).bind("var"), this);
133+
Finder->addMatcher(
134+
varDecl(Common, hasGlobalStorage(), unless(hasThreadStorageDuration()))
135+
.bind("var"),
136+
this);
134137
}
135138

136139
static constexpr StringRef Message =

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,9 @@ Changes in existing checks
159159

160160
- Improved :doc:`misc-use-internal-linkage
161161
<clang-tidy/checks/misc/use-internal-linkage>` check by fix false positives
162-
for function or variable in header file which contains macro expansion.
162+
for function or variable in header file which contains macro expansion and
163+
excluding variables with ``thread_local`` storage class specifier from being
164+
matched.
163165

164166
- Improved :doc:`modernize-use-default-member-init
165167
<clang-tidy/checks/modernize/use-default-member-init>` check by matching

clang-tools-extra/docs/clang-tidy/checks/bugprone/argument-comment.rst

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,19 @@ Options
2424

2525
.. option:: StrictMode
2626

27-
When `false` (default value), the check will ignore leading and trailing
27+
When `false`, the check will ignore leading and trailing
2828
underscores and case when comparing names -- otherwise they are taken into
29-
account.
29+
account. Default is `false`.
3030

3131
.. option:: IgnoreSingleArgument
3232

33-
When `true`, the check will ignore the single argument.
33+
When `true`, the check will ignore the single argument. Default is `false`.
3434

3535
.. option:: CommentBoolLiterals
3636

3737
When `true`, the check will add argument comments in the format
3838
``/*ParameterName=*/`` right before the boolean literal argument.
39+
Default is `false`.
3940

4041
Before:
4142

@@ -55,8 +56,9 @@ After:
5556

5657
.. option:: CommentIntegerLiterals
5758

58-
When true, the check will add argument comments in the format
59+
When `true`, the check will add argument comments in the format
5960
``/*ParameterName=*/`` right before the integer literal argument.
61+
Default is `false`.
6062

6163
Before:
6264

@@ -76,8 +78,9 @@ After:
7678

7779
.. option:: CommentFloatLiterals
7880

79-
When true, the check will add argument comments in the format
81+
When `true`, the check will add argument comments in the format
8082
``/*ParameterName=*/`` right before the float/double literal argument.
83+
Default is `false`.
8184

8285
Before:
8386

@@ -97,8 +100,9 @@ After:
97100

98101
.. option:: CommentStringLiterals
99102

100-
When true, the check will add argument comments in the format
103+
When `true`, the check will add argument comments in the format
101104
``/*ParameterName=*/`` right before the string literal argument.
105+
Default is `false`.
102106

103107
Before:
104108

@@ -122,8 +126,9 @@ After:
122126

123127
.. option:: CommentCharacterLiterals
124128

125-
When true, the check will add argument comments in the format
129+
When `true`, the check will add argument comments in the format
126130
``/*ParameterName=*/`` right before the character literal argument.
131+
Default is `false`.
127132

128133
Before:
129134

@@ -143,8 +148,9 @@ After:
143148

144149
.. option:: CommentUserDefinedLiterals
145150

146-
When true, the check will add argument comments in the format
151+
When `true`, the check will add argument comments in the format
147152
``/*ParameterName=*/`` right before the user defined literal argument.
153+
Default is `false`.
148154

149155
Before:
150156

@@ -168,8 +174,9 @@ After:
168174

169175
.. option:: CommentNullPtrs
170176

171-
When true, the check will add argument comments in the format
177+
When `true`, the check will add argument comments in the format
172178
``/*ParameterName=*/`` right before the nullptr literal argument.
179+
Default is `false`.
173180

174181
Before:
175182

clang-tools-extra/test/clang-doc/assets.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: rm -rf %t && mkdir %t
2-
// RUN: clang-doc --format=html --output=%t --asset=%S/Inputs/test-assets --executor=standalone %s
2+
// RUN: clang-doc --format=html --output=%t --asset=%S/Inputs/test-assets --executor=standalone %s --base base_dir
33
// RUN: FileCheck %s -input-file=%t/index.html -check-prefix=INDEX
44
// RUN: FileCheck %s -input-file=%t/test.css -check-prefix=CSS
55
// RUN: FileCheck %s -input-file=%t/test.js -check-prefix=JS
@@ -19,4 +19,4 @@
1919
// CSS-NEXT: padding: 0;
2020
// CSS-NEXT: }
2121

22-
// JS: console.log("Hello, world!");
22+
// JS: console.log("Hello, world!");

0 commit comments

Comments
 (0)