tree.c (cv_unqualified): New fn.
* tree.c (cv_unqualified): New fn. * cp-tree.h: Declare it. * typeck.c (decay_conversion): Use it instead of TYPE_MAIN_VARIANT. From-SVN: r153790
This commit is contained in:
parent
c86f25e8ea
commit
164247b0e2
@ -1,5 +1,9 @@
|
||||
2009-10-31 Jason Merrill <jason@redhat.com>
|
||||
|
||||
* tree.c (cv_unqualified): New fn.
|
||||
* cp-tree.h: Declare it.
|
||||
* typeck.c (decay_conversion): Use it instead of TYPE_MAIN_VARIANT.
|
||||
|
||||
* rtti.c (tinfo_name): Fix lengths for private case.
|
||||
|
||||
2009-10-31 Jason Merrill <jason@redhat.com>
|
||||
|
@ -5146,6 +5146,7 @@ extern tree move (tree);
|
||||
extern tree cp_build_qualified_type_real (tree, int, tsubst_flags_t);
|
||||
#define cp_build_qualified_type(TYPE, QUALS) \
|
||||
cp_build_qualified_type_real ((TYPE), (QUALS), tf_warning_or_error)
|
||||
extern tree cv_unqualified (tree);
|
||||
extern special_function_kind special_function_p (const_tree);
|
||||
extern int count_trees (tree);
|
||||
extern int char_type_p (tree);
|
||||
|
@ -946,6 +946,16 @@ cp_build_qualified_type_real (tree type,
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Return TYPE with const and volatile removed. */
|
||||
|
||||
tree
|
||||
cv_unqualified (tree type)
|
||||
{
|
||||
int quals = TYPE_QUALS (type);
|
||||
quals &= ~(TYPE_QUAL_CONST|TYPE_QUAL_VOLATILE);
|
||||
return cp_build_qualified_type (type, quals);
|
||||
}
|
||||
|
||||
/* Builds a qualified variant of T that is not a typedef variant.
|
||||
E.g. consider the following declarations:
|
||||
typedef const int ConstInt;
|
||||
|
@ -1691,7 +1691,7 @@ decay_conversion (tree exp)
|
||||
Non-class rvalues always have cv-unqualified types. */
|
||||
type = TREE_TYPE (exp);
|
||||
if (!CLASS_TYPE_P (type) && cp_type_quals (type))
|
||||
exp = build_nop (TYPE_MAIN_VARIANT (type), exp);
|
||||
exp = build_nop (cv_unqualified (type), exp);
|
||||
|
||||
return exp;
|
||||
}
|
||||
|
@ -1,3 +1,7 @@
|
||||
2009-10-31 Richard Guenther <rguenther@suse.de>
|
||||
|
||||
* g++.dg/tree-ssa/restrict1.C: New.
|
||||
|
||||
2009-10-31 Jason Merrill <jason@redhat.com>
|
||||
|
||||
* g++.dg/rtti/typeid9.C: New.
|
||||
|
20
gcc/testsuite/g++.dg/tree-ssa/restrict1.C
Normal file
20
gcc/testsuite/g++.dg/tree-ssa/restrict1.C
Normal file
@ -0,0 +1,20 @@
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-O2 -fdump-tree-lim-details" } */
|
||||
|
||||
struct Foo
|
||||
{
|
||||
Foo();
|
||||
Foo(const Foo&);
|
||||
int n;
|
||||
int * __restrict__ p;
|
||||
};
|
||||
void bar(Foo f, int * __restrict__ q)
|
||||
{
|
||||
for (int i = 0; i < f.n; ++i)
|
||||
{
|
||||
*q += f.p[i];
|
||||
}
|
||||
}
|
||||
|
||||
/* { dg-final { scan-tree-dump "Executing store motion" "lim1" } } */
|
||||
/* { dg-final { cleanup-tree-dump "lim1" } } */
|
Loading…
Reference in New Issue
Block a user