summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/CommentLexer.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [AST] CommentLexer - Remove (optional) Invalid parameter from getSpelling.Simon Pilgrim2019-09-181-5/+2
| | | | | | The static analyzer noticed that we were dereferencing it even when the default null value was being used. Further investigation showed that we never explicitly set the parameter so I've just removed it entirely. llvm-svn: 372217
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* Add a newline to SourceLocation dump outputStephen Kelly2018-08-151-1/+1
| | | | | | | | | | | | | | Summary: Migrate callers to print(). dump() should be useful to downstreams and third parties as a debugging aid. Everyone trips up on this and creates confusing output. Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D50661 llvm-svn: 339810
* Remove trailing spaceFangrui Song2018-07-301-1/+1
| | | | | | sed -Ei 's/[[:space:]]+$//' include/**/*.{def,h,td} lib/**/*.{cpp,h} llvm-svn: 338291
* [AST] Added a helper to extract a user-friendly text of a comment.Ilya Biryukov2018-05-161-117/+129
| | | | | | | | | | | | | | | | | | | | | | Summary: The helper is used in clangd for documentation shown in code completion and storing the docs in the symbols. See D45999. This patch reuses the code of the Doxygen comment lexer, disabling the bits that do command and html tag parsing. The new helper works on all comments, including non-doxygen comments. However, it does not understand or transform any doxygen directives, i.e. cannot extract brief text, etc. Reviewers: sammccall, hokein, ioeric Reviewed By: ioeric Subscribers: mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D46000 llvm-svn: 332458
* Fix 'unknown documentation command' warning rangesErik Verbruggen2016-10-251-4/+6
| | | | | | | | | Warnings generated by -Wdocumentation-unknown-command did only have a start location, not a full source range. This resulted in only the "carret" being show in messages, and IDEs highlighting only the single initial character. llvm-svn: 285056
* Fix some Clang-tidy readability-redundant-control-flow warnings; other minor ↵Eugene Zelenko2016-02-101-5/+11
| | | | | | | | fixes. Differential revision: http://reviews.llvm.org/D17060 llvm-svn: 260414
* Comment parsing: fix an assertion failure on a verbatim block terminated ↵Dmitri Gribenko2015-04-151-0/+6
| | | | | | with "**/" llvm-svn: 235057
* Fix some cases where StringRef was being passed by const reference. Remove ↵Craig Topper2014-08-301-2/+2
| | | | | | const from some other StringRefs since its implicitly const already. llvm-svn: 216825
* CommentLexer: eliminate an NDEBUG from the headersAlp Toker2013-12-071-0/+13
| | | | | | Code in headers shouldn't be conditional on the build configuration. llvm-svn: 196656
* CommentLexer: When proceeding with a typo corrected name don't clobber the ↵Benjamin Kramer2013-12-011-5/+6
| | | | | | | | token. This would crash if the token is used in another diagnostic. PR18051. llvm-svn: 196048
* Fix indentationDmitri Gribenko2013-08-231-1/+1
| | | | llvm-svn: 189119
* [doc parsing]: make single character command imposturesFariborz Jahanian2013-05-091-4/+0
| | | | | | warn in pedantic mode. llvm-svn: 181523
* [doc parsing]: So, in this patch, single characterFariborz Jahanian2013-05-091-0/+4
| | | | | | | | 'commands' will not go through typo fixit logic, preserving the old behavior (no typo, no diagnostics). // rdar://12381408 llvm-svn: 181521
* Turn off a warning caused by my last patch.Fariborz Jahanian2013-05-081-1/+1
| | | | llvm-svn: 181464
* documentation parsing. Patch to do typo correction for Fariborz Jahanian2013-05-081-2/+12
| | | | | | | | documentation commands. Patch was reviewed, along with great suggestions for improvement, by Doug. // rdar://12381408 llvm-svn: 181458
* [doc parsing]: Make warning about unknown commandFariborz Jahanian2013-05-041-3/+2
| | | | | | | tags off by default for now. Move diagnostic code to DiagnosticCommentKinds.td. // rdar://12381408 llvm-svn: 181081
* [Doc parsing] Provide diagnostics for unknown documentation Fariborz Jahanian2013-05-031-2/+6
| | | | | | commands. // rdar://12381408 llvm-svn: 181071
* Comment parsing: refactor handling of command markers in ASTDmitri Gribenko2013-03-041-4/+6
| | | | | | | | | | | | | | | * 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-2/+4
| | | | | | command source fidelity. // rdar://13066276 llvm-svn: 176401
* comment parsing. Keep the original command format Fariborz Jahanian2013-03-011-0/+1
| | | | | | | in AST for source fidelity and use it in diagnostics to refer to the original format. // rdar://13066276 llvm-svn: 176387
* Use static functions instead of an unnamed namespaceDmitri Gribenko2013-02-101-6/+8
| | | | llvm-svn: 174835
* Comment parsing: use CharInfo.hDmitri Gribenko2013-02-091-38/+16
| | | | | | | 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: resolve more named character referencesDmitri Gribenko2013-01-301-182/+22
| | | | | | | | | This reimplements r173850 with a better approach: (1) use a TableGen-generated matcher instead of doing a linear search; (2) avoid allocations for new strings by converting code points to string iterals with TableGen. llvm-svn: 173931
* Move UTF conversion routines from clang/lib/Basic to llvm/lib/SupportDmitri Gribenko2013-01-301-3/+3
| | | | | | This is required to use them in TableGen. llvm-svn: 173924
* Removed couple of html named character references inFariborz Jahanian2013-01-301-2/+0
| | | | | | my last patch. llvm-svn: 173856
* [Doc parsing] Patch to parse Doxygen-supported HTML character Fariborz Jahanian2013-01-291-18/+181
| | | | | | | references to their UTIF-8 encoding. Reviewed offline by Doug. // rdar://12392215 llvm-svn: 173850
* Use llvm::hexDigitValue in comment lexerDmitri Gribenko2013-01-191-6/+2
| | | | llvm-svn: 172924
* Comment lexing: replace manual comparison with StringRef::find_first_ofDmitri Gribenko2012-12-301-9/+6
| | | | | | This gives an about 1.8% improvement on Clang bootstrap with -Wdocumentation llvm-svn: 171262
* Comment parsing: don't parse comment marker followed by a digit as a commandDmitri Gribenko2012-09-141-1/+6
| | | | | | since no Doxygen command starts with a digit. llvm-svn: 163909
* Comment AST: TableGen'ize all command lists in CommentCommandTraits.cpp.Dmitri Gribenko2012-09-101-14/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Remove the useless CommentOptions class.Dmitri Gribenko2012-08-311-2/+2
| | | | llvm-svn: 162986
* Comment HTML tag name machers: move from StringSwitch to an efficientDmitri Gribenko2012-08-311-26/+2
| | | | | | TableGen-generated string matcher. llvm-svn: 162969
* Comment parsing: parse "<blah" as an HTML tag only if "blah" is a known tagDmitri Gribenko2012-08-221-2/+38
| | | | | | | | | | name. This should reduce the amount of warning false positives about bad HTML in comments when the comment author intended to put a reference to a template. This change will also enable us parse the comment as intended in these cases. Fixes part 1 of PR13374. llvm-svn: 162407
* Comment parsing: extract TableGen'able pieces into new CommandTraits class.Dmitri Gribenko2012-08-091-93/+5
| | | | llvm-svn: 161548
* Implement resolving of HTML character references (named: &amp;, decimal: &#42;,Dmitri Gribenko2012-07-271-24/+174
| | | | | | | | | hex: &#x1a;) during comment parsing. Now internal representation of plain text in comment AST does not contain character references, but the characters themselves. llvm-svn: 160891
* Comment parsing: don't parse whitespace before \endverbatim as a separate ↵Dmitri Gribenko2012-07-181-0/+10
| | | | | | line of whitespace. llvm-svn: 160464
* Comment parsing: repaint the bikesched: rename 'HTML open tags' to 'HTML ↵Dmitri Gribenko2012-07-131-17/+17
| | | | | | 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-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Comment lexing: fix lexing to actually work in non-error cases.Dmitri Gribenko2012-07-091-13/+18
| | | | llvm-svn: 159963
* Implement AST classes for comments, a real parser for Doxygen comments and aDmitri Gribenko2012-07-061-8/+36
| | | | | | | | | | | | | | 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
* Fix an infinite loop in comment lexer: we were not advancing in the input ↵Dmitri Gribenko2012-06-271-0/+5
| | | | | | character stream when we saw a '<' that is not a start of an HTML tag. llvm-svn: 159303
* Remove unsigned and a pointer from a comment token (so that each token can ↵Dmitri Gribenko2012-06-271-8/+19
| | | | | | have only one semantic string value attached to it), at a cost of adding an additional token. llvm-svn: 159270
* Comment lexer: counting backwards from token end is thought to be confusing. ↵Dmitri Gribenko2012-06-271-14/+20
| | | | | | We already have a pointer to the beginning of the token, so use it to extract the text instead. llvm-svn: 159269
* Implement a lexer for structured comments.Dmitri Gribenko2012-06-261-0/+676
llvm-svn: 159223
OpenPOWER on IntegriCloud