diff options
Diffstat (limited to 'libcpp')
-rw-r--r-- | libcpp/ChangeLog | 6 | ||||
-rw-r--r-- | libcpp/include/cpplib.h | 1 | ||||
-rw-r--r-- | libcpp/macro.c | 8 |
3 files changed, 15 insertions, 0 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index 70c834c..cc5d4d3 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,9 @@ +2017-11-20 David Malcolm <dmalcolm@redhat.com> + + PR c++/72786 + * include/cpplib.h (cpp_macro_definition_location): New decl. + * macro.c (cpp_macro_definition): New function. + 2017-11-13 Tom Tromey <tom@tromey.com> * pch.c (cpp_read_state): Set n__VA_OPT__. diff --git a/libcpp/include/cpplib.h b/libcpp/include/cpplib.h index 101b33a..4d04a48 100644 --- a/libcpp/include/cpplib.h +++ b/libcpp/include/cpplib.h @@ -889,6 +889,7 @@ extern const cpp_token *cpp_get_token_with_location (cpp_reader *, extern bool cpp_fun_like_macro_p (cpp_hashnode *); extern const unsigned char *cpp_macro_definition (cpp_reader *, cpp_hashnode *); +extern source_location cpp_macro_definition_location (cpp_hashnode *); extern void _cpp_backup_tokens (cpp_reader *, unsigned int); extern const cpp_token *cpp_peek_token (cpp_reader *, int); diff --git a/libcpp/macro.c b/libcpp/macro.c index bf473ea..43f2baa 100644 --- a/libcpp/macro.c +++ b/libcpp/macro.c @@ -3646,3 +3646,11 @@ cpp_macro_definition (cpp_reader *pfile, cpp_hashnode *node) *buffer = '\0'; return pfile->macro_buffer; } + +/* Get the line at which the macro was defined. */ + +source_location +cpp_macro_definition_location (cpp_hashnode *node) +{ + return node->value.macro->line; +} |