Add assert() statement support. Issue #106.

This commit is contained in:
Matt Pharr
2011-10-15 13:22:38 -07:00
parent 1ab05c0351
commit 422b8268a9
14 changed files with 289 additions and 3 deletions

View File

@@ -928,6 +928,13 @@ Module::execPreprocessor(const char* infilename, llvm::raw_string_ostream* ostre
FATAL("Unhandled target ISA in preprocessor symbol definition");
}
if (g->includeStdlib) {
if (g->opt.disableAsserts)
opts.addMacroDef("assert(x)=");
else
opts.addMacroDef("assert(x)=__assert(#x, x)");
}
for (unsigned int i = 0; i < g->cppArgs.size(); ++i) {
// Sanity check--should really begin with -D
if (g->cppArgs[i].substr(0,2) == "-D") {