aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/cplusplus/pp-engine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs/cplusplus/pp-engine.cpp')
-rw-r--r--src/libs/cplusplus/pp-engine.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/libs/cplusplus/pp-engine.cpp b/src/libs/cplusplus/pp-engine.cpp
index 74ca1ceb516..a1343e54713 100644
--- a/src/libs/cplusplus/pp-engine.cpp
+++ b/src/libs/cplusplus/pp-engine.cpp
@@ -1626,10 +1626,10 @@ void Preprocessor::handlePreprocessorDirective(PPToken *tk)
static const QByteArray ppInclude("include");
static const QByteArray ppIncludeNext("include_next");
static const QByteArray ppImport("import");
+ static const QByteArray ppPragma("pragma");
//### TODO:
// line
// error
- // pragma
if (tk->is(T_IDENTIFIER)) {
const ByteArrayRef directive = tk->asByteArrayRef();
@@ -1640,6 +1640,8 @@ void Preprocessor::handlePreprocessorDirective(PPToken *tk)
handleIfDefDirective(true, tk);
} else if (directive == ppEndIf) {
handleEndIfDirective(tk, poundToken);
+ } else if (directive == ppPragma) {
+ handlePragmaDirective(tk);
} else {
m_state.updateIncludeGuardState(State::IncludeGuardStateHint_OtherToken);
@@ -1866,6 +1868,23 @@ void Preprocessor::handleDefineDirective(PPToken *tk)
m_client->macroAdded(macro);
}
+void Preprocessor::handlePragmaDirective(PPToken *tk)
+{
+ Pragma pragma;
+ pragma.line = tk->lineno;
+ lex(tk); // consume "pragma" token
+
+ while (isContinuationToken(*tk)) {
+ if (!consumeComments(tk))
+ return;
+ pragma.tokens << tk->asByteArrayRef().toByteArray();
+ lex(tk);
+ }
+
+ if (m_client)
+ m_client->pragmaAdded(pragma);
+}
+
QByteArray Preprocessor::expand(PPToken *tk, PPToken *lastConditionToken)
{
unsigned line = tk->lineno;