[llvm-commits] [llvm] r171140 - /llvm/trunk/lib/TableGen/TGParser.cpp

Sean Silva silvas at purdue.edu
Mon Dec 31 03:35:54 PST 2012


According to a comment in TGParser.cpp:ParseSimpleValue, this behavior
is deprecated:

Init *TGParser::ParseSimpleValue(Record *CurRec, RecTy *ItemType,
                                 IDParseMode Mode) {
  Init *R = 0;
  switch (Lex.getCode()) {
  default: TokError("Unknown token when parsing a value"); break;
  case tgtok::paste:
    // This is a leading paste operation.  This is deprecated but
    // still exists in some .td files.  Ignore it.
    Lex.Lex();  // Skip '#'.
    return ParseSimpleValue(CurRec, ItemType, Mode);


>From the behavior of this code, it looks like the leading `#` has no
effect anyway, and so we shouldn't encourage its use.

-- Sean Silva

On Wed, Dec 26, 2012 at 11:32 PM, Craig Topper <craig.topper at gmail.com> wrote:
> Author: ctopper
> Date: Thu Dec 27 00:32:52 2012
> New Revision: 171140
>
> URL: http://llvm.org/viewvc/llvm-project?rev=171140&view=rev
> Log:
> Update tablegen parser to allow defm names to start with #NAME.
>
> Modified:
>     llvm/trunk/lib/TableGen/TGParser.cpp
>
> Modified: llvm/trunk/lib/TableGen/TGParser.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/TableGen/TGParser.cpp?rev=171140&r1=171139&r2=171140&view=diff
> ==============================================================================
> --- llvm/trunk/lib/TableGen/TGParser.cpp (original)
> +++ llvm/trunk/lib/TableGen/TGParser.cpp Thu Dec 27 00:32:52 2012
> @@ -2406,7 +2406,11 @@
>
>    Init *DefmPrefix = 0;
>
> -  if (Lex.Lex() == tgtok::Id) {  // eat the defm.
> +  Lex.Lex(); // eat the defm.
> +
> +  // Note that tgtok::paste is here to allow starting with #NAME.
> +  if (Lex.getCode() == tgtok::Id ||
> +      Lex.getCode() == tgtok::paste) {
>      DefmPrefix = ParseObjectName(CurMultiClass);
>    }
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list