[LLVMdev] Inaccurate comment in LLParser: "align 2" is a synonym for "alignstack 2"?

Stephen Lin swlin at post.harvard.edu
Mon Apr 8 15:22:27 PDT 2013


The following comment:

00881       // As a hack, we allow "align 2" on functions as a synonym
for "alignstack
00882       // 2".

in "lib/AsmParser/LLParser.cpp" appears inaccurate, the "alignment" is
later parsed as the alignment of the function itself, both when
directly placed on the function:

02975   // If the alignment was parsed as an attribute, move to the
alignment field.
02976   if (FuncAttrs.hasAlignmentAttr()) {
02977     Alignment = FuncAttrs.getAlignment();
02978     FuncAttrs.removeAttribute(Attribute::Alignment);
02979   }

and through an attribute group:

00088       // If the alignment was parsed as an attribute, move to
the alignment
00089       // field.
00090       if (FnAttrs.hasAlignmentAttr()) {
00091         Fn->setAlignment(FnAttrs.getAlignment());
00092         FnAttrs.removeAttribute(Attribute::Alignment);
00093       }

Am I missing something or should this be removed or changed? (It's
actually legitimately a hack, just not the one described...)

Stephen



More information about the llvm-dev mailing list