mirror of
https://github.com/MaskRay/ccls.git
synced 2025-12-19 13:42:08 +00:00
Compare commits
5 Commits
de5ea8b294
...
ce6fab9d46
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ce6fab9d46 | ||
|
|
aca8280288 | ||
|
|
a7068f13ec | ||
|
|
344e2e6557 | ||
|
|
791f6ba974 |
@ -325,6 +325,9 @@ try_again:
|
|||||||
switch (tp->getTypeClass()) {
|
switch (tp->getTypeClass()) {
|
||||||
case Type::Typedef:
|
case Type::Typedef:
|
||||||
d = cast<TypedefType>(tp)->getDecl();
|
d = cast<TypedefType>(tp)->getDecl();
|
||||||
|
tp = cast<TypedefType>(tp)->getDecl()->getUnderlyingType().getTypePtrOrNull();
|
||||||
|
if (tp)
|
||||||
|
goto try_again;
|
||||||
break;
|
break;
|
||||||
case Type::ObjCObject:
|
case Type::ObjCObject:
|
||||||
d = cast<ObjCObjectType>(tp)->getInterface();
|
d = cast<ObjCObjectType>(tp)->getInterface();
|
||||||
@ -334,11 +337,7 @@ try_again:
|
|||||||
break;
|
break;
|
||||||
case Type::Record:
|
case Type::Record:
|
||||||
case Type::Enum:
|
case Type::Enum:
|
||||||
#if LLVM_VERSION_MAJOR >= 22 // llvmorg-22-init-3166-g91cdd35008e9
|
|
||||||
d = cast<TagType>(tp)->getOriginalDecl();
|
|
||||||
#else
|
|
||||||
d = cast<TagType>(tp)->getDecl();
|
d = cast<TagType>(tp)->getDecl();
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
case Type::TemplateTypeParm:
|
case Type::TemplateTypeParm:
|
||||||
d = cast<TemplateTypeParmType>(tp)->getDecl();
|
d = cast<TemplateTypeParmType>(tp)->getDecl();
|
||||||
@ -346,15 +345,10 @@ try_again:
|
|||||||
case Type::TemplateSpecialization:
|
case Type::TemplateSpecialization:
|
||||||
if (specialization)
|
if (specialization)
|
||||||
*specialization = true;
|
*specialization = true;
|
||||||
if (const RecordType *record = tp->getAs<RecordType>()) {
|
if (const RecordType *record = tp->getAs<RecordType>())
|
||||||
#if LLVM_VERSION_MAJOR >= 22 // llvmorg-22-init-3166-g91cdd35008e9
|
|
||||||
d = record->getOriginalDecl();
|
|
||||||
#else
|
|
||||||
d = record->getDecl();
|
d = record->getDecl();
|
||||||
#endif
|
else
|
||||||
} else {
|
|
||||||
d = cast<TemplateSpecializationType>(tp)->getTemplateName().getAsTemplateDecl();
|
d = cast<TemplateSpecializationType>(tp)->getTemplateName().getAsTemplateDecl();
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Type::Auto:
|
case Type::Auto:
|
||||||
@ -365,11 +359,7 @@ try_again:
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case Type::InjectedClassName:
|
case Type::InjectedClassName:
|
||||||
#if LLVM_VERSION_MAJOR >= 22 // llvmorg-22-init-3166-g91cdd35008e9
|
|
||||||
d = cast<InjectedClassNameType>(tp)->getOriginalDecl();
|
|
||||||
#else
|
|
||||||
d = cast<InjectedClassNameType>(tp)->getDecl();
|
d = cast<InjectedClassNameType>(tp)->getDecl();
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// FIXME: Template type parameters!
|
// FIXME: Template type parameters!
|
||||||
@ -427,11 +417,7 @@ bool validateRecord(const RecordDecl *rd) {
|
|||||||
if (fqt->isIncompleteType() || fqt->isDependentType())
|
if (fqt->isIncompleteType() || fqt->isDependentType())
|
||||||
return false;
|
return false;
|
||||||
if (const RecordType *childType = i->getType()->getAs<RecordType>())
|
if (const RecordType *childType = i->getType()->getAs<RecordType>())
|
||||||
#if LLVM_VERSION_MAJOR >= 22 // llvmorg-22-init-3166-g91cdd35008e9
|
|
||||||
if (const RecordDecl *child = childType->getOriginalDecl())
|
|
||||||
#else
|
|
||||||
if (const RecordDecl *child = childType->getDecl())
|
if (const RecordDecl *child = childType->getDecl())
|
||||||
#endif
|
|
||||||
if (!validateRecord(child))
|
if (!validateRecord(child))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -705,11 +691,7 @@ public:
|
|||||||
if (fd->getIdentifier())
|
if (fd->getIdentifier())
|
||||||
type.def.vars.emplace_back(getUsr(fd), offset1);
|
type.def.vars.emplace_back(getUsr(fd), offset1);
|
||||||
else if (const auto *rt1 = fd->getType()->getAs<RecordType>()) {
|
else if (const auto *rt1 = fd->getType()->getAs<RecordType>()) {
|
||||||
#if LLVM_VERSION_MAJOR >= 22 // llvmorg-22-init-3166-g91cdd35008e9
|
|
||||||
if (const RecordDecl *rd1 = rt1->getOriginalDecl())
|
|
||||||
#else
|
|
||||||
if (const RecordDecl *rd1 = rt1->getDecl())
|
if (const RecordDecl *rd1 = rt1->getDecl())
|
||||||
#endif
|
|
||||||
if (seen.insert(rd1).second)
|
if (seen.insert(rd1).second)
|
||||||
stack.push_back({rd1, offset1});
|
stack.push_back({rd1, offset1});
|
||||||
}
|
}
|
||||||
@ -1286,7 +1268,7 @@ IndexResult index(WorkingFiles *wfiles, VFS *vfs, const std::string &opt_wdir, c
|
|||||||
clang->setInvocation(std::move(ci));
|
clang->setInvocation(std::move(ci));
|
||||||
#endif
|
#endif
|
||||||
clang->createDiagnostics(
|
clang->createDiagnostics(
|
||||||
#if LLVM_VERSION_MAJOR >= 20
|
#if LLVM_VERSION_MAJOR >= 20 && LLVM_VERSION_MAJOR < 22
|
||||||
*fs,
|
*fs,
|
||||||
#endif
|
#endif
|
||||||
&dc, false);
|
&dc, false);
|
||||||
@ -1299,7 +1281,11 @@ IndexResult index(WorkingFiles *wfiles, VFS *vfs, const std::string &opt_wdir, c
|
|||||||
if (!clang->hasTarget())
|
if (!clang->hasTarget())
|
||||||
return {};
|
return {};
|
||||||
clang->getPreprocessorOpts().RetainRemappedFileBuffers = true;
|
clang->getPreprocessorOpts().RetainRemappedFileBuffers = true;
|
||||||
|
#if LLVM_VERSION_MAJOR >= 22
|
||||||
|
clang->createFileManager();
|
||||||
|
#else
|
||||||
clang->createFileManager(fs);
|
clang->createFileManager(fs);
|
||||||
|
#endif
|
||||||
clang->setSourceManager(new SourceManager(clang->getDiagnostics(), clang->getFileManager(), true));
|
clang->setSourceManager(new SourceManager(clang->getDiagnostics(), clang->getFileManager(), true));
|
||||||
|
|
||||||
IndexParam param(*vfs, no_linkage);
|
IndexParam param(*vfs, no_linkage);
|
||||||
|
|||||||
@ -345,7 +345,11 @@ void do_initialize(MessageHandler *m, InitializeParam ¶m, ReplyOnce &reply)
|
|||||||
|
|
||||||
if (g_config->cache.directory.size()) {
|
if (g_config->cache.directory.size()) {
|
||||||
SmallString<256> path(g_config->cache.directory);
|
SmallString<256> path(g_config->cache.directory);
|
||||||
|
#if LLVM_VERSION_MAJOR >= 22
|
||||||
|
sys::path::make_absolute(project_path, path);
|
||||||
|
#else
|
||||||
sys::fs::make_absolute(project_path, path);
|
sys::fs::make_absolute(project_path, path);
|
||||||
|
#endif
|
||||||
// Use upper case for the Driver letter on Windows.
|
// Use upper case for the Driver letter on Windows.
|
||||||
g_config->cache.directory = normalizePath(path.str());
|
g_config->cache.directory = normalizePath(path.str());
|
||||||
ensureEndsInSlash(g_config->cache.directory);
|
ensureEndsInSlash(g_config->cache.directory);
|
||||||
|
|||||||
@ -268,7 +268,7 @@ std::unique_ptr<CompilerInstance> buildCompilerInstance(Session &session, std::u
|
|||||||
clang->setInvocation(std::move(ci));
|
clang->setInvocation(std::move(ci));
|
||||||
#endif
|
#endif
|
||||||
clang->createDiagnostics(
|
clang->createDiagnostics(
|
||||||
#if LLVM_VERSION_MAJOR >= 20
|
#if LLVM_VERSION_MAJOR >= 20 && LLVM_VERSION_MAJOR < 22
|
||||||
*fs,
|
*fs,
|
||||||
#endif
|
#endif
|
||||||
&dc, false);
|
&dc, false);
|
||||||
@ -283,7 +283,11 @@ std::unique_ptr<CompilerInstance> buildCompilerInstance(Session &session, std::u
|
|||||||
// Construct SourceManager with UserFilesAreVolatile: true because otherwise
|
// Construct SourceManager with UserFilesAreVolatile: true because otherwise
|
||||||
// RequiresNullTerminator: true may cause out-of-bounds read when a file is
|
// RequiresNullTerminator: true may cause out-of-bounds read when a file is
|
||||||
// mmap'ed but is saved concurrently.
|
// mmap'ed but is saved concurrently.
|
||||||
|
#if LLVM_VERSION_MAJOR >= 22
|
||||||
|
clang->createFileManager();
|
||||||
|
#else
|
||||||
clang->createFileManager(fs);
|
clang->createFileManager(fs);
|
||||||
|
#endif
|
||||||
clang->setSourceManager(new SourceManager(clang->getDiagnostics(), clang->getFileManager(), true));
|
clang->setSourceManager(new SourceManager(clang->getDiagnostics(), clang->getFileManager(), true));
|
||||||
auto &isec = clang->getFrontendOpts().Inputs;
|
auto &isec = clang->getFrontendOpts().Inputs;
|
||||||
if (isec.size()) {
|
if (isec.size()) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user