summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ExprCXX.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-03-13 18:40:31 +0000
committerDouglas Gregor <dgregor@apple.com>2009-03-13 18:40:31 +0000
commit1baf54e1aa8a1296c43ef49f63cccb1220d8b6a7 (patch)
treeeabf5fad8b03677f6fc4742a6772aa82a0a5542f /clang/lib/AST/ExprCXX.cpp
parent71144973f3954ee03ffc2623539a60df227fc106 (diff)
downloadbcm5719-llvm-1baf54e1aa8a1296c43ef49f63cccb1220d8b6a7.tar.gz
bcm5719-llvm-1baf54e1aa8a1296c43ef49f63cccb1220d8b6a7.zip
Refactor the way we handle operator overloading and template
instantiation for binary operators. This change moves most of the operator-overloading code from the parser action ActOnBinOp to a new, parser-independent semantic checking routine CreateOverloadedBinOp. Of particular importance is the fact that CreateOverloadedBinOp does *not* perform any name lookup based on the current parsing context (it doesn't take a Scope*), since it has to be usable during template instantiation, when there is no scope information. Rather, it takes a pre-computed set of functions that are visible from the context or via argument-dependent lookup, and adds to that set any member operators and built-in operator candidates. The set of functions is computed in the parser action ActOnBinOp based on the current context (both operator name lookup and argument-dependent lookup). Within a template, the set computed by ActOnBinOp is saved within the type-dependent AST node and is augmented with the results of argument-dependent name lookup at instantiation time (see TemplateExprInstantiator::VisitCXXOperatorCallExpr). Sadly, we can't fully test this yet. I'll follow up with template instantiation for sizeof so that the real fun can begin. llvm-svn: 66923
Diffstat (limited to 'clang/lib/AST/ExprCXX.cpp')
-rw-r--r--clang/lib/AST/ExprCXX.cpp21
1 files changed, 0 insertions, 21 deletions
diff --git a/clang/lib/AST/ExprCXX.cpp b/clang/lib/AST/ExprCXX.cpp
index d60ef39070b..184c9fe4904 100644
--- a/clang/lib/AST/ExprCXX.cpp
+++ b/clang/lib/AST/ExprCXX.cpp
@@ -160,27 +160,6 @@ bool UnaryTypeTraitExpr::EvaluateTrait() const {
}
}
-OverloadedOperatorKind CXXOperatorCallExpr::getOperator() const {
- // All simple function calls (e.g. func()) are implicitly cast to pointer to
- // function. As a result, we try and obtain the DeclRefExpr from the
- // ImplicitCastExpr.
- const ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(getCallee());
- if (!ICE) // FIXME: deal with more complex calls (e.g. (func)(), (*func)()).
- return OO_None;
-
- const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(ICE->getSubExpr());
- if (!DRE)
- return OO_None;
-
- if (const FunctionDecl *FDecl = dyn_cast<FunctionDecl>(DRE->getDecl()))
- return FDecl->getDeclName().getCXXOverloadedOperator();
- else if (const OverloadedFunctionDecl *Ovl
- = dyn_cast<OverloadedFunctionDecl>(DRE->getDecl()))
- return Ovl->getDeclName().getCXXOverloadedOperator();
- else
- return OO_None;
-}
-
SourceRange CXXOperatorCallExpr::getSourceRange() const {
OverloadedOperatorKind Kind = getOperator();
if (Kind == OO_PlusPlus || Kind == OO_MinusMinus) {
OpenPOWER on IntegriCloud