Merge topic 'vs-flag-with-following-value'
e8633e66 VS: Fix /analyze:log flag mapping (#14858) 650199e7 VS: Support mapping flags with values following separately (#14858) f2a3dd9d cmIDEOptions: Factor FlagMap update out to separate method
This commit is contained in:
commit
8acd2b3ab4
@ -31,6 +31,7 @@ struct cmIDEFlagTable
|
|||||||
// old value with semicolons (e.g.
|
// old value with semicolons (e.g.
|
||||||
// /NODEFAULTLIB: =>
|
// /NODEFAULTLIB: =>
|
||||||
// IgnoreDefaultLibraryNames)
|
// IgnoreDefaultLibraryNames)
|
||||||
|
UserFollowing = (1<<5), // expect value in following argument
|
||||||
|
|
||||||
UserValueIgnored = UserValue | UserIgnored,
|
UserValueIgnored = UserValue | UserIgnored,
|
||||||
UserValueRequired = UserValue | UserRequired
|
UserValueRequired = UserValue | UserRequired
|
||||||
|
@ -19,6 +19,7 @@ cmIDEOptions::cmIDEOptions()
|
|||||||
this->DoingDefine = false;
|
this->DoingDefine = false;
|
||||||
this->AllowDefine = true;
|
this->AllowDefine = true;
|
||||||
this->AllowSlash = false;
|
this->AllowSlash = false;
|
||||||
|
this->DoingFollowing = 0;
|
||||||
for(int i=0; i < FlagTableCount; ++i)
|
for(int i=0; i < FlagTableCount; ++i)
|
||||||
{
|
{
|
||||||
this->FlagTable[i] = 0;
|
this->FlagTable[i] = 0;
|
||||||
@ -41,6 +42,14 @@ void cmIDEOptions::HandleFlag(const char* flag)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the last option expected a following value, this is it.
|
||||||
|
if(this->DoingFollowing)
|
||||||
|
{
|
||||||
|
this->FlagMapUpdate(this->DoingFollowing, flag);
|
||||||
|
this->DoingFollowing = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Look for known arguments.
|
// Look for known arguments.
|
||||||
if(flag[0] == '-' || (this->AllowSlash && flag[0] == '/'))
|
if(flag[0] == '-' || (this->AllowSlash && flag[0] == '/'))
|
||||||
{
|
{
|
||||||
@ -99,6 +108,43 @@ bool cmIDEOptions::CheckFlagTable(cmIDEFlagTable const* table,
|
|||||||
(!(entry->special & cmIDEFlagTable::UserRequired) ||
|
(!(entry->special & cmIDEFlagTable::UserRequired) ||
|
||||||
static_cast<int>(strlen(flag+1)) > n))
|
static_cast<int>(strlen(flag+1)) > n))
|
||||||
{
|
{
|
||||||
|
this->FlagMapUpdate(entry, flag+n+1);
|
||||||
|
entry_found = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(strcmp(flag+1, entry->commandFlag) == 0)
|
||||||
|
{
|
||||||
|
if(entry->special & cmIDEFlagTable::UserFollowing)
|
||||||
|
{
|
||||||
|
// This flag expects a value in the following argument.
|
||||||
|
this->DoingFollowing = entry;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// This flag table entry provides a fixed value.
|
||||||
|
this->FlagMap[entry->IDEName] = entry->value;
|
||||||
|
}
|
||||||
|
entry_found = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the flag has been handled by an entry not requesting a
|
||||||
|
// search continuation we are done.
|
||||||
|
if(entry_found && !(entry->special & cmIDEFlagTable::Continue))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the entry was found the flag has been handled.
|
||||||
|
flag_handled = flag_handled || entry_found;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void cmIDEOptions::FlagMapUpdate(cmIDEFlagTable const* entry,
|
||||||
|
const char* new_value)
|
||||||
|
{
|
||||||
if(entry->special & cmIDEFlagTable::UserIgnored)
|
if(entry->special & cmIDEFlagTable::UserIgnored)
|
||||||
{
|
{
|
||||||
// Ignore the user-specified value.
|
// Ignore the user-specified value.
|
||||||
@ -106,8 +152,6 @@ bool cmIDEOptions::CheckFlagTable(cmIDEFlagTable const* table,
|
|||||||
}
|
}
|
||||||
else if(entry->special & cmIDEFlagTable::SemicolonAppendable)
|
else if(entry->special & cmIDEFlagTable::SemicolonAppendable)
|
||||||
{
|
{
|
||||||
const char *new_value = flag+1+n;
|
|
||||||
|
|
||||||
std::map<std::string,std::string>::iterator itr;
|
std::map<std::string,std::string>::iterator itr;
|
||||||
itr = this->FlagMap.find(entry->IDEName);
|
itr = this->FlagMap.find(entry->IDEName);
|
||||||
if(itr != this->FlagMap.end())
|
if(itr != this->FlagMap.end())
|
||||||
@ -124,30 +168,8 @@ bool cmIDEOptions::CheckFlagTable(cmIDEFlagTable const* table,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Use the user-specified value.
|
// Use the user-specified value.
|
||||||
this->FlagMap[entry->IDEName] = flag+1+n;
|
this->FlagMap[entry->IDEName] = new_value;
|
||||||
}
|
}
|
||||||
entry_found = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(strcmp(flag+1, entry->commandFlag) == 0)
|
|
||||||
{
|
|
||||||
// This flag table entry provides a fixed value.
|
|
||||||
this->FlagMap[entry->IDEName] = entry->value;
|
|
||||||
entry_found = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If the flag has been handled by an entry not requesting a
|
|
||||||
// search continuation we are done.
|
|
||||||
if(entry_found && !(entry->special & cmIDEFlagTable::Continue))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If the entry was found the flag has been handled.
|
|
||||||
flag_handled = flag_handled || entry_found;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
@ -51,11 +51,13 @@ protected:
|
|||||||
bool DoingDefine;
|
bool DoingDefine;
|
||||||
bool AllowDefine;
|
bool AllowDefine;
|
||||||
bool AllowSlash;
|
bool AllowSlash;
|
||||||
|
cmIDEFlagTable const* DoingFollowing;
|
||||||
enum { FlagTableCount = 16 };
|
enum { FlagTableCount = 16 };
|
||||||
cmIDEFlagTable const* FlagTable[FlagTableCount];
|
cmIDEFlagTable const* FlagTable[FlagTableCount];
|
||||||
void HandleFlag(const char* flag);
|
void HandleFlag(const char* flag);
|
||||||
bool CheckFlagTable(cmIDEFlagTable const* table, const char* flag,
|
bool CheckFlagTable(cmIDEFlagTable const* table, const char* flag,
|
||||||
bool& flag_handled);
|
bool& flag_handled);
|
||||||
|
void FlagMapUpdate(cmIDEFlagTable const* entry, const char* new_value);
|
||||||
virtual void StoreUnknownFlag(const char* flag) = 0;
|
virtual void StoreUnknownFlag(const char* flag) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -248,9 +248,9 @@ static cmVS7FlagTable cmVS11CLFlagTable[] =
|
|||||||
{"ForcedUsingFiles", "FU",
|
{"ForcedUsingFiles", "FU",
|
||||||
"Forced #using File",
|
"Forced #using File",
|
||||||
"", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable},
|
"", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable},
|
||||||
{"PREfastAdditionalOptions", "analyze:",
|
{"PREfastLog", "analyze:log",
|
||||||
"Additional Code Analysis Native options",
|
"Code Analysis Log",
|
||||||
"", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable},
|
"", cmVS7FlagTable::UserFollowing},
|
||||||
{"PREfastAdditionalPlugins", "analyze:plugin",
|
{"PREfastAdditionalPlugins", "analyze:plugin",
|
||||||
"Additional Code Analysis Native plugins",
|
"Additional Code Analysis Native plugins",
|
||||||
"", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable},
|
"", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable},
|
||||||
@ -283,9 +283,6 @@ static cmVS7FlagTable cmVS11CLFlagTable[] =
|
|||||||
"", cmVS7FlagTable::UserValue},
|
"", cmVS7FlagTable::UserValue},
|
||||||
// Skip [XMLDocumentationFileName] - no command line Switch.
|
// Skip [XMLDocumentationFileName] - no command line Switch.
|
||||||
// Skip [BrowseInformationFile] - no command line Switch.
|
// Skip [BrowseInformationFile] - no command line Switch.
|
||||||
{"PREfastLog", "analyze:log ",
|
|
||||||
"Code Analysis Log",
|
|
||||||
"", cmVS7FlagTable::UserValue},
|
|
||||||
// Skip [AdditionalOptions] - no command line Switch.
|
// Skip [AdditionalOptions] - no command line Switch.
|
||||||
{0,0,0,0,0}
|
{0,0,0,0,0}
|
||||||
};
|
};
|
||||||
|
@ -254,9 +254,9 @@ static cmVS7FlagTable cmVS12CLFlagTable[] =
|
|||||||
{"ForcedUsingFiles", "FU",
|
{"ForcedUsingFiles", "FU",
|
||||||
"Forced #using File",
|
"Forced #using File",
|
||||||
"", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable},
|
"", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable},
|
||||||
{"PREfastAdditionalOptions", "analyze:",
|
{"PREfastLog", "analyze:log",
|
||||||
"Additional Code Analysis Native options",
|
"Code Analysis Log",
|
||||||
"", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable},
|
"", cmVS7FlagTable::UserFollowing},
|
||||||
{"PREfastAdditionalPlugins", "analyze:plugin",
|
{"PREfastAdditionalPlugins", "analyze:plugin",
|
||||||
"Additional Code Analysis Native plugins",
|
"Additional Code Analysis Native plugins",
|
||||||
"", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable},
|
"", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable},
|
||||||
@ -289,9 +289,6 @@ static cmVS7FlagTable cmVS12CLFlagTable[] =
|
|||||||
"", cmVS7FlagTable::UserValue},
|
"", cmVS7FlagTable::UserValue},
|
||||||
// Skip [XMLDocumentationFileName] - no command line Switch.
|
// Skip [XMLDocumentationFileName] - no command line Switch.
|
||||||
// Skip [BrowseInformationFile] - no command line Switch.
|
// Skip [BrowseInformationFile] - no command line Switch.
|
||||||
{"PREfastLog", "analyze:log ",
|
|
||||||
"Code Analysis Log",
|
|
||||||
"", cmVS7FlagTable::UserValue},
|
|
||||||
// Skip [AdditionalOptions] - no command line Switch.
|
// Skip [AdditionalOptions] - no command line Switch.
|
||||||
{0,0,0,0,0}
|
{0,0,0,0,0}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user