-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
usage of 'this' in member methods cancels static suggestion
- Loading branch information
Showing
4 changed files
with
52 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright 2012 by Laszlo Nagy [see file MIT-LICENSE] | ||
|
||
#ifndef _IsCXXThisExpr_hpp_ | ||
#define _IsCXXThisExpr_hpp_ | ||
|
||
#include <boost/noncopyable.hpp> | ||
|
||
#include <clang/AST/AST.h> | ||
#include <clang/AST/RecursiveASTVisitor.h> | ||
|
||
// These are helper struct/method to figure out was it a member | ||
// method call or a call on a variable. | ||
class IsCXXThisExpr | ||
: public boost::noncopyable | ||
, public clang::RecursiveASTVisitor<IsCXXThisExpr> { | ||
public: | ||
static bool Check(clang::Stmt const * const Stmt) { | ||
IsCXXThisExpr V; | ||
V.TraverseStmt(const_cast<clang::Stmt*>(Stmt)); | ||
return V.Found; | ||
} | ||
|
||
// public visitor method. | ||
bool VisitCXXThisExpr(clang::CXXThisExpr const *) { | ||
Found = true; | ||
return true; | ||
} | ||
|
||
private: | ||
IsCXXThisExpr() | ||
: boost::noncopyable() | ||
, clang::RecursiveASTVisitor<IsCXXThisExpr>() | ||
, Found(false) | ||
{ } | ||
|
||
bool Found; | ||
}; | ||
|
||
#endif // _IsCXXThisExpr_hpp_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters