161329d6c371365ad07fc8b5fb72fbaea453d05bfEric Christopher// RUN: %clang_cc1 %s -emit-llvm -triple x86_64-apple-darwin -o - | FileCheck %s
261329d6c371365ad07fc8b5fb72fbaea453d05bfEric Christopher
361329d6c371365ad07fc8b5fb72fbaea453d05bfEric Christopher// Make sure pointers are passed as pointers, not converted to int.
461329d6c371365ad07fc8b5fb72fbaea453d05bfEric Christopher// The first load should be of type i8** in either 32 or 64 bit mode.
561329d6c371365ad07fc8b5fb72fbaea453d05bfEric Christopher// This formerly happened on x86-64, 7375899.
661329d6c371365ad07fc8b5fb72fbaea453d05bfEric Christopher
761329d6c371365ad07fc8b5fb72fbaea453d05bfEric Christopherclass StringRef {
861329d6c371365ad07fc8b5fb72fbaea453d05bfEric Christopherpublic:
961329d6c371365ad07fc8b5fb72fbaea453d05bfEric Christopher  const char *Data;
1061329d6c371365ad07fc8b5fb72fbaea453d05bfEric Christopher  long Len;
1161329d6c371365ad07fc8b5fb72fbaea453d05bfEric Christopher};
1261329d6c371365ad07fc8b5fb72fbaea453d05bfEric Christophervoid foo(StringRef X);
1361329d6c371365ad07fc8b5fb72fbaea453d05bfEric Christophervoid bar(StringRef &A) {
1461329d6c371365ad07fc8b5fb72fbaea453d05bfEric Christopher// CHECK: @_Z3barR9StringRef
1561329d6c371365ad07fc8b5fb72fbaea453d05bfEric Christopher// CHECK: load i8**
1661329d6c371365ad07fc8b5fb72fbaea453d05bfEric Christopher  foo(A);
1761329d6c371365ad07fc8b5fb72fbaea453d05bfEric Christopher// CHECK: ret void
1861329d6c371365ad07fc8b5fb72fbaea453d05bfEric Christopher}
19