diff options
Diffstat (limited to 'libcpp')
-rw-r--r-- | libcpp/ChangeLog | 8 | ||||
-rw-r--r-- | libcpp/include/line-map.h | 22 | ||||
-rw-r--r-- | libcpp/line-map.c | 3 |
3 files changed, 32 insertions, 1 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index 8032d7c..13a33c3 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,11 @@ +2017-06-09 David Malcolm <dmalcolm@redhat.com> + + * include/line-map.h + (rich_location::fixits_cannot_be_auto_applied): New method. + (rich_location::fixits_can_be_auto_applied_p): New accessor. + (rich_location::m_fixits_cannot_be_auto_applied): New field. + * line-map.c (rich_location::rich_location): Initialize new field. + 2017-06-05 David Malcolm <dmalcolm@redhat.com> * include/cpplib.h (struct cpp_callbacks): Add "comment" diff --git a/libcpp/include/line-map.h b/libcpp/include/line-map.h index 90d65d7..be3041d 100644 --- a/libcpp/include/line-map.h +++ b/libcpp/include/line-map.h @@ -1663,6 +1663,27 @@ class rich_location fixit_hint *get_last_fixit_hint () const; bool seen_impossible_fixit_p () const { return m_seen_impossible_fixit; } + /* Set this if the fix-it hints are not suitable to be + automatically applied. + + For example, if you are suggesting more than one + mutually exclusive solution to a problem, then + it doesn't make sense to apply all of the solutions; + manual intervention is required. + + If set, then the fix-it hints in the rich_location will + be printed, but will not be added to generated patches, + or affect the modified version of the file. */ + void fixits_cannot_be_auto_applied () + { + m_fixits_cannot_be_auto_applied = true; + } + + bool fixits_can_be_auto_applied_p () const + { + return !m_fixits_cannot_be_auto_applied; + } + private: bool reject_impossible_fixit (source_location where); void stop_supporting_fixits (); @@ -1686,6 +1707,7 @@ protected: semi_embedded_vec <fixit_hint *, MAX_STATIC_FIXIT_HINTS> m_fixit_hints; bool m_seen_impossible_fixit; + bool m_fixits_cannot_be_auto_applied; }; /* A fix-it hint: a suggested insertion, replacement, or deletion of text. diff --git a/libcpp/line-map.c b/libcpp/line-map.c index c4b7cb2..5caaf6b 100644 --- a/libcpp/line-map.c +++ b/libcpp/line-map.c @@ -2012,7 +2012,8 @@ rich_location::rich_location (line_maps *set, source_location loc) : m_column_override (0), m_have_expanded_location (false), m_fixit_hints (), - m_seen_impossible_fixit (false) + m_seen_impossible_fixit (false), + m_fixits_cannot_be_auto_applied (false) { add_range (loc, true); } |