[llvm] r192748 - Add an assert that we have a scope that matters for methods

Eric Christopher echristo at gmail.com
Tue Oct 15 16:31:36 PDT 2013


Author: echristo
Date: Tue Oct 15 18:31:36 2013
New Revision: 192748

URL: http://llvm.org/viewvc/llvm-project?rev=192748&view=rev
Log:
Add an assert that we have a scope that matters for methods
and remove a call to getNonCompileUnitScope as a method
shouldn't be in the compile unit scope.

Modified:
    llvm/trunk/lib/IR/DIBuilder.cpp

Modified: llvm/trunk/lib/IR/DIBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DIBuilder.cpp?rev=192748&r1=192747&r2=192748&view=diff
==============================================================================
--- llvm/trunk/lib/IR/DIBuilder.cpp (original)
+++ llvm/trunk/lib/IR/DIBuilder.cpp Tue Oct 15 18:31:36 2013
@@ -1113,11 +1113,14 @@ DISubprogram DIBuilder::createMethod(DID
                                      MDNode *TParam) {
   assert(Ty.getTag() == dwarf::DW_TAG_subroutine_type &&
          "function types should be subroutines");
+  assert(getNonCompileUnitScope(Context) &&
+         "Methods should have both a Context and a context that isn't "
+         "the compile unit.");
   Value *TElts[] = { GetTagConstant(VMContext, DW_TAG_base_type) };
   Value *Elts[] = {
     GetTagConstant(VMContext, dwarf::DW_TAG_subprogram),
     F.getFileNode(),
-    DIScope(getNonCompileUnitScope(Context)).getRef(),
+    DIScope(Context).getRef(),
     MDString::get(VMContext, Name),
     MDString::get(VMContext, Name),
     MDString::get(VMContext, LinkageName),





More information about the llvm-commits mailing list