Go to the documentation of this file.
9 #ifndef LLVM_LINEEDITOR_LINEEDITOR_H
10 #define LLVM_LINEEDITOR_LINEEDITOR_H
34 FILE *Out = stdout, FILE *Err = stderr);
85 Completer.reset(
new CompleterModel<T>(Comp));
93 Completer.reset(
new ListCompleterModel<T>(Comp));
113 std::string HistoryPath;
114 std::unique_ptr<InternalData>
Data;
116 struct CompleterConcept {
117 virtual ~CompleterConcept();
118 virtual CompletionAction complete(
StringRef Buffer,
size_t Pos)
const = 0;
121 struct ListCompleterConcept : CompleterConcept {
122 ~ListCompleterConcept()
override;
123 CompletionAction complete(StringRef Buffer,
size_t Pos)
const override;
124 static std::string getCommonPrefix(
const std::vector<Completion> &Comps);
125 virtual std::vector<Completion> getCompletions(StringRef Buffer,
126 size_t Pos)
const = 0;
129 template <
typename T>
130 struct CompleterModel : CompleterConcept {
132 CompletionAction complete(StringRef Buffer,
size_t Pos)
const override {
133 return Value(Buffer, Pos);
138 template <
typename T>
139 struct ListCompleterModel : ListCompleterConcept {
141 std::vector<Completion> getCompletions(StringRef Buffer,
142 size_t Pos)
const override {
143 return Value(Buffer, Pos);
148 std::unique_ptr<const CompleterConcept> Completer;
This is an optimization pass for GlobalISel generic memory operations.
This currently compiles esp xmm0 movsd esp eax eax esp ret We should use not the dag combiner This is because dagcombine2 needs to be able to see through the X86ISD::Wrapper which DAGCombine can t really do The code for turning x load into a single vector load is target independent and should be moved to the dag combiner The code for turning x load into a vector load can only handle a direct load from a global or a direct load from the stack It should be generalized to handle any load from P
llvm::Optional< std::string > readLine() const
Reads a line.
A possible completion at a given cursor position.
std::string TypedText
The text to insert.
@ AK_Insert
Insert Text at the cursor position.
CompletionAction getCompletionAction(StringRef Buffer, size_t Pos) const
Use the current completer to produce a CompletionAction for the given completion request.
std::string DisplayText
A description of this completion.
The action to perform upon a completion request.
LineEditor(StringRef ProgName, StringRef HistoryPath="", FILE *In=stdin, FILE *Out=stdout, FILE *Err=stderr)
Create a LineEditor object.
std::string Text
The text to insert.
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
void setCompleter(T Comp)
Set the completer for this LineEditor.
void setListCompleter(T Comp)
Set the completer for this LineEditor to the given list completer.
StringRef - Represent a constant reference to a string, i.e.
Completion(const std::string &TypedText, const std::string &DisplayText)
void setPrompt(const std::string &P)
static std::string getDefaultHistoryPath(StringRef ProgName)
std::vector< std::string > Completions
The list of completions to show.
const std::string & getPrompt() const
@ AK_ShowCompletions
Show Completions, or beep if the list is empty.