github / github/codeql

To get the expression from SwitchCase

Open
#9,842 9 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
CodeQL
Stars
10.1k
Forks
2.1k
Avg merge
2d 15h
Merged PRs (30d)
141

Description

```c

#define ABC XVY(1)

{
int cmd = 1;
int ABC=1;

switch(cmd) {
case ABC:
printf("hello!\n);
}
}
```

How to get a "ABC" from a SwitchCase class? (Not a value using (SwitchCase).getExpr().getFullyConverted().getValue() )

Thanks in advance,

Contributor guide

Open the contributing guide

Research direction

Start with the CodeQL SwitchCase class and the getExpr().getFullyConverted().getValue() call mentioned in the issue. Trace how the case expression is represented and inspect the available library APIs; done means identifying a supported way to retrieve the source name "ABC" rather than its evaluated value.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
security, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.