[Lldb-commits] [lldb] 69d2b67 - [lldb] Remove checks behind LLDB_CONFIGURATION_DEBUG from TypeSystemClang
Raphael Isemann via lldb-commits
lldb-commits at lists.llvm.org
Mon Mar 2 10:58:23 PST 2020
Author: Raphael Isemann
Date: 2020-03-02T10:57:56-08:00
New Revision: 69d2b675562cfce71882023874b6aead94107f97
URL: https://github.com/llvm/llvm-project/commit/69d2b675562cfce71882023874b6aead94107f97
DIFF: https://github.com/llvm/llvm-project/commit/69d2b675562cfce71882023874b6aead94107f97.diff
LOG: [lldb] Remove checks behind LLDB_CONFIGURATION_DEBUG from TypeSystemClang
Summary:
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).
Reviewers: aprantl
Reviewed By: aprantl
Subscribers: shafik, abidh, JDevlieghere, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D75330
Added:
Modified:
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
Removed:
################################################################################
diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index 845318471fa1..ffcab238d09d 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -84,12 +84,14 @@ using llvm::StringSwitch;
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 @@ ClassTemplateDecl *TypeSystemClang::CreateClassTemplateDecl(
decl_ctx->addDecl(class_template_decl);
-#ifdef LLDB_CONFIGURATION_DEBUG
VerifyDecl(class_template_decl);
-#endif
}
return class_template_decl;
@@ -1687,9 +1687,7 @@ NamespaceDecl *TypeSystemClang::GetUniqueNamespaceDeclaration(
}
}
}
-#ifdef LLDB_CONFIGURATION_DEBUG
VerifyDecl(namespace_decl);
-#endif
return namespace_decl;
}
@@ -1892,9 +1890,7 @@ FunctionDecl *TypeSystemClang::CreateFunctionDeclaration(
if (func_decl)
decl_ctx->addDecl(func_decl);
-#ifdef LLDB_CONFIGURATION_DEBUG
VerifyDecl(func_decl);
-#endif
return func_decl;
}
@@ -6937,9 +6933,7 @@ clang::FieldDecl *TypeSystemClang::AddFieldToRecordType(
record_decl->addDecl(field);
-#ifdef LLDB_CONFIGURATION_DEBUG
VerifyDecl(field);
-#endif
}
} else {
clang::ObjCInterfaceDecl *class_interface_decl =
@@ -6962,9 +6956,7 @@ clang::FieldDecl *TypeSystemClang::AddFieldToRecordType(
if (field) {
class_interface_decl->addDecl(field);
-#ifdef LLDB_CONFIGURATION_DEBUG
VerifyDecl(field);
-#endif
}
}
}
@@ -7128,9 +7120,7 @@ clang::VarDecl *TypeSystemClang::AddVariableToRecordType(
TypeSystemClang::ConvertAccessTypeToAccessSpecifier(access));
record_decl->addDecl(var_decl);
-#ifdef LLDB_CONFIGURATION_DEBUG
VerifyDecl(var_decl);
-#endif
return var_decl;
}
@@ -7310,9 +7300,7 @@ clang::CXXMethodDecl *TypeSystemClang::AddMethodToCXXRecordType(
}
}
-#ifdef LLDB_CONFIGURATION_DEBUG
VerifyDecl(cxx_method_decl);
-#endif
return cxx_method_decl;
}
@@ -7704,9 +7692,7 @@ clang::ObjCMethodDecl *TypeSystemClang::AddMethodToObjCObjectType(
class_interface_decl->addDecl(objc_method_decl);
-#ifdef LLDB_CONFIGURATION_DEBUG
VerifyDecl(objc_method_decl);
-#endif
return objc_method_decl;
}
@@ -7904,10 +7890,7 @@ clang::EnumConstantDecl *TypeSystemClang::AddEnumerationValueToEnumerationType(
enutype->getDecl()->addDecl(enumerator_decl);
-#ifdef LLDB_CONFIGURATION_DEBUG
VerifyDecl(enumerator_decl);
-#endif
-
return enumerator_decl;
}
More information about the lldb-commits
mailing list