Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check full AST for functions and classes #4

Open
Artalus opened this issue May 7, 2018 · 1 comment
Open

Check full AST for functions and classes #4

Artalus opened this issue May 7, 2018 · 1 comment
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@Artalus
Copy link
Owner

Artalus commented May 7, 2018

Current implementation simply compares the text of definitions, instead of their semantic content and underlying types, which doesn't allow detecting cases like these:

using ViolatingAlias = float;
class SubtleViolationClass {
public:
	ViolatingAlias x;
	void fun() { std::cout << x << '\n'; }
};

//b.cpp
using ViolatingAlias = std::string;
class SubtleViolationClass {
public:
	ViolatingAlias x;
	void fun() { std::cout << x << '\n'; }
};

The possible way for comparing statements (function bodies) is present here.
Problem: stored Stmt* pointers invalidate somewhere after clang::ast_matchers::MatchFinder::MatchCallback's void run(const clang::ast_matchers::MatchFinder::MatchResult &result) exit.
Maybe matchers are a wrong approach and I need to switch to other ways of traversing AST.

@Artalus Artalus added bug Something isn't working help wanted Extra attention is needed labels May 7, 2018
@Artalus
Copy link
Owner Author

Artalus commented May 11, 2018

Clue from mailing list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant