mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-25 09:05:10 +00:00
parent
c10642d29b
commit
de800ebb70
@ -27,6 +27,13 @@ std::string pathFromFileEntry(const FileEntry &file) {
|
||||
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,
|
||||
std::pair<FileID, unsigned> i) {
|
||||
int l = (int)sm.getLineNumber(i.first, i.second) - 1,
|
||||
|
@ -20,6 +20,8 @@ namespace vfs = clang::vfs;
|
||||
namespace ccls {
|
||||
std::string pathFromFileEntry(const clang::FileEntry &file);
|
||||
|
||||
bool isInsideMainFile(const clang::SourceManager &sm, clang::SourceLocation sl);
|
||||
|
||||
Range fromCharSourceRange(const clang::SourceManager &sm,
|
||||
const clang::LangOptions &lang,
|
||||
clang::CharSourceRange csr,
|
||||
|
@ -243,7 +243,7 @@ public:
|
||||
return;
|
||||
const SourceManager &sm = info.getSourceManager();
|
||||
StringRef filename = sm.getFilename(info.getLocation());
|
||||
bool concerned = sm.isWrittenInMainFile(l);
|
||||
bool concerned = isInsideMainFile(sm, l);
|
||||
auto fillDiagBase = [&](DiagBase &d) {
|
||||
llvm::SmallString<64> message;
|
||||
info.FormatDiagnostic(message);
|
||||
|
Loading…
Reference in New Issue
Block a user