Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
Preprocessor Class Reference

#include <preprocessor.h>

+ Inheritance diagram for Preprocessor:
+ Collaboration diagram for Preprocessor:

Public Types

enum  TokenizeMode {
  TokenizeCpp , TokenizePreprocessor , PreparePreprocessorStatement , TokenizePreprocessorStatement ,
  TokenizeInclude , PrepareDefine , TokenizeDefine
}
 

Public Member Functions

 Preprocessor ()
 
QByteArray resolveInclude (const QByteArray &filename, const QByteArray &relativeTo)
 
Symbols preprocessed (const QByteArray &filename, QFile *device)
 
void parseDefineArguments (Macro *m)
 
void skipUntilEndif ()
 
bool skipBranch ()
 
void substituteUntilNewline (Symbols &substituted)
 
int evaluateCondition ()
 
void setDebugIncludes (bool value)
 
- Public Member Functions inherited from Parser
bool hasNext () const
 
Token next ()
 
Token peek ()
 
bool test (Token)
 
void next (Token)
 
void next (Token, const char *msg)
 
void prev ()
 
Token lookup (int k=1)
 
const Symbolsymbol_lookup (int k=1)
 
Token token ()
 
QByteArray lexem ()
 
QByteArray unquotedLexem ()
 
const Symbolsymbol ()
 
const SymbolsymbolAt (qsizetype idx)
 
Q_NORETURN void error (const Symbol &symbol)
 
Q_NORETURN void error (const char *msg=nullptr)
 
Q_NORETURN void error (const Symbol &symbol, const char *msg)
 
void warning (const char *=nullptr)
 
void warning (const Symbol &sym, QByteArrayView msg)
 
void note (const char *=nullptr)
 
void defaultErrorMsg (const Symbol &sym)
 
void printMsg (QByteArrayView formatStringSuffix, QByteArrayView msg, const Symbol &sym)
 
 Parser (const QString &provider)
 
void addIncludeDirs (const QStringList &list)
 
QString resolveInclude (const QString &filename)
 
void addIncludesRecursive (const QString &filename, QStringList &includes)
 
QStringList findEnumValues (const QString &name, const QStringList &includes)
 
void parseParamReplace (const QString &data, qsizetype offset, const QString &name)
 
void parseInstrument (const QString &data, qsizetype offset)
 
void parsePoint (const QString &data, qsizetype offset)
 
void parsePrefix (const QString &data, qsizetype offset)
 
void parseMetadata (const QString &data, qsizetype offset, const QStringList &includes)
 
int lineNumber (qsizetype offset) const
 
void parse (QIODevice &input, const QString &name)
 
void write (QIODevice &input) const
 
bool isEmpty () const
 

Static Public Member Functions

static Symbols macroExpandIdentifier (Preprocessor *that, SymbolStack &symbols, int lineNum, QByteArray *macroName)
 
static void macroExpand (Symbols *into, Preprocessor *that, const Symbols &toExpand, qsizetype &index, int lineNum, bool one, const QSet< QByteArray > &excludeSymbols=QSet< QByteArray >())
 
static Symbols tokenize (const QByteArray &input, int lineNum=1, TokenizeMode mode=TokenizeCpp)
 

Public Attributes

QList< QByteArrayframeworks
 
QSet< QByteArraypreprocessedIncludes
 
QHash< QByteArray, QByteArraynonlocalIncludePathResolutionCache
 
Macros macros
 
- Public Attributes inherited from Parser
Symbols symbols
 
qsizetype index = 0
 
bool displayWarnings = true
 
bool displayNotes = true
 
bool activeQtMode = false
 
QList< IncludePathincludes
 
std::stack< QByteArray, QByteArrayListcurrentFilenames
 
QList< Functionm_functions
 
QList< Pointm_points
 
QList< Replacem_replaces
 
QList< QStringm_prefixes
 
QList< QStringm_metadata
 
QList< LineNumberm_offsets
 
QList< QStringm_includeDirs
 
QString m_provider
 

Static Public Attributes

static bool preprocessOnly = false
 

Detailed Description

Definition at line 28 of file preprocessor.h.

Member Enumeration Documentation

◆ TokenizeMode

Enumerator
TokenizeCpp 
TokenizePreprocessor 
PreparePreprocessorStatement 
TokenizePreprocessorStatement 
TokenizeInclude 
PrepareDefine 
TokenizeDefine 

