OSDN Git Service

[LTO] Handle null GV in Symbol object
authorTeresa Johnson <tejohnson@google.com>
Sat, 10 Sep 2016 06:15:26 +0000 (06:15 +0000)
committerTeresa Johnson <tejohnson@google.com>
Sat, 10 Sep 2016 06:15:26 +0000 (06:15 +0000)
Similar to other Symbol methods, have Symbol::getComdat handle
a null GV gracefully.

Fixes PR30326.

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

include/llvm/LTO/LTO.h

index d5f3b12..5b684bd 100644 (file)
@@ -165,6 +165,8 @@ public:
       return GV && llvm::canBeOmittedFromSymbolTable(GV);
     }
     Expected<const Comdat *> getComdat() const {
+      if (!GV)
+        return nullptr;
       const GlobalObject *GO;
       if (auto *GA = dyn_cast<GlobalAlias>(GV)) {
         GO = GA->getBaseObject();