Skip to content

[BOLT] Add getter for optional relocations #133085

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

paschalis-mpeis
Copy link
Member

Minor refactoring on comments.

Minor refactoring on comments.
@paschalis-mpeis paschalis-mpeis marked this pull request as ready for review March 26, 2025 13:51
@paschalis-mpeis
Copy link
Member Author

Adds the isOptional getter, which I forgot to add in #131638. User will be:

(cc: @maksfb)

@llvmbot llvmbot added the BOLT label Mar 26, 2025
@llvmbot
Copy link
Member

llvmbot commented Mar 26, 2025

@llvm/pr-subscribers-bolt

Author: Paschalis Mpeis (paschalis-mpeis)

Changes

Minor refactoring on comments.


Full diff: https://github.com/llvm/llvm-project/pull/133085.diff

1 Files Affected:

  • (modified) bolt/include/bolt/Core/Relocation.h (+4-3)
diff --git a/bolt/include/bolt/Core/Relocation.h b/bolt/include/bolt/Core/Relocation.h
index 9292d0496d658..78e94cd63829d 100644
--- a/bolt/include/bolt/Core/Relocation.h
+++ b/bolt/include/bolt/Core/Relocation.h
@@ -57,7 +57,8 @@ class Relocation {
   uint32_t Type;
 
 private:
-  /// Relocations added by optimizations can be optional.
+  /// Relocations added by optimizations can be optional, meaning they can be
+  /// omitted under certain circumstances.
   bool Optional = false;
 
 public:
@@ -72,10 +73,10 @@ class Relocation {
   /// Return size in bytes of the given relocation \p Type.
   static size_t getSizeForType(uint32_t Type);
 
-  /// Some relocations added by optimizations are optional, meaning they can be
-  /// omitted under certain circumstances.
   void setOptional() { Optional = true; }
 
+  bool isOptional() { return Optional; }
+
   /// Return size of this relocation.
   size_t getSize() const { return getSizeForType(Type); }
 

@paschalis-mpeis paschalis-mpeis merged commit 4277255 into main Mar 28, 2025
14 checks passed
@paschalis-mpeis paschalis-mpeis deleted the users/paschalis-mpeis/relocation-optional-getter branch March 28, 2025 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants