File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -1286,6 +1286,14 @@ class Analyzer {
12861286 return true ;
12871287 }
12881288
1289+ bool TraverseCXXRecordDecl (CXXRecordDecl *D) override {
1290+ // Completely skip local struct/class/union declarations since their
1291+ // methods would otherwise be incorrectly interpreted as part of the
1292+ // function we are currently traversing. The initial Sema pass will have
1293+ // already recorded any nonblocking methods needing analysis.
1294+ return true ;
1295+ }
1296+
12891297 bool TraverseConstructorInitializer (CXXCtorInitializer *Init) override {
12901298 ViolationSite PrevVS = VSite;
12911299 if (Init->isAnyMemberInitializer ())
Original file line number Diff line number Diff line change @@ -104,6 +104,15 @@ void nb8c()
104104 };
105105}
106106
107+ void nb8d () [[clang::nonblocking]]
108+ {
109+ // Blocking methods of a local CXXRecordDecl do not generate diagnostics
110+ // for the outer function.
111+ struct Functor1 {
112+ void method () { void * ptr = new int ; }
113+ };
114+ }
115+
107116// Make sure template expansions are found and verified.
108117 template <typename T>
109118 struct Adder {
You can’t perform that action at this time.
0 commit comments