12#include "llvm/ADT/StringRef.h"
13#include "gmock/gmock.h"
14#include "gtest/gtest.h"
22using ::testing::UnorderedElementsAre;
24TEST(ASTSignals, Derive) {
32 return ADD(tar::kConst, a.Y, tar::foo()) + fooInNS2() + tar::foo();
39 TU.HeaderCode = R"cpp(
40 #define ADD(x, y, z) (x + y + z)
41 namespace tar { // A related namespace.
44 void bar(); // Unused symbols are not recorded.
49 namespace ns1::ns2 { int fooInNS2(); }}
52 std::vector<std::pair<StringRef, int>> NS;
53 for (
const auto &P : Signals.RelatedNamespaces)
54 NS.emplace_back(P.getKey(), P.getValue());
55 EXPECT_THAT(NS, UnorderedElementsAre(Pair(
"ns1::", 1), Pair(
"ns1::ns2::", 1),
58 std::vector<std::pair<SymbolID, int>> Sym;
59 for (
const auto &P : Signals.ReferencedSymbols)
60 Sym.emplace_back(P.getFirst(), P.getSecond());
64 Pair(
ns(
"tar").
ID, 4), Pair(
ns(
"ns1").
ID, 1),
65 Pair(
ns(
"ns1::ns2").
ID, 1), Pair(_ , 1),
66 Pair(
cls(
"tar::X").
ID, 1), Pair(
var(
"tar::kConst").
ID, 1),
67 Pair(
func(
"tar::foo").
ID, 2), Pair(
func(
"ns1::ns2::fooInNS2").
ID, 1),
68 Pair(
sym(
"Y", index::SymbolKind::Variable,
"@N@tar@S@X@FI@\\0").
ID,
Symbol func(llvm::StringRef Name)
Symbol cls(llvm::StringRef Name)
Symbol sym(llvm::StringRef QName, index::SymbolKind Kind, llvm::StringRef USRFormat, llvm::StringRef Signature)
Symbol ns(llvm::StringRef Name)
TEST(BackgroundQueueTest, Priority)
Symbol var(llvm::StringRef Name)
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
static ASTSignals derive(const ParsedAST &AST)
@ Include
#include "header.h"
static TestTU withCode(llvm::StringRef Code)