teemperor created this revision.
teemperor added a reviewer: aprantl.
Herald added subscribers: lldb-commits, JDevlieghere, abidh.
Herald added a project: LLDB.
This function is (supposed) to be a list of asserts that just do a generic
sanity check
on declarations we return. Right now this function is hidden behind the
LLDB_CONFIGURATION_DEBUG macro which means it will *only* be run in
debug builds (but not Release+assert builds and so on).
As we have not a single CI running in Debug build, failures in VerifyDecl are
hidden
from us until someone by accident executes the tests in Debug mode on their own
machine.
This patch removes the `ifdef`'s for LLDB_CONFIGURATION_DEBUG and puts
the `getAccess()` call in `VerifyDecl` behind a `#ifndef NDEBUG` to make sure
that this function is just an empty function with internal linkage when NDEBUG
is defined (so compilers should just optimize away the calls to it).
Repository:
rLLDB LLDB
https://reviews.llvm.org/D75330
Files:
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
Index: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
===================================================================
--- lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -84,12 +84,14 @@
LLDB_PLUGIN_DEFINE(TypeSystemClang)
namespace {
-#ifdef LLDB_CONFIGURATION_DEBUG
static void VerifyDecl(clang::Decl *decl) {
assert(decl && "VerifyDecl called with nullptr?");
+#ifndef NDEBUG
+ // We don't care about the actual access value here but only want to trigger
+ // that Clang calls its internal Decl::AccessDeclContextSanity check.
decl->getAccess();
-}
#endif
+}
static inline bool
TypeSystemClangSupportsLanguage(lldb::LanguageType language) {
@@ -1415,9 +1417,7 @@
decl_ctx->addDecl(class_template_decl);
-#ifdef LLDB_CONFIGURATION_DEBUG
VerifyDecl(class_template_decl);
-#endif
}
return class_template_decl;
@@ -1687,9 +1687,7 @@
}
}
}
-#ifdef LLDB_CONFIGURATION_DEBUG
VerifyDecl(namespace_decl);
-#endif
return namespace_decl;
}
@@ -1892,9 +1890,7 @@
if (func_decl)
decl_ctx->addDecl(func_decl);
-#ifdef LLDB_CONFIGURATION_DEBUG
VerifyDecl(func_decl);
-#endif
return func_decl;
}
@@ -6937,9 +6933,7 @@
record_decl->addDecl(field);
-#ifdef LLDB_CONFIGURATION_DEBUG
VerifyDecl(field);
-#endif
}
} else {
clang::ObjCInterfaceDecl *class_interface_decl =
@@ -6962,9 +6956,7 @@
if (field) {
class_interface_decl->addDecl(field);
-#ifdef LLDB_CONFIGURATION_DEBUG
VerifyDecl(field);
-#endif
}
}
}
@@ -7128,9 +7120,7 @@
TypeSystemClang::ConvertAccessTypeToAccessSpecifier(access));
record_decl->addDecl(var_decl);
-#ifdef LLDB_CONFIGURATION_DEBUG
VerifyDecl(var_decl);
-#endif
return var_decl;
}
@@ -7310,9 +7300,7 @@
}
}
-#ifdef LLDB_CONFIGURATION_DEBUG
VerifyDecl(cxx_method_decl);
-#endif
return cxx_method_decl;
}
@@ -7704,9 +7692,7 @@
class_interface_decl->addDecl(objc_method_decl);
-#ifdef LLDB_CONFIGURATION_DEBUG
VerifyDecl(objc_method_decl);
-#endif
return objc_method_decl;
}
@@ -7904,10 +7890,7 @@
enutype->getDecl()->addDecl(enumerator_decl);
-#ifdef LLDB_CONFIGURATION_DEBUG
VerifyDecl(enumerator_decl);
-#endif
-
return enumerator_decl;
}
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits