Commit a2ec42f4 authored by Michele Alberti's avatar Michele Alberti
Browse files

Merge branch 'feature/allow-demangling-c-files' into 'stable/chromium'

Support for editing the translated C file and keeping demangling options afterwards

See merge request frama-c/frama-clang!166
parents c0dd6c74 c3fd6db0
......@@ -40,16 +40,16 @@ with `.cpp`, `.C`, `.cxx`, `.c++` or `.cc` will be treated as C++ files.
Files ending with `.ii` will be considered as already pre-processed C++ files.
Options of the plug-in are the following.
- `-cxx-demangling-full` tells Frama-C to display C++ global
identifiers with their fully-qualified name (e.g. `::A::x`)
- `-cxx-demangling-short` tells Frama-C to display global
C++ identifiers with their unqualified name (e.g. `x`)
- `-cxx-keep-mangling` tells Frama-C to display global C++
identifiers with the name they have in the C translation (e.g.
`_Z1A1x`, that allows to distinguish between overloaded symbols.
This mangled name is computed from the fully-qualified C++ name
according to the rules described in the Itanium C++ ABI. Pretty-printing
the AST with this option should result in compilable C code.
- `-cxx-unmangling key` indicates what to do when outputting a C++ symbol name.
`key` can be one the following:
- `help`: outputs a list of existing `key` with a short description
- `fully-qualified`: displays the fully qualified name (e.g. `::A::x`)
- `without-qualifier`: only display the unqualified name (e.g. `x`)
- `none`: do not any transformation, displays the name as it is stored
in Frama-C's AST (e.g. `_Z1A1x`)
- `-cxx-parseable-output` indicates that the pretty-printed code resulting
from the translation should be able to be parsed again by Frama-C.
implies `-cxx-unmangling none`
- `-cxx-cstdlib-path <path>` specifies where to look for standard
C library headers (default is the path to Frama-C's headers)
- `-cxx-c++stdlib-path <path>` specifies where to look for
......@@ -62,6 +62,12 @@ Options of the plug-in are the following.
This should only be needed if the front-end as a whole has not been installed
properly.
Older versions of the plug-in used specific options for unmangling.
These are now obsolete:
- `-cxx-demangling-full`: use `-cxx-unmangling fully-qualified`
- `-cxx-demangling-short`: use `-cxx-unmangling without-qualifier`
- `-cxx-keep-mangling`: use `-cxx-unmangling none`
In addition, any command-line option taking a function name as
argument (e.g. `-main`, `-eva-slevel-function`, ...) will accept a
fully qualified C++ name (provided it refers to an existing function
......
......@@ -2,7 +2,7 @@
/* */
/* This file is part of Frama-Clang */
/* */
/* Copyright (C) 2012-2021 */
/* Copyright (C) 2012-2022 */
/* CEA (Commissariat à l'énergie atomique et aux énergies */
/* alternatives) */
/* */
......
......@@ -2,7 +2,7 @@
/* */
/* This file is part of Frama-Clang */
/* */
/* Copyright (C) 2012-2021 */
/* Copyright (C) 2012-2022 */
/* CEA (Commissariat à l'énergie atomique et aux énergies */
/* alternatives) */
/* */
......
......@@ -2,7 +2,7 @@
/* */
/* This file is part of Frama-Clang */
/* */
/* Copyright (C) 2012-2021 */
/* Copyright (C) 2012-2022 */
/* CEA (Commissariat à l'énergie atomique et aux énergies */
/* alternatives) */
/* */
......
......@@ -2,7 +2,7 @@
/* */
/* This file is part of Frama-Clang */
/* */
/* Copyright (C) 2012-2021 */
/* Copyright (C) 2012-2022 */
/* CEA (Commissariat à l'énergie atomique et aux énergies */
/* alternatives) */
/* */
......
......@@ -2,7 +2,7 @@
(* *)
(* This file is part of Frama-Clang *)
(* *)
(* Copyright (C) 2012-2021 *)
(* Copyright (C) 2012-2022 *)
(* CEA (Commissariat à l'énergie atomique et aux énergies *)
(* alternatives) *)
(* *)
......
......@@ -2,7 +2,7 @@
(* *)
(* This file is part of Frama-Clang *)
(* *)
(* Copyright (C) 2012-2021 *)
(* Copyright (C) 2012-2022 *)
(* CEA (Commissariat à l'énergie atomique et aux énergies *)
(* alternatives) *)
(* *)
......
......@@ -2,7 +2,7 @@
# #
# This file is part of Frama-Clang #
# #
# Copyright (C) 2012-2021 #
# Copyright (C) 2012-2022 #
# CEA (Commissariat à l'énergie atomique et aux énergies #
# alternatives) #
# #
......
......@@ -2,7 +2,7 @@
(* *)
(* This file is part of Frama-Clang *)
(* *)
(* Copyright (C) 2012-2021 *)
(* Copyright (C) 2012-2022 *)
(* CEA (Commissariat à l'énergie atomique et aux énergies *)
(* alternatives) *)
(* *)
......
......@@ -2,7 +2,7 @@
(* *)
(* This file is part of Frama-Clang *)
(* *)
(* Copyright (C) 2012-2021 *)
(* Copyright (C) 2012-2022 *)
(* CEA (Commissariat à l'énergie atomique et aux énergies *)
(* alternatives) *)
(* *)
......
......@@ -2,7 +2,7 @@
(* *)
(* This file is part of Frama-Clang *)
(* *)
(* Copyright (C) 2012-2021 *)
(* Copyright (C) 2012-2022 *)
(* CEA (Commissariat à l'énergie atomique et aux énergies *)
(* alternatives) *)
(* *)
......
......@@ -2,7 +2,7 @@
(* *)
(* This file is part of Frama-Clang *)
(* *)
(* Copyright (C) 2012-2021 *)
(* Copyright (C) 2012-2022 *)
(* CEA (Commissariat à l'énergie atomique et aux énergies *)
(* alternatives) *)
(* *)
......
......@@ -2,7 +2,7 @@
(* *)
(* This file is part of Frama-Clang *)
(* *)
(* Copyright (C) 2012-2021 *)
(* Copyright (C) 2012-2022 *)
(* CEA (Commissariat à l'énergie atomique et aux énergies *)
(* alternatives) *)
(* *)
......
......@@ -2,7 +2,7 @@
(* *)
(* This file is part of Frama-Clang *)
(* *)
(* Copyright (C) 2012-2021 *)
(* Copyright (C) 2012-2022 *)
(* CEA (Commissariat à l'énergie atomique et aux énergies *)
(* alternatives) *)
(* *)
......
......@@ -2,7 +2,7 @@
(* *)
(* This file is part of Frama-Clang *)
(* *)
(* Copyright (C) 2012-2021 *)
(* Copyright (C) 2012-2022 *)
(* CEA (Commissariat à l'énergie atomique et aux énergies *)
(* alternatives) *)
(* *)
......
......@@ -2,7 +2,7 @@
(* *)
(* This file is part of Frama-Clang *)
(* *)
(* Copyright (C) 2012-2021 *)
(* Copyright (C) 2012-2022 *)
(* CEA (Commissariat à l'énergie atomique et aux énergies *)
(* alternatives) *)
(* *)
......
......@@ -2,7 +2,7 @@
(* *)
(* This file is part of Frama-Clang *)
(* *)
(* Copyright (C) 2012-2021 *)
(* Copyright (C) 2012-2022 *)
(* CEA (Commissariat à l'énergie atomique et aux énergies *)
(* alternatives) *)
(* *)
......
......@@ -2,7 +2,7 @@
(* *)
(* This file is part of Frama-Clang *)
(* *)
(* Copyright (C) 2012-2021 *)
(* Copyright (C) 2012-2022 *)
(* CEA (Commissariat à l'énergie atomique et aux énergies *)
(* alternatives) *)
(* *)
......
\newcommand{\version}{0.0.10\xspace}
\newcommand{\fclangversion}{0.0.10\xspace}
\newcommand{\fcversion}{22.x~Titanium\xspace}
\newcommand{\clangversion}{6.0-11.0\xspace}
\newcommand{\version}{0.0.11+dev\xspace}
\newcommand{\fclangversion}{0.0.11+dev\xspace}
\newcommand{\fcversion}{24.0~Chromium\xspace}
\newcommand{\clangversion}{9.0-13.0\xspace}
......@@ -3,28 +3,52 @@
% --------------------------------------------------------------------------
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{frama-c-book}[2009/02/05 LaTeX Class for Frama-C Books]
\newif\ifusecc
\usecctrue
% --------------------------------------------------------------------------
% --- Base Class management ---
% --------------------------------------------------------------------------
\LoadClass[a4paper,11pt,twoside,openright]{report}
\DeclareOption{web}{\PassOptionsToPackage{colorlinks,urlcolor=blue}{hyperref}}
\DeclareOption{paper}{\PassOptionsToPackage{pdfborder=0 0 0}{hyperref}}
\ProcessOptions
\RequirePackage{fullpage}
\RequirePackage{hevea}
\makeatletter
\RequirePackage{kvoptions}
\SetupKeyvalOptions{
family=framacbook,
prefix=framacbook@,
}
\RequirePackage{ifthen}
\DeclareVoidOption{web}{\PassOptionsToPackage{colorlinks,urlcolor=blue}{hyperref}}
\DeclareVoidOption{paper}{\PassOptionsToPackage{pdfborder=0 0 0}{hyperref}}
\DeclareStringOption[{type=CC,version=4.0,modifier=by-sa}]{license}
\DeclareStringOption[english]{lang}
\DeclareDefaultOption{\PassOptionsToClass{\CurrentOption}{report}}
\PassOptionsToClass{a4paper,11pt,twoside,openright}{report}
\ProcessKeyvalOptions*
\LoadClass{report}
\PassOptionsToPackage{\framacbook@lang}{babel}
\ifthenelse{\equal{\framacbook@license}{no}}{\useccfalse}{}
\ifusecc
\PassOptionsToPackage{\framacbook@license}{doclicense}
\fi
\RequirePackage{babel}
\RequirePackage{fullpage}
\RequirePackage{lmodern}
\RequirePackage[T1]{fontenc}
\RequirePackage[utf8]{inputenc}
\RequirePackage[a4paper,pdftex,pdfstartview=FitH]{hyperref}
\RequirePackage{amssymb}
\RequirePackage{xcolor}
\RequirePackage[table]{xcolor}
\RequirePackage[pdftex]{graphicx}
\RequirePackage{ifthen}
\RequirePackage{xspace}
\RequirePackage{makeidx}
\RequirePackage[leftbars]{changebar}
\RequirePackage[english]{babel}
\RequirePackage{fancyhdr}
\RequirePackage{titlesec}
\RequirePackage{upquote}
\RequirePackage[pdftex,pdfstartview=FitH]{hyperref}
\ifusecc\RequirePackage{doclicense}\else\fi
% --------------------------------------------------------------------------
% --- Page Layout ---
% --------------------------------------------------------------------------
......@@ -101,14 +125,49 @@
{#1}
\medskip
\ifusecc\doclicenseThis\else\fi
}
% \acknowledge{<flag image file>}{<text inside box>}
\newcommand{\acknowledge}[2]{
\fbox{
\begin{minipage}{0.97\textwidth}
\begin{minipage}{1.2cm}
\includegraphics[width=\linewidth]{#1}
\end{minipage}
\begin{minipage}{0.90\textwidth}
This project has received funding from #2.
\end{minipage}
\end{minipage}
}
}
\newcommand{\acknowledgeANR}{
\acknowledge{anr-logo.png}{the French ANR projects
CAT~(ANR-05-RNTL-00301) and U3CAT~(08-SEGI-021-01)
}
}
\newcommand{\acknowledgeEU}{
\acknowledge{eu-flag.jpg}{the
European Union's Seventh Framework Programme (FP7/2007-2013)
under grant agreement N$^\circ$\,317753 (\mbox{STANCE}).\\
It has also received funding from the Horizon 2020 research
and innovation programme, under grant agreements
N$^\circ$\,731453~(\mbox{VESSEDIA}),
N$^\circ$\,824231~(\mbox{DECODER}),
N$^\circ$\,830892~(\mbox{SPARTA}),
and N$^\circ$\,883242~(\mbox{ENSURESEC})
}
}
% --------------------------------------------------------------------------
% --- Sectionning ---
% --------------------------------------------------------------------------
\titleformat{\chapter}[display]{\Huge\raggedleft}%
{\huge\chaptertitlename\,\thechapter}{0.5em}{}
\titleformat{\section}[hang]{\Large\bfseries}{\thesection}{1em}{}%
[\vspace{-14pt}\rule{\textwidth}{0.1pt}\vspace{-8pt}]
[\vspace{-14pt}\rule{\textwidth}{0.1pt}\nopagebreak\vspace{-8pt}]
\titleformat{\subsubsection}[hang]{\bfseries}{}{}{}%
[\vspace{-8pt}]
......@@ -146,7 +205,7 @@
\definecolor{lstspecial}{rgb}{0.2,0.6,0.0}
\definecolor{lstfile}{gray}{0.85}
\newcommand{\lstbrk}{\mbox{$\color{blue}\scriptstyle\cdots$}}
\def\lp@basic{\ifmmode\normalfont\mathtt\mdseries\scriptsize\else\normalfont\ttfamily\mdseries\scriptsize\fi}
\def\lp@basic{\ifmmode\normalfont\mathtt\mdseries\small\else\normalfont\ttfamily\mdseries\small\fi}
\def\lp@inline{\ifmmode\normalfont\mathtt\scriptstyle\else\normalfont\ttfamily\mdseries\small\fi}
\def\lp@keyword{}
\def\lp@special{\color{lstfg}}
......@@ -154,6 +213,7 @@
\def\lp@string{\color{lstfg}} \def\lp@ident{}
\def\lp@number{\rmfamily\tiny\color{lstnum}}
\lstdefinestyle{frama-c-style}{%
columns=flexible,%
basicstyle=\lp@inline,%
identifierstyle=\lp@ident,%
commentstyle=\lp@comment,%
......@@ -204,8 +264,16 @@
% --- Verbatim Stuff -------------------------------------------------------
\lstdefinelanguage{Shell}[]{csh}%
{identifierstyle=\lp@basic,mathescape=false,backgroundcolor=,literate={\\\$}{\$}1}
\lstnewenvironment{shell}[1][]{\lstset{language=Shell,basicstyle=\lp@basic,#1}}{}
{escapechar=@
identifierstyle=\lp@basic,
mathescape=false,
backgroundcolor=,
literate={\\\$}{\$}1
}
\lstnewenvironment{shell}[1][]
{\lstset{language=Shell,basicstyle=\lp@basic,#1}}
{}
% ---- Stdout Stuff --------------------------------------------------------
\lstdefinelanguage{Logs}[]{csh}%
......@@ -242,7 +310,9 @@ keywordstyle=[3]\sffamily\bfseries,%
identifierstyle=\ttfamily,%
stringstyle=\ttfamily\color{lstfg},%
commentstyle=\rmfamily\bfseries\color{lsttxt},%
literate={\\\$}{\$}1,%
literate={\\\$}{\$}1%
{}{\textbackslash}1%
,%
}
% --- Configure ------------------------------------------------------------
\lstdefinelanguage{Configure}[]{csh}{%
......@@ -277,20 +347,21 @@ morekeywords=[2]{failwith,raise,when},%
morekeywords=[3]{module,struct,sig,begin,end},%
literate=%
{~}{${\scriptstyle\thicksim}$}1%
{<}{$<$}1%
{>}{$>$}1%
{->}{$\rightarrow$}1%
{<-}{$\leftarrow$}1%
{:=}{$\leftarrow$}1%
{<=}{$\leq$}1%
{>=}{$\geq$}1%
{==}{$\equiv$}1%
{!=}{$\not\equiv$}1%
{<>}{$\neq$}1%
{'a}{$\alpha$}1%
{'b}{$\beta$}1%
{'c}{$\gamma$}1%
{}{`{}}1%
{<}{$<$ }1%
{>}{$>$ }1%
{->}{$\rightarrow$ }1%
{<-}{$\leftarrow$ }1%
{:=}{$\leftarrow$ }1%
{<=}{$\leq$ }1%
{>=}{$\geq$ }1%
{==}{$\equiv$ }1%
{!=}{$\not\equiv$ }1%
{<>}{$\neq$ }1%
{'a}{$\alpha$ }1%
{'b}{$\beta$ }1%
{'c}{$\gamma$ }1%
{µ}{`{}}1%
{}{\textbackslash}1%
}
\lstdefinestyle{ocaml-basic}%
......@@ -326,7 +397,7 @@ basicstyle=\lp@inline,%
{\lstinputlisting[style=why-style,basicstyle=\lp@basic]{#1}}
\newcommand{\whyinline}[1]%
{\lstinline[style=why-style]{#1}}
\makeatother
% --------------------------------------------------------------------------
% --- End. ---
% --------------------------------------------------------------------------
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment