[PATCH] D60616: Make parseBitcodeFile use a named StructType, if it exists and matches.

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 12 08:32:06 PDT 2019


lebedev.ri added inline comments.


================
Comment at: llvm/lib/Bitcode/Reader/BitcodeReader.cpp:1548
+findMatchingStructType(LLVMContext & Context,
+                       const StringRef & Name,
+                       const SmallVector<Type*, 8> & EltTys) {
----------------
Pass by non-const value


================
Comment at: llvm/lib/Bitcode/Reader/BitcodeReader.cpp:1549
+                       const StringRef & Name,
+                       const SmallVector<Type*, 8> & EltTys) {
+  StructType * Candidate = StructType::getIfExists(Context, Name);
----------------
ArrayRef


================
Comment at: llvm/lib/Bitcode/Reader/BitcodeReader.cpp:1550
+                       const SmallVector<Type*, 8> & EltTys) {
+  StructType * Candidate = StructType::getIfExists(Context, Name);
+  if (!Candidate)
----------------
I'm not sure this is clang-formatted


================
Comment at: llvm/lib/Bitcode/Reader/BitcodeReader.cpp:1555-1558
+  int i = EltTys.size();
+  while (i-- > 0)
+    if (Candidate->getElementType(i) != EltTys[i])
+      return nullptr;
----------------
```
if(!EltTys.equals(Candidate->elements()))
  return nullptr;
```


================
Comment at: llvm/lib/IR/Type.cpp:342
+  if(I == Context.pImpl->NamedStructTypes.end())
+    return 0;
+  return I->getValue();
----------------
nullptr


================
Comment at: llvm/lib/IR/Type.cpp:348
 
+
 StructType *StructType::get(LLVMContext &Context, ArrayRef<Type*> ETypes,
----------------
sporadic newline


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60616/new/

https://reviews.llvm.org/D60616





More information about the llvm-commits mailing list