| 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 <clang/Basic/SourceLocation.h> |
| 25 | #include <map> |
| 26 | #include <string> |
| 27 | |
| 28 | class Annotator; |
| 29 | namespace clang { |
| 30 | class Preprocessor; |
| 31 | class Sema; |
| 32 | } |
| 33 | |
| 34 | class Generator; |
| 35 | |
| 36 | class CommentHandler |
| 37 | { |
| 38 | struct CommentVisitor; |
| 39 | |
| 40 | public: |
| 41 | struct Doc |
| 42 | { |
| 43 | std::string content; |
| 44 | clang::SourceLocation loc; |
| 45 | }; |
| 46 | |
| 47 | std::multimap<std::string, Doc> docs; |
| 48 | |
| 49 | // fileId -> [ref, global_visibility] |
| 50 | std::multimap<clang::SourceLocation, std::pair<std::string, bool>> decl_offsets; |
| 51 | |
| 52 | /** |
| 53 | * Handle the comment startig at @a commentstart within @a bufferStart with length @a len. |
| 54 | * Search for corresponding declaration in the given source location interval |
| 55 | * @a commentLoc is the position of the comment |
| 56 | */ |
| 57 | void handleComment(Annotator &A, Generator &generator, clang::Sema &Sema, |
| 58 | const char *bufferStart, int , int len, |
| 59 | clang::SourceLocation searchLocBegin, clang::SourceLocation searchLocEnd, |
| 60 | clang::SourceLocation ); |
| 61 | }; |