================
@@ -2546,18 +2546,30 @@ bool LLParser::parseAllocKind(AllocFnKind &Kind) {
return false;
}
-static std::optional<MemoryEffects::Location> keywordToLoc(lltok::Kind Tok) {
+static std::optional<SmallVector<MemoryEffects::Location, 2>>
----------------
antoniofrighetto wrote:
We shouldn't need a std::optional anymore now, may as well return an empty
vector on default and check for emptiness in the caller. However, I'd avoid
stack allocations that come with SmallVector here, and favour static storage
instead:
```cpp
static ArrayRef<IRMemLocation> keywordToLoc(lltok::Kind Tok) {
using Loc = IRMemLocation;
static constexpr Loc ArgMem[] = {Loc::ArgMem};
static constexpr Loc InaccessibleMem[] = {Loc::InaccessibleMem};
// ...
switch (Tok) {
case lltok::kw_argmem:
return ArgMem;
// ...
}
```
https://github.com/llvm/llvm-project/pull/176968
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits