1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 15:38:10 +00:00

LibCpp: Import definitions from headers while processing

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).
This commit is contained in:
Itamar 2021-08-06 11:15:57 +03:00 committed by Andreas Kling
parent 4673a517f6
commit 0c4dc00f01
5 changed files with 21 additions and 11 deletions

View file

@ -15,7 +15,7 @@
namespace Cpp {
Parser::Parser(Vector<Token> const& tokens, const String& filename, Preprocessor::Definitions&& definitions)
Parser::Parser(Vector<Token> const& tokens, const String& filename, Preprocessor::Definitions const& definitions)
: m_preprocessor_definitions(move(definitions))
, m_filename(filename)
{