[llvm-commits] [hlvm] r38072 - in /hlvm/trunk/hlvm: AST/Bundle.cpp AST/ContainerType.cpp AST/Function.cpp AST/Node.cpp AST/Node.h AST/Type.cpp Base/Assert.h Base/Memory.cpp Reader/XML/XMLReader.cpp Writer/XML/XMLWriter.cpp

Chris Lattner clattner at apple.com
Sat Jul 7 23:38:21 PDT 2007


On Jul 7, 2007, at 4:59 PM, Reid Spencer wrote:

> +#ifndef HLVM_BASE_ASSERT_H
> +#define HLVM_BASE_ASSERT_H
> +
> +#ifdef HLVM_ASSERT
> +#include <cassert>
> +#endif
> +/// This  macro enforces any expression that the programmer cares to
> +/// assert at the point in the program where the macro is used.  
> The argument
> +/// can be any valid logical expression that can be used with  
> the ! operator.
> +/// Note that the exception thrown will contain the text of the  
> expression so
> +/// that it will be easier to identify which condition failed.  
> Watch out for
> +/// side effects of the expression! Do all assignments before the  
> assertion!
> +/// @param expr Any logic expression to be tested. The macro  
> throws if the expression evaluates to false.
> +/// @brief Check an arbitrary expression for truth.
> +#ifdef HLVM_ASSERT
> +#define hlvmAssert( expr ) assert(expr)
> +#else
> +#define hlvmAssert( expr ) {}
> +#endif

This seems pretty silly.  What is the value in this?  Note that your  
current definition of hlvmAssert won't work if you have a comma  
expression.

-Chris



More information about the llvm-commits mailing list