Improving this fatal diagnostic to help checker developers figure out what's actually...
authorAaron Ballman <aaron@aaronballman.com>
Sat, 22 Dec 2018 15:31:57 +0000 (15:31 +0000)
committerAaron Ballman <aaron@aaronballman.com>
Sat, 22 Dec 2018 15:31:57 +0000 (15:31 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@350004 91177308-0d34-0410-b5e6-96231b3b80d8

utils/TableGen/ClangSACheckersEmitter.cpp

index 453dfe564bf150bd03c91d9bb6d18918a19a8466..57850a438720ef09e1903066934a594bfd34f6d1 100644 (file)
@@ -58,7 +58,7 @@ static std::string getStringValue(const Record &R, StringRef field) {
 }
 
 // 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 getValueFromBitsInit(const BitsInit *B) {
     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 getValueFromBitsInit(const BitsInit *B) {
 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)