gn2bp: Fix compilation of libc++

* Just addition of some required flags to compile libc++.
* rtti is needed for dynamic cast
* -fexceptions is needed to allow libc++ to throw exceptions

This isn't the best way to actually implement this as each and every target that link against libc++ will need to add those 2 flags.

Test: m cronet_aml_components_cronet_android_cronet
Change-Id: I8d76130d860919936bf316c59ded90bb0ded37ee
diff --git a/tools/gn2bp/Android.bp.swp b/tools/gn2bp/Android.bp.swp
index 2114c8c..cc629db 100644
--- a/tools/gn2bp/Android.bp.swp
+++ b/tools/gn2bp/Android.bp.swp
@@ -1942,6 +1942,10 @@
         "jni_headers",
     ],
     cpp_std: "c++20",
+    cppflags: [
+        "-fexceptions",
+    ],
+    rtti: true,
 }
 
 // GN: //components/cronet/android:cronet_jni_headers
diff --git a/tools/gn2bp/gen_android_bp b/tools/gn2bp/gen_android_bp
index c53c8ed..66a7fc7 100755
--- a/tools/gn2bp/gen_android_bp
+++ b/tools/gn2bp/gen_android_bp
@@ -119,6 +119,14 @@
             "cronet_aml_crypto_crypto",
             "cronet_aml_third_party_boringssl_boringssl",
         }),
+    ],
+    'cronet_aml_components_cronet_android_cronet': [
+        ('rtti', True),
+        ('cppflags', {
+            # TODO: figure out if there is no way around this and if this is
+            # allowed for platform code.
+            "-fexceptions",
+        })
     ]
 }
 
@@ -379,6 +387,8 @@
     self.test_suites = set()
     self.test_config = None
     self.stubs = {}
+    self.cppflags = set()
+    self.rtti = False
 
   def to_string(self, output):
     if self.comment:
@@ -421,6 +431,9 @@
     self._output_field(output, 'test_config')
     self._output_field(output, 'stubs')
     self._output_field(output, 'proto')
+    self._output_field(output, 'cppflags')
+    if self.rtti:
+      self._output_field(output, 'rtti')
 
     target_out = []
     self._output_field(target_out, 'android')