MCPcopy Create free account
hub / github.com/andreasfertig/cppinsights / InsertInstantiationPoint

Method InsertInstantiationPoint

CodeGenerator.cpp:1550–1566  ·  view source on GitHub ↗

\brief Inserts the instantiation point of a template. This reveals at which place the template is first used.

Source from the content-addressed store, hash-verified

1548//
1549// This reveals at which place the template is first used.
1550void CodeGenerator::InsertInstantiationPoint(const SourceManager& sm,
1551 const SourceLocation& instLoc,
1552 std::string_view text)
1553{
1554 const auto lineNo = sm.getSpellingLineNumber(instLoc);
1555 const auto& fileId = sm.getFileID(instLoc);
1556 if(const auto file = sm.getFileEntryRefForID(fileId)) {
1557 const auto fileWithDirName = file->getName();
1558 const auto fileName = llvm::sys::path::filename(fileWithDirName);
1559
1560 if(text.empty()) {
1561 text = "First instantiated from: "sv;
1562 }
1563
1564 mOutputFormatHelper.AppendCommentNewLine(text, fileName, ":"sv, lineNo);
1565 }
1566}
1567//-----------------------------------------------------------------------------
1568
1569void CodeGenerator::InsertTemplateGuardBegin(const FunctionDecl* stmt)

Callers

nothing calls this directly

Calls 3

getNameMethod · 0.80
AppendCommentNewLineMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected