This is an archive of the discontinued LLVM Phabricator instance.

Add functions in ctype.h to builtin function database
ClosedPublic

Authored by twoh on Apr 11 2016, 9:41 AM.

Details

Summary

Add functions declared in ctype.h to builtin function database. All functions are annotated with nothrow and const attribute, which enables better optimization.

Diff Detail

Event Timeline

twoh updated this revision to Diff 53260.Apr 11 2016, 9:41 AM
twoh retitled this revision from to Add functions in ctype.h to builtin function database.
twoh updated this object.
twoh added reviewers: rsmith, aaron.ballman.
twoh added a subscriber: cfe-commits.
joerg added a subscriber: joerg.Apr 11 2016, 12:32 PM

ctype.h functions are only pure, not const?

twoh added a comment.Apr 11 2016, 1:07 PM

@joerg My bad. They surely read from globals. I'll fix the diff. Thanks for the catch!

twoh updated this revision to Diff 53369.Apr 11 2016, 11:34 PM

Fix attribute annotation from 'const' to 'pure'. Add support for 'pure' attribute to builtin function database related code. Test case (test/Sema/libbuiltins-ctype.c) added. Line 116 of test/FixIt/typo.m is removed because it is not necessary for test but causes a warning that cannot be addressed by -fixit once isupper is registered to Builtins.def.

aaron.ballman accepted this revision.Apr 12 2016, 6:13 AM
aaron.ballman edited edge metadata.

LGTM, with one small nit.

include/clang/Basic/Builtins.h
97

Missing period at the end of the comment.

This revision is now accepted and ready to land.Apr 12 2016, 6:13 AM
twoh updated this revision to Diff 53395.Apr 12 2016, 8:01 AM
twoh edited edge metadata.

Addressing comments from @aaron.ballman. It would be great if someone can commit this patch for me, as I don't have the privilege yet.

aaron.ballman closed this revision.Apr 13 2016, 7:01 AM

Commit in r266199, thank you!

I reverted this in r266201; it was causing build bot failures like:

http://lab.llvm.org:8011/builders/clang-ppc64be-linux/builds/3517

Can you please take a look?

Thanks!

Sure, I'll take a look.
Thanks!

  • Taewook