diff options
author | David Majnemer <david.majnemer@gmail.com> | 2013-08-15 19:59:14 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2013-08-15 19:59:14 +0000 |
commit | bbecd09658b7a19626f5a86a64428ca0b851c91f (patch) | |
tree | 0e27b19a57e48c5fdad6a942df9dc259814af0c7 /clang/lib/CodeGen/CGExpr.cpp | |
parent | 313ae7009ea1575f385d830229db1c226da6ad52 (diff) | |
download | bcm5719-llvm-bbecd09658b7a19626f5a86a64428ca0b851c91f.tar.gz bcm5719-llvm-bbecd09658b7a19626f5a86a64428ca0b851c91f.zip |
CodeGen: __uuidof should work even with an incomplete _GUID type
Summary:
We would crash in CodeGen::CodeGenModule::EmitUuidofInitializer
because our attempt to enter CodeGen::CodeGenModule::EmitConstantValue
will be foiled: the type of the constant value is incomplete.
Instead, create an unnamed type with the proper layout on all platforms.
Punt the problem of wrongly defined struct _GUID types to the user.
(It's impossible because the TU may never get to see the type and thus
we can't verify that it is suitable.)
This fixes PR16856.
Reviewers: rsmith, rnk, thakis
Reviewed By: rnk
CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D1375
llvm-svn: 188481
Diffstat (limited to 'clang/lib/CodeGen/CGExpr.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGExpr.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp index 0e87d8311c1..0e2085d80f4 100644 --- a/clang/lib/CodeGen/CGExpr.cpp +++ b/clang/lib/CodeGen/CGExpr.cpp @@ -2995,7 +2995,8 @@ CodeGenFunction::EmitCXXTypeidLValue(const CXXTypeidExpr *E) { } llvm::Value *CodeGenFunction::EmitCXXUuidofExpr(const CXXUuidofExpr *E) { - return CGM.GetAddrOfUuidDescriptor(E); + return Builder.CreateBitCast(CGM.GetAddrOfUuidDescriptor(E), + ConvertType(E->getType())->getPointerTo()); } LValue CodeGenFunction::EmitCXXUuidofLValue(const CXXUuidofExpr *E) { |