diff options
Diffstat (limited to 'clang/lib/Sema/SemaBPF.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaBPF.cpp | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/clang/lib/Sema/SemaBPF.cpp b/clang/lib/Sema/SemaBPF.cpp index 6428435ed9d2..be890ab7fa75 100644 --- a/clang/lib/Sema/SemaBPF.cpp +++ b/clang/lib/Sema/SemaBPF.cpp @@ -56,14 +56,9 @@ static bool isValidPreserveTypeInfoArg(Expr *Arg) { return true; // Record type or Enum type. - const Type *Ty = ArgType->getUnqualifiedDesugaredType(); - if (const auto *RT = Ty->getAs<RecordType>()) { + if (const auto *RT = ArgType->getAsCanonical<TagType>()) if (!RT->getOriginalDecl()->getDeclName().isEmpty()) return true; - } else if (const auto *ET = Ty->getAs<EnumType>()) { - if (!ET->getOriginalDecl()->getDeclName().isEmpty()) - return true; - } return false; } @@ -99,13 +94,12 @@ static bool isValidPreserveEnumValueArg(Expr *Arg) { return false; // The type must be EnumType. - const Type *Ty = ArgType->getUnqualifiedDesugaredType(); - const auto *ET = Ty->getAs<EnumType>(); - if (!ET) + const auto *ED = ArgType->getAsEnumDecl(); + if (!ED) return false; // The enum value must be supported. - return llvm::is_contained(ET->getOriginalDecl()->enumerators(), Enumerator); + return llvm::is_contained(ED->enumerators(), Enumerator); } bool SemaBPF::CheckBPFBuiltinFunctionCall(unsigned BuiltinID, |
