forked from OSchip/llvm-project
Revert "Don't use Optional::hasValue (NFC)"
This reverts commit aa8feeefd3
.
This commit is contained in:
parent
aa8feeefd3
commit
3b7c3a654c
|
@ -653,10 +653,10 @@ genHTML(const EnumInfo &I, const ClangDocContext &CDCtx) {
|
||||||
|
|
||||||
if (I.DefLoc) {
|
if (I.DefLoc) {
|
||||||
if (!CDCtx.RepositoryUrl)
|
if (!CDCtx.RepositoryUrl)
|
||||||
Out.emplace_back(writeFileDefinition(*I.DefLoc));
|
Out.emplace_back(writeFileDefinition(I.DefLoc.getValue()));
|
||||||
else
|
else
|
||||||
Out.emplace_back(
|
Out.emplace_back(writeFileDefinition(
|
||||||
writeFileDefinition(*I.DefLoc, StringRef{*CDCtx.RepositoryUrl}));
|
I.DefLoc.getValue(), StringRef{CDCtx.RepositoryUrl.getValue()}));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Description;
|
std::string Description;
|
||||||
|
@ -702,10 +702,10 @@ genHTML(const FunctionInfo &I, const ClangDocContext &CDCtx,
|
||||||
|
|
||||||
if (I.DefLoc) {
|
if (I.DefLoc) {
|
||||||
if (!CDCtx.RepositoryUrl)
|
if (!CDCtx.RepositoryUrl)
|
||||||
Out.emplace_back(writeFileDefinition(*I.DefLoc));
|
Out.emplace_back(writeFileDefinition(I.DefLoc.getValue()));
|
||||||
else
|
else
|
||||||
Out.emplace_back(
|
Out.emplace_back(writeFileDefinition(
|
||||||
writeFileDefinition(*I.DefLoc, StringRef{*CDCtx.RepositoryUrl}));
|
I.DefLoc.getValue(), StringRef{CDCtx.RepositoryUrl.getValue()}));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Description;
|
std::string Description;
|
||||||
|
@ -768,10 +768,10 @@ genHTML(const RecordInfo &I, Index &InfoIndex, const ClangDocContext &CDCtx,
|
||||||
|
|
||||||
if (I.DefLoc) {
|
if (I.DefLoc) {
|
||||||
if (!CDCtx.RepositoryUrl)
|
if (!CDCtx.RepositoryUrl)
|
||||||
Out.emplace_back(writeFileDefinition(*I.DefLoc));
|
Out.emplace_back(writeFileDefinition(I.DefLoc.getValue()));
|
||||||
else
|
else
|
||||||
Out.emplace_back(
|
Out.emplace_back(writeFileDefinition(
|
||||||
writeFileDefinition(*I.DefLoc, StringRef{*CDCtx.RepositoryUrl}));
|
I.DefLoc.getValue(), StringRef{CDCtx.RepositoryUrl.getValue()}));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Description;
|
std::string Description;
|
||||||
|
|
|
@ -817,8 +817,8 @@ void NotNullTerminatedResultCheck::check(
|
||||||
++It;
|
++It;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AreSafeFunctionsWanted)
|
if (AreSafeFunctionsWanted.hasValue())
|
||||||
UseSafeFunctions = *AreSafeFunctionsWanted;
|
UseSafeFunctions = AreSafeFunctionsWanted.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
StringRef Name = FunctionExpr->getDirectCallee()->getName();
|
StringRef Name = FunctionExpr->getDirectCallee()->getName();
|
||||||
|
|
|
@ -663,9 +663,9 @@ void ClangdLSPServer::onDocumentDidOpen(
|
||||||
void ClangdLSPServer::onDocumentDidChange(
|
void ClangdLSPServer::onDocumentDidChange(
|
||||||
const DidChangeTextDocumentParams &Params) {
|
const DidChangeTextDocumentParams &Params) {
|
||||||
auto WantDiags = WantDiagnostics::Auto;
|
auto WantDiags = WantDiagnostics::Auto;
|
||||||
if (Params.wantDiagnostics)
|
if (Params.wantDiagnostics.hasValue())
|
||||||
WantDiags =
|
WantDiags = Params.wantDiagnostics.getValue() ? WantDiagnostics::Yes
|
||||||
*Params.wantDiagnostics ? WantDiagnostics::Yes : WantDiagnostics::No;
|
: WantDiagnostics::No;
|
||||||
|
|
||||||
PathRef File = Params.textDocument.uri.file();
|
PathRef File = Params.textDocument.uri.file();
|
||||||
auto Code = Server->getDraft(File);
|
auto Code = Server->getDraft(File);
|
||||||
|
|
|
@ -411,9 +411,10 @@ void ClangdServer::codeComplete(PathRef File, Position Pos,
|
||||||
clang::clangd::trace::Span Tracer("Completion results callback");
|
clang::clangd::trace::Span Tracer("Completion results callback");
|
||||||
CB(std::move(Result));
|
CB(std::move(Result));
|
||||||
}
|
}
|
||||||
if (SpecFuzzyFind && SpecFuzzyFind->NewReq) {
|
if (SpecFuzzyFind && SpecFuzzyFind->NewReq.hasValue()) {
|
||||||
std::lock_guard<std::mutex> Lock(CachedCompletionFuzzyFindRequestMutex);
|
std::lock_guard<std::mutex> Lock(CachedCompletionFuzzyFindRequestMutex);
|
||||||
CachedCompletionFuzzyFindRequestByFile[File] = *SpecFuzzyFind->NewReq;
|
CachedCompletionFuzzyFindRequestByFile[File] =
|
||||||
|
SpecFuzzyFind->NewReq.getValue();
|
||||||
}
|
}
|
||||||
// SpecFuzzyFind is only destroyed after speculative fuzzy find finishes.
|
// SpecFuzzyFind is only destroyed after speculative fuzzy find finishes.
|
||||||
// We don't want `codeComplete` to wait for the async call if it doesn't use
|
// We don't want `codeComplete` to wait for the async call if it doesn't use
|
||||||
|
|
|
@ -391,9 +391,11 @@ struct CodeCompletionBuilder {
|
||||||
ToInclude.takeError());
|
ToInclude.takeError());
|
||||||
}
|
}
|
||||||
// Prefer includes that do not need edits (i.e. already exist).
|
// Prefer includes that do not need edits (i.e. already exist).
|
||||||
std::stable_partition(
|
std::stable_partition(Completion.Includes.begin(),
|
||||||
Completion.Includes.begin(), Completion.Includes.end(),
|
Completion.Includes.end(),
|
||||||
[](const CodeCompletion::IncludeCandidate &I) { return !I.Insertion; });
|
[](const CodeCompletion::IncludeCandidate &I) {
|
||||||
|
return !I.Insertion.hasValue();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void add(const CompletionCandidate &C, CodeCompletionString *SemaCCS) {
|
void add(const CompletionCandidate &C, CodeCompletionString *SemaCCS) {
|
||||||
|
|
|
@ -358,8 +358,8 @@ struct FragmentCompiler {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
// Make sure exactly one of the Sources is set.
|
// Make sure exactly one of the Sources is set.
|
||||||
unsigned SourceCount = External.File.has_value() +
|
unsigned SourceCount = External.File.hasValue() +
|
||||||
External.Server.has_value() + *External.IsNone;
|
External.Server.hasValue() + *External.IsNone;
|
||||||
if (SourceCount != 1) {
|
if (SourceCount != 1) {
|
||||||
diag(Error, "Exactly one of File, Server or None must be set.",
|
diag(Error, "Exactly one of File, Server or None must be set.",
|
||||||
BlockRange);
|
BlockRange);
|
||||||
|
|
|
@ -13,12 +13,12 @@ namespace clang {
|
||||||
namespace clangd {
|
namespace clangd {
|
||||||
|
|
||||||
void FeatureModule::initialize(const Facilities &F) {
|
void FeatureModule::initialize(const Facilities &F) {
|
||||||
assert(!Fac && "Initialized twice");
|
assert(!Fac.hasValue() && "Initialized twice");
|
||||||
Fac.emplace(F);
|
Fac.emplace(F);
|
||||||
}
|
}
|
||||||
|
|
||||||
FeatureModule::Facilities &FeatureModule::facilities() {
|
FeatureModule::Facilities &FeatureModule::facilities() {
|
||||||
assert(Fac && "Not initialized yet");
|
assert(Fac.hasValue() && "Not initialized yet");
|
||||||
return *Fac;
|
return *Fac;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -354,23 +354,23 @@ template <> struct MappingTraits<CompileCommandYAML> {
|
||||||
|
|
||||||
template <> struct MappingTraits<VariantEntry> {
|
template <> struct MappingTraits<VariantEntry> {
|
||||||
static void mapping(IO &IO, VariantEntry &Variant) {
|
static void mapping(IO &IO, VariantEntry &Variant) {
|
||||||
if (IO.mapTag("!Symbol", Variant.Symbol.has_value())) {
|
if (IO.mapTag("!Symbol", Variant.Symbol.hasValue())) {
|
||||||
if (!IO.outputting())
|
if (!IO.outputting())
|
||||||
Variant.Symbol.emplace();
|
Variant.Symbol.emplace();
|
||||||
MappingTraits<Symbol>::mapping(IO, *Variant.Symbol);
|
MappingTraits<Symbol>::mapping(IO, *Variant.Symbol);
|
||||||
} else if (IO.mapTag("!Refs", Variant.Refs.has_value())) {
|
} else if (IO.mapTag("!Refs", Variant.Refs.hasValue())) {
|
||||||
if (!IO.outputting())
|
if (!IO.outputting())
|
||||||
Variant.Refs.emplace();
|
Variant.Refs.emplace();
|
||||||
MappingTraits<RefBundle>::mapping(IO, *Variant.Refs);
|
MappingTraits<RefBundle>::mapping(IO, *Variant.Refs);
|
||||||
} else if (IO.mapTag("!Relations", Variant.Relation.has_value())) {
|
} else if (IO.mapTag("!Relations", Variant.Relation.hasValue())) {
|
||||||
if (!IO.outputting())
|
if (!IO.outputting())
|
||||||
Variant.Relation.emplace();
|
Variant.Relation.emplace();
|
||||||
MappingTraits<Relation>::mapping(IO, *Variant.Relation);
|
MappingTraits<Relation>::mapping(IO, *Variant.Relation);
|
||||||
} else if (IO.mapTag("!Source", Variant.Source.has_value())) {
|
} else if (IO.mapTag("!Source", Variant.Source.hasValue())) {
|
||||||
if (!IO.outputting())
|
if (!IO.outputting())
|
||||||
Variant.Source.emplace();
|
Variant.Source.emplace();
|
||||||
MappingTraits<IncludeGraphNode>::mapping(IO, *Variant.Source);
|
MappingTraits<IncludeGraphNode>::mapping(IO, *Variant.Source);
|
||||||
} else if (IO.mapTag("!Cmd", Variant.Cmd.has_value())) {
|
} else if (IO.mapTag("!Cmd", Variant.Cmd.hasValue())) {
|
||||||
if (!IO.outputting())
|
if (!IO.outputting())
|
||||||
Variant.Cmd.emplace();
|
Variant.Cmd.emplace();
|
||||||
MappingTraits<CompileCommandYAML>::mapping(
|
MappingTraits<CompileCommandYAML>::mapping(
|
||||||
|
|
|
@ -82,12 +82,12 @@ Diagnostics:
|
||||||
EXPECT_THAT(Results[1].CompileFlags.Add, ElementsAre(val("b\naz\n")));
|
EXPECT_THAT(Results[1].CompileFlags.Add, ElementsAre(val("b\naz\n")));
|
||||||
|
|
||||||
ASSERT_TRUE(Results[2].Index.Background);
|
ASSERT_TRUE(Results[2].Index.Background);
|
||||||
EXPECT_EQ("Skip", *Results[2].Index.Background.value());
|
EXPECT_EQ("Skip", *Results[2].Index.Background.getValue());
|
||||||
EXPECT_THAT(Results[3].Diagnostics.ClangTidy.CheckOptions,
|
EXPECT_THAT(Results[3].Diagnostics.ClangTidy.CheckOptions,
|
||||||
ElementsAre(PairVal("IgnoreMacros", "true"),
|
ElementsAre(PairVal("IgnoreMacros", "true"),
|
||||||
PairVal("example-check.ExampleOption", "0")));
|
PairVal("example-check.ExampleOption", "0")));
|
||||||
EXPECT_TRUE(Results[3].Diagnostics.UnusedIncludes);
|
EXPECT_TRUE(Results[3].Diagnostics.UnusedIncludes);
|
||||||
EXPECT_EQ("Strict", *Results[3].Diagnostics.UnusedIncludes.value());
|
EXPECT_EQ("Strict", *Results[3].Diagnostics.UnusedIncludes.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(ParseYAML, Locations) {
|
TEST(ParseYAML, Locations) {
|
||||||
|
@ -163,10 +163,10 @@ Index:
|
||||||
ASSERT_THAT(Diags.Diagnostics, IsEmpty());
|
ASSERT_THAT(Diags.Diagnostics, IsEmpty());
|
||||||
ASSERT_EQ(Results.size(), 1u);
|
ASSERT_EQ(Results.size(), 1u);
|
||||||
ASSERT_TRUE(Results[0].Index.External);
|
ASSERT_TRUE(Results[0].Index.External);
|
||||||
EXPECT_FALSE(Results[0].Index.External.value()->File.has_value());
|
EXPECT_FALSE(Results[0].Index.External.getValue()->File.hasValue());
|
||||||
EXPECT_FALSE(Results[0].Index.External.value()->MountPoint.has_value());
|
EXPECT_FALSE(Results[0].Index.External.getValue()->MountPoint.hasValue());
|
||||||
EXPECT_FALSE(Results[0].Index.External.value()->Server.has_value());
|
EXPECT_FALSE(Results[0].Index.External.getValue()->Server.hasValue());
|
||||||
EXPECT_THAT(*Results[0].Index.External.value()->IsNone, testing::Eq(true));
|
EXPECT_THAT(*Results[0].Index.External.getValue()->IsNone, testing::Eq(true));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(ParseYAML, ExternalBlock) {
|
TEST(ParseYAML, ExternalBlock) {
|
||||||
|
@ -182,10 +182,10 @@ Index:
|
||||||
Fragment::parseYAML(YAML.code(), "config.yaml", Diags.callback());
|
Fragment::parseYAML(YAML.code(), "config.yaml", Diags.callback());
|
||||||
ASSERT_EQ(Results.size(), 1u);
|
ASSERT_EQ(Results.size(), 1u);
|
||||||
ASSERT_TRUE(Results[0].Index.External);
|
ASSERT_TRUE(Results[0].Index.External);
|
||||||
EXPECT_THAT(*Results[0].Index.External.value()->File, val("foo"));
|
EXPECT_THAT(*Results[0].Index.External.getValue()->File, val("foo"));
|
||||||
EXPECT_THAT(*Results[0].Index.External.value()->MountPoint, val("baz"));
|
EXPECT_THAT(*Results[0].Index.External.getValue()->MountPoint, val("baz"));
|
||||||
ASSERT_THAT(Diags.Diagnostics, IsEmpty());
|
ASSERT_THAT(Diags.Diagnostics, IsEmpty());
|
||||||
EXPECT_THAT(*Results[0].Index.External.value()->Server, val("bar"));
|
EXPECT_THAT(*Results[0].Index.External.getValue()->Server, val("bar"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(ParseYAML, AllScopes) {
|
TEST(ParseYAML, AllScopes) {
|
||||||
|
|
|
@ -28,10 +28,10 @@ TEST(FSTests, PreambleStatusCache) {
|
||||||
EXPECT_TRUE(ProduceFS->status("y"));
|
EXPECT_TRUE(ProduceFS->status("y"));
|
||||||
EXPECT_TRUE(ProduceFS->status("main"));
|
EXPECT_TRUE(ProduceFS->status("main"));
|
||||||
|
|
||||||
EXPECT_TRUE(StatCache.lookup(testPath("x")).has_value());
|
EXPECT_TRUE(StatCache.lookup(testPath("x")).hasValue());
|
||||||
EXPECT_TRUE(StatCache.lookup(testPath("y")).has_value());
|
EXPECT_TRUE(StatCache.lookup(testPath("y")).hasValue());
|
||||||
// Main file is not cached.
|
// Main file is not cached.
|
||||||
EXPECT_FALSE(StatCache.lookup(testPath("main")).has_value());
|
EXPECT_FALSE(StatCache.lookup(testPath("main")).hasValue());
|
||||||
|
|
||||||
llvm::vfs::Status S("fake", llvm::sys::fs::UniqueID(123, 456),
|
llvm::vfs::Status S("fake", llvm::sys::fs::UniqueID(123, 456),
|
||||||
std::chrono::system_clock::now(), 0, 0, 1024,
|
std::chrono::system_clock::now(), 0, 0, 1024,
|
||||||
|
|
|
@ -331,14 +331,14 @@ TEST(GlobalCompilationDatabaseTest, CompileFlagsDirectory) {
|
||||||
FS.Files[testPath("x/compile_flags.txt")] = "-DFOO";
|
FS.Files[testPath("x/compile_flags.txt")] = "-DFOO";
|
||||||
DirectoryBasedGlobalCompilationDatabase CDB(FS);
|
DirectoryBasedGlobalCompilationDatabase CDB(FS);
|
||||||
auto Commands = CDB.getCompileCommand(testPath("x/y.cpp"));
|
auto Commands = CDB.getCompileCommand(testPath("x/y.cpp"));
|
||||||
ASSERT_TRUE(Commands.has_value());
|
ASSERT_TRUE(Commands.hasValue());
|
||||||
EXPECT_THAT(Commands->CommandLine, Contains("-DFOO"));
|
EXPECT_THAT(Commands.getValue().CommandLine, Contains("-DFOO"));
|
||||||
// Make sure we pick the right working directory.
|
// Make sure we pick the right working directory.
|
||||||
EXPECT_EQ(testPath("x"), Commands->Directory);
|
EXPECT_EQ(testPath("x"), Commands.getValue().Directory);
|
||||||
}
|
}
|
||||||
|
|
||||||
MATCHER_P(hasArg, Flag, "") {
|
MATCHER_P(hasArg, Flag, "") {
|
||||||
if (!arg) {
|
if (!arg.hasValue()) {
|
||||||
*result_listener << "command is null";
|
*result_listener << "command is null";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,12 +33,12 @@ TEST(HeaderSourceSwitchTest, FileHeuristic) {
|
||||||
FS.Files[Invalid];
|
FS.Files[Invalid];
|
||||||
Optional<Path> PathResult =
|
Optional<Path> PathResult =
|
||||||
getCorrespondingHeaderOrSource(FooCpp, FS.view(llvm::None));
|
getCorrespondingHeaderOrSource(FooCpp, FS.view(llvm::None));
|
||||||
EXPECT_TRUE(PathResult.has_value());
|
EXPECT_TRUE(PathResult.hasValue());
|
||||||
ASSERT_EQ(*PathResult, FooH);
|
ASSERT_EQ(PathResult.getValue(), FooH);
|
||||||
|
|
||||||
PathResult = getCorrespondingHeaderOrSource(FooH, FS.view(llvm::None));
|
PathResult = getCorrespondingHeaderOrSource(FooH, FS.view(llvm::None));
|
||||||
EXPECT_TRUE(PathResult.has_value());
|
EXPECT_TRUE(PathResult.hasValue());
|
||||||
ASSERT_EQ(*PathResult, FooCpp);
|
ASSERT_EQ(PathResult.getValue(), FooCpp);
|
||||||
|
|
||||||
// Test with header file in capital letters and different extension, source
|
// Test with header file in capital letters and different extension, source
|
||||||
// file with different extension
|
// file with different extension
|
||||||
|
@ -48,8 +48,8 @@ TEST(HeaderSourceSwitchTest, FileHeuristic) {
|
||||||
FS.Files[FooC];
|
FS.Files[FooC];
|
||||||
FS.Files[FooHH];
|
FS.Files[FooHH];
|
||||||
PathResult = getCorrespondingHeaderOrSource(FooC, FS.view(llvm::None));
|
PathResult = getCorrespondingHeaderOrSource(FooC, FS.view(llvm::None));
|
||||||
EXPECT_TRUE(PathResult.has_value());
|
EXPECT_TRUE(PathResult.hasValue());
|
||||||
ASSERT_EQ(*PathResult, FooHH);
|
ASSERT_EQ(PathResult.getValue(), FooHH);
|
||||||
|
|
||||||
// Test with both capital letters
|
// Test with both capital letters
|
||||||
auto Foo2C = testPath("foo2.C");
|
auto Foo2C = testPath("foo2.C");
|
||||||
|
@ -57,8 +57,8 @@ TEST(HeaderSourceSwitchTest, FileHeuristic) {
|
||||||
FS.Files[Foo2C];
|
FS.Files[Foo2C];
|
||||||
FS.Files[Foo2HH];
|
FS.Files[Foo2HH];
|
||||||
PathResult = getCorrespondingHeaderOrSource(Foo2C, FS.view(llvm::None));
|
PathResult = getCorrespondingHeaderOrSource(Foo2C, FS.view(llvm::None));
|
||||||
EXPECT_TRUE(PathResult.has_value());
|
EXPECT_TRUE(PathResult.hasValue());
|
||||||
ASSERT_EQ(*PathResult, Foo2HH);
|
ASSERT_EQ(PathResult.getValue(), Foo2HH);
|
||||||
|
|
||||||
// Test with source file as capital letter and .hxx header file
|
// Test with source file as capital letter and .hxx header file
|
||||||
auto Foo3C = testPath("foo3.C");
|
auto Foo3C = testPath("foo3.C");
|
||||||
|
@ -67,13 +67,13 @@ TEST(HeaderSourceSwitchTest, FileHeuristic) {
|
||||||
FS.Files[Foo3C];
|
FS.Files[Foo3C];
|
||||||
FS.Files[Foo3HXX];
|
FS.Files[Foo3HXX];
|
||||||
PathResult = getCorrespondingHeaderOrSource(Foo3C, FS.view(llvm::None));
|
PathResult = getCorrespondingHeaderOrSource(Foo3C, FS.view(llvm::None));
|
||||||
EXPECT_TRUE(PathResult.has_value());
|
EXPECT_TRUE(PathResult.hasValue());
|
||||||
ASSERT_EQ(*PathResult, Foo3HXX);
|
ASSERT_EQ(PathResult.getValue(), Foo3HXX);
|
||||||
|
|
||||||
// Test if asking for a corresponding file that doesn't exist returns an empty
|
// Test if asking for a corresponding file that doesn't exist returns an empty
|
||||||
// string.
|
// string.
|
||||||
PathResult = getCorrespondingHeaderOrSource(Invalid, FS.view(llvm::None));
|
PathResult = getCorrespondingHeaderOrSource(Invalid, FS.view(llvm::None));
|
||||||
EXPECT_FALSE(PathResult.has_value());
|
EXPECT_FALSE(PathResult.hasValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
MATCHER_P(declNamed, Name, "") {
|
MATCHER_P(declNamed, Name, "") {
|
||||||
|
|
|
@ -93,18 +93,19 @@ TEST(LSPBinderTest, IncomingCalls) {
|
||||||
|
|
||||||
auto &RawPlusOne = RawHandlers.MethodHandlers["plusOne"];
|
auto &RawPlusOne = RawHandlers.MethodHandlers["plusOne"];
|
||||||
RawPlusOne(1, capture(Reply));
|
RawPlusOne(1, capture(Reply));
|
||||||
ASSERT_TRUE(Reply.has_value());
|
ASSERT_TRUE(Reply.hasValue());
|
||||||
EXPECT_THAT_EXPECTED(*Reply, llvm::HasValue(2));
|
EXPECT_THAT_EXPECTED(Reply.getValue(), llvm::HasValue(2));
|
||||||
RawPlusOne("foo", capture(Reply));
|
RawPlusOne("foo", capture(Reply));
|
||||||
ASSERT_TRUE(Reply.has_value());
|
ASSERT_TRUE(Reply.hasValue());
|
||||||
EXPECT_THAT_EXPECTED(
|
EXPECT_THAT_EXPECTED(
|
||||||
*Reply, llvm::FailedWithMessage(HasSubstr(
|
Reply.getValue(),
|
||||||
"failed to decode plusOne request: expected integer")));
|
llvm::FailedWithMessage(
|
||||||
|
HasSubstr("failed to decode plusOne request: expected integer")));
|
||||||
|
|
||||||
auto &RawFail = RawHandlers.MethodHandlers["fail"];
|
auto &RawFail = RawHandlers.MethodHandlers["fail"];
|
||||||
RawFail(2, capture(Reply));
|
RawFail(2, capture(Reply));
|
||||||
ASSERT_TRUE(Reply.has_value());
|
ASSERT_TRUE(Reply.hasValue());
|
||||||
EXPECT_THAT_EXPECTED(*Reply, llvm::FailedWithMessage("X=2"));
|
EXPECT_THAT_EXPECTED(Reply.getValue(), llvm::FailedWithMessage("X=2"));
|
||||||
|
|
||||||
auto &RawNotify = RawHandlers.NotificationHandlers["notify"];
|
auto &RawNotify = RawHandlers.NotificationHandlers["notify"];
|
||||||
RawNotify(42);
|
RawNotify(42);
|
||||||
|
@ -116,8 +117,8 @@ TEST(LSPBinderTest, IncomingCalls) {
|
||||||
|
|
||||||
auto &RawCmdPlusOne = RawHandlers.CommandHandlers["cmdPlusOne"];
|
auto &RawCmdPlusOne = RawHandlers.CommandHandlers["cmdPlusOne"];
|
||||||
RawCmdPlusOne(1, capture(Reply));
|
RawCmdPlusOne(1, capture(Reply));
|
||||||
ASSERT_TRUE(Reply.has_value());
|
ASSERT_TRUE(Reply.hasValue());
|
||||||
EXPECT_THAT_EXPECTED(*Reply, llvm::HasValue(2));
|
EXPECT_THAT_EXPECTED(Reply.getValue(), llvm::HasValue(2));
|
||||||
|
|
||||||
// None of this generated any outgoing traffic.
|
// None of this generated any outgoing traffic.
|
||||||
EXPECT_THAT(RawOutgoing.Received, IsEmpty());
|
EXPECT_THAT(RawOutgoing.Received, IsEmpty());
|
||||||
|
@ -138,23 +139,23 @@ TEST(LSPBinderTest, OutgoingCalls) {
|
||||||
llvm::Optional<llvm::Expected<Foo>> Reply;
|
llvm::Optional<llvm::Expected<Foo>> Reply;
|
||||||
Echo(Foo{2}, capture(Reply));
|
Echo(Foo{2}, capture(Reply));
|
||||||
EXPECT_THAT(RawOutgoing.take("echo"), ElementsAre(llvm::json::Value(2)));
|
EXPECT_THAT(RawOutgoing.take("echo"), ElementsAre(llvm::json::Value(2)));
|
||||||
ASSERT_TRUE(Reply.has_value());
|
ASSERT_TRUE(Reply.hasValue());
|
||||||
EXPECT_THAT_EXPECTED(*Reply, llvm::HasValue(Foo{2}));
|
EXPECT_THAT_EXPECTED(Reply.getValue(), llvm::HasValue(Foo{2}));
|
||||||
|
|
||||||
// JSON response is integer, can't be parsed as string.
|
// JSON response is integer, can't be parsed as string.
|
||||||
llvm::Optional<llvm::Expected<std::string>> WrongTypeReply;
|
llvm::Optional<llvm::Expected<std::string>> WrongTypeReply;
|
||||||
WrongSignature(Foo{2}, capture(WrongTypeReply));
|
WrongSignature(Foo{2}, capture(WrongTypeReply));
|
||||||
EXPECT_THAT(RawOutgoing.take("wrongSignature"),
|
EXPECT_THAT(RawOutgoing.take("wrongSignature"),
|
||||||
ElementsAre(llvm::json::Value(2)));
|
ElementsAre(llvm::json::Value(2)));
|
||||||
ASSERT_TRUE(Reply.has_value());
|
ASSERT_TRUE(Reply.hasValue());
|
||||||
EXPECT_THAT_EXPECTED(*WrongTypeReply,
|
EXPECT_THAT_EXPECTED(WrongTypeReply.getValue(),
|
||||||
llvm::FailedWithMessage(
|
llvm::FailedWithMessage(
|
||||||
HasSubstr("failed to decode wrongSignature reply")));
|
HasSubstr("failed to decode wrongSignature reply")));
|
||||||
|
|
||||||
Fail(Foo{2}, capture(Reply));
|
Fail(Foo{2}, capture(Reply));
|
||||||
EXPECT_THAT(RawOutgoing.take("fail"), ElementsAre(llvm::json::Value(2)));
|
EXPECT_THAT(RawOutgoing.take("fail"), ElementsAre(llvm::json::Value(2)));
|
||||||
ASSERT_TRUE(Reply.has_value());
|
ASSERT_TRUE(Reply.hasValue());
|
||||||
EXPECT_THAT_EXPECTED(*Reply, llvm::FailedWithMessage("Params=2"));
|
EXPECT_THAT_EXPECTED(Reply.getValue(), llvm::FailedWithMessage("Params=2"));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
|
@ -37,18 +37,18 @@ TEST(TidyProvider, NestedDirectories) {
|
||||||
TidyProvider Provider = provideClangTidyFiles(FS);
|
TidyProvider Provider = provideClangTidyFiles(FS);
|
||||||
|
|
||||||
auto BaseOptions = getTidyOptionsForFile(Provider, testPath("File.cpp"));
|
auto BaseOptions = getTidyOptionsForFile(Provider, testPath("File.cpp"));
|
||||||
ASSERT_TRUE(BaseOptions.Checks.has_value());
|
ASSERT_TRUE(BaseOptions.Checks.hasValue());
|
||||||
EXPECT_EQ(*BaseOptions.Checks, "llvm-*");
|
EXPECT_EQ(*BaseOptions.Checks, "llvm-*");
|
||||||
EXPECT_EQ(BaseOptions.CheckOptions.lookup("TestKey").Value, "1");
|
EXPECT_EQ(BaseOptions.CheckOptions.lookup("TestKey").Value, "1");
|
||||||
|
|
||||||
auto Sub1Options = getTidyOptionsForFile(Provider, testPath("sub1/File.cpp"));
|
auto Sub1Options = getTidyOptionsForFile(Provider, testPath("sub1/File.cpp"));
|
||||||
ASSERT_TRUE(Sub1Options.Checks.has_value());
|
ASSERT_TRUE(Sub1Options.Checks.hasValue());
|
||||||
EXPECT_EQ(*Sub1Options.Checks, "misc-*");
|
EXPECT_EQ(*Sub1Options.Checks, "misc-*");
|
||||||
EXPECT_EQ(Sub1Options.CheckOptions.lookup("TestKey").Value, "2");
|
EXPECT_EQ(Sub1Options.CheckOptions.lookup("TestKey").Value, "2");
|
||||||
|
|
||||||
auto Sub2Options =
|
auto Sub2Options =
|
||||||
getTidyOptionsForFile(Provider, testPath("sub1/sub2/File.cpp"));
|
getTidyOptionsForFile(Provider, testPath("sub1/sub2/File.cpp"));
|
||||||
ASSERT_TRUE(Sub2Options.Checks.has_value());
|
ASSERT_TRUE(Sub2Options.Checks.hasValue());
|
||||||
EXPECT_EQ(*Sub2Options.Checks, "misc-*,bugprone-*");
|
EXPECT_EQ(*Sub2Options.Checks, "misc-*,bugprone-*");
|
||||||
EXPECT_EQ(Sub2Options.CheckOptions.lookup("TestKey").Value, "3");
|
EXPECT_EQ(Sub2Options.CheckOptions.lookup("TestKey").Value, "3");
|
||||||
}
|
}
|
||||||
|
|
|
@ -375,11 +375,11 @@ private:
|
||||||
for (auto &A : Params.Table.getActions(Head->State, Lookahead)) {
|
for (auto &A : Params.Table.getActions(Head->State, Lookahead)) {
|
||||||
if (A.kind() != LRTable::Action::Reduce)
|
if (A.kind() != LRTable::Action::Reduce)
|
||||||
continue;
|
continue;
|
||||||
if (RID)
|
if (RID.hasValue())
|
||||||
return false;
|
return false;
|
||||||
RID = A.getReduceRule();
|
RID = A.getReduceRule();
|
||||||
}
|
}
|
||||||
if (!RID)
|
if (!RID.hasValue())
|
||||||
return true; // no reductions available, but we've processed the head!
|
return true; // no reductions available, but we've processed the head!
|
||||||
const auto &Rule = Params.G.lookupRule(*RID);
|
const auto &Rule = Params.G.lookupRule(*RID);
|
||||||
const GSS::Node *Base = Head;
|
const GSS::Node *Base = Head;
|
||||||
|
|
|
@ -95,8 +95,8 @@ void CheckBaseInfo(Info *Expected, Info *Actual) {
|
||||||
|
|
||||||
void CheckSymbolInfo(SymbolInfo *Expected, SymbolInfo *Actual) {
|
void CheckSymbolInfo(SymbolInfo *Expected, SymbolInfo *Actual) {
|
||||||
CheckBaseInfo(Expected, Actual);
|
CheckBaseInfo(Expected, Actual);
|
||||||
EXPECT_EQ(Expected->DefLoc.has_value(), Actual->DefLoc.has_value());
|
EXPECT_EQ(Expected->DefLoc.hasValue(), Actual->DefLoc.hasValue());
|
||||||
if (Expected->DefLoc && Actual->DefLoc) {
|
if (Expected->DefLoc.hasValue() && Actual->DefLoc.hasValue()) {
|
||||||
EXPECT_EQ(Expected->DefLoc->LineNumber, Actual->DefLoc->LineNumber);
|
EXPECT_EQ(Expected->DefLoc->LineNumber, Actual->DefLoc->LineNumber);
|
||||||
EXPECT_EQ(Expected->DefLoc->Filename, Actual->DefLoc->Filename);
|
EXPECT_EQ(Expected->DefLoc->Filename, Actual->DefLoc->Filename);
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,14 +129,14 @@ TEST(ParseConfiguration, MergeConfigurations) {
|
||||||
EXPECT_EQ("check1,check2,check3,check4", *Options.Checks);
|
EXPECT_EQ("check1,check2,check3,check4", *Options.Checks);
|
||||||
EXPECT_EQ("filter2", *Options.HeaderFilterRegex);
|
EXPECT_EQ("filter2", *Options.HeaderFilterRegex);
|
||||||
EXPECT_EQ("user2", *Options.User);
|
EXPECT_EQ("user2", *Options.User);
|
||||||
ASSERT_TRUE(Options.ExtraArgs.has_value());
|
ASSERT_TRUE(Options.ExtraArgs.hasValue());
|
||||||
EXPECT_EQ("arg1,arg2,arg3,arg4", llvm::join(Options.ExtraArgs->begin(),
|
EXPECT_EQ("arg1,arg2,arg3,arg4", llvm::join(Options.ExtraArgs->begin(),
|
||||||
Options.ExtraArgs->end(), ","));
|
Options.ExtraArgs->end(), ","));
|
||||||
ASSERT_TRUE(Options.ExtraArgsBefore.has_value());
|
ASSERT_TRUE(Options.ExtraArgsBefore.hasValue());
|
||||||
EXPECT_EQ("arg-before1,arg-before2,arg-before3,arg-before4",
|
EXPECT_EQ("arg-before1,arg-before2,arg-before3,arg-before4",
|
||||||
llvm::join(Options.ExtraArgsBefore->begin(),
|
llvm::join(Options.ExtraArgsBefore->begin(),
|
||||||
Options.ExtraArgsBefore->end(), ","));
|
Options.ExtraArgsBefore->end(), ","));
|
||||||
ASSERT_TRUE(Options.UseColor.has_value());
|
ASSERT_TRUE(Options.UseColor.hasValue());
|
||||||
EXPECT_TRUE(*Options.UseColor);
|
EXPECT_TRUE(*Options.UseColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -325,9 +325,9 @@ TEST(CheckOptionsValidation, ValidIntOptions) {
|
||||||
|
|
||||||
CHECK_VAL(TestCheck.getIntLocal("IntExpected"), 1);
|
CHECK_VAL(TestCheck.getIntLocal("IntExpected"), 1);
|
||||||
CHECK_VAL(TestCheck.getIntGlobal("GlobalIntExpected"), 1);
|
CHECK_VAL(TestCheck.getIntGlobal("GlobalIntExpected"), 1);
|
||||||
EXPECT_FALSE(TestCheck.getIntLocal("IntInvalid1").has_value());
|
EXPECT_FALSE(TestCheck.getIntLocal("IntInvalid1").hasValue());
|
||||||
EXPECT_FALSE(TestCheck.getIntLocal("IntInvalid2").has_value());
|
EXPECT_FALSE(TestCheck.getIntLocal("IntInvalid2").hasValue());
|
||||||
EXPECT_FALSE(TestCheck.getIntGlobal("GlobalIntInvalid").has_value());
|
EXPECT_FALSE(TestCheck.getIntGlobal("GlobalIntInvalid").hasValue());
|
||||||
ASSERT_EQ(TestCheck.getIntLocal("DefaultedIntInvalid", 1), 1);
|
ASSERT_EQ(TestCheck.getIntLocal("DefaultedIntInvalid", 1), 1);
|
||||||
|
|
||||||
CHECK_VAL(TestCheck.getIntLocal<bool>("BoolITrueValue"), true);
|
CHECK_VAL(TestCheck.getIntLocal<bool>("BoolITrueValue"), true);
|
||||||
|
@ -395,14 +395,14 @@ TEST(ValidConfiguration, ValidEnumOptions) {
|
||||||
/*IgnoreCase*/ true),
|
/*IgnoreCase*/ true),
|
||||||
Colours::Violet);
|
Colours::Violet);
|
||||||
|
|
||||||
EXPECT_FALSE(TestCheck.getIntLocal<Colours>("ValidWrongCase").has_value());
|
EXPECT_FALSE(TestCheck.getIntLocal<Colours>("ValidWrongCase").hasValue());
|
||||||
EXPECT_FALSE(TestCheck.getIntLocal<Colours>("NearMiss").has_value());
|
EXPECT_FALSE(TestCheck.getIntLocal<Colours>("NearMiss").hasValue());
|
||||||
EXPECT_FALSE(TestCheck.getIntGlobal<Colours>("GlobalInvalid").has_value());
|
EXPECT_FALSE(TestCheck.getIntGlobal<Colours>("GlobalInvalid").hasValue());
|
||||||
EXPECT_FALSE(
|
EXPECT_FALSE(
|
||||||
TestCheck.getIntGlobal<Colours>("GlobalValidWrongCase").has_value());
|
TestCheck.getIntGlobal<Colours>("GlobalValidWrongCase").hasValue());
|
||||||
EXPECT_FALSE(TestCheck.getIntGlobal<Colours>("GlobalNearMiss").has_value());
|
EXPECT_FALSE(TestCheck.getIntGlobal<Colours>("GlobalNearMiss").hasValue());
|
||||||
|
|
||||||
EXPECT_FALSE(TestCheck.getIntLocal<Colours>("Invalid").has_value());
|
EXPECT_FALSE(TestCheck.getIntLocal<Colours>("Invalid").hasValue());
|
||||||
EXPECT_THAT(
|
EXPECT_THAT(
|
||||||
DiagConsumer.take(),
|
DiagConsumer.take(),
|
||||||
UnorderedElementsAre(
|
UnorderedElementsAre(
|
||||||
|
|
|
@ -34,8 +34,8 @@ public:
|
||||||
assert(Call != nullptr && "Did not find node \"foo\"");
|
assert(Call != nullptr && "Did not find node \"foo\"");
|
||||||
auto Hint = Aliaser->createAlias(*Result.Context, *Call, "::foo::bar",
|
auto Hint = Aliaser->createAlias(*Result.Context, *Call, "::foo::bar",
|
||||||
{"b", "some_alias"});
|
{"b", "some_alias"});
|
||||||
if (Hint)
|
if (Hint.hasValue())
|
||||||
diag(Call->getBeginLoc(), "Fix for testing") << *Hint;
|
diag(Call->getBeginLoc(), "Fix for testing") << Hint.getValue();
|
||||||
|
|
||||||
diag(Call->getBeginLoc(), "insert call") << FixItHint::CreateInsertion(
|
diag(Call->getBeginLoc(), "insert call") << FixItHint::CreateInsertion(
|
||||||
Call->getBeginLoc(),
|
Call->getBeginLoc(),
|
||||||
|
|
|
@ -53,9 +53,9 @@ TEST(ClangTidyOptionsProvider, InMemoryFileSystems) {
|
||||||
ClangTidyOptions File3Options =
|
ClangTidyOptions File3Options =
|
||||||
FileOpt.getOptions("ProjectRoot/SubDir1/SubDir2/SubDir3/File.cpp");
|
FileOpt.getOptions("ProjectRoot/SubDir1/SubDir2/SubDir3/File.cpp");
|
||||||
|
|
||||||
ASSERT_TRUE(File1Options.Checks.has_value());
|
ASSERT_TRUE(File1Options.Checks.hasValue());
|
||||||
EXPECT_EQ(*File1Options.Checks, "-*,clang-diagnostic-*,readability-*");
|
EXPECT_EQ(*File1Options.Checks, "-*,clang-diagnostic-*,readability-*");
|
||||||
ASSERT_TRUE(File2Options.Checks.has_value());
|
ASSERT_TRUE(File2Options.Checks.hasValue());
|
||||||
EXPECT_EQ(*File2Options.Checks, "bugprone-*,misc-*,clang-diagnostic-*");
|
EXPECT_EQ(*File2Options.Checks, "bugprone-*,misc-*,clang-diagnostic-*");
|
||||||
|
|
||||||
// 2 and 3 should use the same config so these should also be the same.
|
// 2 and 3 should use the same config so these should also be the same.
|
||||||
|
|
|
@ -37,8 +37,8 @@ public:
|
||||||
auto Hint =
|
auto Hint =
|
||||||
Inserter->createUsingDeclaration(*Result.Context, *Call, "::foo::func");
|
Inserter->createUsingDeclaration(*Result.Context, *Call, "::foo::func");
|
||||||
|
|
||||||
if (Hint)
|
if (Hint.hasValue())
|
||||||
diag(Call->getBeginLoc(), "Fix for testing") << *Hint;
|
diag(Call->getBeginLoc(), "Fix for testing") << Hint.getValue();
|
||||||
|
|
||||||
diag(Call->getBeginLoc(), "insert call")
|
diag(Call->getBeginLoc(), "insert call")
|
||||||
<< clang::FixItHint::CreateReplacement(
|
<< clang::FixItHint::CreateReplacement(
|
||||||
|
|
|
@ -76,8 +76,8 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void setSwiftPrivate(llvm::Optional<bool> Private) {
|
void setSwiftPrivate(llvm::Optional<bool> Private) {
|
||||||
SwiftPrivateSpecified = Private.has_value();
|
SwiftPrivateSpecified = Private.hasValue();
|
||||||
SwiftPrivate = Private.value_or(0);
|
SwiftPrivate = Private.hasValue() ? *Private : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
friend bool operator==(const CommonEntityInfo &, const CommonEntityInfo &);
|
friend bool operator==(const CommonEntityInfo &, const CommonEntityInfo &);
|
||||||
|
|
|
@ -520,15 +520,15 @@ let Class = PropertyTypeCase<APValue, "LValue"> in {
|
||||||
if (hasBase) {
|
if (hasBase) {
|
||||||
if (isTypeInfo) {
|
if (isTypeInfo) {
|
||||||
base = APValue::LValueBase::getTypeInfo(
|
base = APValue::LValueBase::getTypeInfo(
|
||||||
TypeInfoLValue(typeInfo->getTypePtr()), *type);
|
TypeInfoLValue(typeInfo.getValue().getTypePtr()), type.getValue());
|
||||||
elemTy = base.getTypeInfoType();
|
elemTy = base.getTypeInfoType();
|
||||||
} else if (isExpr) {
|
} else if (isExpr) {
|
||||||
base = APValue::LValueBase(cast<Expr>(*stmt),
|
base = APValue::LValueBase(cast<Expr>(stmt.getValue()),
|
||||||
*callIndex, *version);
|
callIndex.getValue(), version.getValue());
|
||||||
elemTy = base.get<const Expr *>()->getType();
|
elemTy = base.get<const Expr *>()->getType();
|
||||||
} else {
|
} else {
|
||||||
base = APValue::LValueBase(cast<ValueDecl>(*decl),
|
base = APValue::LValueBase(cast<ValueDecl>(decl.getValue()),
|
||||||
*callIndex, *version);
|
callIndex.getValue(), version.getValue());
|
||||||
elemTy = base.get<const ValueDecl *>()->getType();
|
elemTy = base.get<const ValueDecl *>()->getType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -544,7 +544,7 @@ public:
|
||||||
/// flag may have been previously set, at which point it will not
|
/// flag may have been previously set, at which point it will not
|
||||||
/// be reset unless one specifies to do so.
|
/// be reset unless one specifies to do so.
|
||||||
void setPrunable(bool isPrunable, bool override = false) {
|
void setPrunable(bool isPrunable, bool override = false) {
|
||||||
if (IsPrunable && !override)
|
if (IsPrunable.hasValue() && !override)
|
||||||
return;
|
return;
|
||||||
IsPrunable = isPrunable;
|
IsPrunable = isPrunable;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1766,9 +1766,9 @@ public:
|
||||||
template <typename T>
|
template <typename T>
|
||||||
friend const SemaDiagnosticBuilder &
|
friend const SemaDiagnosticBuilder &
|
||||||
operator<<(const SemaDiagnosticBuilder &Diag, const T &Value) {
|
operator<<(const SemaDiagnosticBuilder &Diag, const T &Value) {
|
||||||
if (Diag.ImmediateDiag)
|
if (Diag.ImmediateDiag.hasValue())
|
||||||
*Diag.ImmediateDiag << Value;
|
*Diag.ImmediateDiag << Value;
|
||||||
else if (Diag.PartialDiagId)
|
else if (Diag.PartialDiagId.hasValue())
|
||||||
Diag.S.DeviceDeferredDiags[Diag.Fn][*Diag.PartialDiagId].second
|
Diag.S.DeviceDeferredDiags[Diag.Fn][*Diag.PartialDiagId].second
|
||||||
<< Value;
|
<< Value;
|
||||||
return Diag;
|
return Diag;
|
||||||
|
@ -1780,26 +1780,26 @@ public:
|
||||||
template <typename T, typename = typename std::enable_if<
|
template <typename T, typename = typename std::enable_if<
|
||||||
!std::is_lvalue_reference<T>::value>::type>
|
!std::is_lvalue_reference<T>::value>::type>
|
||||||
const SemaDiagnosticBuilder &operator<<(T &&V) const {
|
const SemaDiagnosticBuilder &operator<<(T &&V) const {
|
||||||
if (ImmediateDiag)
|
if (ImmediateDiag.hasValue())
|
||||||
*ImmediateDiag << std::move(V);
|
*ImmediateDiag << std::move(V);
|
||||||
else if (PartialDiagId)
|
else if (PartialDiagId.hasValue())
|
||||||
S.DeviceDeferredDiags[Fn][*PartialDiagId].second << std::move(V);
|
S.DeviceDeferredDiags[Fn][*PartialDiagId].second << std::move(V);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
friend const SemaDiagnosticBuilder &
|
friend const SemaDiagnosticBuilder &
|
||||||
operator<<(const SemaDiagnosticBuilder &Diag, const PartialDiagnostic &PD) {
|
operator<<(const SemaDiagnosticBuilder &Diag, const PartialDiagnostic &PD) {
|
||||||
if (Diag.ImmediateDiag)
|
if (Diag.ImmediateDiag.hasValue())
|
||||||
PD.Emit(*Diag.ImmediateDiag);
|
PD.Emit(*Diag.ImmediateDiag);
|
||||||
else if (Diag.PartialDiagId)
|
else if (Diag.PartialDiagId.hasValue())
|
||||||
Diag.S.DeviceDeferredDiags[Diag.Fn][*Diag.PartialDiagId].second = PD;
|
Diag.S.DeviceDeferredDiags[Diag.Fn][*Diag.PartialDiagId].second = PD;
|
||||||
return Diag;
|
return Diag;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddFixItHint(const FixItHint &Hint) const {
|
void AddFixItHint(const FixItHint &Hint) const {
|
||||||
if (ImmediateDiag)
|
if (ImmediateDiag.hasValue())
|
||||||
ImmediateDiag->AddFixItHint(Hint);
|
ImmediateDiag->AddFixItHint(Hint);
|
||||||
else if (PartialDiagId)
|
else if (PartialDiagId.hasValue())
|
||||||
S.DeviceDeferredDiags[Fn][*PartialDiagId].second.AddFixItHint(Hint);
|
S.DeviceDeferredDiags[Fn][*PartialDiagId].second.AddFixItHint(Hint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -414,8 +414,7 @@ public:
|
||||||
bool isArgumentConstructedDirectly(unsigned Index) const {
|
bool isArgumentConstructedDirectly(unsigned Index) const {
|
||||||
// This assumes that the object was not yet removed from the state.
|
// This assumes that the object was not yet removed from the state.
|
||||||
return ExprEngine::getObjectUnderConstruction(
|
return ExprEngine::getObjectUnderConstruction(
|
||||||
getState(), {getOriginExpr(), Index}, getLocationContext())
|
getState(), {getOriginExpr(), Index}, getLocationContext()).hasValue();
|
||||||
.has_value();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Some calls have parameter numbering mismatched from argument numbering.
|
/// Some calls have parameter numbering mismatched from argument numbering.
|
||||||
|
@ -1017,8 +1016,9 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
SVal getObjectUnderConstruction() const {
|
SVal getObjectUnderConstruction() const {
|
||||||
return *ExprEngine::getObjectUnderConstruction(getState(), getOriginExpr(),
|
return ExprEngine::getObjectUnderConstruction(getState(), getOriginExpr(),
|
||||||
getLocationContext());
|
getLocationContext())
|
||||||
|
.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Number of non-placement arguments to the call. It is equal to 2 for
|
/// Number of non-placement arguments to the call. It is equal to 2 for
|
||||||
|
|
|
@ -53,17 +53,25 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return true if the constraint is perfectly constrained to 'true'.
|
/// Return true if the constraint is perfectly constrained to 'true'.
|
||||||
bool isConstrainedTrue() const { return Val && *Val; }
|
bool isConstrainedTrue() const {
|
||||||
|
return Val.hasValue() && Val.getValue();
|
||||||
|
}
|
||||||
|
|
||||||
/// Return true if the constraint is perfectly constrained to 'false'.
|
/// Return true if the constraint is perfectly constrained to 'false'.
|
||||||
bool isConstrainedFalse() const { return Val && !*Val; }
|
bool isConstrainedFalse() const {
|
||||||
|
return Val.hasValue() && !Val.getValue();
|
||||||
|
}
|
||||||
|
|
||||||
/// Return true if the constrained is perfectly constrained.
|
/// Return true if the constrained is perfectly constrained.
|
||||||
bool isConstrained() const { return Val.has_value(); }
|
bool isConstrained() const {
|
||||||
|
return Val.hasValue();
|
||||||
|
}
|
||||||
|
|
||||||
/// Return true if the constrained is underconstrained and we do not know
|
/// Return true if the constrained is underconstrained and we do not know
|
||||||
/// if the constraint is true of value.
|
/// if the constraint is true of value.
|
||||||
bool isUnderconstrained() const { return !Val.has_value(); }
|
bool isUnderconstrained() const {
|
||||||
|
return !Val.hasValue();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class ConstraintManager {
|
class ConstraintManager {
|
||||||
|
|
|
@ -341,10 +341,10 @@ protected:
|
||||||
addStateConstraints(NewState);
|
addStateConstraints(NewState);
|
||||||
|
|
||||||
Optional<bool> res = Solver->check();
|
Optional<bool> res = Solver->check();
|
||||||
if (!res)
|
if (!res.hasValue())
|
||||||
Cached[hash] = ConditionTruthVal();
|
Cached[hash] = ConditionTruthVal();
|
||||||
else
|
else
|
||||||
Cached[hash] = ConditionTruthVal(*res);
|
Cached[hash] = ConditionTruthVal(res.getValue());
|
||||||
|
|
||||||
return Cached[hash];
|
return Cached[hash];
|
||||||
}
|
}
|
||||||
|
|
|
@ -209,8 +209,8 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isValid() const { return Valid; }
|
bool isValid() const { return Valid; }
|
||||||
bool isScalar() const { return Scale && *Scale == 0; }
|
bool isScalar() const { return Scale.hasValue() && Scale.getValue() == 0; }
|
||||||
bool isVector() const { return Scale && *Scale != 0; }
|
bool isVector() const { return Scale.hasValue() && Scale.getValue() != 0; }
|
||||||
bool isVector(unsigned Width) const {
|
bool isVector(unsigned Width) const {
|
||||||
return isVector() && ElementBitwidth == Width;
|
return isVector() && ElementBitwidth == Width;
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,9 +94,9 @@ public:
|
||||||
assert(!isDirectory() && "not a file");
|
assert(!isDirectory() && "not a file");
|
||||||
assert(Contents && "contents not initialized");
|
assert(Contents && "contents not initialized");
|
||||||
if (auto *Directives = Contents->DepDirectives.load()) {
|
if (auto *Directives = Contents->DepDirectives.load()) {
|
||||||
if (Directives->has_value())
|
if (Directives->hasValue())
|
||||||
return ArrayRef<dependency_directives_scan::Directive>(
|
return ArrayRef<dependency_directives_scan::Directive>(
|
||||||
Directives->value());
|
Directives->getValue());
|
||||||
}
|
}
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
|
@ -168,24 +168,24 @@ OMPDeclareTargetDeclAttr::getActiveAttr(const ValueDecl *VD) {
|
||||||
llvm::Optional<OMPDeclareTargetDeclAttr::MapTypeTy>
|
llvm::Optional<OMPDeclareTargetDeclAttr::MapTypeTy>
|
||||||
OMPDeclareTargetDeclAttr::isDeclareTargetDeclaration(const ValueDecl *VD) {
|
OMPDeclareTargetDeclAttr::isDeclareTargetDeclaration(const ValueDecl *VD) {
|
||||||
llvm::Optional<OMPDeclareTargetDeclAttr *> ActiveAttr = getActiveAttr(VD);
|
llvm::Optional<OMPDeclareTargetDeclAttr *> ActiveAttr = getActiveAttr(VD);
|
||||||
if (ActiveAttr)
|
if (ActiveAttr.hasValue())
|
||||||
return ActiveAttr.value()->getMapType();
|
return ActiveAttr.getValue()->getMapType();
|
||||||
return llvm::None;
|
return llvm::None;
|
||||||
}
|
}
|
||||||
|
|
||||||
llvm::Optional<OMPDeclareTargetDeclAttr::DevTypeTy>
|
llvm::Optional<OMPDeclareTargetDeclAttr::DevTypeTy>
|
||||||
OMPDeclareTargetDeclAttr::getDeviceType(const ValueDecl *VD) {
|
OMPDeclareTargetDeclAttr::getDeviceType(const ValueDecl *VD) {
|
||||||
llvm::Optional<OMPDeclareTargetDeclAttr *> ActiveAttr = getActiveAttr(VD);
|
llvm::Optional<OMPDeclareTargetDeclAttr *> ActiveAttr = getActiveAttr(VD);
|
||||||
if (ActiveAttr)
|
if (ActiveAttr.hasValue())
|
||||||
return ActiveAttr.value()->getDevType();
|
return ActiveAttr.getValue()->getDevType();
|
||||||
return llvm::None;
|
return llvm::None;
|
||||||
}
|
}
|
||||||
|
|
||||||
llvm::Optional<SourceLocation>
|
llvm::Optional<SourceLocation>
|
||||||
OMPDeclareTargetDeclAttr::getLocation(const ValueDecl *VD) {
|
OMPDeclareTargetDeclAttr::getLocation(const ValueDecl *VD) {
|
||||||
llvm::Optional<OMPDeclareTargetDeclAttr *> ActiveAttr = getActiveAttr(VD);
|
llvm::Optional<OMPDeclareTargetDeclAttr *> ActiveAttr = getActiveAttr(VD);
|
||||||
if (ActiveAttr)
|
if (ActiveAttr.hasValue())
|
||||||
return ActiveAttr.value()->getRange().getBegin();
|
return ActiveAttr.getValue()->getRange().getBegin();
|
||||||
return llvm::None;
|
return llvm::None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -397,9 +397,9 @@ bool Parser::parseIdentifierPrefixImpl(VariantValue *Value) {
|
||||||
assert(NamedValue.isMatcher());
|
assert(NamedValue.isMatcher());
|
||||||
llvm::Optional<DynTypedMatcher> Result =
|
llvm::Optional<DynTypedMatcher> Result =
|
||||||
NamedValue.getMatcher().getSingleMatcher();
|
NamedValue.getMatcher().getSingleMatcher();
|
||||||
if (Result) {
|
if (Result.hasValue()) {
|
||||||
llvm::Optional<DynTypedMatcher> Bound = Result->tryBind(BindID);
|
llvm::Optional<DynTypedMatcher> Bound = Result->tryBind(BindID);
|
||||||
if (Bound) {
|
if (Bound.hasValue()) {
|
||||||
*Value = VariantMatcher::SingleMatcher(*Bound);
|
*Value = VariantMatcher::SingleMatcher(*Bound);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -797,9 +797,9 @@ VariantMatcher Registry::constructBoundMatcher(MatcherCtor Ctor,
|
||||||
if (Out.isNull()) return Out;
|
if (Out.isNull()) return Out;
|
||||||
|
|
||||||
llvm::Optional<DynTypedMatcher> Result = Out.getSingleMatcher();
|
llvm::Optional<DynTypedMatcher> Result = Out.getSingleMatcher();
|
||||||
if (Result) {
|
if (Result.hasValue()) {
|
||||||
llvm::Optional<DynTypedMatcher> Bound = Result->tryBind(BindID);
|
llvm::Optional<DynTypedMatcher> Bound = Result->tryBind(BindID);
|
||||||
if (Bound) {
|
if (Bound.hasValue()) {
|
||||||
return VariantMatcher::SingleMatcher(*Bound);
|
return VariantMatcher::SingleMatcher(*Bound);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -697,8 +697,8 @@ static Stmt *create_OSAtomicCompareAndSwap(ASTContext &C, const FunctionDecl *D)
|
||||||
|
|
||||||
Stmt *BodyFarm::getBody(const FunctionDecl *D) {
|
Stmt *BodyFarm::getBody(const FunctionDecl *D) {
|
||||||
Optional<Stmt *> &Val = Bodies[D];
|
Optional<Stmt *> &Val = Bodies[D];
|
||||||
if (Val)
|
if (Val.hasValue())
|
||||||
return *Val;
|
return Val.getValue();
|
||||||
|
|
||||||
Val = nullptr;
|
Val = nullptr;
|
||||||
|
|
||||||
|
@ -872,8 +872,8 @@ Stmt *BodyFarm::getBody(const ObjCMethodDecl *D) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
Optional<Stmt *> &Val = Bodies[D];
|
Optional<Stmt *> &Val = Bodies[D];
|
||||||
if (Val)
|
if (Val.hasValue())
|
||||||
return *Val;
|
return Val.getValue();
|
||||||
Val = nullptr;
|
Val = nullptr;
|
||||||
|
|
||||||
// For now, we only synthesize getters.
|
// For now, we only synthesize getters.
|
||||||
|
|
|
@ -31,10 +31,13 @@ buildStmtToBasicBlockMap(const CFG &Cfg) {
|
||||||
if (Block == nullptr)
|
if (Block == nullptr)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (const CFGElement &Element : *Block)
|
for (const CFGElement &Element : *Block) {
|
||||||
if (auto Stmt = Element.getAs<CFGStmt>())
|
auto Stmt = Element.getAs<CFGStmt>();
|
||||||
StmtToBlock[Stmt->getStmt()] = Block;
|
if (!Stmt.hasValue())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
StmtToBlock[Stmt.getValue().getStmt()] = Block;
|
||||||
|
}
|
||||||
if (const Stmt *TerminatorStmt = Block->getTerminatorStmt())
|
if (const Stmt *TerminatorStmt = Block->getTerminatorStmt())
|
||||||
StmtToBlock[TerminatorStmt] = Block;
|
StmtToBlock[TerminatorStmt] = Block;
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,8 +50,8 @@ public:
|
||||||
auto BlockIT = CFCtx.getStmtToBlock().find(&ignoreCFGOmittedNodes(S));
|
auto BlockIT = CFCtx.getStmtToBlock().find(&ignoreCFGOmittedNodes(S));
|
||||||
assert(BlockIT != CFCtx.getStmtToBlock().end());
|
assert(BlockIT != CFCtx.getStmtToBlock().end());
|
||||||
const auto &State = BlockToState[BlockIT->getSecond()->getBlockID()];
|
const auto &State = BlockToState[BlockIT->getSecond()->getBlockID()];
|
||||||
assert(State);
|
assert(State.hasValue());
|
||||||
return &State->Env;
|
return &State.getValue().Env;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -209,10 +209,10 @@ static TypeErasedDataflowAnalysisState computeBlockInputState(
|
||||||
// loop back edge to `Block`.
|
// loop back edge to `Block`.
|
||||||
const llvm::Optional<TypeErasedDataflowAnalysisState> &MaybePredState =
|
const llvm::Optional<TypeErasedDataflowAnalysisState> &MaybePredState =
|
||||||
BlockStates[Pred->getBlockID()];
|
BlockStates[Pred->getBlockID()];
|
||||||
if (!MaybePredState)
|
if (!MaybePredState.hasValue())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
TypeErasedDataflowAnalysisState PredState = *MaybePredState;
|
TypeErasedDataflowAnalysisState PredState = MaybePredState.getValue();
|
||||||
if (ApplyBuiltinTransfer) {
|
if (ApplyBuiltinTransfer) {
|
||||||
if (const Stmt *PredTerminatorStmt = Pred->getTerminatorStmt()) {
|
if (const Stmt *PredTerminatorStmt = Pred->getTerminatorStmt()) {
|
||||||
const StmtToEnvMapImpl StmtToEnv(CFCtx, BlockStates);
|
const StmtToEnvMapImpl StmtToEnv(CFCtx, BlockStates);
|
||||||
|
@ -222,14 +222,14 @@ static TypeErasedDataflowAnalysisState computeBlockInputState(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MaybeState) {
|
if (MaybeState.hasValue()) {
|
||||||
Analysis.joinTypeErased(MaybeState->Lattice, PredState.Lattice);
|
Analysis.joinTypeErased(MaybeState->Lattice, PredState.Lattice);
|
||||||
MaybeState->Env.join(PredState.Env, Analysis);
|
MaybeState->Env.join(PredState.Env, Analysis);
|
||||||
} else {
|
} else {
|
||||||
MaybeState = std::move(PredState);
|
MaybeState = std::move(PredState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!MaybeState) {
|
if (!MaybeState.hasValue()) {
|
||||||
// FIXME: Consider passing `Block` to `Analysis.typeErasedInitialElement()`
|
// FIXME: Consider passing `Block` to `Analysis.typeErasedInitialElement()`
|
||||||
// to enable building analyses like computation of dominators that
|
// to enable building analyses like computation of dominators that
|
||||||
// initialize the state of each basic block differently.
|
// initialize the state of each basic block differently.
|
||||||
|
@ -367,8 +367,8 @@ runTypeErasedDataflowAnalysis(const ControlFlowContext &CFCtx,
|
||||||
TypeErasedDataflowAnalysisState NewBlockState =
|
TypeErasedDataflowAnalysisState NewBlockState =
|
||||||
transferBlock(CFCtx, BlockStates, *Block, InitEnv, Analysis);
|
transferBlock(CFCtx, BlockStates, *Block, InitEnv, Analysis);
|
||||||
|
|
||||||
if (OldBlockState &&
|
if (OldBlockState.hasValue() &&
|
||||||
Analysis.isEqualTypeErased(OldBlockState->Lattice,
|
Analysis.isEqualTypeErased(OldBlockState.getValue().Lattice,
|
||||||
NewBlockState.Lattice) &&
|
NewBlockState.Lattice) &&
|
||||||
OldBlockState->Env.equivalentTo(NewBlockState.Env, Analysis)) {
|
OldBlockState->Env.equivalentTo(NewBlockState.Env, Analysis)) {
|
||||||
// The state of `Block` didn't change after transfer so there's no need to
|
// The state of `Block` didn't change after transfer so there's no need to
|
||||||
|
|
|
@ -319,8 +319,8 @@ static Optional<bool> comparePath(const PathPieces &X, const PathPieces &Y) {
|
||||||
|
|
||||||
for ( ; X_I != X_end && Y_I != Y_end; ++X_I, ++Y_I) {
|
for ( ; X_I != X_end && Y_I != Y_end; ++X_I, ++Y_I) {
|
||||||
Optional<bool> b = comparePiece(**X_I, **Y_I);
|
Optional<bool> b = comparePiece(**X_I, **Y_I);
|
||||||
if (b)
|
if (b.hasValue())
|
||||||
return *b;
|
return b.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
return None;
|
return None;
|
||||||
|
@ -396,8 +396,8 @@ static bool compare(const PathDiagnostic &X, const PathDiagnostic &Y) {
|
||||||
return (*XI) < (*YI);
|
return (*XI) < (*YI);
|
||||||
}
|
}
|
||||||
Optional<bool> b = comparePath(X.path, Y.path);
|
Optional<bool> b = comparePath(X.path, Y.path);
|
||||||
assert(b);
|
assert(b.hasValue());
|
||||||
return *b;
|
return b.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PathDiagnosticConsumer::FlushDiagnostics(
|
void PathDiagnosticConsumer::FlushDiagnostics(
|
||||||
|
|
|
@ -148,8 +148,8 @@ public:
|
||||||
Value getValue(const CFGBlock *block, const CFGBlock *dstBlock,
|
Value getValue(const CFGBlock *block, const CFGBlock *dstBlock,
|
||||||
const VarDecl *vd) {
|
const VarDecl *vd) {
|
||||||
const Optional<unsigned> &idx = declToIndex.getValueIndex(vd);
|
const Optional<unsigned> &idx = declToIndex.getValueIndex(vd);
|
||||||
assert(idx);
|
assert(idx.hasValue());
|
||||||
return getValueVector(block)[*idx];
|
return getValueVector(block)[idx.getValue()];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -209,8 +209,8 @@ void CFGBlockValues::resetScratch() {
|
||||||
|
|
||||||
ValueVector::reference CFGBlockValues::operator[](const VarDecl *vd) {
|
ValueVector::reference CFGBlockValues::operator[](const VarDecl *vd) {
|
||||||
const Optional<unsigned> &idx = declToIndex.getValueIndex(vd);
|
const Optional<unsigned> &idx = declToIndex.getValueIndex(vd);
|
||||||
assert(idx);
|
assert(idx.hasValue());
|
||||||
return scratch[*idx];
|
return scratch[idx.getValue()];
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------====//
|
//------------------------------------------------------------------------====//
|
||||||
|
|
|
@ -251,8 +251,8 @@ bool RISCVTargetInfo::hasFeature(StringRef Feature) const {
|
||||||
.Case("riscv64", Is64Bit)
|
.Case("riscv64", Is64Bit)
|
||||||
.Case("64bit", Is64Bit)
|
.Case("64bit", Is64Bit)
|
||||||
.Default(None);
|
.Default(None);
|
||||||
if (Result)
|
if (Result.hasValue())
|
||||||
return *Result;
|
return Result.getValue();
|
||||||
|
|
||||||
if (ISAInfo->isSupportedExtensionFeature(Feature))
|
if (ISAInfo->isSupportedExtensionFeature(Feature))
|
||||||
return ISAInfo->hasExtension(Feature);
|
return ISAInfo->hasExtension(Feature);
|
||||||
|
|
|
@ -1782,15 +1782,15 @@ namespace {
|
||||||
if (!StartIndex)
|
if (!StartIndex)
|
||||||
StartIndex = FieldIndex;
|
StartIndex = FieldIndex;
|
||||||
} else if (StartIndex) {
|
} else if (StartIndex) {
|
||||||
EHStack.pushCleanup<SanitizeDtorFieldRange>(NormalAndEHCleanup, DD,
|
EHStack.pushCleanup<SanitizeDtorFieldRange>(
|
||||||
*StartIndex, FieldIndex);
|
NormalAndEHCleanup, DD, StartIndex.getValue(), FieldIndex);
|
||||||
StartIndex = None;
|
StartIndex = None;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void End() {
|
void End() {
|
||||||
if (StartIndex)
|
if (StartIndex)
|
||||||
EHStack.pushCleanup<SanitizeDtorFieldRange>(NormalAndEHCleanup, DD,
|
EHStack.pushCleanup<SanitizeDtorFieldRange>(NormalAndEHCleanup, DD,
|
||||||
*StartIndex, -1);
|
StartIndex.getValue(), -1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
} // end anonymous namespace
|
} // end anonymous namespace
|
||||||
|
|
|
@ -2826,12 +2826,12 @@ bool CodeGenModule::isProfileInstrExcluded(llvm::Function *Fn,
|
||||||
CodeGenOptions::ProfileInstrKind Kind = getCodeGenOpts().getProfileInstr();
|
CodeGenOptions::ProfileInstrKind Kind = getCodeGenOpts().getProfileInstr();
|
||||||
// First, check the function name.
|
// First, check the function name.
|
||||||
Optional<bool> V = ProfileList.isFunctionExcluded(Fn->getName(), Kind);
|
Optional<bool> V = ProfileList.isFunctionExcluded(Fn->getName(), Kind);
|
||||||
if (V)
|
if (V.hasValue())
|
||||||
return *V;
|
return *V;
|
||||||
// Next, check the source location.
|
// Next, check the source location.
|
||||||
if (Loc.isValid()) {
|
if (Loc.isValid()) {
|
||||||
Optional<bool> V = ProfileList.isLocationExcluded(Loc, Kind);
|
Optional<bool> V = ProfileList.isLocationExcluded(Loc, Kind);
|
||||||
if (V)
|
if (V.hasValue())
|
||||||
return *V;
|
return *V;
|
||||||
}
|
}
|
||||||
// If location is unknown, this may be a compiler-generated function. Assume
|
// If location is unknown, this may be a compiler-generated function. Assume
|
||||||
|
|
|
@ -3325,8 +3325,8 @@ class OffloadingActionBuilder final {
|
||||||
A = C.getDriver().ConstructPhaseAction(C, Args, CurPhase, A,
|
A = C.getDriver().ConstructPhaseAction(C, Args, CurPhase, A,
|
||||||
AssociatedOffloadKind);
|
AssociatedOffloadKind);
|
||||||
|
|
||||||
if (CompileDeviceOnly && CurPhase == FinalPhase && BundleOutput &&
|
if (CompileDeviceOnly && CurPhase == FinalPhase &&
|
||||||
*BundleOutput) {
|
BundleOutput.hasValue() && BundleOutput.getValue()) {
|
||||||
for (unsigned I = 0, E = GpuArchList.size(); I != E; ++I) {
|
for (unsigned I = 0, E = GpuArchList.size(); I != E; ++I) {
|
||||||
OffloadAction::DeviceDependences DDep;
|
OffloadAction::DeviceDependences DDep;
|
||||||
DDep.add(*CudaDeviceActions[I], *ToolChains.front(), GpuArchList[I],
|
DDep.add(*CudaDeviceActions[I], *ToolChains.front(), GpuArchList[I],
|
||||||
|
|
|
@ -475,9 +475,9 @@ void AVR::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
||||||
D.Diag(diag::warn_drv_avr_stdlib_not_linked);
|
D.Diag(diag::warn_drv_avr_stdlib_not_linked);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SectionAddressData) {
|
if (SectionAddressData.hasValue()) {
|
||||||
std::string DataSectionArg =
|
std::string DataSectionArg = std::string("-Tdata=0x") +
|
||||||
std::string("-Tdata=0x") + llvm::utohexstr(*SectionAddressData);
|
llvm::utohexstr(SectionAddressData.getValue());
|
||||||
CmdArgs.push_back(Args.MakeArgString(DataSectionArg));
|
CmdArgs.push_back(Args.MakeArgString(DataSectionArg));
|
||||||
} else {
|
} else {
|
||||||
// We do not have an entry for this CPU in the address mapping table yet.
|
// We do not have an entry for this CPU in the address mapping table yet.
|
||||||
|
|
|
@ -2340,8 +2340,8 @@ void Clang::AddHexagonTargetArgs(const ArgList &Args,
|
||||||
|
|
||||||
if (auto G = toolchains::HexagonToolChain::getSmallDataThreshold(Args)) {
|
if (auto G = toolchains::HexagonToolChain::getSmallDataThreshold(Args)) {
|
||||||
CmdArgs.push_back("-mllvm");
|
CmdArgs.push_back("-mllvm");
|
||||||
CmdArgs.push_back(
|
CmdArgs.push_back(Args.MakeArgString("-hexagon-small-data-threshold=" +
|
||||||
Args.MakeArgString("-hexagon-small-data-threshold=" + Twine(*G)));
|
Twine(G.getValue())));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Args.hasArg(options::OPT_fno_short_enums))
|
if (!Args.hasArg(options::OPT_fno_short_enums))
|
||||||
|
|
|
@ -2086,8 +2086,8 @@ void Generic_GCC::GCCInstallationDetector::print(raw_ostream &OS) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Generic_GCC::GCCInstallationDetector::getBiarchSibling(Multilib &M) const {
|
bool Generic_GCC::GCCInstallationDetector::getBiarchSibling(Multilib &M) const {
|
||||||
if (BiarchSibling) {
|
if (BiarchSibling.hasValue()) {
|
||||||
M = *BiarchSibling;
|
M = BiarchSibling.getValue();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -340,8 +340,8 @@ constructHexagonLinkArgs(Compilation &C, const JobAction &JA,
|
||||||
CmdArgs.push_back("-pie");
|
CmdArgs.push_back("-pie");
|
||||||
|
|
||||||
if (auto G = toolchains::HexagonToolChain::getSmallDataThreshold(Args)) {
|
if (auto G = toolchains::HexagonToolChain::getSmallDataThreshold(Args)) {
|
||||||
CmdArgs.push_back(Args.MakeArgString("-G" + Twine(*G)));
|
CmdArgs.push_back(Args.MakeArgString("-G" + Twine(G.getValue())));
|
||||||
UseG0 = *G == 0;
|
UseG0 = G.getValue() == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
CmdArgs.push_back("-o");
|
CmdArgs.push_back("-o");
|
||||||
|
|
|
@ -725,11 +725,11 @@ static bool getLiteralInfo(SourceRange literalRange,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!UpperU && !UpperL)
|
if (!UpperU.hasValue() && !UpperL.hasValue())
|
||||||
UpperU = UpperL = true;
|
UpperU = UpperL = true;
|
||||||
else if (UpperU && !UpperL)
|
else if (UpperU.hasValue() && !UpperL.hasValue())
|
||||||
UpperL = UpperU;
|
UpperL = UpperU;
|
||||||
else if (UpperL && !UpperU)
|
else if (UpperL.hasValue() && !UpperU.hasValue())
|
||||||
UpperU = UpperL;
|
UpperU = UpperL;
|
||||||
|
|
||||||
Info.U = *UpperU ? "U" : "u";
|
Info.U = *UpperU ? "U" : "u";
|
||||||
|
|
|
@ -31,14 +31,14 @@ namespace {
|
||||||
/// at position \p Key.
|
/// at position \p Key.
|
||||||
void serializeObject(Object &Paren, StringRef Key, Optional<Object> Obj) {
|
void serializeObject(Object &Paren, StringRef Key, Optional<Object> Obj) {
|
||||||
if (Obj)
|
if (Obj)
|
||||||
Paren[Key] = std::move(*Obj);
|
Paren[Key] = std::move(Obj.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Helper function to inject a JSON array \p Array into object \p Paren at
|
/// Helper function to inject a JSON array \p Array into object \p Paren at
|
||||||
/// position \p Key.
|
/// position \p Key.
|
||||||
void serializeArray(Object &Paren, StringRef Key, Optional<Array> Array) {
|
void serializeArray(Object &Paren, StringRef Key, Optional<Array> Array) {
|
||||||
if (Array)
|
if (Array)
|
||||||
Paren[Key] = std::move(*Array);
|
Paren[Key] = std::move(Array.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Serialize a \c VersionTuple \p V with the Symbol Graph semantic version
|
/// Serialize a \c VersionTuple \p V with the Symbol Graph semantic version
|
||||||
|
|
|
@ -115,9 +115,9 @@ bool CompilerInstance::createTarget() {
|
||||||
auto TO = std::make_shared<TargetOptions>();
|
auto TO = std::make_shared<TargetOptions>();
|
||||||
TO->Triple = llvm::Triple::normalize(getFrontendOpts().AuxTriple);
|
TO->Triple = llvm::Triple::normalize(getFrontendOpts().AuxTriple);
|
||||||
if (getFrontendOpts().AuxTargetCPU)
|
if (getFrontendOpts().AuxTargetCPU)
|
||||||
TO->CPU = *getFrontendOpts().AuxTargetCPU;
|
TO->CPU = getFrontendOpts().AuxTargetCPU.getValue();
|
||||||
if (getFrontendOpts().AuxTargetFeatures)
|
if (getFrontendOpts().AuxTargetFeatures)
|
||||||
TO->FeaturesAsWritten = *getFrontendOpts().AuxTargetFeatures;
|
TO->FeaturesAsWritten = getFrontendOpts().AuxTargetFeatures.getValue();
|
||||||
TO->HostTriple = getTarget().getTriple().str();
|
TO->HostTriple = getTarget().getTriple().str();
|
||||||
setAuxTarget(TargetInfo::CreateTargetInfo(getDiagnostics(), TO));
|
setAuxTarget(TargetInfo::CreateTargetInfo(getDiagnostics(), TO));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1951,8 +1951,8 @@ bool CompilerInvocation::ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args,
|
||||||
<< "-fdiagnostics-hotness-threshold=";
|
<< "-fdiagnostics-hotness-threshold=";
|
||||||
} else {
|
} else {
|
||||||
Opts.DiagnosticsHotnessThreshold = *ResultOrErr;
|
Opts.DiagnosticsHotnessThreshold = *ResultOrErr;
|
||||||
if ((!Opts.DiagnosticsHotnessThreshold ||
|
if ((!Opts.DiagnosticsHotnessThreshold.hasValue() ||
|
||||||
*Opts.DiagnosticsHotnessThreshold > 0) &&
|
Opts.DiagnosticsHotnessThreshold.getValue() > 0) &&
|
||||||
!UsingProfile)
|
!UsingProfile)
|
||||||
Diags.Report(diag::warn_drv_diagnostics_hotness_requires_pgo)
|
Diags.Report(diag::warn_drv_diagnostics_hotness_requires_pgo)
|
||||||
<< "-fdiagnostics-hotness-threshold=";
|
<< "-fdiagnostics-hotness-threshold=";
|
||||||
|
@ -1968,8 +1968,8 @@ bool CompilerInvocation::ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args,
|
||||||
<< "-fdiagnostics-misexpect-tolerance=";
|
<< "-fdiagnostics-misexpect-tolerance=";
|
||||||
} else {
|
} else {
|
||||||
Opts.DiagnosticsMisExpectTolerance = *ResultOrErr;
|
Opts.DiagnosticsMisExpectTolerance = *ResultOrErr;
|
||||||
if ((!Opts.DiagnosticsMisExpectTolerance ||
|
if ((!Opts.DiagnosticsMisExpectTolerance.hasValue() ||
|
||||||
*Opts.DiagnosticsMisExpectTolerance > 0) &&
|
Opts.DiagnosticsMisExpectTolerance.getValue() > 0) &&
|
||||||
!UsingProfile)
|
!UsingProfile)
|
||||||
Diags.Report(diag::warn_drv_diagnostics_misexpect_requires_pgo)
|
Diags.Report(diag::warn_drv_diagnostics_misexpect_requires_pgo)
|
||||||
<< "-fdiagnostics-misexpect-tolerance=";
|
<< "-fdiagnostics-misexpect-tolerance=";
|
||||||
|
@ -2578,10 +2578,10 @@ static void GenerateFrontendArgs(const FrontendOptions &Opts,
|
||||||
for (const auto &ModuleFile : Opts.ModuleFiles)
|
for (const auto &ModuleFile : Opts.ModuleFiles)
|
||||||
GenerateArg(Args, OPT_fmodule_file, ModuleFile, SA);
|
GenerateArg(Args, OPT_fmodule_file, ModuleFile, SA);
|
||||||
|
|
||||||
if (Opts.AuxTargetCPU)
|
if (Opts.AuxTargetCPU.hasValue())
|
||||||
GenerateArg(Args, OPT_aux_target_cpu, *Opts.AuxTargetCPU, SA);
|
GenerateArg(Args, OPT_aux_target_cpu, *Opts.AuxTargetCPU, SA);
|
||||||
|
|
||||||
if (Opts.AuxTargetFeatures)
|
if (Opts.AuxTargetFeatures.hasValue())
|
||||||
for (const auto &Feature : *Opts.AuxTargetFeatures)
|
for (const auto &Feature : *Opts.AuxTargetFeatures)
|
||||||
GenerateArg(Args, OPT_aux_target_feature, Feature, SA);
|
GenerateArg(Args, OPT_aux_target_feature, Feature, SA);
|
||||||
|
|
||||||
|
|
|
@ -831,12 +831,12 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
|
||||||
VersionTuple tuple = LangOpts.ObjCRuntime.getVersion();
|
VersionTuple tuple = LangOpts.ObjCRuntime.getVersion();
|
||||||
|
|
||||||
unsigned minor = 0;
|
unsigned minor = 0;
|
||||||
if (tuple.getMinor())
|
if (tuple.getMinor().hasValue())
|
||||||
minor = *tuple.getMinor();
|
minor = tuple.getMinor().getValue();
|
||||||
|
|
||||||
unsigned subminor = 0;
|
unsigned subminor = 0;
|
||||||
if (tuple.getSubminor())
|
if (tuple.getSubminor().hasValue())
|
||||||
subminor = *tuple.getSubminor();
|
subminor = tuple.getSubminor().getValue();
|
||||||
|
|
||||||
Builder.defineMacro("__OBJFW_RUNTIME_ABI__",
|
Builder.defineMacro("__OBJFW_RUNTIME_ABI__",
|
||||||
Twine(tuple.getMajor() * 10000 + minor * 100 +
|
Twine(tuple.getMajor() * 10000 + minor * 100 +
|
||||||
|
|
|
@ -549,8 +549,8 @@ Scanner::tryLexIdentifierOrSkipLine(const char *&First, const char *const End) {
|
||||||
|
|
||||||
StringRef Scanner::lexIdentifier(const char *&First, const char *const End) {
|
StringRef Scanner::lexIdentifier(const char *&First, const char *const End) {
|
||||||
Optional<StringRef> Id = tryLexIdentifierOrSkipLine(First, End);
|
Optional<StringRef> Id = tryLexIdentifierOrSkipLine(First, End);
|
||||||
assert(Id && "expected identifier token");
|
assert(Id.hasValue() && "expected identifier token");
|
||||||
return *Id;
|
return Id.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Scanner::isNextIdentifierOrSkipLine(StringRef Id, const char *&First,
|
bool Scanner::isNextIdentifierOrSkipLine(StringRef Id, const char *&First,
|
||||||
|
|
|
@ -209,11 +209,12 @@ MacroDirective::DefInfo MacroDirective::getDefinition() {
|
||||||
}
|
}
|
||||||
|
|
||||||
VisibilityMacroDirective *VisMD = cast<VisibilityMacroDirective>(MD);
|
VisibilityMacroDirective *VisMD = cast<VisibilityMacroDirective>(MD);
|
||||||
if (!isPublic)
|
if (!isPublic.hasValue())
|
||||||
isPublic = VisMD->isPublic();
|
isPublic = VisMD->isPublic();
|
||||||
}
|
}
|
||||||
|
|
||||||
return DefInfo(nullptr, UndefLoc, !isPublic || *isPublic);
|
return DefInfo(nullptr, UndefLoc,
|
||||||
|
!isPublic.hasValue() || isPublic.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
const MacroDirective::DefInfo
|
const MacroDirective::DefInfo
|
||||||
|
|
|
@ -1219,8 +1219,8 @@ void ModuleMap::resolveHeaderDirectives(
|
||||||
Module *Mod, llvm::Optional<const FileEntry *> File) const {
|
Module *Mod, llvm::Optional<const FileEntry *> File) const {
|
||||||
bool NeedsFramework = false;
|
bool NeedsFramework = false;
|
||||||
SmallVector<Module::UnresolvedHeaderDirective, 1> NewHeaders;
|
SmallVector<Module::UnresolvedHeaderDirective, 1> NewHeaders;
|
||||||
const auto Size = File ? File.value()->getSize() : 0;
|
const auto Size = File ? File.getValue()->getSize() : 0;
|
||||||
const auto ModTime = File ? File.value()->getModificationTime() : 0;
|
const auto ModTime = File ? File.getValue()->getModificationTime() : 0;
|
||||||
|
|
||||||
for (auto &Header : Mod->UnresolvedHeaders) {
|
for (auto &Header : Mod->UnresolvedHeaders) {
|
||||||
if (File && ((Header.ModTime && Header.ModTime != ModTime) ||
|
if (File && ((Header.ModTime && Header.ModTime != ModTime) ||
|
||||||
|
|
|
@ -1325,11 +1325,11 @@ already_lexed:
|
||||||
|
|
||||||
// The last ')' has been reached; return the value if one found or
|
// The last ')' has been reached; return the value if one found or
|
||||||
// a diagnostic and a dummy value.
|
// a diagnostic and a dummy value.
|
||||||
if (Result) {
|
if (Result.hasValue()) {
|
||||||
OS << *Result;
|
OS << Result.getValue();
|
||||||
// For strict conformance to __has_cpp_attribute rules, use 'L'
|
// For strict conformance to __has_cpp_attribute rules, use 'L'
|
||||||
// suffix for dated literals.
|
// suffix for dated literals.
|
||||||
if (*Result > 1)
|
if (Result.getValue() > 1)
|
||||||
OS << 'L';
|
OS << 'L';
|
||||||
} else {
|
} else {
|
||||||
OS << 0;
|
OS << 0;
|
||||||
|
|
|
@ -114,8 +114,8 @@ bool PreprocessingRecord::isEntityInFileID(iterator PPEI, FileID FID) {
|
||||||
// deserializing it.
|
// deserializing it.
|
||||||
Optional<bool> IsInFile =
|
Optional<bool> IsInFile =
|
||||||
ExternalSource->isPreprocessedEntityInFileID(LoadedIndex, FID);
|
ExternalSource->isPreprocessedEntityInFileID(LoadedIndex, FID);
|
||||||
if (IsInFile)
|
if (IsInFile.hasValue())
|
||||||
return *IsInFile;
|
return IsInFile.getValue();
|
||||||
|
|
||||||
// The external source did not provide a definite answer, go and deserialize
|
// The external source did not provide a definite answer, go and deserialize
|
||||||
// the entity to check it.
|
// the entity to check it.
|
||||||
|
|
|
@ -1873,13 +1873,14 @@ void Parser::ParseOMPDeclareTargetClauses(
|
||||||
if (IsDeviceTypeClause) {
|
if (IsDeviceTypeClause) {
|
||||||
Optional<SimpleClauseData> DevTypeData =
|
Optional<SimpleClauseData> DevTypeData =
|
||||||
parseOpenMPSimpleClause(*this, OMPC_device_type);
|
parseOpenMPSimpleClause(*this, OMPC_device_type);
|
||||||
if (DevTypeData) {
|
if (DevTypeData.hasValue()) {
|
||||||
if (DeviceTypeLoc.isValid()) {
|
if (DeviceTypeLoc.isValid()) {
|
||||||
// We already saw another device_type clause, diagnose it.
|
// We already saw another device_type clause, diagnose it.
|
||||||
Diag(DevTypeData->Loc, diag::warn_omp_more_one_device_type_clause);
|
Diag(DevTypeData.getValue().Loc,
|
||||||
|
diag::warn_omp_more_one_device_type_clause);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
switch (static_cast<OpenMPDeviceType>(DevTypeData->Type)) {
|
switch (static_cast<OpenMPDeviceType>(DevTypeData.getValue().Type)) {
|
||||||
case OMPC_DEVICE_TYPE_any:
|
case OMPC_DEVICE_TYPE_any:
|
||||||
DTCI.DT = OMPDeclareTargetDeclAttr::DT_Any;
|
DTCI.DT = OMPDeclareTargetDeclAttr::DT_Any;
|
||||||
break;
|
break;
|
||||||
|
@ -2312,9 +2313,9 @@ Parser::DeclGroupPtrTy Parser::ParseOpenMPDeclarativeDirectiveWithExtDecl(
|
||||||
Sema::DeclareTargetContextInfo DTCI(DKind, DTLoc);
|
Sema::DeclareTargetContextInfo DTCI(DKind, DTLoc);
|
||||||
if (HasClauses)
|
if (HasClauses)
|
||||||
ParseOMPDeclareTargetClauses(DTCI);
|
ParseOMPDeclareTargetClauses(DTCI);
|
||||||
bool HasImplicitMappings = DKind == OMPD_begin_declare_target ||
|
bool HasImplicitMappings =
|
||||||
!HasClauses ||
|
DKind == OMPD_begin_declare_target || !HasClauses ||
|
||||||
(DTCI.ExplicitlyMapped.empty() && DTCI.Indirect);
|
(DTCI.ExplicitlyMapped.empty() && DTCI.Indirect.hasValue());
|
||||||
|
|
||||||
// Skip the last annot_pragma_openmp_end.
|
// Skip the last annot_pragma_openmp_end.
|
||||||
ConsumeAnyToken();
|
ConsumeAnyToken();
|
||||||
|
@ -3619,18 +3620,20 @@ OMPClause *Parser::ParseOpenMPSimpleClause(OpenMPClauseKind Kind,
|
||||||
if (!Val || ParseOnly)
|
if (!Val || ParseOnly)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
if (getLangOpts().OpenMP < 51 && Kind == OMPC_default &&
|
if (getLangOpts().OpenMP < 51 && Kind == OMPC_default &&
|
||||||
(static_cast<DefaultKind>(Val->Type) == OMP_DEFAULT_private ||
|
(static_cast<DefaultKind>(Val.getValue().Type) == OMP_DEFAULT_private ||
|
||||||
static_cast<DefaultKind>(Val->Type) == OMP_DEFAULT_firstprivate)) {
|
static_cast<DefaultKind>(Val.getValue().Type) ==
|
||||||
Diag(Val->LOpen, diag::err_omp_invalid_dsa)
|
OMP_DEFAULT_firstprivate)) {
|
||||||
<< getOpenMPClauseName(static_cast<DefaultKind>(Val->Type) ==
|
Diag(Val.getValue().LOpen, diag::err_omp_invalid_dsa)
|
||||||
|
<< getOpenMPClauseName(static_cast<DefaultKind>(Val.getValue().Type) ==
|
||||||
OMP_DEFAULT_private
|
OMP_DEFAULT_private
|
||||||
? OMPC_private
|
? OMPC_private
|
||||||
: OMPC_firstprivate)
|
: OMPC_firstprivate)
|
||||||
<< getOpenMPClauseName(OMPC_default) << "5.1";
|
<< getOpenMPClauseName(OMPC_default) << "5.1";
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
return Actions.ActOnOpenMPSimpleClause(Kind, Val->Type, Val->TypeLoc,
|
return Actions.ActOnOpenMPSimpleClause(
|
||||||
Val->LOpen, Val->Loc, Val->RLoc);
|
Kind, Val.getValue().Type, Val.getValue().TypeLoc, Val.getValue().LOpen,
|
||||||
|
Val.getValue().Loc, Val.getValue().RLoc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Parsing of OpenMP clauses like 'ordered'.
|
/// Parsing of OpenMP clauses like 'ordered'.
|
||||||
|
|
|
@ -381,12 +381,13 @@ bool Sema::inferCUDATargetForImplicitSpecialMember(CXXRecordDecl *ClassDecl,
|
||||||
InferredTarget = BaseMethodTarget;
|
InferredTarget = BaseMethodTarget;
|
||||||
} else {
|
} else {
|
||||||
bool ResolutionError = resolveCalleeCUDATargetConflict(
|
bool ResolutionError = resolveCalleeCUDATargetConflict(
|
||||||
*InferredTarget, BaseMethodTarget, InferredTarget.getPointer());
|
InferredTarget.getValue(), BaseMethodTarget,
|
||||||
|
InferredTarget.getPointer());
|
||||||
if (ResolutionError) {
|
if (ResolutionError) {
|
||||||
if (Diagnose) {
|
if (Diagnose) {
|
||||||
Diag(ClassDecl->getLocation(),
|
Diag(ClassDecl->getLocation(),
|
||||||
diag::note_implicit_member_target_infer_collision)
|
diag::note_implicit_member_target_infer_collision)
|
||||||
<< (unsigned)CSM << *InferredTarget << BaseMethodTarget;
|
<< (unsigned)CSM << InferredTarget.getValue() << BaseMethodTarget;
|
||||||
}
|
}
|
||||||
MemberDecl->addAttr(CUDAInvalidTargetAttr::CreateImplicit(Context));
|
MemberDecl->addAttr(CUDAInvalidTargetAttr::CreateImplicit(Context));
|
||||||
return true;
|
return true;
|
||||||
|
@ -424,12 +425,14 @@ bool Sema::inferCUDATargetForImplicitSpecialMember(CXXRecordDecl *ClassDecl,
|
||||||
InferredTarget = FieldMethodTarget;
|
InferredTarget = FieldMethodTarget;
|
||||||
} else {
|
} else {
|
||||||
bool ResolutionError = resolveCalleeCUDATargetConflict(
|
bool ResolutionError = resolveCalleeCUDATargetConflict(
|
||||||
*InferredTarget, FieldMethodTarget, InferredTarget.getPointer());
|
InferredTarget.getValue(), FieldMethodTarget,
|
||||||
|
InferredTarget.getPointer());
|
||||||
if (ResolutionError) {
|
if (ResolutionError) {
|
||||||
if (Diagnose) {
|
if (Diagnose) {
|
||||||
Diag(ClassDecl->getLocation(),
|
Diag(ClassDecl->getLocation(),
|
||||||
diag::note_implicit_member_target_infer_collision)
|
diag::note_implicit_member_target_infer_collision)
|
||||||
<< (unsigned)CSM << *InferredTarget << FieldMethodTarget;
|
<< (unsigned)CSM << InferredTarget.getValue()
|
||||||
|
<< FieldMethodTarget;
|
||||||
}
|
}
|
||||||
MemberDecl->addAttr(CUDAInvalidTargetAttr::CreateImplicit(Context));
|
MemberDecl->addAttr(CUDAInvalidTargetAttr::CreateImplicit(Context));
|
||||||
return true;
|
return true;
|
||||||
|
@ -441,10 +444,10 @@ bool Sema::inferCUDATargetForImplicitSpecialMember(CXXRecordDecl *ClassDecl,
|
||||||
// If no target was inferred, mark this member as __host__ __device__;
|
// If no target was inferred, mark this member as __host__ __device__;
|
||||||
// it's the least restrictive option that can be invoked from any target.
|
// it's the least restrictive option that can be invoked from any target.
|
||||||
bool NeedsH = true, NeedsD = true;
|
bool NeedsH = true, NeedsD = true;
|
||||||
if (InferredTarget) {
|
if (InferredTarget.hasValue()) {
|
||||||
if (*InferredTarget == CFT_Device)
|
if (InferredTarget.getValue() == CFT_Device)
|
||||||
NeedsH = false;
|
NeedsH = false;
|
||||||
else if (*InferredTarget == CFT_Host)
|
else if (InferredTarget.getValue() == CFT_Host)
|
||||||
NeedsD = false;
|
NeedsD = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1873,9 +1873,9 @@ static ExprResult SemaBuiltinLaunder(Sema &S, CallExpr *TheCall) {
|
||||||
return 2;
|
return 2;
|
||||||
return llvm::Optional<unsigned>{};
|
return llvm::Optional<unsigned>{};
|
||||||
}();
|
}();
|
||||||
if (DiagSelect) {
|
if (DiagSelect.hasValue()) {
|
||||||
S.Diag(TheCall->getBeginLoc(), diag::err_builtin_launder_invalid_arg)
|
S.Diag(TheCall->getBeginLoc(), diag::err_builtin_launder_invalid_arg)
|
||||||
<< *DiagSelect << TheCall->getSourceRange();
|
<< DiagSelect.getValue() << TheCall->getSourceRange();
|
||||||
return ExprError();
|
return ExprError();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5362,8 +5362,8 @@ private:
|
||||||
// Overwrite existing if the new member has more info.
|
// Overwrite existing if the new member has more info.
|
||||||
// The preference of . vs :: vs -> is fairly arbitrary.
|
// The preference of . vs :: vs -> is fairly arbitrary.
|
||||||
if (/*Inserted*/ R.second ||
|
if (/*Inserted*/ R.second ||
|
||||||
std::make_tuple(M.ArgTypes.has_value(), M.ResultType != nullptr,
|
std::make_tuple(M.ArgTypes.hasValue(), M.ResultType != nullptr,
|
||||||
M.Operator) > std::make_tuple(O.ArgTypes.has_value(),
|
M.Operator) > std::make_tuple(O.ArgTypes.hasValue(),
|
||||||
O.ResultType != nullptr,
|
O.ResultType != nullptr,
|
||||||
O.Operator))
|
O.Operator))
|
||||||
O = std::move(M);
|
O = std::move(M);
|
||||||
|
|
|
@ -15444,9 +15444,9 @@ void Sema::AddKnownFunctionAttributesForReplaceableGlobalAllocationFunction(
|
||||||
// (3.1) If the allocation function takes an argument of type
|
// (3.1) If the allocation function takes an argument of type
|
||||||
// std::align_val_t, the storage will have the alignment
|
// std::align_val_t, the storage will have the alignment
|
||||||
// specified by the value of this argument.
|
// specified by the value of this argument.
|
||||||
if (AlignmentParam && !FD->hasAttr<AllocAlignAttr>()) {
|
if (AlignmentParam.hasValue() && !FD->hasAttr<AllocAlignAttr>()) {
|
||||||
FD->addAttr(AllocAlignAttr::CreateImplicit(
|
FD->addAttr(AllocAlignAttr::CreateImplicit(
|
||||||
Context, ParamIdx(*AlignmentParam, FD), FD->getLocation()));
|
Context, ParamIdx(AlignmentParam.getValue(), FD), FD->getLocation()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME:
|
// FIXME:
|
||||||
|
@ -19102,12 +19102,12 @@ Sema::FunctionEmissionStatus Sema::getEmissionStatus(FunctionDecl *FD,
|
||||||
// #pragma omp declare target to(*) device_type(*).
|
// #pragma omp declare target to(*) device_type(*).
|
||||||
// Therefore DevTy having no value does not imply host. The emission status
|
// Therefore DevTy having no value does not imply host. The emission status
|
||||||
// will be checked again at the end of compilation unit with Final = true.
|
// will be checked again at the end of compilation unit with Final = true.
|
||||||
if (DevTy)
|
if (DevTy.hasValue())
|
||||||
if (*DevTy == OMPDeclareTargetDeclAttr::DT_Host)
|
if (*DevTy == OMPDeclareTargetDeclAttr::DT_Host)
|
||||||
return FunctionEmissionStatus::OMPDiscarded;
|
return FunctionEmissionStatus::OMPDiscarded;
|
||||||
// If we have an explicit value for the device type, or we are in a target
|
// If we have an explicit value for the device type, or we are in a target
|
||||||
// declare context, we need to emit all extern and used symbols.
|
// declare context, we need to emit all extern and used symbols.
|
||||||
if (isInOpenMPDeclareTargetContext() || DevTy)
|
if (isInOpenMPDeclareTargetContext() || DevTy.hasValue())
|
||||||
if (IsEmittedForExternalSymbol())
|
if (IsEmittedForExternalSymbol())
|
||||||
return FunctionEmissionStatus::Emitted;
|
return FunctionEmissionStatus::Emitted;
|
||||||
// Device mode only emits what it must, if it wasn't tagged yet and needed,
|
// Device mode only emits what it must, if it wasn't tagged yet and needed,
|
||||||
|
|
|
@ -2673,19 +2673,19 @@ static void handleAvailabilityAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
|
||||||
if (IOSToWatchOSMapping) {
|
if (IOSToWatchOSMapping) {
|
||||||
if (auto MappedVersion = IOSToWatchOSMapping->map(
|
if (auto MappedVersion = IOSToWatchOSMapping->map(
|
||||||
Version, MinimumWatchOSVersion, None)) {
|
Version, MinimumWatchOSVersion, None)) {
|
||||||
return *MappedVersion;
|
return MappedVersion.getValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto Major = Version.getMajor();
|
auto Major = Version.getMajor();
|
||||||
auto NewMajor = Major >= 9 ? Major - 7 : 0;
|
auto NewMajor = Major >= 9 ? Major - 7 : 0;
|
||||||
if (NewMajor >= 2) {
|
if (NewMajor >= 2) {
|
||||||
if (Version.getMinor()) {
|
if (Version.getMinor().hasValue()) {
|
||||||
if (Version.getSubminor())
|
if (Version.getSubminor().hasValue())
|
||||||
return VersionTuple(NewMajor, *Version.getMinor(),
|
return VersionTuple(NewMajor, Version.getMinor().getValue(),
|
||||||
*Version.getSubminor());
|
Version.getSubminor().getValue());
|
||||||
else
|
else
|
||||||
return VersionTuple(NewMajor, *Version.getMinor());
|
return VersionTuple(NewMajor, Version.getMinor().getValue());
|
||||||
}
|
}
|
||||||
return VersionTuple(NewMajor);
|
return VersionTuple(NewMajor);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2274,10 +2274,10 @@ Sema::BuildCXXNew(SourceRange Range, bool UseGlobal,
|
||||||
|
|
||||||
// How many bytes do we want to allocate here?
|
// How many bytes do we want to allocate here?
|
||||||
llvm::Optional<llvm::APInt> AllocationSize;
|
llvm::Optional<llvm::APInt> AllocationSize;
|
||||||
if (!ArraySize && !AllocType->isDependentType()) {
|
if (!ArraySize.hasValue() && !AllocType->isDependentType()) {
|
||||||
// For non-array operator new, we only want to allocate one element.
|
// For non-array operator new, we only want to allocate one element.
|
||||||
AllocationSize = SingleEltSize;
|
AllocationSize = SingleEltSize;
|
||||||
} else if (KnownArraySize && !AllocType->isDependentType()) {
|
} else if (KnownArraySize.hasValue() && !AllocType->isDependentType()) {
|
||||||
// For array operator new, only deal with static array size case.
|
// For array operator new, only deal with static array size case.
|
||||||
bool Overflow;
|
bool Overflow;
|
||||||
AllocationSize = llvm::APInt(SizeTyWidth, *KnownArraySize)
|
AllocationSize = llvm::APInt(SizeTyWidth, *KnownArraySize)
|
||||||
|
|
|
@ -822,29 +822,29 @@ public:
|
||||||
/// false - otherwise.
|
/// false - otherwise.
|
||||||
bool isOrderedRegion() const {
|
bool isOrderedRegion() const {
|
||||||
if (const SharingMapTy *Top = getTopOfStackOrNull())
|
if (const SharingMapTy *Top = getTopOfStackOrNull())
|
||||||
return Top->OrderedRegion.has_value();
|
return Top->OrderedRegion.hasValue();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
/// Returns optional parameter for the ordered region.
|
/// Returns optional parameter for the ordered region.
|
||||||
std::pair<const Expr *, OMPOrderedClause *> getOrderedRegionParam() const {
|
std::pair<const Expr *, OMPOrderedClause *> getOrderedRegionParam() const {
|
||||||
if (const SharingMapTy *Top = getTopOfStackOrNull())
|
if (const SharingMapTy *Top = getTopOfStackOrNull())
|
||||||
if (Top->OrderedRegion)
|
if (Top->OrderedRegion.hasValue())
|
||||||
return *Top->OrderedRegion;
|
return Top->OrderedRegion.getValue();
|
||||||
return std::make_pair(nullptr, nullptr);
|
return std::make_pair(nullptr, nullptr);
|
||||||
}
|
}
|
||||||
/// Returns true, if parent region is ordered (has associated
|
/// Returns true, if parent region is ordered (has associated
|
||||||
/// 'ordered' clause), false - otherwise.
|
/// 'ordered' clause), false - otherwise.
|
||||||
bool isParentOrderedRegion() const {
|
bool isParentOrderedRegion() const {
|
||||||
if (const SharingMapTy *Parent = getSecondOnStackOrNull())
|
if (const SharingMapTy *Parent = getSecondOnStackOrNull())
|
||||||
return Parent->OrderedRegion.has_value();
|
return Parent->OrderedRegion.hasValue();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
/// Returns optional parameter for the ordered region.
|
/// Returns optional parameter for the ordered region.
|
||||||
std::pair<const Expr *, OMPOrderedClause *>
|
std::pair<const Expr *, OMPOrderedClause *>
|
||||||
getParentOrderedRegionParam() const {
|
getParentOrderedRegionParam() const {
|
||||||
if (const SharingMapTy *Parent = getSecondOnStackOrNull())
|
if (const SharingMapTy *Parent = getSecondOnStackOrNull())
|
||||||
if (Parent->OrderedRegion)
|
if (Parent->OrderedRegion.hasValue())
|
||||||
return *Parent->OrderedRegion;
|
return Parent->OrderedRegion.getValue();
|
||||||
return std::make_pair(nullptr, nullptr);
|
return std::make_pair(nullptr, nullptr);
|
||||||
}
|
}
|
||||||
/// Marks current region as nowait (it has a 'nowait' clause).
|
/// Marks current region as nowait (it has a 'nowait' clause).
|
||||||
|
@ -7653,9 +7653,9 @@ public:
|
||||||
/// Return true if any expression is dependent.
|
/// Return true if any expression is dependent.
|
||||||
bool dependent() const;
|
bool dependent() const;
|
||||||
/// Returns true if the initializer forms non-rectangular loop.
|
/// Returns true if the initializer forms non-rectangular loop.
|
||||||
bool doesInitDependOnLC() const { return InitDependOnLC.has_value(); }
|
bool doesInitDependOnLC() const { return InitDependOnLC.hasValue(); }
|
||||||
/// Returns true if the condition forms non-rectangular loop.
|
/// Returns true if the condition forms non-rectangular loop.
|
||||||
bool doesCondDependOnLC() const { return CondDependOnLC.has_value(); }
|
bool doesCondDependOnLC() const { return CondDependOnLC.hasValue(); }
|
||||||
/// Returns index of the loop we depend on (starting from 1), or 0 otherwise.
|
/// Returns index of the loop we depend on (starting from 1), or 0 otherwise.
|
||||||
unsigned getLoopDependentIdx() const {
|
unsigned getLoopDependentIdx() const {
|
||||||
return InitDependOnLC.value_or(CondDependOnLC.value_or(0));
|
return InitDependOnLC.value_or(CondDependOnLC.value_or(0));
|
||||||
|
@ -7761,20 +7761,21 @@ bool OpenMPIterationSpaceChecker::setStep(Expr *NewStep, bool Subtract) {
|
||||||
bool IsConstZero = Result && !Result->getBoolValue();
|
bool IsConstZero = Result && !Result->getBoolValue();
|
||||||
|
|
||||||
// != with increment is treated as <; != with decrement is treated as >
|
// != with increment is treated as <; != with decrement is treated as >
|
||||||
if (!TestIsLessOp)
|
if (!TestIsLessOp.hasValue())
|
||||||
TestIsLessOp = IsConstPos || (IsUnsigned && !Subtract);
|
TestIsLessOp = IsConstPos || (IsUnsigned && !Subtract);
|
||||||
if (UB && (IsConstZero ||
|
if (UB &&
|
||||||
(*TestIsLessOp ? (IsConstNeg || (IsUnsigned && Subtract))
|
(IsConstZero || (TestIsLessOp.getValue()
|
||||||
|
? (IsConstNeg || (IsUnsigned && Subtract))
|
||||||
: (IsConstPos || (IsUnsigned && !Subtract))))) {
|
: (IsConstPos || (IsUnsigned && !Subtract))))) {
|
||||||
SemaRef.Diag(NewStep->getExprLoc(),
|
SemaRef.Diag(NewStep->getExprLoc(),
|
||||||
diag::err_omp_loop_incr_not_compatible)
|
diag::err_omp_loop_incr_not_compatible)
|
||||||
<< LCDecl << *TestIsLessOp << NewStep->getSourceRange();
|
<< LCDecl << TestIsLessOp.getValue() << NewStep->getSourceRange();
|
||||||
SemaRef.Diag(ConditionLoc,
|
SemaRef.Diag(ConditionLoc,
|
||||||
diag::note_omp_loop_cond_requres_compatible_incr)
|
diag::note_omp_loop_cond_requres_compatible_incr)
|
||||||
<< *TestIsLessOp << ConditionSrcRange;
|
<< TestIsLessOp.getValue() << ConditionSrcRange;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (*TestIsLessOp == Subtract) {
|
if (TestIsLessOp.getValue() == Subtract) {
|
||||||
NewStep =
|
NewStep =
|
||||||
SemaRef.CreateBuiltinUnaryOp(NewStep->getExprLoc(), UO_Minus, NewStep)
|
SemaRef.CreateBuiltinUnaryOp(NewStep->getExprLoc(), UO_Minus, NewStep)
|
||||||
.get();
|
.get();
|
||||||
|
@ -8529,8 +8530,8 @@ Expr *OpenMPIterationSpaceChecker::buildNumIterations(
|
||||||
UBVal = MinUB.get();
|
UBVal = MinUB.get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Expr *UBExpr = *TestIsLessOp ? UBVal : LBVal;
|
Expr *UBExpr = TestIsLessOp.getValue() ? UBVal : LBVal;
|
||||||
Expr *LBExpr = *TestIsLessOp ? LBVal : UBVal;
|
Expr *LBExpr = TestIsLessOp.getValue() ? LBVal : UBVal;
|
||||||
Expr *Upper = tryBuildCapture(SemaRef, UBExpr, Captures).get();
|
Expr *Upper = tryBuildCapture(SemaRef, UBExpr, Captures).get();
|
||||||
Expr *Lower = tryBuildCapture(SemaRef, LBExpr, Captures).get();
|
Expr *Lower = tryBuildCapture(SemaRef, LBExpr, Captures).get();
|
||||||
if (!Upper || !Lower)
|
if (!Upper || !Lower)
|
||||||
|
@ -8593,12 +8594,12 @@ std::pair<Expr *, Expr *> OpenMPIterationSpaceChecker::buildMinMaxValues(
|
||||||
// init value.
|
// init value.
|
||||||
Expr *MinExpr = nullptr;
|
Expr *MinExpr = nullptr;
|
||||||
Expr *MaxExpr = nullptr;
|
Expr *MaxExpr = nullptr;
|
||||||
Expr *LBExpr = *TestIsLessOp ? LB : UB;
|
Expr *LBExpr = TestIsLessOp.getValue() ? LB : UB;
|
||||||
Expr *UBExpr = *TestIsLessOp ? UB : LB;
|
Expr *UBExpr = TestIsLessOp.getValue() ? UB : LB;
|
||||||
bool LBNonRect =
|
bool LBNonRect = TestIsLessOp.getValue() ? InitDependOnLC.hasValue()
|
||||||
*TestIsLessOp ? InitDependOnLC.has_value() : CondDependOnLC.has_value();
|
: CondDependOnLC.hasValue();
|
||||||
bool UBNonRect =
|
bool UBNonRect = TestIsLessOp.getValue() ? CondDependOnLC.hasValue()
|
||||||
*TestIsLessOp ? CondDependOnLC.has_value() : InitDependOnLC.has_value();
|
: InitDependOnLC.hasValue();
|
||||||
Expr *Lower =
|
Expr *Lower =
|
||||||
LBNonRect ? LBExpr : tryBuildCapture(SemaRef, LBExpr, Captures).get();
|
LBNonRect ? LBExpr : tryBuildCapture(SemaRef, LBExpr, Captures).get();
|
||||||
Expr *Upper =
|
Expr *Upper =
|
||||||
|
@ -8720,9 +8721,9 @@ Expr *OpenMPIterationSpaceChecker::buildPreCond(
|
||||||
if (!NewLB.isUsable() || !NewUB.isUsable())
|
if (!NewLB.isUsable() || !NewUB.isUsable())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
ExprResult CondExpr =
|
ExprResult CondExpr = SemaRef.BuildBinOp(
|
||||||
SemaRef.BuildBinOp(S, DefaultLoc,
|
S, DefaultLoc,
|
||||||
*TestIsLessOp ? (TestIsStrictOp ? BO_LT : BO_LE)
|
TestIsLessOp.getValue() ? (TestIsStrictOp ? BO_LT : BO_LE)
|
||||||
: (TestIsStrictOp ? BO_GT : BO_GE),
|
: (TestIsStrictOp ? BO_GT : BO_GE),
|
||||||
NewLB.get(), NewUB.get());
|
NewLB.get(), NewUB.get());
|
||||||
if (CondExpr.isUsable()) {
|
if (CondExpr.isUsable()) {
|
||||||
|
@ -8799,10 +8800,12 @@ Expr *OpenMPIterationSpaceChecker::buildOrderedLoopData(
|
||||||
!SemaRef.getLangOpts().CPlusPlus)
|
!SemaRef.getLangOpts().CPlusPlus)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
// Upper - Lower
|
// Upper - Lower
|
||||||
Expr *Upper =
|
Expr *Upper = TestIsLessOp.getValue()
|
||||||
*TestIsLessOp ? Cnt : tryBuildCapture(SemaRef, LB, Captures).get();
|
? Cnt
|
||||||
Expr *Lower =
|
: tryBuildCapture(SemaRef, LB, Captures).get();
|
||||||
*TestIsLessOp ? tryBuildCapture(SemaRef, LB, Captures).get() : Cnt;
|
Expr *Lower = TestIsLessOp.getValue()
|
||||||
|
? tryBuildCapture(SemaRef, LB, Captures).get()
|
||||||
|
: Cnt;
|
||||||
if (!Upper || !Lower)
|
if (!Upper || !Lower)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
|
@ -22177,27 +22180,27 @@ void Sema::ActOnOpenMPDeclareTargetName(NamedDecl *ND, SourceLocation Loc,
|
||||||
auto *VD = cast<ValueDecl>(ND);
|
auto *VD = cast<ValueDecl>(ND);
|
||||||
llvm::Optional<OMPDeclareTargetDeclAttr *> ActiveAttr =
|
llvm::Optional<OMPDeclareTargetDeclAttr *> ActiveAttr =
|
||||||
OMPDeclareTargetDeclAttr::getActiveAttr(VD);
|
OMPDeclareTargetDeclAttr::getActiveAttr(VD);
|
||||||
if (ActiveAttr && (*ActiveAttr)->getDevType() != DTCI.DT &&
|
if (ActiveAttr.hasValue() && ActiveAttr.getValue()->getDevType() != DTCI.DT &&
|
||||||
(*ActiveAttr)->getLevel() == Level) {
|
ActiveAttr.getValue()->getLevel() == Level) {
|
||||||
Diag(Loc, diag::err_omp_device_type_mismatch)
|
Diag(Loc, diag::err_omp_device_type_mismatch)
|
||||||
<< OMPDeclareTargetDeclAttr::ConvertDevTypeTyToStr(DTCI.DT)
|
<< OMPDeclareTargetDeclAttr::ConvertDevTypeTyToStr(DTCI.DT)
|
||||||
<< OMPDeclareTargetDeclAttr::ConvertDevTypeTyToStr(
|
<< OMPDeclareTargetDeclAttr::ConvertDevTypeTyToStr(
|
||||||
ActiveAttr.value()->getDevType());
|
ActiveAttr.getValue()->getDevType());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (ActiveAttr && (*ActiveAttr)->getMapType() != MT &&
|
if (ActiveAttr.hasValue() && ActiveAttr.getValue()->getMapType() != MT &&
|
||||||
(*ActiveAttr)->getLevel() == Level) {
|
ActiveAttr.getValue()->getLevel() == Level) {
|
||||||
Diag(Loc, diag::err_omp_declare_target_to_and_link) << ND;
|
Diag(Loc, diag::err_omp_declare_target_to_and_link) << ND;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ActiveAttr && (*ActiveAttr)->getLevel() == Level)
|
if (ActiveAttr.hasValue() && ActiveAttr.getValue()->getLevel() == Level)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Expr *IndirectE = nullptr;
|
Expr *IndirectE = nullptr;
|
||||||
bool IsIndirect = false;
|
bool IsIndirect = false;
|
||||||
if (DTCI.Indirect) {
|
if (DTCI.Indirect.hasValue()) {
|
||||||
IndirectE = *DTCI.Indirect;
|
IndirectE = DTCI.Indirect.getValue();
|
||||||
if (!IndirectE)
|
if (!IndirectE)
|
||||||
IsIndirect = true;
|
IsIndirect = true;
|
||||||
}
|
}
|
||||||
|
@ -22291,13 +22294,13 @@ void Sema::checkDeclIsAllowedInOpenMPTarget(Expr *E, Decl *D,
|
||||||
llvm::Optional<OMPDeclareTargetDeclAttr *> ActiveAttr =
|
llvm::Optional<OMPDeclareTargetDeclAttr *> ActiveAttr =
|
||||||
OMPDeclareTargetDeclAttr::getActiveAttr(VD);
|
OMPDeclareTargetDeclAttr::getActiveAttr(VD);
|
||||||
unsigned Level = DeclareTargetNesting.size();
|
unsigned Level = DeclareTargetNesting.size();
|
||||||
if (ActiveAttr && (*ActiveAttr)->getLevel() >= Level)
|
if (ActiveAttr.hasValue() && ActiveAttr.getValue()->getLevel() >= Level)
|
||||||
return;
|
return;
|
||||||
DeclareTargetContextInfo &DTCI = DeclareTargetNesting.back();
|
DeclareTargetContextInfo &DTCI = DeclareTargetNesting.back();
|
||||||
Expr *IndirectE = nullptr;
|
Expr *IndirectE = nullptr;
|
||||||
bool IsIndirect = false;
|
bool IsIndirect = false;
|
||||||
if (DTCI.Indirect) {
|
if (DTCI.Indirect.hasValue()) {
|
||||||
IndirectE = *DTCI.Indirect;
|
IndirectE = DTCI.Indirect.getValue();
|
||||||
if (!IndirectE)
|
if (!IndirectE)
|
||||||
IsIndirect = true;
|
IsIndirect = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -469,8 +469,8 @@ static void instantiateOMPDeclareVariantAttr(
|
||||||
if (!DeclVarData)
|
if (!DeclVarData)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
E = DeclVarData->second;
|
E = DeclVarData.getValue().second;
|
||||||
FD = DeclVarData->first;
|
FD = DeclVarData.getValue().first;
|
||||||
|
|
||||||
if (auto *VariantDRE = dyn_cast<DeclRefExpr>(E->IgnoreParenImpCasts())) {
|
if (auto *VariantDRE = dyn_cast<DeclRefExpr>(E->IgnoreParenImpCasts())) {
|
||||||
if (auto *VariantFD = dyn_cast<FunctionDecl>(VariantDRE->getDecl())) {
|
if (auto *VariantFD = dyn_cast<FunctionDecl>(VariantDRE->getDecl())) {
|
||||||
|
|
|
@ -1888,7 +1888,7 @@ void ASTWriter::WriteHeaderSearch(const HeaderSearch &HS) {
|
||||||
// without this file existing on disk.
|
// without this file existing on disk.
|
||||||
if (!U.Size || (!U.ModTime && IncludeTimestamps)) {
|
if (!U.Size || (!U.ModTime && IncludeTimestamps)) {
|
||||||
PP->Diag(U.FileNameLoc, diag::err_module_no_size_mtime_for_header)
|
PP->Diag(U.FileNameLoc, diag::err_module_no_size_mtime_for_header)
|
||||||
<< WritingModule->getFullModuleName() << U.Size.has_value()
|
<< WritingModule->getFullModuleName() << U.Size.hasValue()
|
||||||
<< U.FileName;
|
<< U.FileName;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -766,10 +766,10 @@ void VariadicMethodTypeChecker::checkPreObjCMessage(const ObjCMethodCall &msg,
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Generate only one error node to use for all bug reports.
|
// Generate only one error node to use for all bug reports.
|
||||||
if (!errorNode)
|
if (!errorNode.hasValue())
|
||||||
errorNode = C.generateNonFatalErrorNode();
|
errorNode = C.generateNonFatalErrorNode();
|
||||||
|
|
||||||
if (!*errorNode)
|
if (!errorNode.getValue())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
SmallString<128> sbuf;
|
SmallString<128> sbuf;
|
||||||
|
@ -786,8 +786,8 @@ void VariadicMethodTypeChecker::checkPreObjCMessage(const ObjCMethodCall &msg,
|
||||||
ArgTy.print(os, C.getLangOpts());
|
ArgTy.print(os, C.getLangOpts());
|
||||||
os << "'";
|
os << "'";
|
||||||
|
|
||||||
auto R =
|
auto R = std::make_unique<PathSensitiveBugReport>(*BT, os.str(),
|
||||||
std::make_unique<PathSensitiveBugReport>(*BT, os.str(), *errorNode);
|
errorNode.getValue());
|
||||||
R->addRange(msg.getArgSourceRange(I));
|
R->addRange(msg.getArgSourceRange(I));
|
||||||
C.emitReport(std::move(R));
|
C.emitReport(std::move(R));
|
||||||
}
|
}
|
||||||
|
|
|
@ -272,12 +272,12 @@ ProgramStateRef GTestChecker::assumeValuesEqual(SVal Val1, SVal Val2,
|
||||||
CheckerContext &C) {
|
CheckerContext &C) {
|
||||||
auto DVal1 = Val1.getAs<DefinedOrUnknownSVal>();
|
auto DVal1 = Val1.getAs<DefinedOrUnknownSVal>();
|
||||||
auto DVal2 = Val2.getAs<DefinedOrUnknownSVal>();
|
auto DVal2 = Val2.getAs<DefinedOrUnknownSVal>();
|
||||||
if (!DVal1 || !DVal2)
|
if (!DVal1.hasValue() || !DVal2.hasValue())
|
||||||
return State;
|
return State;
|
||||||
|
|
||||||
auto ValuesEqual =
|
auto ValuesEqual =
|
||||||
C.getSValBuilder().evalEQ(State, *DVal1, *DVal2).getAs<DefinedSVal>();
|
C.getSValBuilder().evalEQ(State, *DVal1, *DVal2).getAs<DefinedSVal>();
|
||||||
if (!ValuesEqual)
|
if (!ValuesEqual.hasValue())
|
||||||
return State;
|
return State;
|
||||||
|
|
||||||
State = C.getConstraintManager().assume(State, *ValuesEqual, true);
|
State = C.getConstraintManager().assume(State, *ValuesEqual, true);
|
||||||
|
|
|
@ -1190,7 +1190,7 @@ MallocChecker::performKernelMalloc(const CallEvent &Call, CheckerContext &C,
|
||||||
|
|
||||||
NonLoc Flags = V.castAs<NonLoc>();
|
NonLoc Flags = V.castAs<NonLoc>();
|
||||||
NonLoc ZeroFlag = C.getSValBuilder()
|
NonLoc ZeroFlag = C.getSValBuilder()
|
||||||
.makeIntVal(*KernelZeroFlagVal, FlagsEx->getType())
|
.makeIntVal(KernelZeroFlagVal.getValue(), FlagsEx->getType())
|
||||||
.castAs<NonLoc>();
|
.castAs<NonLoc>();
|
||||||
SVal MaskedFlagsUC = C.getSValBuilder().evalBinOpNN(State, BO_And,
|
SVal MaskedFlagsUC = C.getSValBuilder().evalBinOpNN(State, BO_And,
|
||||||
Flags, ZeroFlag,
|
Flags, ZeroFlag,
|
||||||
|
@ -1238,8 +1238,8 @@ void MallocChecker::checkKernelMalloc(const CallEvent &Call,
|
||||||
ProgramStateRef State = C.getState();
|
ProgramStateRef State = C.getState();
|
||||||
llvm::Optional<ProgramStateRef> MaybeState =
|
llvm::Optional<ProgramStateRef> MaybeState =
|
||||||
performKernelMalloc(Call, C, State);
|
performKernelMalloc(Call, C, State);
|
||||||
if (MaybeState)
|
if (MaybeState.hasValue())
|
||||||
State = *MaybeState;
|
State = MaybeState.getValue();
|
||||||
else
|
else
|
||||||
State = MallocMemAux(C, Call, Call.getArgExpr(0), UndefinedVal(), State,
|
State = MallocMemAux(C, Call, Call.getArgExpr(0), UndefinedVal(), State,
|
||||||
AF_Malloc);
|
AF_Malloc);
|
||||||
|
@ -3571,13 +3571,13 @@ void MallocChecker::printState(raw_ostream &Out, ProgramStateRef State,
|
||||||
const RefState *RefS = State->get<RegionState>(I.getKey());
|
const RefState *RefS = State->get<RegionState>(I.getKey());
|
||||||
AllocationFamily Family = RefS->getAllocationFamily();
|
AllocationFamily Family = RefS->getAllocationFamily();
|
||||||
Optional<MallocChecker::CheckKind> CheckKind = getCheckIfTracked(Family);
|
Optional<MallocChecker::CheckKind> CheckKind = getCheckIfTracked(Family);
|
||||||
if (!CheckKind)
|
if (!CheckKind.hasValue())
|
||||||
CheckKind = getCheckIfTracked(Family, true);
|
CheckKind = getCheckIfTracked(Family, true);
|
||||||
|
|
||||||
I.getKey()->dumpToStream(Out);
|
I.getKey()->dumpToStream(Out);
|
||||||
Out << " : ";
|
Out << " : ";
|
||||||
I.getData().dump(Out);
|
I.getData().dump(Out);
|
||||||
if (CheckKind)
|
if (CheckKind.hasValue())
|
||||||
Out << " (" << CheckNames[*CheckKind].getName() << ")";
|
Out << " (" << CheckNames[*CheckKind].getName() << ")";
|
||||||
Out << NL;
|
Out << NL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -136,10 +136,10 @@ void NonNullParamChecker::checkPreCall(const CallEvent &Call,
|
||||||
if (!DV)
|
if (!DV)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
assert(!HasRefTypeParam || isa<Loc>(*DV));
|
assert(!HasRefTypeParam || isa<Loc>(DV.getValue()));
|
||||||
|
|
||||||
// Process the case when the argument is not a location.
|
// Process the case when the argument is not a location.
|
||||||
if (ExpectedToBeNonNull && !isa<Loc>(*DV)) {
|
if (ExpectedToBeNonNull && !isa<Loc>(DV.getValue())) {
|
||||||
// If the argument is a union type, we want to handle a potential
|
// If the argument is a union type, we want to handle a potential
|
||||||
// transparent_union GCC extension.
|
// transparent_union GCC extension.
|
||||||
if (!ArgE)
|
if (!ArgE)
|
||||||
|
|
|
@ -234,8 +234,7 @@ void UnixAPIMisuseChecker::CheckOpenVariant(CheckerContext &C,
|
||||||
}
|
}
|
||||||
NonLoc oflags = V.castAs<NonLoc>();
|
NonLoc oflags = V.castAs<NonLoc>();
|
||||||
NonLoc ocreateFlag = C.getSValBuilder()
|
NonLoc ocreateFlag = C.getSValBuilder()
|
||||||
.makeIntVal(*Val_O_CREAT, oflagsEx->getType())
|
.makeIntVal(Val_O_CREAT.getValue(), oflagsEx->getType()).castAs<NonLoc>();
|
||||||
.castAs<NonLoc>();
|
|
||||||
SVal maskedFlagsUC = C.getSValBuilder().evalBinOpNN(state, BO_And,
|
SVal maskedFlagsUC = C.getSValBuilder().evalBinOpNN(state, BO_And,
|
||||||
oflags, ocreateFlag,
|
oflags, ocreateFlag,
|
||||||
oflagsEx->getType());
|
oflagsEx->getType());
|
||||||
|
|
|
@ -77,8 +77,8 @@ AnalyzerOptions::getExplorationStrategy() const {
|
||||||
.Case("bfs_block_dfs_contents",
|
.Case("bfs_block_dfs_contents",
|
||||||
ExplorationStrategyKind::BFSBlockDFSContents)
|
ExplorationStrategyKind::BFSBlockDFSContents)
|
||||||
.Default(None);
|
.Default(None);
|
||||||
assert(K && "User mode is invalid.");
|
assert(K.hasValue() && "User mode is invalid.");
|
||||||
return *K;
|
return K.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
CTUPhase1InliningKind AnalyzerOptions::getCTUPhase1Inlining() const {
|
CTUPhase1InliningKind AnalyzerOptions::getCTUPhase1Inlining() const {
|
||||||
|
@ -88,8 +88,8 @@ CTUPhase1InliningKind AnalyzerOptions::getCTUPhase1Inlining() const {
|
||||||
.Case("small", CTUPhase1InliningKind::Small)
|
.Case("small", CTUPhase1InliningKind::Small)
|
||||||
.Case("all", CTUPhase1InliningKind::All)
|
.Case("all", CTUPhase1InliningKind::All)
|
||||||
.Default(None);
|
.Default(None);
|
||||||
assert(K && "CTU inlining mode is invalid.");
|
assert(K.hasValue() && "CTU inlining mode is invalid.");
|
||||||
return *K;
|
return K.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
IPAKind AnalyzerOptions::getIPAMode() const {
|
IPAKind AnalyzerOptions::getIPAMode() const {
|
||||||
|
@ -100,9 +100,9 @@ IPAKind AnalyzerOptions::getIPAMode() const {
|
||||||
.Case("dynamic", IPAK_DynamicDispatch)
|
.Case("dynamic", IPAK_DynamicDispatch)
|
||||||
.Case("dynamic-bifurcate", IPAK_DynamicDispatchBifurcate)
|
.Case("dynamic-bifurcate", IPAK_DynamicDispatchBifurcate)
|
||||||
.Default(None);
|
.Default(None);
|
||||||
assert(K && "IPA Mode is invalid.");
|
assert(K.hasValue() && "IPA Mode is invalid.");
|
||||||
|
|
||||||
return *K;
|
return K.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
|
@ -2363,15 +2363,15 @@ PathSensitiveBugReport::getInterestingnessKind(const MemRegion *R) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PathSensitiveBugReport::isInteresting(SVal V) const {
|
bool PathSensitiveBugReport::isInteresting(SVal V) const {
|
||||||
return getInterestingnessKind(V).has_value();
|
return getInterestingnessKind(V).hasValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PathSensitiveBugReport::isInteresting(SymbolRef sym) const {
|
bool PathSensitiveBugReport::isInteresting(SymbolRef sym) const {
|
||||||
return getInterestingnessKind(sym).has_value();
|
return getInterestingnessKind(sym).hasValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PathSensitiveBugReport::isInteresting(const MemRegion *R) const {
|
bool PathSensitiveBugReport::isInteresting(const MemRegion *R) const {
|
||||||
return getInterestingnessKind(R).has_value();
|
return getInterestingnessKind(R).hasValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PathSensitiveBugReport::isInteresting(const LocationContext *LC) const {
|
bool PathSensitiveBugReport::isInteresting(const LocationContext *LC) const {
|
||||||
|
|
|
@ -2949,8 +2949,8 @@ PathDiagnosticPieceRef ConditionBRVisitor::VisitTrueTest(
|
||||||
|
|
||||||
PathDiagnosticLocation Loc(Cond, SM, LCtx);
|
PathDiagnosticLocation Loc(Cond, SM, LCtx);
|
||||||
auto event = std::make_shared<PathDiagnosticEventPiece>(Loc, Message);
|
auto event = std::make_shared<PathDiagnosticEventPiece>(Loc, Message);
|
||||||
if (shouldPrune)
|
if (shouldPrune.hasValue())
|
||||||
event->setPrunable(*shouldPrune);
|
event->setPrunable(shouldPrune.getValue());
|
||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3084,9 +3084,9 @@ bool ConditionBRVisitor::printValue(const Expr *CondVarExpr, raw_ostream &Out,
|
||||||
Out << (TookTrue ? "not equal to 0" : "0");
|
Out << (TookTrue ? "not equal to 0" : "0");
|
||||||
} else {
|
} else {
|
||||||
if (Ty->isBooleanType())
|
if (Ty->isBooleanType())
|
||||||
Out << (IntValue.value()->getBoolValue() ? "true" : "false");
|
Out << (IntValue.getValue()->getBoolValue() ? "true" : "false");
|
||||||
else
|
else
|
||||||
Out << *IntValue.value();
|
Out << *IntValue.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -3279,10 +3279,10 @@ void FalsePositiveRefutationBRVisitor::finalizeVisitor(
|
||||||
|
|
||||||
// And check for satisfiability
|
// And check for satisfiability
|
||||||
Optional<bool> IsSAT = RefutationSolver->check();
|
Optional<bool> IsSAT = RefutationSolver->check();
|
||||||
if (!IsSAT)
|
if (!IsSAT.hasValue())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!*IsSAT)
|
if (!IsSAT.getValue())
|
||||||
BR.markInvalid("Infeasible constraints", EndPathNode->getLocationContext());
|
BR.markInvalid("Infeasible constraints", EndPathNode->getLocationContext());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1015,8 +1015,8 @@ bool ExprEngine::shouldInlineCall(const CallEvent &Call, const Decl *D,
|
||||||
|
|
||||||
// Check if this function has been marked as non-inlinable.
|
// Check if this function has been marked as non-inlinable.
|
||||||
Optional<bool> MayInline = Engine.FunctionSummaries->mayInline(D);
|
Optional<bool> MayInline = Engine.FunctionSummaries->mayInline(D);
|
||||||
if (MayInline) {
|
if (MayInline.hasValue()) {
|
||||||
if (!*MayInline)
|
if (!MayInline.getValue())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -407,11 +407,11 @@ void PlistPrinter::ReportMacroExpansions(raw_ostream &o, unsigned indent) {
|
||||||
|
|
||||||
// Output the macro name.
|
// Output the macro name.
|
||||||
Indent(o, indent) << "<key>name</key>";
|
Indent(o, indent) << "<key>name</key>";
|
||||||
EmitString(o, *MacroName) << '\n';
|
EmitString(o, MacroName.getValue()) << '\n';
|
||||||
|
|
||||||
// Output what it expands into.
|
// Output what it expands into.
|
||||||
Indent(o, indent) << "<key>expansion</key>";
|
Indent(o, indent) << "<key>expansion</key>";
|
||||||
EmitString(o, *ExpansionText) << '\n';
|
EmitString(o, ExpansionText.getValue()) << '\n';
|
||||||
|
|
||||||
// Finish up.
|
// Finish up.
|
||||||
--indent;
|
--indent;
|
||||||
|
|
|
@ -114,11 +114,11 @@ bool RVVType::verifyType() const {
|
||||||
return false;
|
return false;
|
||||||
if (isScalar())
|
if (isScalar())
|
||||||
return true;
|
return true;
|
||||||
if (!Scale)
|
if (!Scale.hasValue())
|
||||||
return false;
|
return false;
|
||||||
if (isFloat() && ElementBitwidth == 8)
|
if (isFloat() && ElementBitwidth == 8)
|
||||||
return false;
|
return false;
|
||||||
unsigned V = *Scale;
|
unsigned V = Scale.getValue();
|
||||||
switch (ElementBitwidth) {
|
switch (ElementBitwidth) {
|
||||||
case 1:
|
case 1:
|
||||||
case 8:
|
case 8:
|
||||||
|
@ -799,10 +799,10 @@ RVVType::computeTypes(BasicType BT, int Log2LMUL, unsigned NF,
|
||||||
RVVTypes Types;
|
RVVTypes Types;
|
||||||
for (const PrototypeDescriptor &Proto : Prototype) {
|
for (const PrototypeDescriptor &Proto : Prototype) {
|
||||||
auto T = computeType(BT, Log2LMUL, Proto);
|
auto T = computeType(BT, Log2LMUL, Proto);
|
||||||
if (!T)
|
if (!T.hasValue())
|
||||||
return llvm::None;
|
return llvm::None;
|
||||||
// Record legal type index
|
// Record legal type index
|
||||||
Types.push_back(*T);
|
Types.push_back(T.getValue());
|
||||||
}
|
}
|
||||||
return Types;
|
return Types;
|
||||||
}
|
}
|
||||||
|
|
|
@ -179,9 +179,9 @@ static std::string getReplacementErrString(replacement_error Err) {
|
||||||
|
|
||||||
std::string ReplacementError::message() const {
|
std::string ReplacementError::message() const {
|
||||||
std::string Message = getReplacementErrString(Err);
|
std::string Message = getReplacementErrString(Err);
|
||||||
if (NewReplacement)
|
if (NewReplacement.hasValue())
|
||||||
Message += "\nNew replacement: " + NewReplacement->toString();
|
Message += "\nNew replacement: " + NewReplacement->toString();
|
||||||
if (ExistingReplacement)
|
if (ExistingReplacement.hasValue())
|
||||||
Message += "\nExisting replacement: " + ExistingReplacement->toString();
|
Message += "\nExisting replacement: " + ExistingReplacement->toString();
|
||||||
return Message;
|
return Message;
|
||||||
}
|
}
|
||||||
|
|
|
@ -406,18 +406,18 @@ int clang_main(int Argc, char **Argv) {
|
||||||
if (ClangCLMode) {
|
if (ClangCLMode) {
|
||||||
// Arguments in "CL" are prepended.
|
// Arguments in "CL" are prepended.
|
||||||
llvm::Optional<std::string> OptCL = llvm::sys::Process::GetEnv("CL");
|
llvm::Optional<std::string> OptCL = llvm::sys::Process::GetEnv("CL");
|
||||||
if (OptCL) {
|
if (OptCL.hasValue()) {
|
||||||
SmallVector<const char *, 8> PrependedOpts;
|
SmallVector<const char *, 8> PrependedOpts;
|
||||||
getCLEnvVarOptions(*OptCL, Saver, PrependedOpts);
|
getCLEnvVarOptions(OptCL.getValue(), Saver, PrependedOpts);
|
||||||
|
|
||||||
// Insert right after the program name to prepend to the argument list.
|
// Insert right after the program name to prepend to the argument list.
|
||||||
Args.insert(Args.begin() + 1, PrependedOpts.begin(), PrependedOpts.end());
|
Args.insert(Args.begin() + 1, PrependedOpts.begin(), PrependedOpts.end());
|
||||||
}
|
}
|
||||||
// Arguments in "_CL_" are appended.
|
// Arguments in "_CL_" are appended.
|
||||||
llvm::Optional<std::string> Opt_CL_ = llvm::sys::Process::GetEnv("_CL_");
|
llvm::Optional<std::string> Opt_CL_ = llvm::sys::Process::GetEnv("_CL_");
|
||||||
if (Opt_CL_) {
|
if (Opt_CL_.hasValue()) {
|
||||||
SmallVector<const char *, 8> AppendedOpts;
|
SmallVector<const char *, 8> AppendedOpts;
|
||||||
getCLEnvVarOptions(*Opt_CL_, Saver, AppendedOpts);
|
getCLEnvVarOptions(Opt_CL_.getValue(), Saver, AppendedOpts);
|
||||||
|
|
||||||
// Insert at the end of the argument list to append.
|
// Insert at the end of the argument list to append.
|
||||||
Args.append(AppendedOpts.begin(), AppendedOpts.end());
|
Args.append(AppendedOpts.begin(), AppendedOpts.end());
|
||||||
|
|
|
@ -536,9 +536,9 @@ bool CursorVisitor::VisitChildren(CXCursor Cursor) {
|
||||||
TLEnd = CXXUnit->top_level_end();
|
TLEnd = CXXUnit->top_level_end();
|
||||||
TL != TLEnd; ++TL) {
|
TL != TLEnd; ++TL) {
|
||||||
const Optional<bool> V = handleDeclForVisitation(*TL);
|
const Optional<bool> V = handleDeclForVisitation(*TL);
|
||||||
if (!V)
|
if (!V.hasValue())
|
||||||
continue;
|
continue;
|
||||||
return *V;
|
return V.getValue();
|
||||||
}
|
}
|
||||||
} else if (VisitDeclContext(
|
} else if (VisitDeclContext(
|
||||||
CXXUnit->getASTContext().getTranslationUnitDecl()))
|
CXXUnit->getASTContext().getTranslationUnitDecl()))
|
||||||
|
@ -641,9 +641,9 @@ bool CursorVisitor::VisitDeclContext(DeclContext *DC) {
|
||||||
if (OMD->isSynthesizedAccessorStub())
|
if (OMD->isSynthesizedAccessorStub())
|
||||||
continue;
|
continue;
|
||||||
const Optional<bool> V = handleDeclForVisitation(D);
|
const Optional<bool> V = handleDeclForVisitation(D);
|
||||||
if (!V)
|
if (!V.hasValue())
|
||||||
continue;
|
continue;
|
||||||
return *V;
|
return V.getValue();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -675,9 +675,9 @@ Optional<bool> CursorVisitor::handleDeclForVisitation(const Decl *D) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const Optional<bool> V = shouldVisitCursor(Cursor);
|
const Optional<bool> V = shouldVisitCursor(Cursor);
|
||||||
if (!V)
|
if (!V.hasValue())
|
||||||
return None;
|
return None;
|
||||||
if (!*V)
|
if (!V.getValue())
|
||||||
return false;
|
return false;
|
||||||
if (Visit(Cursor, true))
|
if (Visit(Cursor, true))
|
||||||
return true;
|
return true;
|
||||||
|
@ -1074,9 +1074,9 @@ bool CursorVisitor::VisitObjCContainerDecl(ObjCContainerDecl *D) {
|
||||||
I != E; ++I) {
|
I != E; ++I) {
|
||||||
CXCursor Cursor = MakeCXCursor(*I, TU, RegionOfInterest);
|
CXCursor Cursor = MakeCXCursor(*I, TU, RegionOfInterest);
|
||||||
const Optional<bool> &V = shouldVisitCursor(Cursor);
|
const Optional<bool> &V = shouldVisitCursor(Cursor);
|
||||||
if (!V)
|
if (!V.hasValue())
|
||||||
continue;
|
continue;
|
||||||
if (!*V)
|
if (!V.getValue())
|
||||||
return false;
|
return false;
|
||||||
if (Visit(Cursor, true))
|
if (Visit(Cursor, true))
|
||||||
return true;
|
return true;
|
||||||
|
@ -8178,13 +8178,13 @@ static CXVersion convertVersion(VersionTuple In) {
|
||||||
Out.Major = In.getMajor();
|
Out.Major = In.getMajor();
|
||||||
|
|
||||||
Optional<unsigned> Minor = In.getMinor();
|
Optional<unsigned> Minor = In.getMinor();
|
||||||
if (Minor)
|
if (Minor.hasValue())
|
||||||
Out.Minor = *Minor;
|
Out.Minor = *Minor;
|
||||||
else
|
else
|
||||||
return Out;
|
return Out;
|
||||||
|
|
||||||
Optional<unsigned> Subminor = In.getSubminor();
|
Optional<unsigned> Subminor = In.getSubminor();
|
||||||
if (Subminor)
|
if (Subminor.hasValue())
|
||||||
Out.Subminor = *Subminor;
|
Out.Subminor = *Subminor;
|
||||||
|
|
||||||
return Out;
|
return Out;
|
||||||
|
|
|
@ -449,27 +449,27 @@ TEST(ParserTest, ParseMultiline) {
|
||||||
)
|
)
|
||||||
)matcher";
|
)matcher";
|
||||||
Diagnostics Error;
|
Diagnostics Error;
|
||||||
EXPECT_TRUE(Parser::parseMatcherExpression(Code, &Error));
|
EXPECT_TRUE(Parser::parseMatcherExpression(Code, &Error).hasValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
Code = R"matcher(decl(decl()
|
Code = R"matcher(decl(decl()
|
||||||
, decl()))matcher";
|
, decl()))matcher";
|
||||||
Diagnostics Error;
|
Diagnostics Error;
|
||||||
EXPECT_TRUE(Parser::parseMatcherExpression(Code, &Error).has_value());
|
EXPECT_TRUE(Parser::parseMatcherExpression(Code, &Error).hasValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
Code = R"matcher(decl(decl(),
|
Code = R"matcher(decl(decl(),
|
||||||
decl()))matcher";
|
decl()))matcher";
|
||||||
Diagnostics Error;
|
Diagnostics Error;
|
||||||
EXPECT_TRUE(Parser::parseMatcherExpression(Code, &Error).has_value());
|
EXPECT_TRUE(Parser::parseMatcherExpression(Code, &Error).hasValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
Code = "namedDecl(hasName(\"n\"\n))";
|
Code = "namedDecl(hasName(\"n\"\n))";
|
||||||
Diagnostics Error;
|
Diagnostics Error;
|
||||||
EXPECT_TRUE(Parser::parseMatcherExpression(Code, &Error).has_value());
|
EXPECT_TRUE(Parser::parseMatcherExpression(Code, &Error).hasValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
|
@ -40,7 +40,8 @@ isAnnotationDirectlyAfterStatement(const Stmt *Stmt, unsigned AnnotationBegin,
|
||||||
auto NextToken =
|
auto NextToken =
|
||||||
Lexer::findNextToken(Stmt->getEndLoc(), SourceManager, LangOptions);
|
Lexer::findNextToken(Stmt->getEndLoc(), SourceManager, LangOptions);
|
||||||
|
|
||||||
while (NextToken && SourceManager.getFileOffset(NextToken->getLocation()) <
|
while (NextToken.hasValue() &&
|
||||||
|
SourceManager.getFileOffset(NextToken->getLocation()) <
|
||||||
AnnotationBegin) {
|
AnnotationBegin) {
|
||||||
if (NextToken->isNot(tok::semi))
|
if (NextToken->isNot(tok::semi))
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -82,8 +82,8 @@ TEST(DataflowAnalysisTest, NoopAnalysis) {
|
||||||
return NoopAnalysis(C, false);
|
return NoopAnalysis(C, false);
|
||||||
}));
|
}));
|
||||||
EXPECT_EQ(BlockStates.size(), 2u);
|
EXPECT_EQ(BlockStates.size(), 2u);
|
||||||
EXPECT_TRUE(BlockStates[0].has_value());
|
EXPECT_TRUE(BlockStates[0].hasValue());
|
||||||
EXPECT_TRUE(BlockStates[1].has_value());
|
EXPECT_TRUE(BlockStates[1].hasValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
struct NonConvergingLattice {
|
struct NonConvergingLattice {
|
||||||
|
|
|
@ -121,14 +121,14 @@ TEST_F(MacroExpansionContextTest, IgnoresPragmas) {
|
||||||
EXPECT_EQ("\n=============== ExpansionRanges ===============\n",
|
EXPECT_EQ("\n=============== ExpansionRanges ===============\n",
|
||||||
dumpExpansionRanges(*Ctx));
|
dumpExpansionRanges(*Ctx));
|
||||||
|
|
||||||
EXPECT_FALSE(Ctx->getExpandedText(at(2, 1)).has_value());
|
EXPECT_FALSE(Ctx->getExpandedText(at(2, 1)).hasValue());
|
||||||
EXPECT_FALSE(Ctx->getOriginalText(at(2, 1)).has_value());
|
EXPECT_FALSE(Ctx->getOriginalText(at(2, 1)).hasValue());
|
||||||
|
|
||||||
EXPECT_FALSE(Ctx->getExpandedText(at(2, 3)).has_value());
|
EXPECT_FALSE(Ctx->getExpandedText(at(2, 3)).hasValue());
|
||||||
EXPECT_FALSE(Ctx->getOriginalText(at(2, 3)).has_value());
|
EXPECT_FALSE(Ctx->getOriginalText(at(2, 3)).hasValue());
|
||||||
|
|
||||||
EXPECT_FALSE(Ctx->getExpandedText(at(3, 3)).has_value());
|
EXPECT_FALSE(Ctx->getExpandedText(at(3, 3)).hasValue());
|
||||||
EXPECT_FALSE(Ctx->getOriginalText(at(3, 3)).has_value());
|
EXPECT_FALSE(Ctx->getOriginalText(at(3, 3)).hasValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MacroExpansionContextTest, NoneForNonExpansionLocations) {
|
TEST_F(MacroExpansionContextTest, NoneForNonExpansionLocations) {
|
||||||
|
@ -142,33 +142,33 @@ EMPTY zz
|
||||||
// zz
|
// zz
|
||||||
|
|
||||||
// That's the beginning of the definition of EMPTY.
|
// That's the beginning of the definition of EMPTY.
|
||||||
EXPECT_FALSE(Ctx->getExpandedText(at(2, 11)).has_value());
|
EXPECT_FALSE(Ctx->getExpandedText(at(2, 11)).hasValue());
|
||||||
EXPECT_FALSE(Ctx->getOriginalText(at(2, 11)).has_value());
|
EXPECT_FALSE(Ctx->getOriginalText(at(2, 11)).hasValue());
|
||||||
|
|
||||||
// The space before the first expansion of EMPTY.
|
// The space before the first expansion of EMPTY.
|
||||||
EXPECT_FALSE(Ctx->getExpandedText(at(3, 9)).has_value());
|
EXPECT_FALSE(Ctx->getExpandedText(at(3, 9)).hasValue());
|
||||||
EXPECT_FALSE(Ctx->getOriginalText(at(3, 9)).has_value());
|
EXPECT_FALSE(Ctx->getOriginalText(at(3, 9)).hasValue());
|
||||||
|
|
||||||
// The beginning of the first expansion of EMPTY.
|
// The beginning of the first expansion of EMPTY.
|
||||||
EXPECT_TRUE(Ctx->getExpandedText(at(3, 10)).has_value());
|
EXPECT_TRUE(Ctx->getExpandedText(at(3, 10)).hasValue());
|
||||||
EXPECT_TRUE(Ctx->getOriginalText(at(3, 10)).has_value());
|
EXPECT_TRUE(Ctx->getOriginalText(at(3, 10)).hasValue());
|
||||||
|
|
||||||
// Pointing inside of the token EMPTY, but not at the beginning.
|
// Pointing inside of the token EMPTY, but not at the beginning.
|
||||||
// FIXME: We only deal with begin locations.
|
// FIXME: We only deal with begin locations.
|
||||||
EXPECT_FALSE(Ctx->getExpandedText(at(3, 11)).has_value());
|
EXPECT_FALSE(Ctx->getExpandedText(at(3, 11)).hasValue());
|
||||||
EXPECT_FALSE(Ctx->getOriginalText(at(3, 11)).has_value());
|
EXPECT_FALSE(Ctx->getOriginalText(at(3, 11)).hasValue());
|
||||||
|
|
||||||
// Same here.
|
// Same here.
|
||||||
EXPECT_FALSE(Ctx->getExpandedText(at(3, 12)).has_value());
|
EXPECT_FALSE(Ctx->getExpandedText(at(3, 12)).hasValue());
|
||||||
EXPECT_FALSE(Ctx->getOriginalText(at(3, 12)).has_value());
|
EXPECT_FALSE(Ctx->getOriginalText(at(3, 12)).hasValue());
|
||||||
|
|
||||||
// The beginning of the last expansion of EMPTY.
|
// The beginning of the last expansion of EMPTY.
|
||||||
EXPECT_TRUE(Ctx->getExpandedText(at(4, 1)).has_value());
|
EXPECT_TRUE(Ctx->getExpandedText(at(4, 1)).hasValue());
|
||||||
EXPECT_TRUE(Ctx->getOriginalText(at(4, 1)).has_value());
|
EXPECT_TRUE(Ctx->getOriginalText(at(4, 1)).hasValue());
|
||||||
|
|
||||||
// Same as for the 3:11 case.
|
// Same as for the 3:11 case.
|
||||||
EXPECT_FALSE(Ctx->getExpandedText(at(4, 2)).has_value());
|
EXPECT_FALSE(Ctx->getExpandedText(at(4, 2)).hasValue());
|
||||||
EXPECT_FALSE(Ctx->getOriginalText(at(4, 2)).has_value());
|
EXPECT_FALSE(Ctx->getOriginalText(at(4, 2)).hasValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MacroExpansionContextTest, EmptyExpansions) {
|
TEST_F(MacroExpansionContextTest, EmptyExpansions) {
|
||||||
|
@ -181,14 +181,14 @@ EMPTY zz
|
||||||
// A b cd ef gh
|
// A b cd ef gh
|
||||||
// zz
|
// zz
|
||||||
|
|
||||||
EXPECT_EQ("", *Ctx->getExpandedText(at(3, 10)));
|
EXPECT_EQ("", Ctx->getExpandedText(at(3, 10)).getValue());
|
||||||
EXPECT_EQ("EMPTY", *Ctx->getOriginalText(at(3, 10)));
|
EXPECT_EQ("EMPTY", Ctx->getOriginalText(at(3, 10)).getValue());
|
||||||
|
|
||||||
EXPECT_EQ("", *Ctx->getExpandedText(at(3, 19)));
|
EXPECT_EQ("", Ctx->getExpandedText(at(3, 19)).getValue());
|
||||||
EXPECT_EQ("EMPTY", *Ctx->getOriginalText(at(3, 19)));
|
EXPECT_EQ("EMPTY", Ctx->getOriginalText(at(3, 19)).getValue());
|
||||||
|
|
||||||
EXPECT_EQ("", *Ctx->getExpandedText(at(4, 1)));
|
EXPECT_EQ("", Ctx->getExpandedText(at(4, 1)).getValue());
|
||||||
EXPECT_EQ("EMPTY", *Ctx->getOriginalText(at(4, 1)));
|
EXPECT_EQ("EMPTY", Ctx->getOriginalText(at(4, 1)).getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MacroExpansionContextTest, TransitiveExpansions) {
|
TEST_F(MacroExpansionContextTest, TransitiveExpansions) {
|
||||||
|
@ -200,10 +200,10 @@ TEST_F(MacroExpansionContextTest, TransitiveExpansions) {
|
||||||
// After preprocessing:
|
// After preprocessing:
|
||||||
// A b cd ) 1 ef gh
|
// A b cd ) 1 ef gh
|
||||||
|
|
||||||
EXPECT_EQ("WOOF", *Ctx->getOriginalText(at(4, 10)));
|
EXPECT_EQ("WOOF", Ctx->getOriginalText(at(4, 10)).getValue());
|
||||||
|
|
||||||
EXPECT_EQ("", *Ctx->getExpandedText(at(4, 18)));
|
EXPECT_EQ("", Ctx->getExpandedText(at(4, 18)).getValue());
|
||||||
EXPECT_EQ("EMPTY", *Ctx->getOriginalText(at(4, 18)));
|
EXPECT_EQ("EMPTY", Ctx->getOriginalText(at(4, 18)).getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MacroExpansionContextTest, MacroFunctions) {
|
TEST_F(MacroExpansionContextTest, MacroFunctions) {
|
||||||
|
@ -219,17 +219,17 @@ TEST_F(MacroExpansionContextTest, MacroFunctions) {
|
||||||
// WOOF( ) ) ) 1
|
// WOOF( ) ) ) 1
|
||||||
// bar barr( ) ) ) 1( ) ) ) 1),,),')
|
// bar barr( ) ) ) 1( ) ) ) 1),,),')
|
||||||
|
|
||||||
EXPECT_EQ("$$ ef ()))1", *Ctx->getExpandedText(at(4, 10)));
|
EXPECT_EQ("$$ ef ()))1", Ctx->getExpandedText(at(4, 10)).getValue());
|
||||||
EXPECT_EQ("WOOF($$ ef)", *Ctx->getOriginalText(at(4, 10)));
|
EXPECT_EQ("WOOF($$ ef)", Ctx->getOriginalText(at(4, 10)).getValue());
|
||||||
|
|
||||||
EXPECT_EQ("", Ctx->getExpandedText(at(4, 22)).value());
|
EXPECT_EQ("", Ctx->getExpandedText(at(4, 22)).getValue());
|
||||||
EXPECT_EQ("EMPTY", Ctx->getOriginalText(at(4, 22)).value());
|
EXPECT_EQ("EMPTY", Ctx->getOriginalText(at(4, 22)).getValue());
|
||||||
|
|
||||||
EXPECT_EQ("WOOF ()))1", Ctx->getExpandedText(at(5, 3)).value());
|
EXPECT_EQ("WOOF ()))1", Ctx->getExpandedText(at(5, 3)).getValue());
|
||||||
EXPECT_EQ("WOOF(WOOF)", Ctx->getOriginalText(at(5, 3)).value());
|
EXPECT_EQ("WOOF(WOOF)", Ctx->getOriginalText(at(5, 3)).getValue());
|
||||||
|
|
||||||
EXPECT_EQ("bar barr ()))1()))1", Ctx->getExpandedText(at(6, 3)).value());
|
EXPECT_EQ("bar barr ()))1()))1", Ctx->getExpandedText(at(6, 3)).getValue());
|
||||||
EXPECT_EQ("WOOF(WOOF(bar barr))", Ctx->getOriginalText(at(6, 3)).value());
|
EXPECT_EQ("WOOF(WOOF(bar barr))", Ctx->getOriginalText(at(6, 3)).getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MacroExpansionContextTest, VariadicMacros) {
|
TEST_F(MacroExpansionContextTest, VariadicMacros) {
|
||||||
|
@ -251,23 +251,24 @@ TEST_F(MacroExpansionContextTest, VariadicMacros) {
|
||||||
// fprintf (stderr, "success!\n" );
|
// fprintf (stderr, "success!\n" );
|
||||||
|
|
||||||
EXPECT_EQ(R"(fprintf (stderr ,"success!\n",))",
|
EXPECT_EQ(R"(fprintf (stderr ,"success!\n",))",
|
||||||
Ctx->getExpandedText(at(3, 3)).value());
|
Ctx->getExpandedText(at(3, 3)).getValue());
|
||||||
EXPECT_EQ(R"(eprintf("success!\n", ))",
|
EXPECT_EQ(R"(eprintf("success!\n", ))",
|
||||||
Ctx->getOriginalText(at(3, 3)).value());
|
Ctx->getOriginalText(at(3, 3)).getValue());
|
||||||
|
|
||||||
EXPECT_EQ(R"(fprintf (stderr ,"success!\n",))",
|
EXPECT_EQ(R"(fprintf (stderr ,"success!\n",))",
|
||||||
Ctx->getExpandedText(at(4, 3)).value());
|
Ctx->getExpandedText(at(4, 3)).getValue());
|
||||||
EXPECT_EQ(R"(eprintf("success!\n"))", Ctx->getOriginalText(at(4, 3)).value());
|
EXPECT_EQ(R"(eprintf("success!\n"))",
|
||||||
|
Ctx->getOriginalText(at(4, 3)).getValue());
|
||||||
|
|
||||||
EXPECT_EQ(R"(fprintf (stderr ,"success!\n"))",
|
EXPECT_EQ(R"(fprintf (stderr ,"success!\n"))",
|
||||||
Ctx->getExpandedText(at(8, 3)).value());
|
Ctx->getExpandedText(at(8, 3)).getValue());
|
||||||
EXPECT_EQ(R"(eprintf2("success!\n", ))",
|
EXPECT_EQ(R"(eprintf2("success!\n", ))",
|
||||||
Ctx->getOriginalText(at(8, 3)).value());
|
Ctx->getOriginalText(at(8, 3)).getValue());
|
||||||
|
|
||||||
EXPECT_EQ(R"(fprintf (stderr ,"success!\n"))",
|
EXPECT_EQ(R"(fprintf (stderr ,"success!\n"))",
|
||||||
Ctx->getExpandedText(at(9, 3)).value());
|
Ctx->getExpandedText(at(9, 3)).getValue());
|
||||||
EXPECT_EQ(R"(eprintf2("success!\n"))",
|
EXPECT_EQ(R"(eprintf2("success!\n"))",
|
||||||
Ctx->getOriginalText(at(9, 3)).value());
|
Ctx->getOriginalText(at(9, 3)).getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MacroExpansionContextTest, ConcatenationMacros) {
|
TEST_F(MacroExpansionContextTest, ConcatenationMacros) {
|
||||||
|
@ -285,12 +286,12 @@ TEST_F(MacroExpansionContextTest, ConcatenationMacros) {
|
||||||
// };
|
// };
|
||||||
|
|
||||||
EXPECT_EQ(R"({"quit",quit_command })",
|
EXPECT_EQ(R"({"quit",quit_command })",
|
||||||
Ctx->getExpandedText(at(4, 5)).value());
|
Ctx->getExpandedText(at(4, 5)).getValue());
|
||||||
EXPECT_EQ("COMMAND(quit)", Ctx->getOriginalText(at(4, 5)).value());
|
EXPECT_EQ("COMMAND(quit)", Ctx->getOriginalText(at(4, 5)).getValue());
|
||||||
|
|
||||||
EXPECT_EQ(R"({"help",help_command })",
|
EXPECT_EQ(R"({"help",help_command })",
|
||||||
Ctx->getExpandedText(at(5, 5)).value());
|
Ctx->getExpandedText(at(5, 5)).getValue());
|
||||||
EXPECT_EQ("COMMAND(help)", Ctx->getOriginalText(at(5, 5)).value());
|
EXPECT_EQ("COMMAND(help)", Ctx->getOriginalText(at(5, 5)).getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MacroExpansionContextTest, StringizingMacros) {
|
TEST_F(MacroExpansionContextTest, StringizingMacros) {
|
||||||
|
@ -315,14 +316,14 @@ TEST_F(MacroExpansionContextTest, StringizingMacros) {
|
||||||
|
|
||||||
EXPECT_EQ(
|
EXPECT_EQ(
|
||||||
R"(do {if (x ==0)fprintf (stderr ,"Warning: ""x == 0""\n");}while (0))",
|
R"(do {if (x ==0)fprintf (stderr ,"Warning: ""x == 0""\n");}while (0))",
|
||||||
Ctx->getExpandedText(at(6, 3)).value());
|
Ctx->getExpandedText(at(6, 3)).getValue());
|
||||||
EXPECT_EQ("WARN_IF (x == 0)", Ctx->getOriginalText(at(6, 3)).value());
|
EXPECT_EQ("WARN_IF (x == 0)", Ctx->getOriginalText(at(6, 3)).getValue());
|
||||||
|
|
||||||
EXPECT_EQ(R"("foo")", Ctx->getExpandedText(at(11, 3)).value());
|
EXPECT_EQ(R"("foo")", Ctx->getExpandedText(at(11, 3)).getValue());
|
||||||
EXPECT_EQ("str (foo)", Ctx->getOriginalText(at(11, 3)).value());
|
EXPECT_EQ("str (foo)", Ctx->getOriginalText(at(11, 3)).getValue());
|
||||||
|
|
||||||
EXPECT_EQ(R"("4")", Ctx->getExpandedText(at(12, 3)).value());
|
EXPECT_EQ(R"("4")", Ctx->getExpandedText(at(12, 3)).getValue());
|
||||||
EXPECT_EQ("xstr (foo)", Ctx->getOriginalText(at(12, 3)).value());
|
EXPECT_EQ("xstr (foo)", Ctx->getOriginalText(at(12, 3)).getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MacroExpansionContextTest, StringizingVariadicMacros) {
|
TEST_F(MacroExpansionContextTest, StringizingVariadicMacros) {
|
||||||
|
@ -351,18 +352,18 @@ TEST_F(MacroExpansionContextTest, StringizingVariadicMacros) {
|
||||||
|
|
||||||
EXPECT_EQ("zz !apple !x *apple !x !**y (apple )zz !apple !x *apple !x !**y "
|
EXPECT_EQ("zz !apple !x *apple !x !**y (apple )zz !apple !x *apple !x !**y "
|
||||||
"(appleapple ))))",
|
"(appleapple ))))",
|
||||||
Ctx->getExpandedText(at(11, 3)).value());
|
Ctx->getExpandedText(at(11, 3)).getValue());
|
||||||
EXPECT_EQ("q(g)", Ctx->getOriginalText(at(11, 3)).value());
|
EXPECT_EQ("q(g)", Ctx->getOriginalText(at(11, 3)).getValue());
|
||||||
|
|
||||||
EXPECT_EQ(R"res("apple"(apple )"apple"(appleapple )))))res",
|
EXPECT_EQ(R"res("apple"(apple )"apple"(appleapple )))))res",
|
||||||
Ctx->getExpandedText(at(12, 3)).value());
|
Ctx->getExpandedText(at(12, 3)).getValue());
|
||||||
EXPECT_EQ("q(xstr)", Ctx->getOriginalText(at(12, 3)).value());
|
EXPECT_EQ("q(xstr)", Ctx->getOriginalText(at(12, 3)).getValue());
|
||||||
|
|
||||||
EXPECT_EQ("zz !*)!x )!**y ", Ctx->getExpandedText(at(13, 3)).value());
|
EXPECT_EQ("zz !*)!x )!**y ", Ctx->getExpandedText(at(13, 3)).getValue());
|
||||||
EXPECT_EQ("g(RParen2x)", Ctx->getOriginalText(at(13, 3)).value());
|
EXPECT_EQ("g(RParen2x)", Ctx->getOriginalText(at(13, 3)).getValue());
|
||||||
|
|
||||||
EXPECT_EQ("!))*))", Ctx->getExpandedText(at(14, 3)).value());
|
EXPECT_EQ("!))*))", Ctx->getExpandedText(at(14, 3)).getValue());
|
||||||
EXPECT_EQ("f( RParen2x )", Ctx->getOriginalText(at(14, 3)).value());
|
EXPECT_EQ("f( RParen2x )", Ctx->getOriginalText(at(14, 3)).getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MacroExpansionContextTest, RedefUndef) {
|
TEST_F(MacroExpansionContextTest, RedefUndef) {
|
||||||
|
@ -380,15 +381,15 @@ TEST_F(MacroExpansionContextTest, RedefUndef) {
|
||||||
// Hi(Hi)
|
// Hi(Hi)
|
||||||
|
|
||||||
// FIXME: Extra space follows every identifier.
|
// FIXME: Extra space follows every identifier.
|
||||||
EXPECT_EQ("Welcome Adam ", Ctx->getExpandedText(at(3, 3)).value());
|
EXPECT_EQ("Welcome Adam ", Ctx->getExpandedText(at(3, 3)).getValue());
|
||||||
EXPECT_EQ("Hi(Adam)", Ctx->getOriginalText(at(3, 3)).value());
|
EXPECT_EQ("Hi(Adam)", Ctx->getOriginalText(at(3, 3)).getValue());
|
||||||
|
|
||||||
EXPECT_EQ("Willkommen ", Ctx->getExpandedText(at(5, 3)).value());
|
EXPECT_EQ("Willkommen ", Ctx->getExpandedText(at(5, 3)).getValue());
|
||||||
EXPECT_EQ("Hi", Ctx->getOriginalText(at(5, 3)).value());
|
EXPECT_EQ("Hi", Ctx->getOriginalText(at(5, 3)).getValue());
|
||||||
|
|
||||||
// There was no macro expansion at 7:3, we should expect None.
|
// There was no macro expansion at 7:3, we should expect None.
|
||||||
EXPECT_FALSE(Ctx->getExpandedText(at(7, 3)).has_value());
|
EXPECT_FALSE(Ctx->getExpandedText(at(7, 3)).hasValue());
|
||||||
EXPECT_FALSE(Ctx->getOriginalText(at(7, 3)).has_value());
|
EXPECT_FALSE(Ctx->getOriginalText(at(7, 3)).hasValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MacroExpansionContextTest, UnbalacedParenthesis) {
|
TEST_F(MacroExpansionContextTest, UnbalacedParenthesis) {
|
||||||
|
@ -410,11 +411,12 @@ TEST_F(MacroExpansionContextTest, UnbalacedParenthesis) {
|
||||||
// fun();
|
// fun();
|
||||||
// int x = ((1, fun(), 1, fun(), 1 ));
|
// int x = ((1, fun(), 1, fun(), 1 ));
|
||||||
|
|
||||||
EXPECT_EQ("fun ()", Ctx->getExpandedText(at(8, 3)).value());
|
EXPECT_EQ("fun ()", Ctx->getExpandedText(at(8, 3)).getValue());
|
||||||
EXPECT_EQ("applyInt )", Ctx->getOriginalText(at(8, 3)).value());
|
EXPECT_EQ("applyInt )", Ctx->getOriginalText(at(8, 3)).getValue());
|
||||||
|
|
||||||
EXPECT_EQ("((1,fun (),1,fun (),1", Ctx->getExpandedText(at(13, 12)).value());
|
EXPECT_EQ("((1,fun (),1,fun (),1",
|
||||||
EXPECT_EQ("f(f(1))", Ctx->getOriginalText(at(13, 12)).value());
|
Ctx->getExpandedText(at(13, 12)).getValue());
|
||||||
|
EXPECT_EQ("f(f(1))", Ctx->getOriginalText(at(13, 12)).getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
|
@ -64,14 +64,14 @@ TEST(DarwinSDKInfo, VersionMappingParseEmpty) {
|
||||||
llvm::json::Object Obj({});
|
llvm::json::Object Obj({});
|
||||||
EXPECT_FALSE(
|
EXPECT_FALSE(
|
||||||
DarwinSDKInfo::RelatedTargetVersionMapping::parseJSON(Obj, VersionTuple())
|
DarwinSDKInfo::RelatedTargetVersionMapping::parseJSON(Obj, VersionTuple())
|
||||||
.has_value());
|
.hasValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(DarwinSDKInfo, VersionMappingParseError) {
|
TEST(DarwinSDKInfo, VersionMappingParseError) {
|
||||||
llvm::json::Object Obj({{"test", "1.2"}});
|
llvm::json::Object Obj({{"test", "1.2"}});
|
||||||
EXPECT_FALSE(
|
EXPECT_FALSE(
|
||||||
DarwinSDKInfo::RelatedTargetVersionMapping::parseJSON(Obj, VersionTuple())
|
DarwinSDKInfo::RelatedTargetVersionMapping::parseJSON(Obj, VersionTuple())
|
||||||
.has_value());
|
.hasValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(DarwinSDKInfoTest, ParseAndTestMappingMacCatalyst) {
|
TEST(DarwinSDKInfoTest, ParseAndTestMappingMacCatalyst) {
|
||||||
|
|
|
@ -258,12 +258,12 @@ void checkEventualResultWithTimeout(VerifyingConsumer &TestConsumer) {
|
||||||
std::future_status::ready)
|
std::future_status::ready)
|
||||||
<< "The expected result state wasn't reached before the time-out.";
|
<< "The expected result state wasn't reached before the time-out.";
|
||||||
std::unique_lock<std::mutex> L(TestConsumer.Mtx);
|
std::unique_lock<std::mutex> L(TestConsumer.Mtx);
|
||||||
EXPECT_TRUE(TestConsumer.result().has_value());
|
EXPECT_TRUE(TestConsumer.result().hasValue());
|
||||||
if (TestConsumer.result()) {
|
if (TestConsumer.result().hasValue()) {
|
||||||
EXPECT_TRUE(*TestConsumer.result());
|
EXPECT_TRUE(*TestConsumer.result());
|
||||||
}
|
}
|
||||||
if ((TestConsumer.result() && !*TestConsumer.result()) ||
|
if ((TestConsumer.result().hasValue() && !TestConsumer.result().getValue()) ||
|
||||||
!TestConsumer.result())
|
!TestConsumer.result().hasValue())
|
||||||
TestConsumer.printUnmetExpectations(llvm::outs());
|
TestConsumer.printUnmetExpectations(llvm::outs());
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
|
@ -200,9 +200,9 @@ TEST_F(HeaderSearchTest, HeaderFrameworkLookup) {
|
||||||
/*RelativePath=*/nullptr, /*RequestingModule=*/nullptr,
|
/*RelativePath=*/nullptr, /*RequestingModule=*/nullptr,
|
||||||
/*SuggestedModule=*/nullptr, /*IsMapped=*/nullptr, &IsFrameworkFound);
|
/*SuggestedModule=*/nullptr, /*IsMapped=*/nullptr, &IsFrameworkFound);
|
||||||
|
|
||||||
EXPECT_TRUE(FoundFile.has_value());
|
EXPECT_TRUE(FoundFile.hasValue());
|
||||||
EXPECT_TRUE(IsFrameworkFound);
|
EXPECT_TRUE(IsFrameworkFound);
|
||||||
auto &FE = *FoundFile;
|
auto &FE = FoundFile.getValue();
|
||||||
auto FI = Search.getExistingFileInfo(FE);
|
auto FI = Search.getExistingFileInfo(FE);
|
||||||
EXPECT_TRUE(FI);
|
EXPECT_TRUE(FI);
|
||||||
EXPECT_TRUE(FI->IsValid);
|
EXPECT_TRUE(FI->IsValid);
|
||||||
|
@ -269,9 +269,9 @@ TEST_F(HeaderSearchTest, HeaderMapFrameworkLookup) {
|
||||||
/*SuggestedModule=*/nullptr, &IsMapped,
|
/*SuggestedModule=*/nullptr, &IsMapped,
|
||||||
/*IsFrameworkFound=*/nullptr);
|
/*IsFrameworkFound=*/nullptr);
|
||||||
|
|
||||||
EXPECT_TRUE(FoundFile.has_value());
|
EXPECT_TRUE(FoundFile.hasValue());
|
||||||
EXPECT_TRUE(IsMapped);
|
EXPECT_TRUE(IsMapped);
|
||||||
auto &FE = *FoundFile;
|
auto &FE = FoundFile.getValue();
|
||||||
auto FI = Search.getExistingFileInfo(FE);
|
auto FI = Search.getExistingFileInfo(FE);
|
||||||
EXPECT_TRUE(FI);
|
EXPECT_TRUE(FI);
|
||||||
EXPECT_TRUE(FI->IsValid);
|
EXPECT_TRUE(FI->IsValid);
|
||||||
|
|
|
@ -305,13 +305,13 @@ void foo(int x) {
|
||||||
EXPECT_EQ("TestUnion", CRecordType->getDecl()->getName());
|
EXPECT_EQ("TestUnion", CRecordType->getDecl()->getName());
|
||||||
|
|
||||||
auto D = getByName("d").getAs<nonloc::CompoundVal>();
|
auto D = getByName("d").getAs<nonloc::CompoundVal>();
|
||||||
ASSERT_TRUE(D.has_value());
|
ASSERT_TRUE(D.hasValue());
|
||||||
auto Begin = D->begin();
|
auto Begin = D->begin();
|
||||||
ASSERT_NE(D->end(), Begin);
|
ASSERT_NE(D->end(), Begin);
|
||||||
++Begin;
|
++Begin;
|
||||||
ASSERT_EQ(D->end(), Begin);
|
ASSERT_EQ(D->end(), Begin);
|
||||||
auto LD = D->begin()->getAs<nonloc::LazyCompoundVal>();
|
auto LD = D->begin()->getAs<nonloc::LazyCompoundVal>();
|
||||||
ASSERT_TRUE(LD.has_value());
|
ASSERT_TRUE(LD.hasValue());
|
||||||
auto LDT = LD->getType(Context);
|
auto LDT = LD->getType(Context);
|
||||||
ASSERT_FALSE(LDT.isNull());
|
ASSERT_FALSE(LDT.isNull());
|
||||||
const auto *DRecordType = dyn_cast<RecordType>(LDT);
|
const auto *DRecordType = dyn_cast<RecordType>(LDT);
|
||||||
|
|
|
@ -118,18 +118,18 @@ static bool checkReplacementError(llvm::Error &&Error,
|
||||||
OS << "Unexpected error code: " << int(RE.get()) << "\n";
|
OS << "Unexpected error code: " << int(RE.get()) << "\n";
|
||||||
if (ExpectedExisting != RE.getExistingReplacement()) {
|
if (ExpectedExisting != RE.getExistingReplacement()) {
|
||||||
OS << "Expected Existing != Actual Existing.\n";
|
OS << "Expected Existing != Actual Existing.\n";
|
||||||
if (ExpectedExisting)
|
if (ExpectedExisting.hasValue())
|
||||||
OS << "Expected existing replacement: " << ExpectedExisting->toString()
|
OS << "Expected existing replacement: " << ExpectedExisting->toString()
|
||||||
<< "\n";
|
<< "\n";
|
||||||
if (RE.getExistingReplacement())
|
if (RE.getExistingReplacement().hasValue())
|
||||||
OS << "Actual existing replacement: "
|
OS << "Actual existing replacement: "
|
||||||
<< RE.getExistingReplacement()->toString() << "\n";
|
<< RE.getExistingReplacement()->toString() << "\n";
|
||||||
}
|
}
|
||||||
if (ExpectedNew != RE.getNewReplacement()) {
|
if (ExpectedNew != RE.getNewReplacement()) {
|
||||||
OS << "Expected New != Actual New.\n";
|
OS << "Expected New != Actual New.\n";
|
||||||
if (ExpectedNew)
|
if (ExpectedNew.hasValue())
|
||||||
OS << "Expected new replacement: " << ExpectedNew->toString() << "\n";
|
OS << "Expected new replacement: " << ExpectedNew->toString() << "\n";
|
||||||
if (RE.getNewReplacement())
|
if (RE.getNewReplacement().hasValue())
|
||||||
OS << "Actual new replacement: " << RE.getNewReplacement()->toString()
|
OS << "Actual new replacement: " << RE.getNewReplacement()->toString()
|
||||||
<< "\n";
|
<< "\n";
|
||||||
}
|
}
|
||||||
|
|
|
@ -217,22 +217,22 @@ void RVVEmitter::createHeader(raw_ostream &OS) {
|
||||||
for (int Log2LMUL : Log2LMULs) {
|
for (int Log2LMUL : Log2LMULs) {
|
||||||
auto T = RVVType::computeType(BasicType::Int8, Log2LMUL,
|
auto T = RVVType::computeType(BasicType::Int8, Log2LMUL,
|
||||||
PrototypeDescriptor::Mask);
|
PrototypeDescriptor::Mask);
|
||||||
if (T)
|
if (T.hasValue())
|
||||||
printType(*T);
|
printType(T.getValue());
|
||||||
}
|
}
|
||||||
// Print RVV int/float types.
|
// Print RVV int/float types.
|
||||||
for (char I : StringRef("csil")) {
|
for (char I : StringRef("csil")) {
|
||||||
BasicType BT = ParseBasicType(I);
|
BasicType BT = ParseBasicType(I);
|
||||||
for (int Log2LMUL : Log2LMULs) {
|
for (int Log2LMUL : Log2LMULs) {
|
||||||
auto T = RVVType::computeType(BT, Log2LMUL, PrototypeDescriptor::Vector);
|
auto T = RVVType::computeType(BT, Log2LMUL, PrototypeDescriptor::Vector);
|
||||||
if (T) {
|
if (T.hasValue()) {
|
||||||
printType(*T);
|
printType(T.getValue());
|
||||||
auto UT = RVVType::computeType(
|
auto UT = RVVType::computeType(
|
||||||
BT, Log2LMUL,
|
BT, Log2LMUL,
|
||||||
PrototypeDescriptor(BaseTypeModifier::Vector,
|
PrototypeDescriptor(BaseTypeModifier::Vector,
|
||||||
VectorTypeModifier::NoModifier,
|
VectorTypeModifier::NoModifier,
|
||||||
TypeModifier::UnsignedInteger));
|
TypeModifier::UnsignedInteger));
|
||||||
printType(*UT);
|
printType(UT.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -240,8 +240,8 @@ void RVVEmitter::createHeader(raw_ostream &OS) {
|
||||||
for (int Log2LMUL : Log2LMULs) {
|
for (int Log2LMUL : Log2LMULs) {
|
||||||
auto T = RVVType::computeType(BasicType::Float16, Log2LMUL,
|
auto T = RVVType::computeType(BasicType::Float16, Log2LMUL,
|
||||||
PrototypeDescriptor::Vector);
|
PrototypeDescriptor::Vector);
|
||||||
if (T)
|
if (T.hasValue())
|
||||||
printType(*T);
|
printType(T.getValue());
|
||||||
}
|
}
|
||||||
OS << "#endif\n";
|
OS << "#endif\n";
|
||||||
|
|
||||||
|
@ -249,8 +249,8 @@ void RVVEmitter::createHeader(raw_ostream &OS) {
|
||||||
for (int Log2LMUL : Log2LMULs) {
|
for (int Log2LMUL : Log2LMULs) {
|
||||||
auto T = RVVType::computeType(BasicType::Float32, Log2LMUL,
|
auto T = RVVType::computeType(BasicType::Float32, Log2LMUL,
|
||||||
PrototypeDescriptor::Vector);
|
PrototypeDescriptor::Vector);
|
||||||
if (T)
|
if (T.hasValue())
|
||||||
printType(*T);
|
printType(T.getValue());
|
||||||
}
|
}
|
||||||
OS << "#endif\n";
|
OS << "#endif\n";
|
||||||
|
|
||||||
|
@ -258,8 +258,8 @@ void RVVEmitter::createHeader(raw_ostream &OS) {
|
||||||
for (int Log2LMUL : Log2LMULs) {
|
for (int Log2LMUL : Log2LMULs) {
|
||||||
auto T = RVVType::computeType(BasicType::Float64, Log2LMUL,
|
auto T = RVVType::computeType(BasicType::Float64, Log2LMUL,
|
||||||
PrototypeDescriptor::Vector);
|
PrototypeDescriptor::Vector);
|
||||||
if (T)
|
if (T.hasValue())
|
||||||
printType(*T);
|
printType(T.getValue());
|
||||||
}
|
}
|
||||||
OS << "#endif\n\n";
|
OS << "#endif\n\n";
|
||||||
|
|
||||||
|
|
|
@ -446,9 +446,7 @@ public:
|
||||||
/// `load` must be a LHS array_load. Returns `llvm::None` on error.
|
/// `load` must be a LHS array_load. Returns `llvm::None` on error.
|
||||||
llvm::Optional<size_t> findArgPosition(fir::ArrayLoadOp load);
|
llvm::Optional<size_t> findArgPosition(fir::ArrayLoadOp load);
|
||||||
|
|
||||||
bool isLHS(fir::ArrayLoadOp load) {
|
bool isLHS(fir::ArrayLoadOp load) { return findArgPosition(load).hasValue(); }
|
||||||
return findArgPosition(load).has_value();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// `load` must be a LHS array_load. Determine the threaded inner argument
|
/// `load` must be a LHS array_load. Determine the threaded inner argument
|
||||||
/// corresponding to this load.
|
/// corresponding to this load.
|
||||||
|
@ -467,15 +465,15 @@ public:
|
||||||
|
|
||||||
llvm::Optional<fir::ArrayLoadOp> getLhsLoad(size_t i) {
|
llvm::Optional<fir::ArrayLoadOp> getLhsLoad(size_t i) {
|
||||||
assert(i < lhsBases.size());
|
assert(i < lhsBases.size());
|
||||||
if (lhsBases[counter])
|
if (lhsBases[counter].hasValue())
|
||||||
return findBinding(*lhsBases[counter]);
|
return findBinding(lhsBases[counter].getValue());
|
||||||
return llvm::None;
|
return llvm::None;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return the outermost loop in this FORALL nest.
|
/// Return the outermost loop in this FORALL nest.
|
||||||
fir::DoLoopOp getOuterLoop() {
|
fir::DoLoopOp getOuterLoop() {
|
||||||
assert(outerLoop);
|
assert(outerLoop.hasValue());
|
||||||
return *outerLoop;
|
return outerLoop.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return the statement context for the entire, outermost FORALL construct.
|
/// Return the statement context for the entire, outermost FORALL construct.
|
||||||
|
|
|
@ -2227,10 +2227,10 @@ private:
|
||||||
llvm_unreachable("unknown category");
|
llvm_unreachable("unknown category");
|
||||||
}
|
}
|
||||||
if (lhsIsWholeAllocatable)
|
if (lhsIsWholeAllocatable)
|
||||||
fir::factory::finalizeRealloc(*builder, loc, *lhsMutableBox,
|
fir::factory::finalizeRealloc(
|
||||||
/*lbounds=*/llvm::None,
|
*builder, loc, lhsMutableBox.getValue(),
|
||||||
/*takeLboundsIfRealloc=*/false,
|
/*lbounds=*/llvm::None, /*takeLboundsIfRealloc=*/false,
|
||||||
*lhsRealloc);
|
lhsRealloc.getValue());
|
||||||
},
|
},
|
||||||
|
|
||||||
// [2] User defined assignment. If the context is a scalar
|
// [2] User defined assignment. If the context is a scalar
|
||||||
|
|
|
@ -2607,8 +2607,8 @@ public:
|
||||||
funcSymbolAttr, operands);
|
funcSymbolAttr, operands);
|
||||||
|
|
||||||
if (caller.mustSaveResult())
|
if (caller.mustSaveResult())
|
||||||
builder.create<fir::SaveResultOp>(loc, call.getResult(0),
|
builder.create<fir::SaveResultOp>(
|
||||||
fir::getBase(*allocatedResult),
|
loc, call.getResult(0), fir::getBase(allocatedResult.getValue()),
|
||||||
arrayResultShape, resultLengths);
|
arrayResultShape, resultLengths);
|
||||||
|
|
||||||
if (allocatedResult) {
|
if (allocatedResult) {
|
||||||
|
@ -4110,10 +4110,10 @@ private:
|
||||||
mlir::Value{});
|
mlir::Value{});
|
||||||
}
|
}
|
||||||
} else if (isBoundsRemap()) {
|
} else if (isBoundsRemap()) {
|
||||||
auto lbs = *lbounds;
|
auto lbs = lbounds.getValue();
|
||||||
if (lbs.size() > 0) {
|
if (lbs.size() > 0) {
|
||||||
// Rebox the value with user-specified shift and shape.
|
// Rebox the value with user-specified shift and shape.
|
||||||
auto shapeShiftArgs = flatZip(lbs, *ubounds);
|
auto shapeShiftArgs = flatZip(lbs, ubounds.getValue());
|
||||||
auto shapeTy = fir::ShapeShiftType::get(eleTy.getContext(), lbs.size());
|
auto shapeTy = fir::ShapeShiftType::get(eleTy.getContext(), lbs.size());
|
||||||
mlir::Value shapeShift =
|
mlir::Value shapeShift =
|
||||||
builder.create<fir::ShapeShiftOp>(loc, shapeTy, shapeShiftArgs);
|
builder.create<fir::ShapeShiftOp>(loc, shapeTy, shapeShiftArgs);
|
||||||
|
@ -4185,8 +4185,8 @@ private:
|
||||||
auto [iterSpace, insPt] = genIterSpace(resultTy);
|
auto [iterSpace, insPt] = genIterSpace(resultTy);
|
||||||
auto exv = f(iterSpace);
|
auto exv = f(iterSpace);
|
||||||
iterSpace.setElement(std::move(exv));
|
iterSpace.setElement(std::move(exv));
|
||||||
auto lambda = ccStoreToDest
|
auto lambda = ccStoreToDest.hasValue()
|
||||||
? *ccStoreToDest
|
? ccStoreToDest.getValue()
|
||||||
: defaultStoreToDestination(/*substring=*/nullptr);
|
: defaultStoreToDestination(/*substring=*/nullptr);
|
||||||
mlir::Value updVal = fir::getBase(lambda(iterSpace));
|
mlir::Value updVal = fir::getBase(lambda(iterSpace));
|
||||||
finalizeElementCtx();
|
finalizeElementCtx();
|
||||||
|
@ -4522,8 +4522,8 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate the lazy mask allocation, if one was given.
|
// Generate the lazy mask allocation, if one was given.
|
||||||
if (ccPrelude)
|
if (ccPrelude.hasValue())
|
||||||
ccPrelude.value()(shape);
|
ccPrelude.getValue()(shape);
|
||||||
|
|
||||||
// Now handle the implicit loops.
|
// Now handle the implicit loops.
|
||||||
mlir::Value inner = explicitSpaceIsActive()
|
mlir::Value inner = explicitSpaceIsActive()
|
||||||
|
@ -4582,8 +4582,8 @@ private:
|
||||||
fir::ArrayLoadOp
|
fir::ArrayLoadOp
|
||||||
createAndLoadSomeArrayTemp(mlir::Type type,
|
createAndLoadSomeArrayTemp(mlir::Type type,
|
||||||
llvm::ArrayRef<mlir::Value> shape) {
|
llvm::ArrayRef<mlir::Value> shape) {
|
||||||
if (ccLoadDest)
|
if (ccLoadDest.hasValue())
|
||||||
return ccLoadDest.value()(shape);
|
return ccLoadDest.getValue()(shape);
|
||||||
auto seqTy = type.dyn_cast<fir::SequenceType>();
|
auto seqTy = type.dyn_cast<fir::SequenceType>();
|
||||||
assert(seqTy && "must be an array");
|
assert(seqTy && "must be an array");
|
||||||
mlir::Location loc = getLoc();
|
mlir::Location loc = getLoc();
|
||||||
|
@ -5810,8 +5810,8 @@ private:
|
||||||
// always loaded at the beginning of the statement and merged at the
|
// always loaded at the beginning of the statement and merged at the
|
||||||
// end.
|
// end.
|
||||||
destination = arrLoad;
|
destination = arrLoad;
|
||||||
auto lambda = ccStoreToDest
|
auto lambda = ccStoreToDest.hasValue()
|
||||||
? ccStoreToDest.value()
|
? ccStoreToDest.getValue()
|
||||||
: defaultStoreToDestination(components.substring);
|
: defaultStoreToDestination(components.substring);
|
||||||
return [=](IterSpace iters) -> ExtValue { return lambda(iters); };
|
return [=](IterSpace iters) -> ExtValue { return lambda(iters); };
|
||||||
}
|
}
|
||||||
|
@ -6464,8 +6464,8 @@ private:
|
||||||
|
|
||||||
// Return the continuation.
|
// Return the continuation.
|
||||||
if (fir::isa_char(seqTy.getEleTy())) {
|
if (fir::isa_char(seqTy.getEleTy())) {
|
||||||
if (charLen) {
|
if (charLen.hasValue()) {
|
||||||
auto len = builder.create<fir::LoadOp>(loc, charLen.value());
|
auto len = builder.create<fir::LoadOp>(loc, charLen.getValue());
|
||||||
return genarr(fir::CharArrayBoxValue{mem, len, extents});
|
return genarr(fir::CharArrayBoxValue{mem, len, extents});
|
||||||
}
|
}
|
||||||
return genarr(fir::CharArrayBoxValue{mem, zero, extents});
|
return genarr(fir::CharArrayBoxValue{mem, zero, extents});
|
||||||
|
@ -7181,14 +7181,14 @@ private:
|
||||||
|
|
||||||
void setUnordered(bool b) { unordered = b; }
|
void setUnordered(bool b) { unordered = b; }
|
||||||
|
|
||||||
inline bool isPointerAssignment() const { return lbounds.has_value(); }
|
inline bool isPointerAssignment() const { return lbounds.hasValue(); }
|
||||||
|
|
||||||
inline bool isBoundsSpec() const {
|
inline bool isBoundsSpec() const {
|
||||||
return isPointerAssignment() && !ubounds.has_value();
|
return isPointerAssignment() && !ubounds.hasValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool isBoundsRemap() const {
|
inline bool isBoundsRemap() const {
|
||||||
return isPointerAssignment() && ubounds.has_value();
|
return isPointerAssignment() && ubounds.hasValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
void setPointerAssignmentBounds(
|
void setPointerAssignmentBounds(
|
||||||
|
@ -7515,8 +7515,8 @@ void Fortran::lower::createArrayLoads(
|
||||||
auto genLoad = [&](const auto *x) -> fir::ArrayLoadOp {
|
auto genLoad = [&](const auto *x) -> fir::ArrayLoadOp {
|
||||||
return genArrayLoad(loc, converter, builder, x, symMap, stmtCtx);
|
return genArrayLoad(loc, converter, builder, x, symMap, stmtCtx);
|
||||||
};
|
};
|
||||||
if (esp.lhsBases[counter]) {
|
if (esp.lhsBases[counter].hasValue()) {
|
||||||
auto &base = *esp.lhsBases[counter];
|
auto &base = esp.lhsBases[counter].getValue();
|
||||||
auto load = std::visit(genLoad, base);
|
auto load = std::visit(genLoad, base);
|
||||||
esp.initialArgs.push_back(load);
|
esp.initialArgs.push_back(load);
|
||||||
esp.resetInnerArgs();
|
esp.resetInnerArgs();
|
||||||
|
@ -7535,13 +7535,13 @@ void Fortran::lower::createArrayMergeStores(
|
||||||
// Gen the fir.array_merge_store ops for all LHS arrays.
|
// Gen the fir.array_merge_store ops for all LHS arrays.
|
||||||
for (auto i : llvm::enumerate(esp.getOuterLoop().getResults()))
|
for (auto i : llvm::enumerate(esp.getOuterLoop().getResults()))
|
||||||
if (llvm::Optional<fir::ArrayLoadOp> ldOpt = esp.getLhsLoad(i.index())) {
|
if (llvm::Optional<fir::ArrayLoadOp> ldOpt = esp.getLhsLoad(i.index())) {
|
||||||
fir::ArrayLoadOp load = *ldOpt;
|
fir::ArrayLoadOp load = ldOpt.getValue();
|
||||||
builder.create<fir::ArrayMergeStoreOp>(loc, load, i.value(),
|
builder.create<fir::ArrayMergeStoreOp>(loc, load, i.value(),
|
||||||
load.getMemref(), load.getSlice(),
|
load.getMemref(), load.getSlice(),
|
||||||
load.getTypeparams());
|
load.getTypeparams());
|
||||||
}
|
}
|
||||||
if (esp.loopCleanup) {
|
if (esp.loopCleanup.hasValue()) {
|
||||||
esp.loopCleanup.value()(builder);
|
esp.loopCleanup.getValue()(builder);
|
||||||
esp.loopCleanup = llvm::None;
|
esp.loopCleanup = llvm::None;
|
||||||
}
|
}
|
||||||
esp.initialArgs.clear();
|
esp.initialArgs.clear();
|
||||||
|
|
|
@ -195,12 +195,12 @@ lowerIshftc(fir::FirOpBuilder &builder, mlir::Location loc,
|
||||||
isPresentCheck(2) &&
|
isPresentCheck(2) &&
|
||||||
"only ISHFTC SIZE arg is expected to be dynamically optional here");
|
"only ISHFTC SIZE arg is expected to be dynamically optional here");
|
||||||
assert(retTy && "ISFHTC must have a return type");
|
assert(retTy && "ISFHTC must have a return type");
|
||||||
mlir::Type resultType = *retTy;
|
mlir::Type resultType = retTy.getValue();
|
||||||
llvm::SmallVector<fir::ExtendedValue> args;
|
llvm::SmallVector<fir::ExtendedValue> args;
|
||||||
args.push_back(getOperand(0));
|
args.push_back(getOperand(0));
|
||||||
args.push_back(getOperand(1));
|
args.push_back(getOperand(1));
|
||||||
args.push_back(builder
|
args.push_back(builder
|
||||||
.genIfOp(loc, {resultType}, *isPresentCheck(2),
|
.genIfOp(loc, {resultType}, isPresentCheck(2).getValue(),
|
||||||
/*withElseRegion=*/true)
|
/*withElseRegion=*/true)
|
||||||
.genThen([&]() {
|
.genThen([&]() {
|
||||||
fir::ExtendedValue sizeExv = getOperand(2);
|
fir::ExtendedValue sizeExv = getOperand(2);
|
||||||
|
|
|
@ -862,12 +862,12 @@ void Fortran::lower::ExplicitIterSpace::conditionalCleanup() {
|
||||||
|
|
||||||
llvm::Optional<size_t>
|
llvm::Optional<size_t>
|
||||||
Fortran::lower::ExplicitIterSpace::findArgPosition(fir::ArrayLoadOp load) {
|
Fortran::lower::ExplicitIterSpace::findArgPosition(fir::ArrayLoadOp load) {
|
||||||
if (lhsBases[counter]) {
|
if (lhsBases[counter].hasValue()) {
|
||||||
auto ld = loadBindings.find(*lhsBases[counter]);
|
auto ld = loadBindings.find(lhsBases[counter].getValue());
|
||||||
llvm::Optional<size_t> optPos;
|
llvm::Optional<size_t> optPos;
|
||||||
if (ld != loadBindings.end() && ld->second == load)
|
if (ld != loadBindings.end() && ld->second == load)
|
||||||
optPos = static_cast<size_t>(0u);
|
optPos = static_cast<size_t>(0u);
|
||||||
assert(optPos && "load does not correspond to lhs");
|
assert(optPos.hasValue() && "load does not correspond to lhs");
|
||||||
return optPos;
|
return optPos;
|
||||||
}
|
}
|
||||||
return llvm::None;
|
return llvm::None;
|
||||||
|
@ -919,8 +919,8 @@ Fortran::lower::operator<<(llvm::raw_ostream &s,
|
||||||
s << "LHS bases:\n";
|
s << "LHS bases:\n";
|
||||||
for (const llvm::Optional<Fortran::lower::ExplicitIterSpace::ArrayBases> &u :
|
for (const llvm::Optional<Fortran::lower::ExplicitIterSpace::ArrayBases> &u :
|
||||||
e.lhsBases)
|
e.lhsBases)
|
||||||
if (u)
|
if (u.hasValue())
|
||||||
dump(*u);
|
dump(u.getValue());
|
||||||
s << "RHS bases:\n";
|
s << "RHS bases:\n";
|
||||||
for (const llvm::SmallVector<Fortran::lower::ExplicitIterSpace::ArrayBases>
|
for (const llvm::SmallVector<Fortran::lower::ExplicitIterSpace::ArrayBases>
|
||||||
&bases : e.rhsBases) {
|
&bases : e.rhsBases) {
|
||||||
|
|
|
@ -252,11 +252,11 @@ public:
|
||||||
auto toTy = typeConverter.convertType(unwrapRefType(ty));
|
auto toTy = typeConverter.convertType(unwrapRefType(ty));
|
||||||
bool isPinned = mem.getPinned();
|
bool isPinned = mem.getPinned();
|
||||||
llvm::StringRef uniqName;
|
llvm::StringRef uniqName;
|
||||||
if (mem.getUniqName())
|
if (mem.getUniqName().hasValue())
|
||||||
uniqName = mem.getUniqName().value();
|
uniqName = mem.getUniqName().getValue();
|
||||||
llvm::StringRef bindcName;
|
llvm::StringRef bindcName;
|
||||||
if (mem.getBindcName())
|
if (mem.getBindcName().hasValue())
|
||||||
bindcName = mem.getBindcName().value();
|
bindcName = mem.getBindcName().getValue();
|
||||||
rewriter.replaceOpWithNewOp<AllocaOp>(
|
rewriter.replaceOpWithNewOp<AllocaOp>(
|
||||||
mem, toTy, uniqName, bindcName, isPinned, mem.getTypeparams(),
|
mem, toTy, uniqName, bindcName, isPinned, mem.getTypeparams(),
|
||||||
mem.getShape());
|
mem.getShape());
|
||||||
|
@ -267,11 +267,11 @@ public:
|
||||||
rewriter.setInsertionPoint(mem);
|
rewriter.setInsertionPoint(mem);
|
||||||
auto toTy = typeConverter.convertType(unwrapRefType(ty));
|
auto toTy = typeConverter.convertType(unwrapRefType(ty));
|
||||||
llvm::StringRef uniqName;
|
llvm::StringRef uniqName;
|
||||||
if (mem.getUniqName())
|
if (mem.getUniqName().hasValue())
|
||||||
uniqName = mem.getUniqName().value();
|
uniqName = mem.getUniqName().getValue();
|
||||||
llvm::StringRef bindcName;
|
llvm::StringRef bindcName;
|
||||||
if (mem.getBindcName())
|
if (mem.getBindcName().hasValue())
|
||||||
bindcName = mem.getBindcName().value();
|
bindcName = mem.getBindcName().getValue();
|
||||||
rewriter.replaceOpWithNewOp<AllocMemOp>(
|
rewriter.replaceOpWithNewOp<AllocMemOp>(
|
||||||
mem, toTy, uniqName, bindcName, mem.getTypeparams(),
|
mem, toTy, uniqName, bindcName, mem.getTypeparams(),
|
||||||
mem.getShape());
|
mem.getShape());
|
||||||
|
|
|
@ -2636,9 +2636,9 @@ struct GlobalOpConversion : public FIROpConversion<fir::GlobalOp> {
|
||||||
auto loc = global.getLoc();
|
auto loc = global.getLoc();
|
||||||
mlir::Attribute initAttr;
|
mlir::Attribute initAttr;
|
||||||
if (global.getInitVal())
|
if (global.getInitVal())
|
||||||
initAttr = *global.getInitVal();
|
initAttr = global.getInitVal().getValue();
|
||||||
auto linkage = convertLinkage(global.getLinkName());
|
auto linkage = convertLinkage(global.getLinkName());
|
||||||
auto isConst = global.getConstant().has_value();
|
auto isConst = global.getConstant().hasValue();
|
||||||
auto g = rewriter.create<mlir::LLVM::GlobalOp>(
|
auto g = rewriter.create<mlir::LLVM::GlobalOp>(
|
||||||
loc, tyAttr, isConst, linkage, global.getSymName(), initAttr);
|
loc, tyAttr, isConst, linkage, global.getSymName(), initAttr);
|
||||||
auto &gr = g.getInitializerRegion();
|
auto &gr = g.getInitializerRegion();
|
||||||
|
@ -2692,8 +2692,8 @@ struct GlobalOpConversion : public FIROpConversion<fir::GlobalOp> {
|
||||||
// enumeration.
|
// enumeration.
|
||||||
mlir::LLVM::Linkage
|
mlir::LLVM::Linkage
|
||||||
convertLinkage(llvm::Optional<llvm::StringRef> optLinkage) const {
|
convertLinkage(llvm::Optional<llvm::StringRef> optLinkage) const {
|
||||||
if (optLinkage) {
|
if (optLinkage.hasValue()) {
|
||||||
auto name = *optLinkage;
|
auto name = optLinkage.getValue();
|
||||||
if (name == "internal")
|
if (name == "internal")
|
||||||
return mlir::LLVM::Linkage::Internal;
|
return mlir::LLVM::Linkage::Internal;
|
||||||
if (name == "linkonce")
|
if (name == "linkonce")
|
||||||
|
@ -2749,9 +2749,9 @@ static void genCondBrOp(mlir::Location loc, mlir::Value cmp, mlir::Block *dest,
|
||||||
llvm::Optional<mlir::ValueRange> destOps,
|
llvm::Optional<mlir::ValueRange> destOps,
|
||||||
mlir::ConversionPatternRewriter &rewriter,
|
mlir::ConversionPatternRewriter &rewriter,
|
||||||
mlir::Block *newBlock) {
|
mlir::Block *newBlock) {
|
||||||
if (destOps)
|
if (destOps.hasValue())
|
||||||
rewriter.create<mlir::LLVM::CondBrOp>(loc, cmp, dest, *destOps, newBlock,
|
rewriter.create<mlir::LLVM::CondBrOp>(loc, cmp, dest, destOps.getValue(),
|
||||||
mlir::ValueRange());
|
newBlock, mlir::ValueRange());
|
||||||
else
|
else
|
||||||
rewriter.create<mlir::LLVM::CondBrOp>(loc, cmp, dest, newBlock);
|
rewriter.create<mlir::LLVM::CondBrOp>(loc, cmp, dest, newBlock);
|
||||||
}
|
}
|
||||||
|
@ -2759,8 +2759,9 @@ static void genCondBrOp(mlir::Location loc, mlir::Value cmp, mlir::Block *dest,
|
||||||
template <typename A, typename B>
|
template <typename A, typename B>
|
||||||
static void genBrOp(A caseOp, mlir::Block *dest, llvm::Optional<B> destOps,
|
static void genBrOp(A caseOp, mlir::Block *dest, llvm::Optional<B> destOps,
|
||||||
mlir::ConversionPatternRewriter &rewriter) {
|
mlir::ConversionPatternRewriter &rewriter) {
|
||||||
if (destOps)
|
if (destOps.hasValue())
|
||||||
rewriter.replaceOpWithNewOp<mlir::LLVM::BrOp>(caseOp, *destOps, dest);
|
rewriter.replaceOpWithNewOp<mlir::LLVM::BrOp>(caseOp, destOps.getValue(),
|
||||||
|
dest);
|
||||||
else
|
else
|
||||||
rewriter.replaceOpWithNewOp<mlir::LLVM::BrOp>(caseOp, llvm::None, dest);
|
rewriter.replaceOpWithNewOp<mlir::LLVM::BrOp>(caseOp, llvm::None, dest);
|
||||||
}
|
}
|
||||||
|
@ -2883,14 +2884,15 @@ static void selectMatchAndRewrite(fir::LLVMTypeConverter &lowering, OP select,
|
||||||
const mlir::Attribute &attr = cases[t];
|
const mlir::Attribute &attr = cases[t];
|
||||||
if (auto intAttr = attr.template dyn_cast<mlir::IntegerAttr>()) {
|
if (auto intAttr = attr.template dyn_cast<mlir::IntegerAttr>()) {
|
||||||
destinations.push_back(dest);
|
destinations.push_back(dest);
|
||||||
destinationsOperands.push_back(destOps ? *destOps : mlir::ValueRange{});
|
destinationsOperands.push_back(destOps.hasValue() ? *destOps
|
||||||
|
: mlir::ValueRange{});
|
||||||
caseValues.push_back(intAttr.getInt());
|
caseValues.push_back(intAttr.getInt());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
assert(attr.template dyn_cast_or_null<mlir::UnitAttr>());
|
assert(attr.template dyn_cast_or_null<mlir::UnitAttr>());
|
||||||
assert((t + 1 == conds) && "unit must be last");
|
assert((t + 1 == conds) && "unit must be last");
|
||||||
defaultDestination = dest;
|
defaultDestination = dest;
|
||||||
defaultOperands = destOps ? *destOps : mlir::ValueRange{};
|
defaultOperands = destOps.hasValue() ? *destOps : mlir::ValueRange{};
|
||||||
}
|
}
|
||||||
|
|
||||||
// LLVM::SwitchOp takes a i32 type for the selector.
|
// LLVM::SwitchOp takes a i32 type for the selector.
|
||||||
|
|
|
@ -316,9 +316,9 @@ public:
|
||||||
newOpers.insert(newOpers.end(), trailingOpers.begin(), trailingOpers.end());
|
newOpers.insert(newOpers.end(), trailingOpers.begin(), trailingOpers.end());
|
||||||
if constexpr (std::is_same_v<std::decay_t<A>, fir::CallOp>) {
|
if constexpr (std::is_same_v<std::decay_t<A>, fir::CallOp>) {
|
||||||
fir::CallOp newCall;
|
fir::CallOp newCall;
|
||||||
if (callOp.getCallee()) {
|
if (callOp.getCallee().hasValue()) {
|
||||||
newCall =
|
newCall = rewriter->create<A>(loc, callOp.getCallee().getValue(),
|
||||||
rewriter->create<A>(loc, *callOp.getCallee(), newResTys, newOpers);
|
newResTys, newOpers);
|
||||||
} else {
|
} else {
|
||||||
// Force new type on the input operand.
|
// Force new type on the input operand.
|
||||||
newOpers[0].setType(mlir::FunctionType::get(
|
newOpers[0].setType(mlir::FunctionType::get(
|
||||||
|
|
|
@ -616,10 +616,10 @@ mlir::FunctionType fir::CallOp::getFunctionType() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void fir::CallOp::print(mlir::OpAsmPrinter &p) {
|
void fir::CallOp::print(mlir::OpAsmPrinter &p) {
|
||||||
bool isDirect = getCallee().has_value();
|
bool isDirect = getCallee().hasValue();
|
||||||
p << ' ';
|
p << ' ';
|
||||||
if (isDirect)
|
if (isDirect)
|
||||||
p << *getCallee();
|
p << getCallee().getValue();
|
||||||
else
|
else
|
||||||
p << getOperand(0);
|
p << getOperand(0);
|
||||||
p << '(' << (*this)->getOperands().drop_front(isDirect ? 0 : 1) << ')';
|
p << '(' << (*this)->getOperands().drop_front(isDirect ? 0 : 1) << ')';
|
||||||
|
@ -700,8 +700,9 @@ static void printCmpOp(mlir::OpAsmPrinter &p, OPTY op) {
|
||||||
op->template getAttrOfType<mlir::IntegerAttr>(
|
op->template getAttrOfType<mlir::IntegerAttr>(
|
||||||
OPTY::getPredicateAttrName())
|
OPTY::getPredicateAttrName())
|
||||||
.getInt());
|
.getInt());
|
||||||
assert(predSym && "invalid symbol value for predicate");
|
assert(predSym.hasValue() && "invalid symbol value for predicate");
|
||||||
p << '"' << mlir::arith::stringifyCmpFPredicate(*predSym) << '"' << ", ";
|
p << '"' << mlir::arith::stringifyCmpFPredicate(predSym.getValue()) << '"'
|
||||||
|
<< ", ";
|
||||||
p.printOperand(op.getLhs());
|
p.printOperand(op.getLhs());
|
||||||
p << ", ";
|
p << ", ";
|
||||||
p.printOperand(op.getRhs());
|
p.printOperand(op.getRhs());
|
||||||
|
@ -776,8 +777,8 @@ void fir::buildCmpCOp(mlir::OpBuilder &builder, mlir::OperationState &result,
|
||||||
mlir::arith::CmpFPredicate
|
mlir::arith::CmpFPredicate
|
||||||
fir::CmpcOp::getPredicateByName(llvm::StringRef name) {
|
fir::CmpcOp::getPredicateByName(llvm::StringRef name) {
|
||||||
auto pred = mlir::arith::symbolizeCmpFPredicate(name);
|
auto pred = mlir::arith::symbolizeCmpFPredicate(name);
|
||||||
assert(pred && "invalid predicate name");
|
assert(pred.hasValue() && "invalid predicate name");
|
||||||
return *pred;
|
return pred.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
void fir::CmpcOp::print(mlir::OpAsmPrinter &p) { printCmpOp(p, *this); }
|
void fir::CmpcOp::print(mlir::OpAsmPrinter &p) { printCmpOp(p, *this); }
|
||||||
|
@ -1073,7 +1074,7 @@ mlir::ParseResult fir::DispatchTableOp::parse(mlir::OpAsmParser &parser,
|
||||||
// Parse the optional table body.
|
// Parse the optional table body.
|
||||||
mlir::Region *body = result.addRegion();
|
mlir::Region *body = result.addRegion();
|
||||||
mlir::OptionalParseResult parseResult = parser.parseOptionalRegion(*body);
|
mlir::OptionalParseResult parseResult = parser.parseOptionalRegion(*body);
|
||||||
if (parseResult.has_value() && failed(*parseResult))
|
if (parseResult.hasValue() && failed(*parseResult))
|
||||||
return mlir::failure();
|
return mlir::failure();
|
||||||
|
|
||||||
fir::DispatchTableOp::ensureTerminator(*body, parser.getBuilder(),
|
fir::DispatchTableOp::ensureTerminator(*body, parser.getBuilder(),
|
||||||
|
@ -1255,15 +1256,15 @@ mlir::ParseResult fir::GlobalOp::parse(mlir::OpAsmParser &parser,
|
||||||
// Parse the optional initializer body.
|
// Parse the optional initializer body.
|
||||||
auto parseResult =
|
auto parseResult =
|
||||||
parser.parseOptionalRegion(*result.addRegion(), /*arguments=*/{});
|
parser.parseOptionalRegion(*result.addRegion(), /*arguments=*/{});
|
||||||
if (parseResult.has_value() && mlir::failed(*parseResult))
|
if (parseResult.hasValue() && mlir::failed(*parseResult))
|
||||||
return mlir::failure();
|
return mlir::failure();
|
||||||
}
|
}
|
||||||
return mlir::success();
|
return mlir::success();
|
||||||
}
|
}
|
||||||
|
|
||||||
void fir::GlobalOp::print(mlir::OpAsmPrinter &p) {
|
void fir::GlobalOp::print(mlir::OpAsmPrinter &p) {
|
||||||
if (getLinkName())
|
if (getLinkName().hasValue())
|
||||||
p << ' ' << *getLinkName();
|
p << ' ' << getLinkName().getValue();
|
||||||
p << ' ';
|
p << ' ';
|
||||||
p.printAttributeWithoutType(getSymrefAttr());
|
p.printAttributeWithoutType(getSymrefAttr());
|
||||||
if (auto val = getValueOrNull())
|
if (auto val = getValueOrNull())
|
||||||
|
|
|
@ -120,7 +120,7 @@ mlir::Type fir::parseFirType(FIROpsDialect *dialect,
|
||||||
return {};
|
return {};
|
||||||
mlir::Type genType;
|
mlir::Type genType;
|
||||||
auto parseResult = generatedTypeParser(parser, typeTag, genType);
|
auto parseResult = generatedTypeParser(parser, typeTag, genType);
|
||||||
if (parseResult.has_value())
|
if (parseResult.hasValue())
|
||||||
return genType;
|
return genType;
|
||||||
parser.emitError(parser.getNameLoc(), "unknown fir type: ") << typeTag;
|
parser.emitError(parser.getNameLoc(), "unknown fir type: ") << typeTag;
|
||||||
return {};
|
return {};
|
||||||
|
|
|
@ -51,8 +51,8 @@ convertToStringRef(llvm::ArrayRef<std::string> from) {
|
||||||
inline llvm::Optional<llvm::StringRef>
|
inline llvm::Optional<llvm::StringRef>
|
||||||
convertToStringRef(const llvm::Optional<std::string> &from) {
|
convertToStringRef(const llvm::Optional<std::string> &from) {
|
||||||
llvm::Optional<llvm::StringRef> to;
|
llvm::Optional<llvm::StringRef> to;
|
||||||
if (from)
|
if (from.hasValue())
|
||||||
to = *from;
|
to = from.getValue();
|
||||||
return to;
|
return to;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue