diff options
author | Erik Verbruggen <erik.verbruggen@me.com> | 2012-04-22 12:04:00 +0200 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@nokia.com> | 2012-04-23 11:06:35 +0200 |
commit | bd4762218373276b2f38e52d486db339c5428309 (patch) | |
tree | a08981421093ce0d6ab3632397fd7b9b867e0c90 /src/libs/cplusplus/PPToken.h | |
parent | 3f4a9548be70906b2cc0acf71e9d5eadf78f7a8b (diff) | |
download | qt-creator-bd4762218373276b2f38e52d486db339c5428309.tar.gz |
Fix out-of-memory crash when indenting generated tokens.
Generated tokens do not have a position in any source file, so not try
to indent them. Previously, the 'source' used was the scratch buffer,
which would not contain newlines, so the indent depth would be the
length of the scratch buffer at that point.
Task-number: QTCREATORBUG-7262
Change-Id: If94213d6dffd13dd2b47c7038ec2398ad925d904
Reviewed-by: Yuchen Deng <loaden@gmail.com>
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@nokia.com>
Diffstat (limited to 'src/libs/cplusplus/PPToken.h')
-rw-r--r-- | src/libs/cplusplus/PPToken.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/libs/cplusplus/PPToken.h b/src/libs/cplusplus/PPToken.h index 3fbb3ad482..eb59fc847b 100644 --- a/src/libs/cplusplus/PPToken.h +++ b/src/libs/cplusplus/PPToken.h @@ -96,8 +96,11 @@ public: const QByteArray &source() const { return m_src; } - const char *start() const - { return m_src.constData() + offset; } + const char *bufferStart() const + { return m_src.constData(); } + + const char *tokenStart() const + { return bufferStart() + offset; } ByteArrayRef asByteArrayRef() const { return ByteArrayRef(&m_src, offset, length()); } |