Add extra acceptable characters to CMICmdArgValFile (MI)

Summary:
Improve CMICmdArgValFile::IsValidChars to accept extra characters that can be in file name:
```
.'\"`@#$%^&*()_+-={}[]| 
```

Enable MiSyntaxTestCase.test_lldbmi_specialchars test.

All test pass on OS X.

Reviewers: abidh, emaste, zturner, clayborg

Reviewed By: clayborg

Subscribers: lldb-commits, zturner, emaste, clayborg, abidh

Differential Revision: http://reviews.llvm.org/D7859

llvm-svn: 230468
This commit is contained in:
Ilia K 2015-02-25 06:34:05 +00:00
parent a5de1433b7
commit 4dc4ed0a2a
2 changed files with 2 additions and 2 deletions

View File

@ -36,7 +36,6 @@ class MiSyntaxTestCase(lldbmi_testcase.MiTestCaseBase):
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@unittest2.skip("lldb-mi doesn't handle special chars properly")
def test_lldbmi_specialchars(self):
"""Test that 'lldb-mi --interpreter' handles complicated strings."""

View File

@ -193,13 +193,14 @@ CMICmdArgValFile::IsFilePath(const CMIUtilString &vrFileNamePath) const
bool
CMICmdArgValFile::IsValidChars(const CMIUtilString &vrText) const
{
static CMIUtilString s_strSpecialCharacters(".'\"`@#$%^&*()_+-={}[]| ");
const MIchar *pPtr = const_cast<MIchar *>(vrText.c_str());
for (MIuint i = 0; i < vrText.length(); i++, pPtr++)
{
const MIchar c = *pPtr;
if (::isalnum((int)c) == 0)
{
if ((c != '.') && (c != '-') && (c != '_'))
if (s_strSpecialCharacters.find(c) == CMIUtilString::npos)
return false;
}
}