///
/// FIXME: Do we want to support this now that we have bind()?
template <typename T>
-internal::Matcher<T> id(StringRef ID,
+internal::Matcher<T> id(const std::string &ID,
const internal::BindableMatcher<T> &InnerMatcher) {
return InnerMatcher.bind(ID);
}
};
/// \brief Add a binding from an id to a node.
- void setBinding(StringRef Id, const ast_type_traits::DynTypedNode &DynNode) {
+ void setBinding(const std::string &Id,
+ const ast_type_traits::DynTypedNode &DynNode) {
if (Bindings.empty())
Bindings.emplace_back();
for (BoundNodesMap &Binding : Bindings)
///
/// Supported types:
/// - \c unsigned
-/// - \c llvm::StringRef
+/// - \c std::string
/// - \c VariantMatcher (\c DynTypedMatcher / \c Matcher<T>)
class VariantValue {
public:
/// \brief Specific constructors for each supported type.
VariantValue(unsigned Unsigned);
- VariantValue(StringRef String);
+ VariantValue(const std::string &String);
VariantValue(const VariantMatcher &Matchers);
/// \brief Returns true iff this is not an empty value.
/// \brief String value functions.
bool isString() const;
const std::string &getString() const;
- void setString(StringRef String);
+ void setString(const std::string &String);
/// \brief Matcher value functions.
bool isMatcher() const;
std::string TempFilename;
std::unique_ptr<raw_ostream> OS;
- OutputFile(std::string filename, std::string tempFilename,
+ OutputFile(const std::string &filename, const std::string &tempFilename,
std::unique_ptr<raw_ostream> OS)
- : Filename(std::move(filename)), TempFilename(std::move(tempFilename)),
- OS(std::move(OS)) {}
+ : Filename(filename), TempFilename(tempFilename), OS(std::move(OS)) {}
OutputFile(OutputFile &&O)
: Filename(std::move(O.Filename)),
TempFilename(std::move(O.TempFilename)), OS(std::move(O.OS)) {}
///
/// \return - The new object on success, or null on failure.
static IntrusiveRefCntPtr<ASTReader> createPCHExternalASTSource(
- StringRef Path, StringRef Sysroot, bool DisablePCHValidation,
+ StringRef Path, const std::string &Sysroot, bool DisablePCHValidation,
bool AllowPCHWithCompilerErrors, Preprocessor &PP, ASTContext &Context,
const PCHContainerOperations &PCHContainerOps,
void *DeserializationListener, bool OwnDeserializationListener,
/// Create a code completion consumer to print code completion results, at
/// \p Filename, \p Line, and \p Column, to the given output stream \p OS.
- static CodeCompleteConsumer *createCodeCompletionConsumer(
- Preprocessor &PP, StringRef Filename, unsigned Line, unsigned Column,
- const CodeCompleteOptions &Opts, raw_ostream &OS);
+ static CodeCompleteConsumer *
+ createCodeCompletionConsumer(Preprocessor &PP, const std::string &Filename,
+ unsigned Line, unsigned Column,
+ const CodeCompleteOptions &Opts,
+ raw_ostream &OS);
/// \brief Create the Sema object to be used for parsing.
void createSema(TranslationUnitKind TUKind,
if (Code[Length] == Marker) {
Result->Kind = TokenInfo::TK_Literal;
Result->Text = Code.substr(0, Length + 1);
- Result->Value = Code.substr(1, Length - 1);
+ Result->Value = Code.substr(1, Length - 1).str();
Code = Code.drop_front(Length + 1);
return;
}
setUnsigned(Unsigned);
}
-VariantValue::VariantValue(StringRef String) : Type(VT_Nothing) {
+VariantValue::VariantValue(const std::string &String) : Type(VT_Nothing) {
setString(String);
}
return *Value.String;
}
-void VariantValue::setString(StringRef NewValue) {
+void VariantValue::setString(const std::string &NewValue) {
reset();
Type = VT_String;
Value.String = new std::string(NewValue);
}
IntrusiveRefCntPtr<ASTReader> CompilerInstance::createPCHExternalASTSource(
- StringRef Path, StringRef Sysroot, bool DisablePCHValidation,
+ StringRef Path, const std::string &Sysroot, bool DisablePCHValidation,
bool AllowPCHWithCompilerErrors, Preprocessor &PP, ASTContext &Context,
const PCHContainerOperations &PCHContainerOps,
void *DeserializationListener, bool OwnDeserializationListener,
HeaderSearchOptions &HSOpts = PP.getHeaderSearchInfo().getHeaderSearchOpts();
IntrusiveRefCntPtr<ASTReader> Reader(new ASTReader(
- PP, Context, PCHContainerOps, Sysroot.empty() ? "" : Sysroot.data(),
+ PP, Context, PCHContainerOps, Sysroot.empty() ? "" : Sysroot.c_str(),
DisablePCHValidation, AllowPCHWithCompilerErrors,
/*AllowConfigurationMismatch*/ false, HSOpts.ModulesValidateSystemHeaders,
UseGlobalModuleIndex));
CodeCompleteConsumer *
CompilerInstance::createCodeCompletionConsumer(Preprocessor &PP,
- StringRef Filename,
+ const std::string &Filename,
unsigned Line,
unsigned Column,
const CodeCompleteOptions &Opts,