Skip to content

Commit

Permalink
Adding test to cover the correct import of SourceLocation pertaining …
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
shafik committed Mar 6, 2019
1 parent 9c005bb commit 641d0b8
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
@@ -0,0 +1,6 @@
LEVEL = ../../make

OBJC_SOURCES := main.m

include $(LEVEL)/Makefile.rules
LDFLAGS += -framework Cocoa
@@ -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'])
@@ -0,0 +1,6 @@
#import <Cocoa/Cocoa.h>

int main(int argc, const char * argv[]) {

return 0; // break here
}

0 comments on commit 641d0b8

Please sign in to comment.