MCPcopy Create free account
hub / github.com/KDAB/codebrowser / addReference

Method addReference

generator/annotator.cpp:760–792  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

758}
759
760void Annotator::addReference(const std::string &ref, clang::SourceRange refLoc, TokenType type,
761 DeclType dt, const std::string &typeRef, clang::Decl *decl)
762{
763 if (type == Ref || type == Member || type == Decl || type == Call || type == EnumDecl
764 || ((type == Type || type == Enum) && dt == Definition)) {
765 ssize_t size = getDeclSize(decl);
766 if (size >= 0) {
767 structure_sizes[ref] = size;
768 }
769 references[ref].push_back( { dt, refLoc, typeRef } );
770 if (dt < Use) {
771 ssize_t offset = getFieldOffset(decl);
772 if (offset >= 0) {
773 field_offsets[ref] = offset;
774 }
775 clang::FullSourceLoc fulloc(decl->getLocStart(), getSourceMgr());
776 commentHandler.decl_offsets.insert({ fulloc.getSpellingLoc(), {ref, true} });
777 if (auto parentStruct = llvm::dyn_cast<clang::RecordDecl>(decl->getDeclContext())) {
778 auto parentRef = getReferenceAndTitle(parentStruct).first;
779 if (!parentRef.empty()) {
780 SubRef sr;
781 sr.ref = ref;
782 if (decl->isFunctionOrFunctionTemplate()) sr.what = SubRef::Function;
783 else if (llvm::isa<clang::FieldDecl>(decl)) sr.what = SubRef::Member;
784 else if (llvm::isa<clang::VarDecl>(decl)) sr.what = SubRef::Static;
785 if (sr.what != SubRef::Function)
786 sr.type = typeRef;
787 sub_refs[parentRef].push_back(sr);
788 }
789 }
790 }
791 }
792}
793
794void Annotator::registerOverride(clang::NamedDecl* decl, clang::NamedDecl* overrided, clang::SourceLocation loc)
795{

Callers

nothing calls this directly

Calls 2

getDeclSizeFunction · 0.85
getFieldOffsetFunction · 0.85

Tested by

no test coverage detected