Some fixes for clang

This commit is contained in:
Thomas Krijnen
2018-09-19 14:05:19 +02:00
parent 9a3039765f
commit e8b28a099f
8 changed files with 30 additions and 16 deletions
+8
View File
@@ -333,6 +333,14 @@ public:
return items;
}
virtual bool convert_placement(IfcUtil::IfcBaseClass* item, gp_Trsf& trsf) {
if (item->as<IfcSchema::IfcObjectPlacement>()) {
return convert(item->as<IfcSchema::IfcObjectPlacement>(), trsf);
} else {
return false;
}
}
};
IfcUtil::IfcBaseClass* MAKE_TYPE_NAME(tesselate_)(const TopoDS_Shape& shape, double deflection);
+1 -1
View File
@@ -607,7 +607,7 @@ namespace IfcGeom {
ifc_product = ifc_entity->as<IfcSchema::IfcProduct>();
parent_id = -1;
try {
IfcSchema::IfcObjectDefinition* parent_object = kernel.get_decomposing_entity(ifc_product)->as<IfcSchema::IfcObjectDefinition>();
IfcSchema::IfcObjectDefinition* parent_object = kernel.get_decomposing_entity(ifc_product)->template as<IfcSchema::IfcObjectDefinition>();
if (parent_object) {
parent_id = parent_object->data().id();
}
+9
View File
@@ -128,6 +128,15 @@ IfcUtil::IfcBaseEntity* IfcGeom::Kernel::get_decomposing_entity(IfcUtil::IfcBase
}
namespace {
// LayerAssignments renamed from plural to singular, LayerAssignment, so work around that
IfcEntityList::ptr getLayerAssignments(Ifc2x3::IfcRepresentationItem* item) {
return item->LayerAssignments()->generalize();
}
IfcEntityList::ptr getLayerAssignments(Ifc4::IfcRepresentationItem* item) {
return item->LayerAssignment()->generalize();
}
template <typename Schema>
static std::map<std::string, IfcUtil::IfcBaseEntity*> get_layers_impl(typename Schema::IfcProduct* prod) {
std::map<std::string, IfcUtil::IfcBaseEntity*> layers;
+2 -12
View File
@@ -12,16 +12,6 @@
#include <TopExp_Explorer.hxx>
namespace {
// LayerAssignments renamed from plural to singular, LayerAssignment, so work around that
IfcEntityList::ptr getLayerAssignments(Ifc2x3::IfcRepresentationItem* item) {
return item->LayerAssignments()->generalize();
}
IfcEntityList::ptr getLayerAssignments(Ifc4::IfcRepresentationItem* item) {
return item->LayerAssignment()->generalize();
}
}
namespace IfcGeom {
template <typename P, typename PP>
@@ -89,8 +79,8 @@ namespace IfcGeom {
return implementation_->convert(item);
}
virtual bool convert(IfcUtil::IfcBaseClass* item, gp_Trsf& trsf) {
return implementation_->convert(item, trsf);
virtual bool convert_placement(IfcUtil::IfcBaseClass* item, gp_Trsf& trsf) {
return implementation_->convert_placement(item, trsf);
}
static int count(const TopoDS_Shape&, TopAbs_ShapeEnum);
+1
View File
@@ -1791,6 +1791,7 @@ class IFC2X3_instance_factory : public IfcParse::instance_factory {
#if defined(__clang__)
__attribute__((optnone))
#elif defined(__GNUC__) || defined(__GNUG__)
#pragma GCC push_options
#pragma GCC optimize ("O0")
+1
View File
@@ -2105,6 +2105,7 @@ class IFC4_instance_factory : public IfcParse::instance_factory {
#if defined(__clang__)
__attribute__((optnone))
#elif defined(__GNUC__) || defined(__GNUG__)
#pragma GCC push_options
#pragma GCC optimize ("O0")
+7 -2
View File
@@ -38,6 +38,10 @@ namespace IfcUtil {
class IFC_PARSE_API IfcBaseClass {
protected:
IfcEntityInstanceData* data_;
static bool is_null(const IfcBaseClass* not_this) {
return !not_this;
}
public:
IfcBaseClass() : data_(0) {}
@@ -52,7 +56,8 @@ namespace IfcUtil {
template <class T>
T* as() {
if (this == 0) {
// @todo: do not allow this to be null in the first place
if (is_null(this)) {
return static_cast<T*>(0);
}
return declaration().is(T::Class())
@@ -62,7 +67,7 @@ namespace IfcUtil {
template <class T>
const T* as() const {
if (this == 0) {
if (is_null(this)) {
return static_cast<const T*>(0);
}
return declaration().is(T::Class())
+1 -1
View File
@@ -527,7 +527,7 @@ static void start_element(void* user, const xmlChar* tag, const xmlChar** attrs)
instance_to_attribute(inst_or_reference, attr, newinst);
state->stack.back().inst()->data().setArgument(idx, attr);
state->stack.push_back(stack_node::instance(id_in_file, newinst));
} else if (auto select = attribute_type->as_named_type()->declared_type()->as_select_type()) {
} else if (attribute_type->as_named_type()->declared_type()->as_select_type()) {
// Select types cause an additional indirection, so the current stack node is simply repeated
state->stack.push_back(stack_node::select(state->stack.back().inst(), idx));
}