summaryrefslogtreecommitdiff
path: root/src/theory
diff options
context:
space:
mode:
authorAina Niemetz <aina.niemetz@gmail.com>2021-04-20 11:58:46 -0700
committerGitHub <noreply@github.com>2021-04-20 18:58:46 +0000
commit92fa57d6ec03ea19cf5ef177905ee59f29231e8f (patch)
tree704f9ef88ac86122358dac4b95300146d03fb35a /src/theory
parent1d5a6e4a0773064ca0f1465b5e94a301af4eee2e (diff)
Add guards to disable clang-format around placeholders in templates. (#6375)
Diffstat (limited to 'src/theory')
-rw-r--r--src/theory/rewriter_tables_template.h95
-rw-r--r--src/theory/theory_traits_template.h20
-rw-r--r--src/theory/type_enumerator_template.cpp7
3 files changed, 80 insertions, 42 deletions
diff --git a/src/theory/rewriter_tables_template.h b/src/theory/rewriter_tables_template.h
index 5c52e79b5..c549f8cfb 100644
--- a/src/theory/rewriter_tables_template.h
+++ b/src/theory/rewriter_tables_template.h
@@ -20,76 +20,101 @@
#pragma once
+#include "expr/attribute.h"
+#include "expr/attribute_unique_id.h"
#include "theory/rewriter.h"
#include "theory/rewriter_attributes.h"
-#include "expr/attribute_unique_id.h"
-#include "expr/attribute.h"
+// clang-format off
${rewriter_includes}
+// clang-format on
namespace cvc5 {
namespace theory {
-Node Rewriter::getPreRewriteCache(theory::TheoryId theoryId, TNode node) {
- switch(theoryId) {
+Node Rewriter::getPreRewriteCache(theory::TheoryId theoryId, TNode node)
+{
+ switch (theoryId)
+ {
+ // clang-format off
${pre_rewrite_get_cache}
- default:
- Unreachable();
+ // clang-format on
+ default: Unreachable();
}
}
-Node Rewriter::getPostRewriteCache(theory::TheoryId theoryId, TNode node) {
- switch(theoryId) {
+Node Rewriter::getPostRewriteCache(theory::TheoryId theoryId, TNode node)
+{
+ switch (theoryId)
+ {
+ // clang-format off
${post_rewrite_get_cache}
- default:
- Unreachable();
+ // clang-format on
+ default: Unreachable();
}
}
-void Rewriter::setPreRewriteCache(theory::TheoryId theoryId, TNode node, TNode cache) {
- switch(theoryId) {
+void Rewriter::setPreRewriteCache(theory::TheoryId theoryId,
+ TNode node,
+ TNode cache)
+{
+ switch (theoryId)
+ {
+ // clang-format off
${pre_rewrite_set_cache}
- default:
- Unreachable();
+ // clang-format on
+ default: Unreachable();
}
}
-void Rewriter::setPostRewriteCache(theory::TheoryId theoryId, TNode node, TNode cache) {
- switch(theoryId) {
+void Rewriter::setPostRewriteCache(theory::TheoryId theoryId,
+ TNode node,
+ TNode cache)
+{
+ switch (theoryId)
+ {
+ // clang-format off
${post_rewrite_set_cache}
- default:
- Unreachable();
+ // clang-format on
+ default: Unreachable();
}
}
Rewriter::Rewriter() : d_tpg(nullptr)
{
-for (size_t i = 0; i < kind::LAST_KIND; ++i)
-{
- d_preRewriters[i] = nullptr;
- d_postRewriters[i] = nullptr;
-}
+ for (size_t i = 0; i < kind::LAST_KIND; ++i)
+ {
+ d_preRewriters[i] = nullptr;
+ d_postRewriters[i] = nullptr;
+ }
-for (size_t i = 0; i < theory::THEORY_LAST; ++i)
-{
- d_preRewritersEqual[i] = nullptr;
- d_postRewritersEqual[i] = nullptr;
-}
+ for (size_t i = 0; i < theory::THEORY_LAST; ++i)
+ {
+ d_preRewritersEqual[i] = nullptr;
+ d_postRewritersEqual[i] = nullptr;
+ }
}
-void Rewriter::clearCachesInternal() {
+void Rewriter::clearCachesInternal()
+{
typedef cvc5::expr::attr::AttributeUniqueId AttributeUniqueId;
std::vector<AttributeUniqueId> preids;
- ${pre_rewrite_attribute_ids}
+ // clang-format off
+ ${pre_rewrite_attribute_ids} // clang-format on
- std::vector<AttributeUniqueId> postids;
- ${post_rewrite_attribute_ids}
+ std::vector<AttributeUniqueId>
+ postids;
+ // clang-format off
+ ${post_rewrite_attribute_ids} // clang-format on
- std::vector<const AttributeUniqueId*> allids;
- for(unsigned i = 0; i < preids.size(); ++i){
+ std::vector<const AttributeUniqueId*>
+ allids;
+ for (size_t i = 0, size = preids.size(); i < size; ++i)
+ {
allids.push_back(&preids[i]);
}
- for(unsigned i = 0; i < postids.size(); ++i){
+ for (size_t i = 0, size = postids.size(); i < size; ++i)
+ {
allids.push_back(&postids[i]);
}
NodeManager::currentNM()->deleteAttributes(allids);
diff --git a/src/theory/theory_traits_template.h b/src/theory/theory_traits_template.h
index 75a922096..fa6552be1 100644
--- a/src/theory/theory_traits_template.h
+++ b/src/theory/theory_traits_template.h
@@ -25,7 +25,9 @@
#include "options/theory_options.h"
#include "theory/theory.h"
+// clang-format off
${theory_includes}
+// clang-format on
namespace cvc5 {
namespace theory {
@@ -33,15 +35,21 @@ namespace theory {
template <TheoryId theoryId>
struct TheoryTraits;
+// clang-format off
${theory_traits}
-
-struct TheoryConstructor {
- static void addTheory(TheoryEngine* engine, TheoryId id) {
- switch(id) {
-
+// clang-format on
+
+struct TheoryConstructor
+{
+ static void addTheory(TheoryEngine* engine, TheoryId id)
+ {
+ switch (id)
+ {
+ // clang-format off
${theory_constructors}
+ // clang-format on
-default: Unhandled() << id;
+ default: Unhandled() << id;
}
}
}; /* struct cvc5::theory::TheoryConstructor */
diff --git a/src/theory/type_enumerator_template.cpp b/src/theory/type_enumerator_template.cpp
index a8ffc8b2d..4f942d6c6 100644
--- a/src/theory/type_enumerator_template.cpp
+++ b/src/theory/type_enumerator_template.cpp
@@ -19,8 +19,9 @@
#include "expr/kind.h"
#include "theory/type_enumerator.h"
-
+// clang-format off
${type_enumerator_includes}
+// clang-format on
using namespace std;
@@ -35,11 +36,15 @@ TypeEnumeratorInterface* TypeEnumerator::mkTypeEnumerator(
case kind::TYPE_CONSTANT:
switch (type.getConst<TypeConstant>())
{
+ // clang-format off
${mk_type_enumerator_type_constant_cases}
+ // clang-format on
default: Unhandled() << "No type enumerator for type `" << type << "'";
}
Unreachable();
+ // clang-format off
${mk_type_enumerator_cases}
+ // clang-format on
default: Unhandled() << "No type enumerator for type `" << type << "'";
}
Unreachable();
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback