aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/Expr.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-09-06 21:41:04 +0000
committerDouglas Gregor <dgregor@apple.com>2011-09-06 21:41:04 +0000
commit1ddc9c4674b7c737ec65241a531df8c64e40b0a9 (patch)
tree5458b6904520917ace4ba747143ae72d561b14c8 /lib/AST/Expr.cpp
parentba26149eb7b20bc9d4ed0581aefe7237b2a08fd8 (diff)
When extracting the callee declaration from a call expression, be sure
to look through SubstNonTypeTemplateParmExprs. Then, update the IR generation of CallExprs to actually use CallExpr::getCalleeDecl() rather than attempting to mimick its behavior (badly). Fixes <rdar://problem/10063539>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139185 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Expr.cpp')
-rw-r--r--lib/AST/Expr.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp
index 41fa850184..26ff6f3b7d 100644
--- a/lib/AST/Expr.cpp
+++ b/lib/AST/Expr.cpp
@@ -771,6 +771,12 @@ CallExpr::CallExpr(ASTContext &C, StmtClass SC, unsigned NumPreArgs,
Decl *CallExpr::getCalleeDecl() {
Expr *CEE = getCallee()->IgnoreParenCasts();
+
+ while (SubstNonTypeTemplateParmExpr *NTTP
+ = dyn_cast<SubstNonTypeTemplateParmExpr>(CEE)) {
+ CEE = NTTP->getReplacement()->IgnoreParenCasts();
+ }
+
// If we're calling a dereference, look at the pointer instead.
if (BinaryOperator *BO = dyn_cast<BinaryOperator>(CEE)) {
if (BO->isPtrMemOp())