Struct-path aware TBAA: change the format of TBAAStructType node.
We switch the order of offset and field type to make TBAAStructType node
(name, parent node, offset) similar to scalar TBAA node (name, parent node).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180653 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CodeGenTBAA.cpp b/lib/CodeGen/CodeGenTBAA.cpp
index 95b9714..54e0de6 100644
--- a/lib/CodeGen/CodeGenTBAA.cpp
+++ b/lib/CodeGen/CodeGenTBAA.cpp
@@ -57,7 +57,7 @@
llvm::MDNode *CodeGenTBAA::createTBAAScalarType(StringRef Name,
llvm::MDNode *Parent) {
if (CodeGenOpts.StructPathTBAA)
- return MDHelper.createTBAAScalarTypeNode(Name, 0, Parent);
+ return MDHelper.createTBAAScalarTypeNode(Name, Parent);
else
return MDHelper.createTBAANode(Name, Parent);
}
@@ -275,7 +275,7 @@
const RecordDecl *RD = TTy->getDecl()->getDefinition();
const ASTRecordLayout &Layout = Context.getASTRecordLayout(RD);
- SmallVector <std::pair<uint64_t, llvm::MDNode*>, 4> Fields;
+ SmallVector <std::pair<llvm::MDNode*, uint64_t>, 4> Fields;
unsigned idx = 0;
const FieldDecl *LastFD = 0;
bool IsMsStruct = RD->isMsStruct(Context);
@@ -299,7 +299,7 @@
if (!FieldNode)
return StructTypeMetadataCache[Ty] = NULL;
Fields.push_back(std::make_pair(
- Layout.getFieldOffset(idx) / Context.getCharWidth(), FieldNode));
+ FieldNode, Layout.getFieldOffset(idx) / Context.getCharWidth()));
}
// TODO: This is using the RTTI name. Is there a better way to get