-
Notifications
You must be signed in to change notification settings - Fork 387
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
cxxabi.h suggested for __forced_unwind not in code #909
Comments
I'm pretty sure it can be safely ignored.
I tried to read up on forced unwind, and it appears to be a GCC runtime thing invoked when the runtime knows that unwind needs to be performed, but the language can't see it, e.g.
|
On a whim, I moved the diff --git a/iwyu.cc b/iwyu.cc
index 92837a8..785bdc5 100644
--- a/iwyu.cc
+++ b/iwyu.cc
@@ -1890,22 +1890,6 @@ class IwyuBaseAstVisitor : public BaseAstVisitor<Derived> {
//------------------------------------------------------------
// Visitors of types derived from clang::Stmt.
- // Catch statements always require the full type to be visible,
- // no matter if we're catching by value, reference or pointer.
- bool VisitCXXCatchStmt(clang::CXXCatchStmt* stmt) {
- if (CanIgnoreCurrentASTNode()) return true;
-
- if (const Type* caught_type = stmt->getCaughtType().getTypePtrOrNull()) {
- // Strip off pointers/references to get to the 'base' type.
- caught_type = RemovePointersAndReferencesAsWritten(caught_type);
- ReportTypeUse(CurrentLoc(), caught_type);
- } else {
- // catch(...): no type to act on here.
- }
-
- return Base::VisitCXXCatchStmt(stmt);
- }
-
// The type of the for-range-init expression is fully required, because the
// compiler generates method calls to it, e.g. 'for (auto t : ts)' translates
// roughly into 'for (auto i = std::begin(ts); i != std::end(ts); ++i)'.
@@ -3939,6 +3923,21 @@ class IwyuAstConsumer
}
// --- Visitors of types derived from clang::Stmt.
+ // Catch statements always require the full type to be visible,
+ // no matter if we're catching by value, reference or pointer.
+ bool VisitCXXCatchStmt(clang::CXXCatchStmt* stmt) {
+ if (CanIgnoreCurrentASTNode()) return true;
+
+ if (const Type* caught_type = stmt->getCaughtType().getTypePtrOrNull()) {
+ // Strip off pointers/references to get to the 'base' type.
+ caught_type = RemovePointersAndReferencesAsWritten(caught_type);
+ ReportTypeUse(CurrentLoc(), caught_type);
+ } else {
+ // catch(...): no type to act on here.
+ }
+
+ return Base::VisitCXXCatchStmt(stmt);
+ }
// Called whenever a variable, function, enum, etc is used.
bool VisitDeclRefExpr(clang::DeclRefExpr* expr) { ... and that seems to have fixed the problem without breaking any tests. That tells me there must be negative test coverage missing for try/catch in templates. But it's also interesting, cause there's probably more visits in the base visitor that shouldn't apply to templates. Not sure, because I find it hard to reason about user templates vs system templates, but this patch might work around your local problem. |
Did a quick
There are some internal headers that also have this construct, but I can't really decipher what these implementation are for so I'll leave them out. Hopefully this will make people easier to find out where your code is "using" it and how to work around that. |
Fixed on master as of ffe6c3f |
I'm running iwyu over my code base, and there are a few files where it insists I add
I was able to ablate code and find that it seems related to
cv.wait(mu)
.Specifically, the no predicate version.
If I remove
cv.wait(mu)
, iwyu no longer suggestscxxabi.h
.What is this
__forced_unwind
function, why is iwyu recommending it, and can this safely be ignored?Minimal test case:
The text was updated successfully, but these errors were encountered: