aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/clang/lib/Tooling/Core/Replacement.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/clang/lib/Tooling/Core/Replacement.cpp')
-rw-r--r--contrib/llvm-project/clang/lib/Tooling/Core/Replacement.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/contrib/llvm-project/clang/lib/Tooling/Core/Replacement.cpp b/contrib/llvm-project/clang/lib/Tooling/Core/Replacement.cpp
index 30e1923bf1cb..269f17a6db4c 100644
--- a/contrib/llvm-project/clang/lib/Tooling/Core/Replacement.cpp
+++ b/contrib/llvm-project/clang/lib/Tooling/Core/Replacement.cpp
@@ -67,7 +67,7 @@ bool Replacement::isApplicable() const {
bool Replacement::apply(Rewriter &Rewrite) const {
SourceManager &SM = Rewrite.getSourceMgr();
- auto Entry = SM.getFileManager().getFile(FilePath);
+ auto Entry = SM.getFileManager().getOptionalFileRef(FilePath);
if (!Entry)
return false;
@@ -122,7 +122,8 @@ void Replacement::setFromSourceLocation(const SourceManager &Sources,
StringRef ReplacementText) {
const std::pair<FileID, unsigned> DecomposedLocation =
Sources.getDecomposedLoc(Start);
- const FileEntry *Entry = Sources.getFileEntryForID(DecomposedLocation.first);
+ OptionalFileEntryRef Entry =
+ Sources.getFileEntryRefForID(DecomposedLocation.first);
this->FilePath = std::string(Entry ? Entry->getName() : InvalidLocation);
this->ReplacementRange = Range(DecomposedLocation.second, Length);
this->ReplacementText = std::string(ReplacementText);
@@ -179,9 +180,9 @@ static std::string getReplacementErrString(replacement_error Err) {
std::string ReplacementError::message() const {
std::string Message = getReplacementErrString(Err);
- if (NewReplacement.hasValue())
+ if (NewReplacement)
Message += "\nNew replacement: " + NewReplacement->toString();
- if (ExistingReplacement.hasValue())
+ if (ExistingReplacement)
Message += "\nExisting replacement: " + ExistingReplacement->toString();
return Message;
}
@@ -270,7 +271,7 @@ llvm::Error Replacements::add(const Replacement &R) {
assert(R.getLength() == 0);
// `I` is also an insertion, `R` and `I` conflict.
if (I->getLength() == 0) {
- // Check if two insertions are order-indepedent: if inserting them in
+ // Check if two insertions are order-independent: if inserting them in
// either order produces the same text, they are order-independent.
if ((R.getReplacementText() + I->getReplacementText()).str() !=
(I->getReplacementText() + R.getReplacementText()).str())
@@ -319,7 +320,7 @@ llvm::Error Replacements::add(const Replacement &R) {
Replaces.insert(R);
} else {
// `I` overlaps with `R`. We need to check `R` against all overlapping
- // replacements to see if they are order-indepedent. If they are, merge `R`
+ // replacements to see if they are order-independent. If they are, merge `R`
// with them and replace them with the merged replacements.
auto MergeBegin = I;
auto MergeEnd = std::next(I);