Skip to content

Commit d52d72e

Browse files
authored
LLVM and SPIRV-LLVM-Translator pulldown (WW05) #3094
LLVM: llvm/llvm-project@622eaa4 SPIRV-LLVM-Translator: KhronosGroup/SPIRV-LLVM-Translator@bec81d1
2 parents 2f42570 + a52d3d3 commit d52d72e

File tree

3,840 files changed

+662668
-419758
lines changed

Some content is hidden

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

3,840 files changed

+662668
-419758
lines changed

.github/lockdown.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Configuration for Repo Lockdown - https://github.com/dessant/repo-lockdown
2+
3+
skipCreatedBefore: "2020-03-21"
4+
5+
pulls:
6+
comment: >
7+
This repository does not accept pull requests.
8+
Please follow http://llvm.org/docs/Contributing.html#how-to-submit-a-patch for contribution to LLVM.

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
#OS X specific files.
2222
.DS_store
2323

24+
# Ignore the user specified CMake presets in subproject directories.
25+
/*/CMakeUserPresets.json
26+
2427
# Nested build directory
2528
/build*
2629
!buildbot
@@ -64,3 +67,5 @@ pythonenv*
6467
/clang/utils/analyzer/projects/*/PatchedSource
6568
/clang/utils/analyzer/projects/*/ScanBuildResults
6669
/clang/utils/analyzer/projects/*/RefScanBuildResults
70+
# automodapi puts generated documentation files here.
71+
/lldb/docs/python_api/

