Skip to content

Commit c9d38b5

Browse files
committed
Linux / cmake: Install the clang resource directory to the expected POSIX path.
HostInfoPosix::ComputeClangDirectory() expects the clang resource directory to be in lib/lldb/clang/$VERSION. This patch fixes the Swift-specific CMake to install it there instead of in lib/lldb/clang/. <rdar://problem/37354542> https://bugs.swift.org/browse/SR-6954 (cherry picked from commit 0f090945431a91eb0a6a89a7c8dd85b0c0d5c1f8) apple-llvm-split-commit: f49060bb6a702a7e94048471caabdb247d63b262 apple-llvm-split-dir: lldb/
1 parent c1f0b24 commit c9d38b5

File tree

5 files changed

+53
-4
lines changed

5 files changed

+53
-4
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
LEVEL = ../../../make
2+
SWIFT_SOURCES := main.swift
3+
include $(LEVEL)/Makefile.rules
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# TestSwiftFoundation.py
2+
#
3+
# This source file is part of the Swift.org open source project
4+
#
5+
# Copyright (c) 2018 Apple Inc. and the Swift project authors
6+
# Licensed under Apache License v2.0 with Runtime Library Exception
7+
#
8+
# See https://swift.org/LICENSE.txt for license information
9+
# See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+
#
11+
# ------------------------------------------------------------------------------
12+
import lldbsuite.test.lldbinline as lldbinline
13+
import lldbsuite.test.decorators as decorators
14+
15+
lldbinline.MakeInlineTest(__file__, globals(), decorators=[])
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// main.swift
2+
//
3+
// This source file is part of the Swift.org open source project
4+
//
5+
// Copyright (c) 2018 Apple Inc. and the Swift project authors
6+
// Licensed under Apache License v2.0 with Runtime Library Exception
7+
//
8+
// See https://swift.org/LICENSE.txt for license information
9+
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+
//
11+
// -----------------------------------------------------------------------------
12+
import Foundation
13+
14+
// Test that importing Foundation and printing a value for which
15+
// no data formatter exists works consistently on all platforms.
16+
func main() {
17+
var point = NSPoint(x: 23, y: 42)
18+
print(point) //% self.expect("frame variable -- point", substrs=['x', '23', 'y', '42'])
19+
//% self.expect("expression -- point", substrs=['x', '23', 'y', '42'])
20+
}
21+
22+
main()

lldb/packages/Python/lldbsuite/test/make/Makefile.rules

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -482,8 +482,16 @@ endif
482482
# Check if we need the Swift/ObjC interop features
483483
#----------------------------------------------------------------------
484484
ifeq "$(SWIFT_OBJC_INTEROP)" "1"
485-
SWIFTFLAGS += -framework Foundation -framework CoreGraphics
486-
LDFLAGS +=-lswiftObjectiveC -lswiftFoundation -framework Foundation -framework CoreGraphics
485+
ifeq "$(OS)" "Darwin"
486+
SWIFTFLAGS += -framework Foundation -framework CoreGraphics
487+
LDFLAGS += -lswiftObjectiveC -lswiftFoundation -framework Foundation -framework CoreGraphics
488+
else
489+
# CFLAGS_EXTRAS is used via "dotest.py -E" to pass the -I and -L paths
490+
# for Foundation and libdispatch on Linux.
491+
SWIFTFLAGS += $(CFLAGS_EXTRAS)
492+
LDFLAGS += $(CFLAGS_EXTRAS)
493+
endif
494+
487495
endif
488496

489497
#----------------------------------------------------------------------

lldb/source/API/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,11 @@ if(NOT LLDB_BUILT_STANDALONE)
170170
set(clang_headers_target symlink_clang_headers)
171171
endif()
172172

173+
# Copy the clang resource directory.
173174
add_custom_command_target(
174175
unused_var
175-
COMMAND "${CMAKE_COMMAND}" "-E" "copy_directory" "${CLANG_RESOURCE_PATH}" "${lib_dir}/lldb/clang"
176-
OUTPUT "${lib_dir}/lldb/clang"
176+
COMMAND "${CMAKE_COMMAND}" "-E" "copy_directory" "${CLANG_RESOURCE_PATH}" "${lib_dir}/lldb/clang/${LLVM_PACKAGE_VERSION}"
177+
OUTPUT "${lib_dir}/lldb/clang/${LLVM_PACKAGE_VERSION}"
177178
VERBATIM
178179
ALL
179180
DEPENDS ${clang_headers_target})

0 commit comments

Comments
 (0)