-
Notifications
You must be signed in to change notification settings - Fork 12.3k
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
[Minidump] Add extern template declarations for MinidumpFile::getListStream #112568
Conversation
…Stream Add extern template defs along with visibility macros to MinidumpFile::getListStream thats needed by MinidumpTest.cpp when llvm is built as shared library on windows with explicit visibility macros enabled. This is part of the work to enable LLVM_BUILD_LLVM_DYLIB and LLVM plugins on window.
@llvm/pr-subscribers-llvm-binary-utilities Author: Thomas Fransham (fsfod) ChangesAdd extern template defs along with visibility macros to MinidumpFile::getListStream that is needed by MinidumpTest.cpp when llvm is built as shared library on windows with explicit visibility macros enabled. This is part of the work to enable LLVM_BUILD_LLVM_DYLIB and LLVM plugins on window. Full diff: https://github.com/llvm/llvm-project/pull/112568.diff 2 Files Affected:
diff --git a/llvm/include/llvm/Object/Minidump.h b/llvm/include/llvm/Object/Minidump.h
index e6b21979ccaa1d..5002a2a54c7555 100644
--- a/llvm/include/llvm/Object/Minidump.h
+++ b/llvm/include/llvm/Object/Minidump.h
@@ -15,9 +15,15 @@
#include "llvm/ADT/iterator.h"
#include "llvm/BinaryFormat/Minidump.h"
#include "llvm/Object/Binary.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/Error.h"
namespace llvm {
+namespace minidump {
+struct Module;
+struct Thread;
+struct MemoryDescriptor;
+} // namespace minidump
namespace object {
/// A class providing access to the contents of a minidump file.
@@ -371,6 +377,14 @@ Expected<ArrayRef<T>> MinidumpFile::getDataSliceAs(ArrayRef<uint8_t> Data,
return ArrayRef<T>(reinterpret_cast<const T *>(Slice->data()), Count);
}
+// Needed by MinidumpTest.cpp
+extern template LLVM_TEMPLATE_ABI Expected<ArrayRef<minidump::Module>>
+ MinidumpFile::getListStream(minidump::StreamType) const;
+extern template LLVM_TEMPLATE_ABI Expected<ArrayRef<minidump::Thread>>
+ MinidumpFile::getListStream(minidump::StreamType) const;
+extern template LLVM_TEMPLATE_ABI Expected<ArrayRef<minidump::MemoryDescriptor>>
+ MinidumpFile::getListStream(minidump::StreamType) const;
+
} // end namespace object
} // end namespace llvm
diff --git a/llvm/lib/Object/Minidump.cpp b/llvm/lib/Object/Minidump.cpp
index fe768c4c90711b..50d4c608456900 100644
--- a/llvm/lib/Object/Minidump.cpp
+++ b/llvm/lib/Object/Minidump.cpp
@@ -98,11 +98,11 @@ Expected<ArrayRef<T>> MinidumpFile::getListStream(StreamType Type) const {
return getDataSliceAs<T>(*Stream, ListOffset, ListSize);
}
-template Expected<ArrayRef<Module>>
+template LLVM_EXPORT_TEMPLATE Expected<ArrayRef<Module>>
MinidumpFile::getListStream(StreamType) const;
-template Expected<ArrayRef<Thread>>
+template LLVM_EXPORT_TEMPLATE Expected<ArrayRef<Thread>>
MinidumpFile::getListStream(StreamType) const;
-template Expected<ArrayRef<MemoryDescriptor>>
+template LLVM_EXPORT_TEMPLATE Expected<ArrayRef<MemoryDescriptor>>
MinidumpFile::getListStream(StreamType) const;
Expected<ArrayRef<uint8_t>> MinidumpFile::getDataSlice(ArrayRef<uint8_t> Data,
|
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 was just me trying to reduce the size of the header. I may have been too clever about that.
The function itself is not that big, and there's no reason why it has to be in the cpp file. Would moving the function definition to the header be a better solution?
Yes that could work. |
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.
Yes that could work.
Okay, then I'm going to leave it up to you to choose which one is better. I'm totally fine with moving the function to the header.
llvm/include/llvm/Object/Minidump.h
Outdated
@@ -371,6 +377,14 @@ Expected<ArrayRef<T>> MinidumpFile::getDataSliceAs(ArrayRef<uint8_t> Data, | |||
return ArrayRef<T>(reinterpret_cast<const T *>(Slice->data()), Count); | |||
} | |||
|
|||
// Needed by MinidumpTest.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.
Can we remove this? This is bound to get out of date over time. (In fact it's probably out of date already, as I suspect lldb needs this as well, but nobody is building it in a configuration where it matters).
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/52/builds/3417 Here is the relevant piece of the build log for the reference
|
…of extern template (llvm#112568) This is part of the work to enable LLVM_BUILD_LLVM_DYLIB and LLVM plugins on window.
…of extern template (llvm#112568) This is part of the work to enable LLVM_BUILD_LLVM_DYLIB and LLVM plugins on window.
…of extern template (llvm#112568) This is part of the work to enable LLVM_BUILD_LLVM_DYLIB and LLVM plugins on window.
Add extern template defs along with visibility macros to MinidumpFile::getListStream that is needed by MinidumpTest.cpp when llvm is built as shared library on windows with explicit visibility macros enabled.
This is part of the work to enable LLVM_BUILD_LLVM_DYLIB and LLVM plugins on window.