Skip to content

Commit 3ccc691

Browse files
committed
Merge from 'main' to 'sycl-web' (#35)
CONFLICT (content): Merge conflict in clang/include/clang/Driver/Options.td
2 parents 7a7401f + 791634b commit 3ccc691

File tree

132 files changed

+6130
-1723
lines changed

Some content is hidden

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

132 files changed

+6130
-1723
lines changed

clang-tools-extra/clangd/FindSymbols.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,10 @@ class DocumentOutline {
247247
enum class VisitKind { No, OnlyDecl, OnlyChildren, DeclAndChildren };
248248

249249
void traverseDecl(Decl *D, std::vector<DocumentSymbol> &Results) {
250+
// Skip symbols which do not originate from the main file.
251+
if (!isInsideMainFile(D->getLocation(), AST.getSourceManager()))
252+
return;
253+
250254
if (auto *Templ = llvm::dyn_cast<TemplateDecl>(D)) {
251255
// TemplatedDecl might be null, e.g. concepts.
252256
if (auto *TD = Templ->getTemplatedDecl())

clang-tools-extra/clangd/GlobalCompilationDatabase.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,8 @@ parseJSON(PathRef Path, llvm::StringRef Data, std::string &Error) {
271271
}
272272
static std::unique_ptr<tooling::CompilationDatabase>
273273
parseFixed(PathRef Path, llvm::StringRef Data, std::string &Error) {
274-
return tooling::FixedCompilationDatabase::loadFromBuffer(Path, Data, Error);
274+
return tooling::FixedCompilationDatabase::loadFromBuffer(
275+
llvm::sys::path::parent_path(Path), Data, Error);
275276
}
276277

277278
bool DirectoryBasedGlobalCompilationDatabase::DirectoryCache::load(

clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,15 @@ bool isDeducedAsLambda(const SelectionTree::Node *Node, SourceLocation Loc) {
8282
return false;
8383
}
8484

85+
// Returns true iff "auto" in Node is really part of the template parameter,
86+
// which we cannot expand.
87+
bool isTemplateParam(const SelectionTree::Node *Node) {
88+
if (Node->Parent)
89+
if (Node->Parent->ASTNode.get<NonTypeTemplateParmDecl>())
90+
return true;
91+
return false;
92+
}
93+
8594
bool ExpandAutoType::prepare(const Selection& Inputs) {
8695
CachedLocation = llvm::None;
8796
if (auto *Node = Inputs.ASTSelection.commonAncestor()) {
@@ -90,7 +99,8 @@ bool ExpandAutoType::prepare(const Selection& Inputs) {
9099
// Code in apply() does handle 'decltype(auto)' yet.
91100
if (!Result.getTypePtr()->isDecltypeAuto() &&
92101
!isStructuredBindingType(Node) &&
93-
!isDeducedAsLambda(Node, Result.getBeginLoc()))
102+
!isDeducedAsLambda(Node, Result.getBeginLoc()) &&
103+
!isTemplateParam(Node))
94104
CachedLocation = Result;
95105
}
96106
}

clang-tools-extra/clangd/unittests/FindSymbolsTests.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,11 +523,13 @@ TEST(DocumentSymbols, InHeaderFile) {
523523
}
524524
)cpp";
525525
TU.Code = R"cpp(
526+
int i; // declaration to finish preamble
526527
#include "bar.h"
527528
int test() {
528529
}
529530
)cpp";
530-
EXPECT_THAT(getSymbols(TU.build()), ElementsAre(WithName("test")));
531+
EXPECT_THAT(getSymbols(TU.build()),
532+
ElementsAre(WithName("i"), WithName("test")));
531533
}
532534

533535
TEST(DocumentSymbols, Template) {

clang-tools-extra/clangd/unittests/GlobalCompilationDatabaseTests.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,17 @@ TEST(GlobalCompilationDatabaseTest, BuildDir) {
279279
<< "x/build/compile_flags.json only applicable to x/";
280280
}
281281

282+
TEST(GlobalCompilationDatabaseTest, CompileFlagsDirectory) {
283+
MockFS FS;
284+
FS.Files[testPath("x/compile_flags.txt")] = "-DFOO";
285+
DirectoryBasedGlobalCompilationDatabase CDB(FS);
286+
auto Commands = CDB.getCompileCommand(testPath("x/y.cpp"));
287+
ASSERT_TRUE(Commands.hasValue());
288+
EXPECT_THAT(Commands.getValue().CommandLine, Contains("-DFOO"));
289+
// Make sure we pick the right working directory.
290+
EXPECT_EQ(testPath("x"), Commands.getValue().Directory);
291+
}
292+
282293
TEST(GlobalCompilationDatabaseTest, NonCanonicalFilenames) {
283294
OverlayCDB DB(nullptr);
284295
std::vector<std::string> DiscoveredFiles;

clang-tools-extra/clangd/unittests/tweaks/ExpandAutoTypeTests.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ TEST_F(ExpandAutoTypeTest, Test) {
8080
// unknown types in a template should not be replaced
8181
EXPECT_THAT(apply("template <typename T> void x() { ^auto y = T::z(); }"),
8282
StartsWith("fail: Could not deduce type for 'auto' type"));
83+
84+
ExtraArgs.push_back("-std=c++17");
85+
EXPECT_UNAVAILABLE("template <au^to X> class Y;");
8386
}
8487

8588
} // namespace

clang/docs/OpenCLSupport.rst

Lines changed: 33 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -67,40 +67,39 @@ OpenCL 3.0 Implementation Status
6767
The following table provides an overview of features in OpenCL C 3.0 and their
6868
implementation status.
6969

70-
+------------------------------+--------------------------------------------------------------+----------------------+----------------------- ----------------------------------------------------+
71-
| Category | Feature | Status | Reviews |
72-
+==============================+==============================================================+======================+======================= ====================================================+
73-
| Command line interface | New value for ``-cl-std`` flag | :good:`done` | https://reviews.llvm.o rg/D88300 |
74-
+------------------------------+--------------------------------------------------------------+----------------------+----------------------- ----------------------------------------------------+
75-
| Predefined macros | New version macro | :good:`done` | https://reviews.llvm.o rg/D88300 |
76-
+------------------------------+--------------------------------------------------------------+----------------------+----------------------- ----------------------------------------------------+
77-
| Predefined macros | Feature macros | :part:`worked on` | https://reviews.llvm.o rg/D89869 |
78-
+------------------------------+--------------------------------------------------------------+----------------------+----------------------- ----------------------------------------------------+
79-
| Feature optionality | Generic address space | :none:`unclaimed` | |
80-
+------------------------------+--------------------------------------------------------------+----------------------+----------------------- ----------------------------------------------------+
81-
| Feature optionality | Builtin function overloads with generic address space | :part:`worked on` | https://reviews.llvm.o rg/D92004 |
82-
83-
+------------------------------+--------------------------------------------------------------+----------------------+----------------------- ----------------------------------------------------+
84-
| Feature optionality | Program scope variables in global memory | :none:`unclaimed` | |
85-
+------------------------------+--------------------------------------------------------------+----------------------+----------------------- ----------------------------------------------------+
86-
| Feature optionality | 3D image writes including builtin functions | :none:`unclaimed` | |
87-
+------------------------------+--------------------------------------------------------------+----------------------+----------------------- ----------------------------------------------------+
88-
| Feature optionality | read_write images including builtin functions | :none:`unclaimed` | |
89-
+------------------------------+--------------------------------------------------------------+----------------------+----------------------- ----------------------------------------------------+
90-
| Feature optionality | C11 atomics memory scopes, ordering and builtin function | :part:`worked on` | https://reviews.llvm.o rg/D92004 (functions only) |
91-
+------------------------------+--------------------------------------------------------------+----------------------+----------------------- ----------------------------------------------------+
92-
| Feature optionality | Device-side kernel enqueue including builtin functions | :none:`unclaimed` | |
93-
+------------------------------+--------------------------------------------------------------+----------------------+----------------------- ----------------------------------------------------+
94-
| Feature optionality | Pipes including builtin functions | :part:`worked on` | https://reviews.llvm.o rg/D92004 (functions only) |
95-
+------------------------------+--------------------------------------------------------------+----------------------+----------------------- ----------------------------------------------------+
96-
| Feature optionality | Work group collective functions | :part:`worked on` | https://reviews.llvm.o rg/D92004 |
97-
+------------------------------+--------------------------------------------------------------+----------------------+----------------------- ----------------------------------------------------+
98-
| New functionality | RGBA vector components | :none:`unclaimed` | |
99-
+------------------------------+--------------------------------------------------------------+----------------------+----------------------- ----------------------------------------------------+
100-
| New functionality | Subgroup functions | :part:`worked on` | https://reviews.llvm.o rg/D92004 |
101-
+------------------------------+--------------------------------------------------------------+----------------------+----------------------- ----------------------------------------------------+
102-
| New functionality | Atomic mem scopes: subgroup, all devices including functions | :part:`worked on` | https://reviews.llvm.o rg/D92004 (functions only) |
103-
+------------------------------+--------------------------------------------------------------+----------------------+----------------------- ----------------------------------------------------+
70+
+------------------------------+--------------------------------------------------------------+----------------------+---------------------------------------------------------------------------+
71+
| Category | Feature | Status | Reviews |
72+
+==============================+==============================================================+======================+===========================================================================+
73+
| Command line interface | New value for ``-cl-std`` flag | :good:`done` | https://reviews.llvm.org/D88300 |
74+
+------------------------------+--------------------------------------------------------------+----------------------+---------------------------------------------------------------------------+
75+
| Predefined macros | New version macro | :good:`done` | https://reviews.llvm.org/D88300 |
76+
+------------------------------+--------------------------------------------------------------+----------------------+---------------------------------------------------------------------------+
77+
| Predefined macros | Feature macros | :part:`worked on` | https://reviews.llvm.org/D89869 |
78+
+------------------------------+--------------------------------------------------------------+----------------------+---------------------------------------------------------------------------+
79+
| Feature optionality | Generic address space | :none:`unclaimed` | |
80+
+------------------------------+--------------------------------------------------------------+----------------------+---------------------------------------------------------------------------+
81+
| Feature optionality | Builtin function overloads with generic address space | :part:`worked on` | https://reviews.llvm.org/D92004 |
82+
+------------------------------+--------------------------------------------------------------+----------------------+---------------------------------------------------------------------------+
83+
| Feature optionality | Program scope variables in global memory | :none:`unclaimed` | |
84+
+------------------------------+--------------------------------------------------------------+----------------------+---------------------------------------------------------------------------+
85+
| Feature optionality | 3D image writes including builtin functions | :none:`unclaimed` | |
86+
+------------------------------+--------------------------------------------------------------+----------------------+---------------------------------------------------------------------------+
87+
| Feature optionality | read_write images including builtin functions | :none:`unclaimed` | |
88+
+------------------------------+--------------------------------------------------------------+----------------------+---------------------------------------------------------------------------+
89+
| Feature optionality | C11 atomics memory scopes, ordering and builtin function | :part:`worked on` | https://reviews.llvm.org/D92004 (functions only) |
90+
+------------------------------+--------------------------------------------------------------+----------------------+---------------------------------------------------------------------------+
91+
| Feature optionality | Device-side kernel enqueue including builtin functions | :none:`unclaimed` | |
92+
+------------------------------+--------------------------------------------------------------+----------------------+---------------------------------------------------------------------------+
93+
| Feature optionality | Pipes including builtin functions | :part:`worked on` | https://reviews.llvm.org/D92004 (functions only) |
94+
+------------------------------+--------------------------------------------------------------+----------------------+---------------------------------------------------------------------------+
95+
| Feature optionality | Work group collective functions | :part:`worked on` | https://reviews.llvm.org/D92004 |
96+
+------------------------------+--------------------------------------------------------------+----------------------+---------------------------------------------------------------------------+
97+
| New functionality | RGBA vector components | :none:`unclaimed` | |
98+
+------------------------------+--------------------------------------------------------------+----------------------+---------------------------------------------------------------------------+
99+
| New functionality | Subgroup functions | :part:`worked on` | https://reviews.llvm.org/D92004 |
100+
+------------------------------+--------------------------------------------------------------+----------------------+---------------------------------------------------------------------------+
101+
| New functionality | Atomic mem scopes: subgroup, all devices including functions | :part:`worked on` | https://reviews.llvm.org/D92004 (functions only) |
102+
+------------------------------+--------------------------------------------------------------+----------------------+---------------------------------------------------------------------------+
104103

105104
.. _opencl_experimenal:
106105

clang/include/clang/Driver/Options.td

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5301,14 +5301,15 @@ def fdefault_calling_conv_EQ : Joined<["-"], "fdefault-calling-conv=">,
53015301
NormalizedValuesScope<"LangOptions">,
53025302
NormalizedValues<["DCC_CDecl", "DCC_FastCall", "DCC_StdCall", "DCC_VectorCall", "DCC_RegCall"]>,
53035303
MarshallingInfoString<LangOpts<"DefaultCallingConv">, "DCC_None">, AutoNormalizeEnum;
5304+
5305+
// These options cannot be marshalled, because they are used to set up the LangOptions defaults.
53045306
def finclude_default_header : Flag<["-"], "finclude-default-header">,
5305-
HelpText<"Include default header file for OpenCL">,
5306-
MarshallingInfoFlag<LangOpts<"IncludeDefaultHeader">>;
5307+
HelpText<"Include default header file for OpenCL">;
53075308
def fdeclare_opencl_builtins : Flag<["-"], "fdeclare-opencl-builtins">,
5308-
HelpText<"Add OpenCL builtin function declarations (experimental)">,
5309-
MarshallingInfoFlag<LangOpts<"DeclareOpenCLBuiltins">>;
5309+
HelpText<"Add OpenCL builtin function declarations (experimental)">;
53105310
def fdeclare_spirv_builtins : Flag<["-"], "fdeclare-spirv-builtins">,
53115311
HelpText<"Add SPIR-V builtin function declarations (experimental)">;
5312+
53125313
def fpreserve_vec3_type : Flag<["-"], "fpreserve-vec3-type">,
53135314
HelpText<"Preserve 3-component vector type">,
53145315
MarshallingInfoFlag<CodeGenOpts<"PreserveVec3Type">>;

0 commit comments

Comments
 (0)