Add support for assertions in llvm-rs-cc.
Bug: 3430674
Change-Id: I3400238652449cde84275cc2a770f405332d9544
diff --git a/slang_rs_reflection.h b/slang_rs_reflection.h
index f820e59..2f9e18c 100644
--- a/slang_rs_reflection.h
+++ b/slang_rs_reflection.h
@@ -17,7 +17,6 @@
#ifndef _FRAMEWORKS_COMPILE_SLANG_SLANG_RS_REFLECTION_H_ // NOLINT
#define _FRAMEWORKS_COMPILE_SLANG_SLANG_RS_REFLECTION_H_
-#include <cassert>
#include <fstream>
#include <iostream>
#include <map>
@@ -26,6 +25,7 @@
#include "llvm/ADT/StringExtras.h"
+#include "slang_assert.h"
#include "slang_rs_export_type.h"
namespace slang {
@@ -133,7 +133,7 @@
}
inline void decIndentLevel() {
- assert(getIndentLevel() > 0 && "No indent");
+ slangAssert(getIndentLevel() > 0 && "No indent");
mIndent.erase(0, 4);
return;
}
@@ -190,15 +190,15 @@
inline void resetFieldIndex() { mFieldIndex = 0; }
inline void addFieldIndexMapping(const RSExportRecordType::Field *F) {
- assert((mFieldIndexMap.find(F) == mFieldIndexMap.end()) &&
- "Nested structure never occurs in C language.");
+ slangAssert((mFieldIndexMap.find(F) == mFieldIndexMap.end()) &&
+ "Nested structure never occurs in C language.");
mFieldIndexMap.insert(std::make_pair(F, mFieldIndex));
}
inline unsigned getFieldIndex(const RSExportRecordType::Field *F) const {
FieldIndexMapTy::const_iterator I = mFieldIndexMap.find(F);
- assert((I != mFieldIndexMap.end()) &&
- "Requesting field is out of scope.");
+ slangAssert((I != mFieldIndexMap.end()) &&
+ "Requesting field is out of scope.");
return I->second;
}
@@ -282,7 +282,7 @@
: mRSContext(Context),
mLastError(""),
mGeneratedFileNames(GeneratedFileNames) {
- assert(mGeneratedFileNames && "Must supply GeneratedFileNames");
+ slangAssert(mGeneratedFileNames && "Must supply GeneratedFileNames");
return;
}