llvm-project/clang/test/CodeGenCXX/ms-property.cpp
Alexey Bataev 6910347f62 [MSVC] Fix for http://llvm.org/PR24132: __declspec(property): double invocations of foo() when compiling foo()->propertyName
Removes extra codegen for base expression of MS property call
Differential Revision: http://reviews.llvm.org/D13375

llvm-svn: 250265
2015-10-14 04:05:42 +00:00

20 lines
548 B
C++

// RUN: %clang_cc1 -emit-llvm -triple=x86_64-pc-win32 -fms-compatibility %s -o - | FileCheck %s
class Test1 {
private:
int x_;
public:
Test1(int x) : x_(x) {}
__declspec(property(get = get_x)) int X;
int get_x() const { return x_; }
static Test1 *GetTest1() { return new Test1(10); }
};
// CHECK-LABEL: main
int main(int argc, char **argv) {
// CHECK: [[CALL:%.+]] = call %class.Test1* @"\01?GetTest1@Test1@@SAPEAV1@XZ"()
// CHECK-NEXT: call i32 @"\01?get_x@Test1@@QEBAHXZ"(%class.Test1* [[CALL]])
return Test1::GetTest1()->X;
}