diff --git a/llvm/include/llvm/Support/YAMLTraits.h b/llvm/include/llvm/Support/YAMLTraits.h index 4487eae248237b8bbd3ffb7bd7b5751a107a3ce0..3fb1f09063ad7047fea6e6e81b29951889226cad 100644 --- a/llvm/include/llvm/Support/YAMLTraits.h +++ b/llvm/include/llvm/Support/YAMLTraits.h @@ -360,7 +360,7 @@ public: template void enumCase(T &Val, const char* Str, const T ConstVal) { - if ( matchEnumScalar(Str, (Val == ConstVal)) ) { + if ( matchEnumScalar(Str, outputting() && Val == ConstVal) ) { Val = ConstVal; } } @@ -368,14 +368,14 @@ public: // allow anonymous enum values to be used with LLVM_YAML_STRONG_TYPEDEF template void enumCase(T &Val, const char* Str, const uint32_t ConstVal) { - if ( matchEnumScalar(Str, (Val == static_cast(ConstVal))) ) { + if ( matchEnumScalar(Str, outputting() && Val == static_cast(ConstVal)) ) { Val = ConstVal; } } template void bitSetCase(T &Val, const char* Str, const T ConstVal) { - if ( bitSetMatch(Str, ((Val & ConstVal) == ConstVal)) ) { + if ( bitSetMatch(Str, outputting() && (Val & ConstVal) == ConstVal) ) { Val = Val | ConstVal; } } @@ -383,7 +383,7 @@ public: // allow anonymous enum values to be used with LLVM_YAML_STRONG_TYPEDEF template void bitSetCase(T &Val, const char* Str, const uint32_t ConstVal) { - if ( bitSetMatch(Str, ((Val & ConstVal) == ConstVal)) ) { + if ( bitSetMatch(Str, outputting() && (Val & ConstVal) == ConstVal) ) { Val = Val | ConstVal; } } @@ -423,7 +423,7 @@ private: bool Required) { void *SaveInfo; bool UseDefault; - const bool sameAsDefault = (Val == DefaultValue); + const bool sameAsDefault = outputting() && Val == DefaultValue; if ( this->preflightKey(Key, Required, sameAsDefault, UseDefault, SaveInfo) ) { yamlize(*this, Val, Required);