Fix unused variable warning in tablegen generated code

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@338831 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Karl-Johan Karlsson 2018-08-03 09:13:15 +00:00
parent 3500aae383
commit bf40a7d591
1 changed files with 8 additions and 4 deletions

View File

@ -3274,11 +3274,15 @@ static std::string GenerateCustomAppertainsTo(const Record &Subject,
return "";
}
const StringRef CheckCodeValue = Subject.getValueAsString("CheckCode");
OS << "static bool " << FnName << "(const Decl *D) {\n";
OS << " if (const auto *S = dyn_cast<";
OS << GetSubjectWithSuffix(Base);
OS << ">(D))\n";
OS << " return " << Subject.getValueAsString("CheckCode") << ";\n";
if (CheckCodeValue != "false") {
OS << " if (const auto *S = dyn_cast<";
OS << GetSubjectWithSuffix(Base);
OS << ">(D))\n";
OS << " return " << Subject.getValueAsString("CheckCode") << ";\n";
}
OS << " return false;\n";
OS << "}\n\n";