diff options
author | Shahms King <shahms@google.com> | 2023-01-03 11:34:48 -0800 |
---|---|---|
committer | Yi Kong <yikong@google.com> | 2023-03-01 17:03:11 +0900 |
commit | 7749d33051d72afaafe141ff2315f653de3be0fd (patch) | |
tree | 9b3060b9e4ea72d6e704b26a9d983a0d9f856716 | |
parent | ff109488e721dc221a61fd570935c665e2fd5ff8 (diff) | |
download | kythe-7749d33051d72afaafe141ff2315f653de3be0fd.tar.gz |
Cherrypick upstream change to fix build.
This cherrypicks the following upstream change to fix build with the
latest Clang API:
34a4932e42b7cc853eff38a43ee009a8d101f488 chore: update LLVM (#5483)
Test: presubmit
Bug: 264965700
Change-Id: Id1bc47a52214708784150a9cc4a326e41aa87582
-rw-r--r-- | kythe/cxx/extractor/cxx_extractor.cc | 4 | ||||
-rw-r--r-- | kythe/cxx/extractor/path_utils.cc | 2 | ||||
-rw-r--r-- | kythe/cxx/extractor/testlib.cc | 4 | ||||
-rw-r--r-- | kythe/cxx/indexer/cxx/IndexerPPCallbacks.cc | 7 | ||||
-rw-r--r-- | kythe/cxx/indexer/cxx/IndexerPPCallbacks.h | 2 | ||||
-rw-r--r-- | kythe/cxx/indexer/cxx/marked_source.cc | 3 | ||||
-rw-r--r-- | kythe/cxx/tools/fyi/fyi.cc | 8 | ||||
-rw-r--r-- | setup.bzl | 2 |
8 files changed, 15 insertions, 17 deletions
diff --git a/kythe/cxx/extractor/cxx_extractor.cc b/kythe/cxx/extractor/cxx_extractor.cc index c244aca01..e17039857 100644 --- a/kythe/cxx/extractor/cxx_extractor.cc +++ b/kythe/cxx/extractor/cxx_extractor.cc @@ -454,7 +454,7 @@ class ExtractorPPCallbacks : public clang::PPCallbacks { void InclusionDirective( clang::SourceLocation HashLoc, const clang::Token& IncludeTok, llvm::StringRef FileName, bool IsAngled, clang::CharSourceRange Range, - llvm::Optional<clang::FileEntryRef> File, llvm::StringRef SearchPath, + clang::OptionalFileEntryRef File, llvm::StringRef SearchPath, llvm::StringRef RelativePath, const clang::Module* Imported, clang::SrcMgr::CharacteristicKind FileType) override; @@ -843,7 +843,7 @@ std::string IncludeDirGroupToString(const clang::frontend::IncludeDirGroup& G) { void ExtractorPPCallbacks::InclusionDirective( clang::SourceLocation HashLoc, const clang::Token& IncludeTok, llvm::StringRef FileName, bool IsAngled, clang::CharSourceRange Range, - llvm::Optional<clang::FileEntryRef> File, llvm::StringRef SearchPath, + clang::OptionalFileEntryRef File, llvm::StringRef SearchPath, llvm::StringRef RelativePath, const clang::Module* Imported, clang::SrcMgr::CharacteristicKind FileType) { if (!File) { diff --git a/kythe/cxx/extractor/path_utils.cc b/kythe/cxx/extractor/path_utils.cc index bacc8283e..42a76d56c 100644 --- a/kythe/cxx/extractor/path_utils.cc +++ b/kythe/cxx/extractor/path_utils.cc @@ -66,7 +66,7 @@ const clang::FileEntry* LookupFileForIncludePragma( } else { result_filename->append(filename.begin(), filename.end()); } - llvm::Optional<clang::FileEntryRef> file = preprocessor->LookupFile( + clang::OptionalFileEntryRef file = preprocessor->LookupFile( filename_token.getLocation(), preprocessor->getLangOpts().MSVCCompat ? normalized_path.c_str() : filename, diff --git a/kythe/cxx/extractor/testlib.cc b/kythe/cxx/extractor/testlib.cc index f21548399..1dc2f19d7 100644 --- a/kythe/cxx/extractor/testlib.cc +++ b/kythe/cxx/extractor/testlib.cc @@ -20,6 +20,7 @@ #include <stdlib.h> #include <iostream> +#include <optional> #include <utility> #include "absl/container/flat_hash_map.h" @@ -36,7 +37,6 @@ #include "kythe/proto/analysis.pb.h" #include "kythe/proto/cxx.pb.h" #include "kythe/proto/filecontext.pb.h" -#include "llvm/ADT/None.h" #include "llvm/Support/Program.h" #include "tools/cpp/runfiles/runfiles.h" @@ -209,7 +209,7 @@ bool ExecuteAndWait(const std::string& program, int exit_code = llvm::sys::ExecuteAndWait( program, VectorForExecute(argv), llvm::makeArrayRef(VectorForExecute(env)), - /* Redirects */ llvm::None, + /* Redirects */ std::nullopt, /* SecondsToWait */ 0, /* MemoryLimit */ 0, &error, &execution_failed); if (!error.empty() || execution_failed || exit_code != 0) { LOG(ERROR) << "unable to run extractor (" << exit_code << "): " << error; diff --git a/kythe/cxx/indexer/cxx/IndexerPPCallbacks.cc b/kythe/cxx/indexer/cxx/IndexerPPCallbacks.cc index fdd875eeb..db62eb724 100644 --- a/kythe/cxx/indexer/cxx/IndexerPPCallbacks.cc +++ b/kythe/cxx/indexer/cxx/IndexerPPCallbacks.cc @@ -240,10 +240,9 @@ void IndexerPPCallbacks::Ifndef(clang::SourceLocation Location, void IndexerPPCallbacks::InclusionDirective( clang::SourceLocation HashLocation, const clang::Token& IncludeToken, llvm::StringRef Filename, bool IsAngled, - clang::CharSourceRange FilenameRange, - llvm::Optional<clang::FileEntryRef> FileRef, llvm::StringRef SearchPath, - llvm::StringRef RelativePath, const clang::Module* Imported, - clang::SrcMgr::CharacteristicKind FileType) { + clang::CharSourceRange FilenameRange, clang::OptionalFileEntryRef 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 (FileRef) { diff --git a/kythe/cxx/indexer/cxx/IndexerPPCallbacks.h b/kythe/cxx/indexer/cxx/IndexerPPCallbacks.h index 1e332e9f7..bc0c42a73 100644 --- a/kythe/cxx/indexer/cxx/IndexerPPCallbacks.h +++ b/kythe/cxx/indexer/cxx/IndexerPPCallbacks.h @@ -66,7 +66,7 @@ class IndexerPPCallbacks : public clang::PPCallbacks { const clang::Token& IncludeToken, llvm::StringRef Filename, bool IsAngled, clang::CharSourceRange FilenameRange, - llvm::Optional<clang::FileEntryRef> FileRef, + clang::OptionalFileEntryRef FileRef, llvm::StringRef SearchPath, llvm::StringRef RelativePath, const clang::Module* Imported, diff --git a/kythe/cxx/indexer/cxx/marked_source.cc b/kythe/cxx/indexer/cxx/marked_source.cc index a92bf6aae..be0a345fa 100644 --- a/kythe/cxx/indexer/cxx/marked_source.cc +++ b/kythe/cxx/indexer/cxx/marked_source.cc @@ -509,8 +509,7 @@ class DeclAnnotator : public clang::DeclVisitor<DeclAnnotator> { /// is placed to the left of types, _Nullable is placed to the right of types. bool ShouldSkipDecl(const clang::Decl* decl, const clang::QualType& qt, const clang::SourceRange& sr) { - clang::Optional<clang::NullabilityKind> k = - qt->getNullability(decl->getASTContext()); + clang::Optional<clang::NullabilityKind> k = qt->getNullability(); return k && sr.getBegin().getRawEncoding() > sr.getEnd().getRawEncoding(); } diff --git a/kythe/cxx/tools/fyi/fyi.cc b/kythe/cxx/tools/fyi/fyi.cc index e9560343e..6c32d77a3 100644 --- a/kythe/cxx/tools/fyi/fyi.cc +++ b/kythe/cxx/tools/fyi/fyi.cc @@ -280,7 +280,7 @@ class PreprocessorHooks : public clang::PPCallbacks { const clang::Token& include_token, llvm::StringRef file_name, bool is_angled, clang::CharSourceRange file_name_range, - llvm::Optional<clang::FileEntryRef> include_file, + clang::OptionalFileEntryRef include_file, llvm::StringRef search_path, llvm::StringRef relative_path, const clang::Module* imported, @@ -490,9 +490,9 @@ void PreprocessorHooks::InclusionDirective( clang::SourceLocation hash_location, const clang::Token& include_token, llvm::StringRef file_name, bool is_angled, clang::CharSourceRange file_name_range, - llvm::Optional<clang::FileEntryRef> include_file, - llvm::StringRef search_path, llvm::StringRef relative_path, - const clang::Module* imported, clang::SrcMgr::CharacteristicKind FileType) { + clang::OptionalFileEntryRef 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; } @@ -141,7 +141,7 @@ def kythe_rule_repositories(): maybe( github_archive, repo_name = "llvm/llvm-project", - commit = "4c564940a14f55d2315d2676b10fea0660ea814a", + commit = "77fad4c31e9c32a61da78946f41e8db28ec6a6a7", name = "llvm-project-raw", build_file_content = "#empty", patch_args = ["-p1"], |