| 3071 | } |
| 3072 | |
| 3073 | Error BitcodeReader::parseGlobalIndirectSymbolRecord( |
| 3074 | unsigned BitCode, ArrayRef<uint64_t> Record) { |
| 3075 | // v1 ALIAS_OLD: [alias type, aliasee val#, linkage] (name in VST) |
| 3076 | // v1 ALIAS: [alias type, addrspace, aliasee val#, linkage, visibility, |
| 3077 | // dllstorageclass, threadlocal, unnamed_addr, |
| 3078 | // preemption specifier] (name in VST) |
| 3079 | // v1 IFUNC: [alias type, addrspace, aliasee val#, linkage, |
| 3080 | // visibility, dllstorageclass, threadlocal, unnamed_addr, |
| 3081 | // preemption specifier] (name in VST) |
| 3082 | // v2: [strtab_offset, strtab_size, v1] |
| 3083 | StringRef Name; |
| 3084 | std::tie(Name, Record) = readNameFromStrtab(Record); |
| 3085 | |
| 3086 | bool NewRecord = BitCode != bitc::MODULE_CODE_ALIAS_OLD; |
| 3087 | if (Record.size() < (3 + (unsigned)NewRecord)) |
| 3088 | return error("Invalid record"); |
| 3089 | unsigned OpNum = 0; |
| 3090 | Type *Ty = getTypeByID(Record[OpNum++]); |
| 3091 | if (!Ty) |
| 3092 | return error("Invalid record"); |
| 3093 | |
| 3094 | unsigned AddrSpace; |
| 3095 | if (!NewRecord) { |
| 3096 | auto *PTy = dyn_cast<PointerType>(Ty); |
| 3097 | if (!PTy) |
| 3098 | return error("Invalid type for value"); |
| 3099 | Ty = PTy->getElementType(); |
| 3100 | AddrSpace = PTy->getAddressSpace(); |
| 3101 | } else { |
| 3102 | AddrSpace = Record[OpNum++]; |
| 3103 | } |
| 3104 | |
| 3105 | auto Val = Record[OpNum++]; |
| 3106 | auto Linkage = Record[OpNum++]; |
| 3107 | GlobalIndirectSymbol *NewGA; |
| 3108 | if (BitCode == bitc::MODULE_CODE_ALIAS || |
| 3109 | BitCode == bitc::MODULE_CODE_ALIAS_OLD) |
| 3110 | NewGA = GlobalAlias::create(Ty, AddrSpace, getDecodedLinkage(Linkage), Name, |
| 3111 | TheModule); |
| 3112 | else |
| 3113 | NewGA = GlobalIFunc::create(Ty, AddrSpace, getDecodedLinkage(Linkage), Name, |
| 3114 | nullptr, TheModule); |
| 3115 | // Old bitcode files didn't have visibility field. |
| 3116 | // Local linkage must have default visibility. |
| 3117 | if (OpNum != Record.size()) { |
| 3118 | auto VisInd = OpNum++; |
| 3119 | if (!NewGA->hasLocalLinkage()) |
| 3120 | // FIXME: Change to an error if non-default in 4.0. |
| 3121 | NewGA->setVisibility(getDecodedVisibility(Record[VisInd])); |
| 3122 | } |
| 3123 | if (BitCode == bitc::MODULE_CODE_ALIAS || |
| 3124 | BitCode == bitc::MODULE_CODE_ALIAS_OLD) { |
| 3125 | if (OpNum != Record.size()) |
| 3126 | NewGA->setDLLStorageClass(getDecodedDLLStorageClass(Record[OpNum++])); |
| 3127 | else |
| 3128 | upgradeDLLImportExportLinkage(NewGA, Linkage); |
| 3129 | if (OpNum != Record.size()) |
| 3130 | NewGA->setThreadLocalMode(getDecodedThreadLocalMode(Record[OpNum++])); |
nothing calls this directly
no test coverage detected