diff options
author | Erik Verbruggen <erik.verbruggen@nokia.com> | 2012-03-26 15:18:01 +0200 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@nokia.com> | 2012-03-29 14:28:17 +0200 |
commit | 60db5736604583fe99dde3c25412d97f9b77489d (patch) | |
tree | 2f5bf1342086232de0570500fd440a98eb12cb96 /src/libs/cplusplus/CppDocument.cpp | |
parent | 159058d9eb7ab233f94cc6a0a5b0e7e8f691a041 (diff) | |
download | qt-creator-60db5736604583fe99dde3c25412d97f9b77489d.tar.gz |
[C++] Rewrite of the preprocessor.
This rewrite fixes a couple of issues with the pre-processor. It now
supports:
- macros in macro bodies
- stringification of parameters [cpp.stringize]
- the concatenation operator [cpp.concat]
- #include MACRO_HERE
- defined() inside macro bodies used in pp-conditions.
Change-Id: Ifdb78041fb6afadf44f939a4bd66ce2832b8601f
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
Diffstat (limited to 'src/libs/cplusplus/CppDocument.cpp')
-rw-r--r-- | src/libs/cplusplus/CppDocument.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/libs/cplusplus/CppDocument.cpp b/src/libs/cplusplus/CppDocument.cpp index ec617ff929..0d39e3b1db 100644 --- a/src/libs/cplusplus/CppDocument.cpp +++ b/src/libs/cplusplus/CppDocument.cpp @@ -198,6 +198,8 @@ protected: }; +#define DO_NOT_DUMP_ALL_PARSER_ERRORS + class DocumentDiagnosticClient : public DiagnosticClient { enum { MAX_MESSAGE_COUNT = 10 }; @@ -217,8 +219,10 @@ public: if (level == Error) { ++errorCount; +#ifdef DO_NOT_DUMP_ALL_PARSER_ERRORS if (errorCount >= MAX_MESSAGE_COUNT) return; // ignore the error +#endif // DO_NOT_DUMP_ALL_PARSER_ERRORS } const QString fileName = QString::fromUtf8(fileId->chars(), fileId->size()); @@ -229,6 +233,16 @@ public: QString message; message.vsprintf(format, ap); +#ifndef DO_NOT_DUMP_ALL_PARSER_ERRORS + { + const char *levelStr = "Unknown level"; + if (level == Document::DiagnosticMessage::Warning) levelStr = "Warning"; + if (level == Document::DiagnosticMessage::Error) levelStr = "Error"; + if (level == Document::DiagnosticMessage::Fatal) levelStr = "Fatal"; + qDebug("%s:%u:%u: %s: %s", fileId->chars(), line, column, levelStr, message.toUtf8().constData()); + } +#endif // DO_NOT_DUMP_ALL_PARSER_ERRORS + Document::DiagnosticMessage m(convertLevel(level), doc->fileName(), line, column, message); messages->append(m); @@ -341,10 +355,9 @@ void Document::appendMacro(const Macro ¯o) void Document::addMacroUse(const Macro ¯o, unsigned offset, unsigned length, unsigned beginLine, - const QVector<MacroArgumentReference> &actuals, bool inCondition) + const QVector<MacroArgumentReference> &actuals) { MacroUse use(macro, offset, offset + length, beginLine); - use.setInCondition(inCondition); foreach (const MacroArgumentReference &actual, actuals) { const Block arg(actual.position(), actual.position() + actual.length()); |