logic: fixed recorded location of function bodies that are defined inside macros

This commit is contained in:
mlangkabel
2017-11-06 16:56:35 +01:00
parent 09694409f1
commit ad20275dae
9 changed files with 139 additions and 140 deletions
@@ -688,18 +688,17 @@ ParseLocation CxxAstVisitor::getParseLocation(const clang::SourceRange& sourceRa
{
const clang::SourceManager& sourceManager = m_astContext->getSourceManager();
const clang::SourceLocation startLoc = sourceRange.getBegin();
const clang::SourceLocation endLoc = m_preprocessor->getLocForEndOfToken(sourceRange.getEnd());
const clang::PresumedLoc& presumedBegin = sourceManager.getPresumedLoc(startLoc, false);
const clang::PresumedLoc& presumedEnd = sourceManager.getPresumedLoc(endLoc, false);
const clang::PresumedLoc& presumedBegin = sourceManager.getPresumedLoc(sourceRange.getBegin(), false);
const clang::PresumedLoc& presumedEnd = sourceManager.getPresumedLoc(endLoc.isValid() ? endLoc : sourceRange.getEnd(), false);
parseLocation = ParseLocation(
m_canonicalFilePathCache->getValue(presumedBegin.getFilename()),
presumedBegin.getLine(),
presumedBegin.getColumn(),
presumedEnd.getLine(),
presumedEnd.getColumn() - 1
presumedEnd.getColumn() - (endLoc.isValid() ? 1 : 0)
);
}
return parseLocation;