Skip to content

Commit 7131c31

Browse files
committed
Merge from 'main' to 'sycl-web' (#4)
Expected to build-fail until the next commit 2c03d92. CONFLICT (content): Merge conflict in llvm/unittests/Passes/CMakeLists.txt
2 parents 91ea564 + 2e4ec3e commit 7131c31

File tree

1,644 files changed

+168390
-36607
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,644 files changed

+168390
-36607
lines changed

clang-tools-extra/clangd/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# This is a no-op for building files in this dir, but is inherited by subdirs.
2+
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
3+
include_directories(${CMAKE_CURRENT_BINARY_DIR})
4+
15
add_subdirectory(support)
26

37
# Configure the Features.inc file.

clang-tools-extra/clangd/InlayHints.cpp

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@ class InlayHintVisitor : public RecursiveASTVisitor<InlayHintVisitor> {
3232
TypeHintPolicy.SuppressScope = true; // keep type names short
3333
TypeHintPolicy.AnonymousTagLocations =
3434
false; // do not print lambda locations
35+
// Print canonical types. Otherwise, SuppressScope would result in
36+
// things like "metafunction<args>::type" being shorted to just "type",
37+
// which is useless. This is particularly important for structured
38+
// bindings that use the tuple_element protocol, where the non-canonical
39+
// types would be "tuple_element<I, A>::type".
40+
// Note, for "auto", we would often prefer sugared types, but the AST
41+
// doesn't currently retain them in DeducedType anyways.
42+
TypeHintPolicy.PrintCanonicalTypes = true;
3543
}
3644

3745
bool VisitCXXConstructExpr(CXXConstructExpr *E) {
@@ -76,20 +84,23 @@ class InlayHintVisitor : public RecursiveASTVisitor<InlayHintVisitor> {
7684
if (auto *AT = D->getReturnType()->getContainedAutoType()) {
7785
QualType Deduced = AT->getDeducedType();
7886
if (!Deduced.isNull()) {
79-
addInlayHint(D->getFunctionTypeLoc().getRParenLoc(),
80-
InlayHintKind::TypeHint,
81-
"-> " + D->getReturnType().getAsString(TypeHintPolicy));
87+
addTypeHint(D->getFunctionTypeLoc().getRParenLoc(), D->getReturnType(),
88+
"-> ");
8289
}
8390
}
8491

8592
return true;
8693
}
8794

8895
bool VisitVarDecl(VarDecl *D) {
89-
// Do not show hints for the aggregate in a structured binding.
90-
// In the future, we may show hints for the individual bindings.
91-
if (isa<DecompositionDecl>(D))
96+
// Do not show hints for the aggregate in a structured binding,
97+
// but show hints for the individual bindings.
98+
if (auto *DD = dyn_cast<DecompositionDecl>(D)) {
99+
for (auto *Binding : DD->bindings()) {
100+
addTypeHint(Binding->getLocation(), Binding->getType(), ": ");
101+
}
92102
return true;
103+
}
93104

94105
if (D->getType()->getContainedAutoType()) {
95106
if (!D->getType()->isDependentType()) {
@@ -98,8 +109,7 @@ class InlayHintVisitor : public RecursiveASTVisitor<InlayHintVisitor> {
98109
// (e.g. for `const auto& x = 42`, print `const int&`).
99110
// Alternatively, we could place the hint on the `auto`
100111
// (and then just print the type deduced for the `auto`).
101-
addInlayHint(D->getLocation(), InlayHintKind::TypeHint,
102-
": " + D->getType().getAsString(TypeHintPolicy));
112+
addTypeHint(D->getLocation(), D->getType(), ": ");
103113
}
104114
}
105115
return true;
@@ -311,6 +321,15 @@ class InlayHintVisitor : public RecursiveASTVisitor<InlayHintVisitor> {
311321
Kind, Label.str()});
312322
}
313323

324+
void addTypeHint(SourceRange R, QualType T, llvm::StringRef Prefix) {
325+
// Do not print useless "NULL TYPE" hint.
326+
if (!T.getTypePtrOrNull())
327+
return;
328+
329+
addInlayHint(R, InlayHintKind::TypeHint,
330+
std::string(Prefix) + T.getAsString(TypeHintPolicy));
331+
}
332+
314333
std::vector<InlayHint> &Results;
315334
ASTContext &AST;
316335
FileID MainFileID;

clang-tools-extra/clangd/TUScheduler.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1380,11 +1380,13 @@ bool ASTWorker::blockUntilIdle(Deadline Timeout) const {
13801380
};
13811381
// Make sure ASTWorker has processed all requests, which might issue new
13821382
// updates to PreamblePeer.
1383-
WaitUntilASTWorkerIsIdle();
1383+
if (!WaitUntilASTWorkerIsIdle())
1384+
return false;
13841385
// Now that ASTWorker processed all requests, ensure PreamblePeer has served
13851386
// all update requests. This might create new PreambleRequests for the
13861387
// ASTWorker.
1387-
PreamblePeer.blockUntilIdle(Timeout);
1388+
if (!PreamblePeer.blockUntilIdle(Timeout))
1389+
return false;
13881390
assert(Requests.empty() &&
13891391
"No new normal tasks can be scheduled concurrently with "
13901392
"blockUntilIdle(): ASTWorker isn't threadsafe");

clang-tools-extra/clangd/Transport.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_TRANSPORT_H_
1919
#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_TRANSPORT_H_
2020

21+
#include "Features.h"
2122
#include "llvm/ADT/StringRef.h"
2223
#include "llvm/Support/JSON.h"
2324
#include "llvm/Support/raw_ostream.h"

clang-tools-extra/clangd/benchmarks/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../)
2-
31
add_subdirectory(CompletionModel)
42

53
add_benchmark(IndexBenchmark IndexBenchmark.cpp)

clang-tools-extra/clangd/benchmarks/CompletionModel/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../)
2-
31
add_benchmark(DecisionForestBenchmark DecisionForestBenchmark.cpp)
42

53
target_link_libraries(DecisionForestBenchmark

clang-tools-extra/clangd/fuzzer/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..
2-
${CMAKE_CURRENT_BINARY_DIR}/..)
3-
41
set(LLVM_LINK_COMPONENTS
52
FuzzMutate
63
Support

clang-tools-extra/clangd/index/dex/Dex.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,6 @@ namespace clangd {
3434
namespace dex {
3535

3636
/// In-memory Dex trigram-based index implementation.
37-
// FIXME(kbobyrev): Introduce serialization and deserialization of the symbol
38-
// index so that it can be loaded from the disk. Since static index is not
39-
// changed frequently, it's safe to assume that it has to be built only once
40-
// (when the clangd process starts). Therefore, it can be easier to store built
41-
// index on disk and then load it if available.
4237
class Dex : public SymbolIndex {
4338
public:
4439
// All data must outlive this index.

clang-tools-extra/clangd/index/dex/dexp/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../../)
2-
include_directories(${CMAKE_CURRENT_BINARY_DIR}/../../../)
3-
41
set(LLVM_LINK_COMPONENTS
52
LineEditor
63
Support

clang-tools-extra/clangd/index/remote/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ if (CLANGD_ENABLE_REMOTE)
1313
MonitoringServiceProto
1414
)
1515
include_directories(${CMAKE_CURRENT_BINARY_DIR})
16-
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../)
17-
include_directories(${CMAKE_CURRENT_BINARY_DIR}/../../)
1816

1917
# FIXME(kirillbobyrev): target_compile_definitions is not working with
2018
# add_clang_library for some reason. Is there any way to make this

0 commit comments

Comments
 (0)