summaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGExpr.cpp
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2013-08-15 19:59:14 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2013-08-15 19:59:14 +0000
commit8effeda3d2cfd92abaebc5ac46fc3693c69f66f3 (patch)
treee5537290686007001dce27c527591bba170ab1f2 /lib/CodeGen/CGExpr.cpp
parente1f1ff66bf4e9507bb534244a5a5d0c950316a2f (diff)
downloadclang-8effeda3d2cfd92abaebc5ac46fc3693c69f66f3.tar.gz
clang-8effeda3d2cfd92abaebc5ac46fc3693c69f66f3.tar.bz2
clang-8effeda3d2cfd92abaebc5ac46fc3693c69f66f3.tar.xz
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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188481 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExpr.cpp')
-rw-r--r--lib/CodeGen/CGExpr.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp
index 0e87d8311c..0e2085d80f 100644
--- a/lib/CodeGen/CGExpr.cpp
+++ b/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) {