13 #include "llvm/ADT/SmallString.h" 14 #include "llvm/Support/Path.h" 16 using namespace clang;
23 "Occurrences should be associated with their canonical decl");
25 auto IsNextOccurence = [&]() ->
bool {
28 auto &
Last = Decls.back();
32 if (IsNextOccurence()) {
33 Decls.emplace_back(Roles, Offset, D, Relations);
39 auto It = llvm::upper_bound(Decls, NewInfo);
40 Decls.insert(It, std::move(NewInfo));
44 OS <<
"DECLS BEGIN ---\n";
45 for (
auto &DclInfo : Decls) {
46 const Decl *D = DclInfo.Dcl;
53 if (
auto ND = dyn_cast<NamedDecl>(D)) {
54 OS <<
' ' << ND->getNameAsString();
59 OS <<
"DECLS END ---\n";
Defines the clang::ASTContext interface.
Decl - This represents one declaration (or definition), e.g.
Defines the C++ template declaration subclasses.
void print(llvm::raw_ostream &OS) const
bool isCanonicalDecl() const
Whether this particular Decl is a canonical one.
unsigned getLine() const
Return the presumed line number of this location.
Represents an unpacked "presumed" location which can be presented to the user.
const char * getFilename() const
Return the presumed filename of this location.
unsigned getColumn() const
Return the presumed column number of this location.
Encodes a location in the source.
ASTContext & getASTContext() const LLVM_READONLY
SourceLocation getFileLoc(SourceLocation Loc) const
Given Loc, if it is a macro location return the expansion location or the spelling location...
void addDeclOccurence(SymbolRoleSet Roles, unsigned Offset, const Decl *D, ArrayRef< SymbolRelation > Relations)
Adds an occurrence of the canonical declaration D at the supplied Offset.
Dataflow Directional Tag Classes.
PresumedLoc getPresumedLoc(SourceLocation Loc, bool UseLineDirectives=true) const
Returns the "presumed" location of a SourceLocation specifies.
SourceManager & getSourceManager()
This class handles loading and caching of source files into memory.
SourceLocation getLocation() const