Skip to content

Commit 71d4fed

Browse files
Merge branch 'llvm:main' into gh-101657
2 parents 3bc2ab8 + d02a704 commit 71d4fed

File tree

1,363 files changed

+20487
-93065
lines changed

Some content is hidden

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

1,363 files changed

+20487
-93065
lines changed

.ci/generate_test_report_lib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def plural(num_tests):
9292
]
9393
)
9494
elif failures:
95-
report.extend(["", "## Failed Tests", "(click to see output)"])
95+
report.extend(["", "## Failed Tests", "(click on a test name to see its output)"])
9696

9797
for testsuite_name, failures in failures.items():
9898
report.extend(["", f"### {testsuite_name}"])

.ci/generate_test_report_lib_test.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
# See https://llvm.org/LICENSE.txt for license information.
33
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44

5+
# To run these tests:
6+
# python -m unittest generate_test_report_lib_test.py
7+
58
import unittest
69
from io import StringIO
710
from textwrap import dedent
@@ -150,7 +153,7 @@ def test_report_single_file_single_testsuite(self):
150153
* 2 tests failed
151154
152155
## Failed Tests
153-
(click to see output)
156+
(click on a test name to see its output)
154157
155158
### Bar
156159
<details>
@@ -182,7 +185,7 @@ def test_report_single_file_single_testsuite(self):
182185
* 2 tests failed
183186
184187
## Failed Tests
185-
(click to see output)
188+
(click on a test name to see its output)
186189
187190
### ABC
188191
<details>

clang-tools-extra/clang-doc/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ set(LLVM_LINK_COMPONENTS
33
BitstreamReader
44
FrontendOpenMP
55
)
6+
add_subdirectory(support)
67

