Skip to content
This repository has been archived by the owner on Apr 23, 2020. It is now read-only.

Commit

Permalink
[libclang] Fix issue with clang_tokenize and make sure it interprets …
Browse files Browse the repository at this point in the history
…CXSourceRange as half-open character range.

Patch provided by Emilio Cobos Álvarez! (https://reviews.llvm.org/D26446)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@286421 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
akyrtzi committed Nov 9, 2016
1 parent 3b3f2f6 commit 3b61b92
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions test/Index/annotate-tokens.c
Original file line number Diff line number Diff line change
Expand Up @@ -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: ";"
2 changes: 1 addition & 1 deletion tools/libclang/CIndex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6156,7 +6156,7 @@ static void getTokens(ASTUnit *CXXUnit, SourceRange Range,
}
CXTokens.push_back(CXTok);
previousWasAt = Tok.is(tok::at);
} while (Lex.getBufferLocation() <= EffectiveBufferEnd);
} while (Lex.getBufferLocation() < EffectiveBufferEnd);
}

void clang_tokenize(CXTranslationUnit TU, CXSourceRange Range,
Expand Down

0 comments on commit 3b61b92

Please sign in to comment.