File tree 2 files changed +16
-1
lines changed
2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change 23
23
#include " clang/Basic/IdentifierTable.h"
24
24
#include " clang/Basic/SourceLocation.h"
25
25
#include " clang/Basic/Specifiers.h"
26
- #include " llvm/ADT/STLExtras.h"
27
26
#include " llvm/ADT/STLFunctionalExtras.h"
28
27
#include " llvm/ADT/SmallVector.h"
29
28
#include " llvm/Support/Casting.h"
@@ -350,6 +349,15 @@ class ASTWalker : public RecursiveASTVisitor<ASTWalker> {
350
349
RefType::Implicit);
351
350
return true ;
352
351
}
352
+
353
+ bool VisitCXXNewExpr (CXXNewExpr *E) {
354
+ report (E->getExprLoc (), E->getOperatorNew ());
355
+ return true ;
356
+ }
357
+ bool VisitCXXDeleteExpr (CXXDeleteExpr *E) {
358
+ report (E->getExprLoc (), E->getOperatorDelete ());
359
+ return true ;
360
+ }
353
361
};
354
362
355
363
} // namespace
Original file line number Diff line number Diff line change @@ -555,5 +555,12 @@ TEST(WalkAST, FriendDecl) {
555
555
testWalk (" void $explicit^foo();" , " struct Bar { friend void ^foo(); };" );
556
556
testWalk (" struct $explicit^Foo {};" , " struct Bar { friend struct ^Foo; };" );
557
557
}
558
+
559
+ TEST (WalkAST, OperatorNewDelete) {
560
+ testWalk (" void* $explicit^operator new(unsigned long, void*);" ,
561
+ " struct Bar { void foo() { Bar b; ^new (&b) Bar; } };" );
562
+ testWalk (" struct A { static void $explicit^operator delete(void*); };" ,
563
+ " void foo() { A a; ^delete &a; }" );
564
+ }
558
565
} // namespace
559
566
} // namespace clang::include_cleaner
You can’t perform that action at this time.
0 commit comments