diff options
author | Roberto Raggi <qtc-committer@nokia.com> | 2008-12-22 11:40:53 +0100 |
---|---|---|
committer | Roberto Raggi <qtc-committer@nokia.com> | 2008-12-22 11:40:53 +0100 |
commit | 753ddb7ce076a12df07b2f800fe785cf659277df (patch) | |
tree | 74797fcd46919bed253d9fbbc85c67be18702d51 /src/libs/cplusplus/pp-macro-expander.cpp | |
parent | d8336257cb1da778ab74f1edce68f855dd862242 (diff) | |
download | qt-creator-753ddb7ce076a12df07b2f800fe785cf659277df.tar.gz |
Some cleanup in the C++ preprocessor.
Introduced pp-scanner.cpp, renamed `pp' to `Preprocessor' and removed useless #includes.
Diffstat (limited to 'src/libs/cplusplus/pp-macro-expander.cpp')
-rw-r--r-- | src/libs/cplusplus/pp-macro-expander.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/libs/cplusplus/pp-macro-expander.cpp b/src/libs/cplusplus/pp-macro-expander.cpp index 21148d2446..6a7d7e75df 100644 --- a/src/libs/cplusplus/pp-macro-expander.cpp +++ b/src/libs/cplusplus/pp-macro-expander.cpp @@ -32,11 +32,26 @@ ***************************************************************************/ #include "pp.h" +#include "pp-cctype.h" #include "pp-macro-expander.h" #include <QDateTime> using namespace CPlusPlus; +inline static bool comment_p (const char *__first, const char *__last) +{ + if (__first == __last) + return false; + + if (*__first != '/') + return false; + + if (++__first == __last) + return false; + + return (*__first == '/' || *__first == '*'); +} + MacroExpander::MacroExpander (Environment &env, pp_frame *frame) : env(env), frame(frame), lines(0), generated_lines(0) @@ -137,7 +152,7 @@ const char *MacroExpander::operator () (const char *__first, const char *__last, __result->append(__first, next_pos - __first); __first = next_pos; } - else if (_PP_internal::comment_p (__first, __last)) + else if (comment_p (__first, __last)) { __first = skip_comment_or_divop (__first, __last); int n = skip_comment_or_divop.lines; |