Skip to content

Commit

Permalink
Integrate LLVM at llvm/llvm-project@23487be49036
Browse files Browse the repository at this point in the history
Updates LLVM usage to match
[23487be49036](llvm/llvm-project@23487be49036)

PiperOrigin-RevId: 679610108
  • Loading branch information
durin42 authored and Google-ML-Automation committed Sep 27, 2024
1 parent 175328a commit f00588e
Show file tree
Hide file tree
Showing 5 changed files with 941 additions and 12 deletions.
85 changes: 85 additions & 0 deletions third_party/llvm/generated.patch
Original file line number Diff line number Diff line change
@@ -1 +1,86 @@
Auto generated patch. Do not edit or delete it, even if empty.
diff -ruN --strip-trailing-cr a/clang/include/clang/AST/DeclID.h b/clang/include/clang/AST/DeclID.h
--- a/clang/include/clang/AST/DeclID.h
+++ b/clang/include/clang/AST/DeclID.h
@@ -189,6 +189,7 @@
// Every Decl ID is a local decl ID to the module being writing in ASTWriter.
friend class ASTWriter;
friend class GlobalDeclID;
+ friend struct llvm::DenseMapInfo<clang::LocalDeclID>;

public:
LocalDeclID() : Base() {}
@@ -266,6 +267,27 @@
return L == R;
}
};
+
+template <> struct DenseMapInfo<clang::LocalDeclID> {
+ using LocalDeclID = clang::LocalDeclID;
+ using DeclID = LocalDeclID::DeclID;
+
+ static LocalDeclID getEmptyKey() {
+ return LocalDeclID(DenseMapInfo<DeclID>::getEmptyKey());
+ }
+
+ static LocalDeclID getTombstoneKey() {
+ return LocalDeclID(DenseMapInfo<DeclID>::getTombstoneKey());
+ }
+
+ static unsigned getHashValue(const LocalDeclID &Key) {
+ return DenseMapInfo<DeclID>::getHashValue(Key.getRawValue());
+ }
+
+ static bool isEqual(const LocalDeclID &L, const LocalDeclID &R) {
+ return L == R;
+ }
+};

} // namespace llvm

diff -ruN --strip-trailing-cr a/clang/include/clang/Serialization/ASTWriter.h b/clang/include/clang/Serialization/ASTWriter.h
--- a/clang/include/clang/Serialization/ASTWriter.h
+++ b/clang/include/clang/Serialization/ASTWriter.h
@@ -233,13 +233,13 @@
/// instead of comparing the result of `getDeclID()` or `GetDeclRef()`.
llvm::SmallPtrSet<const Decl *, 32> PredefinedDecls;

- /// Mapping from FunctionDecl to the list of lambda IDs inside the function.
+ /// Mapping from FunctionDecl ID to the list of lambda IDs inside the
+ /// function.
///
/// These lambdas have to be loaded right after the function they belong to.
/// In order to have canonical declaration for lambda class from the same
/// module as enclosing function during deserialization.
- llvm::DenseMap<const Decl *, SmallVector<LocalDeclID, 4>>
- FunctionToLambdasMap;
+ llvm::DenseMap<LocalDeclID, SmallVector<LocalDeclID, 4>> FunctionToLambdasMap;

/// Offset of each declaration in the bitstream, indexed by
/// the declaration's ID.
diff -ruN --strip-trailing-cr a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp
--- a/clang/lib/Serialization/ASTWriter.cpp
+++ b/clang/lib/Serialization/ASTWriter.cpp
@@ -5713,8 +5713,7 @@
// efficent becuase it allows lazy deserialization.
RecordData FunctionToLambdasMapRecord;
for (const auto &Pair : FunctionToLambdasMap) {
- FunctionToLambdasMapRecord.push_back(
- GetDeclRef(Pair.first).getRawValue());
+ FunctionToLambdasMapRecord.push_back(Pair.first.getRawValue());
FunctionToLambdasMapRecord.push_back(Pair.second.size());
for (const auto &Lambda : Pair.second)
FunctionToLambdasMapRecord.push_back(Lambda.getRawValue());
diff -ruN --strip-trailing-cr a/clang/lib/Serialization/ASTWriterDecl.cpp b/clang/lib/Serialization/ASTWriterDecl.cpp
--- a/clang/lib/Serialization/ASTWriterDecl.cpp
+++ b/clang/lib/Serialization/ASTWriterDecl.cpp
@@ -1524,7 +1524,8 @@
// For lambdas inside canonical FunctionDecl remember the mapping.
if (auto FD = llvm::dyn_cast_or_null<FunctionDecl>(D->getDeclContext());
FD && FD->isCanonicalDecl()) {
- Writer.FunctionToLambdasMap[FD].push_back(Writer.GetDeclRef(D));
+ Writer.FunctionToLambdasMap[Writer.GetDeclRef(FD)].push_back(
+ Writer.GetDeclRef(D));
}
} else {
Record.push_back(CXXRecNotTemplate);
4 changes: 2 additions & 2 deletions third_party/llvm/workspace.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ load("//third_party:repo.bzl", "tf_http_archive")

def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "29b92d07746fac26cd64c914bc9c5c3833974f6d"
LLVM_SHA256 = "3e8e93e3749454af4b64f7f34b792a4748b62fc533bca1703d33b2b04e34eb70"
LLVM_COMMIT = "23487be4903630a4c06160562fb939f6389aa99d"
LLVM_SHA256 = "7c4c8c99df91e9e9859006b0435f83b5ed1260289a649befacfb529dc0a5f68f"

tf_http_archive(
name = name,
Expand Down
Loading

0 comments on commit f00588e

Please sign in to comment.