File tree Expand file tree Collapse file tree 1 file changed +54
-0
lines changed Expand file tree Collapse file tree 1 file changed +54
-0
lines changed Original file line number Diff line number Diff line change
1
+ # REQUIRES: system-darwin
2
+
3
+ # Tests whether the expression evaluator can handle the `NS_ENUM`/`NS_OPTIONS`
4
+ # typedefs from Objective-C `CoreFoundation`.
5
+ # Here `module.h` mimicks the `NS_OPTIONS` typedef from `CoreFoundation`.
6
+ #
7
+ # The `ClangModulesDeclVendor` currently compiles modules as
8
+ # C++, so the `MyInt` Clang decl in the module will be a `TypedefType`,
9
+ # while the DWARF AST parser will produce an `EnumType` (since that's what
10
+ # the debug-info says). When the `ASTImporter` imports these decls into the
11
+ # scratch AST, it will fail to re-use one or the other decl because they
12
+ # aren't structurally equivalent (one is a typedef, the other an enum),
13
+ # so we end up with two conflicting `MyInt` declarations in the scratch AST
14
+ # and the expression fails to run due to ambiguity in name lookup.
15
+
16
+ # RUN: split-file %s %t
17
+ # RUN: %clang_host -g %t/main.m -fmodules -fcxx-modules -o %t.out
18
+ # RUN: %lldb -x -b -s %t/commands.input %t.out -o exit 2>&1 \
19
+ # RUN: | FileCheck %s
20
+
21
+ #--- main.m
22
+
23
+ #import "module.h"
24
+
25
+ int main() {
26
+ MyInt i;
27
+ return i;
28
+ }
29
+
30
+ #--- module.h
31
+
32
+ #if (__cplusplus)
33
+ typedef int MyInt;
34
+ enum : MyInt { CASE };
35
+ #else
36
+ typedef enum MyInt : int MyInt;
37
+ enum MyInt : int { CASE };
38
+ #endif
39
+
40
+ #--- module.modulemap
41
+ module Int {
42
+ header "module.h"
43
+ }
44
+
45
+ #--- commands.input
46
+
47
+ break set -n main
48
+ run
49
+ expression -l objective-c -- (MyInt)5
50
+
51
+ # CHECK: error: reference to 'MyInt' is ambiguous
52
+ # CHECK: error: reference to 'MyInt' is ambiguous
53
+ # CHECK: note: note: candidate found by name lookup is 'MyInt'
54
+ # CHECK: note: note: candidate found by name lookup is 'MyInt'
You can’t perform that action at this time.
0 commit comments