[PATCH] Add PragmaAttr and Pragma Spelling to Tablegen

Tyler Nowicki tnowicki at apple.com
Thu Jun 5 19:17:10 PDT 2014


Hi Aaron,

Thanks for the review!

I’ve made the changes you suggested except for adding the tests. I mighty be mistaken, but don’t the tests in the first patch test/PCH/pragma-loop.cpp and test/Parser/pragma-loop-ast.cpp verify that pretty printing is outputting the correct pragma? Is there another place for tests specific to pretty printing?

>> @@ -1847,11 +1867,11 @@ void EmitClangAttrSpellingListIndex(RecordKeeper &Records, raw_ostream &OS) {
>> -      OS << "    if (Name == \""
>> -        << Spellings[I].name() << "\" && "
>> -        << "SyntaxUsed == "
>> -        << StringSwitch<unsigned>(Spellings[I].variety())
>> -          .Case("GNU", 0)
>> -          .Case("CXX11", 1)
>> -          .Case("Declspec", 2)
>> -          .Case("Keyword", 3)
>> -          .Default(0)
>> -        << " && Scope == \"" << Spellings[I].nameSpace() << "\")\n"
>> -        << "        return " << I << ";\n";
>> +      OS << "    if (Name == \"" << Spellings[I].name() << "\" && "
>> +         << "SyntaxUsed == "
>> +         << StringSwitch<unsigned>(Spellings[I].variety())
>> +                .Case("GNU", 0)
>> +                .Case("CXX11", 1)
>> +                .Case("Declspec", 2)
>> +                .Case("Keyword", 3)
>> +                .Case("Pragma", 4)
>> +                .Default(0)
>> +         << " && Scope == \"" << Spellings[I].nameSpace() << "\")\n"
>> +         << "        return " << I << ";\n";
> 
> Ahh, good catch on the formatting. :-)

I can’t take any credit, clang-format is a great tool.

Tyler

-------------- next part --------------
A non-text attachment was scrubbed...
Name: pragma_tablegen.patch
Type: application/octet-stream
Size: 7368 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140605/3a1c5187/attachment.obj>


More information about the cfe-commits mailing list