xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGen/pr19841.cpp (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -emit-llvm %s -o -  | FileCheck %s
2*0a6a1f1dSLionel Sambuc 
3*0a6a1f1dSLionel Sambuc namespace Common {
4*0a6a1f1dSLionel Sambuc enum RenderMode {
5*0a6a1f1dSLionel Sambuc   kRenderEGA,
6*0a6a1f1dSLionel Sambuc   kRenderCGA
7*0a6a1f1dSLionel Sambuc };
8*0a6a1f1dSLionel Sambuc class C;
9*0a6a1f1dSLionel Sambuc class A {
10*0a6a1f1dSLionel Sambuc   A();
11*0a6a1f1dSLionel Sambuc   C *_vm;
12*0a6a1f1dSLionel Sambuc   unsigned char _highlightColorTableVGA[];
13*0a6a1f1dSLionel Sambuc   static const unsigned char b[];
14*0a6a1f1dSLionel Sambuc };
15*0a6a1f1dSLionel Sambuc // CHECK: [[Common_A_b:@[^ ]+]] = constant [1 x i8] zeroinitializer
16*0a6a1f1dSLionel Sambuc class B {
17*0a6a1f1dSLionel Sambuc public:
18*0a6a1f1dSLionel Sambuc   Common::RenderMode _configRenderMode;
19*0a6a1f1dSLionel Sambuc };
20*0a6a1f1dSLionel Sambuc class C : public B {};
A()21*0a6a1f1dSLionel Sambuc A::A() {
22*0a6a1f1dSLionel Sambuc   0 == Common::kRenderCGA || _vm->_configRenderMode == Common::kRenderEGA
23*0a6a1f1dSLionel Sambuc       ? b
24*0a6a1f1dSLionel Sambuc       : _highlightColorTableVGA;
25*0a6a1f1dSLionel Sambuc // Make sure the PHI value is casted correctly to the PHI type
26*0a6a1f1dSLionel Sambuc // CHECK: %{{.*}} = phi [0 x i8]* [ bitcast ([1 x i8]* [[Common_A_b]] to [0 x i8]*), %{{.*}} ], [ %{{.*}}, %{{.*}} ]
27*0a6a1f1dSLionel Sambuc }
28*0a6a1f1dSLionel Sambuc const unsigned char A::b[] = { 0 };
29*0a6a1f1dSLionel Sambuc }
30