Skip to content

cleaned up FwdAnalysis#8652

Open
firewave wants to merge 2 commits into
cppcheck-opensource:mainfrom
firewave:fwd-clean
Open

cleaned up FwdAnalysis#8652
firewave wants to merge 2 commits into
cppcheck-opensource:mainfrom
firewave:fwd-clean

Conversation

@firewave

Copy link
Copy Markdown
Collaborator

No description provided.

@firewave firewave requested a review from francois-berder June 14, 2026 22:51
Comment thread lib/fwdanalysis.cpp
Comment on lines +101 to +108
struct Result {
enum class Type : std::uint8_t { NONE, READ, WRITE, BREAK, RETURN, BAILOUT } type;
explicit Result(Type type) : type(type) {}
Result(Type type, const Token *token) : type(type), token(token) {}
const Token* token{};
};

enum class What : std::uint8_t { Reassign, UnusedValue };

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I missed it. But I feel these should be in some namespace to avoid possible ODR violations.

Suggested change
struct Result {
enum class Type : std::uint8_t { NONE, READ, WRITE, BREAK, RETURN, BAILOUT } type;
explicit Result(Type type) : type(type) {}
Result(Type type, const Token *token) : type(type), token(token) {}
const Token* token{};
};
enum class What : std::uint8_t { Reassign, UnusedValue };
namespace {
struct Result {
enum class Type : std::uint8_t { NONE, READ, WRITE, BREAK, RETURN, BAILOUT } type;
explicit Result(Type type) : type(type) {}
Result(Type type, const Token *token) : type(type), token(token) {}
const Token* token{};
};
enum class What : std::uint8_t { Reassign, UnusedValue };
}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure that is necessary as clang-tidy should complain about that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants