Skip to content

Commit cc48023

Browse files
author
Simon Moll
committed
Merge remote-tracking branch 'origin/develop' into hpce/merge
2 parents 9f6cc86 + 6456c4d commit cc48023

File tree

3,802 files changed

+480246
-339182
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,802 files changed

+480246
-339182
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: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,5 @@ pythonenv*
6363
/clang/utils/analyzer/projects/*/PatchedSource
6464
/clang/utils/analyzer/projects/*/ScanBuildResults
6565
/clang/utils/analyzer/projects/*/RefScanBuildResults
66+
# automodapi puts generated documentation files here.
67+
/lldb/docs/python_api/

Jenkinsfile

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ pipeline {
1212
REPO_TOP_URL = sh(
1313
returnStdout: true,
1414
script: "echo ${env.GIT_URL} | sed -e 's:/[^/]*/[^/]*\$::'").trim()
15+
16+
// Use VE 0 or 2.
17+
VE_NODE_NUMBER = sh(
18+
returnStdout: true,
19+
script: "echo ${env.EXECUTOR_NUMBER} | sed -e 's:1:2:'").trim()
1520
}
1621

1722
stages {
@@ -71,19 +76,19 @@ pipeline {
7176
}
7277
}
7378
}
74-
stage('Prepare vetfkernel') {
79+
stage('Prepare vml') {
7580
steps {
76-
dir('vetfkernel') {
81+
dir('vml') {
7782
git branch: 'master',
7883
credentialsId: 'marukawa-token',
79-
url: "${REPO_TOP_URL}/ve-tensorflow/vetfkernel.git"
84+
url: "${REPO_TOP_URL}/ve-tensorflow/vml.git"
8085
}
81-
dir('vetfkernel/libs/vednn') {
82-
git branch: 'vetfkernel',
86+
dir('vml/libs/vednn') {
87+
git branch: 'vml',
8388
credentialsId: 'marukawa-token',
8489
url: "${REPO_TOP_URL}/ve-tensorflow/vednn.git"
8590
}
86-
dir('vetfkernel/build') {
91+
dir('vml/build') {
8792
sh """
8893
${CMAKE} -DCMAKE_BUILD_TYPE="Debug" \
8994
-DLLVM_DIR=${TOP}/llvm-dev/install/lib/cmake/llvm \
@@ -95,12 +100,12 @@ pipeline {
95100
}
96101
}
97102
}
98-
stage('Check vetfkernel') {
103+
stage('Check vml') {
99104
steps {
100-
dir('vetfkernel') {
105+
dir('vml/build') {
101106
sh """
102-
./build/test/test01
103-
${PYTHON} perf.py -e build/test/bench -d perfdb/10B \
107+
make test
108+
${PYTHON} ../perf.py -e bench/bench -d ../perfdb/10B \
104109
test
105110
"""
106111
}

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: 17 additions & 8 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 {
@@ -299,19 +300,27 @@ SymbolID getSymbolID(const llvm::StringRef MacroName, const MacroInfo *MI,
299300
return SymbolID(USR);
300301
}
301302

302-
// FIXME: This should be handled while printing underlying decls instead.
303303
std::string printType(const QualType QT, const DeclContext &CurContext) {
304304
std::string Result;
305305
llvm::raw_string_ostream OS(Result);
306-
auto Decls =
307-
explicitReferenceTargets(DynTypedNode::create(QT), DeclRelation::Alias);
308-
if (!Decls.empty())
309-
OS << getQualification(CurContext.getParentASTContext(), &CurContext,
310-
Decls.front(),
311-
/*VisibleNamespaces=*/llvm::ArrayRef<std::string>{});
312306
PrintingPolicy PP(CurContext.getParentASTContext().getPrintingPolicy());
313-
PP.SuppressScope = true;
314307
PP.SuppressTagKeyword = true;
308+
PP.SuppressUnwrittenScope = true;
309+
310+
class PrintCB : public PrintingCallbacks {
311+
public:
312+
PrintCB(const DeclContext *CurContext) : CurContext(CurContext) {}
313+
virtual ~PrintCB() {}
314+
virtual bool isScopeVisible(const DeclContext *DC) const override {
315+
return DC->Encloses(CurContext);
316+
}
317+
318+
private:
319+
const DeclContext *CurContext;
320+
};
321+
PrintCB PCB(&CurContext);
322+
PP.Callbacks = &PCB;
323+
315324
QT.print(OS, PP);
316325
return OS.str();
317326
}
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: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -620,15 +620,17 @@ void ClangdLSPServer::onInitialize(const InitializeParams &Params,
620620
{"documentSymbolProvider", true},
621621
{"workspaceSymbolProvider", true},
622622
{"referencesProvider", true},
623-
{"astProvider", true},
623+
{"astProvider", true}, // clangd extension
624624
{"executeCommandProvider",
625625
llvm::json::Object{
626626
{"commands",
627627
{ExecuteCommandParams::CLANGD_APPLY_FIX_COMMAND,
628628
ExecuteCommandParams::CLANGD_APPLY_TWEAK}},
629629
}},
630630
{"typeHierarchyProvider", true},
631-
{"memoryUsageProvider", true}, // clangd extension.
631+
{"memoryUsageProvider", true}, // clangd extension
632+
{"compilationDatabase", // clangd extension
633+
llvm::json::Object{{"automaticReload", true}}},
632634
{"callHierarchyProvider", true},
633635
}}}};
634636
if (Opts.Encoding)

clang-tools-extra/clangd/ClangdServer.cpp

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -243,22 +243,19 @@ void ClangdServer::codeComplete(PathRef File, Position Pos,
243243
// No speculation in Fallback mode, as it's supposed to be much faster
244244
// without compiling.
245245
vlog("Build for file {0} is not ready. Enter fallback mode.", File);
246-
} else {
247-
if (CodeCompleteOpts.Index && CodeCompleteOpts.SpeculativeIndexRequest) {
248-
SpecFuzzyFind.emplace();
249-
{
250-
std::lock_guard<std::mutex> Lock(
251-
CachedCompletionFuzzyFindRequestMutex);
252-
SpecFuzzyFind->CachedReq =
253-
CachedCompletionFuzzyFindRequestByFile[File];
254-
}
246+
} else if (CodeCompleteOpts.Index) {
247+
SpecFuzzyFind.emplace();
248+
{
249+
std::lock_guard<std::mutex> Lock(CachedCompletionFuzzyFindRequestMutex);
250+
SpecFuzzyFind->CachedReq = CachedCompletionFuzzyFindRequestByFile[File];
255251
}
256252
}
257253
ParseInputs ParseInput{IP->Command, &TFS, IP->Contents.str()};
258254
ParseInput.Index = Index;
259255
ParseInput.Opts.BuildRecoveryAST = BuildRecoveryAST;
260256
ParseInput.Opts.PreserveRecoveryASTType = PreserveRecoveryASTType;
261257

258+
CodeCompleteOpts.MainFileSignals = IP->Signals;
262259
// FIXME(ibiryukov): even if Preamble is non-null, we may want to check
263260
// both the old and the new version in case only one of them matches.
264261
CodeCompleteResult Result = clangd::codeComplete(
@@ -549,8 +546,8 @@ void ClangdServer::switchSourceHeader(
549546
// the same directory.
550547
// 2) if 1) fails, we use the AST&Index approach, it is slower but supports
551548
// different code layout.
552-
if (auto CorrespondingFile = getCorrespondingHeaderOrSource(
553-
std::string(Path), TFS.view(llvm::None)))
549+
if (auto CorrespondingFile =
550+
getCorrespondingHeaderOrSource(Path, TFS.view(llvm::None)))
554551
return CB(std::move(CorrespondingFile));
555552
auto Action = [Path = Path.str(), CB = std::move(CB),
556553
this](llvm::Expected<InputsAndAST> InpAST) mutable {

clang-tools-extra/clangd/CodeComplete.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ struct CodeCompletionBuilder {
277277
CodeCompletionContext::Kind ContextKind,
278278
const CodeCompleteOptions &Opts,
279279
bool IsUsingDeclaration, tok::TokenKind NextTokenKind)
280-
: ASTCtx(ASTCtx), ExtractDocumentation(Opts.IncludeComments),
280+
: ASTCtx(ASTCtx),
281281
EnableFunctionArgSnippets(Opts.EnableFunctionArgSnippets),
282282
IsUsingDeclaration(IsUsingDeclaration), NextTokenKind(NextTokenKind) {
283283
add(C, SemaCCS);
@@ -393,7 +393,7 @@ struct CodeCompletionBuilder {
393393
S.SnippetSuffix = std::string(C.IndexResult->CompletionSnippetSuffix);
394394
S.ReturnType = std::string(C.IndexResult->ReturnType);
395395
}
396-
if (ExtractDocumentation && !Completion.Documentation) {
396+
if (!Completion.Documentation) {
397397
auto SetDoc = [&](llvm::StringRef Doc) {
398398
if (!Doc.empty()) {
399399
Completion.Documentation.emplace();
@@ -512,7 +512,6 @@ struct CodeCompletionBuilder {
512512
ASTContext *ASTCtx;
513513
CodeCompletion Completion;
514514
llvm::SmallVector<BundledEntry, 1> Bundled;
515-
bool ExtractDocumentation;
516515
bool EnableFunctionArgSnippets;
517516
// No snippets will be generated for using declarations and when the function
518517
// arguments are already present.
@@ -828,9 +827,9 @@ struct CompletionRecorder : public CodeCompleteConsumer {
828827
};
829828

830829
struct ScoredSignature {
831-
// When set, requires documentation to be requested from the index with this
832-
// ID.
833-
llvm::Optional<SymbolID> IDForDoc;
830+
// When not null, requires documentation to be requested from the index with
831+
// this ID.
832+
SymbolID IDForDoc;
834833
SignatureInformation Signature;
835834
SignatureQualitySignals Quality;
836835
};
@@ -894,7 +893,7 @@ class SignatureHelpCollector final : public CodeCompleteConsumer {
894893
for (const auto &S : ScoredSignatures) {
895894
if (!S.IDForDoc)
896895
continue;
897-
IndexRequest.IDs.insert(*S.IDForDoc);
896+
IndexRequest.IDs.insert(S.IDForDoc);
898897
}
899898
Index->lookup(IndexRequest, [&](const Symbol &S) {
900899
if (!S.Documentation.empty())
@@ -939,7 +938,7 @@ class SignatureHelpCollector final : public CodeCompleteConsumer {
939938

940939
for (auto &SS : ScoredSignatures) {
941940
auto IndexDocIt =
942-
SS.IDForDoc ? FetchedDocs.find(*SS.IDForDoc) : FetchedDocs.end();
941+
SS.IDForDoc ? FetchedDocs.find(SS.IDForDoc) : FetchedDocs.end();
943942
if (IndexDocIt != FetchedDocs.end())
944943
SS.Signature.documentation = IndexDocIt->second;
945944

@@ -1111,8 +1110,8 @@ bool semaCodeComplete(std::unique_ptr<CodeCompleteConsumer> Consumer,
11111110
offsetToClangLineColumn(Input.ParseInput.Contents, Input.Offset);
11121111

11131112
std::unique_ptr<llvm::MemoryBuffer> ContentsBuffer =
1114-
llvm::MemoryBuffer::getMemBufferCopy(Input.ParseInput.Contents,
1115-
Input.FileName);
1113+
llvm::MemoryBuffer::getMemBuffer(Input.ParseInput.Contents,
1114+
Input.FileName);
11161115
// The diagnostic options must be set before creating a CompilerInstance.
11171116
CI->getDiagnosticOpts().IgnoreWarnings = true;
11181117
// We reuse the preamble whether it's valid or not. This is a
@@ -1686,6 +1685,7 @@ class CodeCompleteFlow {
16861685
if (PreferredType)
16871686
Relevance.HadContextType = true;
16881687
Relevance.ContextWords = &ContextWords;
1688+
Relevance.MainFileSignals = Opts.MainFileSignals;
16891689

16901690
auto &First = Bundle.front();
16911691
if (auto FuzzyScore = fuzzyScore(First))
@@ -1765,8 +1765,8 @@ class CodeCompleteFlow {
17651765

17661766
clang::CodeCompleteOptions CodeCompleteOptions::getClangCompleteOpts() const {
17671767
clang::CodeCompleteOptions Result;
1768-
Result.IncludeCodePatterns = EnableSnippets && IncludeCodePatterns;
1769-
Result.IncludeMacros = IncludeMacros;
1768+
Result.IncludeCodePatterns = EnableSnippets;
1769+
Result.IncludeMacros = true;
17701770
Result.IncludeGlobals = true;
17711771
// We choose to include full comments and not do doxygen parsing in
17721772
// completion.

0 commit comments

Comments
 (0)