aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/AST/CommentCommandTraits.cpp
AgeCommit message (Collapse)AuthorFilesLines
2014-10-15Fix for PR21254 - Assertion in comment parserDario Domizioli1-0/+4
The size of the ID field in CommandInfo was narrow, leading to potential wrap-around of command IDs, causing misinterpretation later on. The patch does the following: - It extends the ID bitfield from 8 to 20 bits. - It provides a DRY definition of the number of bits for the field to avoid using literal numbers in different files. - It introduces a new assertion that checks for the wrap-around. - It adds the testcase from PR21254. llvm-svn: 219802
2014-05-12[C++11] Use 'nullptr'. AST edition.Craig Topper1-2/+2
llvm-svn: 208517
2014-03-06Fix dead store and simplify. No functionality change (although the code is nowRichard Smith1-36/+31
correct if MaxEditDistance were increased to something greater than 1). llvm-svn: 203153
2013-07-15Use llvm::array_lengthof to replace sizeof(array)/sizeof(array[0]).Craig Topper1-1/+1
llvm-svn: 186300
2013-05-09[doc parsing]: make single character command imposturesFariborz Jahanian1-0/+5
warn in pedantic mode. llvm-svn: 181523
2013-05-09[doc parsing]: So, in this patch, single characterFariborz Jahanian1-4/+0
'commands' will not go through typo fixit logic, preserving the old behavior (no typo, no diagnostics). // rdar://12381408 llvm-svn: 181521
2013-05-09[doc parsing]: don't attempt to fix single characterFariborz Jahanian1-0/+4
commands (\t \n are common). \\ rdar://12381408 llvm-svn: 181517
2013-05-08[doc parsing]: Also do typo correction forFariborz Jahanian1-19/+30
dynamically registered commands. // rdar://12381408 llvm-svn: 181477
2013-05-08documentation parsing. Patch to do typo correction for Fariborz Jahanian1-0/+27
documentation commands. Patch was reviewed, along with great suggestions for improvement, by Doug. // rdar://12381408 llvm-svn: 181458
2013-02-22Comment parsing: add CommentOptions to allow specifying custom comment block ↵Dmitri Gribenko1-5/+29
commands Add an ability to specify custom documentation block comment commands via a new class CommentOptions. The intention is that this class will hold future customizations for comment parsing, including defining documentation comments with specific numbers of parameters, etc. CommentOptions instance is a member of LangOptions. CommentOptions is controlled by a new command-line parameter -fcomment-block-commands=Foo,Bar,Baz. llvm-svn: 175892
2012-09-11Comment parsing: handle non-builtin commands correctly. After semanticDmitri Gribenko1-0/+1
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-11Fix buffer overflow.Eli Friedman1-2/+2
llvm-svn: 163578
2012-09-10Comment AST: TableGen'ize all command lists in CommentCommandTraits.cpp.Dmitri Gribenko1-101/+39
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-16CommentCommandTraits: rename BeginName -> StartName for consistency.Dmitri Gribenko1-5/+5
llvm-svn: 162044
2012-08-09Comment to HTML and XML conversion: ignore commands that contain a declarationDmitri Gribenko1-8/+32
as their argument. For example, \fn, \function, \typedef, \method, \class etc. llvm-svn: 161601
2012-08-09Comment parsing: extract TableGen'able pieces into new CommandTraits class.Dmitri Gribenko1-0/+110
llvm-svn: 161548