-
Notifications
You must be signed in to change notification settings - Fork 632
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cxx: use a trashbox for deleteing tokens allocated for anonymous para…
…meters Partially close #3372. The original code assumed tokens allocated in cxxParserTokenChainLooksLikeFunctionParameterList() for tagging anonymous parameters were deleted on its caller side (cxxParserEmitFunctionParameterTags()). However, in some conditions, cxxParserEmitFunctionParameterTags() are not called. As a result, the allocated tokens are not deleted. To avoid the memory leaking, the deletion cannot depend on cxxParserEmitFunctionParameterTags(). This change uses per-parsing trashbox for deleting the anonymous tokens. The objects linked to the trashbox are destroyed at the end of parsing the current input file. Signed-off-by: Masatake YAMATO <[email protected]>
- Loading branch information
Showing
6 changed files
with
25 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This is a test case for detecting memory leaking. |
2 changes: 2 additions & 0 deletions
2
Units/parser-c.r/anonymous-param-in-broken-paramlist.d/args.ctags
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--kinds-C=+z | ||
--extras=+{anonymous} |
16 changes: 16 additions & 0 deletions
16
Units/parser-c.r/anonymous-param-in-broken-paramlist.d/input-0.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* https://gitlab.gnome.org/GNOME/glib/-/blob/main/gio/gdummyproxyresolver.c */ | ||
G_DEFINE_TYPE_WITH_CODE (GDummyProxyResolver, g_dummy_proxy_resolver, G_TYPE_OBJECT, | ||
G_IMPLEMENT_INTERFACE (G_TYPE_PROXY_RESOLVER, | ||
g_dummy_proxy_resolver_iface_init) | ||
_g_io_modules_ensure_extension_points_registered (); | ||
g_io_extension_point_implement (G_PROXY_RESOLVER_EXTENSION_POINT_NAME, | ||
g_define_type_id, | ||
"dummy", | ||
-100)) | ||
|
||
static void | ||
g_dummy_proxy_resolver_finalize (GObject *object) | ||
{ | ||
/* must chain up */ | ||
G_OBJECT_CLASS (g_dummy_proxy_resolver_parent_class)->finalize (object); | ||
} |
1 change: 1 addition & 0 deletions
1
Units/parser-c.r/anonymous-param-in-broken-paramlist.d/input-1.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
G (f () g ()) h (void) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
f(a,){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters