DebugInfo: preparation to implement DW_AT_alignment
- Add alignment attribute to DIVariable family
- Modify bitcode format to match new DIVariable representation
- Update tests to match these changes (also add bitcode upgrade test)
- Expect that frontend passes non-zero align value only when it is not default
(was forcibly aligned by alignas()/_Alignas()/__atribute__(aligned())
Differential Revision: https://reviews.llvm.org/D25073
llvm-svn: 284678
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp
index 959501f..961ae65 100644
--- a/llvm/lib/AsmParser/LLParser.cpp
+++ b/llvm/lib/AsmParser/LLParser.cpp
@@ -4186,7 +4186,7 @@
/// ::= !DIGlobalVariable(scope: !0, name: "foo", linkageName: "foo",
/// file: !1, line: 7, type: !2, isLocal: false,
/// isDefinition: true, variable: i32* @foo,
-/// declaration: !3)
+/// declaration: !3, align: 8)
bool LLParser::ParseDIGlobalVariable(MDNode *&Result, bool IsDistinct) {
#define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \
REQUIRED(name, MDStringField, (/* AllowEmpty */ false)); \
@@ -4198,22 +4198,26 @@
OPTIONAL(isLocal, MDBoolField, ); \
OPTIONAL(isDefinition, MDBoolField, (true)); \
OPTIONAL(expr, MDField, ); \
- OPTIONAL(declaration, MDField, );
+ OPTIONAL(declaration, MDField, ); \
+ OPTIONAL(align, MDUnsignedField, (0, UINT32_MAX));
PARSE_MD_FIELDS();
#undef VISIT_MD_FIELDS
Result = GET_OR_DISTINCT(DIGlobalVariable,
(Context, scope.Val, name.Val, linkageName.Val,
file.Val, line.Val, type.Val, isLocal.Val,
- isDefinition.Val, expr.Val, declaration.Val));
+ isDefinition.Val, expr.Val, declaration.Val,
+ align.Val));
return false;
}
/// ParseDILocalVariable:
/// ::= !DILocalVariable(arg: 7, scope: !0, name: "foo",
-/// file: !1, line: 7, type: !2, arg: 2, flags: 7)
+/// file: !1, line: 7, type: !2, arg: 2, flags: 7,
+/// align: 8)
/// ::= !DILocalVariable(scope: !0, name: "foo",
-/// file: !1, line: 7, type: !2, arg: 2, flags: 7)
+/// file: !1, line: 7, type: !2, arg: 2, flags: 7,
+/// align: 8)
bool LLParser::ParseDILocalVariable(MDNode *&Result, bool IsDistinct) {
#define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \
REQUIRED(scope, MDField, (/* AllowNull */ false)); \
@@ -4222,13 +4226,14 @@
OPTIONAL(file, MDField, ); \
OPTIONAL(line, LineField, ); \
OPTIONAL(type, MDField, ); \
- OPTIONAL(flags, DIFlagField, );
+ OPTIONAL(flags, DIFlagField, ); \
+ OPTIONAL(align, MDUnsignedField, (0, UINT32_MAX));
PARSE_MD_FIELDS();
#undef VISIT_MD_FIELDS
Result = GET_OR_DISTINCT(DILocalVariable,
(Context, scope.Val, name.Val, file.Val, line.Val,
- type.Val, arg.Val, flags.Val));
+ type.Val, arg.Val, flags.Val, align.Val));
return false;
}