Skip to content

Commit

Permalink
Added a C++17 option for code completion and build
Browse files Browse the repository at this point in the history
  • Loading branch information
aviallon authored and eranif committed Feb 24, 2018
1 parent 5f05e28 commit 6548df2
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 3 deletions.
5 changes: 5 additions & 0 deletions LiteEditor/clang_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,11 @@ FileTypeCmpArgs_t ClangDriver::DoPrepareCompilationArgs(const wxString& projectN
cppCompileArgs.Add(wxT("-std=c++14"));
// cCompileArgs.Add(wxT("-std=c++14"));
}

if(workspaceFlags & LocalWorkspace::EnableCpp17) {
cppCompileArgs.Add(wxT("-std=c++17"));
// cCompileArgs.Add(wxT("-std=c++14"));
}

///////////////////////////////////////////////////////////////////////
// Project setting additional flags
Expand Down
2 changes: 2 additions & 0 deletions LiteEditor/code_completion_page.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ CodeCompletionPage::CodeCompletionPage(wxWindow* parent, int type)

m_checkBoxCpp11->SetValue(LocalWorkspaceST::Get()->GetParserFlags() & LocalWorkspace::EnableCpp11);
m_checkBoxCpp14->SetValue(LocalWorkspaceST::Get()->GetParserFlags() & LocalWorkspace::EnableCpp14);
m_checkBoxCpp17->SetValue(LocalWorkspaceST::Get()->GetParserFlags() & LocalWorkspace::EnableCpp14);
m_checkBoxSWTLW->SetValue(LocalWorkspaceST::Get()->GetParserFlags() & LocalWorkspace::EnableSWTLW);
}
}
Expand All @@ -72,6 +73,7 @@ void CodeCompletionPage::Save()

if(m_checkBoxCpp11->IsChecked()) flags |= LocalWorkspace::EnableCpp11;
if(m_checkBoxCpp14->IsChecked()) flags |= LocalWorkspace::EnableCpp14;
if(m_checkBoxCpp17->IsChecked()) flags |= LocalWorkspace::EnableCpp17;
if(m_checkBoxSWTLW->IsChecked()) flags |= LocalWorkspace::EnableSWTLW;
LocalWorkspaceST::Get()->SetParserFlags(flags);
LocalWorkspaceST::Get()->Flush();
Expand Down
8 changes: 8 additions & 0 deletions LiteEditor/project_settings_base_dlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1177,6 +1177,12 @@ PSCompletionBase::PSCompletionBase(wxWindow* parent, wxWindowID id, const wxPoin
m_checkBoxC14->SetToolTip(_("If checked, pass -std=c++14 to the clang code completion engine to ensure that all c++14 features are recognized properly"));

bSizer40->Add(m_checkBoxC14, 0, wxALL, 5);

m_checkBoxC17 = new wxCheckBox(m_panel15, wxID_ANY, _("Enable C++17 Standard"), wxDefaultPosition, wxSize(-1,-1), 0);
m_checkBoxC17->SetValue(false);
m_checkBoxC17->SetToolTip(_("If checked, pass -std=c++17 to the clang code completion engine to ensure that all c++17 features are recognized properly"));

bSizer40->Add(m_checkBoxC17, 0, wxALL, 5);

SetName(wxT("PSCompletionBase"));
SetSize(-1,-1);
Expand All @@ -1189,6 +1195,7 @@ PSCompletionBase::PSCompletionBase(wxWindow* parent, wxWindowID id, const wxPoin
m_textCtrlMacros->Connect(wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler(PSCompletionBase::OnCmdEvtVModified), NULL, this);
m_checkBoxC11->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler(PSCompletionBase::OnCmdEvtVModified), NULL, this);
m_checkBoxC14->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler(PSCompletionBase::OnCmdEvtVModified), NULL, this);
m_checkBoxC17->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler(PSCompletionBase::OnCmdEvtVModified), NULL, this);

}

Expand All @@ -1199,6 +1206,7 @@ PSCompletionBase::~PSCompletionBase()
m_textCtrlMacros->Disconnect(wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler(PSCompletionBase::OnCmdEvtVModified), NULL, this);
m_checkBoxC11->Disconnect(wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler(PSCompletionBase::OnCmdEvtVModified), NULL, this);
m_checkBoxC14->Disconnect(wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler(PSCompletionBase::OnCmdEvtVModified), NULL, this);
m_checkBoxC17->Disconnect(wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler(PSCompletionBase::OnCmdEvtVModified), NULL, this);

}

Expand Down
2 changes: 2 additions & 0 deletions LiteEditor/project_settings_base_dlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,7 @@ class PSCompletionBase : public wxPanel
wxTextCtrl* m_textCtrlMacros;
wxCheckBox* m_checkBoxC11;
wxCheckBox* m_checkBoxC14;
wxCheckBox* m_checkBoxC17;

protected:
virtual void OnProjectEnabledUI(wxUpdateUIEvent& event) { event.Skip(); }
Expand All @@ -425,6 +426,7 @@ class PSCompletionBase : public wxPanel
wxTextCtrl* GetTextCtrlMacros() { return m_textCtrlMacros; }
wxCheckBox* GetCheckBoxC11() { return m_checkBoxC11; }
wxCheckBox* GetCheckBoxC14() { return m_checkBoxC14; }
wxCheckBox* GetCheckBoxC17() { return m_checkBoxC17; }
wxPanel* GetPanel15() { return m_panel15; }
wxSplitterWindow* GetSplitter1() { return m_splitter1; }
PSCompletionBase(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize(-1,-1), long style = wxTAB_TRAVERSAL);
Expand Down
6 changes: 4 additions & 2 deletions LiteEditor/ps_completion_page.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,17 @@ void PSCompletionPage::Load(BuildConfigPtr buildConf)
m_textCtrlMacros->SetValue(buildConf->GetClangPPFlags());
m_textCtrlSearchPaths->SetValue(buildConf->GetCcSearchPaths());
m_checkBoxC11->SetValue(buildConf->IsClangC11());
m_checkBoxC14->SetValue(buildConf->IsClangC14());
m_checkBoxC14->SetValue(buildConf->IsClangC14());
m_checkBoxC17->SetValue(buildConf->IsClangC17());
}

