diff options
author | Kevin Enderby <enderby@apple.com> | 2010-07-28 20:55:35 +0000 |
---|---|---|
committer | Kevin Enderby <enderby@apple.com> | 2010-07-28 20:55:35 +0000 |
commit | e5930f142a74f3c3b5facbbee410c6e211540523 (patch) | |
tree | 271ed002823a4a38fe64f7691a494ab2f6190e1e /llvm/lib/MC/MCParser/AsmParser.cpp | |
parent | 18e39cec7a26d0673c5f362110e0fe7cdfed77f1 (diff) | |
download | bcm5719-llvm-e5930f142a74f3c3b5facbbee410c6e211540523.tar.gz bcm5719-llvm-e5930f142a74f3c3b5facbbee410c6e211540523.zip |
Added first bit of support for the dwarf .file directive. This patch collects
the info from the .file directive and makes file and directory tables that
will eventually be put out as part of the dwarf info in the output file.
llvm-svn: 109651
Diffstat (limited to 'llvm/lib/MC/MCParser/AsmParser.cpp')
-rw-r--r-- | llvm/lib/MC/MCParser/AsmParser.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp index 61d65b8d015..e74952a4cab 100644 --- a/llvm/lib/MC/MCParser/AsmParser.cpp +++ b/llvm/lib/MC/MCParser/AsmParser.cpp @@ -26,6 +26,7 @@ #include "llvm/MC/MCSectionMachO.h" #include "llvm/MC/MCStreamer.h" #include "llvm/MC/MCSymbol.h" +#include "llvm/MC/MCDwarf.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/SourceMgr.h" @@ -370,6 +371,16 @@ bool AsmParser::Run(bool NoInitialTextSection, bool NoFinalize) { if (TheCondState.TheCond != StartingCondState.TheCond || TheCondState.Ignore != StartingCondState.Ignore) return TokError("unmatched .ifs or .elses"); + + // Check to see there are no empty DwarfFile slots. + const std::vector<MCDwarfFile *> &MCDwarfFiles = + getContext().getMCDwarfFiles(); + for (unsigned i = 1; i < MCDwarfFiles.size(); i++) { + if (!MCDwarfFiles[i]){ + TokError("unassigned file number: " + Twine(i) + " for .file directives"); + HadError = true; + } + } // Finalize the output stream if there are no errors and if the client wants // us to. @@ -1729,6 +1740,7 @@ bool AsmParser::ParseDirectiveEndIf(SMLoc DirectiveLoc) { bool GenericAsmParser::ParseDirectiveFile(StringRef, SMLoc DirectiveLoc) { // FIXME: I'm not sure what this is. int64_t FileNumber = -1; + SMLoc FileNumberLoc = getLexer().getLoc(); if (getLexer().is(AsmToken::Integer)) { FileNumber = getTok().getIntVal(); Lex(); @@ -1749,8 +1761,11 @@ bool GenericAsmParser::ParseDirectiveFile(StringRef, SMLoc DirectiveLoc) { if (FileNumber == -1) getStreamer().EmitFileDirective(Filename); - else + else { + if (getContext().GetDwarfFile(Filename, FileNumber) == 0) + Error(FileNumberLoc, "file number already allocated"); getStreamer().EmitDwarfFileDirective(FileNumber, Filename); + } return false; } |