diff options
author | Eric Fiselier <eric@efcs.ca> | 2018-12-12 21:50:55 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2018-12-12 21:50:55 +0000 |
commit | 5cdc2cda28ac86ba4ec3771341545355452fdc86 (patch) | |
tree | 6bf91ed91fd399e0dbc0afd1dcf14da1e960962f /clang/lib/AST/Expr.cpp | |
parent | 91dfdd5734e1c0a603e17bae0dd7723d775c485a (diff) | |
download | bcm5719-llvm-5cdc2cda28ac86ba4ec3771341545355452fdc86.tar.gz bcm5719-llvm-5cdc2cda28ac86ba4ec3771341545355452fdc86.zip |
[AST] Store "UsesADL" information in CallExpr.
Summary:
Currently the Clang AST doesn't store information about how the callee of a CallExpr was found. Specifically if it was found using ADL.
However, this information is invaluable to tooling. Consider a tool which renames usages of a function. If the originally CallExpr was formed using ADL, then the tooling may need to additionally qualify the replacement.
Without information about how the callee was found, the tooling is left scratching it's head. Additionally, we want to be able to match ADL calls as quickly as possible, which means avoiding computing the answer on the fly.
This patch changes `CallExpr` to store whether it's callee was found using ADL. It does not change the size of any AST nodes.
Reviewers: fowles, rsmith, klimek, shafik
Reviewed By: rsmith
Subscribers: aaron.ballman, riccibruno, calabrese, titus, cfe-commits
Differential Revision: https://reviews.llvm.org/D55534
llvm-svn: 348977
Diffstat (limited to 'clang/lib/AST/Expr.cpp')
-rw-r--r-- | clang/lib/AST/Expr.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp index 8ff967e26db..751d9137e6b 100644 --- a/clang/lib/AST/Expr.cpp +++ b/clang/lib/AST/Expr.cpp @@ -1223,11 +1223,13 @@ OverloadedOperatorKind UnaryOperator::getOverloadedOperator(Opcode Opc) { CallExpr::CallExpr(const ASTContext &C, StmtClass SC, Expr *fn, ArrayRef<Expr *> preargs, ArrayRef<Expr *> args, QualType t, ExprValueKind VK, SourceLocation rparenloc, - unsigned MinNumArgs) + unsigned MinNumArgs, ADLCallKind UsesADL) : Expr(SC, t, VK, OK_Ordinary, fn->isTypeDependent(), fn->isValueDependent(), fn->isInstantiationDependent(), fn->containsUnexpandedParameterPack()), RParenLoc(rparenloc) { + CallExprBits.UsesADL = static_cast<bool>(UsesADL); + NumArgs = std::max<unsigned>(args.size(), MinNumArgs); unsigned NumPreArgs = preargs.size(); CallExprBits.NumPreArgs = NumPreArgs; @@ -1249,15 +1251,16 @@ CallExpr::CallExpr(const ASTContext &C, StmtClass SC, Expr *fn, CallExpr::CallExpr(const ASTContext &C, StmtClass SC, Expr *fn, ArrayRef<Expr *> args, QualType t, ExprValueKind VK, - SourceLocation rparenloc, unsigned MinNumArgs) + SourceLocation rparenloc, unsigned MinNumArgs, + ADLCallKind UsesADL) : CallExpr(C, SC, fn, ArrayRef<Expr *>(), args, t, VK, rparenloc, - MinNumArgs) {} + MinNumArgs, UsesADL) {} CallExpr::CallExpr(const ASTContext &C, Expr *fn, ArrayRef<Expr *> args, QualType t, ExprValueKind VK, SourceLocation rparenloc, - unsigned MinNumArgs) - : CallExpr(C, CallExprClass, fn, ArrayRef<Expr *>(), args, t, VK, - rparenloc, MinNumArgs) {} + unsigned MinNumArgs, ADLCallKind UsesADL) + : CallExpr(C, CallExprClass, fn, ArrayRef<Expr *>(), args, t, VK, rparenloc, + MinNumArgs, UsesADL) {} CallExpr::CallExpr(const ASTContext &C, StmtClass SC, unsigned NumPreArgs, unsigned NumArgs, EmptyShell Empty) |