diff options
author | Matheus Izvekov <mizvekov@gmail.com> | 2025-04-03 14:27:18 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-03 14:27:18 -0300 |
commit | cfee056b4e75cd941591d298e0f8dc303460c57e (patch) | |
tree | 03f3bf29ef837c5e3e3bc3ddeff2d7fe714ad42d /clang/lib/Serialization/ASTWriter.cpp | |
parent | 262b9b515330daf7c446cc7983bf5f89185b3666 (diff) | |
download | llvm-cfee056b4e75cd941591d298e0f8dc303460c57e.zip llvm-cfee056b4e75cd941591d298e0f8dc303460c57e.tar.gz llvm-cfee056b4e75cd941591d298e0f8dc303460c57e.tar.bz2 |
[clang] NFC: introduce UnsignedOrNone as a replacement for std::optional<unsigned> (#134142)
This introduces a new class 'UnsignedOrNone', which models a lite
version of `std::optional<unsigned>`, but has the same size as
'unsigned'.
This replaces most uses of `std::optional<unsigned>`, and similar
schemes utilizing 'int' and '-1' as sentinel.
Besides the smaller size advantage, this is simpler to serialize, as its
internal representation is a single unsigned int as well.
Diffstat (limited to 'clang/lib/Serialization/ASTWriter.cpp')
-rw-r--r-- | clang/lib/Serialization/ASTWriter.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp index 84f7f2b..f27be5f 100644 --- a/clang/lib/Serialization/ASTWriter.cpp +++ b/clang/lib/Serialization/ASTWriter.cpp @@ -4267,7 +4267,7 @@ public: auto ID = Writer.GetDeclRef(DeclForLocalLookup); if (isModuleLocalDecl(D)) { - if (std::optional<unsigned> PrimaryModuleHash = + if (UnsignedOrNone PrimaryModuleHash = getPrimaryModuleHash(D->getOwningModule())) { auto Key = std::make_pair(D->getDeclName(), *PrimaryModuleHash); auto Iter = ModuleLocalDeclsMap.find(Key); |