r199392 - Fixing a warning that causes the sanitizer build disliked about mixing && and ||. Since this is generated code, the && has been removed from the expression entirely.

Aaron Ballman aaron at aaronballman.com
Thu Jan 16 06:32:04 PST 2014


Author: aaronballman
Date: Thu Jan 16 08:32:03 2014
New Revision: 199392

URL: http://llvm.org/viewvc/llvm-project?rev=199392&view=rev
Log:
Fixing a warning that causes the sanitizer build disliked about mixing && and ||. Since this is generated code, the && has been removed from the expression entirely.

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=199392&r1=199391&r2=199392&view=diff
==============================================================================
--- cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp (original)
+++ cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp Thu Jan 16 08:32:03 2014
@@ -2088,10 +2088,11 @@ static std::string GenerateCustomApperta
   }
 
   OS << "static bool " << FnName << "(const Decl *D) {\n";
-  OS << "  const " << GetSubjectWithSuffix(Base) << " *S = dyn_cast<";
+  OS << "  if (const " << GetSubjectWithSuffix(Base) << " *S = dyn_cast<";
   OS << GetSubjectWithSuffix(Base);
-  OS << ">(D);\n";
-  OS << "  return S && " << Subject.getValueAsString("CheckCode") << ";\n";
+  OS << ">(D))\n";
+  OS << "    return " << Subject.getValueAsString("CheckCode") << ";\n";
+  OS << "  return false;\n";
   OS << "}\n\n";
 
   CustomSubjectSet.insert(FnName);





More information about the cfe-commits mailing list