diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-12-20 22:11:22 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-12-20 22:11:22 -0800 |
commit | 30716ce07e1014fc22481cfd4ecd7d0eda338415 (patch) | |
tree | 5ae18e32c37910ddbd5873f57b72fe4623dda4f8 /lib/Target/CppBackend/CPPBackend.cpp | |
parent | ad044fbc84d71c51b58a57bc58ffb9d862a41e14 (diff) |
emit debug info
Diffstat (limited to 'lib/Target/CppBackend/CPPBackend.cpp')
-rw-r--r-- | lib/Target/CppBackend/CPPBackend.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Target/CppBackend/CPPBackend.cpp b/lib/Target/CppBackend/CPPBackend.cpp index 70fa619b14..db5c4f8817 100644 --- a/lib/Target/CppBackend/CPPBackend.cpp +++ b/lib/Target/CppBackend/CPPBackend.cpp @@ -34,6 +34,7 @@ #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/FormattedStream.h" #include "llvm/Support/TargetRegistry.h" +#include "llvm/DebugInfo.h" #include <algorithm> #include <cstdio> #include <map> @@ -1056,6 +1057,13 @@ std::string JSWriter::generateInstruction(const Instruction *I) { } } delete [] opNames; + // append debug info + if (MDNode *N = I->getMetadata("dbg")) { + DILocation Loc(N); + unsigned Line = Loc.getLineNumber(); + StringRef File = Loc.getFilename(); + text += " //@line " + utostr(Line) + " \"" + File.str() + "\""; + } return text; } |