I was looking at the Internalize patch, and decided to clean it up a bit. The
attached patch makes two functional changes to the pass:
1. If both -internalize-public-api-file and -internalize-public-api-list
options are given on the commandline, only -file was used. Now, all
options are respected and the contents of the file merged with the items
given with the -list option(s). I think it is very confusing for users to
have commandline options ignored without any indication, especially when
it is perfectly possibly to use all options.
2. There was an odd case, when InternalizeEverything was false and the
-internalize-public-api-file was given but pointed to an empty or
nonexistent file, the InternalizeEverything option would not be respected
(ie, all globals except for main would still be internalized). This
behaviour was also different from not specifying the
-internalize-public-api-file option, in which case nothing would be
internalized (thus respecting the InternalizeEverything option). The
difference between not specifying the -file option and having an empty or
non-existent file was removed and the AllButMain option (the new name for
InternalizeEverything) is always respected.
Furthermore, this patch does some renaming and has improved comments.
Lastly, this patch adds a few testcases for the Internalize pass. The first
three RUN lines work with the orginal and modified code, the last two RUN
lines need the first functional change above.
The second functional change (or anything with AllButMain) is not tested.
internalize.diff (7.66 KB)