Hi Daniel,

> I have been calling runClangTidy directly, and I finally am (mostly)
> getting the results that I expect.
> ClangTidyMessage has the position as an offset into the file.  Is there a
> function in Clang/LLVM that will convert this to a line and column?

Take a look at SourceManager methods like getSpellingLineNumber

In a clang-tidy check, you can write something along the lines:
  const SourceManager &SM = *Result.SourceManager;
  SourceLocation Loc = ...;
  bool Invalid = false;
  unsigned LineNo = SM.getSpellingLineNumber(Loc, &Invalid);
  unsigned ColNo = SM.getSpellingColumnNumber(Loc, &Invalid);

Cheers,

Marek Kurdej
--
Ph.D. candidate
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to