[UPSTREAM] chore: update LLVM (#5254)
Bug: http://b/241011085
Cherry-pick change to build kythe with latest LLVM.
Change-Id: Ifcbc3d80f430a275db074c115b9fca2fcb408e41
(cherry picked from commit 6a1baed2f889a36bb25e3f4429fd14016ef5cf3b)
diff --git a/kythe/cxx/extractor/cxx_extractor.cc b/kythe/cxx/extractor/cxx_extractor.cc
index e4ef24c..c244aca 100644
--- a/kythe/cxx/extractor/cxx_extractor.cc
+++ b/kythe/cxx/extractor/cxx_extractor.cc
@@ -454,7 +454,7 @@
void InclusionDirective(
clang::SourceLocation HashLoc, const clang::Token& IncludeTok,
llvm::StringRef FileName, bool IsAngled, clang::CharSourceRange Range,
- const clang::FileEntry* File, llvm::StringRef SearchPath,
+ llvm::Optional<clang::FileEntryRef> File, llvm::StringRef SearchPath,
llvm::StringRef RelativePath, const clang::Module* Imported,
clang::SrcMgr::CharacteristicKind FileType) override;
@@ -843,10 +843,10 @@
void ExtractorPPCallbacks::InclusionDirective(
clang::SourceLocation HashLoc, const clang::Token& IncludeTok,
llvm::StringRef FileName, bool IsAngled, clang::CharSourceRange Range,
- const clang::FileEntry* File, llvm::StringRef SearchPath,
+ llvm::Optional<clang::FileEntryRef> File, llvm::StringRef SearchPath,
llvm::StringRef RelativePath, const clang::Module* Imported,
clang::SrcMgr::CharacteristicKind FileType) {
- if (File == nullptr) {
+ if (!File) {
LOG(WARNING) << "Found null file: " << FileName.str();
LOG(WARNING) << "Search path was " << SearchPath.str();
LOG(WARNING) << "Relative path was " << RelativePath.str();
@@ -870,7 +870,7 @@
return;
}
last_inclusion_directive_path_ =
- AddFile(File, FileName, SearchPath, RelativePath);
+ AddFile(&File->getFileEntry(), FileName, SearchPath, RelativePath);
last_inclusion_offset_ = source_manager_->getFileOffset(HashLoc);
}
diff --git a/kythe/cxx/indexer/cxx/IndexerASTHooks.cc b/kythe/cxx/indexer/cxx/IndexerASTHooks.cc
index 0a467bd..60519a2 100644
--- a/kythe/cxx/indexer/cxx/IndexerASTHooks.cc
+++ b/kythe/cxx/indexer/cxx/IndexerASTHooks.cc
@@ -4042,6 +4042,9 @@
case TemplateName::SubstTemplateTemplateParmPack:
CHECK(IgnoreUnimplemented) << "TN.SubstTemplateTemplateParmPack";
return absl::nullopt;
+ case TemplateName::UsingTemplate:
+ CHECK(options_.IgnoreUnimplemented) << "TN.UsingTemplate";
+ return absl::nullopt;
}
CHECK(IgnoreUnimplemented)
<< "Unexpected TemplateName kind: " << Name.getKind();
diff --git a/kythe/cxx/indexer/cxx/IndexerPPCallbacks.cc b/kythe/cxx/indexer/cxx/IndexerPPCallbacks.cc
index 187cc49..1f6eef6 100644
--- a/kythe/cxx/indexer/cxx/IndexerPPCallbacks.cc
+++ b/kythe/cxx/indexer/cxx/IndexerPPCallbacks.cc
@@ -240,14 +240,16 @@
void IndexerPPCallbacks::InclusionDirective(
clang::SourceLocation HashLocation, const clang::Token& IncludeToken,
llvm::StringRef Filename, bool IsAngled,
- clang::CharSourceRange FilenameRange, const clang::FileEntry* FileEntry,
- llvm::StringRef SearchPath, llvm::StringRef RelativePath,
- const clang::Module* Imported, clang::SrcMgr::CharacteristicKind FileType) {
+ clang::CharSourceRange FilenameRange,
+ llvm::Optional<clang::FileEntryRef> FileRef, llvm::StringRef SearchPath,
+ llvm::StringRef RelativePath, const clang::Module* Imported,
+ clang::SrcMgr::CharacteristicKind FileType) {
// TODO(zarko) (Modules): Check if `Imported` is non-null; if so, this
// was transformed to a module import.
- if (FileEntry != nullptr) {
+ if (FileRef) {
Observer.recordIncludesRange(
- RangeInCurrentContext(FilenameRange.getAsRange()), FileEntry);
+ RangeInCurrentContext(FilenameRange.getAsRange()),
+ &FileRef->getFileEntry());
}
LastInclusionHash = HashLocation;
}
diff --git a/kythe/cxx/indexer/cxx/IndexerPPCallbacks.h b/kythe/cxx/indexer/cxx/IndexerPPCallbacks.h
index 8ae2df1..92b2d8b 100644
--- a/kythe/cxx/indexer/cxx/IndexerPPCallbacks.h
+++ b/kythe/cxx/indexer/cxx/IndexerPPCallbacks.h
@@ -66,7 +66,7 @@
const clang::Token& IncludeToken,
llvm::StringRef Filename, bool IsAngled,
clang::CharSourceRange FilenameRange,
- const clang::FileEntry* FileEntry,
+ llvm::Optional<clang::FileEntryRef> FileEntry,
llvm::StringRef SearchPath,
llvm::StringRef RelativePath,
const clang::Module* Imported,
diff --git a/kythe/cxx/indexer/cxx/semantic_hash.cc b/kythe/cxx/indexer/cxx/semantic_hash.cc
index 53d535b..4b8c9db 100644
--- a/kythe/cxx/indexer/cxx/semantic_hash.cc
+++ b/kythe/cxx/indexer/cxx/semantic_hash.cc
@@ -49,6 +49,9 @@
CHECK(ignore_unimplemented_)
<< "SemanticHash(SubstTemplateTemplateParmPack)";
return 0;
+ case TemplateName::UsingTemplate:
+ CHECK(ignore_unimplemented_) << "SemanticHash(UsingTemplate)";
+ return 0;
}
CHECK(ignore_unimplemented_)
<< "Unexpected TemplateName Kind: " << name.getKind();
diff --git a/kythe/cxx/tools/fyi/fyi.cc b/kythe/cxx/tools/fyi/fyi.cc
index fcf161a..e956034 100644
--- a/kythe/cxx/tools/fyi/fyi.cc
+++ b/kythe/cxx/tools/fyi/fyi.cc
@@ -280,7 +280,7 @@
const clang::Token& include_token,
llvm::StringRef file_name, bool is_angled,
clang::CharSourceRange file_name_range,
- const clang::FileEntry* include_file,
+ llvm::Optional<clang::FileEntryRef> include_file,
llvm::StringRef search_path,
llvm::StringRef relative_path,
const clang::Module* imported,
@@ -490,9 +490,9 @@
clang::SourceLocation hash_location, const clang::Token& include_token,
llvm::StringRef file_name, bool is_angled,
clang::CharSourceRange file_name_range,
- const clang::FileEntry* include_file, llvm::StringRef search_path,
- llvm::StringRef relative_path, const clang::Module* imported,
- clang::SrcMgr::CharacteristicKind FileType) {
+ llvm::Optional<clang::FileEntryRef> include_file,
+ llvm::StringRef search_path, llvm::StringRef relative_path,
+ const clang::Module* imported, clang::SrcMgr::CharacteristicKind FileType) {
if (!enclosing_pass_ || !enclosing_pass_->tracker()) {
return;
}
@@ -501,7 +501,7 @@
auto id_position = source_manager->getDecomposedExpansionLoc(hash_location);
const auto* source_file =
source_manager->getFileEntryForID(id_position.first);
- if (source_file == nullptr || include_file == nullptr) {
+ if (source_file == nullptr || !include_file) {
return;
}
if (tracked_file_ == source_file) {
diff --git a/setup.bzl b/setup.bzl
index 6a95e3d..55d78d2 100644
--- a/setup.bzl
+++ b/setup.bzl
@@ -141,7 +141,7 @@
maybe(
github_archive,
repo_name = "llvm/llvm-project",
- commit = "40d85f16c45e09c1e280bcb8e63342392036f1eb",
+ commit = "4c564940a14f55d2315d2676b10fea0660ea814a",
name = "llvm-project-raw",
build_file_content = "#empty",
sha256 = "938127d27b04c2fcff4814075771e2e434eb5e20a8b6935e0141454effaf6be7",