This is an archive of the discontinued LLVM Phabricator instance.

Turn some C-style vararg into variadic templates
ClosedPublic

Authored by serge-sans-paille on Mar 17 2017, 4:13 AM.

Details

Summary

Module::getOrInsertFunction is using C-style vararg instead of variadic templates.

From a user prospective, it forces the use of an annoying nullptr to mark the end of the vararg, and there's not type checking on the arguments.
The variadic template is an obvious solution to both issues.

Diff Detail

Repository
rL LLVM

Event Timeline

mehdi_amini accepted this revision.Mar 17 2017, 10:41 AM

LGTM, thanks for the cleanup!

This revision is now accepted and ready to land.Mar 17 2017, 10:41 AM

@mehdi_amini I still don't have the commit right, so if you can handle this.

Also I did run the llvm test suite, but I did not ensure all third_party tools are still compiling with the API change

Oh we only need clang/lld/lldb to work, I'll check this before committing.

(you should request commit access to Chris)

@mehdi_amini I have a few validation issues, pelase wait :-)

serge-sans-paille updated this revision to Diff 92293.EditedMar 19 2017, 12:50 PM

Fixed a translation bug, some callsite relied on a conditional null value to have a dynamic behavior.

Can you rebase? I promise I'll apply it quickly after :)

rebased + @mehdi_amini tested on llvm + clang

clang-formatted and committed as r299699

This revision was automatically updated to reflect the committed changes.
This revision is now accepted and ready to land.Apr 6 2017, 1:37 PM
eugenis added a subscriber: eugenis.Apr 6 2017, 2:16 PM

It seems that these asan failures are caused by this change, too:
http://lab.llvm.org:8011/builders/llvm-hexagon-elf/builds/5163

Verified by reverting. All the asan changes in the blamelist are, surprisingly, unrelated.

Well, they are not exactly unrelated - they add a call to getOrInsertFunction which needs to lose nullptr at the end when this change is reapplied.

This revision was automatically updated to reflect the committed changes.

Commited as r299949