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_rs_export_func.cpp b/slang_rs_export_func.cpp
index f729c12..ba83290 100644
--- a/slang_rs_export_func.cpp
+++ b/slang_rs_export_func.cpp
@@ -112,7 +112,7 @@
return false;
const llvm::StructLayout *ParamTySL =
- mContext->getTargetData()->getStructLayout(ParamTy);
+ getRSContext()->getTargetData()->getStructLayout(ParamTy);
unsigned Index = 0;
for (RSExportRecordType::const_field_iterator FI = ERT->fields_begin(),
@@ -135,7 +135,7 @@
// Check size
size_t T1Size = RSExportType::GetTypeAllocSize(F->getType());
- size_t T2Size = mContext->getTargetData()->getTypeAllocSize(T2);
+ size_t T2Size = getRSContext()->getTargetData()->getTypeAllocSize(T2);
if (T1Size != T2Size)
return false;