diff options
Diffstat (limited to 'lib/AST/Comment.cpp')
-rw-r--r-- | lib/AST/Comment.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/AST/Comment.cpp b/lib/AST/Comment.cpp index 4681d5a143..1520d13417 100644 --- a/lib/AST/Comment.cpp +++ b/lib/AST/Comment.cpp @@ -86,6 +86,38 @@ Comment::child_iterator Comment::child_end() const { llvm_unreachable("Unknown comment kind!"); } +bool TextComment::isWhitespace() const { + for (StringRef::const_iterator I = Text.begin(), E = Text.end(); + I != E; ++I) { + const char C = *I; + if (C != ' ' && C != '\n' && C != '\r' && + C != '\t' && C != '\f' && C != '\v') + return false; + } + return true; +} + +bool ParagraphComment::isWhitespace() const { + for (child_iterator I = child_begin(), E = child_end(); I != E; ++I) { + if (const TextComment *TC = dyn_cast<TextComment>(*I)) { + if (!TC->isWhitespace()) + return false; + } + } + return true; +} + +const char *ParamCommandComment::getDirectionAsString(PassDirection D) { + switch (D) { + case ParamCommandComment::In: + return "[in]"; + case ParamCommandComment::Out: + return "[out]"; + case ParamCommandComment::InOut: + return "[in,out]"; + } + llvm_unreachable("unknown PassDirection"); +} } // end namespace comments } // end namespace clang |