Skip to content

Commit 3787844

Browse files
authored
Merge pull request #423 from Xilinx/bump_to_c57b9f5a
[AutoBump] Merge with c57b9f5 (Sep 21) (9)
2 parents d061bda + a15136b commit 3787844

File tree

433 files changed

+12853
-7622
lines changed

Some content is hidden

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

433 files changed

+12853
-7622
lines changed

bolt/include/bolt/Core/BinaryBasicBlock.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "bolt/Core/MCPlus.h"
2020
#include "llvm/ADT/GraphTraits.h"
2121
#include "llvm/ADT/StringRef.h"
22+
#include "llvm/Config/llvm-config.h" // for LLVM_ON_UNIX
2223
#include "llvm/MC/MCInst.h"
2324
#include "llvm/MC/MCSymbol.h"
2425
#include "llvm/Support/ErrorOr.h"

clang-tools-extra/clang-move/HelperDeclRefGraph.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,10 @@ HelperDeclRefGraph::getReachableNodes(const Decl *Root) const {
7676
llvm::DenseSet<const CallGraphNode *> ConnectedNodes;
7777
std::function<void(const CallGraphNode *)> VisitNode =
7878
[&](const CallGraphNode *Node) {
79-
if (ConnectedNodes.count(Node))
79+
if (!ConnectedNodes.insert(Node).second)
8080
return;
81-
ConnectedNodes.insert(Node);
82-
for (auto It = Node->begin(), End = Node->end(); It != End; ++It)
83-
VisitNode(*It);
81+
for (const CallGraphNode::CallRecord &Callee : *Node)
82+
VisitNode(Callee);
8483
};
8584

8685
VisitNode(RootNode);

clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,8 @@ void ExpandModularHeadersPPCallbacks::handleModuleFile(
116116
if (!MF)
117117
return;
118118
// Avoid processing a ModuleFile more than once.
119-
if (VisitedModules.count(MF))
119+
if (!VisitedModules.insert(MF).second)
120120
return;
121-
VisitedModules.insert(MF);
122121

123122
// Visit all the input files of this module and mark them to record their
124123
// contents later.

clang-tools-extra/clang-tidy/bugprone/DanglingHandleCheck.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ DanglingHandleCheck::DanglingHandleCheck(StringRef Name,
9797
ClangTidyContext *Context)
9898
: ClangTidyCheck(Name, Context),
9999
HandleClasses(utils::options::parseStringList(Options.get(
100-
"HandleClasses",
101-
"std::basic_string_view;std::experimental::basic_string_view"))),
100+
"HandleClasses", "std::basic_string_view;std::experimental::basic_"
101+
"string_view;std::span"))),
102102
IsAHandle(cxxRecordDecl(hasAnyName(HandleClasses)).bind("handle")) {}
103103

104104
void DanglingHandleCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {

clang-tools-extra/clangd/FS.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ PreambleFileStatusCache::getProducingFS(
6464
: ProxyFileSystem(std::move(FS)), StatCache(StatCache) {}
6565

6666
llvm::ErrorOr<std::unique_ptr<llvm::vfs::File>>
67-
openFileForRead(const llvm::Twine &Path, bool IsText = true) override {
68-
auto File = getUnderlyingFS().openFileForRead(Path, IsText);
67+
openFileForRead(const llvm::Twine &Path) override {
68+
auto File = getUnderlyingFS().openFileForRead(Path);
6969
if (!File || !*File)
7070
return File;
7171
// Eagerly stat opened file, as the followup `status` call on the file

clang-tools-extra/clangd/ParsedAST.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,8 @@ class TidyDiagnosticGroups {
280280
llvm::StringRef Check;
281281
while (!Checks.empty()) {
282282
std::tie(Check, Checks) = Checks.split(',');
283+
Check = Check.trim();
284+
283285
if (Check.empty())
284286
continue;
285287

clang-tools-extra/clangd/Preamble.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -479,9 +479,9 @@ class TimerFS : public llvm::vfs::ProxyFileSystem {
479479
: ProxyFileSystem(std::move(FS)) {}
480480

481481
llvm::ErrorOr<std::unique_ptr<llvm::vfs::File>>
482-
openFileForRead(const llvm::Twine &Path, bool IsText = true) override {
482+
openFileForRead(const llvm::Twine &Path) override {
483483
WallTimerRegion T(Timer);
484-
auto FileOr = getUnderlyingFS().openFileForRead(Path, IsText);
484+
auto FileOr = getUnderlyingFS().openFileForRead(Path);
485485
if (!FileOr)
486486
return FileOr;
487487
return std::make_unique<TimerFile>(Timer, std::move(FileOr.get()));

clang-tools-extra/clangd/index/Symbol.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,11 @@ struct Symbol {
145145
ImplementationDetail = 1 << 2,
146146
/// Symbol is visible to other files (not e.g. a static helper function).
147147
VisibleOutsideFile = 1 << 3,
148+
/// Symbol has an attached documentation comment.
149+
HasDocComment = 1 << 4
148150
};
149-
150151
SymbolFlag Flags = SymbolFlag::None;
152+
151153
/// FIXME: also add deprecation message and fixit?
152154
};
153155

clang-tools-extra/clangd/index/SymbolCollector.cpp

Lines changed: 47 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -635,17 +635,21 @@ bool SymbolCollector::handleDeclOccurrence(
635635
return true;
636636

637637
const Symbol *BasicSymbol = Symbols.find(ID);
638-
if (isPreferredDeclaration(*OriginalDecl, Roles))
638+
bool SkipDocCheckInDef = false;
639+
if (isPreferredDeclaration(*OriginalDecl, Roles)) {
639640
// If OriginalDecl is preferred, replace/create the existing canonical
640641
// declaration (e.g. a class forward declaration). There should be at most
641642
// one duplicate as we expect to see only one preferred declaration per
642643
// TU, because in practice they are definitions.
643644
BasicSymbol = addDeclaration(*OriginalDecl, std::move(ID), IsMainFileOnly);
644-
else if (!BasicSymbol || DeclIsCanonical)
645+
SkipDocCheckInDef = true;
646+
} else if (!BasicSymbol || DeclIsCanonical) {
645647
BasicSymbol = addDeclaration(*ND, std::move(ID), IsMainFileOnly);
648+
SkipDocCheckInDef = true;
649+
}
646650

647651
if (Roles & static_cast<unsigned>(index::SymbolRole::Definition))
648-
addDefinition(*OriginalDecl, *BasicSymbol);
652+
addDefinition(*OriginalDecl, *BasicSymbol, SkipDocCheckInDef);
649653

650654
return true;
651655
}
@@ -1025,16 +1029,28 @@ const Symbol *SymbolCollector::addDeclaration(const NamedDecl &ND, SymbolID ID,
10251029
*ASTCtx, *PP, CodeCompletionContext::CCC_Symbol, *CompletionAllocator,
10261030
*CompletionTUInfo,
10271031
/*IncludeBriefComments*/ false);
1028-
std::string Documentation =
1029-
formatDocumentation(*CCS, getDocComment(Ctx, SymbolCompletion,
1030-
/*CommentsFromHeaders=*/true));
1032+
std::string DocComment;
1033+
std::string Documentation;
1034+
bool AlreadyHasDoc = S.Flags & Symbol::HasDocComment;
1035+
if (!AlreadyHasDoc) {
1036+
DocComment = getDocComment(Ctx, SymbolCompletion,
1037+
/*CommentsFromHeaders=*/true);
1038+
Documentation = formatDocumentation(*CCS, DocComment);
1039+
}
1040+
const auto UpdateDoc = [&] {
1041+
if (!AlreadyHasDoc) {
1042+
if (!DocComment.empty())
1043+
S.Flags |= Symbol::HasDocComment;
1044+
S.Documentation = Documentation;
1045+
}
1046+
};
10311047
if (!(S.Flags & Symbol::IndexedForCodeCompletion)) {
10321048
if (Opts.StoreAllDocumentation)
1033-
S.Documentation = Documentation;
1049+
UpdateDoc();
10341050
Symbols.insert(S);
10351051
return Symbols.find(S.ID);
10361052
}
1037-
S.Documentation = Documentation;
1053+
UpdateDoc();
10381054
std::string Signature;
10391055
std::string SnippetSuffix;
10401056
getSignature(*CCS, &Signature, &SnippetSuffix, SymbolCompletion.Kind,
@@ -1058,8 +1074,8 @@ const Symbol *SymbolCollector::addDeclaration(const NamedDecl &ND, SymbolID ID,
10581074
return Symbols.find(S.ID);
10591075
}
10601076

1061-
void SymbolCollector::addDefinition(const NamedDecl &ND,
1062-
const Symbol &DeclSym) {
1077+
void SymbolCollector::addDefinition(const NamedDecl &ND, const Symbol &DeclSym,
1078+
bool SkipDocCheck) {
10631079
if (DeclSym.Definition)
10641080
return;
10651081
const auto &SM = ND.getASTContext().getSourceManager();
@@ -1074,6 +1090,27 @@ void SymbolCollector::addDefinition(const NamedDecl &ND,
10741090
Symbol S = DeclSym;
10751091
// FIXME: use the result to filter out symbols.
10761092
S.Definition = *DefLoc;
1093+
1094+
std::string DocComment;
1095+
std::string Documentation;
1096+
if (!SkipDocCheck && !(S.Flags & Symbol::HasDocComment) &&
1097+
(llvm::isa<FunctionDecl>(ND) || llvm::isa<CXXMethodDecl>(ND))) {
1098+
CodeCompletionResult SymbolCompletion(&getTemplateOrThis(ND), 0);
1099+
const auto *CCS = SymbolCompletion.CreateCodeCompletionString(
1100+
*ASTCtx, *PP, CodeCompletionContext::CCC_Symbol, *CompletionAllocator,
1101+
*CompletionTUInfo,
1102+
/*IncludeBriefComments*/ false);
1103+
DocComment = getDocComment(ND.getASTContext(), SymbolCompletion,
1104+
/*CommentsFromHeaders=*/true);
1105+
if (!S.Documentation.empty())
1106+
Documentation = S.Documentation.str() + '\n' + DocComment;
1107+
else
1108+
Documentation = formatDocumentation(*CCS, DocComment);
1109+
if (!DocComment.empty())
1110+
S.Flags |= Symbol::HasDocComment;
1111+
S.Documentation = Documentation;
1112+
}
1113+
10771114
Symbols.insert(S);
10781115
}
10791116

clang-tools-extra/clangd/index/SymbolCollector.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,8 @@ class SymbolCollector : public index::IndexDataConsumer {
161161
private:
162162
const Symbol *addDeclaration(const NamedDecl &, SymbolID,
163163
bool IsMainFileSymbol);
164-
void addDefinition(const NamedDecl &, const Symbol &DeclSymbol);
164+
void addDefinition(const NamedDecl &, const Symbol &DeclSymbol,
165+
bool SkipDocCheck);
165166
void processRelations(const NamedDecl &ND, const SymbolID &ID,
166167
ArrayRef<index::SymbolRelation> Relations);
167168

0 commit comments

Comments
 (0)