[Metadata] Decorate methods with 'const'. NFC.

- Minor coding style fix.
This commit is contained in:
Michael Liao 2021-07-08 14:05:54 -04:00
parent 9dae86ce56
commit 8c7ff9da90
2 changed files with 9 additions and 9 deletions

View File

@ -677,17 +677,17 @@ struct AAMDNodes {
MDNode *NoAlias = nullptr; MDNode *NoAlias = nullptr;
// Shift tbaa Metadata node to start off bytes later // Shift tbaa Metadata node to start off bytes later
static MDNode *ShiftTBAA(MDNode *M, size_t off); static MDNode *shiftTBAA(MDNode *M, size_t off);
// Shift tbaa.struct Metadata node to start off bytes later // Shift tbaa.struct Metadata node to start off bytes later
static MDNode *ShiftTBAAStruct(MDNode *M, size_t off); static MDNode *shiftTBAAStruct(MDNode *M, size_t off);
/// Given two sets of AAMDNodes that apply to the same pointer, /// Given two sets of AAMDNodes that apply to the same pointer,
/// give the best AAMDNodes that are compatible with both (i.e. a set of /// give the best AAMDNodes that are compatible with both (i.e. a set of
/// nodes whose allowable aliasing conclusions are a subset of those /// nodes whose allowable aliasing conclusions are a subset of those
/// allowable by both of the inputs). However, for efficiency /// allowable by both of the inputs). However, for efficiency
/// reasons, do not create any new MDNodes. /// reasons, do not create any new MDNodes.
AAMDNodes intersect(const AAMDNodes &Other) { AAMDNodes intersect(const AAMDNodes &Other) const {
AAMDNodes Result; AAMDNodes Result;
Result.TBAA = Other.TBAA == TBAA ? TBAA : nullptr; Result.TBAA = Other.TBAA == TBAA ? TBAA : nullptr;
Result.TBAAStruct = Other.TBAAStruct == TBAAStruct ? TBAAStruct : nullptr; Result.TBAAStruct = Other.TBAAStruct == TBAAStruct ? TBAAStruct : nullptr;
@ -697,12 +697,12 @@ struct AAMDNodes {
} }
/// Create a new AAMDNode that describes this AAMDNode after applying a /// Create a new AAMDNode that describes this AAMDNode after applying a
/// constant offset to the start of the pointer /// constant offset to the start of the pointer.
AAMDNodes shift(size_t Offset) { AAMDNodes shift(size_t Offset) const {
AAMDNodes Result; AAMDNodes Result;
Result.TBAA = TBAA ? ShiftTBAA(TBAA, Offset) : nullptr; Result.TBAA = TBAA ? shiftTBAA(TBAA, Offset) : nullptr;
Result.TBAAStruct = Result.TBAAStruct =
TBAAStruct ? ShiftTBAAStruct(TBAAStruct, Offset) : nullptr; TBAAStruct ? shiftTBAAStruct(TBAAStruct, Offset) : nullptr;
Result.Scope = Scope; Result.Scope = Scope;
Result.NoAlias = NoAlias; Result.NoAlias = NoAlias;
return Result; return Result;

View File

@ -738,7 +738,7 @@ void TypeBasedAAWrapperPass::getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll(); AU.setPreservesAll();
} }
MDNode *AAMDNodes::ShiftTBAA(MDNode *MD, size_t Offset) { MDNode *AAMDNodes::shiftTBAA(MDNode *MD, size_t Offset) {
// Fast path if there's no offset // Fast path if there's no offset
if (Offset == 0) if (Offset == 0)
return MD; return MD;
@ -757,7 +757,7 @@ MDNode *AAMDNodes::ShiftTBAA(MDNode *MD, size_t Offset) {
return MD; return MD;
} }
MDNode *AAMDNodes::ShiftTBAAStruct(MDNode *MD, size_t Offset) { MDNode *AAMDNodes::shiftTBAAStruct(MDNode *MD, size_t Offset) {
// Fast path if there's no offset // Fast path if there's no offset
if (Offset == 0) if (Offset == 0)
return MD; return MD;