[clang] 9e4f289 - [clang][Interp][NFC] Add [[nodiscard]] attribute to emit functions
Timm Bäder via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 7 10:38:02 PST 2024
Author: Timm Bäder
Date: 2024-03-07T19:37:52+01:00
New Revision: 9e4f289bd6c905a2a436b3311ca49ad2d6328060
URL: https://github.com/llvm/llvm-project/commit/9e4f289bd6c905a2a436b3311ca49ad2d6328060
DIFF: https://github.com/llvm/llvm-project/commit/9e4f289bd6c905a2a436b3311ca49ad2d6328060.diff
LOG: [clang][Interp][NFC] Add [[nodiscard]] attribute to emit functions
Added:
Modified:
clang/lib/AST/Interp/ByteCodeExprGen.cpp
clang/utils/TableGen/ClangOpcodesEmitter.cpp
Removed:
################################################################################
diff --git a/clang/lib/AST/Interp/ByteCodeExprGen.cpp b/clang/lib/AST/Interp/ByteCodeExprGen.cpp
index 712218f5de2e42..a384e191464fea 100644
--- a/clang/lib/AST/Interp/ByteCodeExprGen.cpp
+++ b/clang/lib/AST/Interp/ByteCodeExprGen.cpp
@@ -1646,7 +1646,8 @@ bool ByteCodeExprGen<Emitter>::VisitMaterializeTemporaryExpr(
SubExpr, *SubExprT, /*IsConst=*/true, /*IsExtended=*/true)) {
if (!this->visit(SubExpr))
return false;
- this->emitSetLocal(*SubExprT, *LocalIndex, E);
+ if (!this->emitSetLocal(*SubExprT, *LocalIndex, E))
+ return false;
return this->emitGetPtrLocal(*LocalIndex, E);
}
} else {
diff --git a/clang/utils/TableGen/ClangOpcodesEmitter.cpp b/clang/utils/TableGen/ClangOpcodesEmitter.cpp
index 1c41301ab3aeeb..120e1e2efa32b4 100644
--- a/clang/utils/TableGen/ClangOpcodesEmitter.cpp
+++ b/clang/utils/TableGen/ClangOpcodesEmitter.cpp
@@ -274,7 +274,7 @@ void ClangOpcodesEmitter::EmitGroup(raw_ostream &OS, StringRef N,
// Emit the prototype of the group emitter in the header.
OS << "#if defined(GET_EVAL_PROTO) || defined(GET_LINK_PROTO)\n";
- OS << "bool " << EmitFuncName << "(";
+ OS << "[[nodiscard]] bool " << EmitFuncName << "(";
for (size_t I = 0, N = Types->size(); I < N; ++I)
OS << "PrimType, ";
for (auto *Arg : Args)
More information about the cfe-commits
mailing list