From 489bc0506022c4c3b4e0b922a0440a8ed1c8fa09 Mon Sep 17 00:00:00 2001
From: Simon Schuster <git@rationality.eu>
Date: Fri, 12 May 2017 19:15:31 +0200
Subject: [PATCH] Adapt Platinaguard to the new metadata layout

The platina intrinsic now takes two metadata items, "platina.type" and
"platina.expr". This commit changes the handling to provide both.
---
 lib/CodeGen/CGStmt.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/CodeGen/CGStmt.cpp b/lib/CodeGen/CGStmt.cpp
index f6f9827399..e8fdc8bcce 100644
--- a/lib/CodeGen/CGStmt.cpp
+++ b/lib/CodeGen/CGStmt.cpp
@@ -504,8 +504,10 @@ void CodeGenFunction::EmitPlatinaIntrinsic(const ArrayRef<const Attr*> &Attrs) {
     // Attach the guardexpr to the instruction-metadata
     // We have to store our string in the LLVMContext
     LLVMContext& C = callsite->getContext();
-    MDNode *meta = MDNode::get(C, MDString::get(C, PG->getGuardExpr()));
-    callsite->setMetadata("platina.guardexpr", meta);
+    MDNode *type = MDNode::get(C, MDString::get(C, "guard"));
+    callsite->setMetadata("platina.type", type);
+    MDNode *expr = MDNode::get(C, MDString::get(C, PG->getGuardExpr()));
+    callsite->setMetadata("platina.expr", expr);
   }
 }
 
-- 
GitLab