Manage preprocessor Macro objects with shared pointers

This ensures that pointers to Macros that are removed from the macro
set stay valid. Pointers to undef'd macros may need to be referred to
if reenabling the macros has been deferred.

BUG=chromium:681324
TEST=angle_unittests

Change-Id: Ibbbabbcbd6b0a84254cda717ae63712e6d404ebd
Reviewed-on: https://chromium-review.googlesource.com/427948
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/compiler/preprocessor/Macro.cpp b/src/compiler/preprocessor/Macro.cpp
index e7f2bae..6162767 100644
--- a/src/compiler/preprocessor/Macro.cpp
+++ b/src/compiler/preprocessor/Macro.cpp
@@ -24,11 +24,11 @@
     token.type = Token::CONST_INT;
     token.text = ToString(value);
 
-    Macro macro;
-    macro.predefined = true;
-    macro.type       = Macro::kTypeObj;
-    macro.name       = name;
-    macro.replacements.push_back(token);
+    std::shared_ptr<Macro> macro = std::make_shared<Macro>();
+    macro->predefined            = true;
+    macro->type                  = Macro::kTypeObj;
+    macro->name                  = name;
+    macro->replacements.push_back(token);
 
     (*macroSet)[name] = macro;
 }