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 2
2
#include " ../Utils.h"
3
3
#include " Enum.h"
4
4
#include " Struct.h"
5
+ #include < stdexcept>
5
6
6
7
TypeDef::TypeDef (std::string name, std::shared_ptr<const Type> type,
7
8
std::shared_ptr<Location> location)
@@ -48,9 +49,10 @@ bool TypeDef::operator==(const Type &other) const {
48
49
49
50
std::shared_ptr<Location> TypeDef::getLocation () const {
50
51
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." );
54
56
}
55
57
if (location) {
56
58
/* if typedef is not generated */
@@ -65,8 +67,8 @@ std::shared_ptr<Location> TypeDef::getLocation() const {
65
67
if (enumPointer) {
66
68
return enumPointer->getLocation ();
67
69
}
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" );
70
72
}
71
73
72
74
bool TypeDef::hasLocation () const { return location || type; }
You can’t perform that action at this time.
0 commit comments