MCPcopy Create free account
hub / github.com/Samsung/UTopia / getDeclTypeInfo

Method getDeclTypeInfo

lib/inputanalysis/DefMapGenerator.cpp:315–335  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

313}
314
315std::pair<unsigned, std::string>
316DefMapGenerator::getDeclTypeInfo(const VarDecl &D,
317 const SourceManager &SrcManager) const {
318 auto MacroCallerLoc = SrcManager.getTopMacroCallerLoc(D.getBeginLoc());
319 auto *Base = getFirstVarDeclhasSameBeginLoc(D);
320 assert(Base && "Unexpected Program State");
321
322 auto Offset = SrcManager.getFileOffset(MacroCallerLoc);
323 int Length = SrcManager.getFileOffset(
324 SrcManager.getTopMacroCallerLoc(Base->getLocation())) -
325 (int)Offset;
326 if (Length <= 0)
327 return std::make_pair(0, "");
328
329 auto Content =
330 util::getFileContent(SrcManager.getFileID(MacroCallerLoc), SrcManager);
331 if (Content.size() < Offset + Length)
332 return std::make_pair(0, "");
333
334 return std::make_pair(Offset, Content.substr(Offset, Length).str());
335}
336
337unsigned DefMapGenerator::getEndOffset(const VarDecl &D,
338 const SourceManager &SrcManager) const {

Callers

nothing calls this directly

Calls 3

getFileContentFunction · 0.85
getBeginLocMethod · 0.80
sizeMethod · 0.80

Tested by

no test coverage detected