]> granicus.if.org Git - clang/commitdiff
Fix <rdar://problem/6512717> by correctly reading the right offset in the token data...
authorTed Kremenek <kremenek@apple.com>
Wed, 21 Jan 2009 22:41:38 +0000 (22:41 +0000)
committerTed Kremenek <kremenek@apple.com>
Wed, 21 Jan 2009 22:41:38 +0000 (22:41 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62725 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Lex/PTHLexer.cpp
test/SemaObjC/cocoa.m

index aa59db5ae2a0dbb71c6cc355a6ef5f24276d7f1c..9fa2bb2b0fbf37277dd399ec156749b45167eb39 100644 (file)
@@ -324,7 +324,7 @@ SourceLocation PTHLexer::getSourceLocation() {
   // handling a #included file.  Just read the necessary data from the token
   // data buffer to construct the SourceLocation object.
   // NOTE: This is a virtual function; hence it is defined out-of-line.
-  const unsigned char *OffsetPtr = CurPtr + (1 + 1 + 3);
+  const unsigned char *OffsetPtr = CurPtr + (DISK_TOKEN_SIZE - 4);
   uint32_t Offset = Read32(OffsetPtr);
   return FileStartLoc.getFileLocWithOffset(Offset);
 }
index ac7d1dc6668855a8c3dc8fa148397a3b4ea6b742..795e0c8cb28d75d7538d2546070fee740ce9fb27 100644 (file)
@@ -1,5 +1,6 @@
 // RUN: clang %s -print-stats &&
-// RUN: clang -x objective-c-header -o %t %s && clang -token-cache %t %s
+// RUN: clang -x objective-c-header -o %t %s && clang -token-cache %t %s &&
+// RUN: clang -x objective-c-header -o %t %s && clang -token-cache %t %s -E %s -o /dev/null
 #ifdef __APPLE__
 #include <Cocoa/Cocoa.h>
 #endif