[llvm-commits] [compiler-rt] r157473 - /compiler-rt/trunk/lib/asan/asan_rtl.cc

Alexander Potapenko glider at google.com
Fri May 25 08:37:16 PDT 2012


Author: glider
Date: Fri May 25 10:37:16 2012
New Revision: 157473

URL: http://llvm.org/viewvc/llvm-project?rev=157473&view=rev
Log:
Factor ParseAsanOptions outside __asan_init


Modified:
    compiler-rt/trunk/lib/asan/asan_rtl.cc

Modified: compiler-rt/trunk/lib/asan/asan_rtl.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_rtl.cc?rev=157473&r1=157472&r2=157473&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_rtl.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_rtl.cc Fri May 25 10:37:16 2012
@@ -424,15 +424,7 @@
   AsanDie();
 }
 
-void __asan_init() {
-  if (asan_inited) return;
-  asan_init_is_running = true;
-
-  // Make sure we are not statically linked.
-  AsanDoesNotSupportStaticLinkage();
-
-  // flags
-  const char *options = AsanGetEnv("ASAN_OPTIONS");
+static void ParseAsanOptions(const char *options) {
   FLAG_malloc_context_size =
       IntFlagValue(options, "malloc_context_size=", kMallocContextSize);
   CHECK(FLAG_malloc_context_size <= kMallocContextSize);
@@ -476,11 +468,24 @@
 
   FLAG_quarantine_size = IntFlagValue(options, "quarantine_size=",
       (ASAN_LOW_MEMORY) ? 1UL << 24 : 1UL << 28);
+}
+
+void __asan_init() {
+  if (asan_inited) return;
+  asan_init_is_running = true;
+
+  // Make sure we are not statically linked.
+  AsanDoesNotSupportStaticLinkage();
+
+  // flags
+  const char *options = AsanGetEnv("ASAN_OPTIONS");
 
   if (FLAG_v) {
     Report("Parsed ASAN_OPTIONS: %s\n", options);
   }
 
+  ParseAsanOptions(options);
+
   if (FLAG_atexit) {
     Atexit(asan_atexit);
   }





More information about the llvm-commits mailing list