DebugInfo: Add implicit conversion from DISubprogram to DIScope
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Tue, 14 Apr 2015 16:19:44 +0000 (16:19 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Tue, 14 Apr 2015 16:19:44 +0000 (16:19 +0000)
As a follow-up to r234850, add an implicit conversion from
`DISubprogram` to `DIScope` to support Kaleidoscope Ch. 8.  This also
reverts that band-aid from r234890.

(/me learns *again* to build Kaleidoscope before commit...)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234904 91177308-0d34-0410-b5e6-96231b3b80d8

examples/Kaleidoscope/Chapter8/toy.cpp
include/llvm/IR/DebugInfo.h

index 8dfec4b2ebadf14d33e37b6322053ac6191e8588..2838d6df5937a836ceae034ead157ec3e07f3b14 100644 (file)
@@ -1234,7 +1234,7 @@ Function *PrototypeAST::Codegen() {
       CreateFunctionType(Args.size(), Unit), false /* internal linkage */,
       true /* definition */, ScopeLine, DIDescriptor::FlagPrototyped, false, F);
 
-  KSDbgInfo.FnScopeMap[this] = (DIScope)SP;
+  KSDbgInfo.FnScopeMap[this] = SP;
   return F;
 }
 
index 56033dfead0be5b6d462503d89e3b5b718287e3c..46ebcb4b8df98ac4a531b9d508c1fc7c4e8b2738 100644 (file)
@@ -437,6 +437,7 @@ public:
       : N(const_cast<MDSubprogram *>(N)) {}
 
   operator DIDescriptor() const { return N; }
+  operator DIScope() const { return N; }
   operator MDSubprogram *() const { return N; }
   MDSubprogram *operator->() const { return N; }
   MDSubprogram &operator*() const { return *N; }