diff options
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/AsmParser/LLParser.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 7 | ||||
-rw-r--r-- | llvm/lib/IR/AsmWriter.cpp | 7 | ||||
-rw-r--r-- | llvm/lib/IR/LLVMContextImpl.h | 6 | ||||
-rw-r--r-- | llvm/lib/IR/Verifier.cpp | 5 |
5 files changed, 15 insertions, 14 deletions
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp index 0e98692e11c..103c8c48a5e 100644 --- a/llvm/lib/AsmParser/LLParser.cpp +++ b/llvm/lib/AsmParser/LLParser.cpp @@ -3348,8 +3348,8 @@ bool LLParser::ParseMDLocation(MDNode *&Result, bool IsDistinct) { PARSE_MD_FIELDS(); #undef VISIT_MD_FIELDS - auto get = (IsDistinct ? MDLocation::getDistinct : MDLocation::get); - Result = get(Context, line.Val, column.Val, scope.Val, inlinedAt.Val); + Result = GET_OR_DISTINCT( + MDLocation, (Context, line.Val, column.Val, scope.Val, inlinedAt.Val)); return false; } diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index 66831cced41..84753ffd181 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -1691,14 +1691,15 @@ std::error_code BitcodeReader::ParseMetadata() { if (Record.size() != 5) return Error("Invalid record"); - auto get = Record[0] ? MDLocation::getDistinct : MDLocation::get; unsigned Line = Record[1]; unsigned Column = Record[2]; MDNode *Scope = cast<MDNode>(MDValueList.getValueFwdRef(Record[3])); Metadata *InlinedAt = Record[4] ? MDValueList.getValueFwdRef(Record[4] - 1) : nullptr; - MDValueList.AssignValue(get(Context, Line, Column, Scope, InlinedAt), - NextMDValueNo++); + MDValueList.AssignValue( + GET_OR_DISTINCT(MDLocation, Record[0], + (Context, Line, Column, Scope, InlinedAt)), + NextMDValueNo++); break; } case bitc::METADATA_GENERIC_DEBUG: { diff --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp index 4eba3212e2b..d77c3447705 100644 --- a/llvm/lib/IR/AsmWriter.cpp +++ b/llvm/lib/IR/AsmWriter.cpp @@ -1419,11 +1419,10 @@ static void writeMDLocation(raw_ostream &Out, const MDLocation *DL, if (DL->getColumn()) Out << FS << "column: " << DL->getColumn(); Out << FS << "scope: "; - WriteAsOperandInternal(Out, DL->getScope(), TypePrinter, Machine, Context); - if (DL->getInlinedAt()) { + WriteAsOperandInternal(Out, DL->getRawScope(), TypePrinter, Machine, Context); + if (auto *IA = DL->getRawInlinedAt()) { Out << FS << "inlinedAt: "; - WriteAsOperandInternal(Out, DL->getInlinedAt(), TypePrinter, Machine, - Context); + WriteAsOperandInternal(Out, IA, TypePrinter, Machine, Context); } Out << ")"; } diff --git a/llvm/lib/IR/LLVMContextImpl.h b/llvm/lib/IR/LLVMContextImpl.h index 4631246d77a..e3806652830 100644 --- a/llvm/lib/IR/LLVMContextImpl.h +++ b/llvm/lib/IR/LLVMContextImpl.h @@ -240,12 +240,12 @@ template <> struct MDNodeKeyImpl<MDLocation> { : Line(Line), Column(Column), Scope(Scope), InlinedAt(InlinedAt) {} MDNodeKeyImpl(const MDLocation *L) - : Line(L->getLine()), Column(L->getColumn()), Scope(L->getScope()), - InlinedAt(L->getInlinedAt()) {} + : Line(L->getLine()), Column(L->getColumn()), Scope(L->getRawScope()), + InlinedAt(L->getRawInlinedAt()) {} bool isKeyOf(const MDLocation *RHS) const { return Line == RHS->getLine() && Column == RHS->getColumn() && - Scope == RHS->getScope() && InlinedAt == RHS->getInlinedAt(); + Scope == RHS->getRawScope() && InlinedAt == RHS->getRawInlinedAt(); } unsigned getHashValue() const { return hash_combine(Line, Column, Scope, InlinedAt); diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp index ee3582d00ca..fcf48c452e2 100644 --- a/llvm/lib/IR/Verifier.cpp +++ b/llvm/lib/IR/Verifier.cpp @@ -659,8 +659,9 @@ void Verifier::visitMetadataAsValue(const MetadataAsValue &MDV, Function *F) { } void Verifier::visitMDLocation(const MDLocation &N) { - Assert(N.getScope(), "location requires a valid scope", &N); - if (auto *IA = N.getInlinedAt()) + Assert(N.getRawScope() && isa<MDLocalScope>(N.getRawScope()), + "location requires a valid scope", &N, N.getRawScope()); + if (auto *IA = N.getRawInlinedAt()) Assert(isa<MDLocation>(IA), "inlined-at should be a location", &N, IA); } |