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/test/AST/ast-dump-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/test/AST/ast-dump-expr.cpp')
-rw-r--r-- | clang/test/AST/ast-dump-expr.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/clang/test/AST/ast-dump-expr.cpp b/clang/test/AST/ast-dump-expr.cpp index e847fc61647..5d668aad4ae 100644 --- a/clang/test/AST/ast-dump-expr.cpp +++ b/clang/test/AST/ast-dump-expr.cpp @@ -508,3 +508,46 @@ void PrimaryExpressions(Ts... a) { // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:4> 'Ts...' lvalue ParmVar 0x{{[^ ]*}} 'a' 'Ts...' // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:14> 'int' lvalue Var 0x{{[^ ]*}} 'b' 'int' } + + +namespace NS { +struct X {}; +void f(X); +void y(...); +} // namespace NS + +// CHECK-LABEL: FunctionDecl 0x{{[^ ]*}} {{.*}}ADLCall 'void ()' +void ADLCall() { + NS::X x; + // CHECK: CallExpr 0x{{[^ ]*}} <line:[[@LINE+1]]:{{[^>]+}}> 'void' adl{{$}} + f(x); + // CHECK: CallExpr 0x{{[^ ]*}} <line:[[@LINE+1]]:{{[^>]+}}> 'void' adl{{$}} + y(x); +} + +// CHECK-LABEL: FunctionDecl 0x{{[^ ]*}} {{.*}}NonADLCall 'void ()' +void NonADLCall() { + NS::X x; + // CHECK: CallExpr 0x{{[^ ]*}} <line:[[@LINE+1]]:{{[^>]+}}> 'void'{{$}} + NS::f(x); +} + +// CHECK-LABEL: FunctionDecl 0x{{[^ ]*}} {{.*}}NonADLCall2 'void ()' +void NonADLCall2() { + NS::X x; + using NS::f; + // CHECK: CallExpr 0x{{[^ ]*}} <line:[[@LINE+1]]:{{[^>]+}}> 'void'{{$}} + f(x); + // CHECK: CallExpr 0x{{[^ ]*}} <line:[[@LINE+1]]:{{[^>]+}}> 'void' adl{{$}} + y(x); +} + +namespace test_adl_call_three { +using namespace NS; +// CHECK-LABEL: FunctionDecl 0x{{[^ ]*}} {{.*}}NonADLCall3 'void ()' +void NonADLCall3() { + X x; + // CHECK: CallExpr 0x{{[^ ]*}} <line:[[@LINE+1]]:{{[^>]+}}> 'void'{{$}} + f(x); +} +} // namespace test_adl_call_three
\ No newline at end of file |