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/Sema/SemaExpr.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/Sema/SemaExpr.cpp')
-rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 3ea9c7c8f95..d4180c89da7 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -5585,12 +5585,11 @@ ExprResult Sema::ActOnConvertVectorExpr(Expr *E, ParsedType ParsedDestTy, /// block-pointer type. /// /// \param NDecl the declaration being called, if available -ExprResult -Sema::BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl, - SourceLocation LParenLoc, - ArrayRef<Expr *> Args, - SourceLocation RParenLoc, - Expr *Config, bool IsExecConfig) { +ExprResult Sema::BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl, + SourceLocation LParenLoc, + ArrayRef<Expr *> Args, + SourceLocation RParenLoc, Expr *Config, + bool IsExecConfig, ADLCallKind UsesADL) { FunctionDecl *FDecl = dyn_cast_or_null<FunctionDecl>(NDecl); unsigned BuiltinID = (FDecl ? FDecl->getBuiltinID() : 0); @@ -5670,13 +5669,16 @@ Sema::BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl, unsigned NumParams = Proto ? Proto->getNumParams() : 0; CallExpr *TheCall; - if (Config) + if (Config) { + assert(UsesADL == ADLCallKind::NotADL && + "CUDAKernelCallExpr should not use ADL"); TheCall = new (Context) CUDAKernelCallExpr(Context, Fn, cast<CallExpr>(Config), Args, ResultTy, VK_RValue, RParenLoc, NumParams); - else - TheCall = new (Context) - CallExpr(Context, Fn, Args, ResultTy, VK_RValue, RParenLoc, NumParams); + } else { + TheCall = new (Context) CallExpr(Context, Fn, Args, ResultTy, VK_RValue, + RParenLoc, NumParams, UsesADL); + } if (!getLangOpts().CPlusPlus) { // C cannot always handle TypoExpr nodes in builtin calls and direct |