[cfe-commits] [LLVMdev] [cfe-dev] OpenMP support in CLANG: A proposal
Dmitri Gribenko
gribozavr at gmail.com
Sun Oct 28 06:54:15 PDT 2012
On Sun, Oct 28, 2012 at 3:49 PM, Mahesha HS <mahesha.llvm at gmail.com> wrote:
> I curiously looked into the OpenMP parsing in GCC. It follows the
> method of string comparison but *without* maintaining any string table
> in a following manner (by switching based on the first character of an
> identifier token) . I think, I can also follow the same technique. I
> should have done this long before in order to prevent unnecessarily
> maintaining a string table. But, I still welcome other better
> techniques, if any.
Clang already does this sort of thing, but the matching code is
autogenerated by TableGen. For example, take a look at
tools/clang/include/clang/AST/CommentCommandInfo.inc in the build
tree.
It might sound sensible to code the switch() for OMP clauses by hand
just because there are only a few of them. But OTOH, it will create a
possibly unwanted precedent of hardcoding where we have the
infrastructure to autogenerate code.
Dmitri
--
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/
More information about the cfe-commits
mailing list