Skip to content

Commit c09158d

Browse files
committed
TokenList: apply enforced language early
1 parent df584c4 commit c09158d

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

lib/tokenlist.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ TokenList::TokenList(const Settings* settings) :
5050
mSettings(settings)
5151
{
5252
mTokensFrontBack.list = this;
53+
if (mSettings && (mSettings->enforcedLang != Settings::Language::None)) {
54+
mLang = mSettings->enforcedLang;
55+
}
5356
}
5457

5558
TokenList::~TokenList()
@@ -80,9 +83,8 @@ void TokenList::deallocateTokens()
8083

8184
void TokenList::determineCppC()
8285
{
83-
if (mSettings && (mSettings->enforcedLang != Settings::Language::None)) {
84-
mLang = mSettings->enforcedLang;
85-
} else {
86+
// only try to determine it if it wasn't enforced
87+
if (mLang == Settings::Language::None) {
8688
if (Path::isC(getSourceFilePath()))
8789
mLang = Settings::Language::C;
8890
else if (Path::isCPP(getSourceFilePath()))

0 commit comments

Comments
 (0)