Skip to content

[clang][dataflow] Emit an error if source code is not compiled as C++. #65301

New issue

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

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

Already on GitHub? # to your account

Merged
merged 1 commit into from
Sep 6, 2023

Conversation

martinboehme
Copy link
Contributor

The shape of certain elements of the AST can vary depending on the langugage.
We currently only support C++.

The shape of certain elements of the AST can vary depending on the langugage.
We currently only support C++.
@martinboehme martinboehme requested review from a team as code owners September 5, 2023 06:49
copybara-service bot pushed a commit to google/crubit that referenced this pull request Sep 5, 2023
Adding a small check not to run the code for non-C++ files

The same check can also be added in the framework, e.g.
llvm/llvm-project#65301

this patch stops calling it for all functions before then

PiperOrigin-RevId: 562773151
Change-Id: I0b7feb10da4166a4d231282bb31dfd83a91929f4
@martinboehme martinboehme merged commit c0703ea into llvm:main Sep 6, 2023
avillega pushed a commit to avillega/llvm-project that referenced this pull request Sep 11, 2023
llvm#65301)

The shape of certain elements of the AST can vary depending on the
langugage.
We currently only support C++.
@topolarity
Copy link

Is this the right place to add this check? It doesn't seem like there's any C++-specific logic here.

Presumably the real incompatibility is clang::CFG or one of the consumers of dataflow::ControlFlowContext?

@martinboehme
Copy link
Contributor Author

Is this the right place to add this check? It doesn't seem like there's any C++-specific logic here.

Presumably the real incompatibility is clang::CFG or one of the consumers of dataflow::ControlFlowContext?

Much of the logic in the dataflow framework assumes that the AST comes from a C++ compilation. For example, the code in Transfer.cpp makes a lot of assumptions around this, but other places do too.

ControlFlowContext::build() is a good central place to check whether the language is C++ and abort with a meaningful error message if it isn't.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants