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 13
13
#ifndef SWIFT_CLANGNODE_H
14
14
#define SWIFT_CLANGNODE_H
15
15
16
+ #include " swift/Basic/Debug.h"
16
17
#include " llvm/ADT/PointerUnion.h"
17
18
18
19
namespace clang {
@@ -98,6 +99,8 @@ class ClangNode {
98
99
clang::SourceLocation getLocation () const ;
99
100
clang::SourceRange getSourceRange () const ;
100
101
102
+ SWIFT_DEBUG_DUMP;
103
+
101
104
void *getOpaqueValue () const { return Ptr.getOpaqueValue (); }
102
105
static inline ClangNode getFromOpaqueValue (void *VP) {
103
106
ClangNode N;
Original file line number Diff line number Diff line change @@ -116,6 +116,17 @@ const clang::Module *ClangNode::getClangModule() const {
116
116
return nullptr ;
117
117
}
118
118
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
+
119
130
// Only allow allocation of Decls using the allocator in ASTContext.
120
131
void *Decl::operator new (size_t Bytes, const ASTContext &C,
121
132
unsigned Alignment) {
You can’t perform that action at this time.
0 commit comments