aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2015-09-08 23:01:30 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2015-09-08 23:01:30 +0000
commit25a80bf9b6a4c01eb50dacac5007262c09eca6e0 (patch)
treebd8d6a2104901fcf6b7f1e510594e93eeccb66e6 /clang/lib/CodeGen/CodeGenModule.cpp
parente438e078563fac5ae62b63d6698303d24d3c5813 (diff)
downloadllvm-25a80bf9b6a4c01eb50dacac5007262c09eca6e0.zip
llvm-25a80bf9b6a4c01eb50dacac5007262c09eca6e0.tar.gz
llvm-25a80bf9b6a4c01eb50dacac5007262c09eca6e0.tar.bz2
CodeGen: Introduce CodeGenModule::CreateMetadataIdentifierForType.
This function can be used to create a metadata identifier for a specific type. No functionality change, but this will be used by D11857 and D12026. Differential Revision: http://reviews.llvm.org/D12038 llvm-svn: 247098
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index e76ee12..a2d554b 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -3803,6 +3803,25 @@ void CodeGenModule::EmitOMPThreadPrivateDecl(const OMPThreadPrivateDecl *D) {
}
}
+llvm::Metadata *CodeGenModule::CreateMetadataIdentifierForType(QualType T) {
+ llvm::Metadata *&InternalId = MetadataIdMap[T.getCanonicalType()];
+ if (InternalId)
+ return InternalId;
+
+ if (isExternallyVisible(T->getLinkage())) {
+ std::string OutName;
+ llvm::raw_string_ostream Out(OutName);
+ getCXXABI().getMangleContext().mangleTypeName(T, Out);
+
+ InternalId = llvm::MDString::get(getLLVMContext(), Out.str());
+ } else {
+ InternalId = llvm::MDNode::getDistinct(getLLVMContext(),
+ llvm::ArrayRef<llvm::Metadata *>());
+ }
+
+ return InternalId;
+}
+
llvm::MDTuple *CodeGenModule::CreateVTableBitSetEntry(
llvm::GlobalVariable *VTable, CharUnits Offset, const CXXRecordDecl *RD) {
std::string OutName;