[llvm] r234246 - DebugInfo: Drop confusing forwarding API from DILexicalBlockFile

Duncan P. N. Exon Smith dexonsmith at apple.com
Mon Apr 6 15:07:46 PDT 2015


Author: dexonsmith
Date: Mon Apr  6 17:07:46 2015
New Revision: 234246

URL: http://llvm.org/viewvc/llvm-project?rev=234246&view=rev
Log:
DebugInfo: Drop confusing forwarding API from DILexicalBlockFile

Remove `DILexicalBlockFile::getScope()` (whose last use was removed from
clang in r234245), which illegally returned a `DILexicalBlock` despite
its scope sometimes being an `MDSubprogram`.  Also remove the
`getLineNumber()` and `getColumnNumber()` methods that just forwarded to
`DILexicalBlock`'s versions, since there don't seem to be any callers.

Note that the block of code removed from `DebugInfo.cpp` was actually
dead code, since `isLexicalBlock()` (the previous branch) always returns
true when `isLexicalBlockFile()` returns true.

An earlier (broken and untested) version of this was squashed into
r234222 and reverted in r234225.

Modified:
    llvm/trunk/include/llvm/IR/DebugInfo.h
    llvm/trunk/lib/IR/DebugInfo.cpp

Modified: llvm/trunk/include/llvm/IR/DebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/DebugInfo.h?rev=234246&r1=234245&r2=234246&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/DebugInfo.h (original)
+++ llvm/trunk/include/llvm/IR/DebugInfo.h Mon Apr  6 17:07:46 2015
@@ -745,10 +745,7 @@ public:
     return *get();
   }
 
-  DIScope getContext() const { return getScope(); }
-  unsigned getLineNumber() const { return getScope().getLineNumber(); }
-  unsigned getColumnNumber() const { return getScope().getColumnNumber(); }
-  DILexicalBlock getScope() const { return DILexicalBlock(get()->getScope()); }
+  DIScope getContext() const { return get()->getScope(); }
   unsigned getDiscriminator() const { return get()->getDiscriminator(); }
 };
 
@@ -1050,11 +1047,9 @@ public:
     // Since discriminators are associated with lexical blocks, make
     // sure this location is a lexical block before retrieving its
     // value.
-    return getScope().isLexicalBlockFile()
-               ? DILexicalBlockFile(
-                     cast<MDNode>(cast<MDLocation>(DbgNode)->getScope()))
-                     .getDiscriminator()
-               : 0;
+    if (auto *F = dyn_cast<MDLexicalBlockFile>(get()->getScope()))
+      return F->getDiscriminator();
+    return 0;
   }
 
   /// \brief Generate a new discriminator value for this location.

Modified: llvm/trunk/lib/IR/DebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DebugInfo.cpp?rev=234246&r1=234245&r2=234246&view=diff
==============================================================================
--- llvm/trunk/lib/IR/DebugInfo.cpp (original)
+++ llvm/trunk/lib/IR/DebugInfo.cpp Mon Apr  6 17:07:46 2015
@@ -498,9 +498,6 @@ void DebugInfoFinder::processScope(DISco
   if (Scope.isLexicalBlock()) {
     DILexicalBlock LB(Scope);
     processScope(LB.getContext());
-  } else if (Scope.isLexicalBlockFile()) {
-    DILexicalBlockFile LBF = DILexicalBlockFile(Scope);
-    processScope(LBF.getScope());
   } else if (Scope.isNameSpace()) {
     DINameSpace NS(Scope);
     processScope(NS.getContext());





More information about the llvm-commits mailing list