blob: a61222eb7688ece3c1ca266144276fb5d0fb8ccd [file] [log] [blame] [raw]
Matt Godbolt895bfd52019-05-30 16:33:07 -05001// Copyright (c) 2018, Compiler Explorer Authors
Partouf4cfd6ea2018-02-11 20:45:43 +01002// All rights reserved.
3//
4// Redistribution and use in source and binary forms, with or without
5// modification, are permitted provided that the following conditions are met:
6//
7// * Redistributions of source code must retain the above copyright notice,
8// this list of conditions and the following disclaimer.
9// * Redistributions in binary form must reproduce the above copyright
10// notice, this list of conditions and the following disclaimer in the
11// documentation and/or other materials provided with the distribution.
12//
13// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
14// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
17// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
23// POSSIBILITY OF SUCH DAMAGE.
Partouf4cfd6ea2018-02-11 20:45:43 +010024
Austin Morton044dcfb2020-09-26 16:59:26 -040025import { BaseDemangler } from './base';
Partouf4cfd6ea2018-02-11 20:45:43 +010026
27const LabelMetadata = [
Rubén Rincón Blanco16421302021-02-25 21:38:51 +010028 {ident: new RegExp('C1E[a-zA-Z0-9_$]*$'), description: 'complete object constructor'},
29 {ident: new RegExp('C2E[a-zA-Z0-9_$]*$'), description: 'base object constructor'},
30 {ident: new RegExp('C3E[a-zA-Z0-9_$]*$'), description: 'complete object allocating constructor'},
31 {ident: new RegExp('D0Ev$'), description: 'deleting destructor'},
32 {ident: new RegExp('D1Ev$'), description: 'complete object destructor'},
33 {ident: new RegExp('D2Ev$'), description: 'base object destructor'},
Partouf4cfd6ea2018-02-11 20:45:43 +010034];
35
Austin Morton044dcfb2020-09-26 16:59:26 -040036export class CppDemangler extends BaseDemangler {
Austin Mortonbac07fe2020-09-25 11:21:30 -040037 static get key() { return 'cpp'; }
38
Partouf90a6a952018-03-24 13:16:27 +010039 getMetadata(symbol) {
Rubén Rincón Blanco16421302021-02-25 21:38:51 +010040 return LabelMetadata.filter(metadata => metadata.ident.test(symbol));
Partouf775b5882018-03-08 17:25:07 +010041 }
Partouf4cfd6ea2018-02-11 20:45:43 +010042}