Browse Source

Merge pull request #222 from ddobrev/enum_empty

Fixed a regression in the new parser causing a crash on enums with empty names
pull/223/merge
João Matos 11 years ago
parent
commit
3555c647f1
  1. 6
      src/CppParser/AST.cpp
  2. 6
      tests/Basic/Basic.h

6
src/CppParser/AST.cpp

@ -13,6 +13,10 @@ @@ -13,6 +13,10 @@
template<typename T>
static std::vector<T> split(const T & str, const T & delimiters) {
std::vector<T> v;
if (str.length() == 0) {
v.push_back(str);
return v;
}
typename T::size_type start = 0;
auto pos = str.find_first_of(delimiters, start);
while(pos != T::npos) {
@ -238,8 +242,6 @@ Class* DeclarationContext::FindClass(const std::string& Name, bool IsComplete, @@ -238,8 +242,6 @@ Class* DeclarationContext::FindClass(const std::string& Name, bool IsComplete,
Enumeration* DeclarationContext::FindEnum(const std::string& Name, bool Create)
{
if (Name.empty()) return nullptr;
auto entries = split<std::string>(Name, "::");
if (entries.size() == 1)

6
tests/Basic/Basic.h

@ -288,3 +288,9 @@ public: @@ -288,3 +288,9 @@ public:
int A;
float B;
};
template <class T>
struct EmptyNamedNestedEnum
{
enum { Value = 10 };
};

Loading…
Cancel
Save