[Expression Parser] Inhibit global lookups for symbols in the IR dynamic checks
authorSean Callanan <scallanan@apple.com>
Tue, 26 Sep 2017 17:25:34 +0000 (17:25 +0000)
committerSean Callanan <scallanan@apple.com>
Tue, 26 Sep 2017 17:25:34 +0000 (17:25 +0000)
commit1b3c43b6dd5b67fe46220e1905b6647197b41c93
tree8fd0bc5b59a497ef7e24149d086127ce07c30cc6
parentb59abb2590898d1325f1b67b6ea2f75a1bfbd78c
[Expression Parser] Inhibit global lookups for symbols in the IR dynamic checks

The IR dynamic checks are self-contained functions whose job is to

- verify that pointers referenced in an expression are valid at runtime; and
- verify that selectors sent to Objective-C objects by an expression are
  actually supported by that object.

These dynamic checks forward-declare all the functions they use and should not
require any external debug information. The way they ensure this is by marking
all the names they use with a dollar sign ($). The expression parser recognizes
such symbols and perform no lookups for them.

This patch fixes three issues surrounding the use of the dollar sign:

- to fix a MIPS issue, the name of the pointer checker was changed from
  starting with $ to starting with _$, but this was not properly ignored; and
- the Objective-C object checker used a temporary variable that did not start
  with $.
- the Objective-C object checker used an externally-defined struct (struct
  objc_selector) but didn't need to.

The patch also implements some cleanup in the area:

- it reformats the string containing the Objective-C object checker,
  which was mangled horribly when the code was transformed to a uniform width
  of 80 columns, and
- it factors out the logic for ignoring global $-symbols into common code
  shared between ClangASTSource and ClangExpressionDeclMap.

Differential Revision: https://reviews.llvm.org/D38153

llvm-svn: 314225
lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.h
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp