Subzero: Reduce the amount of #ifdef'd code.
Try to make most #ifdef'd code be compiled under all configurations,
to catch code rot earlier. When #ifdef code is required, try to use
it only to guard trivial code like "return;".
BUG= none
R=jpp@chromium.org
Review URL: https://codereview.chromium.org/1197863003
diff --git a/src/PNaClTranslator.cpp b/src/PNaClTranslator.cpp
index cb05493..dfc3fb7 100644
--- a/src/PNaClTranslator.cpp
+++ b/src/PNaClTranslator.cpp
@@ -80,14 +80,14 @@
};
Ice::Ostream &operator<<(Ice::Ostream &Stream, const ExtendedType &Ty) {
- if (!ALLOW_DUMP)
+ if (!Ice::BuildDefs::dump())
return Stream;
Ty.dump(Stream);
return Stream;
}
Ice::Ostream &operator<<(Ice::Ostream &Stream, ExtendedType::TypeKind Kind) {
- if (!ALLOW_DUMP)
+ if (!Ice::BuildDefs::dump())
return Stream;
Stream << "ExtendedType::";
switch (Kind) {
@@ -136,7 +136,7 @@
};
void ExtendedType::dump(Ice::Ostream &Stream) const {
- if (!ALLOW_DUMP)
+ if (!Ice::BuildDefs::dump())
return;
Stream << Kind;
switch (Kind) {
@@ -1564,7 +1564,7 @@
void dumpVectorIndexCheckValue(raw_ostream &Stream,
VectorIndexCheckValue Value) const {
- if (!ALLOW_DUMP)
+ if (!Ice::BuildDefs::dump())
return;
switch (Value) {
case VectorIndexNotVector:
@@ -2838,7 +2838,7 @@
return;
Ice::Operand *Op = getFunctionParser()->getOperand(Index);
if (Ice::Variable *V = dyn_cast<Ice::Variable>(Op)) {
- if (ALLOW_DUMP) {
+ if (Ice::BuildDefs::dump()) {
std::string Nm(Name.data(), Name.size());
V->setName(getFunctionParser()->getFunc(), Nm);
}
@@ -2856,7 +2856,7 @@
return;
}
std::string Nm(Name.data(), Name.size());
- if (ALLOW_DUMP)
+ if (Ice::BuildDefs::dump())
getFunctionParser()->getFunc()->getNodes()[Index]->setName(Nm);
}