Comment 4 for bug 1073399

Revision history for this message
jonathan (sprbeyond) wrote :

1 I find llvm cause this bug .

2 According to error information, there are following code in the TGLexer.cpp(in android/external/llvm/lib/TableGen):

  tgtok::TokKind TGLexer::LexToken() {
  TokStart = CurPtr;
  // This always consumes at least one character.
  int CurChar = getNextChar();

  switch (CurChar) {
  default:
    // Handle letters: [a-zA-Z_]
    if (isalpha(CurChar) || CurChar == '_')
      return LexIdentifier();

    printf(" TGLexer::LexToken : 0x%x-0x%x\n", CurChar, EOF);
    // Unknown character, emit an error.
    return ReturnError(TokStart, "Unexpected character");
  case EOF: return tgtok::Eof;
  ... ...

3 Analyzing code

3.1 When reading next char following real last char of the file , the char is n't EOF. why?

3.2 The proccess of reading file:

    MemoryBuffer::getFile->MemoryBuffer::getOpenFile->shouldUseMmap