[llvm] 8c7ff9d - [Metadata] Decorate methods with 'const'. NFC.

Michael Liao via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 8 11:11:26 PDT 2021


Author: Michael Liao
Date: 2021-07-08T14:11:14-04:00
New Revision: 8c7ff9da9039089a89f5b076c267a3efb5da161c

URL: https://github.com/llvm/llvm-project/commit/8c7ff9da9039089a89f5b076c267a3efb5da161c
DIFF: https://github.com/llvm/llvm-project/commit/8c7ff9da9039089a89f5b076c267a3efb5da161c.diff

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

- Minor coding style fix.

Added: 
    

Modified: 
    llvm/include/llvm/IR/Metadata.h
    llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/IR/Metadata.h b/llvm/include/llvm/IR/Metadata.h
index aac03a531c5e..c5840564454e 100644
--- a/llvm/include/llvm/IR/Metadata.h
+++ b/llvm/include/llvm/IR/Metadata.h
@@ -677,17 +677,17 @@ struct AAMDNodes {
   MDNode *NoAlias = nullptr;
 
   // 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
-  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,
   /// give the best AAMDNodes that are compatible with both (i.e. a set of
   /// nodes whose allowable aliasing conclusions are a subset of those
   /// allowable by both of the inputs). However, for efficiency
   /// reasons, do not create any new MDNodes.
-  AAMDNodes intersect(const AAMDNodes &Other) {
+  AAMDNodes intersect(const AAMDNodes &Other) const {
     AAMDNodes Result;
     Result.TBAA = Other.TBAA == TBAA ? TBAA : 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
-  /// constant offset to the start of the pointer
-  AAMDNodes shift(size_t Offset) {
+  /// constant offset to the start of the pointer.
+  AAMDNodes shift(size_t Offset) const {
     AAMDNodes Result;
-    Result.TBAA = TBAA ? ShiftTBAA(TBAA, Offset) : nullptr;
+    Result.TBAA = TBAA ? shiftTBAA(TBAA, Offset) : nullptr;
     Result.TBAAStruct =
-        TBAAStruct ? ShiftTBAAStruct(TBAAStruct, Offset) : nullptr;
+        TBAAStruct ? shiftTBAAStruct(TBAAStruct, Offset) : nullptr;
     Result.Scope = Scope;
     Result.NoAlias = NoAlias;
     return Result;

diff  --git a/llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp b/llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp
index 9f381209ef77..20d718f4fad3 100644
--- a/llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp
+++ b/llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp
@@ -738,7 +738,7 @@ void TypeBasedAAWrapperPass::getAnalysisUsage(AnalysisUsage &AU) const {
   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
   if (Offset == 0)
     return MD;
@@ -757,7 +757,7 @@ MDNode *AAMDNodes::ShiftTBAA(MDNode *MD, size_t Offset) {
   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
   if (Offset == 0)
     return MD;


        


More information about the llvm-commits mailing list