Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,16 @@ static bool IsTrivialBasename(const llvm::StringRef &basename) {
if (basename.size() <= idx)
return false; // Empty string or "~"

if (!std::isalpha(basename[idx]) && basename[idx] != '_')
if (!std::isalpha(static_cast<unsigned char>(basename[idx])) &&
basename[idx] != '_')
return false; // First character (after removing the possible '~'') isn't in
// [A-Za-z_]

// Read all characters matching [A-Za-z_0-9]
++idx;
while (idx < basename.size()) {
if (!std::isalnum(basename[idx]) && basename[idx] != '_')
if (!std::isalnum(static_cast<unsigned char>(basename[idx])) &&
basename[idx] != '_')
break;
++idx;
}
Expand Down
6 changes: 4 additions & 2 deletions lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ using namespace lldb_private::formatters;
static void consumeInlineNamespace(llvm::StringRef &name) {
// Delete past an inline namespace, if any: __[a-zA-Z0-9_]+::
auto scratch = name;
if (scratch.consume_front("__") && std::isalnum(scratch[0])) {
scratch = scratch.drop_while([](char c) { return std::isalnum(c); });
if (scratch.consume_front("__") &&
std::isalnum(static_cast<unsigned char>(scratch[0]))) {
scratch = scratch.drop_while(
[](char c) { return std::isalnum(static_cast<unsigned char>(c)); });
if (scratch.consume_front("::")) {
// Successfully consumed a namespace.
name = scratch;
Expand Down
Loading