================
Comment at: lib/Sema/AnalysisBasedWarnings.cpp:108-109
@@ +107,4 @@
+ if (CE && CE->getCalleeDecl() == FD) {
+ if (const CXXMemberCallExpr *MCE = dyn_cast<CXXMemberCallExpr>(CE)) {
+ if (isa<CXXThisExpr>(MCE->getImplicitObjectArgument())) {
+ state = AfterFunctionCall;
----------------
If the function is non-virtual, you should warn even if the object argument is
different.
================
Comment at: lib/Sema/AnalysisBasedWarnings.cpp:107
@@ +106,3 @@
+ const CallExpr *CE = dyn_cast<CallExpr>(I->getAs<CFGStmt>()->getStmt());
+ if (CE && CE->getCalleeDecl() == FD) {
+ if (const CXXMemberCallExpr *MCE = dyn_cast<CXXMemberCallExpr>(CE)) {
----------------
Compare canonical declarations here.
================
Comment at: lib/Sema/AnalysisBasedWarnings.cpp:85-87
@@ +84,5 @@
+enum RecursiveState {
+ Unknown,
+ AfterFunctionCall,
+ Reachable
+};
----------------
These names are a bit confusing. They seem to mean:
Unknown: no paths to here have been visited
AfterFunctionCall: no paths to here have been found that don't recurse
Reachable: paths to here have been found that don't recurse
How about `FoundNoPath`, `FoundPath`, `FoundPathWithNoRecursiveCall` or similar?
================
Comment at: lib/Sema/AnalysisBasedWarnings.cpp:96-97
@@ +95,4 @@
+
+ if (states[ID] < state)
+ states[ID] = state;
+ else
----------------
Once you set the exit block to `Reachable`, you can bail out of the traversal
early.
http://llvm-reviews.chandlerc.com/D1864
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits