Add base::debug::Alias from Chromium base

BUG=

Change-Id: Icec290fcb2a62002725857df3472d4001cb836a2
Reviewed-on: https://chromium-review.googlesource.com/339565
Reviewed-by: Mark Mentovai <mark@chromium.org>
diff --git a/base/base.gyp b/base/base.gyp
index 0a2f2d3..3eb8c07 100644
--- a/base/base.gyp
+++ b/base/base.gyp
@@ -40,6 +40,8 @@
         'atomicops_internals_x86_msvc.h',
         'auto_reset.h',
         'compiler_specific.h',
+        'debug/alias.cc',
+        'debug/alias.h',
         'files/file_path.cc',
         'files/file_path.h',
         'files/file_util.h',
diff --git a/base/debug/alias.cc b/base/debug/alias.cc
new file mode 100644
index 0000000..f672d2b
--- /dev/null
+++ b/base/debug/alias.cc
@@ -0,0 +1,24 @@
+// Copyright 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/debug/alias.h"
+
+#include "build/build_config.h"
+
+namespace base {
+namespace debug {
+
+#if defined(COMPILER_MSVC)
+#pragma optimize("", off)
+#endif
+
+void Alias(const void* var) {
+}
+
+#if defined(COMPILER_MSVC)
+#pragma optimize("", on)
+#endif
+
+}  // namespace debug
+}  // namespace base
diff --git a/base/debug/alias.h b/base/debug/alias.h
new file mode 100644
index 0000000..66b5cd7
--- /dev/null
+++ b/base/debug/alias.h
@@ -0,0 +1,19 @@
+// Copyright 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef BASE_DEBUG_ALIAS_H_
+#define BASE_DEBUG_ALIAS_H_
+
+namespace base {
+namespace debug {
+
+// Make the optimizer think that var is aliased. This is to prevent it from
+// optimizing out variables that that would not otherwise be live at the point
+// of a potential crash.
+void Alias(const void* var);
+
+}  // namespace debug
+}  // namespace base
+
+#endif  // BASE_DEBUG_ALIAS_H_