This is an automated email from the git hooks/post-receive script.
unknown user pushed a commit to branch aoliva/libcp1
in repository gcc.
commit 124523db34abaab48a4a9c739fd531cc819bb745
Author: Alexandre Oliva <aoliva(a)redhat.com>
Date: Fri Jul 3 13:32:24 2015 -0300
Add FIXME for cv-qualified function typedefs.
---
include/gcc-cp-fe.def | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/include/gcc-cp-fe.def b/include/gcc-cp-fe.def
index 56dc079..0dc3867 100644
--- a/include/gcc-cp-fe.def
+++ b/include/gcc-cp-fe.def
@@ -167,7 +167,12 @@ GCC_METHOD1 (int /* bool */, finish_enum_type,
/* Create a new function type. RETURN_TYPE is the type returned by
the function, and ARGUMENT_TYPES is a vector, of length NARGS, of
the argument types. IS_VARARGS is true if the function is
- varargs. */
+ varargs.
+
+ FIXME: C++ allows such stuff as "typedef int f() const;" to create
+ a cv-qualified (member) function type not associated with any
+ specific class, which can then be used to declare member functions
+ and pointers to member functions. Our API doesn't support this. */
GCC_METHOD3 (gcc_type, build_function_type,
gcc_type, /* Argument RETURN_TYPE. */
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
This is an automated email from the git hooks/post-receive script.
unknown user pushed a commit to branch aoliva/libcp1
in repository gcc.
commit 9a1acbc240767dc85d7b308834ad26a6238c5882
Author: Alexandre Oliva <aoliva(a)redhat.com>
Date: Fri Jun 12 02:10:39 2015 -0300
Fix variable-length arrays in C++
Use g++ infrastructure to save the computation of the array size,
but this is not enough. The plugin is replacing the array type
with a constant-sized array, so that building the auto array does
not confuse later passes. This unfortunately breaks the deferred
evaluation of sizeof done in C++, so I removed that, and made all
decls for which addresses are given DECL_EXTERN, so that we don't
even attempt to instantiate them.
---
libcc1/libcp1plugin.cc | 20 ++++++--------------
1 file changed, 6 insertions(+), 14 deletions(-)
diff --git a/libcc1/libcp1plugin.cc b/libcc1/libcp1plugin.cc
index a25e851..9acfe16 100644
--- a/libcc1/libcp1plugin.cc
+++ b/libcc1/libcp1plugin.cc
@@ -290,18 +290,7 @@ address_rewriter (tree *in, int *walk_subtrees, void *arg)
value.decl = *in;
decl_addr_value *found_value = ctx->address_map.find (&value);
if (found_value != NULL)
- {
- // At this point we don't need VLA sizes for gdb-supplied
- // variables, and having them here confuses later passes, so we
- // drop them.
- if (array_of_runtime_bound_p (TREE_TYPE (*in)))
- {
- TREE_TYPE (*in)
- = build_array_type_nelts (TREE_TYPE (TREE_TYPE (*in)), 1);
- DECL_SIZE (*in) = TYPE_SIZE (TREE_TYPE (*in));
- DECL_SIZE_UNIT (*in) = TYPE_SIZE_UNIT (TREE_TYPE (*in));
- }
- }
+ ;
else if (DECL_IS_BUILTIN (*in))
{
gcc_address address;
@@ -428,6 +417,7 @@ plugin_build_decl (cc1_plugin::connection *self,
{
decl_addr_value value;
+ DECL_EXTERNAL (decl) = 1;
value.decl = decl;
if (substitution_name != NULL)
{
@@ -761,10 +751,12 @@ plugin_build_vla_array_type (cc1_plugin::connection *self,
{
tree element_type = convert_in (element_type_in);
tree upper_bound = lookup_name (get_identifier (upper_bound_name));
- tree range = build_index_type (upper_bound);
+ tree size = fold_build2 (PLUS_EXPR, TREE_TYPE (upper_bound), upper_bound,
+ build_one_cst (TREE_TYPE (upper_bound)));
+ tree range = compute_array_index_type (NULL_TREE, size,
+ tf_warning_or_error);
tree result = build_cplus_array_type (element_type, range);
- // C_TYPE_VARIABLE_SIZE (result) = 1;
plugin_context *ctx = static_cast<plugin_context *> (self);
return convert_out (ctx->preserve (result));
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
This is an automated email from the git hooks/post-receive script.
unknown user pushed a commit to branch aoliva/libcp1
in repository gcc.
commit f1a88e3527ed8e1e8b21fd8bfc19a6a285284d94
Author: Alexandre Oliva <aoliva(a)redhat.com>
Date: Wed Jun 10 06:21:57 2015 -0300
Fix build_constant for C++.
C++ wants CONST_DECLs to be used for enumerators only. Define a VAR_DECL
with a READONLY and STATIC flags, and let cp_finish_decl take care of the
initialization. Then introduce the declaration like other decls, removing
the only remaining use of pushdecl_safe, so the function is removed too.
---
libcc1/libcp1plugin.cc | 26 +++++++-------------------
1 file changed, 7 insertions(+), 19 deletions(-)
diff --git a/libcc1/libcp1plugin.cc b/libcc1/libcp1plugin.cc
index b0d1cb0..a25e851 100644
--- a/libcc1/libcp1plugin.cc
+++ b/libcc1/libcp1plugin.cc
@@ -153,22 +153,6 @@ struct string_hasher : typed_noop_remove<const char>
-// A wrapper for pushdecl that doesn't let gdb have a chance to
-// instantiate a symbol.
-
-static void
-pushdecl_safe (tree decl)
-{
- void (*save) (enum cp_oracle_request, tree identifier);
-
- save = cp_binding_oracle;
- cp_binding_oracle = NULL;
- pushdecl (decl);
- cp_binding_oracle = save;
-}
-
-
-
struct plugin_context : public cc1_plugin::connection
{
plugin_context (int fd);
@@ -831,10 +815,14 @@ plugin_build_constant (cc1_plugin::connection *self, gcc_type [...]
tree type = convert_in (type_in);
cst = build_int_cst (type, value);
+ if (!TYPE_READONLY (type))
+ type = build_qualified_type (type, TYPE_QUAL_CONST);
decl = build_decl (ctx->get_source_location (filename, line_number),
- CONST_DECL, get_identifier (name), type);
- DECL_INITIAL (decl) = cst;
- pushdecl_safe (decl);
+ VAR_DECL, get_identifier (name), type);
+ TREE_STATIC (decl) = 1;
+ TREE_READONLY (decl) = 1;
+ cp_finish_decl (decl, cst, true, NULL, LOOKUP_ONLYCONVERTING);
+ pushdecl_maybe_friend (decl, false);
return 1;
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
This is an automated email from the git hooks/post-receive script.
unknown user pushed a commit to branch aoliva/libcp1
in repository gcc.
commit 9d8dd071b1ae448d6b6176d087f5943732640737
Author: Alexandre Oliva <aoliva(a)redhat.com>
Date: Fri May 22 01:45:18 2015 -0300
Fix unions (and structs), behaving more like the C++ parser
We enter the class/union scope at build_(record|union)_type, and leave
it at finish_record_or_union. Ctors, dtors and the class name defined
within the class name are probably not correctly defined because we're
still using a placeholder name, but this will have to do for now.
---
libcc1/libcp1plugin.cc | 50 +++++++++++++++-----------------------------------
1 file changed, 15 insertions(+), 35 deletions(-)
diff --git a/libcc1/libcp1plugin.cc b/libcc1/libcp1plugin.cc
index f32a2f3..30f3a57 100644
--- a/libcc1/libcp1plugin.cc
+++ b/libcc1/libcp1plugin.cc
@@ -513,16 +513,23 @@ static tree
build_anonymous_node (enum tree_code code)
{
tree node;
- if (code == RECORD_TYPE)
- node = make_class_type (code);
+ if (code != ENUMERAL_TYPE)
+ {
+ node = make_class_type (code);
+ }
else
- node = make_node (code);
- if (!name_placeholder)
+ node = cxx_make_type (code);
+ if (!name_placeholder) // FIXME: have a separate call to set scope, name and bases
name_placeholder = get_identifier ("name placeholder");
tree type_decl = build_decl (input_location, TYPE_DECL,
name_placeholder, node);
TYPE_NAME (node) = type_decl;
TYPE_STUB_DECL (node) = type_decl;
+ if (code != ENUMERAL_TYPE)
+ {
+ xref_basetypes (node, NULL);
+ begin_class_definition (node);
+ }
return node;
}
@@ -530,9 +537,7 @@ gcc_type
plugin_build_record_type (cc1_plugin::connection *self)
{
plugin_context *ctx = static_cast<plugin_context *> (self);
- tree node = build_anonymous_node (RECORD_TYPE);
- xref_basetypes (node, NULL); // for now
- return convert_out (ctx->preserve (node));
+ return convert_out (ctx->preserve (build_anonymous_node (RECORD_TYPE)));
}
gcc_type
@@ -553,8 +558,7 @@ plugin_build_add_field (cc1_plugin::connection *,
tree record_or_union_type = convert_in (record_or_union_type_in);
tree field_type = convert_in (field_type_in);
- gcc_assert (TREE_CODE (record_or_union_type) == RECORD_TYPE
- || TREE_CODE (record_or_union_type) == UNION_TYPE);
+ gcc_assert (RECORD_OR_UNION_CODE_P (TREE_CODE (record_or_union_type)));
/* Note that gdb does not preserve the location of field decls, so
we can't provide a decent location here. */
@@ -599,33 +603,9 @@ plugin_finish_record_or_union (cc1_plugin::connection *,
{
tree record_or_union_type = convert_in (record_or_union_type_in);
- gcc_assert (TREE_CODE (record_or_union_type) == RECORD_TYPE
- || TREE_CODE (record_or_union_type) == UNION_TYPE);
-
- /* We built the field list in reverse order, so fix it now. */
- TYPE_FIELDS (record_or_union_type)
- = nreverse (TYPE_FIELDS (record_or_union_type));
+ gcc_assert (RECORD_OR_UNION_CODE_P (TREE_CODE (record_or_union_type)));
- if (TREE_CODE (record_or_union_type) == UNION_TYPE)
- {
- /* Unions can just be handled by the generic code. */
- layout_type (record_or_union_type);
- }
- else
- {
- // FIXME there's no way to get this from DWARF,
- // or even, it seems, a particularly good way to deduce it.
- TYPE_ALIGN (record_or_union_type)
- = TYPE_PRECISION (pointer_sized_int_node);
-
- TYPE_SIZE (record_or_union_type) = bitsize_int (size_in_bytes
- * BITS_PER_UNIT);
- TYPE_SIZE_UNIT (record_or_union_type) = size_int (size_in_bytes);
-
- compute_record_mode (record_or_union_type);
- finish_bitfield_layout (record_or_union_type);
- // FIXME we have no idea about TYPE_PACKED
- }
+ finish_struct (record_or_union_type, NULL);
return 1;
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.