[PATCH] D88643: [NFC] Correct name of profile function to Profile in APValue

2020-10-15 Thread Tyker via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG53122ce2b39f: [NFC] Correct name of profile function to 
Profile in APValue (authored by Tyker).

Changed prior to commit:
  https://reviews.llvm.org/D88643?vs=295502=298330#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D88643/new/

https://reviews.llvm.org/D88643

Files:
  clang/include/clang/AST/APValue.h
  clang/lib/AST/APValue.cpp

Index: clang/lib/AST/APValue.cpp
===
--- clang/lib/AST/APValue.cpp
+++ clang/lib/AST/APValue.cpp
@@ -77,7 +77,7 @@
   return QualType::getFromOpaquePtr(DynamicAllocType);
 }
 
-void APValue::LValueBase::profile(llvm::FoldingSetNodeID ) const {
+void APValue::LValueBase::Profile(llvm::FoldingSetNodeID ) const {
   ID.AddPointer(Ptr.getOpaqueValue());
   if (is() || is())
 return;
@@ -103,7 +103,7 @@
   Value = reinterpret_cast(BaseOrMember.getOpaqueValue());
 }
 
-void APValue::LValuePathEntry::profile(llvm::FoldingSetNodeID ) const {
+void APValue::LValuePathEntry::Profile(llvm::FoldingSetNodeID ) const {
   ID.AddInteger(Value);
 }
 
@@ -414,7 +414,7 @@
   std::swap(Data, RHS.Data);
 }
 
-void APValue::profile(llvm::FoldingSetNodeID ) const {
+void APValue::Profile(llvm::FoldingSetNodeID ) const {
   ID.AddInteger(Kind);
 
   switch (Kind) {
@@ -430,10 +430,10 @@
   case Struct:
 ID.AddInteger(getStructNumBases());
 for (unsigned I = 0, N = getStructNumBases(); I != N; ++I)
-  getStructBase(I).profile(ID);
+  getStructBase(I).Profile(ID);
 ID.AddInteger(getStructNumFields());
 for (unsigned I = 0, N = getStructNumFields(); I != N; ++I)
-  getStructField(I).profile(ID);
+  getStructField(I).Profile(ID);
 return;
 
   case Union:
@@ -442,7 +442,7 @@
   return;
 }
 ID.AddPointer(getUnionField()->getCanonicalDecl());
-getUnionValue().profile(ID);
+getUnionValue().Profile(ID);
 return;
 
   case Array: {
@@ -459,9 +459,9 @@
 //   ['a', 'c', 'x', 'x', 'x'] is profiled as
 //   [5, 'x', 3, 'c', 'a']
 llvm::FoldingSetNodeID FillerID;
-(hasArrayFiller() ? getArrayFiller() :
- getArrayInitializedElt(getArrayInitializedElts() -
-   1)).profile(FillerID);
+(hasArrayFiller() ? getArrayFiller()
+  : getArrayInitializedElt(getArrayInitializedElts() - 1))
+.Profile(FillerID);
 ID.AddNodeID(FillerID);
 unsigned NumFillers = getArraySize() - getArrayInitializedElts();
 unsigned N = getArrayInitializedElts();
@@ -481,7 +481,7 @@
   // element.
   if (N != getArraySize()) {
 llvm::FoldingSetNodeID ElemID;
-getArrayInitializedElt(N - 1).profile(ElemID);
+getArrayInitializedElt(N - 1).Profile(ElemID);
 if (ElemID != FillerID) {
   ID.AddInteger(NumFillers);
   ID.AddNodeID(ElemID);
@@ -497,14 +497,14 @@
 
 // Emit the remaining elements.
 for (; N != 0; --N)
-  getArrayInitializedElt(N - 1).profile(ID);
+  getArrayInitializedElt(N - 1).Profile(ID);
 return;
   }
 
   case Vector:
 ID.AddInteger(getVectorLength());
 for (unsigned I = 0, N = getVectorLength(); I != N; ++I)
-  getVectorElt(I).profile(ID);
+  getVectorElt(I).Profile(ID);
 return;
 
   case Int:
@@ -533,7 +533,7 @@
 return;
 
   case LValue:
-getLValueBase().profile(ID);
+getLValueBase().Profile(ID);
 ID.AddInteger(getLValueOffset().getQuantity());
 ID.AddInteger(isNullPointer());
 ID.AddInteger(isLValueOnePastTheEnd());
@@ -541,7 +541,7 @@
 // to union members, but we don't have the type here so we don't know
 // how to interpret the entries.
 for (LValuePathEntry E : getLValuePath())
-  E.profile(ID);
+  E.Profile(ID);
 return;
 
   case MemberPointer:
Index: clang/include/clang/AST/APValue.h
===
--- clang/include/clang/AST/APValue.h
+++ clang/include/clang/AST/APValue.h
@@ -151,7 +151,7 @@
 static LValueBase getDynamicAlloc(DynamicAllocLValue LV, QualType Type);
 static LValueBase getTypeInfo(TypeInfoLValue LV, QualType TypeInfo);
 
-void profile(llvm::FoldingSetNodeID ) const;
+void Profile(llvm::FoldingSetNodeID ) const;
 
 template 
 bool is() const { return Ptr.is(); }
@@ -219,7 +219,7 @@
 }
 uint64_t getAsArrayIndex() const { return Value; }
 
-void profile(llvm::FoldingSetNodeID ) const;
+void Profile(llvm::FoldingSetNodeID ) const;
 
 friend bool operator==(LValuePathEntry A, LValuePathEntry B) {
   return A.Value == B.Value;
@@ -363,10 +363,10 @@
   /// Swaps the contents of this and the given APValue.
   void swap(APValue );
 
-  /// Profile this value. There is no guarantee that values of different
+  /// profile this value. There is no guarantee that values of different
   /// types will not produce the same profiled value, so the 

[PATCH] D88643: [NFC] Correct name of profile function to Profile in APValue

2020-10-07 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith accepted this revision.
rsmith added a comment.
This revision is now accepted and ready to land.

Good idea. (My use for this in class type non-type template parameters doesn't 
directly use `APValue`s as values in a folding set, but that seems like a 
reasonable use case for this functionality.)




Comment at: clang/include/clang/AST/APValue.h:366-367
   /// Profile this value. There is no guarantee that values of different
-  /// types will not produce the same profiled value, so the type should
-  /// typically also be profiled if it's not implied by the context.
-  void profile(llvm::FoldingSetNodeID ) const;
+  /// types will not produce the same Profiled value, so the type should
+  /// typically also be Profiled if it's not implied by the context.
+  void Profile(llvm::FoldingSetNodeID ) const;

These ones shouldn't be capitalized :)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D88643/new/

https://reviews.llvm.org/D88643

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D88643: [NFC] Correct name of profile function to Profile in APValue

2020-10-01 Thread Tyker via Phabricator via cfe-commits
Tyker created this revision.
Tyker added a reviewer: rsmith.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Tyker requested review of this revision.

Capitalize the profile function of APValue such that it can be used by 
FoldingSetNodeID


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D88643

Files:
  clang/include/clang/AST/APValue.h
  clang/lib/AST/APValue.cpp

Index: clang/lib/AST/APValue.cpp
===
--- clang/lib/AST/APValue.cpp
+++ clang/lib/AST/APValue.cpp
@@ -77,7 +77,7 @@
   return QualType::getFromOpaquePtr(DynamicAllocType);
 }
 
-void APValue::LValueBase::profile(llvm::FoldingSetNodeID ) const {
+void APValue::LValueBase::Profile(llvm::FoldingSetNodeID ) const {
   ID.AddPointer(Ptr.getOpaqueValue());
   if (is() || is())
 return;
@@ -103,7 +103,7 @@
   Value = reinterpret_cast(BaseOrMember.getOpaqueValue());
 }
 
-void APValue::LValuePathEntry::profile(llvm::FoldingSetNodeID ) const {
+void APValue::LValuePathEntry::Profile(llvm::FoldingSetNodeID ) const {
   ID.AddInteger(Value);
 }
 
@@ -414,7 +414,7 @@
   std::swap(Data, RHS.Data);
 }
 
-void APValue::profile(llvm::FoldingSetNodeID ) const {
+void APValue::Profile(llvm::FoldingSetNodeID ) const {
   ID.AddInteger(Kind);
 
   switch (Kind) {
@@ -430,10 +430,10 @@
   case Struct:
 ID.AddInteger(getStructNumBases());
 for (unsigned I = 0, N = getStructNumBases(); I != N; ++I)
-  getStructBase(I).profile(ID);
+  getStructBase(I).Profile(ID);
 ID.AddInteger(getStructNumFields());
 for (unsigned I = 0, N = getStructNumFields(); I != N; ++I)
-  getStructField(I).profile(ID);
+  getStructField(I).Profile(ID);
 return;
 
   case Union:
@@ -442,7 +442,7 @@
   return;
 }
 ID.AddPointer(getUnionField()->getCanonicalDecl());
-getUnionValue().profile(ID);
+getUnionValue().Profile(ID);
 return;
 
   case Array: {
@@ -459,9 +459,9 @@
 //   ['a', 'c', 'x', 'x', 'x'] is profiled as
 //   [5, 'x', 3, 'c', 'a']
 llvm::FoldingSetNodeID FillerID;
-(hasArrayFiller() ? getArrayFiller() :
- getArrayInitializedElt(getArrayInitializedElts() -
-   1)).profile(FillerID);
+(hasArrayFiller() ? getArrayFiller()
+  : getArrayInitializedElt(getArrayInitializedElts() - 1))
+.Profile(FillerID);
 ID.AddNodeID(FillerID);
 unsigned NumFillers = getArraySize() - getArrayInitializedElts();
 unsigned N = getArrayInitializedElts();
@@ -481,7 +481,7 @@
   // element.
   if (N != getArraySize()) {
 llvm::FoldingSetNodeID ElemID;
-getArrayInitializedElt(N - 1).profile(ElemID);
+getArrayInitializedElt(N - 1).Profile(ElemID);
 if (ElemID != FillerID) {
   ID.AddInteger(NumFillers);
   ID.AddNodeID(ElemID);
@@ -497,14 +497,14 @@
 
 // Emit the remaining elements.
 for (; N != 0; --N)
-  getArrayInitializedElt(N - 1).profile(ID);
+  getArrayInitializedElt(N - 1).Profile(ID);
 return;
   }
 
   case Vector:
 ID.AddInteger(getVectorLength());
 for (unsigned I = 0, N = getVectorLength(); I != N; ++I)
-  getVectorElt(I).profile(ID);
+  getVectorElt(I).Profile(ID);
 return;
 
   case Int:
@@ -533,7 +533,7 @@
 return;
 
   case LValue:
-getLValueBase().profile(ID);
+getLValueBase().Profile(ID);
 ID.AddInteger(getLValueOffset().getQuantity());
 ID.AddInteger(isNullPointer());
 ID.AddInteger(isLValueOnePastTheEnd());
@@ -541,7 +541,7 @@
 // to union members, but we don't have the type here so we don't know
 // how to interpret the entries.
 for (LValuePathEntry E : getLValuePath())
-  E.profile(ID);
+  E.Profile(ID);
 return;
 
   case MemberPointer:
Index: clang/include/clang/AST/APValue.h
===
--- clang/include/clang/AST/APValue.h
+++ clang/include/clang/AST/APValue.h
@@ -150,7 +150,7 @@
 static LValueBase getDynamicAlloc(DynamicAllocLValue LV, QualType Type);
 static LValueBase getTypeInfo(TypeInfoLValue LV, QualType TypeInfo);
 
-void profile(llvm::FoldingSetNodeID ) const;
+void Profile(llvm::FoldingSetNodeID ) const;
 
 template 
 bool is() const { return Ptr.is(); }
@@ -218,7 +218,7 @@
 }
 uint64_t getAsArrayIndex() const { return Value; }
 
-void profile(llvm::FoldingSetNodeID ) const;
+void Profile(llvm::FoldingSetNodeID ) const;
 
 friend bool operator==(LValuePathEntry A, LValuePathEntry B) {
   return A.Value == B.Value;
@@ -363,9 +363,9 @@
   void swap(APValue );
 
   /// Profile this value. There is no guarantee that values of different
-  /// types will not produce the same profiled value, so the type should
-  /// typically also be profiled if it's not implied by the context.
-  void profile(llvm::FoldingSetNodeID ) const;
+  /// types will not produce the same Profiled value, so the type should
+