diff options
author | Nico Weber <nicolasweber@gmx.de> | 2016-09-03 03:25:22 +0000 |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2016-09-03 03:25:22 +0000 |
commit | 05e1dadac675c1a28739c6f49e771b3a230ec264 (patch) | |
tree | a35b01fd85efb3052a5399688b137bf4bb11c349 /clang/test/CodeGenCXX/microsoft-uuidof.cpp | |
parent | 05e78450be654c8197d610b14b20f5bb5014f19f (diff) | |
download | bcm5719-llvm-05e1dadac675c1a28739c6f49e771b3a230ec264.tar.gz bcm5719-llvm-05e1dadac675c1a28739c6f49e771b3a230ec264.zip |
[ms] Add support for parsing uuid as a Microsoft attribute.
Some Windows SDK classes, for example
Windows::Storage::Streams::IBufferByteAccess, use the ATL way of spelling
attributes:
[uuid("....")] class IBufferByteAccess {};
To be able to use __uuidof() to grab the uuid off these types, clang needs to
support uuid as a Microsoft attribute. There was already code to skip Microsoft
attributes, extend that to look for uuid and parse it. Use the new "Microsoft"
attribute type added in r280575 (and r280574, r280576) for this.
Final part of https://reviews.llvm.org/D23895
llvm-svn: 280578
Diffstat (limited to 'clang/test/CodeGenCXX/microsoft-uuidof.cpp')
-rw-r--r-- | clang/test/CodeGenCXX/microsoft-uuidof.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/microsoft-uuidof.cpp b/clang/test/CodeGenCXX/microsoft-uuidof.cpp index 62e4b880ad4..9b4ff68d9aa 100644 --- a/clang/test/CodeGenCXX/microsoft-uuidof.cpp +++ b/clang/test/CodeGenCXX/microsoft-uuidof.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -emit-llvm %s -o - -DDEFINE_GUID -triple=i386-pc-linux -fms-extensions | FileCheck %s --check-prefix=CHECK-DEFINE-GUID +// RUN: %clang_cc1 -emit-llvm %s -o - -DDEFINE_GUID -DBRACKET_ATTRIB -triple=i386-pc-linux -fms-extensions | FileCheck %s --check-prefix=CHECK-DEFINE-GUID // RUN: %clang_cc1 -emit-llvm %s -o - -triple=i386-pc-linux -fms-extensions | FileCheck %s // RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-pc-linux -fms-extensions | FileCheck %s --check-prefix=CHECK-64 // RUN: %clang_cc1 -emit-llvm %s -o - -DDEFINE_GUID -DWRONG_GUID -triple=i386-pc-linux -fms-extensions | FileCheck %s --check-prefix=CHECK-DEFINE-WRONG-GUID @@ -17,10 +18,17 @@ struct _GUID { #endif typedef struct _GUID GUID; +#ifdef BRACKET_ATTRIB +[uuid(12345678-1234-1234-1234-1234567890aB)] struct S1 { } s1; +[uuid(87654321-4321-4321-4321-ba0987654321)] struct S2 { }; +[uuid({12345678-1234-1234-1234-1234567890ac})] struct Curly; +[uuid({12345678-1234-1234-1234-1234567890ac})] struct Curly; +#else struct __declspec(uuid("12345678-1234-1234-1234-1234567890aB")) S1 { } s1; struct __declspec(uuid("87654321-4321-4321-4321-ba0987654321")) S2 { }; struct __declspec(uuid("{12345678-1234-1234-1234-1234567890ac}")) Curly; struct __declspec(uuid("{12345678-1234-1234-1234-1234567890ac}")) Curly; +#endif #ifdef DEFINE_GUID // Make sure we can properly generate code when the UUID has curly braces on it. |