[-cxx-abi microsoft] Mangle __uuidof correctly into template parameters
Summary: It seems that __uuidof introduces a global extern "C" declaration of type __s_GUID. However, our implementation of __uuidof does not provide such a declaration and thus must open-code the mangling for __uuidof in template parameters. This allows us to codegen scoped COM pointers and other such things. This fixes PR16836. Depends on D1356. Reviewers: rnk, cdavis5x, rsmith Reviewed By: rnk CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1357 llvm-svn: 188252
This commit is contained in:
@@ -1046,17 +1046,7 @@ llvm::Constant *CodeGenModule::GetAddrOfUuidDescriptor(
|
||||
const CXXUuidofExpr* E) {
|
||||
// Sema has verified that IIDSource has a __declspec(uuid()), and that its
|
||||
// well-formed.
|
||||
StringRef Uuid;
|
||||
if (E->isTypeOperand())
|
||||
Uuid = CXXUuidofExpr::GetUuidAttrOfType(E->getTypeOperand())->getGuid();
|
||||
else {
|
||||
// Special case: __uuidof(0) means an all-zero GUID.
|
||||
Expr *Op = E->getExprOperand();
|
||||
if (!Op->isNullPointerConstant(Context, Expr::NPC_ValueDependentIsNull))
|
||||
Uuid = CXXUuidofExpr::GetUuidAttrOfType(Op->getType())->getGuid();
|
||||
else
|
||||
Uuid = "00000000-0000-0000-0000-000000000000";
|
||||
}
|
||||
StringRef Uuid = E->getUuidAsStringRef(Context);
|
||||
std::string Name = "_GUID_" + Uuid.lower();
|
||||
std::replace(Name.begin(), Name.end(), '-', '_');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user