aaron.ballman added inline comments.
================ Comment at: include/clang/Basic/Attr.td:896 let AdditionalMembers = [{ - IdentifierInfo *getCPUName(unsigned Index) const { - return *(cpus_begin() + Index); + // gets the ordinal of the requested CPU name, or 0 if it isn't in the cpu + // list. ---------------- gets -> Gets ================ Comment at: include/clang/Basic/Attr.td:901 + for (const IdentifierInfo *II : cpus()) { + if (II->getName() == Name) + return Ord; ---------------- `if (II->isStr(Name))` ================ Comment at: include/clang/Basic/Attr.td:908 + + IdentifierInfo *getCPUName(unsigned Ordinal) const { + assert(Ordinal > 0 && "Invalid Ordinal"); ---------------- Can this return a `const IdentifierInfo *` instead? ================ Comment at: lib/CodeGen/CodeGenModule.cpp:2141 + if (Global->hasAttr<CPUSpecificAttr>() && GD.getMultiVersionOrdinal() == 0) { + auto *Spec = Global->getAttr<CPUSpecificAttr>(); + for (unsigned I = 1; I <= Spec->cpus_size(); ++I) ---------------- Rather than use `hasAttr<>` followed by `getAttr<>`, just get the attribute and test it for null. Also, `const auto *`. ================ Comment at: lib/CodeGen/CodeGenModule.cpp:2442 // Requires multiple emits. + auto *Spec = FD->getAttr<CPUSpecificAttr>(); + for (unsigned I = 1; I <= Spec->cpus_size(); ++I) ---------------- `const auto *` ================ Comment at: lib/CodeGen/CodeGenModule.cpp:2562 + for (GlobalDecl GD : MultiVersionFuncs) { + const FunctionDecl *FD = cast<FunctionDecl>(GD.getDecl()); + assert(FD && FD->isMultiVersion() && "Not a multiversion function?"); ---------------- `const auto *` ================ Comment at: lib/CodeGen/CodeGenModule.cpp:2584 + llvm::Type *&DeclTy) { + const FunctionDecl *FD = cast<FunctionDecl>(GD.getDecl()); QualType CanonTy = Context.getCanonicalType(FD->getType()); ---------------- `const auto *` ================ Comment at: lib/CodeGen/CodeGenModule.cpp:2612 const TargetInfo &Target = getTarget(); - unsigned Index = 0; + const FunctionDecl *FD = cast<FunctionDecl>(GD.getDecl()); + assert(FD->isCPUDispatchMultiVersion() && ---------------- `const auto *` CHANGES SINCE LAST ACTION https://reviews.llvm.org/D55527/new/ https://reviews.llvm.org/D55527 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits