brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · cf1f2c6 Raw
55 lines · plain
1# REQUIRES: system-darwin2 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 as8# 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 what10# the debug-info says). When the `ASTImporter` imports these decls into the11# scratch AST, it will fail to re-use one or the other decl because they12# 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 AST14# and the expression fails to run due to ambiguity in name lookup.15 16# RUN: split-file %s %t17# RUN: %clang_host -g %t/main.m -fmodules -fcxx-modules -o %t.out18# RUN: %lldb -x -b -s %t/commands.input %t.out -o exit 2>&1 \19# RUN:       | FileCheck %s20 21#--- main.m22 23#import "module.h"24 25int main() {26    MyInt i;27    return i;28}29 30#--- module.h31 32#if (__cplusplus)33typedef int MyInt;34enum : MyInt { CASE };35#else36typedef enum MyInt : int MyInt;37enum MyInt : int { CASE };38#endif39 40#--- module.modulemap41module Int {42    header "module.h"43}44 45#--- commands.input46 47break set -n main48run49expression -l objective-c -- (MyInt)550 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' 55