| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // Copyright (c) 2021-2025 ChilliBits. All rights reserved. | ||
| 2 | |||
| 3 | #include "DebugInfoGenerator.h" | ||
| 4 | |||
| 5 | #include <llvm/BinaryFormat/Dwarf.h> | ||
| 6 | #include <llvm/IR/Module.h> | ||
| 7 | |||
| 8 | #include <ast/ASTNodes.h> | ||
| 9 | #include <driver/Driver.h> | ||
| 10 | #include <irgenerator/IRGenerator.h> | ||
| 11 | #include <irgenerator/NameMangling.h> | ||
| 12 | #include <model/Function.h> | ||
| 13 | #include <model/Struct.h> | ||
| 14 | #include <util/CustomHashFunctions.h> | ||
| 15 | #include <util/FileUtil.h> | ||
| 16 | |||
| 17 | namespace spice::compiler { | ||
| 18 | |||
| 19 | 23 | void DebugInfoGenerator::initialize(const std::string &sourceFileName, std::filesystem::path sourceFileDir) { | |
| 20 | 23 | llvm::Module *module = irGenerator->module; | |
| 21 | 23 | llvm::LLVMContext &context = irGenerator->context; | |
| 22 | |||
| 23 | // Create DIBuilder | ||
| 24 |
1/2✓ Branch 2 → 3 taken 23 times.
✗ Branch 2 → 119 not taken.
|
23 | diBuilder = std::make_unique<llvm::DIBuilder>(*module); |
| 25 | |||
| 26 | // Create compilation unit | ||
| 27 |
3/6✓ Branch 5 → 6 taken 23 times.
✗ Branch 5 → 124 not taken.
✓ Branch 6 → 7 taken 23 times.
✗ Branch 6 → 122 not taken.
✓ Branch 7 → 8 taken 23 times.
✗ Branch 7 → 120 not taken.
|
23 | std::filesystem::path absolutePath = absolute(sourceFileDir / sourceFileName); |
| 28 | 23 | absolutePath.make_preferred(); | |
| 29 | 23 | sourceFileDir.make_preferred(); | |
| 30 |
3/6✓ Branch 15 → 16 taken 23 times.
✗ Branch 15 → 132 not taken.
✓ Branch 17 → 18 taken 23 times.
✗ Branch 17 → 128 not taken.
✓ Branch 19 → 20 taken 23 times.
✗ Branch 19 → 126 not taken.
|
46 | llvm::DIFile *cuDiFile = diBuilder->createFile(absolutePath.string(), sourceFileDir.string()); |
| 31 |
3/6✓ Branch 25 → 26 taken 23 times.
✗ Branch 25 → 138 not taken.
✓ Branch 26 → 27 taken 23 times.
✗ Branch 26 → 137 not taken.
✓ Branch 28 → 29 taken 23 times.
✗ Branch 28 → 136 not taken.
|
46 | compileUnit = diBuilder->createCompileUnit( |
| 32 | 23 | llvm::dwarf::DW_LANG_C_plus_plus_14, cuDiFile, PRODUCER_STRING, irGenerator->cliOptions.optLevel > OptLevel::O0, "", 0, "", | |
| 33 | llvm::DICompileUnit::FullDebug, 0, false, false, llvm::DICompileUnit::DebugNameTableKind::None); | ||
| 34 | |||
| 35 |
2/4✓ Branch 29 → 30 taken 23 times.
✗ Branch 29 → 141 not taken.
✓ Branch 30 → 31 taken 23 times.
✗ Branch 30 → 141 not taken.
|
23 | module->addModuleFlag(llvm::Module::Max, "Dwarf Version", 5); |
| 36 |
2/4✓ Branch 31 → 32 taken 23 times.
✗ Branch 31 → 142 not taken.
✓ Branch 32 → 33 taken 23 times.
✗ Branch 32 → 142 not taken.
|
23 | module->addModuleFlag(llvm::Module::Warning, "Debug Info Version", llvm::DEBUG_METADATA_VERSION); |
| 37 | |||
| 38 | // Create another DIFile as scope for subprograms | ||
| 39 |
2/4✓ Branch 36 → 37 taken 23 times.
✗ Branch 36 → 146 not taken.
✓ Branch 39 → 40 taken 23 times.
✗ Branch 39 → 143 not taken.
|
46 | diFile = diBuilder->createFile(sourceFileName, sourceFileDir.string()); |
| 40 | |||
| 41 |
1/2✓ Branch 42 → 43 taken 23 times.
✗ Branch 42 → 182 not taken.
|
23 | pointerWidth = irGenerator->module->getDataLayout().getPointerSizeInBits(); |
| 42 | |||
| 43 | // Initialize primitive debug types | ||
| 44 |
2/4✓ Branch 44 → 45 taken 23 times.
✗ Branch 44 → 150 not taken.
✓ Branch 45 → 46 taken 23 times.
✗ Branch 45 → 150 not taken.
|
23 | doubleTy = diBuilder->createBasicType("double", 64, llvm::dwarf::DW_ATE_float); |
| 45 |
2/4✓ Branch 47 → 48 taken 23 times.
✗ Branch 47 → 151 not taken.
✓ Branch 48 → 49 taken 23 times.
✗ Branch 48 → 151 not taken.
|
23 | intTy = diBuilder->createBasicType("int", 32, llvm::dwarf::DW_ATE_signed); |
| 46 |
2/4✓ Branch 50 → 51 taken 23 times.
✗ Branch 50 → 152 not taken.
✓ Branch 51 → 52 taken 23 times.
✗ Branch 51 → 152 not taken.
|
23 | uIntTy = diBuilder->createBasicType("unsigned int", 32, llvm::dwarf::DW_ATE_unsigned); |
| 47 |
2/4✓ Branch 53 → 54 taken 23 times.
✗ Branch 53 → 153 not taken.
✓ Branch 54 → 55 taken 23 times.
✗ Branch 54 → 153 not taken.
|
23 | shortTy = diBuilder->createBasicType("short", 16, llvm::dwarf::DW_ATE_signed); |
| 48 |
2/4✓ Branch 56 → 57 taken 23 times.
✗ Branch 56 → 154 not taken.
✓ Branch 57 → 58 taken 23 times.
✗ Branch 57 → 154 not taken.
|
23 | uShortTy = diBuilder->createBasicType("unsigned short", 16, llvm::dwarf::DW_ATE_unsigned); |
| 49 |
2/4✓ Branch 59 → 60 taken 23 times.
✗ Branch 59 → 155 not taken.
✓ Branch 60 → 61 taken 23 times.
✗ Branch 60 → 155 not taken.
|
23 | longTy = diBuilder->createBasicType("long", 64, llvm::dwarf::DW_ATE_signed); |
| 50 |
2/4✓ Branch 62 → 63 taken 23 times.
✗ Branch 62 → 156 not taken.
✓ Branch 63 → 64 taken 23 times.
✗ Branch 63 → 156 not taken.
|
23 | uLongTy = diBuilder->createBasicType("unsigned long", 64, llvm::dwarf::DW_ATE_unsigned); |
| 51 |
2/4✓ Branch 65 → 66 taken 23 times.
✗ Branch 65 → 157 not taken.
✓ Branch 66 → 67 taken 23 times.
✗ Branch 66 → 157 not taken.
|
23 | byteTy = diBuilder->createBasicType("byte", 8, llvm::dwarf::DW_ATE_unsigned); |
| 52 |
2/4✓ Branch 68 → 69 taken 23 times.
✗ Branch 68 → 158 not taken.
✓ Branch 69 → 70 taken 23 times.
✗ Branch 69 → 158 not taken.
|
23 | charTy = diBuilder->createBasicType("char", 8, llvm::dwarf::DW_ATE_unsigned_char); |
| 53 |
1/2✓ Branch 74 → 75 taken 23 times.
✗ Branch 74 → 159 not taken.
|
46 | stringTy = diBuilder->createPointerType(charTy, pointerWidth); |
| 54 |
2/4✓ Branch 76 → 77 taken 23 times.
✗ Branch 76 → 162 not taken.
✓ Branch 77 → 78 taken 23 times.
✗ Branch 77 → 162 not taken.
|
23 | boolTy = diBuilder->createBasicType("bool", 8, llvm::dwarf::DW_ATE_boolean); |
| 55 |
2/4✓ Branch 79 → 80 taken 23 times.
✗ Branch 79 → 163 not taken.
✓ Branch 80 → 81 taken 23 times.
✗ Branch 80 → 163 not taken.
|
23 | voidTy = diBuilder->createBasicType("void", 0, llvm::dwarf::DW_ATE_unsigned); |
| 56 | |||
| 57 | // Initialize fat ptr type | ||
| 58 |
1/2✓ Branch 81 → 82 taken 23 times.
✗ Branch 81 → 182 not taken.
|
23 | llvm::PointerType *ptrTy = irGenerator->builder.getPtrTy(); |
| 59 |
1/2✓ Branch 82 → 83 taken 23 times.
✗ Branch 82 → 86 not taken.
|
23 | if (!irGenerator->llvmTypes.fatPtrType) |
| 60 |
1/2✓ Branch 84 → 85 taken 23 times.
✗ Branch 84 → 164 not taken.
|
23 | irGenerator->llvmTypes.fatPtrType = llvm::StructType::get(context, {ptrTy, ptrTy}); |
| 61 | |||
| 62 | 23 | const llvm::DataLayout &dataLayout = module->getDataLayout(); | |
| 63 |
1/2✓ Branch 87 → 88 taken 23 times.
✗ Branch 87 → 182 not taken.
|
23 | const llvm::StructLayout *structLayout = dataLayout.getStructLayout(irGenerator->llvmTypes.fatPtrType); |
| 64 |
1/2✓ Branch 88 → 89 taken 23 times.
✗ Branch 88 → 166 not taken.
|
23 | const uint32_t alignInBits = dataLayout.getABITypeAlign(irGenerator->llvmTypes.fatPtrType).value(); |
| 65 |
1/2✓ Branch 90 → 91 taken 23 times.
✗ Branch 90 → 167 not taken.
|
23 | const uint32_t ptrAlignInBits = dataLayout.getABITypeAlign(ptrTy).value(); |
| 66 | |||
| 67 |
6/12✓ Branch 93 → 94 taken 23 times.
✗ Branch 93 → 171 not taken.
✓ Branch 95 → 96 taken 23 times.
✗ Branch 95 → 170 not taken.
✓ Branch 96 → 97 taken 23 times.
✗ Branch 96 → 169 not taken.
✓ Branch 97 → 98 taken 23 times.
✗ Branch 97 → 169 not taken.
✓ Branch 98 → 99 taken 23 times.
✗ Branch 98 → 168 not taken.
✓ Branch 99 → 100 taken 23 times.
✗ Branch 99 → 168 not taken.
|
23 | fatPtrTy = diBuilder->createStructType(diFile, "_fat_ptr", diFile, 0, structLayout->getSizeInBits(), alignInBits, |
| 68 | llvm::DINode::FlagTypePassByValue | llvm::DINode::FlagNonTrivial, nullptr, {}, 0, | ||
| 69 | nullptr, "_fat_ptr"); | ||
| 70 | |||
| 71 |
1/2✓ Branch 104 → 105 taken 23 times.
✗ Branch 104 → 172 not taken.
|
46 | llvm::DIType *voidPtrDIType = diBuilder->createPointerType(voidTy, pointerWidth, ptrAlignInBits); |
| 72 |
2/4✓ Branch 107 → 108 taken 23 times.
✗ Branch 107 → 175 not taken.
✓ Branch 108 → 109 taken 23 times.
✗ Branch 108 → 175 not taken.
|
23 | llvm::DIDerivedType *firstType = diBuilder->createMemberType(fatPtrTy, "fct", diFile, 0, pointerWidth, ptrAlignInBits, 0, |
| 73 | llvm::DINode::FlagZero, voidPtrDIType); | ||
| 74 |
1/2✓ Branch 112 → 113 taken 23 times.
✗ Branch 112 → 177 not taken.
|
46 | llvm::DIDerivedType *secondType = diBuilder->createMemberType(fatPtrTy, "captures", diFile, 0, pointerWidth, ptrAlignInBits, |
| 75 |
1/2✓ Branch 111 → 112 taken 23 times.
✗ Branch 111 → 177 not taken.
|
23 | pointerWidth, llvm::DINode::FlagZero, voidPtrDIType); |
| 76 |
2/4✓ Branch 114 → 115 taken 23 times.
✗ Branch 114 → 179 not taken.
✓ Branch 116 → 117 taken 23 times.
✗ Branch 116 → 179 not taken.
|
23 | fatPtrTy->replaceElements(llvm::MDTuple::get(context, {firstType, secondType})); |
| 77 | 23 | } | |
| 78 | |||
| 79 | 10367 | void DebugInfoGenerator::generateFunctionDebugInfo(llvm::Function *llvmFunction, const Function *spiceFunc, bool isLambda) { | |
| 80 |
2/2✓ Branch 2 → 3 taken 10162 times.
✓ Branch 2 → 4 taken 205 times.
|
10367 | if (!irGenerator->cliOptions.instrumentation.generateDebugInfo) |
| 81 | 10162 | return; | |
| 82 | |||
| 83 | 205 | const ASTNode *node = spiceFunc->declNode; | |
| 84 |
1/2✓ Branch 4 → 5 taken 205 times.
✗ Branch 4 → 117 not taken.
|
205 | const uint32_t lineNo = spiceFunc->getDeclCodeLoc().line; |
| 85 | |||
| 86 | // Prepare flags | ||
| 87 | 205 | llvm::DIScope *scope = diFile; | |
| 88 | 205 | llvm::DINode::DIFlags flags = llvm::DINode::FlagPrototyped; | |
| 89 |
8/10✓ Branch 5 → 6 taken 200 times.
✓ Branch 5 → 10 taken 5 times.
✓ Branch 6 → 7 taken 200 times.
✗ Branch 6 → 117 not taken.
✓ Branch 7 → 8 taken 200 times.
✗ Branch 7 → 117 not taken.
✓ Branch 8 → 9 taken 193 times.
✓ Branch 8 → 10 taken 7 times.
✓ Branch 11 → 12 taken 193 times.
✓ Branch 11 → 13 taken 12 times.
|
205 | if (spiceFunc->entry && spiceFunc->entry->getQualType().isPublic()) |
| 90 |
1/2✓ Branch 12 → 13 taken 193 times.
✗ Branch 12 → 117 not taken.
|
193 | flags |= llvm::DINode::FlagPublic; |
| 91 | |||
| 92 | // Prepare spFlags | ||
| 93 | 205 | llvm::DISubprogram::DISPFlags spFlags = llvm::DISubprogram::SPFlagDefinition; | |
| 94 |
1/2✗ Branch 13 → 14 not taken.
✓ Branch 13 → 15 taken 205 times.
|
205 | if (isLambda) |
| 95 | ✗ | spFlags |= llvm::DISubprogram::SPFlagLocalToUnit; | |
| 96 |
2/2✓ Branch 15 → 16 taken 5 times.
✓ Branch 15 → 20 taken 200 times.
|
205 | if (spiceFunc->isVirtual) { |
| 97 |
2/4✓ Branch 16 → 17 taken 5 times.
✗ Branch 16 → 117 not taken.
✗ Branch 17 → 18 not taken.
✓ Branch 17 → 19 taken 5 times.
|
5 | if (spiceFunc->thisType.is(TY_INTERFACE)) |
| 98 | ✗ | spFlags |= llvm::DISubprogram::SPFlagPureVirtual; | |
| 99 | else | ||
| 100 |
1/2✓ Branch 19 → 20 taken 5 times.
✗ Branch 19 → 117 not taken.
|
5 | spFlags |= llvm::DISubprogram::SPFlagVirtual; |
| 101 | } | ||
| 102 | |||
| 103 | // Collect arguments | ||
| 104 |
1/2✓ Branch 20 → 21 taken 205 times.
✗ Branch 20 → 115 not taken.
|
205 | std::vector<llvm::Metadata *> argTypes; |
| 105 |
2/2✓ Branch 23 → 24 taken 69 times.
✓ Branch 23 → 26 taken 136 times.
|
205 | if (spiceFunc->isProcedure()) |
| 106 |
1/2✓ Branch 24 → 25 taken 69 times.
✗ Branch 24 → 89 not taken.
|
69 | argTypes.push_back(voidTy); |
| 107 | else | ||
| 108 |
2/4✓ Branch 26 → 27 taken 136 times.
✗ Branch 26 → 90 not taken.
✓ Branch 27 → 28 taken 136 times.
✗ Branch 27 → 90 not taken.
|
136 | argTypes.push_back(getDITypeForQualType(node, spiceFunc->returnType)); // Add result type |
| 109 |
2/2✓ Branch 32 → 33 taken 124 times.
✓ Branch 32 → 36 taken 81 times.
|
205 | if (spiceFunc->isMethod()) |
| 110 |
2/4✓ Branch 33 → 34 taken 124 times.
✗ Branch 33 → 91 not taken.
✓ Branch 34 → 35 taken 124 times.
✗ Branch 34 → 91 not taken.
|
124 | argTypes.push_back(getDITypeForQualType(node, spiceFunc->thisType)); // Add this type |
| 111 |
1/2✗ Branch 36 → 37 not taken.
✓ Branch 36 → 45 taken 205 times.
|
205 | if (isLambda) { |
| 112 | ✗ | llvm::DICompositeType *captureStructType = generateCaptureStructDebugInfo(spiceFunc); | |
| 113 | ✗ | scope = captureStructType; | |
| 114 | ✗ | llvm::DIType *captureStructPtr = diBuilder->createPointerType(captureStructType, pointerWidth); | |
| 115 | ✗ | argTypes.push_back(captureStructPtr); // Add this type | |
| 116 | } | ||
| 117 |
3/4✓ Branch 45 → 46 taken 205 times.
✗ Branch 45 → 99 not taken.
✓ Branch 53 → 48 taken 216 times.
✓ Branch 53 → 54 taken 205 times.
|
421 | for (const QualType &argType : spiceFunc->getParamTypes()) // Add arg types |
| 118 |
2/4✓ Branch 49 → 50 taken 216 times.
✗ Branch 49 → 96 not taken.
✓ Branch 50 → 51 taken 216 times.
✗ Branch 50 → 96 not taken.
|
421 | argTypes.push_back(getDITypeForQualType(node, argType)); |
| 119 | |||
| 120 | // Create function type | ||
| 121 |
2/4✓ Branch 58 → 59 taken 205 times.
✗ Branch 58 → 100 not taken.
✓ Branch 59 → 60 taken 205 times.
✗ Branch 59 → 100 not taken.
|
205 | llvm::DISubroutineType *functionTy = diBuilder->createSubroutineType(diBuilder->getOrCreateTypeArray(argTypes)); |
| 122 | |||
| 123 |
1/2✓ Branch 60 → 61 taken 205 times.
✗ Branch 60 → 115 not taken.
|
205 | const std::string mangledName = spiceFunc->getMangledName(); |
| 124 | llvm::DISubprogram *subprogram; | ||
| 125 |
1/2✓ Branch 61 → 62 taken 205 times.
✗ Branch 61 → 113 not taken.
|
205 | const std::string &name = spiceFunc->name; |
| 126 |
2/2✓ Branch 64 → 65 taken 124 times.
✓ Branch 64 → 72 taken 81 times.
|
205 | if (spiceFunc->isMethod()) { |
| 127 |
1/2✓ Branch 70 → 71 taken 124 times.
✗ Branch 70 → 101 not taken.
|
124 | subprogram = diBuilder->createMethod(scope, name, mangledName, diFile, lineNo, functionTy, 0, 0, nullptr, flags, spFlags); |
| 128 | } else { | ||
| 129 |
1/2✓ Branch 79 → 80 taken 81 times.
✗ Branch 79 → 105 not taken.
|
162 | subprogram = diBuilder->createFunction(scope, name, mangledName, diFile, lineNo, functionTy, lineNo, flags, spFlags); |
| 130 | } | ||
| 131 |
1/2✓ Branch 82 → 83 taken 205 times.
✗ Branch 82 → 111 not taken.
|
205 | subprogram->replaceRetainedNodes({}); |
| 132 | |||
| 133 | // Add debug info to LLVM function | ||
| 134 |
1/2✓ Branch 83 → 84 taken 205 times.
✗ Branch 83 → 113 not taken.
|
205 | llvmFunction->setSubprogram(subprogram); |
| 135 | // Add scope to lexicalBlocks | ||
| 136 |
1/2✓ Branch 84 → 85 taken 205 times.
✗ Branch 84 → 112 not taken.
|
205 | lexicalBlocks.push(subprogram); |
| 137 | 205 | } | |
| 138 | |||
| 139 | 10607 | void DebugInfoGenerator::concludeFunctionDebugInfo() { | |
| 140 |
2/2✓ Branch 2 → 3 taken 10402 times.
✓ Branch 2 → 4 taken 205 times.
|
10607 | if (!irGenerator->cliOptions.instrumentation.generateDebugInfo) |
| 141 | 10402 | return; | |
| 142 | |||
| 143 |
1/2✗ Branch 5 → 6 not taken.
✓ Branch 5 → 7 taken 205 times.
|
205 | assert(!lexicalBlocks.empty()); |
| 144 | 205 | lexicalBlocks.pop(); | |
| 145 | } | ||
| 146 | |||
| 147 | 8571 | void DebugInfoGenerator::pushLexicalBlock(const ASTNode *node) { | |
| 148 |
2/2✓ Branch 2 → 3 taken 8382 times.
✓ Branch 2 → 4 taken 189 times.
|
8571 | if (!irGenerator->cliOptions.instrumentation.generateDebugInfo) |
| 149 | 8382 | return; | |
| 150 | |||
| 151 | 189 | const uint32_t line = node->codeLoc.line; | |
| 152 | 189 | const uint32_t col = node->codeLoc.col; | |
| 153 | 189 | llvm::DILexicalBlock *lexicalBlock = diBuilder->createLexicalBlock(lexicalBlocks.top(), diFile, line, col); | |
| 154 |
1/2✓ Branch 7 → 8 taken 189 times.
✗ Branch 7 → 10 not taken.
|
189 | lexicalBlocks.push(lexicalBlock); |
| 155 | } | ||
| 156 | |||
| 157 | 8571 | void DebugInfoGenerator::popLexicalBlock() { | |
| 158 |
2/2✓ Branch 2 → 3 taken 8382 times.
✓ Branch 2 → 4 taken 189 times.
|
8571 | if (!irGenerator->cliOptions.instrumentation.generateDebugInfo) |
| 159 | 8382 | return; | |
| 160 | |||
| 161 |
1/2✗ Branch 5 → 6 not taken.
✓ Branch 5 → 7 taken 189 times.
|
189 | assert(!lexicalBlocks.empty()); |
| 162 | 189 | lexicalBlocks.pop(); | |
| 163 | } | ||
| 164 | |||
| 165 | ✗ | llvm::DICompositeType *DebugInfoGenerator::generateCaptureStructDebugInfo(const Function *spiceFunc) { | |
| 166 | ✗ | const CaptureMap &captures = spiceFunc->bodyScope->symbolTable.captures; | |
| 167 | ✗ | const ASTNode *node = spiceFunc->declNode; | |
| 168 | ✗ | const uint32_t lineNo = node->codeLoc.line; | |
| 169 | |||
| 170 | // Get LLVM type for struct | ||
| 171 | ✗ | std::vector<llvm::Type *> fieldTypes; | |
| 172 | ✗ | std::vector<SymbolTableEntry *> fieldEntries; | |
| 173 | ✗ | QualTypeList fieldSymbolTypes; | |
| 174 | ✗ | for (const auto &capture : captures | std::views::values) { | |
| 175 | ✗ | QualType captureType = capture.capturedSymbol->getQualType(); | |
| 176 | |||
| 177 | // Capture by reference | ||
| 178 | ✗ | if (capture.getMode() == BY_REFERENCE) | |
| 179 | ✗ | captureType = captureType.toRef(node); | |
| 180 | |||
| 181 | ✗ | fieldEntries.push_back(capture.capturedSymbol); | |
| 182 | ✗ | fieldSymbolTypes.push_back(captureType); | |
| 183 | ✗ | fieldTypes.push_back(captureType.toLLVMType(irGenerator->sourceFile)); | |
| 184 | } | ||
| 185 | ✗ | llvm::StructType *structType = llvm::StructType::get(irGenerator->context, fieldTypes); | |
| 186 | ✗ | const llvm::StructLayout *structLayout = irGenerator->module->getDataLayout().getStructLayout(structType); | |
| 187 | ✗ | const size_t alignInBits = irGenerator->module->getDataLayout().getABITypeAlign(structType).value(); | |
| 188 | |||
| 189 | ✗ | llvm::DIScope *scope = lexicalBlocks.top(); | |
| 190 | llvm::DICompositeType *structDiType = | ||
| 191 | ✗ | diBuilder->createClassType(scope, "", diFile, lineNo, structLayout->getSizeInBits(), alignInBits, 0, | |
| 192 | llvm::DINode::FlagTypePassByValue | llvm::DINode::FlagNonTrivial, nullptr, {}); | ||
| 193 | |||
| 194 | ✗ | std::vector<llvm::Metadata *> fieldDITypes; | |
| 195 | ✗ | for (size_t i = 0; i < fieldEntries.size(); i++) { | |
| 196 | ✗ | llvm::DIType *fieldDiType = getDITypeForQualType(node, fieldSymbolTypes.at(i)); | |
| 197 | ✗ | const std::string &fieldName = fieldEntries.at(i)->name; | |
| 198 | ✗ | const size_t offsetInBits = structLayout->getElementOffsetInBits(i); | |
| 199 | ✗ | const size_t fieldSize = fieldDiType->getSizeInBits(); | |
| 200 | ✗ | const size_t fieldAlign = fieldDiType->getAlignInBits(); | |
| 201 | ✗ | llvm::DIDerivedType *fieldDiDerivedType = diBuilder->createMemberType( | |
| 202 | structDiType, fieldName, diFile, lineNo, fieldSize, fieldAlign, offsetInBits, llvm::DINode::FlagZero, fieldDiType); | ||
| 203 | ✗ | fieldDITypes.push_back(fieldDiDerivedType); | |
| 204 | } | ||
| 205 | ✗ | structDiType->replaceElements(llvm::MDTuple::get(irGenerator->context, fieldDITypes)); | |
| 206 | |||
| 207 | ✗ | return structDiType; | |
| 208 | ✗ | } | |
| 209 | |||
| 210 | 1161 | void DebugInfoGenerator::generateGlobalVarDebugInfo(llvm::GlobalVariable *global, const SymbolTableEntry *globalEntry) { | |
| 211 |
2/2✓ Branch 2 → 3 taken 1154 times.
✓ Branch 2 → 4 taken 7 times.
|
1161 | if (!irGenerator->cliOptions.instrumentation.generateDebugInfo) |
| 212 | 1154 | return; | |
| 213 | |||
| 214 |
1/2✓ Branch 4 → 5 taken 7 times.
✗ Branch 4 → 17 not taken.
|
7 | const uint32_t lineNo = globalEntry->getDeclCodeLoc().line; |
| 215 |
1/2✓ Branch 5 → 6 taken 7 times.
✗ Branch 5 → 17 not taken.
|
7 | const llvm::StringRef name = global->getName(); |
| 216 |
2/4✓ Branch 6 → 7 taken 7 times.
✗ Branch 6 → 17 not taken.
✓ Branch 7 → 8 taken 7 times.
✗ Branch 7 → 17 not taken.
|
7 | llvm::DIType *type = getDITypeForQualType(globalEntry->declNode, globalEntry->getQualType()); |
| 217 |
2/4✓ Branch 8 → 9 taken 7 times.
✗ Branch 8 → 17 not taken.
✓ Branch 9 → 10 taken 7 times.
✗ Branch 9 → 17 not taken.
|
7 | const bool isLocal = globalEntry->getQualType().isPublic(); |
| 218 | |||
| 219 |
2/4✓ Branch 12 → 13 taken 7 times.
✗ Branch 12 → 16 not taken.
✓ Branch 13 → 14 taken 7 times.
✗ Branch 13 → 16 not taken.
|
7 | global->addDebugInfo(diBuilder->createGlobalVariableExpression(compileUnit, name, name, diFile, lineNo, type, isLocal)); |
| 220 | } | ||
| 221 | |||
| 222 | 48 | void DebugInfoGenerator::generateGlobalStringDebugInfo(llvm::GlobalVariable *global, const std::string &name, size_t length, | |
| 223 | const CodeLoc &codeLoc) const { | ||
| 224 | 48 | const uint32_t lineNo = codeLoc.line; | |
| 225 | 48 | const size_t sizeInBits = (length + 1) * 8; // +1 because of null-terminator | |
| 226 | |||
| 227 |
1/2✓ Branch 4 → 5 taken 48 times.
✗ Branch 4 → 12 not taken.
|
48 | llvm::DIStringType *stringType = diBuilder->createStringType(name, sizeInBits); |
| 228 |
2/4✓ Branch 9 → 10 taken 48 times.
✗ Branch 9 → 13 not taken.
✓ Branch 10 → 11 taken 48 times.
✗ Branch 10 → 13 not taken.
|
48 | global->addDebugInfo(diBuilder->createGlobalVariableExpression(compileUnit, name, name, diFile, lineNo, stringType, true)); |
| 229 | 48 | } | |
| 230 | |||
| 231 | 32397 | void DebugInfoGenerator::generateLocalVarDebugInfo(const std::string &varName, llvm::Value *address, size_t argNumber) { | |
| 232 |
2/2✓ Branch 2 → 3 taken 31759 times.
✓ Branch 2 → 4 taken 638 times.
|
32397 | if (!irGenerator->cliOptions.instrumentation.generateDebugInfo) |
| 233 | 31759 | return; | |
| 234 | |||
| 235 | // Get symbol table entry | ||
| 236 | 638 | const SymbolTableEntry *variableEntry = irGenerator->currentScope->lookupStrict(varName); | |
| 237 |
1/2✗ Branch 7 → 8 not taken.
✓ Branch 7 → 9 taken 638 times.
|
638 | assert(variableEntry != nullptr); |
| 238 | // Build debug info | ||
| 239 | 638 | llvm::DIScope *scope = lexicalBlocks.top(); | |
| 240 | 638 | llvm::DIType *diType = getDITypeForQualType(variableEntry->declNode, variableEntry->getQualType()); | |
| 241 | 638 | const uint32_t lineNo = variableEntry->declNode->codeLoc.line; | |
| 242 | |||
| 243 | llvm::DILocalVariable *varInfo; | ||
| 244 |
2/2✓ Branch 12 → 13 taken 340 times.
✓ Branch 12 → 18 taken 298 times.
|
638 | if (argNumber != SIZE_MAX) |
| 245 |
1/2✓ Branch 16 → 17 taken 340 times.
✗ Branch 16 → 36 not taken.
|
340 | varInfo = diBuilder->createParameterVariable(scope, varName, argNumber, diFile, lineNo, diType); |
| 246 | else | ||
| 247 |
1/2✓ Branch 20 → 21 taken 298 times.
✗ Branch 20 → 38 not taken.
|
298 | varInfo = diBuilder->createAutoVariable(scope, varName, diFile, lineNo, diType); |
| 248 |
1/2✓ Branch 24 → 25 taken 638 times.
✗ Branch 24 → 39 not taken.
|
638 | llvm::DIExpression *expr = diBuilder->createExpression(); |
| 249 |
2/4✓ Branch 25 → 26 taken 638 times.
✗ Branch 25 → 42 not taken.
✓ Branch 26 → 27 taken 638 times.
✗ Branch 26 → 40 not taken.
|
638 | const llvm::DILocation *debugLocation = irGenerator->builder.getCurrentDebugLocation(); |
| 250 |
1/2✗ Branch 28 → 29 not taken.
✓ Branch 28 → 30 taken 638 times.
|
638 | assert(debugLocation != nullptr); |
| 251 |
1/2✓ Branch 33 → 34 taken 638 times.
✗ Branch 33 → 43 not taken.
|
638 | diBuilder->insertDeclare(address, varInfo, expr, debugLocation, irGenerator->builder.GetInsertPoint()); |
| 252 | } | ||
| 253 | |||
| 254 | 1302406 | void DebugInfoGenerator::setSourceLocation(const CodeLoc &codeLoc) { | |
| 255 |
2/2✓ Branch 2 → 3 taken 1275784 times.
✓ Branch 2 → 4 taken 26622 times.
|
1302406 | if (!irGenerator->cliOptions.instrumentation.generateDebugInfo) |
| 256 | 1275784 | return; | |
| 257 | |||
| 258 |
1/2✗ Branch 5 → 6 not taken.
✓ Branch 5 → 7 taken 26622 times.
|
26622 | assert(!lexicalBlocks.empty()); |
| 259 | 26622 | llvm::DIScope *scope = lexicalBlocks.top(); | |
| 260 | 26622 | const llvm::DILocation *diCodeLoc = llvm::DILocation::get(scope->getContext(), codeLoc.line, codeLoc.col, scope); | |
| 261 |
2/4✓ Branch 10 → 11 taken 26622 times.
✗ Branch 10 → 17 not taken.
✓ Branch 11 → 12 taken 26622 times.
✗ Branch 11 → 15 not taken.
|
26622 | irGenerator->builder.SetCurrentDebugLocation(diCodeLoc); |
| 262 | } | ||
| 263 | |||
| 264 | 1273345 | void DebugInfoGenerator::setSourceLocation(const ASTNode *node) { setSourceLocation(node->codeLoc); } | |
| 265 | |||
| 266 | 957 | void DebugInfoGenerator::finalize() const { | |
| 267 |
2/2✓ Branch 2 → 3 taken 23 times.
✓ Branch 2 → 5 taken 934 times.
|
957 | if (irGenerator->cliOptions.instrumentation.generateDebugInfo) |
| 268 | 23 | diBuilder->finalize(); | |
| 269 | 957 | } | |
| 270 | |||
| 271 | 1540 | llvm::DIType *DebugInfoGenerator::getDITypeForQualType(const ASTNode *node, const QualType &ty) { // NOLINT(*-no-recursion) | |
| 272 | // Pointer type | ||
| 273 |
2/2✓ Branch 3 → 4 taken 218 times.
✓ Branch 3 → 13 taken 1322 times.
|
1540 | if (ty.isPtr()) { |
| 274 |
2/4✓ Branch 4 → 5 taken 218 times.
✗ Branch 4 → 176 not taken.
✓ Branch 5 → 6 taken 218 times.
✗ Branch 5 → 176 not taken.
|
218 | llvm::DIType *pointeeTy = getDITypeForQualType(node, ty.getContained()); |
| 275 |
1/2✓ Branch 10 → 11 taken 218 times.
✗ Branch 10 → 177 not taken.
|
436 | return diBuilder->createPointerType(pointeeTy, pointerWidth); |
| 276 | } | ||
| 277 | |||
| 278 | // Reference type | ||
| 279 |
2/2✓ Branch 14 → 15 taken 127 times.
✓ Branch 14 → 22 taken 1195 times.
|
1322 | if (ty.isRef()) { |
| 280 |
2/4✓ Branch 15 → 16 taken 127 times.
✗ Branch 15 → 180 not taken.
✓ Branch 16 → 17 taken 127 times.
✗ Branch 16 → 180 not taken.
|
127 | llvm::DIType *referencedType = getDITypeForQualType(node, ty.getContained()); |
| 281 |
1/2✓ Branch 19 → 20 taken 127 times.
✗ Branch 19 → 181 not taken.
|
254 | return diBuilder->createReferenceType(llvm::dwarf::DW_TAG_reference_type, referencedType, pointerWidth); |
| 282 | } | ||
| 283 | |||
| 284 | // Array type | ||
| 285 |
2/2✓ Branch 23 → 24 taken 2 times.
✓ Branch 23 → 38 taken 1193 times.
|
1195 | if (ty.isArray()) { |
| 286 |
2/4✓ Branch 24 → 25 taken 2 times.
✗ Branch 24 → 182 not taken.
✓ Branch 25 → 26 taken 2 times.
✗ Branch 25 → 182 not taken.
|
2 | llvm::DIType *itemTy = getDITypeForQualType(node, ty.getContained()); |
| 287 |
1/2✓ Branch 26 → 27 taken 2 times.
✗ Branch 26 → 188 not taken.
|
2 | const size_t size = ty.getArraySize(); |
| 288 |
1/2✓ Branch 29 → 30 taken 2 times.
✗ Branch 29 → 183 not taken.
|
2 | const llvm::DINodeArray subscripts = diBuilder->getOrCreateArray({}); |
| 289 |
5/10✓ Branch 31 → 32 taken 2 times.
✗ Branch 31 → 187 not taken.
✓ Branch 32 → 33 taken 2 times.
✗ Branch 32 → 186 not taken.
✓ Branch 33 → 34 taken 2 times.
✗ Branch 33 → 185 not taken.
✓ Branch 34 → 35 taken 2 times.
✗ Branch 34 → 184 not taken.
✓ Branch 35 → 36 taken 2 times.
✗ Branch 35 → 184 not taken.
|
2 | return diBuilder->createArrayType(size, 0, itemTy, subscripts); |
| 290 | } | ||
| 291 | |||
| 292 | // Primitive types | ||
| 293 | llvm::DIType *baseDiType; | ||
| 294 |
8/12✗ Branch 39 → 40 not taken.
✓ Branch 39 → 41 taken 83 times.
✗ Branch 39 → 46 not taken.
✓ Branch 39 → 51 taken 264 times.
✓ Branch 39 → 56 taken 66 times.
✓ Branch 39 → 57 taken 131 times.
✓ Branch 39 → 58 taken 141 times.
✓ Branch 39 → 59 taken 120 times.
✓ Branch 39 → 60 taken 384 times.
✗ Branch 39 → 125 not taken.
✓ Branch 39 → 160 taken 4 times.
✗ Branch 39 → 161 not taken.
|
1193 | switch (ty.getSuperType()) { |
| 295 | ✗ | case TY_DOUBLE: | |
| 296 | ✗ | baseDiType = doubleTy; | |
| 297 | ✗ | break; | |
| 298 | 83 | case TY_INT: | |
| 299 |
2/2✓ Branch 42 → 43 taken 66 times.
✓ Branch 42 → 44 taken 17 times.
|
83 | baseDiType = ty.isSigned() ? intTy : uIntTy; |
| 300 | 83 | break; | |
| 301 | ✗ | case TY_SHORT: | |
| 302 | ✗ | baseDiType = ty.isSigned() ? shortTy : uShortTy; | |
| 303 | ✗ | break; | |
| 304 | 264 | case TY_LONG: | |
| 305 |
2/2✓ Branch 52 → 53 taken 55 times.
✓ Branch 52 → 54 taken 209 times.
|
264 | baseDiType = ty.isSigned() ? longTy : uLongTy; |
| 306 | 264 | break; | |
| 307 | 66 | case TY_BYTE: | |
| 308 | 66 | baseDiType = byteTy; | |
| 309 | 66 | break; | |
| 310 | 131 | case TY_CHAR: | |
| 311 | 131 | baseDiType = charTy; | |
| 312 | 131 | break; | |
| 313 | 141 | case TY_STRING: | |
| 314 | 141 | baseDiType = stringTy; | |
| 315 | 141 | break; | |
| 316 | 120 | case TY_BOOL: | |
| 317 | 120 | baseDiType = boolTy; | |
| 318 | 120 | break; | |
| 319 | 384 | case TY_STRUCT: { | |
| 320 | // Do cache lookup | ||
| 321 | 384 | const size_t hashKey = std::hash<QualType>{}(ty); | |
| 322 |
3/4✓ Branch 61 → 62 taken 384 times.
✗ Branch 61 → 205 not taken.
✓ Branch 62 → 63 taken 351 times.
✓ Branch 62 → 65 taken 33 times.
|
384 | if (structTypeCache.contains(hashKey)) |
| 323 |
1/2✓ Branch 63 → 64 taken 351 times.
✗ Branch 63 → 205 not taken.
|
351 | return structTypeCache.at(hashKey); |
| 324 | |||
| 325 | // Cache miss, generate struct type | ||
| 326 |
1/2✓ Branch 65 → 66 taken 33 times.
✗ Branch 65 → 205 not taken.
|
33 | const Struct *spiceStruct = ty.getStruct(node); |
| 327 |
1/2✗ Branch 66 → 67 not taken.
✓ Branch 66 → 68 taken 33 times.
|
33 | assert(spiceStruct != nullptr); |
| 328 | |||
| 329 | // Retrieve information about the struct | ||
| 330 |
1/2✓ Branch 68 → 69 taken 33 times.
✗ Branch 68 → 205 not taken.
|
33 | const uint32_t lineNo = spiceStruct->getDeclCodeLoc().line; |
| 331 |
2/4✓ Branch 69 → 70 taken 33 times.
✗ Branch 69 → 205 not taken.
✓ Branch 70 → 71 taken 33 times.
✗ Branch 70 → 205 not taken.
|
33 | llvm::Type *structType = spiceStruct->entry->getQualType().toLLVMType(irGenerator->sourceFile); |
| 332 |
1/2✗ Branch 71 → 72 not taken.
✓ Branch 71 → 73 taken 33 times.
|
33 | assert(structType != nullptr); |
| 333 | 33 | const llvm::DataLayout &dataLayout = irGenerator->module->getDataLayout(); | |
| 334 |
1/2✓ Branch 74 → 75 taken 33 times.
✗ Branch 74 → 205 not taken.
|
33 | const llvm::StructLayout *structLayout = dataLayout.getStructLayout(reinterpret_cast<llvm::StructType *>(structType)); |
| 335 |
1/2✓ Branch 75 → 76 taken 33 times.
✗ Branch 75 → 189 not taken.
|
33 | const uint32_t alignInBits = dataLayout.getABITypeAlign(structType).value(); |
| 336 | |||
| 337 | // Create struct ty | ||
| 338 |
1/2✓ Branch 77 → 78 taken 33 times.
✗ Branch 77 → 205 not taken.
|
33 | const std::string mangledName = NameMangling::mangleStruct(*spiceStruct); |
| 339 |
2/4✓ Branch 81 → 82 taken 33 times.
✗ Branch 81 → 192 not taken.
✓ Branch 83 → 84 taken 33 times.
✗ Branch 83 → 191 not taken.
|
66 | llvm::DICompositeType *structDiType = diBuilder->createStructType( |
| 340 |
2/4✓ Branch 82 → 83 taken 33 times.
✗ Branch 82 → 191 not taken.
✓ Branch 85 → 86 taken 33 times.
✗ Branch 85 → 190 not taken.
|
66 | diFile, spiceStruct->name, diFile, lineNo, structLayout->getSizeInBits(), alignInBits, |
| 341 | 33 | llvm::DINode::FlagTypePassByReference | llvm::DINode::FlagNonTrivial, nullptr, {}, 0, nullptr, mangledName); | |
| 342 | 33 | baseDiType = structDiType; | |
| 343 | |||
| 344 | // Insert into cache | ||
| 345 |
1/2✓ Branch 87 → 88 taken 33 times.
✗ Branch 87 → 194 not taken.
|
33 | structTypeCache.insert({hashKey, structDiType}); |
| 346 | |||
| 347 | // Collect DI types for fields | ||
| 348 | 33 | std::vector<llvm::Metadata *> fieldTypes; | |
| 349 |
3/4✓ Branch 114 → 115 taken 109 times.
✗ Branch 114 → 201 not taken.
✓ Branch 115 → 89 taken 76 times.
✓ Branch 115 → 116 taken 33 times.
|
109 | for (size_t i = 0; i < spiceStruct->scope->getFieldCount(); i++) { |
| 350 | // Get field entry | ||
| 351 |
1/2✗ Branch 89 → 90 not taken.
✓ Branch 89 → 91 taken 76 times.
|
76 | const SymbolTableEntry *fieldEntry = spiceStruct->scope->lookupField(i); |
| 352 |
3/6✓ Branch 94 → 95 taken 76 times.
✗ Branch 94 → 98 not taken.
✓ Branch 95 → 96 taken 76 times.
✗ Branch 95 → 201 not taken.
✓ Branch 96 → 97 taken 76 times.
✗ Branch 96 → 98 not taken.
|
76 | assert(fieldEntry != nullptr && fieldEntry->isField()); |
| 353 |
2/2✓ Branch 99 → 100 taken 4 times.
✓ Branch 99 → 101 taken 72 times.
|
76 | if (fieldEntry->isImplicitField) |
| 354 | 4 | continue; | |
| 355 | |||
| 356 |
1/2✓ Branch 101 → 102 taken 72 times.
✗ Branch 101 → 201 not taken.
|
72 | const QualType &fieldType = fieldEntry->getQualType(); |
| 357 | 72 | const uint32_t fieldLineNo = fieldEntry->declNode->codeLoc.line; | |
| 358 |
2/4✓ Branch 102 → 103 taken 72 times.
✗ Branch 102 → 195 not taken.
✓ Branch 103 → 104 taken 72 times.
✗ Branch 103 → 195 not taken.
|
72 | const size_t offsetInBits = structLayout->getElementOffsetInBits(i); |
| 359 | |||
| 360 |
1/2✓ Branch 104 → 105 taken 72 times.
✗ Branch 104 → 201 not taken.
|
72 | llvm::DIType *fieldDiType = getDITypeForQualType(node, fieldType); |
| 361 | llvm::DIDerivedType *fieldDiDerivedType = | ||
| 362 |
3/6✓ Branch 107 → 108 taken 72 times.
✗ Branch 107 → 197 not taken.
✓ Branch 108 → 109 taken 72 times.
✗ Branch 108 → 197 not taken.
✓ Branch 110 → 111 taken 72 times.
✗ Branch 110 → 196 not taken.
|
72 | diBuilder->createMemberType(structDiType, fieldEntry->name, diFile, fieldLineNo, fieldDiType->getSizeInBits(), |
| 363 | fieldDiType->getAlignInBits(), offsetInBits, llvm::DINode::FlagZero, fieldDiType); | ||
| 364 | |||
| 365 |
1/2✓ Branch 111 → 112 taken 72 times.
✗ Branch 111 → 198 not taken.
|
72 | fieldTypes.push_back(fieldDiDerivedType); |
| 366 | } | ||
| 367 | |||
| 368 |
2/4✓ Branch 117 → 118 taken 33 times.
✗ Branch 117 → 199 not taken.
✓ Branch 119 → 120 taken 33 times.
✗ Branch 119 → 199 not taken.
|
33 | structDiType->replaceElements(llvm::MDTuple::get(irGenerator->context, fieldTypes)); |
| 369 | 33 | break; | |
| 370 | 33 | } | |
| 371 | ✗ | case TY_INTERFACE: { | |
| 372 | // Do cache lookup | ||
| 373 | ✗ | const size_t hashKey = std::hash<QualType>{}(ty); | |
| 374 | ✗ | if (structTypeCache.contains(hashKey)) | |
| 375 | ✗ | return structTypeCache.at(hashKey); | |
| 376 | |||
| 377 | // Cache miss, generate interface type | ||
| 378 | ✗ | const Interface *spiceInterface = ty.getInterface(node); | |
| 379 | ✗ | assert(spiceInterface != nullptr); | |
| 380 | |||
| 381 | // Retrieve information about the interface | ||
| 382 | ✗ | const uint32_t lineNo = spiceInterface->getDeclCodeLoc().line; | |
| 383 | ✗ | llvm::Type *interfaceType = spiceInterface->entry->getQualType().toLLVMType(irGenerator->sourceFile); | |
| 384 | ✗ | assert(interfaceType != nullptr); | |
| 385 | ✗ | const llvm::DataLayout dataLayout = irGenerator->module->getDataLayout(); | |
| 386 | ✗ | const llvm::StructLayout *structLayout = dataLayout.getStructLayout(reinterpret_cast<llvm::StructType *>(interfaceType)); | |
| 387 | ✗ | const uint32_t alignInBits = dataLayout.getABITypeAlign(interfaceType).value(); | |
| 388 | |||
| 389 | // Create interface ty | ||
| 390 | ✗ | const std::string mangledName = NameMangling::mangleInterface(*spiceInterface); | |
| 391 | ✗ | llvm::DICompositeType *interfaceDiType = diBuilder->createStructType( | |
| 392 | ✗ | diFile, spiceInterface->name, diFile, lineNo, structLayout->getSizeInBits(), alignInBits, | |
| 393 | ✗ | llvm::DINode::FlagTypePassByReference | llvm::DINode::FlagNonTrivial, nullptr, {}, 0, nullptr, mangledName); | |
| 394 | |||
| 395 | // Set vtable holder to itself for interfaces | ||
| 396 | ✗ | interfaceDiType->replaceVTableHolder(interfaceDiType); | |
| 397 | ✗ | baseDiType = interfaceDiType; | |
| 398 | |||
| 399 | // Insert into cache | ||
| 400 | ✗ | structTypeCache.insert({hashKey, interfaceDiType}); | |
| 401 | |||
| 402 | ✗ | break; | |
| 403 | ✗ | } | |
| 404 | 4 | case TY_FUNCTION: // fall-through | |
| 405 | case TY_PROCEDURE: | ||
| 406 | 4 | baseDiType = fatPtrTy; | |
| 407 | 4 | break; | |
| 408 | ✗ | default: | |
| 409 | − | throw CompilerError(UNHANDLED_BRANCH, "Debug Info Type fallthrough"); // GCOV_EXCL_LINE | |
| 410 | } | ||
| 411 | |||
| 412 |
2/2✓ Branch 170 → 171 taken 85 times.
✓ Branch 170 → 174 taken 757 times.
|
842 | if (ty.isConst()) |
| 413 | 85 | baseDiType = diBuilder->createQualifiedType(llvm::dwarf::DW_TAG_const_type, baseDiType); | |
| 414 | |||
| 415 | 842 | return baseDiType; | |
| 416 | } | ||
| 417 | |||
| 418 | } // namespace spice::compiler | ||
| 419 |