Skip to content

Commit

Permalink
Add facebook-dt-18.x toolchain
Browse files Browse the repository at this point in the history
Reviewed By: ivanmurashko

Differential Revision: D55448683

fbshipit-source-id: 7211aeae66bdd73631b873c2467d5c0b15b57853
  • Loading branch information
Dmitry Polukhin authored and facebook-github-bot committed Apr 24, 2024
1 parent a556d3b commit 6938b05
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 8 deletions.
12 changes: 12 additions & 0 deletions glean/lang/clang/ast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1269,15 +1269,27 @@ struct ASTVisitor : public clang::RecursiveASTVisitor<ASTVisitor> {

folly::Optional<Cxx::RecordKind> kind;
switch (decl->getTagKind()) {
#if LLVM_VERSION_MAJOR >= 18
case clang::TagTypeKind::Struct:
#else
case clang::TTK_Struct:
#endif
kind = Cxx::RecordKind::struct_();
break;

#if LLVM_VERSION_MAJOR >= 18
case clang::TagTypeKind::Class:
#else
case clang::TTK_Class:
#endif
kind = Cxx::RecordKind::class_();
break;

#if LLVM_VERSION_MAJOR >= 18
case clang::TagTypeKind::Union:
#else
case clang::TTK_Union:
#endif
kind = Cxx::RecordKind::union_();
break;

Expand Down
8 changes: 4 additions & 4 deletions glean/lang/clang/db.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ std::filesystem::path subpath(

std::optional<std::pair<Fact<Src::File>, std::filesystem::path>>
ClangDB::fileFromEntry(
const clang::FileEntry& entry) {
const clang::FileEntryRef& entry) {
auto path = goodPath(root, subpath(subdir, entry.getName().str()));
if (path.is_relative()) {
path = followSymlinksInsideRoot(root, path);
Expand All @@ -68,7 +68,7 @@ ClangDB::fileFromEntry(
}
const auto buffer = [&] {
#if LLVM_VERSION_MAJOR >= 12
return sourceManager().getMemoryBufferForFileOrNone(&entry);
return sourceManager().getMemoryBufferForFileOrNone(entry);
#else
bool invalid = false;
auto buffer = sourceManager().getMemoryBufferForFile(&entry, &invalid);
Expand Down Expand Up @@ -165,9 +165,9 @@ void ClangDB::enterFile(
}

void ClangDB::skipFile(
folly::Optional<Include> inc, const clang::FileEntry *entry) {
folly::Optional<Include> inc, const clang::FileEntryRef& entry) {
if (inc && inc->entry != nullptr && inc->entry == entry) {
if (auto file = fileFromEntry(*entry)) {
if (auto file = fileFromEntry(entry)) {
include(inc.value(), file->first, folly::none);
}
}
Expand Down
6 changes: 3 additions & 3 deletions glean/lang/clang/db.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class ClangDB {
// Files

std::optional<std::pair<Fact<Src::File>, std::filesystem::path>>
fileFromEntry(const clang::FileEntry& entry);
fileFromEntry(const clang::FileEntryRef& entry);

bool isPhysicalFile(clang::FileID id) {
return sourceManager().getFileEntryForID(id);
Expand All @@ -85,7 +85,7 @@ class ClangDB {
std::optional<std::pair<Fact<Src::File>, std::filesystem::path>> res;
if (auto data = folly::get_default(files, id, nullptr)) {
res = {data->fact, data->path};
} else if (auto entry = sourceManager().getFileEntryForID(id)) {
} else if (auto entry = sourceManager().getFileEntryRefForID(id)) {
res = fileFromEntry(*entry);
}
if (res) {
Expand Down Expand Up @@ -199,7 +199,7 @@ class ClangDB {
Fact<Src::File> file,
folly::Optional<clang::FileID> id);
void enterFile(clang::SourceLocation loc, folly::Optional<Include> inc);
void skipFile(folly::Optional<Include> inc, const clang::FileEntry *entry);
void skipFile(folly::Optional<Include> inc, const clang::FileEntryRef& entry);

void declaration(const SourceRange& range, Cxx::Declaration decl) {
if (range.file) {
Expand Down
2 changes: 1 addition & 1 deletion glean/lang/clang/preprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ struct PPCallbacks final : public clang::PPCallbacks {
const clang::FileEntryRef& entry,
const clang::Token&,
clang::SrcMgr::CharacteristicKind) override {
db.skipFile(last_include, &entry.getFileEntry());
db.skipFile(last_include, entry);
last_include.reset();
}
#else
Expand Down

0 comments on commit 6938b05

Please sign in to comment.