mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-29 02:51:57 +00:00
parent
c10642d29b
commit
de800ebb70
@ -27,6 +27,13 @@ std::string pathFromFileEntry(const FileEntry &file) {
|
|||||||
return normalizeFolder(ret) ? ret : realPath(ret);
|
return normalizeFolder(ret) ? ret : realPath(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isInsideMainFile(const SourceManager &sm, SourceLocation sl) {
|
||||||
|
if (!sl.isValid())
|
||||||
|
return false;
|
||||||
|
FileID fid = sm.getFileID(sm.getExpansionLoc(sl));
|
||||||
|
return fid == sm.getMainFileID() || fid == sm.getPreambleFileID();
|
||||||
|
}
|
||||||
|
|
||||||
static Pos decomposed2LineAndCol(const SourceManager &sm,
|
static Pos decomposed2LineAndCol(const SourceManager &sm,
|
||||||
std::pair<FileID, unsigned> i) {
|
std::pair<FileID, unsigned> i) {
|
||||||
int l = (int)sm.getLineNumber(i.first, i.second) - 1,
|
int l = (int)sm.getLineNumber(i.first, i.second) - 1,
|
||||||
|
@ -20,6 +20,8 @@ namespace vfs = clang::vfs;
|
|||||||
namespace ccls {
|
namespace ccls {
|
||||||
std::string pathFromFileEntry(const clang::FileEntry &file);
|
std::string pathFromFileEntry(const clang::FileEntry &file);
|
||||||
|
|
||||||
|
bool isInsideMainFile(const clang::SourceManager &sm, clang::SourceLocation sl);
|
||||||
|
|
||||||
Range fromCharSourceRange(const clang::SourceManager &sm,
|
Range fromCharSourceRange(const clang::SourceManager &sm,
|
||||||
const clang::LangOptions &lang,
|
const clang::LangOptions &lang,
|
||||||
clang::CharSourceRange csr,
|
clang::CharSourceRange csr,
|
||||||
|
@ -243,7 +243,7 @@ public:
|
|||||||
return;
|
return;
|
||||||
const SourceManager &sm = info.getSourceManager();
|
const SourceManager &sm = info.getSourceManager();
|
||||||
StringRef filename = sm.getFilename(info.getLocation());
|
StringRef filename = sm.getFilename(info.getLocation());
|
||||||
bool concerned = sm.isWrittenInMainFile(l);
|
bool concerned = isInsideMainFile(sm, l);
|
||||||
auto fillDiagBase = [&](DiagBase &d) {
|
auto fillDiagBase = [&](DiagBase &d) {
|
||||||
llvm::SmallString<64> message;
|
llvm::SmallString<64> message;
|
||||||
info.FormatDiagnostic(message);
|
info.FormatDiagnostic(message);
|
||||||
|
Loading…
Reference in New Issue
Block a user