summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/Expr.cpp
diff options
context:
space:
mode:
authorZhongxing Xu <xuzhongxing@gmail.com>2009-07-17 07:29:51 +0000
committerZhongxing Xu <xuzhongxing@gmail.com>2009-07-17 07:29:51 +0000
commit3c8fa978adee9387a1e3a1f60e8fe5d6b9ccc14a (patch)
treebdc1ee3e89b5bb4f4716372437fa259560b60651 /clang/lib/AST/Expr.cpp
parent6a60a66b2be5b527ca46b9c381fd21d0e124be9e (diff)
downloadbcm5719-llvm-3c8fa978adee9387a1e3a1f60e8fe5d6b9ccc14a.tar.gz
bcm5719-llvm-3c8fa978adee9387a1e3a1f60e8fe5d6b9ccc14a.zip
Refactor code into a new CallExpr::getDirectCallee() method. Simplify some
code with the new method. llvm-svn: 76164
Diffstat (limited to 'clang/lib/AST/Expr.cpp')
-rw-r--r--clang/lib/AST/Expr.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp
index 63a6d3153c7..320a4f1f72e 100644
--- a/clang/lib/AST/Expr.cpp
+++ b/clang/lib/AST/Expr.cpp
@@ -224,6 +224,16 @@ void CallExpr::Destroy(ASTContext& C) {
C.Deallocate(this);
}
+FunctionDecl *CallExpr::getDirectCallee() {
+ Expr *CEE = getCallee()->IgnoreParenCasts();
+ if (DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(CEE)) {
+ // FIXME: We can follow objective-c methods and C++ member functions...
+ return dyn_cast<FunctionDecl>(DRE->getDecl());
+ }
+
+ return 0;
+}
+
/// setNumArgs - This changes the number of arguments present in this call.
/// Any orphaned expressions are deleted by this, and any new operands are set
/// to null.
OpenPOWER on IntegriCloud