Add support for assertions in llvm-rs-cc.
Bug: 3430674
Change-Id: I3400238652449cde84275cc2a770f405332d9544
diff --git a/slang_rs_export_element.cpp b/slang_rs_export_element.cpp
index 78675be..9887f0b 100644
--- a/slang_rs_export_element.cpp
+++ b/slang_rs_export_element.cpp
@@ -22,6 +22,7 @@
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/IdentifierTable.h"
+#include "slang_assert.h"
#include "slang_rs_context.h"
#include "slang_rs_export_type.h"
@@ -67,7 +68,7 @@
if (!Initialized)
Init();
- assert(EI != NULL && "Element info not found");
+ slangAssert(EI != NULL && "Element info not found");
if (!RSExportType::NormalizeType(T, TypeName, NULL, NULL, NULL))
return NULL;
@@ -75,8 +76,8 @@
switch (T->getTypeClass()) {
case clang::Type::Builtin:
case clang::Type::Pointer: {
- assert(EI->vsize == 1 && "Element not a primitive class (please check "
- "your macro)");
+ slangAssert(EI->vsize == 1 && "Element not a primitive class (please "
+ "check your macro)");
RSExportPrimitiveType *EPT =
RSExportPrimitiveType::Create(Context,
T,
@@ -84,13 +85,13 @@
EI->kind,
EI->normalized);
// Verify
- assert(EI->type == EPT->getType() && "Element has unexpected type");
+ slangAssert(EI->type == EPT->getType() && "Element has unexpected type");
ET = EPT;
break;
}
case clang::Type::ExtVector: {
- assert(EI->vsize > 1 && "Element not a vector class (please check your "
- "macro)");
+ slangAssert(EI->vsize > 1 && "Element not a vector class (please check "
+ "your macro)");
RSExportVectorType *EVT =
RSExportVectorType::Create(Context,
static_cast<clang::ExtVectorType*>(
@@ -100,9 +101,9 @@
EI->kind,
EI->normalized);
// Verify
- assert(EI->type == EVT->getType() && "Element has unexpected type");
- assert(EI->vsize == EVT->getNumElement() && "Element has unexpected size "
- "of vector");
+ slangAssert(EI->type == EVT->getType() && "Element has unexpected type");
+ slangAssert(EI->vsize == EVT->getNumElement() && "Element has unexpected "
+ "size of vector");
ET = EVT;
break;
}