diff options
Diffstat (limited to 'clang/lib/AST/Comment.cpp')
-rw-r--r-- | clang/lib/AST/Comment.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/clang/lib/AST/Comment.cpp b/clang/lib/AST/Comment.cpp index 1520d134172..e215e63dec9 100644 --- a/clang/lib/AST/Comment.cpp +++ b/clang/lib/AST/Comment.cpp @@ -9,6 +9,7 @@ #include "clang/AST/Comment.h" #include "llvm/Support/ErrorHandling.h" +#include "llvm/Support/raw_ostream.h" namespace clang { namespace comments { @@ -27,6 +28,19 @@ const char *Comment::getCommentKindName() const { llvm_unreachable("Unknown comment kind!"); } +void Comment::dump() const { + // It is important that Comment::dump() is defined in a different TU than + // Comment::dump(raw_ostream, SourceManager). If both functions were defined + // in CommentDumper.cpp, that object file would be removed by linker because + // none of its functions are referenced by other object files, despite the + // LLVM_ATTRIBUTE_USED. + dump(llvm::errs(), NULL); +} + +void Comment::dump(SourceManager &SM) const { + dump(llvm::errs(), &SM); +} + namespace { struct good {}; struct bad {}; |