Skip to content

[Clang][TableGen] Use const pointers for various Init * pointers in SA checker emitter #112321

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

Merged
merged 1 commit into from
Oct 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions clang/utils/TableGen/ClangSACheckersEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ static std::string getPackageFullName(const Record *R, StringRef Sep = ".");
static std::string getParentPackageFullName(const Record *R,
StringRef Sep = ".") {
std::string name;
if (DefInit *DI = dyn_cast<DefInit>(R->getValueInit("ParentPackage")))
if (const DefInit *DI = dyn_cast<DefInit>(R->getValueInit("ParentPackage")))
name = getPackageFullName(DI->getDef(), Sep);
return name;
}
Expand All @@ -53,7 +53,7 @@ static std::string getCheckerFullName(const Record *R, StringRef Sep = ".") {
}

static std::string getStringValue(const Record &R, StringRef field) {
if (StringInit *SI = dyn_cast<StringInit>(R.getValueInit(field)))
if (const StringInit *SI = dyn_cast<StringInit>(R.getValueInit(field)))
return std::string(SI->getValue());
return std::string();
}
Expand Down Expand Up @@ -94,7 +94,7 @@ static std::string getCheckerDocs(const Record &R) {
/// the class itself has to be modified for adding a new option type in
/// CheckerBase.td.
static std::string getCheckerOptionType(const Record &R) {
if (BitsInit *BI = R.getValueAsBitsInit("Type")) {
if (const BitsInit *BI = R.getValueAsBitsInit("Type")) {
switch(getValueFromBitsInit(BI, R)) {
case 0:
return "int";
Expand All @@ -111,7 +111,7 @@ static std::string getCheckerOptionType(const Record &R) {
}

static std::string getDevelopmentStage(const Record &R) {
if (BitsInit *BI = R.getValueAsBitsInit("DevelopmentStage")) {
if (const BitsInit *BI = R.getValueAsBitsInit("DevelopmentStage")) {
switch(getValueFromBitsInit(BI, R)) {
case 0:
return "alpha";
Expand All @@ -131,7 +131,7 @@ static bool isHidden(const Record *R) {
return true;

// Not declared as hidden, check the parent package if it is hidden.
if (DefInit *DI = dyn_cast<DefInit>(R->getValueInit("ParentPackage")))
if (const DefInit *DI = dyn_cast<DefInit>(R->getValueInit("ParentPackage")))
return isHidden(DI->getDef());

return false;
Expand Down
Loading