summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenFunction.cpp
diff options
context:
space:
mode:
authorSiva Chandra <sivachandra@google.com>2016-02-04 18:38:35 +0000
committerSiva Chandra <sivachandra@google.com>2016-02-04 18:38:35 +0000
commit375882dddb92b4cf9fac72b3388b9c4af35d8ba6 (patch)
treeef1bee8ec19899ee4edb351549bffc40a1f62135 /clang/lib/CodeGen/CodeGenFunction.cpp
parent76c48e0e704ef72f37766ef12b3fa1a924c33ad8 (diff)
downloadbcm5719-llvm-375882dddb92b4cf9fac72b3388b9c4af35d8ba6.tar.gz
bcm5719-llvm-375882dddb92b4cf9fac72b3388b9c4af35d8ba6.zip
Use an artifical namespace so that member vars do not hide local vars.
Summary: While evaluating expressions when stopped in a class method, there was a problem of member variables hiding local variables. This was happening because, in the context of a method, clang already knew about member variables with their name and assumed that they were the only variables with those names in scope. Consequently, clang never checks with LLDB about the possibility of local variables with the same name and goes wrong. This change addresses the problem by using an artificial namespace "$__lldb_local_vars". All local variables in scope are declared in the "$__lldb_expr" method as follows: using $__lldb_local_vars::<local var 1>; using $__lldb_local_vars::<local var 2>; ... This hides the member variables with the same name and forces clang to enquire about the variables which it thinks are declared in $__lldb_local_vars. When LLDB notices that clang is enquiring about variables in $__lldb_local_vars, it looks up local vars and conveys their information if found. This way, member variables do not hide local variables, leading to correct evaluation of expressions. A point to keep in mind is that the above solution does not solve the problem for one specific case: namespace N { int a; } class A { public: void Method(); int a; }; void A::Method() { using N::a; ... // Since the above solution only touches locals, it does not // force clang to enquire about "a" coming from namespace N. } Reviewers: clayborg, spyffe Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D16746 llvm-svn: 259810
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud