[cfe-dev] storing copy of QualType like nodes

mobi phil mobi at mobiphil.com
Sun Dec 21 16:39:07 PST 2014


Hi,

the documentation [1] says:

template<typename T > const T* clang::ast_type_traits::DynTypedNode::get

For types that have identity via their pointer in the AST (like Stmt, Decl,
Type and NestedNameSpecifier) the returned pointer points to the referenced
AST node. For other types (like QualType) the value is stored directly in
the DynTypedNode, and the returned pointer points at the storage inside
DynTypedNode. For those nodes, do not use the pointer outside the scope of
the DynTypedNode.

However making a copy of the QualType object for using it "outside" of the
scope of the DynTypeNode, should be safe, or? I need it for a C interface
like libclang.


[1]
http://clang.llvm.org/doxygen/classclang_1_1ast__type__traits_1_1DynTypedNode.html


rgrds,
mobi phil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20141222/62080c38/attachment.html>


More information about the cfe-dev mailing list