Implement one-definition-rule (ODR) feature.
When compiling multiple RS files, we say two RS files A and B break ODR
iff:
1. They have at least one common struct named [S] and [S] will be reflected
to ScriptField_[S].java, and
2. [S] defined in A is not *exactly the same* (number of fields, field
type and field name) as the one defined in B.
This CL detects such error.
diff --git a/slang.h b/slang.h
index 96a1390..ea33567 100644
--- a/slang.h
+++ b/slang.h
@@ -71,6 +71,8 @@
} OutputType;
private:
+ bool mInitialized;
+
// The diagnostics engine instance (for status reporting during compilation)
llvm::IntrusiveRefCntPtr<clang::Diagnostic> mDiagnostics;
// The clients of diagnostics engine. The ownership is taken by the
@@ -151,8 +153,10 @@
static void GlobalInitialization();
- Slang(const std::string &Triple, const std::string &CPU,
- const std::vector<std::string> &Features);
+ Slang();
+
+ void init(const std::string &Triple, const std::string &CPU,
+ const std::vector<std::string> &Features);
bool setInputSource(llvm::StringRef InputFile, const char *Text,
size_t TextLength);