File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change 22#include " ../Utils.h"
33#include " Enum.h"
44#include " Struct.h"
5+ #include < stdexcept>
56
67TypeDef::TypeDef (std::string name, std::shared_ptr<const Type> type,
78 std::shared_ptr<Location> location)
@@ -48,9 +49,10 @@ bool TypeDef::operator==(const Type &other) const {
4849
4950std::shared_ptr<Location> TypeDef::getLocation () const {
5051 if (!type) {
51- assert (false && " This method should not be called on typedef that "
52- " references an opaque type because location cannot be "
53- " defined." );
52+ throw std::logic_error (
53+ " TypeDef::getLocation method should not be called on typedef that "
54+ " references an opaque type because location cannot be "
55+ " defined." );
5456 }
5557 if (location) {
5658 /* if typedef is not generated */
@@ -65,8 +67,8 @@ std::shared_ptr<Location> TypeDef::getLocation() const {
6567 if (enumPointer) {
6668 return enumPointer->getLocation ();
6769 }
68- assert ( false &&
69- " Generated typedef may reference only struct, union or enum" );
70+ throw std::logic_error (
71+ " Generated typedef may reference only struct, union or enum" );
7072}
7173
7274bool TypeDef::hasLocation () const { return location || type; }
You can’t perform that action at this time.
0 commit comments