r286421 - [libclang] Fix issue with clang_tokenize and make sure it interprets CXSourceRange as half-open character range.
Argyrios Kyrtzidis via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 9 15:58:39 PST 2016
Author: akirtzidis
Date: Wed Nov 9 17:58:39 2016
New Revision: 286421
URL: http://llvm.org/viewvc/llvm-project?rev=286421&view=rev
Log:
[libclang] Fix issue with clang_tokenize and make sure it interprets CXSourceRange as half-open character range.
Patch provided by Emilio Cobos Álvarez! (https://reviews.llvm.org/D26446)
Modified:
cfe/trunk/test/Index/annotate-tokens.c
cfe/trunk/tools/libclang/CIndex.cpp
Modified: cfe/trunk/test/Index/annotate-tokens.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/annotate-tokens.c?rev=286421&r1=286420&r2=286421&view=diff
==============================================================================
--- cfe/trunk/test/Index/annotate-tokens.c (original)
+++ cfe/trunk/test/Index/annotate-tokens.c Wed Nov 9 17:58:39 2016
@@ -239,3 +239,7 @@ void test() {
// CHECK-RANGE2: Identifier: "reg" [68:3 - 68:6] DeclRefExpr=reg:67:7
// CHECK-RANGE2: Punctuation: "." [68:6 - 68:7] MemberRefExpr=field:62:9
// CHECK-RANGE2: Identifier: "field" [68:7 - 68:12] MemberRefExpr=field:62:9
+
+// RUN: c-index-test -test-annotate-tokens=%s:68:15:68:16 %s | FileCheck %s -check-prefix=CHECK-RANGE3
+// CHECK-RANGE3: Literal: "1" [68:15 - 68:16] IntegerLiteral=
+// CHECK-RANGE3-NOT: Punctuation: ";"
Modified: cfe/trunk/tools/libclang/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndex.cpp?rev=286421&r1=286420&r2=286421&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CIndex.cpp (original)
+++ cfe/trunk/tools/libclang/CIndex.cpp Wed Nov 9 17:58:39 2016
@@ -6156,7 +6156,7 @@ static void getTokens(ASTUnit *CXXUnit,
}
CXTokens.push_back(CXTok);
previousWasAt = Tok.is(tok::at);
- } while (Lex.getBufferLocation() <= EffectiveBufferEnd);
+ } while (Lex.getBufferLocation() < EffectiveBufferEnd);
}
void clang_tokenize(CXTranslationUnit TU, CXSourceRange Range,
More information about the cfe-commits
mailing list