From af58a1a6d90dceb795f8975b75cf3769b0318575 Mon Sep 17 00:00:00 2001 From: Yi Kong Date: Thu, 2 Mar 2023 08:36:12 +0000 Subject: Revert "Cherrypick upstream change to fix build." Revert submission 2462733-fix-clang-tools-r487747 Rollback compiler update Reverted changes: /q/submissionid:2462733-fix-clang-tools-r487747 Change-Id: Ifc66c521ce977931c021f209e39557437572638c --- kythe/cxx/extractor/cxx_extractor.cc | 4 ++-- kythe/cxx/extractor/path_utils.cc | 2 +- kythe/cxx/extractor/testlib.cc | 4 ++-- kythe/cxx/indexer/cxx/IndexerPPCallbacks.cc | 7 ++++--- kythe/cxx/indexer/cxx/IndexerPPCallbacks.h | 2 +- kythe/cxx/indexer/cxx/marked_source.cc | 3 ++- kythe/cxx/tools/fyi/fyi.cc | 8 ++++---- setup.bzl | 2 +- 8 files changed, 17 insertions(+), 15 deletions(-) diff --git a/kythe/cxx/extractor/cxx_extractor.cc b/kythe/cxx/extractor/cxx_extractor.cc index e17039857..c244aca01 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, - clang::OptionalFileEntryRef File, llvm::StringRef SearchPath, + llvm::Optional 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, - clang::OptionalFileEntryRef File, llvm::StringRef SearchPath, + llvm::Optional 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 42a76d56c..bacc8283e 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()); } - clang::OptionalFileEntryRef file = preprocessor->LookupFile( + llvm::Optional 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 1dc2f19d7..f21548399 100644 --- a/kythe/cxx/extractor/testlib.cc +++ b/kythe/cxx/extractor/testlib.cc @@ -20,7 +20,6 @@ #include #include -#include #include #include "absl/container/flat_hash_map.h" @@ -37,6 +36,7 @@ #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 */ std::nullopt, + /* Redirects */ llvm::None, /* 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 db62eb724..fdd875eeb 100644 --- a/kythe/cxx/indexer/cxx/IndexerPPCallbacks.cc +++ b/kythe/cxx/indexer/cxx/IndexerPPCallbacks.cc @@ -240,9 +240,10 @@ void IndexerPPCallbacks::Ifndef(clang::SourceLocation Location, void IndexerPPCallbacks::InclusionDirective( clang::SourceLocation HashLocation, const clang::Token& IncludeToken, llvm::StringRef Filename, bool IsAngled, - clang::CharSourceRange FilenameRange, clang::OptionalFileEntryRef FileRef, - llvm::StringRef SearchPath, llvm::StringRef RelativePath, - const clang::Module* Imported, clang::SrcMgr::CharacteristicKind FileType) { + clang::CharSourceRange FilenameRange, + llvm::Optional 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 bc0c42a73..1e332e9f7 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, - clang::OptionalFileEntryRef FileRef, + llvm::Optional 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 be0a345fa..a92bf6aae 100644 --- a/kythe/cxx/indexer/cxx/marked_source.cc +++ b/kythe/cxx/indexer/cxx/marked_source.cc @@ -509,7 +509,8 @@ class DeclAnnotator : public clang::DeclVisitor { /// 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 k = qt->getNullability(); + clang::Optional k = + qt->getNullability(decl->getASTContext()); 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 6c32d77a3..e9560343e 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, - clang::OptionalFileEntryRef include_file, + llvm::Optional 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, - clang::OptionalFileEntryRef include_file, llvm::StringRef search_path, - llvm::StringRef relative_path, const clang::Module* imported, - clang::SrcMgr::CharacteristicKind FileType) { + llvm::Optional 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; } diff --git a/setup.bzl b/setup.bzl index e4a4c2c71..bfd9ae74f 100644 --- a/setup.bzl +++ b/setup.bzl @@ -141,7 +141,7 @@ def kythe_rule_repositories(): maybe( github_archive, repo_name = "llvm/llvm-project", - commit = "77fad4c31e9c32a61da78946f41e8db28ec6a6a7", + commit = "4c564940a14f55d2315d2676b10fea0660ea814a", name = "llvm-project-raw", build_file_content = "#empty", patch_args = ["-p1"], -- cgit v1.2.3