ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change
on this file since 3dafd83 was
4cb935e,
checked in by Thierry Delisle <tdelisle@…>, 8 years ago
|
0 and 1 now properly parse and resolve to zero_t and one_t respectively
|
-
Property mode set to
100644
|
File size:
1.0 KB
|
Rev | Line | |
---|
[b87a5ed] | 1 | // |
---|
| 2 | // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo |
---|
| 3 | // |
---|
| 4 | // The contents of this file are covered under the licence agreement in the |
---|
| 5 | // file "LICENCE" distributed with Cforall. |
---|
| 6 | // |
---|
[4cb935e] | 7 | // parseutility.cc -- |
---|
[b87a5ed] | 8 | // |
---|
| 9 | // Author : Rodolfo G. Esteves |
---|
| 10 | // Created On : Sat May 16 15:30:39 2015 |
---|
| 11 | // Last Modified By : Peter A. Buhr |
---|
[e82aa9df] | 12 | // Last Modified On : Sun Aug 14 23:45:03 2016 |
---|
| 13 | // Update Count : 3 |
---|
[4cb935e] | 14 | // |
---|
[b87a5ed] | 15 | |
---|
[51b7345] | 16 | #include "parseutility.h" |
---|
| 17 | #include "SynTree/Type.h" |
---|
| 18 | #include "SynTree/Expression.h" |
---|
| 19 | |
---|
[e82aa9df] | 20 | // rewrite |
---|
| 21 | // if ( x ) ... |
---|
| 22 | // as |
---|
| 23 | // if ( (int)(x != 0) ) ... |
---|
| 24 | |
---|
[bdd516a] | 25 | Expression *notZeroExpr( Expression *orig ) { |
---|
[b87a5ed] | 26 | UntypedExpr *comparison = new UntypedExpr( new NameExpr( "?!=?" ) ); |
---|
| 27 | comparison->get_args().push_back( orig ); |
---|
[4cb935e] | 28 | comparison->get_args().push_back( new ConstantExpr( Constant( new ZeroType( emptyQualifiers ), "0" ) ) ); |
---|
[b87a5ed] | 29 | return new CastExpr( comparison, new BasicType( Type::Qualifiers(), BasicType::SignedInt ) ); |
---|
[51b7345] | 30 | } |
---|
[b87a5ed] | 31 | |
---|
| 32 | // Local Variables: // |
---|
| 33 | // tab-width: 4 // |
---|
| 34 | // mode: c++ // |
---|
| 35 | // compile-command: "make install" // |
---|
| 36 | // End: // |
---|
Note: See
TracBrowser
for help on using the repository browser.