Skip to content

Commit

Permalink
Merge pull request #1656 from SiIky/master
Browse files Browse the repository at this point in the history
Fix NULL check
  • Loading branch information
masatake authored Jan 13, 2018
2 parents 796684b + a877beb commit 1620c63
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 1 deletion.
6 changes: 6 additions & 0 deletions Units/parser-cxx.r/enum-in-a-struct--with-q-extra.d/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
S::T::E::alpha and S::T::E::beta are not included intentionally
Taken from the comments of cxx_tag.c::

// If the scope kind is enumeration then we need to remove the
// last scope part. This is what old ctags did.

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--sort=no
--extra=+q
12 changes: 12 additions & 0 deletions Units/parser-cxx.r/enum-in-a-struct--with-q-extra.d/expected.tags
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
S input.cc /^namespace S {$/;" n file:
T input.cc /^ struct T {$/;" s namespace:S file:
S::T input.cc /^ struct T {$/;" s namespace:S file:
E input.cc /^ enum E {$/;" g struct:S::T file:
S::T::E input.cc /^ enum E {$/;" g struct:S::T file:
alpha input.cc /^ alpha, beta,$/;" e enum:S::T::E file:
S::T::alpha input.cc /^ alpha, beta,$/;" e enum:S::T::E file:
beta input.cc /^ alpha, beta,$/;" e enum:S::T::E file:
S::T::beta input.cc /^ alpha, beta,$/;" e enum:S::T::E file:
elt input.cc /^ } elt;$/;" m struct:S::T typeref:enum:S::T::E file:
S::T::elt input.cc /^ } elt;$/;" m struct:S::T typeref:enum:S::T::E file:
s input.cc /^struct S::T s = { .elt = S::T::E::alpha };$/;" v typeref:struct:S::T
9 changes: 9 additions & 0 deletions Units/parser-cxx.r/enum-in-a-struct--with-q-extra.d/input.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace S {
struct T {
enum E {
alpha, beta,
} elt;
};
}

struct S::T s = { .elt = S::T::E::alpha };
2 changes: 1 addition & 1 deletion parsers/cxx/cxx_token_chain.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ void cxxTokenChainJoinRangeInString(
while(t && (t != to))
{
t = t->pNext;
if(t)
if(!t)
return;

if(szSeparator)
Expand Down

0 comments on commit 1620c63

Please sign in to comment.