diff options
| author | Rafael Espindola <rafael.espindola@gmail.com> | 2014-12-01 19:17:46 +0000 |
|---|---|---|
| committer | Rafael Espindola <rafael.espindola@gmail.com> | 2014-12-01 19:17:46 +0000 |
| commit | 973b3612e49cb527ed89d7d06f630c40264c2ea0 (patch) | |
| tree | e13203d1b80926335b1e79761e0518f9b1a60449 /llvm/lib/Linker | |
| parent | 4d4c938770babc28c64e216a0494c229529731e1 (diff) | |
| download | bcm5719-llvm-973b3612e49cb527ed89d7d06f630c40264c2ea0.tar.gz bcm5719-llvm-973b3612e49cb527ed89d7d06f630c40264c2ea0.zip | |
Use a continue to reduce indentation and clang-format. NFC.
llvm-svn: 223067
Diffstat (limited to 'llvm/lib/Linker')
| -rw-r--r-- | llvm/lib/Linker/LinkModules.cpp | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/llvm/lib/Linker/LinkModules.cpp b/llvm/lib/Linker/LinkModules.cpp index 412ccd88b2a..6c025d685f3 100644 --- a/llvm/lib/Linker/LinkModules.cpp +++ b/llvm/lib/Linker/LinkModules.cpp @@ -802,30 +802,33 @@ void ModuleLinker::computeTypeMapping() { size_t DotPos = ST->getName().rfind('.'); if (DotPos == 0 || DotPos == StringRef::npos || ST->getName().back() == '.' || - !isdigit(static_cast<unsigned char>(ST->getName()[DotPos+1]))) + !isdigit(static_cast<unsigned char>(ST->getName()[DotPos + 1]))) continue; // Check to see if the destination module has a struct with the prefix name. - if (StructType *DST = DstM->getTypeByName(ST->getName().substr(0, DotPos))) - // Don't use it if this actually came from the source module. They're in - // the same LLVMContext after all. Also don't use it unless the type is - // actually used in the destination module. This can happen in situations - // like this: - // - // Module A Module B - // -------- -------- - // %Z = type { %A } %B = type { %C.1 } - // %A = type { %B.1, [7 x i8] } %C.1 = type { i8* } - // %B.1 = type { %C } %A.2 = type { %B.3, [5 x i8] } - // %C = type { i8* } %B.3 = type { %C.1 } - // - // When we link Module B with Module A, the '%B' in Module B is - // used. However, that would then use '%C.1'. But when we process '%C.1', - // we prefer to take the '%C' version. So we are then left with both - // '%C.1' and '%C' being used for the same types. This leads to some - // variables using one type and some using the other. - if (TypeMap.DstStructTypesSet.count(DST)) - TypeMap.addTypeMapping(DST, ST); + StructType *DST = DstM->getTypeByName(ST->getName().substr(0, DotPos)); + if (!DST) + continue; + + // Don't use it if this actually came from the source module. They're in + // the same LLVMContext after all. Also don't use it unless the type is + // actually used in the destination module. This can happen in situations + // like this: + // + // Module A Module B + // -------- -------- + // %Z = type { %A } %B = type { %C.1 } + // %A = type { %B.1, [7 x i8] } %C.1 = type { i8* } + // %B.1 = type { %C } %A.2 = type { %B.3, [5 x i8] } + // %C = type { i8* } %B.3 = type { %C.1 } + // + // When we link Module B with Module A, the '%B' in Module B is + // used. However, that would then use '%C.1'. But when we process '%C.1', + // we prefer to take the '%C' version. So we are then left with both + // '%C.1' and '%C' being used for the same types. This leads to some + // variables using one type and some using the other. + if (TypeMap.DstStructTypesSet.count(DST)) + TypeMap.addTypeMapping(DST, ST); } // Now that we have discovered all of the type equivalences, get a body for |

