1 | /**************************************************************************** |
2 | * Copyright (C) 2012-2016 Woboq GmbH |
3 | * Olivier Goffart <contact at woboq.com> |
4 | * https://woboq.com/codebrowser.html |
5 | * |
6 | * This file is part of the Woboq Code Browser. |
7 | * |
8 | * Commercial License Usage: |
9 | * Licensees holding valid commercial licenses provided by Woboq may use |
10 | * this file in accordance with the terms contained in a written agreement |
11 | * between the licensee and Woboq. |
12 | * For further information see https://woboq.com/codebrowser.html |
13 | * |
14 | * Alternatively, this work may be used under a Creative Commons |
15 | * Attribution-NonCommercial-ShareAlike 3.0 (CC-BY-NC-SA 3.0) License. |
16 | * http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_US |
17 | * This license does not allow you to use the code browser to assist the |
18 | * development of your commercial software. If you intent to do so, consider |
19 | * purchasing a commercial licence. |
20 | ****************************************************************************/ |
21 | |
22 | #pragma once |
23 | |
24 | #include <string> |
25 | #include <map> |
26 | #include <clang/Basic/SourceLocation.h> |
27 | |
28 | class Annotator; |
29 | namespace clang { |
30 | class Preprocessor; |
31 | class Sema; |
32 | } |
33 | |
34 | class Generator; |
35 | |
36 | class CommentHandler { |
37 | struct CommentVisitor; |
38 | public: |
39 | |
40 | struct Doc { |
41 | std::string content; |
42 | clang::SourceLocation loc; |
43 | }; |
44 | |
45 | std::multimap<std::string, Doc> docs; |
46 | |
47 | // fileId -> [ref, global_visibility] |
48 | std::multimap<clang::SourceLocation, std::pair<std::string, bool>> decl_offsets; |
49 | |
50 | /** |
51 | * Handle the comment startig at @a commentstart within @a bufferStart with length @a len. |
52 | * Search for corresponding declaration in the given source location interval |
53 | * @a commentLoc is the position of the comment |
54 | */ |
55 | void handleComment(Annotator &A, Generator& generator, clang::Sema& Sema, |
56 | const char* bufferStart, int , int len, |
57 | clang::SourceLocation searchLocBegin, clang::SourceLocation searchLocEnd, |
58 | clang::SourceLocation ); |
59 | |
60 | }; |