Please use GitHub pull requests for new patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
mlir/lib/AsmParser/Parser.cpp
Show First 20 Lines • Show All 383 Lines • ▼ Show 20 Lines | ParseResult Parser::codeCompleteDialectOrElidedOpName(SMLoc loc) { | ||||
// Check to see if there is anything else on the current line. This check | // Check to see if there is anything else on the current line. This check | ||||
// isn't strictly necessary, but it does avoid unnecessarily triggering | // isn't strictly necessary, but it does avoid unnecessarily triggering | ||||
// completions for operations and dialects in situations where we don't want | // completions for operations and dialects in situations where we don't want | ||||
// them (e.g. at the end of an operation). | // them (e.g. at the end of an operation). | ||||
auto shouldIgnoreOpCompletion = [&]() { | auto shouldIgnoreOpCompletion = [&]() { | ||||
const char *bufBegin = state.lex.getBufferBegin(); | const char *bufBegin = state.lex.getBufferBegin(); | ||||
const char *it = loc.getPointer() - 1; | const char *it = loc.getPointer() - 1; | ||||
for (; it > bufBegin && *it != '\n'; --it) | for (; it > bufBegin && *it != '\n'; --it) | ||||
if (!llvm::is_contained(StringRef(" \t\r"), *it)) | if (!StringRef(" \t\r").contains(*it)) | ||||
return true; | return true; | ||||
return false; | return false; | ||||
}; | }; | ||||
if (shouldIgnoreOpCompletion()) | if (shouldIgnoreOpCompletion()) | ||||
return failure(); | return failure(); | ||||
// The completion here is either for a dialect name, or an operation name | // The completion here is either for a dialect name, or an operation name | ||||
// whose dialect prefix was elided. For this we simply invoke both of the | // whose dialect prefix was elided. For this we simply invoke both of the | ||||
▲ Show 20 Lines • Show All 2,267 Lines • Show Last 20 Lines |