Skip to content

Commit 86b4d68

Browse files
author
Daniel Kroening
committed
add noexcept to frequently used constructors
1 parent ebf5ce8 commit 86b4d68

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

src/big-int/bigint.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ BigInt::BigInt (BigInt const &y)
464464
memcpy (digit, y.digit, length * sizeof (onedig_t));
465465
}
466466

467-
BigInt::BigInt (BigInt &&y)
467+
BigInt::BigInt (BigInt &&y) noexcept
468468
: BigInt()
469469
{
470470
swap(y);

src/big-int/bigint.hh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ public:
168168
BigInt (llong_t) _fast;
169169
BigInt (ullong_t) _fast;
170170
BigInt (BigInt const &) _fast;
171-
BigInt (BigInt &&) _fast;
171+
BigInt (BigInt &&) noexcept _fast;
172172
BigInt (char const *, onedig_t = 10) _fast;
173173

174174
BigInt &operator= (BigInt const &) _fast;

src/util/dstring.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class dstringt final
3939
#ifdef __GNUC__
4040
constexpr
4141
#endif
42-
dstringt():no(0)
42+
dstringt() noexcept:no(0)
4343
{
4444
}
4545

src/util/expr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class exprt:public irept
5454
typedef std::vector<exprt> operandst;
5555

5656
// constructors
57-
exprt() { }
57+
exprt() noexcept { }
5858
explicit exprt(const irep_idt &_id):irept(_id) { }
5959
exprt(const irep_idt &_id, const typet &_type):irept(_id)
6060
{

src/util/irep.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ class irept
172172
bool is_nil() const { return id()==ID_nil; }
173173
bool is_not_nil() const { return id()!=ID_nil; }
174174

175-
explicit irept(const irep_idt &_id)
175+
explicit irept(const irep_idt &_id) noexcept
176176
#ifdef SHARING
177177
:data(&empty_d)
178178
#endif
@@ -182,12 +182,12 @@ class irept
182182

183183
#ifdef SHARING
184184
// constructor for blank irep
185-
irept():data(&empty_d)
185+
irept() noexcept:data(&empty_d)
186186
{
187187
}
188188

189189
// copy constructor
190-
irept(const irept &irep):data(irep.data)
190+
irept(const irept &irep) noexcept:data(irep.data)
191191
{
192192
if(data!=&empty_d)
193193
{
@@ -204,7 +204,7 @@ class irept
204204
// Copy from rvalue reference.
205205
// Note that this does avoid a branch compared to the
206206
// standard copy constructor above.
207-
irept(irept &&irep):data(irep.data)
207+
irept(irept &&irep) noexcept:data(irep.data)
208208
{
209209
#ifdef IREP_DEBUG
210210
std::cout << "COPY MOVE\n";
@@ -234,7 +234,7 @@ class irept
234234
#ifdef USE_MOVE
235235
// Note that the move assignment operator does avoid
236236
// three branches compared to standard operator above.
237-
irept &operator=(irept &&irep)
237+
irept &operator=(irept &&irep) noexcept
238238
{
239239
#ifdef IREP_DEBUG
240240
std::cout << "ASSIGN MOVE\n";

0 commit comments

Comments
 (0)