-
Notifications
You must be signed in to change notification settings - Fork 11k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[lldb] Prevent false positives with simple template names in SymbolFi…
…leDWARF::FindTypes The provided test case was crashing because of confusion attempting to find types for `ns::Foo` under -gsimple-template-names. (This looks broken normally because it's attempting to find `ns::Foo` rather than `ns::Foo<T>`) Looking up types can't give false positives, as opposed to looking up functions as mentioned in https://reviews.llvm.org/D137098. Reviewed By: Michael137 Differential Revision: https://reviews.llvm.org/D140240
- Loading branch information
Showing
12 changed files
with
109 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
CXX_SOURCES := main.cpp | ||
|
||
include Makefile.rules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
""" | ||
Test that we return only the requested template instantiation. | ||
""" | ||
|
||
import lldb | ||
import lldbsuite.test.lldbutil as lldbutil | ||
from lldbsuite.test.decorators import * | ||
from lldbsuite.test.lldbtest import * | ||
|
||
class UniqueTypesTestCase4(TestBase): | ||
def do_test(self, debug_flags): | ||
"""Test that we display the correct template instantiation.""" | ||
self.build(dictionary=debug_flags) | ||
lldbutil.run_to_source_breakpoint(self, "// Set breakpoint here", lldb.SBFileSpec("main.cpp")) | ||
# FIXME: these should successfully print the values | ||
self.expect("print ns::Foo<double>::value", substrs=["no member named"], error=True) | ||
self.expect("print ns::Foo<int>::value", substrs=["no member named"], error=True) | ||
self.expect("print ns::Bar<double>::value", substrs=["no member named"], error=True) | ||
self.expect("print ns::Bar<int>::value", substrs=["no member named"], error=True) | ||
self.expect("print ns::FooDouble::value", substrs=["Couldn't lookup symbols"], error=True) | ||
self.expect("print ns::FooInt::value", substrs=["Couldn't lookup symbols"], error=True) | ||
|
||
@skipIf(compiler=no_match("clang")) | ||
@skipIf(compiler_version=["<", "15.0"]) | ||
def test_simple_template_names(self): | ||
self.do_test(dict(CFLAGS_EXTRAS="-gsimple-template-names")) | ||
|
||
@skipIf(compiler=no_match("clang")) | ||
@skipIf(compiler_version=["<", "15.0"]) | ||
def test_no_simple_template_names(self): | ||
self.do_test(dict(CFLAGS_EXTRAS="-gno-simple-template-names")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
namespace ns { | ||
|
||
template <typename T> struct Foo { | ||
static T value; | ||
}; | ||
|
||
template <typename T> using Bar = Foo<T>; | ||
|
||
using FooInt = Foo<int>; | ||
using FooDouble = Foo<double>; | ||
|
||
} // namespace ns | ||
|
||
ns::Foo<double> a; | ||
ns::Foo<int> b; | ||
ns::Bar<double> c; | ||
ns::Bar<int> d; | ||
ns::FooInt e; | ||
ns::FooDouble f; | ||
|
||
int main() { | ||
// Set breakpoint here | ||
} |