-
Notifications
You must be signed in to change notification settings - Fork 80
Update the Import Script to Include Windows Headers #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Indexstore includes |
Instead of moving the import script, I suggest using a different name for the directory containing the files. That will also make it a lot easier to review the changes to that script. |
Alright, modified this one to just be the import script changes. I should be much easier to read now. |
lib/LLVMSupport/Support/Process.cpp
Outdated
@@ -1,3 +1,4 @@ | |||
#define LLVM_ENABLE_CRASH_DUMPS false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the change that was required? It should go into config.h
.
Utilities/import-llvm
Outdated
|
||
# ADT "Small" structures. | ||
ADT_imports += ['SmallPtrSet', 'SmallSet', 'SmallString', 'SmallVector'] | ||
|
||
# ADT Algorithms. | ||
ADT_imports += ['edit_distance'] | ||
|
||
Demangle_imports = ['Demangle', 'ItaniumDemangle', 'MicrosoftDemangle', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What pulled in the demangler?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Support/Unix/Signals.inc
includes Demangle.h
it uses it to demangle symbols when printing backtraces.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, this was apparently one of the modifications to the files that we warned about at the top of the import script:
char* d = nullptr;//itaniumDemangle(dlinfo.dli_sname, nullptr, nullptr, &res);
I don't think we want to pull in the demangler.
os.symlink(os.path.join('..', '..', '..', 'include', 'llvm'), | ||
os.path.join(sourcekit_llvm_lib, 'include', 'llvm')) | ||
os.symlink(os.path.join('..', '..', '..', 'include', 'llvm-c'), | ||
os.path.join(sourcekit_llvm_lib, 'include', 'llvm-c')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could these symlinks be done by looping over the directories instead of listing them out manually? It's really hard to tell if these are correct by inspection.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cleaned these up a bit, I didn't need as many as I thought I did.
Utilities/import-llvm
Outdated
copyfile(os.path.join(sourcekit_srcroot, 'include', 'llvm', 'Support', 'AArch64TargetParser.def'), | ||
os.path.join(def_location, 'AArch64TargetParser.def')) | ||
|
||
# Process.cpp uses LLVM_ENABLE_CRASH_DUMPS which is usually set in CMake. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be in config.h. In general, it would be good to look at a new config.h from an llvm build, although it will need to be merged manually with what's here, which is already customized. But that more general change doesn't need to happen in this PR.
Utilities/import-llvm
Outdated
if os.path.exists(def_location): | ||
shutil.rmtree(def_location) | ||
os.makedirs(def_location) | ||
copyfile(os.path.join(sourcekit_srcroot, 'include', 'llvm', 'Support', 'AArch64TargetParser.def'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the original location get looked at? If not, we could move instead of copy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move it is!
Utilities/import-llvm
Outdated
'Statistic', 'StringExtras', 'STLExtras', 'AllocatorList', 'Triple'] | ||
ADT_imports = ['iterator', 'iterator_range', 'APFloat', 'APInt', 'APSInt', | ||
'AllocatorList', 'EpochTracker', 'Hashing', 'None', 'Optional', | ||
'Statistic', 'StringExtras', 'STLExtras'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These lists are getting quite messy. I think we're better off just making each variable into a single list, and putting every dependency on its own line. That will make it much easier to see changes in the future. Splitting it up "thematically" like this made more sense when we had fewer imports and you could still conceivable eyeball changes.
161f73d
to
f2f1c1b
Compare
The TimeValue changes seem to be here too. |
'FormatVariadicDetails', 'NativeFormatting', 'DJB', 'ReverseIteration', 'MD5', | ||
'SmallVectorMemoryBuffer', 'WithColor', 'Options', 'PrettyStackTrace', 'Watchdog', | ||
'TargetParser', 'ARMBuildAttributes', 'ARMTargetParser.def', 'AArch64TargetParser.def', 'X86TargetParser.def', 'LineIterator'] | ||
'AArch64TargetParser', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Praise be M-x sort-lines
Had them in the branch to make sure things compiled, rebased off master, gone now. |
Utilities/import-llvm
Outdated
'Process', | ||
'Program', | ||
'Recycler', | ||
'Regex', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is pulling in Regex (and all the reg* files below)? If possible it would be nice to avoid this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Timer -> YAML (so it can print JSON) -> Regex. It's just one function that indexstoredb doesn't use, so it could be commented out/removed.
558d1e0
to
c54f669
Compare
Alright, added in some super gross sed calls so that Demangle and Regex don't need to be imported. |
Utilities/import-llvm
Outdated
|
||
# Timer.cpp and Statistics.cpp use YAMLTraits to assert some JSON is valid. We don't want to | ||
# pull in the YAML/Regex so we'll remove the "offending" lines. | ||
timer_location = os.path.join(sourcekit_srcroot, 'lib', 'LLVMSupport', 'Support', 'Timer.cpp') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yikes, this is pretty gross. Could we use a patch file instead of doing this with sed
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, that seems like a much nice way to do it.
Additionally, update it so that it's compatibile with the current stable branch (ab94816b593daf1c623322b0fb981abb0b156833)
Ping on this one |
Apologies, this PR slipped my mind, and I've already gone ahead and imported a new llvm here: #18 I introduced a patch file to avoid adding the regex dependency and to fix include errors (ideally the patch file changes should go to llvm upstream). I avoided adding the demangle dependency by adding a dummy Demangle.h I also added the Windows support files. |
Update the import script and run it to import a new version of llvm. The only file changes are in the first commit. Everything in the second commit should be identical to swift llvm commit ab94816b593daf1c623322b0fb981abb0b156833 except for llvm/Support/Process.cpp with required some hacks in the import-llvm script.