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

Method annotateSourceRange

generator/annotator.cpp:821–848  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

819}
820
821void Annotator::annotateSourceRange(clang::SourceRange range, std::string tag, std::string attributes)
822{
823 clang::SourceManager &sm = getSourceMgr();
824 if (!range.getBegin().isFileID()) {
825 range = sm.getSpellingLoc(range.getBegin());
826 if(!range.getBegin().isFileID())
827 return;
828 }
829
830 clang::FileID FID = sm.getFileID(range.getBegin());
831 if (FID != sm.getFileID(range.getEnd())) {
832 return;
833 }
834 if (!shouldProcess(FID))
835 return;
836
837
838 clang::SourceLocation B = range.getBegin();
839 clang::SourceLocation E = range.getEnd();
840
841 uint pos = sm.getFileOffset(B);
842 int len = sm.getFileOffset(E) - pos;
843
844 // Include the whole end token in the range.
845 len += clang::Lexer::MeasureTokenLength(E, sm, getLangOpts());
846
847 generator(FID).addTag(std::move(tag), std::move(attributes), pos, len);
848}
849
850void Annotator::reportDiagnostic(clang::SourceRange range, const std::string& msg, const std::string &clas)
851{

Callers 1

VisitCallExprMethod · 0.80

Calls 1

addTagMethod · 0.80

Tested by

no test coverage detected