Files
clice/src/Basic/SourceCode.cpp

18 lines
545 B
C++

#include "Basic/SourceCode.h"
namespace clice {
llvm::StringRef getFileContent(const clang::SourceManager& SM, clang::FileID fid) {
return SM.getBufferData(fid);
}
std::uint32_t getTokenLength(const clang::SourceManager& SM, clang::SourceLocation location) {
return clang::Lexer::MeasureTokenLength(location, SM, {});
}
llvm::StringRef getTokenSpelling(const clang::SourceManager& SM, clang::SourceLocation location) {
return llvm::StringRef(SM.getCharacterData(location), getTokenLength(SM, location));
}
} // namespace clice