From 0f66874aebd6beef4daf2356f7f9c9eeebee4364 Mon Sep 17 00:00:00 2001 From: Renaud Durlin Date: Wed, 2 Oct 2013 19:57:32 +0200 Subject: [PATCH] Typedef requires include and not forward declaration --- cpp/find_warnings.py | 5 ++++- test/baz.h | 2 ++ test/typedef.h | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/cpp/find_warnings.py b/cpp/find_warnings.py index 482cfe3..2bdcb67 100644 --- a/cpp/find_warnings.py +++ b/cpp/find_warnings.py @@ -249,7 +249,10 @@ def _add_reference(name, namespace): return name = file_use_node[1].normalized_filename if name in file_uses: - file_uses[name] |= USES_REFERENCE + if isinstance(file_use_node[0], ast.Typedef): + file_uses[name] |= USES_DECLARATION + else: + file_uses[name] |= USES_REFERENCE def _add_use(name, namespace): if isinstance(name, list): diff --git a/test/baz.h b/test/baz.h index 2750db6..46ec50a 100644 --- a/test/baz.h +++ b/test/baz.h @@ -1,3 +1,5 @@ #include "bar.h" +#include "typedef.h" void fct(Bar& bar); +void fct(Type& t); diff --git a/test/typedef.h b/test/typedef.h index abb287f..1d3646f 100644 --- a/test/typedef.h +++ b/test/typedef.h @@ -2,3 +2,4 @@ class Foo; class Bar; typedef Plain p; typedef Ref r; +typedef int Type;