void PSCompletionPage::Save(BuildConfigPtr buildConf, ProjectSettingsPtr projSettingsPtr)
{
buildConf->SetClangPPFlags(m_textCtrlMacros->GetValue());
buildConf->SetCcSearchPaths(m_textCtrlSearchPaths->GetValue());
buildConf->SetClangC11(m_checkBoxC11->IsChecked());
buildConf->SetClangC14(m_checkBoxC14->IsChecked());
buildConf->SetClangC14(m_checkBoxC14->IsChecked());
buildConf->SetClangC17(m_checkBoxC17->IsChecked());
// Save was requested
if(m_ccSettingsModified) {
m_ccSettingsModified = false;
Expand Down
5 changes: 5 additions & 0 deletions LiteEditor/workspacesettingsbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,11 @@ CodeCompletionBasePage::CodeCompletionBasePage(wxWindow* parent, wxWindowID id,
m_checkBoxCpp14->SetValue(false);

boxSizer3->Add(m_checkBoxCpp14, 0, wxALL, 5);

m_checkBoxCpp17 = new wxCheckBox(m_panel6, wxID_ANY, _("Enable C++17 Standard"), wxDefaultPosition, wxSize(-1,-1), 0);
m_checkBoxCpp17->SetValue(false);

boxSizer3->Add(m_checkBoxCpp17, 0, wxALL, 5);

m_checkBoxSWTLW = new wxCheckBox(m_panel6, wxID_ANY, _("Sync to Workspace File"), wxDefaultPosition, wxSize(-1,-1), 0);
m_checkBoxSWTLW->SetValue(false);
Expand Down
2 changes: 2 additions & 0 deletions LiteEditor/workspacesettingsbase.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class CodeCompletionBasePage : public wxPanel
wxTextCtrl* m_textCtrlMacros;
wxCheckBox* m_checkBoxCpp11;
wxCheckBox* m_checkBoxCpp14;
wxCheckBox* m_checkBoxCpp17;
wxCheckBox* m_checkBoxSWTLW;

protected:
Expand All @@ -94,6 +95,7 @@ class CodeCompletionBasePage : public wxPanel
wxTextCtrl* GetTextCtrlMacros() { return m_textCtrlMacros; }
wxCheckBox* GetCheckBoxCpp11() { return m_checkBoxCpp11; }
wxCheckBox* GetCheckBoxCpp14() { return m_checkBoxCpp14; }
wxCheckBox* GetCheckBoxCpp17() { return m_checkBoxCpp17; }
wxCheckBox* GetCheckBoxSWTLW() { return m_checkBoxSWTLW; }
wxPanel* GetPanel6() { return m_panel6; }
wxSplitterWindow* GetSplitter1() { return m_splitter1; }
Expand Down
3 changes: 3 additions & 0 deletions Plugin/build_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ class WXDLLIMPEXP_SDK BuildConfig : public ConfObject
wxString m_ccPCH;
bool m_clangC11;
bool m_clangC14;
bool m_clangC17;
wxArrayString m_debuggerSearchPaths;
bool m_isGUIProgram;
bool m_isProjectEnabled;
Expand Down Expand Up @@ -171,6 +172,8 @@ class WXDLLIMPEXP_SDK BuildConfig : public ConfObject
bool IsClangC11() const { return m_clangC11; }
void SetClangC14(bool clangC14) { this->m_clangC14 = clangC14; }
bool IsClangC14() const { return m_clangC14; }
void SetClangC17(bool clangC17) { this->m_clangC17 = clangC17; }
bool IsClangC17() const { return m_clangC17; }
void SetClangCcPCH(const wxString& ccPCH) { this->m_ccPCH = ccPCH; }
const wxString& GetClangCcPCH() const { return m_ccPCH; }
void SetCcSearchPaths(const wxString& ccSearchPaths) { this->m_ccSearchPaths = ccSearchPaths; }
Expand Down
1 change: 1 addition & 0 deletions Plugin/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,7 @@ void Compiler::AddDefaultGnuComplierOptions()
AddCompilerOption("-std=c99", "Enable ANSI C99 features");
AddCompilerOption("-std=c++11", "Enable C++11 features");
AddCompilerOption("-std=c++14", "Enable C++14 features");
AddCompilerOption("-std=c++17", "Enable C++17 features");
}

void Compiler::AddDefaultGnuLinkerOptions()
Expand Down
3 changes: 2 additions & 1 deletion Plugin/localworkspace.h
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,8 @@ class WXDLLIMPEXP_SDK LocalWorkspace
enum CC_FLAGS {
EnableCpp11 = 0x00000001,
EnableCpp14 = 0x00000002,
EnableSWTLW = 0x00000004 // Save Parse folders to Workspace file.
EnableCpp17 = 0x00000004,
EnableSWTLW = 0x00000008 // Save Parse folders to Workspace file.
};

private:
Expand Down

0 comments on commit 6548df2

Please sign in to comment.