[llvm] de1e911 - [llvm-debuginfo-analyzer] (05/09) - Select elements
Carlos Alberto Enciso via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 21 11:18:34 PDT 2022
Author: Carlos Alberto Enciso
Date: 2022-10-21T19:16:49+01:00
New Revision: de1e911f02a0b4369287c7d056efc94c3f5dc0cd
URL: https://github.com/llvm/llvm-project/commit/de1e911f02a0b4369287c7d056efc94c3f5dc0cd
DIFF: https://github.com/llvm/llvm-project/commit/de1e911f02a0b4369287c7d056efc94c3f5dc0cd.diff
LOG: [llvm-debuginfo-analyzer] (05/09) - Select elements
The test case 'checkFlexiblePatterns' caused a failure in:
https://lab.llvm.org/buildbot/#/builders/85/builds/11590
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior
runtime error: applying zero offset to null pointer
llvm/lib/Support/regengine.inc:151:18
The logical view is traversed and for each logical element a
series of match criterias are applied. One of those criterias
is to match its name or type name to a given pattern.
If the logical element does not have a type (for instance a
'namespace') do not try to use its type name, which is a
empty string as the 'matcher' function receives a null pointer.
Reviewed By: probinson
Differential Revision: https://reviews.llvm.org/D136444
Added:
Modified:
llvm/include/llvm/DebugInfo/LogicalView/Core/LVOptions.h
llvm/lib/DebugInfo/LogicalView/Core/LVOptions.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/DebugInfo/LogicalView/Core/LVOptions.h b/llvm/include/llvm/DebugInfo/LogicalView/Core/LVOptions.h
index ba8e773e6f8a8..8c495c8bc820f 100644
--- a/llvm/include/llvm/DebugInfo/LogicalView/Core/LVOptions.h
+++ b/llvm/include/llvm/DebugInfo/LogicalView/Core/LVOptions.h
@@ -511,8 +511,8 @@ class LVPatterns final {
void resolveGenericPatternMatch(T *Element, const U &Requests) {
assert(Element && "Element must not be nullptr");
auto CheckPattern = [=]() -> bool {
- return Element->isNamed() &&
- (matchGenericPattern(Element->getName()) ||
+ return (Element->isNamed() && matchGenericPattern(Element->getName())) ||
+ (Element->isTyped() &&
matchGenericPattern(Element->getTypeName()));
};
auto CheckOffset = [=]() -> bool {
diff --git a/llvm/lib/DebugInfo/LogicalView/Core/LVOptions.cpp b/llvm/lib/DebugInfo/LogicalView/Core/LVOptions.cpp
index 2bcc8a6b4c35b..265237ee21dc2 100644
--- a/llvm/lib/DebugInfo/LogicalView/Core/LVOptions.cpp
+++ b/llvm/lib/DebugInfo/LogicalView/Core/LVOptions.cpp
@@ -505,6 +505,9 @@ void LVPatterns::updateReportOptions() {
// Match a general pattern.
bool LVPatterns::matchPattern(StringRef Input, const LVMatchInfo &MatchInfo) {
bool Matched = false;
+ // Do not match an empty 'Input'.
+ if (Input.empty())
+ return Matched;
// Traverse all match specifications.
for (const LVMatch &Match : MatchInfo) {
switch (Match.Mode) {
More information about the llvm-commits
mailing list