Search code examples
includeclanglibtooling

How to get source location of #includes using clang libtooling?


Is there any way to get clang::SourceLocation for every #include in file by its clang::FileID or clang::FileEntry or something?


Solution

  • What about using source manager's GetIncludedLoc function which takes fileid as parameter.

    SourceManager.GetIncludedLoc(fileid)