Definition at line 53 of file preprocessor.h.

Constructor & Destructor Documentation

◆ Preprocessor()

Preprocessor::Preprocessor ( )
inline

Definition at line 31 of file preprocessor.h.

Member Function Documentation

◆ evaluateCondition()

int Preprocessor::evaluateCondition ( )

Definition at line 949 of file preprocessor.cpp.

References substituteUntilNewline(), and PP_Expression::value().

+ Here is the call graph for this function:

◆ macroExpand()

void Preprocessor::macroExpand ( Symbols * into,
Preprocessor * that,
const Symbols & toExpand,
qsizetype & index,
int lineNum,
bool one,
const QSet< QByteArray > & excludeSymbols = QSet<QByteArray>() )
static

Definition at line 509 of file preprocessor.cpp.

References SymbolStack::hasNext(), Symbol::lineNum, SymbolStack::next(), and SymbolStack::symbol().

+ Here is the call graph for this function:

◆ macroExpandIdentifier()

Symbols Preprocessor::macroExpandIdentifier ( Preprocessor * that,
SymbolStack & symbols,
int lineNum,
QByteArray * macroName )
static

Definition at line 550 of file preprocessor.cpp.

References Symbol::Symbol(), SymbolStack::hasNext(), Macro::isFunction, Macro::isVariadic, macros, SymbolStack::next(), SymbolStack::symbol(), SymbolStack::test(), and Symbol::token.

+ Here is the call graph for this function:

◆ parseDefineArguments()

void Preprocessor::parseDefineArguments ( Macro * m)

Definition at line 1275 of file preprocessor.cpp.

References Macro::isVariadic.

◆ preprocessed()

Symbols Preprocessor::preprocessed ( const QByteArray & filename,
QFile * device )

Definition at line 1233 of file preprocessor.cpp.

◆ resolveInclude()

QByteArray Preprocessor::resolveInclude ( const QByteArray & filename,
const QByteArray & relativeTo )

Definition at line 1049 of file preprocessor.cpp.

◆ setDebugIncludes()

void Preprocessor::setDebugIncludes ( bool value)

Definition at line 1329 of file preprocessor.cpp.

◆ skipBranch()

bool Preprocessor::skipBranch ( )

Definition at line 106 of file preprocessor.cpp.

References skipUntilEndif().

+ Here is the call graph for this function:

◆ skipUntilEndif()

void Preprocessor::skipUntilEndif ( )

Definition at line 89 of file preprocessor.cpp.

References skipUntilEndif().

Referenced by skipBranch(), and skipUntilEndif().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ substituteUntilNewline()

void Preprocessor::substituteUntilNewline ( Symbols & substituted)

Definition at line 701 of file preprocessor.cpp.

References macros, and Symbol::token.

Referenced by evaluateCondition().

+ Here is the caller graph for this function:

◆ tokenize()

Symbols Preprocessor::tokenize ( const QByteArray & input,
int lineNum = 1,
Preprocessor::TokenizeMode mode = TokenizeCpp )
static

Definition at line 129 of file preprocessor.cpp.

References Symbol::Symbol(), Symbol::Symbol(), defchar, defnext, ident, is_ident_char(), keyword_trans, next, pp_keyword_trans, PrepareDefine, PreparePreprocessorStatement, preprocessOnly, skipQuote(), token, TokenizeCpp, TokenizeDefine, TokenizeInclude, TokenizePreprocessor, and TokenizePreprocessorStatement.

+ Here is the call graph for this function:

Member Data Documentation

◆ frameworks

QList<QByteArray> Preprocessor::frameworks

Definition at line 33 of file preprocessor.h.

◆ macros

Macros Preprocessor::macros

Definition at line 36 of file preprocessor.h.

Referenced by macroExpandIdentifier(), runMoc(), and substituteUntilNewline().

◆ nonlocalIncludePathResolutionCache

QHash<QByteArray, QByteArray> Preprocessor::nonlocalIncludePathResolutionCache

Definition at line 35 of file preprocessor.h.

◆ preprocessedIncludes

QSet<QByteArray> Preprocessor::preprocessedIncludes

Definition at line 34 of file preprocessor.h.

◆ preprocessOnly

bool Preprocessor::preprocessOnly = false
static

Definition at line 32 of file preprocessor.h.

Referenced by runMoc(), and tokenize().


The documentation for this class was generated from the following files: