Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
28b9cdd
Delete dead code.
adrian-prantl Jan 8, 2020
58deb20
Revert "Merge memtag instructions with adjacent stack slots."
eugenis Jan 8, 2020
f84d320
[MLIR] Don't use SSA names directly for std.view canonicalization test
asaadaldien Jan 8, 2020
7f1026a
[cfi][test] cross-dso/stats.cpp: don't assume the order of static con…
MaskRay Jan 8, 2020
ae47a3d
[lldb/SWIG] Refactor extensions to be non Python-specific (2/2)
JDevlieghere Jan 9, 2020
ee57469
[X86] Remove EFLAGS from live-in lists in X86FlagsCopyLowering.
JonPsson Dec 11, 2019
b2fb6a7
[NFC] Whitespace fixes
Xazax-hun Jan 9, 2020
85ee4ff
[libcxx] [test] Disable refwrap/weak_result.pass.cpp in C++20 mode (b…
BillyONeal Jan 9, 2020
659efa2
Recommit "[MachineVerifier] Improve verification of live-in lists."
JonPsson Nov 19, 2019
ff0311c
[PowerPC]: Add powerpcspe target triple subarch component
chmeeedalf Dec 30, 2019
76aab66
[NFC][InlineCost] Factor cost modeling out of CallAnalyzer traversal.
mtrofin Jan 9, 2020
1e46eb7
[Attributor][FIX] Avoid dangling value pointers during code modification
jdoerfert Jan 7, 2020
a4088c7
[Attributor][FIX] Carefully change invokes to calls (after manifest)
jdoerfert Jan 7, 2020
338a601
Revert "[NFC][InlineCost] Factor cost modeling out of CallAnalyzer tr…
mtrofin Jan 9, 2020
26ba160
[PowerPC] when folding rlwinm+rlwinm. to andi., we should use first r…
Jan 9, 2020
a63af91
[lldb] Remove various dead Compare functions
bulbazord Jan 8, 2020
be841f8
[MIR] Target specific MIR formating and parsing
pguo-cn Jan 9, 2020
d44a074
Save more descriptive error msg from FBS/BKS, relay it up to lldb.
jasonmolenda Jan 9, 2020
5ab6fa7
Revert "[MIR] Target specific MIR formating and parsing"
dsandersllvm Jan 9, 2020
3ef05d8
[MIR] Target specific MIR formating and parsing
pguo-cn Jan 9, 2020
71d64f7
Revert "[MIR] Target specific MIR formating and parsing"
nico Jan 9, 2020
de3d0ee
Revert "Revert "[MIR] Target specific MIR formating and parsing""
dsandersllvm Jan 9, 2020
d48ac7d
[DAGCombine] Fold the (fma -x, y, -z) to -(fma x, y, z)
Jan 9, 2020
51bdd98
[lldb/SWIG] Refactor extensions to be non Python-specific (3/3)
JDevlieghere Jan 9, 2020
4ebb589
[SCEV] [NFC] add testcase for constant range for addrecexpr with nsw …
Jan 9, 2020
24b326c
[APFloat] Fix checked error assert failures
ekatz Jan 9, 2020
65678d9
[mlir][VectorOps] Implement strided_slice conversion
nicolasvasilache Jan 9, 2020
2d515e4
[mlir][VectorOps] Implement insert_strided_slice conversion
nicolasvasilache Jan 9, 2020
e93e0d4
[ARM][LowOverheadLoops] Update liveness info
sparker-arm Jan 9, 2020
08778d8
[mlir][GPU] introduce utilities for promotion to workgroup memory
ftynse Jan 7, 2020
8f18874
[LV] Still vectorise when tail-folding can't find a primary inducatio…
Jan 9, 2020
0541a9d
[DWARFDebugLoc] Tweak error message when resolving offset pairs with …
labath Jan 9, 2020
1cba261
Revert "[ARM][LowOverheadLoops] Update liveness info"
sparker-arm Jan 9, 2020
459ad8e
[Matrix] Implement back-propagation of shape information.
fhahn Jan 9, 2020
f0abe82
[LoopUtils][NFC] Minor refactoring in getLoopEstimatedTripCount.
ebrevnov Dec 31, 2019
00c6e98
[VE] Target stub for NEC SX-Aurora
kaz7 Jan 9, 2020
7adf664
[Matrix] Propagate and use shape information for loads.
fhahn Jan 9, 2020
287a874
[clangd] Refurbish HoverInfo::present
kadircet Dec 13, 2019
edaf01d
Merge from 'sycl' to 'sycl-web' (#3)
Jan 9, 2020
ccf2422
[Matrix] Update shape propagation to iterate until done.
fhahn Jan 9, 2020
782ad91
[lldb] Fix that TestNoSuchArch.py was passing for the wrong reason
Teemperor Jan 9, 2020
0d54079
Fix MSVC unhandled enum warning. NFCI.
RKSimon Jan 9, 2020
795c38e
[clang-tidy] For checker `readability-misleading-indentation` update …
abpostelnicu Jan 9, 2020
15c7fa4
[ARM][MVE] Don't unroll intrinsic loops.
sparker-arm Jan 9, 2020
e3e72a2
Fix "pointer is null" static analyzer warnings. NFCI.
RKSimon Jan 9, 2020
e315ce2
Fix "pointer is null" static analyzer warnings. NFCI.
RKSimon Jan 9, 2020
9bb01ef
[lldb/DWARF] Add is_dwo member to DWARFUnit
labath Dec 17, 2019
cd5da94
[lldb/DWARF] Fix mixed v4+v5 location lists
labath Dec 20, 2019
d462185
Fix "pointer is null" static analyzer warning. NFCI.
RKSimon Jan 9, 2020
25dd99f
Fix "pointer is null" static analyzer warning. NFCI.
RKSimon Jan 9, 2020
9c91d79
[NFC][ARM] LowOverheadLoop comments
sparker-arm Jan 9, 2020
b65b1f3
[Concepts] Function trailing requires clauses
saarraz Jan 9, 2020
4a83f1e
[mlir] fix test failure in EDSC/builder-api-test
inouehrs Jan 9, 2020
5c4661b
[lldb] Modernize OptionValue::SetValueChangedCallback
labath Jan 9, 2020
032a939
[InstCombine] Use minimal FMF in testcase for Z / (1.0 / Y) => (Y * Z…
rotateright Jan 9, 2020
173b711
[ARM][MVE] MVE-I should not be disabled by -mfpu=none
momchil-velikov Jan 9, 2020
f53b38d
[InstSimplify] select Cond, true, false --> Cond
rotateright Jan 9, 2020
84ce462
[Concepts] Fix failing test on Windows
saarraz Jan 9, 2020
cb5612e
[DAGCombiner] reduce extract subvector of concat
rotateright Jan 9, 2020
4c11703
[OPENMP]Remove unused code, NFC.
alexey-bataev Jan 9, 2020
667e1f7
IR: remove "else" after "return". NFCI.
TNorthover Jan 9, 2020
d857e11
[ARM,MVE] Fix valid immediate range for vsliq_n.
statham-arm Jan 9, 2020
9704ba6
[ARM,MVE] Add missing IntrNoMem flag on IR intrinsics.
statham-arm Jan 9, 2020
db7c920
AMDGPU: Add register class to DS_SWIZZLE_B32 pattern
arsenm Jan 8, 2020
0274ed9
TableGen/GlobalISel: Fix slightly wrong generated comment
arsenm Jan 8, 2020
3952748
AMDGPU/GlobalISel: Fix add of neg inline constant pattern
arsenm Jan 7, 2020
d964086
AMDGPU/GlobalISel: Add equiv xform for bitcast_fpimm_to_i32
arsenm Jan 7, 2020
79450a4
AMDGPU/GlobalISel: Add selectVOP3Mods_nnan
arsenm Jan 7, 2020
e71af77
AMDGPU/GlobalISel: Add IMMPopCount xform
arsenm Jan 7, 2020
7d67742
AMDGPU/GlobalISel: Fix import of zext of s16 op patterns
arsenm Jan 7, 2020
c1d4963
AMDGPU: Use new PatFrag system for d16 load nodes
arsenm Jan 7, 2020
3766f4b
AMDGPU: Use new PatFrag system for d16 stores
arsenm Jan 7, 2020
c66b2e1
AMDGPU: Eliminate more legacy codepred address space PatFrags
arsenm Jan 7, 2020
9ffd0ed
AMDGPU/GlobalISel: Fix import of integer med3
arsenm Jan 8, 2020
de08244
TableGen: Remove unused code
arsenm Jan 8, 2020
0fa8f70
[ELF][Hexagon] Add support for IE relocations
SidManning Jan 2, 2020
6c04ef4
[InstCombine] Z / (1.0 / Y) => (Y * Z)
raghesh Jan 9, 2020
fb76c79
[libcxxabi] Allow tests to link with static libc++abi/libc++ even if …
broadwaylamb Dec 26, 2019
ea9888b
[clangd] Respect `--sysroot` argument if it is set
DavidGoldman Jan 8, 2020
93a1e9c
[lldb/SWIG] Add missing '\' in macros again
JDevlieghere Jan 9, 2020
45c971f
[lldb/Lua] Make lldb.debugger et al available to Lua
JDevlieghere Jan 9, 2020
d27a15f
[NFCI][LoopUnrollAndJam] Changing LoopUnrollAndJamPass to a function
Jan 9, 2020
cee4a1c
Improve support of GNU mempcpy
Dec 11, 2019
241f335
[OpenCL][Docs] Rename C++ for OpenCL label
svenvh Jan 9, 2020
6498aff
[lldb/Bindings] Move bindings into their own subdirectory
JDevlieghere Jan 9, 2020
189aa5b
[clangd] Adjust diagnostic range to be inside main file
kadircet Jan 9, 2020
5e0bf67
[lldb/SWIG] Fix capitalization for case sensitive file systems.
JDevlieghere Jan 9, 2020
06d07ec
[Clang] Handle target-specific builtins returning aggregates.
statham-arm Jan 9, 2020
ed6daa2
[Support][NFC] Add a comment about the semantics of MF_HUGE_HINT flag
riccibruno Jan 9, 2020
356b335
[NFC,format] Sort switch cases alphabetically
Jan 9, 2020
c2c98c9
Merge from 'master' to 'sycl-web' (#697)
sndmitriev Jan 10, 2020
3edb2ec
Merge from 'sycl' to 'sycl-web' (#4)
Jan 10, 2020
0417fd6
Merge from 'master' to 'sycl-web' (#26)
sndmitriev Jan 10, 2020
0681d12
Merge from 'sycl' to 'sycl-web' (#1)
Jan 10, 2020
3b4091f
Merge from 'master' to 'sycl-web' (#53)
bader Jan 10, 2020
0461c77
Merge from 'sycl' to 'sycl-web' (#1)
Jan 13, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
14 changes: 8 additions & 6 deletions clang-tools-extra/clang-tidy/readability/MagicNumbersCheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,17 @@ MagicNumbersCheck::MagicNumbersCheck(StringRef Name, ClangTidyContext *Context)
IgnoredDoublePointValues.reserve(IgnoredFloatingPointValuesInput.size());
for (const auto &InputValue : IgnoredFloatingPointValuesInput) {
llvm::APFloat FloatValue(llvm::APFloat::IEEEsingle());
if (!FloatValue.convertFromString(InputValue, DefaultRoundingMode)) {
assert(false && "Invalid floating point representation");
}
auto StatusOrErr =
FloatValue.convertFromString(InputValue, DefaultRoundingMode);
assert(StatusOrErr && "Invalid floating point representation");
consumeError(StatusOrErr.takeError());
IgnoredFloatingPointValues.push_back(FloatValue.convertToFloat());

llvm::APFloat DoubleValue(llvm::APFloat::IEEEdouble());
if (!DoubleValue.convertFromString(InputValue, DefaultRoundingMode)) {
assert(false && "Invalid floating point representation");
}
StatusOrErr =
DoubleValue.convertFromString(InputValue, DefaultRoundingMode);
assert(StatusOrErr && "Invalid floating point representation");
consumeError(StatusOrErr.takeError());
IgnoredDoublePointValues.push_back(DoubleValue.convertToDouble());
}
llvm::sort(IgnoredFloatingPointValues.begin(),
Expand Down
4 changes: 3 additions & 1 deletion clang-tools-extra/clangd/CompileCommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,9 @@ void CommandMangler::adjust(std::vector<std::string> &Cmd) const {
if (ResourceDir && !Has("-resource-dir"))
Cmd.push_back(("-resource-dir=" + *ResourceDir));

if (Sysroot && !Has("-isysroot")) {
// Don't set `-isysroot` if it is already set or if `--sysroot` is set.
// `--sysroot` is a superset of the `-isysroot` argument.
if (Sysroot && !Has("-isysroot") && !Has("--sysroot")) {
Cmd.push_back("-isysroot");
Cmd.push_back(*Sysroot);
}
Expand Down
28 changes: 20 additions & 8 deletions clang-tools-extra/clangd/Diagnostics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#include "clang/Lex/Token.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
Expand Down Expand Up @@ -328,14 +330,22 @@ CodeAction toCodeAction(const Fix &F, const URIForFile &File) {
void toLSPDiags(
const Diag &D, const URIForFile &File, const ClangdDiagnosticOptions &Opts,
llvm::function_ref<void(clangd::Diagnostic, llvm::ArrayRef<Fix>)> OutFn) {
auto FillBasicFields = [](const DiagBase &D) -> clangd::Diagnostic {
clangd::Diagnostic Res;
Res.range = D.Range;
Res.severity = getSeverity(D.Severity);
return Res;
};
clangd::Diagnostic Main;
Main.severity = getSeverity(D.Severity);

// Main diagnostic should always refer to a range inside main file. If a
// diagnostic made it so for, it means either itself or one of its notes is
// inside main file.
if (D.InsideMainFile) {
Main.range = D.Range;
} else {
auto It =
llvm::find_if(D.Notes, [](const Note &N) { return N.InsideMainFile; });
assert(It != D.Notes.end() &&
"neither the main diagnostic nor notes are inside main file");
Main.range = It->Range;
}

clangd::Diagnostic Main = FillBasicFields(D);
Main.code = D.Name;
switch (D.Source) {
case Diag::Clang:
Expand Down Expand Up @@ -379,7 +389,9 @@ void toLSPDiags(
for (auto &Note : D.Notes) {
if (!Note.InsideMainFile)
continue;
clangd::Diagnostic Res = FillBasicFields(Note);
clangd::Diagnostic Res;
Res.severity = getSeverity(Note.Severity);
Res.range = Note.Range;
Res.message = noteMessage(D, Note, Opts);
OutFn(std::move(Res), llvm::ArrayRef<Fix>());
}
Expand Down
96 changes: 66 additions & 30 deletions clang-tools-extra/clangd/Hover.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@
#include "clang/AST/PrettyPrinter.h"
#include "clang/Index/IndexSymbol.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/iterator_range.h"
#include "llvm/Support/Casting.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/raw_ostream.h"
#include <string>

namespace clang {
namespace clangd {
Expand Down Expand Up @@ -224,8 +226,8 @@ void enhanceFromIndex(HoverInfo &Hover, const NamedDecl &ND,

// Populates Type, ReturnType, and Parameters for function-like decls.
void fillFunctionTypeAndParams(HoverInfo &HI, const Decl *D,
const FunctionDecl *FD,
const PrintingPolicy &Policy) {
const FunctionDecl *FD,
const PrintingPolicy &Policy) {
HI.Parameters.emplace();
for (const ParmVarDecl *PVD : FD->parameters()) {
HI.Parameters->emplace_back();
Expand All @@ -250,11 +252,11 @@ void fillFunctionTypeAndParams(HoverInfo &HI, const Decl *D,
}
}

if (const auto* CCD = llvm::dyn_cast<CXXConstructorDecl>(FD)) {
if (const auto *CCD = llvm::dyn_cast<CXXConstructorDecl>(FD)) {
// Constructor's "return type" is the class type.
HI.ReturnType = declaredType(CCD->getParent()).getAsString(Policy);
// Don't provide any type for the constructor itself.
} else if (llvm::isa<CXXDestructorDecl>(FD)){
} else if (llvm::isa<CXXDestructorDecl>(FD)) {
HI.ReturnType = "void";
} else {
HI.ReturnType = FD->getReturnType().getAsString(Policy);
Expand Down Expand Up @@ -309,7 +311,7 @@ llvm::Optional<std::string> printExprValue(const SelectionTree::Node *N,
}

/// Generate a \p Hover object given the declaration \p D.
HoverInfo getHoverContents(const Decl *D, const SymbolIndex *Index) {
HoverInfo getHoverContents(const NamedDecl *D, const SymbolIndex *Index) {
HoverInfo HI;
const ASTContext &Ctx = D->getASTContext();

Expand All @@ -321,12 +323,10 @@ HoverInfo getHoverContents(const Decl *D, const SymbolIndex *Index) {
HI.LocalScope.append("::");

PrintingPolicy Policy = printingPolicyForDecls(Ctx.getPrintingPolicy());
if (const NamedDecl *ND = llvm::dyn_cast<NamedDecl>(D)) {
HI.Name = printName(Ctx, *ND);
ND = getDeclForComment(ND);
HI.Documentation = getDeclComment(Ctx, *ND);
enhanceFromIndex(HI, *ND, Index);
}
HI.Name = printName(Ctx, *D);
const auto *CommentD = getDeclForComment(D);
HI.Documentation = getDeclComment(Ctx, *CommentD);
enhanceFromIndex(HI, *CommentD, Index);

HI.Kind = index::getSymbolInfo(D).Kind;

Expand Down Expand Up @@ -460,34 +460,70 @@ llvm::Optional<HoverInfo> getHover(ParsedAST &AST, Position Pos,
tooling::applyAllReplacements(HI->Definition, Replacements))
HI->Definition = *Formatted;

HI->SymRange = getTokenRange(AST.getSourceManager(),
AST.getLangOpts(), SourceLocationBeg);
HI->SymRange = getTokenRange(AST.getSourceManager(), AST.getLangOpts(),
SourceLocationBeg);
return HI;
}

markup::Document HoverInfo::present() const {
markup::Document Output;
if (NamespaceScope) {
auto &P = Output.addParagraph();
P.appendText("Declared in");
// Drop trailing "::".
if (!LocalScope.empty())
P.appendCode(llvm::StringRef(LocalScope).drop_back(2));
else if (NamespaceScope->empty())
P.appendCode("global namespace");
else
P.appendCode(llvm::StringRef(*NamespaceScope).drop_back(2));
// Header contains a text of the form:
// variable `var` : `int`
//
// class `X`
//
// function `foo` → `int`
markup::Paragraph &Header = Output.addParagraph();
Header.appendText(index::getSymbolKindString(Kind));
assert(!Name.empty() && "hover triggered on a nameless symbol");
Header.appendCode(Name);
if (ReturnType) {
Header.appendText("→");
Header.appendCode(*ReturnType);
} else if (Type) {
Header.appendText(":");
Header.appendCode(*Type);
}

if (!Definition.empty()) {
Output.addCodeBlock(Definition);
} else {
// Builtin types
Output.addCodeBlock(Name);
// For functions we display signature in a list form, e.g.:
// - `bool param1`
// - `int param2 = 5`
if (Parameters && !Parameters->empty()) {
markup::BulletList &L = Output.addBulletList();
for (const auto &Param : *Parameters) {
std::string Buffer;
llvm::raw_string_ostream OS(Buffer);
OS << Param;
L.addItem().addParagraph().appendCode(std::move(OS.str()));
}
}

if (Value) {
markup::Paragraph &P = Output.addParagraph();
P.appendText("Value =");
P.appendCode(*Value);
}

if (!Documentation.empty())
Output.addParagraph().appendText(Documentation);

if (!Definition.empty()) {
std::string ScopeComment;
// Drop trailing "::".
if (!LocalScope.empty()) {
// Container name, e.g. class, method, function.
// We might want to propogate some info about container type to print
// function foo, class X, method X::bar, etc.
ScopeComment =
"// In " + llvm::StringRef(LocalScope).rtrim(':').str() + '\n';
} else if (NamespaceScope && !NamespaceScope->empty()) {
ScopeComment = "// In namespace " +
llvm::StringRef(*NamespaceScope).rtrim(':').str() + '\n';
}
// Note that we don't print anything for global namespace, to not annoy
// non-c++ projects or projects that are not making use of namespaces.
Output.addCodeBlock(ScopeComment + Definition);
}
return Output;
}

Expand Down
4 changes: 2 additions & 2 deletions clang-tools-extra/clangd/test/hover.test
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# CHECK-NEXT: "result": {
# CHECK-NEXT: "contents": {
# CHECK-NEXT: "kind": "plaintext",
# CHECK-NEXT: "value": "Declared in global namespace\n\nvoid foo()"
# CHECK-NEXT: "value": "function foo → void\n\nvoid foo()"
# CHECK-NEXT: },
# CHECK-NEXT: "range": {
# CHECK-NEXT: "end": {
Expand Down Expand Up @@ -37,7 +37,7 @@
# CHECK-NEXT: "result": {
# CHECK-NEXT: "contents": {
# CHECK-NEXT: "kind": "plaintext",
# CHECK-NEXT: "value": "Declared in global namespace\n\nenum foo {}"
# CHECK-NEXT: "value": "enum foo\n\nenum foo {}"
# CHECK-NEXT: },
# CHECK-NEXT: "range": {
# CHECK-NEXT: "end": {
Expand Down
23 changes: 23 additions & 0 deletions clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1014,6 +1014,29 @@ TEST(IgnoreDiags, FromNonWrittenInclude) {
EXPECT_THAT(TU.build().getDiagnostics(), UnorderedElementsAre());
}

TEST(ToLSPDiag, RangeIsInMain) {
ClangdDiagnosticOptions Opts;
clangd::Diag D;
D.Range = {pos(1, 2), pos(3, 4)};
D.Notes.emplace_back();
Note &N = D.Notes.back();
N.Range = {pos(2, 3), pos(3, 4)};

D.InsideMainFile = true;
N.InsideMainFile = false;
toLSPDiags(D, {}, Opts,
[&](clangd::Diagnostic LSPDiag, ArrayRef<clangd::Fix>) {
EXPECT_EQ(LSPDiag.range, D.Range);
});

D.InsideMainFile = false;
N.InsideMainFile = true;
toLSPDiags(D, {}, Opts,
[&](clangd::Diagnostic LSPDiag, ArrayRef<clangd::Fix>) {
EXPECT_EQ(LSPDiag.range, N.Range);
});
}

} // namespace
} // namespace clangd
} // namespace clang
89 changes: 89 additions & 0 deletions clang-tools-extra/clangd/unittests/HoverTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1606,6 +1606,95 @@ TEST(Hover, DocsFromMostSpecial) {
}
}
}
TEST(Hover, Present) {
struct {
const std::function<void(HoverInfo &)> Builder;
llvm::StringRef ExpectedRender;
} Cases[] = {
{
[](HoverInfo &HI) {
HI.Kind = index::SymbolKind::Unknown;
HI.Name = "X";
},
R"(<unknown> X)",
},
{
[](HoverInfo &HI) {
HI.Kind = index::SymbolKind::NamespaceAlias;
HI.Name = "foo";
},
R"(namespace-alias foo)",
},
{
[](HoverInfo &HI) {
HI.Kind = index::SymbolKind::Class;
HI.TemplateParameters = {
{std::string("typename"), std::string("T"), llvm::None},
{std::string("typename"), std::string("C"),
std::string("bool")},
};
HI.Documentation = "documentation";
HI.Definition =
"template <typename T, typename C = bool> class Foo {}";
HI.Name = "foo";
HI.NamespaceScope.emplace();
},
R"(class foo
documentation

template <typename T, typename C = bool> class Foo {})",
},
{
[](HoverInfo &HI) {
HI.Kind = index::SymbolKind::Function;
HI.Name = "foo";
HI.Type = "type";
HI.ReturnType = "ret_type";
HI.Parameters.emplace();
HoverInfo::Param P;
HI.Parameters->push_back(P);
P.Type = "type";
HI.Parameters->push_back(P);
P.Name = "foo";
HI.Parameters->push_back(P);
P.Default = "default";
HI.Parameters->push_back(P);
HI.NamespaceScope = "ns::";
HI.Definition = "ret_type foo(params) {}";
},
R"(function foo → ret_type
-
- type
- type foo
- type foo = default

// In namespace ns
ret_type foo(params) {})",
},
{
[](HoverInfo &HI) {
HI.Kind = index::SymbolKind::Variable;
HI.LocalScope = "test::bar::";
HI.Value = "value";
HI.Name = "foo";
HI.Type = "type";
HI.Definition = "def";
},
R"(variable foo : type
Value = value

// In test::bar
def)",
},
};

for (const auto &C : Cases) {
HoverInfo HI;
C.Builder(HI);
EXPECT_EQ(HI.present().asPlainText(), C.ExpectedRender);
}
}

} // namespace
} // namespace clangd
} // namespace clang
Loading