brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.7 KiB · 30109c2 Raw
71 lines · plain
1# REQUIRES: system-darwin2 3# In this test we have two CUs with conflicting forward declaration4# depending on the CU language (one is C++ and the other is Objective-C++).5# We are then stopped in the C++ CU and try to print the type, at which6# point LLDB will try to make it into an Clang AST node. If LLDB were to7# interpret the type as C++ instead of Objective-C, we'd violate Clang8# invariants and crash.9#10# RUN: split-file %s %t11# RUN: %clangxx_host -c -g -x objective-c++ %t/request.m -o %t/request_objc.o12# RUN: %clangxx_host -c -g %t/main.cpp -o %t/main.o13# RUN: %clangxx_host %t/main.o %t/request_objc.o -framework Foundation -o %t/a.out14#15# RUN: %lldb %t/a.out \16# RUN:    -o "breakpoint set -p return -X main" \17# RUN:    -o run \18# RUN:    -o "frame variable r" \19# RUN:    -o exit | FileCheck %s20#21# RUN: dsymutil %t/a.out22#23# RUN: %lldb %t/a.out \24# RUN:    -o "breakpoint set -p return -X main" \25# RUN:    -o run \26# RUN:    -o "frame variable r" \27# RUN:    -o exit | FileCheck %s --check-prefix=CHECK-DSYM28 29# CHECK:      (lldb) frame variable r30# CHECK-NEXT: (Request) ::r = (m_request = "Hello, World!")31 32# CHECK-DSYM:      (lldb) frame variable r33# CHECK-DSYM-NEXT: (Request) ::r = (m_request = "Hello, World!")34 35#--- lib.h36#ifndef LIB_H_IN37#define LIB_H_IN38 39#ifdef __OBJC__40@class NSString;                                               41#else42class NSString;43#endif44 45struct Request {46  NSString * m_request = nullptr;47};48 49#endif // _H_IN50 51#--- main.cpp52#include "lib.h"53 54void process(Request *);55 56Request r;57 58int main() {59    process(&r);60    return 0;61}62 63#--- request.m64#import <Foundation/Foundation.h>65 66#include "lib.h"67 68void process(Request * r) {69  r->m_request = @"Hello, World!";70}71