File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change 1313#ifndef SWIFT_CLANGNODE_H
1414#define SWIFT_CLANGNODE_H
1515
16+ #include " swift/Basic/Debug.h"
1617#include " llvm/ADT/PointerUnion.h"
1718
1819namespace clang {
@@ -98,6 +99,8 @@ class ClangNode {
9899 clang::SourceLocation getLocation () const ;
99100 clang::SourceRange getSourceRange () const ;
100101
102+ SWIFT_DEBUG_DUMP;
103+
101104 void *getOpaqueValue () const { return Ptr.getOpaqueValue (); }
102105 static inline ClangNode getFromOpaqueValue (void *VP) {
103106 ClangNode N;
Original file line number Diff line number Diff line change @@ -116,6 +116,17 @@ const clang::Module *ClangNode::getClangModule() const {
116116 return nullptr ;
117117}
118118
119+ void ClangNode::dump () const {
120+ if (auto D = getAsDecl ())
121+ D->dump ();
122+ else if (auto M = getAsMacro ())
123+ M->dump ();
124+ else if (auto M = getAsModule ())
125+ M->dump ();
126+ else
127+ llvm::errs () << " ClangNode contains nullptr\n " ;
128+ }
129+
119130// Only allow allocation of Decls using the allocator in ASTContext.
120131void *Decl::operator new (size_t Bytes, const ASTContext &C,
121132 unsigned Alignment) {
You can’t perform that action at this time.
0 commit comments