/Users/buildslave/jenkins/workspace/coverage/llvm-project/clang/tools/libclang/CXComment.h
Line | Count | Source (jump to first uncovered line) |
1 | | //===- CXComment.h - Routines for manipulating CXComments -----------------===// |
2 | | // |
3 | | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | | // See https://llvm.org/LICENSE.txt for license information. |
5 | | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | | // |
7 | | //===----------------------------------------------------------------------===// |
8 | | // |
9 | | // This file defines routines for manipulating CXComments. |
10 | | // |
11 | | //===----------------------------------------------------------------------===// |
12 | | |
13 | | #ifndef LLVM_CLANG_TOOLS_LIBCLANG_CXCOMMENT_H |
14 | | #define LLVM_CLANG_TOOLS_LIBCLANG_CXCOMMENT_H |
15 | | |
16 | | #include "CXTranslationUnit.h" |
17 | | #include "clang-c/Documentation.h" |
18 | | #include "clang-c/Index.h" |
19 | | #include "clang/AST/ASTContext.h" |
20 | | #include "clang/AST/Comment.h" |
21 | | #include "clang/Frontend/ASTUnit.h" |
22 | | |
23 | | namespace clang { |
24 | | namespace comments { |
25 | | class CommandTraits; |
26 | | } |
27 | | |
28 | | namespace cxcomment { |
29 | | |
30 | | static inline CXComment createCXComment(const comments::Comment *C, |
31 | 94.7k | CXTranslationUnit TU) { |
32 | 94.7k | CXComment Result; |
33 | 94.7k | Result.ASTNode = C; |
34 | 94.7k | Result.TranslationUnit = TU; |
35 | 94.7k | return Result; |
36 | 94.7k | } |
37 | | |
38 | 121k | static inline const comments::Comment *getASTNode(CXComment CXC) { |
39 | 121k | return static_cast<const comments::Comment *>(CXC.ASTNode); |
40 | 121k | } |
41 | | |
42 | | template<typename T> |
43 | 10.1k | static inline const T *getASTNodeAs(CXComment CXC) { |
44 | 10.1k | const comments::Comment *C = getASTNode(CXC); |
45 | 10.1k | if (!C) |
46 | 0 | return nullptr; |
47 | | |
48 | 10.1k | return dyn_cast<T>(C); |
49 | 10.1k | } CXComment.cpp:clang::comments::InlineContentComment const* clang::cxcomment::getASTNodeAs<clang::comments::InlineContentComment>(CXComment) Line | Count | Source | 43 | 2.57k | static inline const T *getASTNodeAs(CXComment CXC) { | 44 | 2.57k | const comments::Comment *C = getASTNode(CXC); | 45 | 2.57k | if (!C) | 46 | 0 | return nullptr; | 47 | | | 48 | 2.57k | return dyn_cast<T>(C); | 49 | 2.57k | } |
CXComment.cpp:clang::comments::TextComment const* clang::cxcomment::getASTNodeAs<clang::comments::TextComment>(CXComment) Line | Count | Source | 43 | 2.31k | static inline const T *getASTNodeAs(CXComment CXC) { | 44 | 2.31k | const comments::Comment *C = getASTNode(CXC); | 45 | 2.31k | if (!C) | 46 | 0 | return nullptr; | 47 | | | 48 | 2.31k | return dyn_cast<T>(C); | 49 | 2.31k | } |
CXComment.cpp:clang::comments::InlineCommandComment const* clang::cxcomment::getASTNodeAs<clang::comments::InlineCommandComment>(CXComment) Line | Count | Source | 43 | 577 | static inline const T *getASTNodeAs(CXComment CXC) { | 44 | 577 | const comments::Comment *C = getASTNode(CXC); | 45 | 577 | if (!C) | 46 | 0 | return nullptr; | 47 | | | 48 | 577 | return dyn_cast<T>(C); | 49 | 577 | } |
CXComment.cpp:clang::comments::HTMLTagComment const* clang::cxcomment::getASTNodeAs<clang::comments::HTMLTagComment>(CXComment) Line | Count | Source | 43 | 78 | static inline const T *getASTNodeAs(CXComment CXC) { | 44 | 78 | const comments::Comment *C = getASTNode(CXC); | 45 | 78 | if (!C) | 46 | 0 | return nullptr; | 47 | | | 48 | 78 | return dyn_cast<T>(C); | 49 | 78 | } |
CXComment.cpp:clang::comments::HTMLStartTagComment const* clang::cxcomment::getASTNodeAs<clang::comments::HTMLStartTagComment>(CXComment) Line | Count | Source | 43 | 136 | static inline const T *getASTNodeAs(CXComment CXC) { | 44 | 136 | const comments::Comment *C = getASTNode(CXC); | 45 | 136 | if (!C) | 46 | 0 | return nullptr; | 47 | | | 48 | 136 | return dyn_cast<T>(C); | 49 | 136 | } |
CXComment.cpp:clang::comments::BlockCommandComment const* clang::cxcomment::getASTNodeAs<clang::comments::BlockCommandComment>(CXComment) Line | Count | Source | 43 | 1.03k | static inline const T *getASTNodeAs(CXComment CXC) { | 44 | 1.03k | const comments::Comment *C = getASTNode(CXC); | 45 | 1.03k | if (!C) | 46 | 0 | return nullptr; | 47 | | | 48 | 1.03k | return dyn_cast<T>(C); | 49 | 1.03k | } |
CXComment.cpp:clang::comments::ParamCommandComment const* clang::cxcomment::getASTNodeAs<clang::comments::ParamCommandComment>(CXComment) Line | Count | Source | 43 | 956 | static inline const T *getASTNodeAs(CXComment CXC) { | 44 | 956 | const comments::Comment *C = getASTNode(CXC); | 45 | 956 | if (!C) | 46 | 0 | return nullptr; | 47 | | | 48 | 956 | return dyn_cast<T>(C); | 49 | 956 | } |
CXComment.cpp:clang::comments::TParamCommandComment const* clang::cxcomment::getASTNodeAs<clang::comments::TParamCommandComment>(CXComment) Line | Count | Source | 43 | 438 | static inline const T *getASTNodeAs(CXComment CXC) { | 44 | 438 | const comments::Comment *C = getASTNode(CXC); | 45 | 438 | if (!C) | 46 | 0 | return nullptr; | 47 | | | 48 | 438 | return dyn_cast<T>(C); | 49 | 438 | } |
CXComment.cpp:clang::comments::VerbatimBlockLineComment const* clang::cxcomment::getASTNodeAs<clang::comments::VerbatimBlockLineComment>(CXComment) Line | Count | Source | 43 | 17 | static inline const T *getASTNodeAs(CXComment CXC) { | 44 | 17 | const comments::Comment *C = getASTNode(CXC); | 45 | 17 | if (!C) | 46 | 0 | return nullptr; | 47 | | | 48 | 17 | return dyn_cast<T>(C); | 49 | 17 | } |
CXComment.cpp:clang::comments::VerbatimLineComment const* clang::cxcomment::getASTNodeAs<clang::comments::VerbatimLineComment>(CXComment) Line | Count | Source | 43 | 45 | static inline const T *getASTNodeAs(CXComment CXC) { | 44 | 45 | const comments::Comment *C = getASTNode(CXC); | 45 | 45 | if (!C) | 46 | 0 | return nullptr; | 47 | | | 48 | 45 | return dyn_cast<T>(C); | 49 | 45 | } |
CXComment.cpp:clang::comments::FullComment const* clang::cxcomment::getASTNodeAs<clang::comments::FullComment>(CXComment) Line | Count | Source | 43 | 1.94k | static inline const T *getASTNodeAs(CXComment CXC) { | 44 | 1.94k | const comments::Comment *C = getASTNode(CXC); | 45 | 1.94k | if (!C) | 46 | 0 | return nullptr; | 47 | | | 48 | 1.94k | return dyn_cast<T>(C); | 49 | 1.94k | } |
|
50 | | |
51 | 703 | static inline ASTContext &getASTContext(CXComment CXC) { |
52 | 703 | return cxtu::getASTUnit(CXC.TranslationUnit)->getASTContext(); |
53 | 703 | } |
54 | | |
55 | 703 | static inline comments::CommandTraits &getCommandTraits(CXComment CXC) { |
56 | 703 | return getASTContext(CXC).getCommentCommandTraits(); |
57 | 703 | } |
58 | | |
59 | | } // end namespace cxcomment |
60 | | } // end namespace clang |
61 | | |
62 | | #endif |
63 | | |