[clang] 4d80dff - int -> uintptr_t to silence diagnostics

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 10 10:57:32 PDT 2024


Author: Aaron Ballman
Date: 2024-04-10T13:57:18-04:00
New Revision: 4d80dff819d1164775d0d55fc68bffedb90ba53c

URL: https://github.com/llvm/llvm-project/commit/4d80dff819d1164775d0d55fc68bffedb90ba53c
DIFF: https://github.com/llvm/llvm-project/commit/4d80dff819d1164775d0d55fc68bffedb90ba53c.diff

LOG: int -> uintptr_t to silence diagnostics

'int' may not be sufficiently large to store a pointer representation
anyway, so this is also a correctness fix.

Added: 
    

Modified: 
    clang/lib/AST/Interp/FunctionPointer.h

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/Interp/FunctionPointer.h b/clang/lib/AST/Interp/FunctionPointer.h
index e7fad8161fd9cb..f61f9ded0bf000 100644
--- a/clang/lib/AST/Interp/FunctionPointer.h
+++ b/clang/lib/AST/Interp/FunctionPointer.h
@@ -24,7 +24,7 @@ class FunctionPointer final {
 public:
   // FIXME: We might want to track the fact that the Function pointer
   // has been created from an integer and is most likely garbage anyway.
-  FunctionPointer(int IntVal = 0, const Descriptor *Desc = nullptr)
+  FunctionPointer(uintptr_t IntVal = 0, const Descriptor *Desc = nullptr)
       : Func(reinterpret_cast<const Function *>(IntVal)) {}
 
   FunctionPointer(const Function *Func) : Func(Func) { assert(Func); }


        


More information about the cfe-commits mailing list