[llvm] r311012 - [Verifier] Reject globals without a type associated.
Davide Italiano via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 16 08:16:33 PDT 2017
Author: davide
Date: Wed Aug 16 08:16:33 2017
New Revision: 311012
URL: http://llvm.org/viewvc/llvm-project?rev=311012&view=rev
Log:
[Verifier] Reject globals without a type associated.
Added:
llvm/trunk/test/DebugInfo/pr34186.ll
Modified:
llvm/trunk/lib/IR/Verifier.cpp
Modified: llvm/trunk/lib/IR/Verifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Verifier.cpp?rev=311012&r1=311011&r2=311012&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Verifier.cpp (original)
+++ llvm/trunk/lib/IR/Verifier.cpp Wed Aug 16 08:16:33 2017
@@ -1150,6 +1150,7 @@ void Verifier::visitDIGlobalVariable(con
AssertDI(N.getTag() == dwarf::DW_TAG_variable, "invalid tag", &N);
AssertDI(!N.getName().empty(), "missing global variable name", &N);
+ AssertDI(N.getType(), "missing global variable type", &N);
if (auto *Member = N.getRawStaticDataMemberDeclaration()) {
AssertDI(isa<DIDerivedType>(Member),
"invalid static data member declaration", &N, Member);
Added: llvm/trunk/test/DebugInfo/pr34186.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/pr34186.ll?rev=311012&view=auto
==============================================================================
--- llvm/trunk/test/DebugInfo/pr34186.ll (added)
+++ llvm/trunk/test/DebugInfo/pr34186.ll Wed Aug 16 08:16:33 2017
@@ -0,0 +1,12 @@
+; RUN: not llc %s 2>&1 | FileCheck %s
+; CHECK: missing global variable type
+
+!llvm.dbg.cu = !{!2}
+!llvm.module.flags = !{!63, !64}
+!1 = distinct !DIGlobalVariable(name: "pat", scope: !2, file: !3, line: 27, isLocal: true, isDefinition: true)
+!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "", emissionKind: FullDebug, globals: !5)
+!3 = !DIFile(filename: "patatino.c", directory: "/")
+!5 = !{!6}
+!6 = !DIGlobalVariableExpression(var: !1)
+!63 = !{i32 2, !"Dwarf Version", i32 4}
+!64 = !{i32 2, !"Debug Info Version", i32 3}
More information about the llvm-commits
mailing list