summaryrefslogtreecommitdiff
path: root/src/base
diff options
context:
space:
mode:
authorGereon Kremer <gereon.kremer@cs.rwth-aachen.de>2021-03-02 01:58:20 +0100
committerGitHub <noreply@github.com>2021-03-02 00:58:20 +0000
commitb5073e16ea49ce9214fcc5318ce080724719c809 (patch)
tree1073858c57a3590b67ae7fd8e6fa2d46872f9114 /src/base
parent822ae21e0b26e9a98b3a5585dbcd2694bbbce685 (diff)
Clean up includes to reduce compile times (#6031)
This PR cleans up a ton of includes, based on the suggestions of iwyu. Mostly, it removes includes from header files in favor of forward declarations and adds includes to source files.
Diffstat (limited to 'src/base')
-rw-r--r--src/base/exception.cpp32
-rw-r--r--src/base/exception.h2
-rw-r--r--src/base/listener.h2
-rw-r--r--src/base/output.h2
4 files changed, 17 insertions, 21 deletions
diff --git a/src/base/exception.cpp b/src/base/exception.cpp
index 2a8dc8d10..cddef79fd 100644
--- a/src/base/exception.cpp
+++ b/src/base/exception.cpp
@@ -28,24 +28,24 @@ using namespace std;
namespace CVC4 {
-thread_local LastExceptionBuffer* LastExceptionBuffer::s_currentBuffer = NULL;
+thread_local LastExceptionBuffer* LastExceptionBuffer::s_currentBuffer = nullptr;
-LastExceptionBuffer::LastExceptionBuffer() : d_contents(NULL) {}
+LastExceptionBuffer::LastExceptionBuffer() : d_contents(nullptr) {}
LastExceptionBuffer::~LastExceptionBuffer() {
- if(d_contents != NULL){
+ if(d_contents != nullptr){
free(d_contents);
- d_contents = NULL;
+ d_contents = nullptr;
}
}
void LastExceptionBuffer::setContents(const char* string) {
- if(d_contents != NULL){
+ if(d_contents != nullptr){
free(d_contents);
- d_contents = NULL;
+ d_contents = nullptr;
}
- if(string != NULL){
+ if(string != nullptr){
d_contents = strdup(string);
}
}
@@ -61,7 +61,7 @@ std::string IllegalArgumentException::formatVariadic(const char* format, ...) {
va_start(args, format);
int n = 512;
- char* buf = NULL;
+ char* buf = nullptr;
for (int i = 0; i < 2; ++i){
Assert(n > 0);
@@ -80,9 +80,9 @@ std::string IllegalArgumentException::formatVariadic(const char* format, ...) {
break;
}
}
- // buf is not NULL is an invariant.
+ // buf is not nullptr is an invariant.
// buf is also 0 terminated.
- Assert(buf != NULL);
+ Assert(buf != nullptr);
std::string result(buf);
delete [] buf;
va_end(args);
@@ -107,7 +107,7 @@ void IllegalArgumentException::construct(const char* header, const char* extra,
buf = new char[n];
int size;
- if(extra == NULL) {
+ if(extra == nullptr) {
size = snprintf(buf, n, "%s\n%s\n%s",
header, function, tail);
} else {
@@ -129,8 +129,8 @@ void IllegalArgumentException::construct(const char* header, const char* extra,
#ifdef CVC4_DEBUG
LastExceptionBuffer* buffer = LastExceptionBuffer::getCurrent();
- if(buffer != NULL){
- if(buffer->getContents() == NULL) {
+ if(buffer != nullptr){
+ if(buffer->getContents() == nullptr) {
buffer->setContents(buf);
}
}
@@ -149,7 +149,7 @@ void IllegalArgumentException::construct(const char* header, const char* extra,
buf = new char[n];
int size;
- if(extra == NULL) {
+ if(extra == nullptr) {
size = snprintf(buf, n, "%s.\n%s\n",
header, function);
} else {
@@ -170,8 +170,8 @@ void IllegalArgumentException::construct(const char* header, const char* extra,
#ifdef CVC4_DEBUG
LastExceptionBuffer* buffer = LastExceptionBuffer::getCurrent();
- if(buffer != NULL){
- if(buffer->getContents() == NULL) {
+ if(buffer != nullptr){
+ if(buffer->getContents() == nullptr) {
buffer->setContents(buf);
}
}
diff --git a/src/base/exception.h b/src/base/exception.h
index 1d49d94cc..8a89c99fc 100644
--- a/src/base/exception.h
+++ b/src/base/exception.h
@@ -151,7 +151,7 @@ public:
static void setCurrent(LastExceptionBuffer* buffer) { s_currentBuffer = buffer; }
static const char* currentContents() {
- return (getCurrent() == NULL) ? NULL : getCurrent()->getContents();
+ return (getCurrent() == nullptr) ? nullptr : getCurrent()->getContents();
}
private:
diff --git a/src/base/listener.h b/src/base/listener.h
index 15256ab01..5c5a58128 100644
--- a/src/base/listener.h
+++ b/src/base/listener.h
@@ -20,8 +20,6 @@
#ifndef CVC4__LISTENER_H
#define CVC4__LISTENER_H
-#include <list>
-
namespace CVC4 {
/**
diff --git a/src/base/output.h b/src/base/output.h
index 96cb9f8ac..9de1d9b09 100644
--- a/src/base/output.h
+++ b/src/base/output.h
@@ -21,10 +21,8 @@
#include <ios>
#include <iostream>
-#include <streambuf>
#include <string>
#include <cstdio>
-#include <cstdarg>
#include <set>
#include <utility>
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback