diff options
author | Rico Tzschichholz <ricotz@ubuntu.com> | 2021-11-15 20:43:19 +0100 |
---|---|---|
committer | Rico Tzschichholz <ricotz@ubuntu.com> | 2021-11-15 20:43:19 +0100 |
commit | 5b6345a6386b05aaf3f11cb3572940413eb878a8 (patch) | |
tree | 5c7e8d78df6d8eb9694bfebc75337708ccf62761 /ccode | |
parent | 9dff977bed612cbb76807d80571a3029ae9aed13 (diff) | |
download | vala-5b6345a6386b05aaf3f11cb3572940413eb878a8.tar.gz |
codegen: Add and use CCodeConstantIdentifier for accessing constants
If an address to a constant value is required then its identifier needs
to be used instead of referring to a temporary copy.
Fixes a regression of f1a8f2a4c6771124abd61fd0ebfa991c846575fe
Found by -fsanitize=address
Diffstat (limited to 'ccode')
-rw-r--r-- | ccode/Makefile.am | 1 | ||||
-rw-r--r-- | ccode/valaccodeconstantidentifier.vala | 35 |
2 files changed, 36 insertions, 0 deletions
diff --git a/ccode/Makefile.am b/ccode/Makefile.am index 9ba660760..c87c5dd1d 100644 --- a/ccode/Makefile.am +++ b/ccode/Makefile.am @@ -28,6 +28,7 @@ libvalaccode_la_VALASOURCES = \ valaccodecomment.vala \ valaccodeconditionalexpression.vala \ valaccodeconstant.vala \ + valaccodeconstantidentifier.vala \ valaccodecontinuestatement.vala \ valaccodedeclaration.vala \ valaccodedeclarator.vala \ diff --git a/ccode/valaccodeconstantidentifier.vala b/ccode/valaccodeconstantidentifier.vala new file mode 100644 index 000000000..0495389f1 --- /dev/null +++ b/ccode/valaccodeconstantidentifier.vala @@ -0,0 +1,35 @@ +/* valaccodeconstantidentifier.vala + * + * Copyright (C) 2021 Rico Tzschichholz + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Rico Tzschichholz <ricotz@ubuntu.com> + */ + +using GLib; + +/** + * Represents a constant identifier in the C code. + */ +public class Vala.CCodeConstantIdentifier : CCodeIdentifier { + /** + * The name of this constant identifier. + */ + public CCodeConstantIdentifier (string name) { + base (name); + } +} |