[llvm] a29e85d - [llvm-exegesis] Change preprocessor directives for getCurrentTID

Aiden Grossman via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 16 00:44:26 PDT 2024


Author: Aiden Grossman
Date: 2024-04-16T07:44:14Z
New Revision: a29e85d6626aae7dba44c66ee5b703d3ab5de41c

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

LOG: [llvm-exegesis] Change preprocessor directives for getCurrentTID

This patch changes the preprocessor directives surrounding
getCurrentTID, particularly moving it out of the block that is only
defined when not building for Android. The getCurrentTID function is
called in places that only require Linux definitions, so this function
should have the same preprocessor scoping around it to prevent link time
failures.

Added: 
    

Modified: 
    llvm/tools/llvm-exegesis/lib/SubprocessMemory.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/tools/llvm-exegesis/lib/SubprocessMemory.cpp b/llvm/tools/llvm-exegesis/lib/SubprocessMemory.cpp
index 0a947f6e206fef..4699fbbea5def0 100644
--- a/llvm/tools/llvm-exegesis/lib/SubprocessMemory.cpp
+++ b/llvm/tools/llvm-exegesis/lib/SubprocessMemory.cpp
@@ -22,7 +22,7 @@
 namespace llvm {
 namespace exegesis {
 
-#if defined(__linux__) && !defined(__ANDROID__)
+#if defined(__linux__)
 
 long SubprocessMemory::getCurrentTID() {
   // We're using the raw syscall here rather than the gettid() function provided
@@ -31,6 +31,8 @@ long SubprocessMemory::getCurrentTID() {
   return syscall(SYS_gettid);
 }
 
+#if !defined(__ANDROID__)
+
 Error SubprocessMemory::initializeSubprocessMemory(pid_t ProcessID) {
   // Add the PID to the shared memory name so that if we're running multiple
   // processes at the same time, they won't interfere with each other.
@@ -157,7 +159,8 @@ Expected<int> SubprocessMemory::setupAuxiliaryMemoryInSubprocess(
 
 SubprocessMemory::~SubprocessMemory() {}
 
-#endif // defined(__linux__) && !defined(__ANDROID__)
+#endif // !defined(__ANDROID__)
+#endif // defined(__linux__)
 
 } // namespace exegesis
 } // namespace llvm


        


More information about the llvm-commits mailing list