|
@@ -29,7 +29,7 @@
|
|
#include <system_error>
|
|
#include <system_error>
|
|
using namespace clang;
|
|
using namespace clang;
|
|
|
|
|
|
-#define DISK_TOKEN_SIZE (1+1+2+4+4)
|
|
|
|
|
|
+static const unsigned StoredTokenSize = 1 + 1 + 2 + 4 + 4;
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
//===----------------------------------------------------------------------===//
|
|
// PTHLexer methods.
|
|
// PTHLexer methods.
|
|
@@ -110,7 +110,7 @@ bool PTHLexer::Lex(Token& Tok) {
|
|
}
|
|
}
|
|
|
|
|
|
if (TKind == tok::hash && Tok.isAtStartOfLine()) {
|
|
if (TKind == tok::hash && Tok.isAtStartOfLine()) {
|
|
- LastHashTokPtr = CurPtr - DISK_TOKEN_SIZE;
|
|
|
|
|
|
+ LastHashTokPtr = CurPtr - StoredTokenSize;
|
|
assert(!LexingRawMode);
|
|
assert(!LexingRawMode);
|
|
PP->HandleDirective(Tok);
|
|
PP->HandleDirective(Tok);
|
|
|
|
|
|
@@ -179,7 +179,7 @@ void PTHLexer::DiscardToEndOfLine() {
|
|
if (y & Token::StartOfLine) break;
|
|
if (y & Token::StartOfLine) break;
|
|
|
|
|
|
// Skip to the next token.
|
|
// Skip to the next token.
|
|
- p += DISK_TOKEN_SIZE;
|
|
|
|
|
|
+ p += StoredTokenSize;
|
|
}
|
|
}
|
|
|
|
|
|
CurPtr = p;
|
|
CurPtr = p;
|
|
@@ -255,10 +255,10 @@ bool PTHLexer::SkipBlock() {
|
|
// already points 'elif'. Just return.
|
|
// already points 'elif'. Just return.
|
|
|
|
|
|
if (CurPtr > HashEntryI) {
|
|
if (CurPtr > HashEntryI) {
|
|
- assert(CurPtr == HashEntryI + DISK_TOKEN_SIZE);
|
|
|
|
|
|
+ assert(CurPtr == HashEntryI + StoredTokenSize);
|
|
// Did we reach a #endif? If so, go ahead and consume that token as well.
|
|
// Did we reach a #endif? If so, go ahead and consume that token as well.
|
|
if (isEndif)
|
|
if (isEndif)
|
|
- CurPtr += DISK_TOKEN_SIZE*2;
|
|
|
|
|
|
+ CurPtr += StoredTokenSize * 2;
|
|
else
|
|
else
|
|
LastHashTokPtr = HashEntryI;
|
|
LastHashTokPtr = HashEntryI;
|
|
|
|
|
|
@@ -274,10 +274,12 @@ bool PTHLexer::SkipBlock() {
|
|
|
|
|
|
// Skip the '#' token.
|
|
// Skip the '#' token.
|
|
assert(((tok::TokenKind)*CurPtr) == tok::hash);
|
|
assert(((tok::TokenKind)*CurPtr) == tok::hash);
|
|
- CurPtr += DISK_TOKEN_SIZE;
|
|
|
|
|
|
+ CurPtr += StoredTokenSize;
|
|
|
|
|
|
// Did we reach a #endif? If so, go ahead and consume that token as well.
|
|
// Did we reach a #endif? If so, go ahead and consume that token as well.
|
|
- if (isEndif) { CurPtr += DISK_TOKEN_SIZE*2; }
|
|
|
|
|
|
+ if (isEndif) {
|
|
|
|
+ CurPtr += StoredTokenSize * 2;
|
|
|
|
+ }
|
|
|
|
|
|
return isEndif;
|
|
return isEndif;
|
|
}
|
|
}
|
|
@@ -290,7 +292,7 @@ SourceLocation PTHLexer::getSourceLocation() {
|
|
// NOTE: This is a virtual function; hence it is defined out-of-line.
|
|
// NOTE: This is a virtual function; hence it is defined out-of-line.
|
|
using namespace llvm::support;
|
|
using namespace llvm::support;
|
|
|
|
|
|
- const unsigned char *OffsetPtr = CurPtr + (DISK_TOKEN_SIZE - 4);
|
|
|
|
|
|
+ const unsigned char *OffsetPtr = CurPtr + (StoredTokenSize - 4);
|
|
uint32_t Offset = endian::readNext<uint32_t, little, aligned>(OffsetPtr);
|
|
uint32_t Offset = endian::readNext<uint32_t, little, aligned>(OffsetPtr);
|
|
return FileStartLoc.getLocWithOffset(Offset);
|
|
return FileStartLoc.getLocWithOffset(Offset);
|
|
}
|
|
}
|