Age | Commit message (Collapse) | Author |
|
When we run the Preprocessor from the CppComprehensionEngine of
the language server, we don't want the preprocessor to crash if it
encounters an invalid preprocessor statement (for example, an #endif
statement without an accompanying previous #if statement).
To achieve this, this commit adds an "ignore_invalid_statements" flag
to the preprocessor which is set by the CppComprehensionEngine.
Fixes #11064.
|
|
|
|
Previously, the preprocessor first split the source into lines, and then
processed and lexed each line separately.
This patch makes the preprocessor first lex the source, and then do the
processing on the tokenized representation.
This generally simplifies the code, and also fixes an issue we
previously had with multiline comments (we did not recognize them
correctly when processing each line separately).
|
|
|
|
The preprocessor now understands when a function-like macro is defined,
and can also parse calls to such macros.
The actual evaluation of function-like macros will be done in a
separate commit.
|
|
After this change, the parser is completely separated from preprocessor
concepts.
|
|
When the preprocessor encounters an #include statement it now adds
the preprocessor definitions that exist in the included header to its
own set of definitions.
We previously only aggregated the definitions from headers after
processing the source, which was less correct. (For example, there
could be an #ifdef that depends on a definition from another header).
|
|
We now call Preprocessor::process_and_lex() and pass the result to the
parser.
Doing the lexing in the preprocessor will allow us to maintain the
original position information of tokens after substituting definitions.
|
|
Now you can click a TODO entry to set focus on that position of that
file.
|
|
|
|
This also moves most of the logic that was in handle_preprocessor_line
into handle_preprocessor_keyword.
|
|
SPDX License Identifiers are a more compact / standardized
way of representing file license information.
See: https://spdx.dev/resources/use/#identifiers
This was done with the `ambr` search and replace tool.
ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
|
|
Under some circumstances we need to ignore unsupported preprocessor
keywords instead of crashing the processing, for example during live
parsing in HackStudio.
|
|
.. definitions.
|
|
Preprocessor definitions now appear in the AutoComplete suggestions box
as well as in the Locator.
|
|
|
|
We currently handle basic #define statements as well as ifdef and else
branches.
|