mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 02:33:06 +01:00
PoC for Flang Driver Plugins
This commit is contained in:
parent
e9c11e84f4
commit
c930f37268
@ -18,6 +18,7 @@
|
||||
#include "llvm/ADT/iterator_range.h"
|
||||
#include "llvm/Support/Compiler.h"
|
||||
#include "llvm/Support/DynamicLibrary.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include <memory>
|
||||
|
||||
namespace llvm {
|
||||
@ -120,7 +121,10 @@ namespace llvm {
|
||||
public:
|
||||
Add(StringRef Name, StringRef Desc)
|
||||
: Entry(Name, Desc, CtorFn), Node(Entry) {
|
||||
llvm::outs() << " -------------- (Registry) --------------\n";
|
||||
llvm::outs() << " \tAdd :: " << Name << "\n";
|
||||
add_node(&Node);
|
||||
llvm::outs() << " ------------- (\\Registry) --------------\n";
|
||||
}
|
||||
};
|
||||
};
|
||||
@ -145,8 +149,14 @@ namespace llvm {
|
||||
else \
|
||||
Head = N; \
|
||||
Tail = N; \
|
||||
llvm::outs() << " REGISTRY_CLASS :: list >> \n"; \
|
||||
for (const REGISTRY_CLASS::entry &plugin : REGISTRY_CLASS::entries()) { \
|
||||
llvm::outs() << " " << plugin.getName() << " \t-- " << plugin.getDesc() << "\n"; \
|
||||
} \
|
||||
} \
|
||||
template<typename T> typename Registry<T>::iterator Registry<T>::begin() { \
|
||||
llvm::outs() << "iterator (head)\n"; \
|
||||
llvm::outs() << Head << "\n"; \
|
||||
return iterator(Head); \
|
||||
} \
|
||||
template REGISTRY_CLASS::node *Registry<REGISTRY_CLASS::type>::Head; \
|
||||
|
@ -149,12 +149,18 @@ DynamicLibrary DynamicLibrary::getPermanentLibrary(const char *FileName,
|
||||
// ManagedStatic can be added from static constructors in HandleSet::DLOpen.
|
||||
HandleSet& HS = *OpenedHandles;
|
||||
|
||||
printf(" -------- (getPermantentLibrary) --------\n");
|
||||
printf(" get Lib: %s \n", FileName);
|
||||
|
||||
void *Handle = HandleSet::DLOpen(FileName, Err);
|
||||
if (Handle != &Invalid) {
|
||||
printf(" Handle != Invalid \n");
|
||||
SmartScopedLock<true> Lock(*SymbolsMutex);
|
||||
HS.AddLibrary(Handle, /*IsProcess*/ FileName == nullptr);
|
||||
}
|
||||
|
||||
printf(" ------- (\\getPermantentLibrary) --------\n");
|
||||
|
||||
return DynamicLibrary(Handle);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user