78
add_clang_library(clangDoc STATIC
89
BitcodeReader.cpp
@@ -23,6 +24,7 @@ add_clang_library(clangDoc STATIC
2324

2425
clang_target_link_libraries(clangDoc
2526
PRIVATE
27+
clangDocSupport
2628
clangAnalysis
2729
clangAST
2830
clangASTMatchers

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

Lines changed: 1 addition & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#include "Generators.h"
1010
#include "Representation.h"
11+
#include "support/File.h"
1112
#include "clang/Basic/Version.h"
1213
#include "llvm/ADT/StringExtras.h"
1314
#include "llvm/ADT/StringRef.h"
@@ -251,47 +252,6 @@ static void appendVector(std::vector<Derived> &&New,
251252
std::move(New.begin(), New.end(), std::back_inserter(Original));
252253
}
253254

254-
// Compute the relative path from an Origin directory to a Destination directory
255-
static SmallString<128> computeRelativePath(StringRef Destination,
256-
StringRef Origin) {
257-
// If Origin is empty, the relative path to the Destination is its complete
258-
// path.
259-
if (Origin.empty())
260-
return Destination;
261-
262-
// The relative path is an empty path if both directories are the same.
263-
if (Destination == Origin)
264-
return {};
265-
266-
// These iterators iterate through each of their parent directories
267-
llvm::sys::path::const_iterator FileI = llvm::sys::path::begin(Destination);
268-
llvm::sys::path::const_iterator FileE = llvm::sys::path::end(Destination);
269-
llvm::sys::path::const_iterator DirI = llvm::sys::path::begin(Origin);
270-
llvm::sys::path::const_iterator DirE = llvm::sys::path::end(Origin);
271-
// Advance both iterators until the paths differ. Example:
272-
// Destination = A/B/C/D
273-
// Origin = A/B/E/F
274-
// FileI will point to C and DirI to E. The directories behind them is the
275-
// directory they share (A/B).
276-
while (FileI != FileE && DirI != DirE && *FileI == *DirI) {
277-
++FileI;
278-
++DirI;
279-
}
280-
SmallString<128> Result; // This will hold the resulting path.
281-
// Result has to go up one directory for each of the remaining directories in
282-
// Origin
283-
while (DirI != DirE) {
284-
llvm::sys::path::append(Result, "..");
285-
++DirI;
286-
}
287-
// Result has to append each of the remaining directories in Destination
288-
while (FileI != FileE) {
289-
llvm::sys::path::append(Result, *FileI);
290-
++FileI;
291-
}
292-
return Result;
293-
}
294-
295255
// HTML generation
296256

297257
static std::vector<std::unique_ptr<TagNode>>
@@ -1138,23 +1098,6 @@ static llvm::Error genIndex(const ClangDocContext &CDCtx) {
11381098
return llvm::Error::success();
11391099
}
11401100

1141-
static llvm::Error copyFile(StringRef FilePath, StringRef OutDirectory) {
1142-
llvm::SmallString<128> PathWrite;
1143-
llvm::sys::path::native(OutDirectory, PathWrite);
1144-
llvm::sys::path::append(PathWrite, llvm::sys::path::filename(FilePath));
1145-
llvm::SmallString<128> PathRead;
1146-
llvm::sys::path::native(FilePath, PathRead);
1147-
std::error_code OK;
1148-
std::error_code FileErr = llvm::sys::fs::copy_file(PathRead, PathWrite);
1149-
if (FileErr != OK) {
1150-
return llvm::createStringError(llvm::inconvertibleErrorCode(),
1151-
"error creating file " +
1152-
llvm::sys::path::filename(FilePath) +
1153-
": " + FileErr.message() + "\n");
1154-
}
1155-
return llvm::Error::success();
1156-
}
1157-
11581101
llvm::Error HTMLGenerator::createResources(ClangDocContext &CDCtx) {
11591102
auto Err = serializeIndex(CDCtx);
11601103
if (Err)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# clang-doc/support contains support libraries that do not depend
2+
# on clang either programmatically or conceptually.
3+
set(LLVM_LINK_COMPONENTS
4+
Support
5+
)
6+
7+
add_clang_library(clangDocSupport STATIC
8+
File.cpp
9+
)
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
#include "File.h"
9+
#include "llvm/Support/FileSystem.h"
10+
#include "llvm/Support/Path.h"
11+
12+
namespace clang {
13+
namespace doc {
14+
15+
llvm::Error copyFile(llvm::StringRef FilePath, llvm::StringRef OutDirectory) {
16+
llvm::SmallString<128> PathWrite;
17+
llvm::sys::path::native(OutDirectory, PathWrite);
18+
llvm::sys::path::append(PathWrite, llvm::sys::path::filename(FilePath));
19+
llvm::SmallString<128> PathRead;
20+
llvm::sys::path::native(FilePath, PathRead);
21+
std::error_code FileErr = llvm::sys::fs::copy_file(PathRead, PathWrite);
22+
if (FileErr) {
23+
return llvm::createStringError(llvm::inconvertibleErrorCode(),
24+
"error creating file " +
25+
llvm::sys::path::filename(FilePath) +
26+
": " + FileErr.message() + "\n");
27+
}
28+
return llvm::Error::success();
29+
}
30+
31+
llvm::SmallString<128> computeRelativePath(llvm::StringRef Destination,
32+
llvm::StringRef Origin) {
33+
// If Origin is empty, the relative path to the Destination is its complete
34+
// path.
35+
if (Origin.empty())
36+
return Destination;
37+
38+
// The relative path is an empty path if both directories are the same.
39+
if (Destination == Origin)
40+
return {};
41+
42+
// These iterators iterate through each of their parent directories
43+
llvm::sys::path::const_iterator FileI = llvm::sys::path::begin(Destination);
44+
llvm::sys::path::const_iterator FileE = llvm::sys::path::end(Destination);
45+
llvm::sys::path::const_iterator DirI = llvm::sys::path::begin(Origin);
46+
llvm::sys::path::const_iterator DirE = llvm::sys::path::end(Origin);
47+
// Advance both iterators until the paths differ. Example:
48+
// Destination = A/B/C/D
49+
// Origin = A/B/E/F
50+
// FileI will point to C and DirI to E. The directories behind them is the
51+
// directory they share (A/B).
52+
while (FileI != FileE && DirI != DirE && *FileI == *DirI) {
53+
++FileI;
54+
++DirI;
55+
}
56+
llvm::SmallString<128> Result; // This will hold the resulting path.
57+
// Result has to go up one directory for each of the remaining directories in
58+
// Origin
59+
while (DirI != DirE) {
60+
llvm::sys::path::append(Result, "..");
61+
++DirI;
62+
}
63+
// Result has to append each of the remaining directories in Destination
64+
while (FileI != FileE) {
65+
llvm::sys::path::append(Result, *FileI);
66+
++FileI;
67+
}
68+
return Result;
69+
}
70+
71+
} // namespace doc
72+
} // namespace clang
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_DOC_FILE_H
9+
#define LLVM_CLANG_TOOLS_EXTRA_CLANG_DOC_FILE_H
10+
11+
#include "llvm/ADT/StringExtras.h"
12+
#include "llvm/Support/Error.h"
13+
14+
namespace clang {
15+
namespace doc {
16+
17+
llvm::Error copyFile(llvm::StringRef FilePath, llvm::StringRef OutDirectory);
18+
19+
llvm::SmallString<128> computeRelativePath(llvm::StringRef Destination,
20+
llvm::StringRef Origin);
21+
22+
} // namespace doc
23+
} // namespace clang
24+
25+
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_DOC_FILE_H

clang/docs/ReleaseNotes.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,10 @@ Bug Fixes to Attribute Support
386386
or too few attribute argument indicies for the specified callback function.
387387
(#GH47451)
388388

389+
- No longer crashing on ``__attribute__((align_value(N)))`` during template
390+
instantiation when the function parameter type is not a pointer or reference.
391+
(#GH26612)
392+
389393
Bug Fixes to C++ Support
390394
^^^^^^^^^^^^^^^^^^^^^^^^
391395

clang/include/clang/AST/DeclCXX.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4166,7 +4166,7 @@ class StaticAssertDecl : public Decl {
41664166
/// DecompositionDecl of type 'int (&)[3]'.
41674167
class BindingDecl : public ValueDecl {
41684168
/// The declaration that this binding binds to part of.
4169-
ValueDecl *Decomp;
4169+
ValueDecl *Decomp = nullptr;
41704170
/// The binding represented by this declaration. References to this
41714171
/// declaration are effectively equivalent to this expression (except
41724172
/// that it is only evaluated once at the point of declaration of the

clang/include/clang/AST/OpenACCClause.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ class OpenACCClause {
3838
OpenACCClauseKind getClauseKind() const { return Kind; }
3939
SourceLocation getBeginLoc() const { return Location.getBegin(); }
4040
SourceLocation getEndLoc() const { return Location.getEnd(); }
41+
SourceRange getSourceRange() const { return Location; }
4142

4243
static bool classof(const OpenACCClause *) { return true; }
4344

@@ -1315,11 +1316,13 @@ template <class Impl> class OpenACCClauseVisitor {
13151316
switch (C->getClauseKind()) {
13161317
#define VISIT_CLAUSE(CLAUSE_NAME) \
13171318
case OpenACCClauseKind::CLAUSE_NAME: \
1318-
Visit##CLAUSE_NAME##Clause(*cast<OpenACC##CLAUSE_NAME##Clause>(C)); \
1319+
getDerived().Visit##CLAUSE_NAME##Clause( \
1320+
*cast<OpenACC##CLAUSE_NAME##Clause>(C)); \
13191321
return;
13201322
#define CLAUSE_ALIAS(ALIAS_NAME, CLAUSE_NAME, DEPRECATED) \
13211323
case OpenACCClauseKind::ALIAS_NAME: \
1322-
Visit##CLAUSE_NAME##Clause(*cast<OpenACC##CLAUSE_NAME##Clause>(C)); \
1324+
getDerived().Visit##CLAUSE_NAME##Clause( \
1325+
*cast<OpenACC##CLAUSE_NAME##Clause>(C)); \
13231326
return;
13241327
#include "clang/Basic/OpenACCClauses.def"
13251328

@@ -1332,7 +1335,7 @@ template <class Impl> class OpenACCClauseVisitor {
13321335
#define VISIT_CLAUSE(CLAUSE_NAME) \
13331336
void Visit##CLAUSE_NAME##Clause( \
13341337
const OpenACC##CLAUSE_NAME##Clause &Clause) { \
1335-
return getDerived().Visit##CLAUSE_NAME##Clause(Clause); \
1338+
return getDerived().VisitClause(Clause); \
13361339
}
13371340

13381341
#include "clang/Basic/OpenACCClauses.def"

0 commit comments

Comments
 (0)