Skip to content

Commit e9b9384

Browse files
author
Yihao Wu
committed
Add main_input_filename
We definitely want to know the filename we are compiling. Signed-off-by: Yihao Wu <[email protected]>
1 parent a8373e2 commit e9b9384

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

gcc-python.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,12 @@ PyGcc_dump(PyObject *self, PyObject *arg)
371371
Py_RETURN_NONE;
372372
}
373373

374+
static PyObject *
375+
PyGcc_get_main_input_filename(PyObject *self, PyObject *args)
376+
{
377+
return PyGccStringOrNone(main_input_filename);
378+
}
379+
374380
static PyObject *
375381
PyGcc_get_dump_file_name(PyObject *self, PyObject *noargs)
376382
{
@@ -494,6 +500,9 @@ static PyMethodDef GccMethods[] = {
494500
{"get_callgraph_nodes", PyGcc_get_callgraph_nodes, METH_VARARGS,
495501
"Get a list of all gcc.CallgraphNode instances"},
496502

503+
{"get_main_input_filename", PyGcc_get_main_input_filename, METH_NOARGS,
504+
"Get main_input_filename"},
505+
497506
/* Dump files */
498507
{"dump", PyGcc_dump, METH_O,
499508
"Dump str() of the argument to the current dump file (or silently discard it when no dump file is open)"},

0 commit comments

Comments
 (0)