-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extend parent RecordDecl analysis for EnumDecls
If the current declaration is a EnumDecl and it is inside a nested struct we also fall in the case we need to output the parent RecordDecl as well. Signed-off-by: Giuliano Belinassi <[email protected]>
- Loading branch information
1 parent
57e013e
commit cebcb26
Showing
2 changed files
with
57 additions
and
18 deletions.
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
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,33 @@ | ||
/* { dg-options "-DCE_EXTRACT_FUNCTIONS=f -DCE_NO_EXTERNALIZATION" }*/ | ||
|
||
extern int strncasecmp (const char *__s1, const char *__s2, unsigned long __n) | ||
__attribute__ ((__nothrow__ )) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); | ||
|
||
extern unsigned long strlen (const char *__s) | ||
__attribute__ ((__nothrow__ )) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); | ||
|
||
struct config { | ||
enum sched_prio { | ||
SCHED_ERR = -1, | ||
SCHED_HIGH, | ||
SCHED_DEFAULT, | ||
SCHED_LOW | ||
} prio; | ||
unsigned int verbose; | ||
}; | ||
|
||
/** clang-extract: from source.c:1511:1 */ | ||
enum sched_prio f(const char *str) | ||
{ | ||
if (strncasecmp("high", str, strlen(str)) == 0) | ||
return SCHED_HIGH; | ||
else if (strncasecmp("default", str, strlen(str)) == 0) | ||
return SCHED_DEFAULT; | ||
else if (strncasecmp("low", str, strlen(str)) == 0) | ||
return SCHED_LOW; | ||
else | ||
return SCHED_ERR; | ||
} | ||
|
||
/* { dg-final { scan-tree-dump "struct config *{" } } */ | ||
/* { dg-final { scan-tree-dump " *enum sched_prio *{" } } */ |