r350004 - Improving this fatal diagnostic to help checker developers figure out what's actually gone wrong when they hit it.

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Sat Dec 22 07:31:57 PST 2018


Author: aaronballman
Date: Sat Dec 22 07:31:57 2018
New Revision: 350004

URL: http://llvm.org/viewvc/llvm-project?rev=350004&view=rev
Log:
Improving this fatal diagnostic to help checker developers figure out what's actually gone wrong when they hit it.

Modified:
    cfe/trunk/utils/TableGen/ClangSACheckersEmitter.cpp

Modified: cfe/trunk/utils/TableGen/ClangSACheckersEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/TableGen/ClangSACheckersEmitter.cpp?rev=350004&r1=350003&r2=350004&view=diff
==============================================================================
--- cfe/trunk/utils/TableGen/ClangSACheckersEmitter.cpp (original)
+++ cfe/trunk/utils/TableGen/ClangSACheckersEmitter.cpp Sat Dec 22 07:31:57 2018
@@ -58,7 +58,7 @@ static std::string getStringValue(const
 }
 
 // Calculates the integer value representing the BitsInit object
-static inline uint64_t getValueFromBitsInit(const BitsInit *B) {
+static inline uint64_t getValueFromBitsInit(const BitsInit *B, const Record &R) {
   assert(B->getNumBits() <= sizeof(uint64_t) * 8 && "BitInits' too long!");
 
   uint64_t Value = 0;
@@ -67,7 +67,8 @@ static inline uint64_t getValueFromBitsI
     if (Bit)
       Value |= uint64_t(Bit->getValue()) << i;
     else
-      PrintFatalError("Invalid bits");
+      PrintFatalError(R.getLoc(),
+                      "missing Documentation for " + getCheckerFullName(&R));
   }
   return Value;
 }
@@ -75,7 +76,7 @@ static inline uint64_t getValueFromBitsI
 static std::string getCheckerDocs(const Record &R) {
   StringRef LandingPage;
   if (BitsInit *BI = R.getValueAsBitsInit("Documentation")) {
-    uint64_t V = getValueFromBitsInit(BI);
+    uint64_t V = getValueFromBitsInit(BI, R);
     if (V == 1)
       LandingPage = "available_checks.html";
     else if (V == 2)




More information about the cfe-commits mailing list