Lines Matching +full:llvm +full:- +full:builddir

1 //===-- XRefsTests.cpp  ---------------------------*- C++ -*--------------===//
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
7 //===----------------------------------------------------------------------===//
20 #include "llvm/ADT/StringRef.h"
21 #include "llvm/Support/Casting.h"
22 #include "llvm/Support/Error.h"
23 #include "llvm/Support/Path.h"
24 #include "llvm/Support/ScopedPrinter.h"
44 std::string guard(llvm::StringRef Code) {
139 TU.ExtraArgs.push_back("-xobjective-c++");
149 // Highlight same-function returns.
152 [[return]] fib(n - 1) + fib(n - 2);
177 if (c == '?') [[return]] -1;
184 // Highlight loop and same-loop control flow
207 // Highlight case and exits for switch-break (but not other cases).
255 [[return]] -1; // correct: exits the matching catch
276 TU.ExtraArgs.push_back("-fexceptions"); // FIXME: stop testing on PS4.
291 << llvm::to_string(arg.PreferredDeclaration);
301 *result_listener << "Definition is " << llvm::to_string(*arg.Definition);
304 if (arg.Definition->range != *Def) {
305 *result_listener << "Definition is " << llvm::to_string(*arg.Definition);
679 struct S2 { S1 * $decl[[operator]]->(); };
681 s2-^>f();
782 ^auto test() -> decltype(Bar()) {
789 auto test() -> ^decltype(Bar()) {
840 auto test() -> decltype(Bar()) {
870 R"cpp(// Heuristic resolution of dependent method via this->
874 this->fo^o();
895 T* operator->();
899 V->fo^o();
927 - (void)bark;
940 - (void)meow;
943 - (void)meow {}
976 - (void)$decl[[meow]];
979 - (void)$def[[meow]] {}
990 - (void)$decl[[runAround]];
993 - (void)$def[[runAround]] {}
1004 - (void)$decl[[howl]];
1007 - (void)$def[[howl]] {}
1046 TU.ExtraArgs.push_back("-xobjective-c++");
1047 TU.ExtraArgs.push_back("-std=c++23");
1060 GotDef = Results[0].Definition->range;
1102 - (void)meow;
1105 - (void)meow {}
1115 - (void)meow;
1118 - (void)meow {}
1126 - (void)meow;
1129 - (void)meow {}
1151 TU.ExtraArgs.push_back("-xobjective-c++");
1162 GotDef = Results[Idx].Definition->range;
1173 R"cpp(// Field, GNU old-style field designator
1213 GotDef = Results[0].Definition->range;
1257 /*error-ok*/
1334 // FIXME: Go-to-definition in a template requires disabling delayed template
1336 TU.ExtraArgs.push_back("-fno-delayed-template-parsing");
1371 // nearby-ident heuristic.
1411 // triggered on non-definition of a renaming alias: should not give any
1431 // triggered on definition of a non-renaming alias: should give underlying
1488 // The source is in "/clangd-test/src".
1489 // We build in "/clangd-test/build".
1509 llvm::sys::path::append(RelPathPrefix, "src");
1510 std::string BuildDir = testPath("build");
1511 MockCompilationDatabase CDB(BuildDir, RelPathPrefix);
1680 // We don't pass an index, so can't hit index-based fallback.
1753 // have the same value of `floor(log2(<token line> - <word line>))`.
1773 Tok->location(), Tok->endLocation()));
1782 llvm::StringRef Test = R"cpp(
1798 B->Fo$1^o();
1799 B->C$4^oncrete();
1802 C1->B$2^ar();
1803 C1->Fo$3^o();
1838 llvm::StringRef Test = R"cpp(
1869 T* operator->();
1874 for (const llvm::StringRef Case : {
1913 for (const llvm::StringRef Case : {
1962 void checkFindRefs(llvm::StringRef Test, bool UseIndex = false) {
1965 TU.ExtraArgs.push_back("-std=c++20");
1973 // If we have cases that are definition-only, we should change this.
2197 constexpr llvm::StringLiteral Code = R"cpp(
2203 { *x } -> $(IsSmallPtr)[[IsSmal^l]];
2216 constexpr llvm::StringLiteral Code = R"cpp(
2222 { *x } -> $(IsSmallPtr)[[IsSmal^l]];
2229 constexpr llvm::StringLiteral Code = R"cpp(
2235 { *$(IsSmallPtr)[[^x]] } -> IsSmall;
2242 llvm::StringRef Test =
2257 D->func(); // No references to the overrides.
2258 B->$(test)[[func]]();
2264 llvm::StringRef Test =
2280 BB->$(test)[[func]]();
2281 B->$(test)[[func]]();
2282 D->$(test)[[fu^nc]]();
2288 llvm::StringRef Test =
2355 if ($(test)[[a^]]) {} // ignore implicit conversion-operator AST node
2386 TU.ExtraArgs.push_back("-std=c++20");
2402 TU.ExtraArgs.push_back("-isystem" + testPath("system"));
2502 mutable std::optional<llvm::DenseSet<SymbolID>> RefIDs;
2504 llvm::function_ref<void(const Ref &)>) const override {
2537 llvm::StringRef AnnotatedCode;
2592 SourceLocation SL = llvm::cantFail(
2596 llvm::dyn_cast<FunctionDecl>(&findDecl(AST, [SL](const NamedDecl &ND) {
2597 return ND.getLocation() == SL && llvm::isa<FunctionDecl>(ND);
2604 if (const auto *ND = llvm::dyn_cast<NamedDecl>(D))
2605 Names.push_back(ND->getQualifiedNameAsString());
2622 TU.ExtraArgs = {"-isystem."};