mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Now Decl::getBriefComment() returns the real brief comment, instead of placeholder text. Swift SVN r15048
76 lines
2.0 KiB
C++
76 lines
2.0 KiB
C++
//===--- RawComment.h - Extraction of raw comments ------------------------===//
|
|
//
|
|
// This source file is part of the Swift.org open source project
|
|
//
|
|
// Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
|
|
// Licensed under Apache License v2.0 with Runtime Library Exception
|
|
//
|
|
// See http://swift.org/LICENSE.txt for license information
|
|
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef SWIFT_AST_RAW_COMMENT_H
|
|
#define SWIFT_AST_RAW_COMMENT_H
|
|
|
|
#include "swift/Basic/LLVM.h"
|
|
#include "swift/Basic/SourceLoc.h"
|
|
#include "swift/Basic/SourceManager.h"
|
|
|
|
namespace swift {
|
|
struct SingleRawComment {
|
|
enum class CommentKind {
|
|
OrdinaryLine, ///< Any normal // comments
|
|
OrdinaryBlock, ///< Any normal /* */ comment
|
|
LineDoc, ///< \code /// stuff \endcode
|
|
BlockDoc, ///< \code /** stuff */ \endcode
|
|
};
|
|
|
|
const CharSourceRange Range;
|
|
const StringRef RawText;
|
|
|
|
const CommentKind Kind;
|
|
const unsigned StartLine;
|
|
const unsigned EndLine;
|
|
|
|
SingleRawComment(CharSourceRange Range, const SourceManager &SourceMgr);
|
|
SingleRawComment(StringRef RawText);
|
|
|
|
SingleRawComment(const SingleRawComment &) = default;
|
|
SingleRawComment &operator=(const SingleRawComment &) = default;
|
|
|
|
bool isOrdinary() const LLVM_READONLY {
|
|
return Kind == CommentKind::OrdinaryLine ||
|
|
Kind == CommentKind::OrdinaryBlock;
|
|
}
|
|
|
|
bool isLine() const LLVM_READONLY {
|
|
return Kind == CommentKind::OrdinaryLine ||
|
|
Kind == CommentKind::LineDoc;
|
|
}
|
|
};
|
|
|
|
struct RawComment {
|
|
ArrayRef<SingleRawComment> Comments;
|
|
|
|
RawComment() {}
|
|
RawComment(ArrayRef<SingleRawComment> Comments) : Comments(Comments) {}
|
|
|
|
RawComment(const RawComment &) = default;
|
|
RawComment &operator=(const RawComment &) = default;
|
|
|
|
bool isEmpty() const {
|
|
return Comments.empty();
|
|
}
|
|
};
|
|
|
|
struct BriefAndRawComment {
|
|
StringRef Brief;
|
|
RawComment Raw;
|
|
};
|
|
|
|
} // namespace swift
|
|
|
|
#endif // LLVM_SWIFT_AST_RAW_COMMENT_H
|
|
|