本文整理汇总了C++中NamespaceDecl::getName方法的典型用法代码示例。如果您正苦于以下问题:C++ NamespaceDecl::getName方法的具体用法?C++ NamespaceDecl::getName怎么用?C++ NamespaceDecl::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NamespaceDecl
的用法示例。
在下文中一共展示了NamespaceDecl::getName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: NeedsFinalization
// TODO: Add classes with a finalize() method that specialize FinalizerTrait.
bool RecordInfo::NeedsFinalization() {
if (does_need_finalization_ == kNotComputed) {
// Rely on hasNonTrivialDestructor(), but if the only
// identifiable reason for it being true is the presence
// of a safely ignorable class as a direct base,
// or we're processing such an 'ignorable' class, then it does
// not need finalization.
does_need_finalization_ =
record_->hasNonTrivialDestructor() ? kTrue : kFalse;
if (!does_need_finalization_)
return does_need_finalization_;
// Processing a class with a safely-ignorable destructor.
NamespaceDecl* ns =
dyn_cast<NamespaceDecl>(record_->getDeclContext());
if (ns && Config::HasIgnorableDestructor(ns->getName(), name_)) {
does_need_finalization_ = kFalse;
return does_need_finalization_;
}
CXXDestructorDecl* dtor = record_->getDestructor();
if (dtor && dtor->isUserProvided())
return does_need_finalization_;
for (Fields::iterator it = GetFields().begin();
it != GetFields().end();
++it) {
if (it->second.edge()->NeedsFinalization())
return does_need_finalization_;
}
for (Bases::iterator it = GetBases().begin();
it != GetBases().end();
++it) {
if (it->second.info()->NeedsFinalization())
return does_need_finalization_;
}
// Destructor was non-trivial due to bases with destructors that
// can be safely ignored. Hence, no need for finalization.
does_need_finalization_ = kFalse;
}
return does_need_finalization_;
}
示例2: CreateEdge
Edge* RecordInfo::CreateEdge(const Type* type) {
if (!type) {
return 0;
}
if (type->isPointerType() || type->isReferenceType()) {
if (Edge* ptr = CreateEdge(type->getPointeeType().getTypePtrOrNull()))
return new RawPtr(ptr, false, type->isReferenceType());
return 0;
}
RecordInfo* info = cache_->Lookup(type);
// If the type is neither a pointer or a C++ record we ignore it.
if (!info) {
return 0;
}
TemplateArgs args;
if (Config::IsRawPtr(info->name()) && info->GetTemplateArgs(1, &args)) {
if (Edge* ptr = CreateEdge(args[0]))
return new RawPtr(ptr, true, false);
return 0;
}
if (Config::IsRefPtr(info->name()) && info->GetTemplateArgs(1, &args)) {
if (Edge* ptr = CreateEdge(args[0]))
return new RefPtr(ptr);
return 0;
}
if (Config::IsOwnPtr(info->name()) && info->GetTemplateArgs(1, &args)) {
if (Edge* ptr = CreateEdge(args[0]))
return new OwnPtr(ptr);
return 0;
}
if (Config::IsMember(info->name()) && info->GetTemplateArgs(1, &args)) {
if (Edge* ptr = CreateEdge(args[0]))
return new Member(ptr);
return 0;
}
if (Config::IsWeakMember(info->name()) && info->GetTemplateArgs(1, &args)) {
if (Edge* ptr = CreateEdge(args[0]))
return new WeakMember(ptr);
return 0;
}
if (Config::IsPersistent(info->name())) {
// Persistent might refer to v8::Persistent, so check the name space.
// TODO: Consider using a more canonical identification than names.
NamespaceDecl* ns =
dyn_cast<NamespaceDecl>(info->record()->getDeclContext());
if (!ns || ns->getName() != "blink")
return 0;
if (!info->GetTemplateArgs(1, &args))
return 0;
if (Edge* ptr = CreateEdge(args[0]))
return new Persistent(ptr);
return 0;
}
if (Config::IsGCCollection(info->name()) ||
Config::IsWTFCollection(info->name())) {
bool is_root = Config::IsPersistentGCCollection(info->name());
bool on_heap = is_root || info->IsHeapAllocatedCollection();
size_t count = Config::CollectionDimension(info->name());
if (!info->GetTemplateArgs(count, &args))
return 0;
Collection* edge = new Collection(info, on_heap, is_root);
for (TemplateArgs::iterator it = args.begin(); it != args.end(); ++it) {
if (Edge* member = CreateEdge(*it)) {
edge->members().push_back(member);
}
// TODO: Handle the case where we fail to create an edge (eg, if the
// argument is a primitive type or just not fully known yet).
}
return edge;
}
return new Value(info);
}
示例3: CreateEdge
Edge* RecordInfo::CreateEdge(const Type* type) {
if (!type) {
return 0;
}
if (type->isPointerType()) {
if (Edge* ptr = CreateEdge(type->getPointeeType().getTypePtrOrNull()))
return new RawPtr(ptr);
return 0;
}
RecordInfo* info = cache_->Lookup(type);
// If the type is neither a pointer or a C++ record we ignore it.
if (!info) {
return 0;
}
TemplateArgs args;
if (Config::IsRawPtr(info->name()) && info->GetTemplateArgs(1, &args)) {
if (Edge* ptr = CreateEdge(args[0]))
return new RawPtr(ptr);
return 0;
}
if (Config::IsRefPtr(info->name()) && info->GetTemplateArgs(1, &args)) {
if (Edge* ptr = CreateEdge(args[0]))
return new RefPtr(ptr);
return 0;
}
if (Config::IsOwnPtr(info->name()) && info->GetTemplateArgs(1, &args)) {
if (Edge* ptr = CreateEdge(args[0]))
return new OwnPtr(ptr);
return 0;
}
if (Config::IsMember(info->name()) && info->GetTemplateArgs(1, &args)) {
if (Edge* ptr = CreateEdge(args[0]))
return new Member(ptr);
return 0;
}
if (Config::IsWeakMember(info->name()) && info->GetTemplateArgs(1, &args)) {
if (Edge* ptr = CreateEdge(args[0]))
return new WeakMember(ptr);
return 0;
}
if (Config::IsPersistent(info->name())) {
// Persistent might refer to v8::Persistent, so check the name space.
// TODO: Consider using a more canonical identification than names.
NamespaceDecl* ns =
dyn_cast<NamespaceDecl>(info->record()->getDeclContext());
if (!ns || ns->getName() != "WebCore")
return 0;
if (!info->GetTemplateArgs(1, &args))
return 0;
if (Edge* ptr = CreateEdge(args[0]))
return new Persistent(ptr);
return 0;
}
if (Config::IsGCCollection(info->name()) ||
Config::IsWTFCollection(info->name())) {
bool is_root = Config::IsPersistentGCCollection(info->name());
bool on_heap = is_root || info->IsHeapAllocatedCollection();
size_t count = Config::CollectionDimension(info->name());
if (!info->GetTemplateArgs(count, &args))
return 0;
Collection* edge = new Collection(info, on_heap, is_root);
for (TemplateArgs::iterator it = args.begin(); it != args.end(); ++it) {
if (Edge* member = CreateEdge(*it)) {
edge->members().push_back(member);
} else {
// We failed to create an edge so abort the entire edge construction.
delete edge; // Will delete the already allocated members.
return 0;
}
}
return edge;
}
return new Value(info);
}