[clang] 4eaa024 - APINotes: constify `dump` methods (NFC)
Saleem Abdulrasool via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 1 11:16:14 PST 2020
Author: Saleem Abdulrasool
Date: 2020-12-01T19:01:06Z
New Revision: 4eaa024863f4a86151beb7971301c6ab10a9de01
URL: https://github.com/llvm/llvm-project/commit/4eaa024863f4a86151beb7971301c6ab10a9de01
DIFF: https://github.com/llvm/llvm-project/commit/4eaa024863f4a86151beb7971301c6ab10a9de01.diff
LOG: 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.
Added:
Modified:
clang/include/clang/APINotes/Types.h
clang/lib/APINotes/APINotesTypes.cpp
Removed:
################################################################################
diff --git a/clang/include/clang/APINotes/Types.h b/clang/include/clang/APINotes/Types.h
index 3095bfbf1718..d9bf2f07291f 100644
--- a/clang/include/clang/APINotes/Types.h
+++ b/clang/include/clang/APINotes/Types.h
@@ -105,7 +105,7 @@ class CommonEntityInfo {
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 @@ class CommonTypeInfo : public CommonEntityInfo {
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 @@ class VariableInfo : public CommonEntityInfo {
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 @@ class ObjCPropertyInfo : public VariableInfo {
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 @@ class ParamInfo : public VariableInfo {
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 @@ class FunctionInfo : public CommonEntityInfo {
}
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 @@ class TypedefInfo : public CommonTypeInfo {
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) {
diff --git a/clang/lib/APINotes/APINotesTypes.cpp b/clang/lib/APINotes/APINotesTypes.cpp
index f443d90effb3..3d50ea96f144 100644
--- a/clang/lib/APINotes/APINotesTypes.cpp
+++ b/clang/lib/APINotes/APINotesTypes.cpp
@@ -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';
More information about the cfe-commits
mailing list