diff options
author | David Majnemer <david.majnemer@gmail.com> | 2016-02-02 19:22:34 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2016-02-02 19:22:34 +0000 |
commit | c9911f28e5a8060a439aa475e0a95793b1b1e970 (patch) | |
tree | 1292f7b899d8f09ff4c194fea492b3b7ff8ecd6c /llvm/lib/MC/MCParser/AsmParser.cpp | |
parent | e5737f7cacd925aabc3b0d079928d43a4dfdc4a3 (diff) | |
download | bcm5719-llvm-c9911f28e5a8060a439aa475e0a95793b1b1e970.tar.gz bcm5719-llvm-c9911f28e5a8060a439aa475e0a95793b1b1e970.zip |
[codeview] Correctly handle inlining functions post-dominated by unreachable
CodeView requires us to accurately describe the extent of the inlined
code. We did this by grabbing the next debug location in source order
and using *that* to denote where we stopped inlining. However, this is
not sufficient or correct in instances where there is no next debug
location or the next debug location belongs to the start of another
function.
To get this correct, use the end symbol of the function to denote the
last possible place the inlining could have stopped at.
llvm-svn: 259548
Diffstat (limited to 'llvm/lib/MC/MCParser/AsmParser.cpp')
-rw-r--r-- | llvm/lib/MC/MCParser/AsmParser.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp index 9f8027a381e..2db7504b377 100644 --- a/llvm/lib/MC/MCParser/AsmParser.cpp +++ b/llvm/lib/MC/MCParser/AsmParser.cpp @@ -3229,7 +3229,7 @@ bool AsmParser::parseDirectiveCVLinetable() { } /// parseDirectiveCVInlineLinetable -/// ::= .cv_inline_linetable PrimaryFunctionId FileId LineNum FnStart +/// ::= .cv_inline_linetable PrimaryFunctionId FileId LineNum FnStart FnEnd /// ("contains" SecondaryFunctionId+)? bool AsmParser::parseDirectiveCVInlineLinetable() { int64_t PrimaryFunctionId = getTok().getIntVal(); @@ -3256,6 +3256,12 @@ bool AsmParser::parseDirectiveCVInlineLinetable() { return Error(Loc, "expected identifier in directive"); MCSymbol *FnStartSym = getContext().getOrCreateSymbol(FnStartName); + Loc = getLexer().getLoc(); + StringRef FnEndName; + if (parseIdentifier(FnEndName)) + return Error(Loc, "expected identifier in directive"); + MCSymbol *FnEndSym = getContext().getOrCreateSymbol(FnEndName); + SmallVector<unsigned, 8> SecondaryFunctionIds; if (getLexer().is(AsmToken::Identifier)) { if (getTok().getIdentifier() != "contains") @@ -3276,7 +3282,7 @@ bool AsmParser::parseDirectiveCVInlineLinetable() { getStreamer().EmitCVInlineLinetableDirective(PrimaryFunctionId, SourceFileId, SourceLineNum, FnStartSym, - SecondaryFunctionIds); + FnEndSym, SecondaryFunctionIds); return false; } |