summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python
diff options
context:
space:
mode:
authorShafik Yaghmour <syaghmour@apple.com>2019-03-06 18:03:54 +0000
committerShafik Yaghmour <syaghmour@apple.com>2019-03-06 18:03:54 +0000
commit641d0b8cee4529ed2dca697cb76de6ce4d800871 (patch)
tree1852d2ec57a0d5dc8e63475378c963f1457f7b7a /lldb/packages/Python
parent9c005bbdd4db8e0395c34211d3b1adf77bc0e9ee (diff)
downloadbcm5719-llvm-641d0b8cee4529ed2dca697cb76de6ce4d800871.tar.gz
bcm5719-llvm-641d0b8cee4529ed2dca697cb76de6ce4d800871.zip
Adding test to cover the correct import of SourceLocation pertaining to a built-in during expression parsing
Summary: This tests a fix in the ASTImpoter.cpp to ensure that we import built-in correctly, see differential: https://reviews.llvm.org/D58743 Once this change is merged this test should pass and should catch regressions in this feature. Differential Revision: https://reviews.llvm.org/D58790 llvm-svn: 355525
Diffstat (limited to 'lldb/packages/Python')
-rw-r--r--lldb/packages/Python/lldbsuite/test/expression_command/import_builtin_fileid/Makefile6
-rw-r--r--lldb/packages/Python/lldbsuite/test/expression_command/import_builtin_fileid/TestImportBuiltinFileID.py27
-rw-r--r--lldb/packages/Python/lldbsuite/test/expression_command/import_builtin_fileid/main.m6
3 files changed, 39 insertions, 0 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/expression_command/import_builtin_fileid/Makefile b/lldb/packages/Python/lldbsuite/test/expression_command/import_builtin_fileid/Makefile
new file mode 100644
index 00000000000..4464e2ee9f5
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/expression_command/import_builtin_fileid/Makefile
@@ -0,0 +1,6 @@
+LEVEL = ../../make
+
+OBJC_SOURCES := main.m
+
+include $(LEVEL)/Makefile.rules
+LDFLAGS += -framework Cocoa
diff --git a/lldb/packages/Python/lldbsuite/test/expression_command/import_builtin_fileid/TestImportBuiltinFileID.py b/lldb/packages/Python/lldbsuite/test/expression_command/import_builtin_fileid/TestImportBuiltinFileID.py
new file mode 100644
index 00000000000..08b6a8c90f5
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/expression_command/import_builtin_fileid/TestImportBuiltinFileID.py
@@ -0,0 +1,27 @@
+"""
+They may be cases where an expression will import SourceLocation and if the
+SourceLocation ends up with a FileID that is a built-in we need to copy that
+buffer over correctly.
+"""
+
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+class TestImportBuiltinFileID(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ @skipUnlessDarwin
+ @skipIfDarwinEmbedded
+ @add_test_categories(["gmodules"])
+ def test_import_builtin_fileid(self):
+ self.build()
+
+ lldbutil.run_to_source_breakpoint(self, '// break here',
+ lldb.SBFileSpec("main.m", False))
+
+ self.expect("expr int (*DBG_CGImageGetRenderingIntent)(void *) = ((int (*)(void *))CGImageGetRenderingIntent); DBG_CGImageGetRenderingIntent((void *)0x00000000000000);",
+ substrs=['$0 = 0'])
diff --git a/lldb/packages/Python/lldbsuite/test/expression_command/import_builtin_fileid/main.m b/lldb/packages/Python/lldbsuite/test/expression_command/import_builtin_fileid/main.m
new file mode 100644
index 00000000000..ef74940b0ac
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/expression_command/import_builtin_fileid/main.m
@@ -0,0 +1,6 @@
+#import <Cocoa/Cocoa.h>
+
+int main(int argc, const char * argv[]) {
+
+ return 0; // break here
+}
OpenPOWER on IntegriCloud