[PATCH] D30022: [XRay][compiler-rt] Allow for defining defaults at compile-time

Dean Michael Berris via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 17 10:42:11 PST 2017


dberris updated this revision to Diff 88919.
dberris added a comment.

Fix order of applying the overrides


https://reviews.llvm.org/D30022

Files:
  lib/xray/xray_flags.cc


Index: lib/xray/xray_flags.cc
===================================================================
--- lib/xray/xray_flags.cc
+++ lib/xray/xray_flags.cc
@@ -37,6 +37,16 @@
 #undef XRAY_FLAG
 }
 
+static const char *useCompilerDefinedFlags() {
+#ifdef XRAY_DEFAULT_OPTIONS
+#define XRAY_STRINGIZE(x) #x
+#define XRAY_STRINGIZE_OPTIONS(options) XRAY_STRINGIZE(options)
+  return XRAY_STRINGIZE_OPTIONS(XRAY_DEFAULT_OPTIONS);
+#else
+  return "";
+#endif
+}
+
 void initializeFlags() XRAY_NEVER_INSTRUMENT {
   SetCommonFlagsDefaults();
   auto *F = flags();
@@ -46,9 +56,14 @@
   registerXRayFlags(&XRayParser, F);
   RegisterCommonFlags(&XRayParser);
 
-  // Override from command line.
+  // Use options defaulted at compile-time for the runtime.
+  const char *XRayCompileFlags = useCompilerDefinedFlags();
+  XRayParser.ParseString(XRayCompileFlags);
+
+  // Override from environment variables.
   XRayParser.ParseString(GetEnv("XRAY_OPTIONS"));
 
+  // Override from command line.
   InitializeCommonFlags();
 
   if (Verbosity())


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30022.88919.patch
Type: text/x-patch
Size: 1034 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170217/ff8a8044/attachment.bin>


More information about the llvm-commits mailing list