fix update sled
This commit is contained in:
parent
c95ed2feaf
commit
838e33df0b
2
3rdparty/sled
vendored
2
3rdparty/sled
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 5413784c57b02d681e7b02648fab6b2ac4bb4dcb
|
Subproject commit f31657640f5731c2f86206190fe1d59728225795
|
@ -26,6 +26,8 @@ public:
|
|||||||
CXTypeKind GetKind(void) const;
|
CXTypeKind GetKind(void) const;
|
||||||
bool IsConst(void) const;
|
bool IsConst(void) const;
|
||||||
|
|
||||||
|
CXType handle() const { return handle_; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CXType handle_;
|
CXType handle_;
|
||||||
};
|
};
|
||||||
|
@ -10,7 +10,7 @@ const char *kTag = "main";
|
|||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
LOGI(kTag, "cwd={}", sled::Path::Current().ToString());
|
// LOGI(kTag, "cwd={}", sled::Path::Current().ToString());
|
||||||
meta::Parser parser;
|
meta::Parser parser;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (i = 1; i < argc; i++) {
|
for (i = 1; i < argc; i++) {
|
||||||
|
@ -19,6 +19,12 @@ BaseType::BaseType(const Cursor &cursor, const std::vector<std::string> &namespa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string
|
||||||
|
BaseType::type_name() const
|
||||||
|
{
|
||||||
|
return cursor_.GetType().GetDisplayName();
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<std::string>
|
std::vector<std::string>
|
||||||
BaseType::GetProperties(const Cursor &annotation_cursor)
|
BaseType::GetProperties(const Cursor &annotation_cursor)
|
||||||
{
|
{
|
||||||
@ -33,7 +39,7 @@ BaseType::ToString() const
|
|||||||
{
|
{
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss << name();
|
ss << name();
|
||||||
if (!properties_.empty()) { ss << " [" << sled::StrJoin(properties(), ",") << "]"; }
|
if (!properties_.empty()) { ss << " /*" << sled::StrJoin(properties(), ",") << "*/"; }
|
||||||
return ss.str();
|
return ss.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,6 +13,8 @@ public:
|
|||||||
|
|
||||||
virtual std::string name() const { return cursor_.GetSpelling(); }
|
virtual std::string name() const { return cursor_.GetSpelling(); }
|
||||||
|
|
||||||
|
virtual std::string type_name() const;
|
||||||
|
|
||||||
virtual std::string ToString() const;
|
virtual std::string ToString() const;
|
||||||
|
|
||||||
virtual bool ShouldGenerate() const { return !properties_.empty(); }
|
virtual bool ShouldGenerate() const { return !properties_.empty(); }
|
||||||
|
@ -19,7 +19,7 @@ Field::Field(const Cursor &cursor, const std::vector<std::string> &namespaces, c
|
|||||||
std::string
|
std::string
|
||||||
Field::ToString() const
|
Field::ToString() const
|
||||||
{
|
{
|
||||||
return BaseType::ToString();
|
return type_name() + " " + BaseType::ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
}// namespace meta
|
}// namespace meta
|
||||||
|
@ -1,17 +1,36 @@
|
|||||||
#include "method.h"
|
#include "method.h"
|
||||||
|
#include <sled/log/log.h>
|
||||||
|
#include <sled/strings/utils.h>
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
namespace meta {
|
namespace meta {
|
||||||
Method::Method(const Cursor &cursor,
|
Method::Method(const Cursor &cursor,
|
||||||
const std::vector<std::string> &namespaces,
|
const std::vector<std::string> &namespaces,
|
||||||
const Class &parent)
|
const Class &parent)
|
||||||
: BaseType(cursor, namespaces),
|
: BaseType(cursor, namespaces),
|
||||||
parent_(parent)
|
parent_(parent),
|
||||||
{}
|
return_type_(clang_getResultType(cursor.GetType().handle()))
|
||||||
|
{
|
||||||
|
unsigned args_num = clang_Cursor_getNumArguments(cursor.handle());
|
||||||
|
|
||||||
|
for (unsigned i = 0; i < args_num; ++i) {
|
||||||
|
Cursor arg = clang_Cursor_getArgument(cursor.handle(), i);
|
||||||
|
arguments_.push_back(arg.GetType());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::string
|
std::string
|
||||||
Method::ToString() const
|
Method::ToString() const
|
||||||
{
|
{
|
||||||
return BaseType::ToString();
|
std::stringstream ss;
|
||||||
|
// ss << type_name();
|
||||||
|
ss << return_type_.GetDisplayName() << " " << name() << "(";
|
||||||
|
for (unsigned i = 0; i < arguments_.size(); ++i) {
|
||||||
|
ss << arguments_[i].GetDisplayName();
|
||||||
|
if (i < arguments_.size() - 1) { ss << ", "; }
|
||||||
|
}
|
||||||
|
ss << ")";
|
||||||
|
return ss.str() + " /*" + sled::StrJoin(properties(), ",") + "*/";
|
||||||
}
|
}
|
||||||
|
|
||||||
}// namespace meta
|
}// namespace meta
|
||||||
|
@ -12,8 +12,14 @@ public:
|
|||||||
|
|
||||||
std::string ToString() const override;
|
std::string ToString() const override;
|
||||||
|
|
||||||
|
CursorType return_type() const;
|
||||||
|
CursorType argument(unsigned index) const;
|
||||||
|
std::vector<CursorType> arguments() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const Class &parent_;
|
const Class &parent_;
|
||||||
|
CursorType return_type_;
|
||||||
|
std::vector<CursorType> arguments_;
|
||||||
};
|
};
|
||||||
}// namespace meta
|
}// namespace meta
|
||||||
#endif// META_TYPES_METHOD_H
|
#endif// META_TYPES_METHOD_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user