aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/DwarfWriter.cpp
diff options
context:
space:
mode:
authorJim Laskey <jlaskey@mac.com>2006-01-26 21:22:49 +0000
committerJim Laskey <jlaskey@mac.com>2006-01-26 21:22:49 +0000
commit6e87c0e029c011b9ee61068c607080ca4934378a (patch)
tree461d03d7672523772cac862a4a47d2f4089a5403 /lib/CodeGen/DwarfWriter.cpp
parent9471c8a93b117d8ac01c4ef1cb9faa583e03dec0 (diff)
Use global information to fill out Dwarf compile units.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25662 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/DwarfWriter.cpp')
-rw-r--r--lib/CodeGen/DwarfWriter.cpp30
1 files changed, 10 insertions, 20 deletions
diff --git a/lib/CodeGen/DwarfWriter.cpp b/lib/CodeGen/DwarfWriter.cpp
index 512f479fdd..cd2a9da12c 100644
--- a/lib/CodeGen/DwarfWriter.cpp
+++ b/lib/CodeGen/DwarfWriter.cpp
@@ -1242,20 +1242,16 @@ void DwarfWriter::NewGlobalVariable(DWContext *Context,
/// NewCompileUnit - Create new compile unit information.
///
-DIE *DwarfWriter::NewCompileUnit(const std::string &Directory,
- const std::string &SourceName) {
+DIE *DwarfWriter::NewCompileUnit(const CompileUnitWrapper &CompileUnit) {
DIE *Unit = new DIE(DW_TAG_compile_unit, DW_CHILDREN_yes);
// FIXME - use the correct line set.
Unit->AddLabel (DW_AT_stmt_list, DW_FORM_data4, DWLabel("line", 0));
Unit->AddLabel (DW_AT_high_pc, DW_FORM_addr, DWLabel("text_end", 0));
Unit->AddLabel (DW_AT_low_pc, DW_FORM_addr, DWLabel("text_begin", 0));
- // FIXME - The producer needs to be in this form, but should come from
- // an appropriate source.
- Unit->AddString(DW_AT_producer, DW_FORM_string,
- "llvm 3.4.x (LLVM Research Group)");
- Unit->AddInt (DW_AT_language, DW_FORM_data1, DW_LANG_C89);
- Unit->AddString(DW_AT_name, DW_FORM_string, SourceName);
- Unit->AddString(DW_AT_comp_dir, DW_FORM_string, Directory);
+ Unit->AddString(DW_AT_producer, DW_FORM_string, CompileUnit.getProducer());
+ Unit->AddInt (DW_AT_language, DW_FORM_data1, CompileUnit.getLanguage());
+ Unit->AddString(DW_AT_name, DW_FORM_string, CompileUnit.getFileName());
+ Unit->AddString(DW_AT_comp_dir, DW_FORM_string, CompileUnit.getDirectory());
Unit->Complete(*this);
return Unit;
@@ -1700,17 +1696,11 @@ void DwarfWriter::EmitDebugMacInfo() {
/// ConstructCompileUnitDIEs - Create a compile unit DIE for each source and
/// header file.
void DwarfWriter::ConstructCompileUnitDIEs() {
- // Get directory and source information.
- const UniqueVector<std::string> &Directories = DebugInfo->getDirectories();
- const UniqueVector<SourceFileInfo> &SourceFiles = DebugInfo->getSourceFiles();
-
- // Construct compile unit DIEs for each source.
- for (unsigned SourceID = 1, NSID = SourceFiles.size();
- SourceID <= NSID; ++SourceID) {
- const SourceFileInfo &SourceFile = SourceFiles[SourceID];
- const std::string &Directory = Directories[SourceFile.getDirectoryID()];
- const std::string &SourceName = SourceFile.getName();
- DIE *Unit = NewCompileUnit(Directory, SourceName);
+ const UniqueVector<CompileUnitWrapper> CUW = DebugInfo->getCompileUnits();
+
+ for (unsigned i = 1, N = CUW.size(); i <= N; ++i) {
+ const CompileUnitWrapper &CompileUnit = CUW[i];
+ DIE *Unit = NewCompileUnit(CompileUnit);
DWContext *Context = new DWContext(*this, NULL, Unit);
CompileUnits.push_back(Unit);
}