aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/AST/CommentParser.cpp
AgeCommit message (Collapse)AuthorFilesLines
2016-09-20[cleanup] Remove excessive padding from TextTokenRetokenizer::PositionAlexander Shaposhnikov1-1/+1
Reorder the fields of the struct TextTokenRetokenizer::Position to remove excessive padding. Test plan: make -j8 check-clang Differential revision: https://reviews.llvm.org/D24751 llvm-svn: 281995
2014-05-12[C++11] Use 'nullptr'. AST edition.Craig Topper1-3/+3
llvm-svn: 208517
2013-08-23Comment parsing: fix a bug where a line with whitespace between two paragraphsDmitri Gribenko1-0/+21
would cause us to concatenate these paragraphs into a single one. The no-op whitespace churn in test/Index test happened because these tests don't use the correct approach for testing and are more strict than required for they are testing. llvm-svn: 189126
2013-05-05Replace ArrayRef<T>() with None, now that we have an implicit ArrayRef ↵Dmitri Gribenko1-3/+2
constructor from None Patch by Robert Wilhelm. llvm-svn: 181139
2013-04-18Comment parsing: simplify code. As a side effect, this also silences GCC'sDmitri Gribenko1-14/+10
-Wunitnitialized warning. Patch by Rui Ueyama. llvm-svn: 179794
2013-03-05doc parsing. Add @method and @callback forFariborz Jahanian1-2/+0
checkings and few other refactoring/cleanup. // rdar://13094352. llvm-svn: 176509
2013-03-05doc parsing. We want to issue a strong warning whenFariborz Jahanian1-0/+2
an @function comment is not followed by a function decl. // rdar://13094352 llvm-svn: 176468
2013-03-04Comment parsing: refactor handling of command markers in ASTDmitri Gribenko1-3/+5
* Use the term 'command marker', because the semantics of 'backslash' and 'at' commands are the same. (Talking about 'at commands' makes them look like a special entity.) * Sink the flag down into bitfields, reducing the size of AST nodes. * Change the flag into an enum for clarity. Boolean function parameters are not very clear. * Add unittests for new tok::at_command tokens. llvm-svn: 176461
2013-03-02Some refactoring in my patch on documentFariborz Jahanian1-11/+13
command source fidelity. // rdar://13066276 llvm-svn: 176401
2013-03-01comment parsing. Keep the original command format Fariborz Jahanian1-0/+4
in AST for source fidelity and use it in diagnostics to refer to the original format. // rdar://13066276 llvm-svn: 176387
2013-02-09Comment parsing: use CharInfo.hDmitri Gribenko1-5/+1
This also gives us 0.2% speedup on '-fsyntax-only -Wdocumentation' time for a testcase that consists of all Clang headers. llvm-svn: 174810
2013-01-26Comment parsing: actually check for a block command after "\param x"Dmitri Gribenko1-6/+23
This fixes PR15068. llvm-svn: 173539
2012-12-19Fix PR14591: Windows newlines in doxygen comments cause failed assertion inDmitri Gribenko1-2/+1
TextDiagnostic Patch by Janusz Chorko. llvm-svn: 170566
2012-12-19Comment parsing: add a missing 'else'. Found by inspection.Dmitri Gribenko1-1/+1
No testcase because we were just building an extra AST node and eventually throwing it away, so it did not affect correctness. llvm-svn: 170563
2012-12-04Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth1-2/+2
uncovered. This required manually correcting all of the incorrect main-module headers I could find, and running the new llvm/utils/sort_includes.py script over the files. I also manually added quite a few missing headers that were uncovered by shuffling the order or moving headers up to be main-module-headers. llvm-svn: 169237
2012-11-18Documentation parsing: propely handle a lone '\endverbatim' and emit a warning.Dmitri Gribenko1-0/+8
We actually used to assert on this. Thanks to NAKAMURA Takumi for noticing this! llvm-svn: 168277
2012-09-11Comment parsing: handle non-builtin commands correctly. After semanticDmitri Gribenko1-0/+7
analysis registers a command, it becomes a "known" command for the lexer, since it has an ID. Having this freedom of choice to register a command is a good thing since BriefParser does not need this. But the parser should still invoke the correct semantic analysis method (actOnUnknownCommand) in this case. llvm-svn: 163646
2012-09-10Comment AST: TableGen'ize all command lists in CommentCommandTraits.cpp.Dmitri Gribenko1-29/+32
Now we have a list of all commands. This is a good thing in itself, but it also enables us to easily implement typo correction for command names. With this change we have objects that contain information about each command, so it makes sense to resolve command name just once during lexing (currently we store command names as strings and do a linear search every time some property value is needed). Thus comment token and AST nodes were changed to contain a command ID -- index into a tables of builtin and registered commands. Unknown commands are registered during parsing and thus are also uniformly assigned an ID. Using an ID instead of a StringRef is also a nice memory optimization since ID is a small integer that fits into a common bitfield in Comment class. This change implies that to get any information about a command (even a command name) we need a CommandTraits object to resolve the command ID to CommandInfo*. Currently a fresh temporary CommandTraits object is created whenever it is needed since it does not have any state. But with this change it has state -- new commands can be registered, so a CommandTraits object was added to ASTContext. Also, in libclang CXComment has to be expanded to include a CXTranslationUnit so that all functions working on comment AST nodes can get a CommandTraits object. This breaks binary compatibility of CXComment APIs. Now clang_FullComment_getAsXML(CXTranslationUnit TU, CXComment CXC) doesn't need TU parameter anymore, so it was removed. This is a source-incompatible change for this C API. llvm-svn: 163540
2012-08-09Comment parsing: extract TableGen'able pieces into new CommandTraits class.Dmitri Gribenko1-8/+11
llvm-svn: 161548
2012-08-06Comment parsing: fix crash on \tparam followed immediately by another blockDmitri Gribenko1-1/+4
command, for example: \tparam\brief. llvm-svn: 161361
2012-08-06Comment parser and sema: remove useless return valuesDmitri Gribenko1-58/+63
llvm-svn: 161331
2012-07-31Comment parsing: add support for \tparam command on all levels.Dmitri Gribenko1-9/+33
The only caveat is renumbering CXCommentKind enum for aesthetic reasons -- this breaks libclang binary compatibility, but should not be a problem since API is so new. This also fixes PR13372 as a side-effect. llvm-svn: 161087
2012-07-30Comment parser: don't crash on a completely empty \param followed by a blockDmitri Gribenko1-2/+2
command llvm-svn: 160975
2012-07-24Comment parsing: allow newlines between \param, direction specification (e.g.,Dmitri Gribenko1-6/+28
[in]), parameter name and description paragraph. llvm-svn: 160682
2012-07-24Comment parsing: couple TextTokenRetokenizer and comment parser together toDmitri Gribenko1-50/+42
remove one of the two variable-length lookahead buffers. Now retokenizer will ask for more tokens when it needs them. llvm-svn: 160680
2012-07-24Move TextTokenRetokenizer from CommentLexer.h to CommentParser.cpp since it isDmitri Gribenko1-0/+203
an implementation detail of the parser. llvm-svn: 160679
2012-07-24Comment parsing: retokenized text tokens are now pushed back in correct (notDmitri Gribenko1-2/+5
reverse) order llvm-svn: 160675
2012-07-20Fix PR13411: Comment parsing: failed assertion on unterminated verbatim block.Dmitri Gribenko1-5/+10
The assertion was wrong in case we have a verbatim block without a closing command. Also add tests for closing command name in a verbatim block, since now it can be empty in such cases. llvm-svn: 160568
2012-07-18This fits into 80 columns without wrapping.Dmitri Gribenko1-2/+1
llvm-svn: 160453
2012-07-13Comment parsing: repaint the bikesched: rename 'HTML open tags' to 'HTML ↵Dmitri Gribenko1-50/+50
start tags' and 'HTML close tags' to 'HTML end tags' according to HTML spec. llvm-svn: 160153
2012-07-11Enable comment parsing and semantic analysis to emit diagnostics. A fewDmitri Gribenko1-24/+74
diagnostics implemented -- see testcases. I created a new TableGen file for comment diagnostics, DiagnosticCommentKinds.td, because comment diagnostics don't logically fit into AST diagnostics file. But I don't feel strongly about it. This also implements support for self-closing HTML tags in comment lexer and parser (for example, <br />). In order to issue precise diagnostics CommentSema needs to know the declaration the comment is attached to. There is no easy way to find a decl by comment, so we match comments and decls in lockstep: after parsing one declgroup we check if we have any new, not yet attached comments. If we do -- then we do the usual comment-finding process. It is interesting that this automatically handles trailing comments. We pick up not only comments that precede the declaration, but also comments that *follow* the declaration -- thanks to the lookahead in the lexer: after parsing the declgroup we've consumed the semicolon and looked ahead through comments. Added -Wdocumentation-html flag for semantic HTML errors to allow the user to disable only HTML warnings (but not HTML parse errors, which we emit as warnings in -Wdocumentation). llvm-svn: 160078
2012-07-06Sprinkle llvm_unreachable around to placate GCC's -Wreturn-type.Matt Beaumont-Gay1-2/+1
llvm-svn: 159860
2012-07-06Stop using new[] on llvm::BumpPtrAllocator.Dmitri Gribenko1-1/+2
llvm-svn: 159833
2012-07-06CommentParser.cpp: remove unused variable.Dmitri Gribenko1-1/+0
llvm-svn: 159797
2012-07-06Implement AST classes for comments, a real parser for Doxygen comments and aDmitri Gribenko1-0/+414
very simple semantic analysis that just builds the AST; minor changes for lexer to pick up source locations I didn't think about before. Comments AST is modelled along the ideas of HTML AST: block and inline content. * Block content is a paragraph or a command that has a paragraph as an argument or verbatim command. * Inline content is placed within some block. Inline content includes plain text, inline commands and HTML as tag soup. llvm-svn: 159790