clang-tools-extra/clang-tidy/abseil/UpgradeDurationConversionsCheck.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ void UpgradeDurationConversionsCheck::check(
128128

129129
if (!match(isInTemplateInstantiation(), *OuterExpr, *Result.Context)
130130
.empty()) {
131-
if (MatchedTemplateLocations.count(Loc.getRawEncoding()) == 0) {
131+
if (MatchedTemplateLocations.count(Loc) == 0) {
132132
// For each location matched in a template instantiation, we check if the
133133
// location can also be found in `MatchedTemplateLocations`. If it is not
134134
// found, that means the expression did not create a match without the
@@ -144,7 +144,7 @@ void UpgradeDurationConversionsCheck::check(
144144
internal::Matcher<Stmt> IsInsideTemplate =
145145
hasAncestor(decl(anyOf(classTemplateDecl(), functionTemplateDecl())));
146146
if (!match(IsInsideTemplate, *ArgExpr, *Result.Context).empty())
147-
MatchedTemplateLocations.insert(Loc.getRawEncoding());
147+
MatchedTemplateLocations.insert(Loc);
148148

149149
DiagnosticBuilder Diag = diag(Loc, Message);
150150
CharSourceRange SourceRange = Lexer::makeFileCharRange(

clang-tools-extra/clang-tidy/abseil/UpgradeDurationConversionsCheck.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111

1212
#include "../ClangTidyCheck.h"
1313

14-
#include <unordered_set>
14+
#include "clang/Basic/SourceLocation.h"
15+
#include "llvm/ADT/DenseSet.h"
1516

1617
namespace clang {
1718
namespace tidy {
@@ -32,7 +33,7 @@ class UpgradeDurationConversionsCheck : public ClangTidyCheck {
3233
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
3334

3435
private:
35-
std::unordered_set<unsigned> MatchedTemplateLocations;
36+
llvm::DenseSet<SourceLocation> MatchedTemplateLocations;
3637
};
3738

3839
} // namespace abseil

clang-tools-extra/clangd/AST.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ getQualification(ASTContext &Context, const DeclContext *DestContext,
116116
if (auto *TD = llvm::dyn_cast<TagDecl>(CurContext)) {
117117
// There can't be any more tag parents after hitting a namespace.
118118
assert(!ReachedNS);
119+
(void)ReachedNS;
119120
NNS = NestedNameSpecifier::Create(Context, nullptr, false,
120121
TD->getTypeForDecl());
121122
} else {
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
//===--- ASTSignals.cpp ------------------------------------------*- C++-*-===//
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+
9+
#include "ASTSignals.h"
10+
#include "AST.h"
11+
#include "FindTarget.h"
12+
13+
namespace clang {
14+
namespace clangd {
15+
ASTSignals ASTSignals::derive(const ParsedAST &AST) {
16+
ASTSignals Signals;
17+
const SourceManager &SM = AST.getSourceManager();
18+
findExplicitReferences(AST.getASTContext(), [&](ReferenceLoc Ref) {
19+
for (const NamedDecl *ND : Ref.Targets) {
20+
if (!isInsideMainFile(Ref.NameLoc, SM))
21+
continue;
22+
SymbolID ID = getSymbolID(ND);
23+
if (!ID)
24+
continue;
25+
unsigned &SymbolCount = Signals.ReferencedSymbols[ID];
26+
SymbolCount++;
27+
// Process namespace only when we see the symbol for the first time.
28+
if (SymbolCount != 1)
29+
continue;
30+
if (const auto *NSD = dyn_cast<NamespaceDecl>(ND->getDeclContext())) {
31+
if (NSD->isAnonymousNamespace())
32+
continue;
33+
std::string NS = printNamespaceScope(*NSD);
34+
if (!NS.empty())
35+
Signals.RelatedNamespaces[NS]++;
36+
}
37+
}
38+
});
39+
return Signals;
40+
}
41+
} // namespace clangd
42+
} // namespace clang

clang-tools-extra/clangd/ASTSignals.h

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
//===--- ASTSignals.h --------------------------------------------*- C++-*-===//
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+
9+
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_ASTSIGNALS_H
10+
#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_ASTSIGNALS_H
11+
12+
#include "ParsedAST.h"
13+
#include "index/SymbolID.h"
14+
#include "llvm/ADT/DenseMap.h"
15+
#include "llvm/ADT/StringMap.h"
16+
17+
namespace clang {
18+
namespace clangd {
19+
20+
/// Signals derived from a valid AST of a file.
21+
/// Provides information that can only be extracted from the AST to actions that
22+
/// can't access an AST. The signals are computed and updated asynchronously by
23+
/// the ASTWorker and thus they are always stale and also can be absent.
24+
/// Example usage: Information about the declarations used in a file affects
25+
/// code-completion ranking in that file.
26+
struct ASTSignals {
27+
/// Number of occurrences of each symbol present in the file.
28+
llvm::DenseMap<SymbolID, unsigned> ReferencedSymbols;
29+
/// Namespaces whose symbols are used in the file, and the number of such
30+
/// distinct symbols.
31+
llvm::StringMap<unsigned> RelatedNamespaces;
32+
33+
static ASTSignals derive(const ParsedAST &AST);
34+
};
35+
36+
} // namespace clangd
37+
} // namespace clang
38+
39+
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANGD_ASTSIGNALS_H

clang-tools-extra/clangd/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ include_directories(BEFORE "${CMAKE_CURRENT_BINARY_DIR}/../clang-tidy")
4646

4747
add_clang_library(clangDaemon
4848
AST.cpp
49+
ASTSignals.cpp
4950
ClangdLSPServer.cpp
5051
ClangdServer.cpp
5152
CodeComplete.cpp

clang-tools-extra/clangd/ClangdLSPServer.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1469,6 +1469,12 @@ ClangdLSPServer::ClangdLSPServer(class Transport &Transp,
14691469
MsgHandler(new MessageHandler(*this)), TFS(TFS),
14701470
SupportedSymbolKinds(defaultSymbolKinds()),
14711471
SupportedCompletionItemKinds(defaultCompletionItemKinds()), Opts(Opts) {
1472+
if (Opts.ConfigProvider) {
1473+
assert(!Opts.ContextProvider &&
1474+
"Only one of ConfigProvider and ContextProvider allowed!");
1475+
this->Opts.ContextProvider = ClangdServer::createConfiguredContextProvider(
1476+
Opts.ConfigProvider, this);
1477+
}
14721478

14731479
// clang-format off
14741480
MsgHandler->bind("initialize", &ClangdLSPServer::onInitialize);

clang-tools-extra/clangd/ClangdLSPServer.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ class SymbolIndex;
4141
class ClangdLSPServer : private ClangdServer::Callbacks {
4242
public:
4343
struct Options : ClangdServer::Options {
44+
/// Supplies configuration (overrides ClangdServer::ContextProvider).
45+
config::Provider *ConfigProvider = nullptr;
4446
/// Look for compilation databases, rather than using compile commands
4547
/// set via LSP (extensions) only.
4648
bool UseDirBasedCDB = true;

0 commit comments

Comments
 (0)