aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/AST/ByteCode/Compiler.cpp
diff options
context:
space:
mode:
authorTimm Baeder <tbaeder@redhat.com>2025-09-08 08:56:46 +0200
committerGitHub <noreply@github.com>2025-09-08 08:56:46 +0200
commit8ba0d0f72f25229cfa2de9b7352866d7a33c1e54 (patch)
tree89976ddcdfa1d10451abf6612a745ae52fce121a /clang/lib/AST/ByteCode/Compiler.cpp
parent93c2eecda521049ca6334830a69fdff54967b440 (diff)
downloadllvm-8ba0d0f72f25229cfa2de9b7352866d7a33c1e54.zip
llvm-8ba0d0f72f25229cfa2de9b7352866d7a33c1e54.tar.gz
llvm-8ba0d0f72f25229cfa2de9b7352866d7a33c1e54.tar.bz2
[clang][bytcode][NFC] Use UnsignedOrNone for global ids (#157328)
Diffstat (limited to 'clang/lib/AST/ByteCode/Compiler.cpp')
-rw-r--r--clang/lib/AST/ByteCode/Compiler.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp
index 0a1a95d..a213583 100644
--- a/clang/lib/AST/ByteCode/Compiler.cpp
+++ b/clang/lib/AST/ByteCode/Compiler.cpp
@@ -2912,7 +2912,8 @@ bool Compiler<Emitter>::VisitMaterializeTemporaryExpr(
OptPrimType SubExprT = classify(SubExpr);
bool IsStatic = E->getStorageDuration() == SD_Static;
if (IsStatic) {
- std::optional<unsigned> GlobalIndex = P.createGlobal(E);
+
+ UnsignedOrNone GlobalIndex = P.createGlobal(E);
if (!GlobalIndex)
return false;
@@ -3001,7 +3002,7 @@ bool Compiler<Emitter>::VisitCompoundLiteralExpr(const CompoundLiteralExpr *E) {
if (T && !E->isLValue())
return this->delegate(Init);
- std::optional<unsigned> GlobalIndex = P.createGlobal(E);
+ UnsignedOrNone GlobalIndex = P.createGlobal(E);
if (!GlobalIndex)
return false;
@@ -3345,7 +3346,7 @@ bool Compiler<Emitter>::VisitSourceLocExpr(const SourceLocExpr *E) {
auto *UGCD = cast<UnnamedGlobalConstantDecl>(BaseDecl);
- std::optional<unsigned> GlobalIndex = P.getOrCreateGlobal(UGCD);
+ UnsignedOrNone GlobalIndex = P.getOrCreateGlobal(UGCD);
if (!GlobalIndex)
return false;
@@ -3868,7 +3869,7 @@ bool Compiler<Emitter>::VisitCXXUuidofExpr(const CXXUuidofExpr *E) {
if (!RD->isCompleteDefinition())
return this->emitDummyPtr(GuidDecl, E);
- std::optional<unsigned> GlobalIndex = P.getOrCreateGlobal(GuidDecl);
+ UnsignedOrNone GlobalIndex = P.getOrCreateGlobal(GuidDecl);
if (!GlobalIndex)
return false;
if (!this->emitGetPtrGlobal(*GlobalIndex, E))
@@ -4860,7 +4861,7 @@ VarCreationState Compiler<Emitter>::visitVarDecl(const VarDecl *VD,
DeclScope<Emitter> LocalScope(this, VD);
// We've already seen and initialized this global.
- if (std::optional<unsigned> GlobalIndex = P.getGlobal(VD)) {
+ if (UnsignedOrNone GlobalIndex = P.getGlobal(VD)) {
if (P.getPtrGlobal(*GlobalIndex).isInitialized())
return checkDecl();
@@ -4869,7 +4870,7 @@ VarCreationState Compiler<Emitter>::visitVarDecl(const VarDecl *VD,
return Init && checkDecl() && initGlobal(*GlobalIndex);
}
- std::optional<unsigned> GlobalIndex = P.createGlobal(VD, Init);
+ UnsignedOrNone GlobalIndex = P.createGlobal(VD, Init);
if (!GlobalIndex)
return false;
@@ -6802,7 +6803,7 @@ bool Compiler<Emitter>::visitDeclRef(const ValueDecl *D, const Expr *E) {
return F && this->emitGetFnPtr(F, E);
}
if (const auto *TPOD = dyn_cast<TemplateParamObjectDecl>(D)) {
- if (std::optional<unsigned> Index = P.getOrCreateGlobal(D)) {
+ if (UnsignedOrNone Index = P.getOrCreateGlobal(D)) {
if (!this->emitGetPtrGlobal(*Index, E))
return false;
if (OptPrimType T = classify(E->getType())) {