From e53fc5e231c92304369c0804b701145219cd4703 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20M=C3=BCller?= Date: Tue, 10 Oct 2017 22:33:03 +0200 Subject: [PATCH] Include semicolon in unexposed entity --- src/libclang/tokenizer.cpp | 8 +++++++- src/libclang/variable_parser.cpp | 1 - 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/libclang/tokenizer.cpp b/src/libclang/tokenizer.cpp index 5e5642e..6218fc3 100644 --- a/src/libclang/tokenizer.cpp +++ b/src/libclang/tokenizer.cpp @@ -223,9 +223,15 @@ namespace || clang_isExpression(kind) || kind == CXCursor_CXXBaseSpecifier || kind == CXCursor_TemplateTypeParameter #endif - ) + ) // need to shrink range by one end = get_next_location(tu, file, end, -1); + else if (kind == CXCursor_UnexposedDecl) + { + // include semicolon, if necessary + if (token_after_is(tu, file, cur, end, ";")) + end = get_next_location(tu, file, end); + } return clang_getRange(begin, end); } diff --git a/src/libclang/variable_parser.cpp b/src/libclang/variable_parser.cpp index 89e00d4..d4a65bf 100644 --- a/src/libclang/variable_parser.cpp +++ b/src/libclang/variable_parser.cpp @@ -6,7 +6,6 @@ #include #include -#include #include "libclang_visitor.hpp"