[compiler-rt] r262791 - [PGO] cleanup: move one support method into InstrProfilingUtil.h /NFC

Xinliang David Li via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 5 20:52:46 PST 2016


Author: davidxl
Date: Sat Mar  5 22:52:45 2016
New Revision: 262791

URL: http://llvm.org/viewvc/llvm-project?rev=262791&view=rev
Log:
[PGO] cleanup: move one support method into InstrProfilingUtil.h /NFC

Modified:
    compiler-rt/trunk/lib/profile/InstrProfilingFile.c
    compiler-rt/trunk/lib/profile/InstrProfilingUtil.c
    compiler-rt/trunk/lib/profile/InstrProfilingUtil.h

Modified: compiler-rt/trunk/lib/profile/InstrProfilingFile.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/InstrProfilingFile.c?rev=262791&r1=262790&r2=262791&view=diff
==============================================================================
--- compiler-rt/trunk/lib/profile/InstrProfilingFile.c (original)
+++ compiler-rt/trunk/lib/profile/InstrProfilingFile.c Sat Mar  5 22:52:45 2016
@@ -14,22 +14,9 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#ifdef COMPILER_RT_HAS_UNAME
-#include <sys/utsname.h>
-#endif
 
 #define UNCONST(ptr) ((void *)(uintptr_t)(ptr))
 
-#ifdef COMPILER_RT_HAS_UNAME
-int lprofGetHostName(char *Name, int Len) {
-  struct utsname N;
-  int R;
-  if (!(R = uname(&N)))
-    strncpy(Name, N.nodename, Len);
-  return R;
-}
-#endif
-
 /* Return 1 if there is an error, otherwise return  0.  */
 static uint32_t fileWriter(ProfDataIOVec *IOVecs, uint32_t NumIOVecs,
                            void **WriterCtx) {

Modified: compiler-rt/trunk/lib/profile/InstrProfilingUtil.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/InstrProfilingUtil.c?rev=262791&r1=262790&r2=262791&view=diff
==============================================================================
--- compiler-rt/trunk/lib/profile/InstrProfilingUtil.c (original)
+++ compiler-rt/trunk/lib/profile/InstrProfilingUtil.c Sat Mar  5 22:52:45 2016
@@ -19,6 +19,12 @@ int mkdir(const char*, unsigned short);
 #include <sys/types.h>
 #endif
 
+#ifdef COMPILER_RT_HAS_UNAME
+#include <sys/utsname.h>
+#endif
+
+#include <string.h>
+
 COMPILER_RT_VISIBILITY
 void __llvm_profile_recursive_mkdir(char *path) {
   int i;
@@ -47,3 +53,14 @@ uint32_t lprofBoolCmpXchg(void **Ptr, vo
 }
 #endif
 
+#ifdef COMPILER_RT_HAS_UNAME
+int lprofGetHostName(char *Name, int Len) {
+  struct utsname N;
+  int R;
+  if (!(R = uname(&N)))
+    strncpy(Name, N.nodename, Len);
+  return R;
+}
+#endif
+
+

Modified: compiler-rt/trunk/lib/profile/InstrProfilingUtil.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/InstrProfilingUtil.h?rev=262791&r1=262790&r2=262791&view=diff
==============================================================================
--- compiler-rt/trunk/lib/profile/InstrProfilingUtil.h (original)
+++ compiler-rt/trunk/lib/profile/InstrProfilingUtil.h Sat Mar  5 22:52:45 2016
@@ -20,6 +20,8 @@ void __llvm_profile_recursive_mkdir(char
 static inline char *getenv(const char *name) { return NULL; }
 #endif /* #if __PS4__ */
 
+int lprofGetHostName(char *Name, int Len);
+
 unsigned BoolCmpXchg(void **Ptr, void *OldV, void *NewV);
 
 #endif  /* PROFILE_INSTRPROFILINGUTIL_H */




More information about the llvm-commits mailing list