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

Attribute plugins are broken #70702

Closed
AaronBallman opened this issue Oct 30, 2023 · 3 comments
Closed

Attribute plugins are broken #70702

AaronBallman opened this issue Oct 30, 2023 · 3 comments
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" clang:plugin Clang Plugin interface confirmed Verified by a second party

Comments

@AaronBallman
Copy link
Collaborator

The changes in 0faee97 accidentally broke attribute plugins (for which we have no test coverage, so the author had no way to know that this breakage happened!).

The issue comes from the changes to ParsedAttr.cpp:

bool ParsedAttr::existsInTarget(const TargetInfo &Target) const {
  return getInfo().existsInTarget(Target) &&
         getInfo().spellingExistsInTarget(Target,
                                          getAttributeSpellingListIndex());
}

the call to getAttributeSpellingListIndex() is reaching an unreachable that is generated here:

OS << " llvm_unreachable(\"Ignored/unknown shouldn't get here\");\n";

@AaronBallman AaronBallman added clang:frontend Language frontend issues, e.g. anything involving "Sema" confirmed Verified by a second party clang:plugin Clang Plugin interface labels Oct 30, 2023
@llvmbot
Copy link
Collaborator

llvmbot commented Oct 30, 2023

@llvm/issue-subscribers-clang-frontend

Author: Aaron Ballman (AaronBallman)

The changes in https://github.com/llvm/llvm-project/commit/0faee97a924adec76d5c7cd680c289ced51e6b5a accidentally broke attribute plugins (for which we have no test coverage, so the author had no way to know that this breakage happened!).

The issue comes from the changes to ParsedAttr.cpp:

bool ParsedAttr::existsInTarget(const TargetInfo &amp;Target) const {
  return getInfo().existsInTarget(Target) &amp;&amp;
         getInfo().spellingExistsInTarget(Target,
                                          getAttributeSpellingListIndex());
}

the call to getAttributeSpellingListIndex() is reaching an unreachable that is generated here:

OS << " llvm_unreachable(\"Ignored/unknown shouldn't get here\");\n";

@amykhuang
Copy link
Collaborator

I made a pr for this, but I haven't tested it because I don't know how to make a plugin. #70877

amykhuang added a commit that referenced this issue Nov 20, 2023
[0faee97](0faee97)
broke attribute plugins. Specifically, it added a call to
`getAttributeSpellingListIndex()` in situations that reached an
unreachable statement. This patch adds a check before calling that to
avoid hitting the unreachable.

`clang/test/Frontend/plugin-attribute.cpp` has been broken since
[0faee97](0faee97),
and this patch fixes it.

Bug: [70702](#70702)
@wanders
Copy link
Member

wanders commented Jan 20, 2024

This should be closed, right?

PR is merged. And attribute plugins seems to work fine on trunk.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" clang:plugin Clang Plugin interface confirmed Verified by a second party
Projects
None yet
Development

No branches or pull requests

5 participants