[ASan] fixup for r167725: Don't fetch name of StructType if it is literal
authorAlexey Samsonov <samsonov@google.com>
Mon, 12 Nov 2012 14:47:00 +0000 (14:47 +0000)
committerAlexey Samsonov <samsonov@google.com>
Mon, 12 Nov 2012 14:47:00 +0000 (14:47 +0000)
llvm-svn: 167729

llvm/lib/Transforms/Instrumentation/BlackList.cpp

index 5b65ea6..e02c631 100644 (file)
@@ -97,8 +97,9 @@ static StringRef GetGVTypeString(const GlobalVariable &G) {
   // Types of GlobalVariables are always pointer types.
   Type *GType = G.getType()->getElementType();
   // For now we support blacklisting struct types only.
-  if (GType->isStructTy()) {
-    return GType->getStructName();
+  if (StructType *SGType = dyn_cast<StructType>(GType)) {
+    if (!SGType->isLiteral())
+      return SGType->getName();
   }
   return "<unknown type>";
 }