APINotes: constify `dump` methods (NFC)

This simply marks the functions as const as they do not mutate the
value.  This is useful for debugging iterations during development.
NFCI.
This commit is contained in:
Saleem Abdulrasool 2020-11-30 23:54:08 +00:00
parent 37340798cc
commit 4eaa024863
2 changed files with 20 additions and 20 deletions

View File

@ -105,7 +105,7 @@ public:
return *this;
}
LLVM_DUMP_METHOD void dump(llvm::raw_ostream &OS);
LLVM_DUMP_METHOD void dump(llvm::raw_ostream &OS) const;
};
inline bool operator==(const CommonEntityInfo &LHS,
@ -176,7 +176,7 @@ public:
return *this;
}
LLVM_DUMP_METHOD void dump(llvm::raw_ostream &OS);
LLVM_DUMP_METHOD void dump(llvm::raw_ostream &OS) const;
};
inline bool operator==(const CommonTypeInfo &LHS, const CommonTypeInfo &RHS) {
@ -338,7 +338,7 @@ public:
return *this;
}
LLVM_DUMP_METHOD void dump(llvm::raw_ostream &OS);
LLVM_DUMP_METHOD void dump(llvm::raw_ostream &OS) const;
};
inline bool operator==(const VariableInfo &LHS, const VariableInfo &RHS) {
@ -394,7 +394,7 @@ public:
return *this;
}
LLVM_DUMP_METHOD void dump(llvm::raw_ostream &OS);
LLVM_DUMP_METHOD void dump(llvm::raw_ostream &OS) const;
};
inline bool operator==(const ObjCPropertyInfo &LHS,
@ -464,7 +464,7 @@ public:
friend bool operator==(const ParamInfo &, const ParamInfo &);
LLVM_DUMP_METHOD void dump(llvm::raw_ostream &OS);
LLVM_DUMP_METHOD void dump(llvm::raw_ostream &OS) const;
};
inline bool operator==(const ParamInfo &LHS, const ParamInfo &RHS) {
@ -582,7 +582,7 @@ private:
}
public:
LLVM_DUMP_METHOD void dump(llvm::raw_ostream &OS);
LLVM_DUMP_METHOD void dump(llvm::raw_ostream &OS) const;
};
inline bool operator==(const FunctionInfo &LHS, const FunctionInfo &RHS) {
@ -717,7 +717,7 @@ public:
friend bool operator==(const TypedefInfo &, const TypedefInfo &);
LLVM_DUMP_METHOD void dump(llvm::raw_ostream &OS);
LLVM_DUMP_METHOD void dump(llvm::raw_ostream &OS) const;
};
inline bool operator==(const TypedefInfo &LHS, const TypedefInfo &RHS) {

View File

@ -11,7 +11,7 @@
namespace clang {
namespace api_notes {
void CommonEntityInfo::dump(llvm::raw_ostream &OS) {
void CommonEntityInfo::dump(llvm::raw_ostream &OS) const {
if (Unavailable)
OS << "[Unavailable] (" << UnavailableMsg << ")" << ' ';
if (UnavailableInSwift)
@ -23,8 +23,8 @@ void CommonEntityInfo::dump(llvm::raw_ostream &OS) {
OS << '\n';
}
void CommonTypeInfo::dump(llvm::raw_ostream &OS) {
static_cast<CommonEntityInfo &>(*this).dump(OS);
void CommonTypeInfo::dump(llvm::raw_ostream &OS) const {
static_cast<const CommonEntityInfo &>(*this).dump(OS);
if (SwiftBridge)
OS << "Swift Briged Type: " << *SwiftBridge << ' ';
if (NSErrorDomain)
@ -45,8 +45,8 @@ void ObjCContextInfo::dump(llvm::raw_ostream &OS) {
OS << '\n';
}
void VariableInfo::dump(llvm::raw_ostream &OS) {
static_cast<CommonEntityInfo &>(*this).dump(OS);
void VariableInfo::dump(llvm::raw_ostream &OS) const {
static_cast<const CommonEntityInfo &>(*this).dump(OS);
if (NullabilityAudited)
OS << "Audited Nullability: " << Nullable << ' ';
if (!Type.empty())
@ -54,23 +54,23 @@ void VariableInfo::dump(llvm::raw_ostream &OS) {
OS << '\n';
}
void ObjCPropertyInfo::dump(llvm::raw_ostream &OS) {
static_cast<VariableInfo &>(*this).dump(OS);
void ObjCPropertyInfo::dump(llvm::raw_ostream &OS) const {
static_cast<const VariableInfo &>(*this).dump(OS);
if (SwiftImportAsAccessorsSpecified)
OS << (SwiftImportAsAccessors ? "[SwiftImportAsAccessors] " : "");
OS << '\n';
}
void ParamInfo::dump(llvm::raw_ostream &OS) {
static_cast<VariableInfo &>(*this).dump(OS);
void ParamInfo::dump(llvm::raw_ostream &OS) const {
static_cast<const VariableInfo &>(*this).dump(OS);
if (NoEscapeSpecified)
OS << (NoEscape ? "[NoEscape] " : "");
OS << "RawRetainCountConvention: " << RawRetainCountConvention << ' ';
OS << '\n';
}
void FunctionInfo::dump(llvm::raw_ostream &OS) {
static_cast<CommonEntityInfo &>(*this).dump(OS);
void FunctionInfo::dump(llvm::raw_ostream &OS) const {
static_cast<const CommonEntityInfo &>(*this).dump(OS);
OS << (NullabilityAudited ? "[NullabilityAudited] " : "")
<< "RawRetainCountConvention: " << RawRetainCountConvention << ' ';
if (!ResultType.empty())
@ -97,8 +97,8 @@ void TagInfo::dump(llvm::raw_ostream &OS) {
OS << '\n';
}
void TypedefInfo::dump(llvm::raw_ostream &OS) {
static_cast<CommonTypeInfo &>(*this).dump(OS);
void TypedefInfo::dump(llvm::raw_ostream &OS) const {
static_cast<const CommonTypeInfo &>(*this).dump(OS);
if (SwiftWrapper)
OS << "Swift Type: " << static_cast<long>(*SwiftWrapper) << ' ';
OS << '\n';