-
Notifications
You must be signed in to change notification settings - Fork 11.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Clang][TableGen] Change SACheckersEmitter to use const Record * #110596
Conversation
@llvm/pr-subscribers-clang Author: Rahul Joshi (jurahul) ChangesThis is a part of effort to have better const correctness in TableGen backends: Full diff: https://github.com/llvm/llvm-project/pull/110596.diff 1 Files Affected:
diff --git a/clang/utils/TableGen/ClangSACheckersEmitter.cpp b/clang/utils/TableGen/ClangSACheckersEmitter.cpp
index 998c5ed2079d71..bebdcac3212613 100644
--- a/clang/utils/TableGen/ClangSACheckersEmitter.cpp
+++ b/clang/utils/TableGen/ClangSACheckersEmitter.cpp
@@ -229,9 +229,8 @@ void clang::EmitClangSACheckers(const RecordKeeper &Records, raw_ostream &OS) {
if (Package->isValueUnset("PackageOptions"))
continue;
- std::vector<Record *> PackageOptions = Package
- ->getValueAsListOfDefs("PackageOptions");
- for (Record *PackageOpt : PackageOptions) {
+ for (const Record *PackageOpt :
+ Package->getValueAsListOfDefs("PackageOptions")) {
OS << "PACKAGE_OPTION(";
printOption(OS, getPackageFullName(Package), *PackageOpt);
OS << ")\n";
@@ -325,13 +324,11 @@ void clang::EmitClangSACheckers(const RecordKeeper &Records, raw_ostream &OS) {
OS << "\n"
"#ifdef GET_CHECKER_OPTIONS\n";
for (const Record *Checker : checkers) {
-
if (Checker->isValueUnset("CheckerOptions"))
continue;
- std::vector<Record *> CheckerOptions = Checker
- ->getValueAsListOfDefs("CheckerOptions");
- for (Record *CheckerOpt : CheckerOptions) {
+ for (const Record *CheckerOpt :
+ Checker->getValueAsListOfDefs("CheckerOptions")) {
OS << "CHECKER_OPTION(";
printOption(OS, getCheckerFullName(Checker), *CheckerOpt);
OS << ")\n";
|
@kazutakahirata would appreciate if you can look at this smaller one as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks!
…m#110596) This is a part of effort to have better const correctness in TableGen backends: https://discourse.llvm.org/t/psa-planned-changes-to-tablegen-getallderiveddefinitions-api-potential-downstream-breakages/81089
…m#110596) This is a part of effort to have better const correctness in TableGen backends: https://discourse.llvm.org/t/psa-planned-changes-to-tablegen-getallderiveddefinitions-api-potential-downstream-breakages/81089
…m#110596) This is a part of effort to have better const correctness in TableGen backends: https://discourse.llvm.org/t/psa-planned-changes-to-tablegen-getallderiveddefinitions-api-potential-downstream-breakages/81089
…m#110596) This is a part of effort to have better const correctness in TableGen backends: https://discourse.llvm.org/t/psa-planned-changes-to-tablegen-getallderiveddefinitions-api-potential-downstream-breakages/81089
This is a part of effort to have better const correctness in TableGen backends:
https://discourse.llvm.org/t/psa-planned-changes-to-tablegen-getallderiveddefinitions-api-potential-downstream-breakages/81089