r338831 - Fix unused variable warning in tablegen generated code
Karl-Johan Karlsson via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 3 02:13:16 PDT 2018
Author: karka
Date: Fri Aug 3 02:13:15 2018
New Revision: 338831
URL: http://llvm.org/viewvc/llvm-project?rev=338831&view=rev
Log:
Fix unused variable warning in tablegen generated code
Modified:
cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp
Modified: cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp?rev=338831&r1=338830&r2=338831&view=diff
==============================================================================
--- cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp (original)
+++ cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp Fri Aug 3 02:13:15 2018
@@ -3274,11 +3274,15 @@ static std::string GenerateCustomApperta
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";
More information about the cfe-commits
mailing list