summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/CommentParser.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [C++11] Use 'nullptr'. AST edition.Craig Topper2014-05-121-3/+3
| | | | llvm-svn: 208517
* Comment parsing: fix a bug where a line with whitespace between two paragraphsDmitri Gribenko2013-08-231-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
* Replace ArrayRef<T>() with None, now that we have an implicit ArrayRef ↵Dmitri Gribenko2013-05-051-3/+2
| | | | | | | | constructor from None Patch by Robert Wilhelm. llvm-svn: 181139
* Comment parsing: simplify code. As a side effect, this also silences GCC'sDmitri Gribenko2013-04-181-14/+10
| | | | | | | | -Wunitnitialized warning. Patch by Rui Ueyama. llvm-svn: 179794
* doc parsing. Add @method and @callback forFariborz Jahanian2013-03-051-2/+0
| | | | | | | checkings and few other refactoring/cleanup. // rdar://13094352. llvm-svn: 176509
* doc parsing. We want to issue a strong warning whenFariborz Jahanian2013-03-051-0/+2
| | | | | | | an @function comment is not followed by a function decl. // rdar://13094352 llvm-svn: 176468
* Comment parsing: refactor handling of command markers in ASTDmitri Gribenko2013-03-041-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
* Some refactoring in my patch on documentFariborz Jahanian2013-03-021-11/+13
| | | | | | command source fidelity. // rdar://13066276 llvm-svn: 176401
* comment parsing. Keep the original command format Fariborz Jahanian2013-03-011-0/+4
| | | | | | | in AST for source fidelity and use it in diagnostics to refer to the original format. // rdar://13066276 llvm-svn: 176387
* Comment parsing: use CharInfo.hDmitri Gribenko2013-02-091-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
* Comment parsing: actually check for a block command after "\param x"Dmitri Gribenko2013-01-261-6/+23
| | | | | | This fixes PR15068. llvm-svn: 173539
* Fix PR14591: Windows newlines in doxygen comments cause failed assertion inDmitri Gribenko2012-12-191-2/+1
| | | | | | | | TextDiagnostic Patch by Janusz Chorko. llvm-svn: 170566
* Comment parsing: add a missing 'else'. Found by inspection.Dmitri Gribenko2012-12-191-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
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-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
* Documentation parsing: propely handle a lone '\endverbatim' and emit a warning.Dmitri Gribenko2012-11-181-0/+8
| | | | | | | | We actually used to assert on this. Thanks to NAKAMURA Takumi for noticing this! llvm-svn: 168277
* Comment parsing: handle non-builtin commands correctly. After semanticDmitri Gribenko2012-09-111-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
* Comment AST: TableGen'ize all command lists in CommentCommandTraits.cpp.Dmitri Gribenko2012-09-101-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
* Comment parsing: extract TableGen'able pieces into new CommandTraits class.Dmitri Gribenko2012-08-091-8/+11
| | | | llvm-svn: 161548
* Comment parsing: fix crash on \tparam followed immediately by another blockDmitri Gribenko2012-08-061-1/+4
| | | | | | command, for example: \tparam\brief. llvm-svn: 161361
* Comment parser and sema: remove useless return valuesDmitri Gribenko2012-08-061-58/+63
| | | | llvm-svn: 161331
* Comment parsing: add support for \tparam command on all levels.Dmitri Gribenko2012-07-311-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
* Comment parser: don't crash on a completely empty \param followed by a blockDmitri Gribenko2012-07-301-2/+2
| | | | | | command llvm-svn: 160975
* Comment parsing: allow newlines between \param, direction specification (e.g.,Dmitri Gribenko2012-07-241-6/+28
| | | | | | [in]), parameter name and description paragraph. llvm-svn: 160682
* Comment parsing: couple TextTokenRetokenizer and comment parser together toDmitri Gribenko2012-07-241-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
* Move TextTokenRetokenizer from CommentLexer.h to CommentParser.cpp since it isDmitri Gribenko2012-07-241-0/+203
| | | | | | an implementation detail of the parser. llvm-svn: 160679
* Comment parsing: retokenized text tokens are now pushed back in correct (notDmitri Gribenko2012-07-241-2/+5
| | | | | | reverse) order llvm-svn: 160675
* Fix PR13411: Comment parsing: failed assertion on unterminated verbatim block.Dmitri Gribenko2012-07-201-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
* This fits into 80 columns without wrapping.Dmitri Gribenko2012-07-181-2/+1
| | | | llvm-svn: 160453
* Comment parsing: repaint the bikesched: rename 'HTML open tags' to 'HTML ↵Dmitri Gribenko2012-07-131-50/+50
| | | | | | start tags' and 'HTML close tags' to 'HTML end tags' according to HTML spec. llvm-svn: 160153
* Enable comment parsing and semantic analysis to emit diagnostics. A fewDmitri Gribenko2012-07-111-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
* Sprinkle llvm_unreachable around to placate GCC's -Wreturn-type.Matt Beaumont-Gay2012-07-061-2/+1
| | | | llvm-svn: 159860
* Stop using new[] on llvm::BumpPtrAllocator.Dmitri Gribenko2012-07-061-1/+2
| | | | llvm-svn: 159833
* CommentParser.cpp: remove unused variable.Dmitri Gribenko2012-07-061-1/+0
| | | | llvm-svn: 159797
* Implement AST classes for comments, a real parser for Doxygen comments and aDmitri Gribenko2012-07-061-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
OpenPOWER on IntegriCloud