From 1721597f0cf37a2e2cb79a1474f8fdd9624b7921 Mon Sep 17 00:00:00 2001 From: Strahinja Val Markovic Date: Mon, 7 Apr 2014 10:52:29 -0700 Subject: [PATCH] GoTo commands now work with C-family macros Fixes #758 --- cpp/ycm/ClangCompleter/TranslationUnit.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/cpp/ycm/ClangCompleter/TranslationUnit.cpp b/cpp/ycm/ClangCompleter/TranslationUnit.cpp index d169ec3a..b84fdb7a 100644 --- a/cpp/ycm/ClangCompleter/TranslationUnit.cpp +++ b/cpp/ycm/ClangCompleter/TranslationUnit.cpp @@ -33,6 +33,15 @@ using boost::remove_pointer; namespace YouCompleteMe { +namespace { + +unsigned editingOptions() { + return CXTranslationUnit_DetailedPreprocessingRecord | + clang_defaultEditingTranslationUnitOptions(); +} + +} // unnamed namespace + typedef shared_ptr < remove_pointer< CXCodeCompleteResults >::type > CodeCompleteResultsWrap; @@ -67,7 +76,7 @@ TranslationUnit::TranslationUnit( pointer_flags.size(), const_cast( unsaved ), cxunsaved_files.size(), - clang_defaultEditingTranslationUnitOptions() ); + editingOptions() ); if ( !clang_translation_unit_ ) boost_throw( ClangParseError() ); @@ -230,7 +239,7 @@ Location TranslationUnit::GetDefinitionLocation( // param though. void TranslationUnit::Reparse( std::vector< CXUnsavedFile > &unsaved_files ) { - Reparse( unsaved_files, clang_defaultEditingTranslationUnitOptions() ); + Reparse( unsaved_files, editingOptions() ); }