Debug.cpp 918 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. // Local includes
  2. #include "Debug.h"
  3. namespace debugger {
  4. DIType *DebugInfo::getDoubleTy() {
  5. if (DblTy)
  6. return DblTy;
  7. DblTy = DBuilder->createBasicType("double", 64, 64, dwarf::DW_ATE_float);
  8. return DblTy;
  9. }
  10. void DebugInfo::emitLocation(ExprAST *AST) {
  11. if (!AST)
  12. return Builder.SetCurrentDebugLocation(DebugLoc());
  13. DIScope *Scope;
  14. if (LexicalBlocks.empty())
  15. Scope = TheCU;
  16. else
  17. Scope = LexicalBlocks.back();
  18. Builder.SetCurrentDebugLocation(
  19. DebugLoc::get(AST->getLine(), AST->getCol(), Scope));
  20. }
  21. static DISubroutineType *CreateFunctionType(unsigned NumArgs, DIFile *Unit) {
  22. SmallVector<Metadata *, 8> EltTys;
  23. DIType *DblTy = KSDbgInfo.getDoubleTy();
  24. // Add the result type.
  25. EltTys.push_back(DblTy);
  26. for (unsigned i = 0, e = NumArgs; i != e; ++i)
  27. EltTys.push_back(DblTy);
  28. return DBuilder->createSubroutineType(DBuilder->getOrCreateTypeArray(EltTys));
  29. }
  30. }