Compiler error with no line number - ios

Whwn trying to compile my project, the following error appears in AppCode (Xcode only prints the "Error: Command... part"):
AppCode:
Note:Stored value type does not match pointer operand type!
Note: store %CSo7UIColor* %135, %objc_object** %136, align 8, !dbg !4686
Error: %objc_object*LLVM ERROR: Broken function found, compilation aborted!
Error:Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1
Is there a way to actually get the line number causing the problem ? Note says something related to UIColor but that's the only thing I got from it :S
P.S: I have deleted Derived Data, checked out a previous commit, created a new project and still the same issue. I'm almost certain that the problem is due to a dependency.

Found the problem...
self.navigationController!.navigationBar.titleTextAttributes = [ NSForegroundColorAttributeName : .clearColor()]
.clearColor() should work...Fixed it by appending UIColor back.

Related

XCode : Cannot print object in console when debuging

Without any reason, Xcode show an error when i whan ton print using the debuger console :
(lldb) po self
warning: Swift error in scratch context: error: failed to load module 'XXX'
.
Shared Swift state for XXX.app has developed fatal errors and is being discarded.
REPL definitions and persistent names/types will be lost.
error: expression failed to parse:
unknown error
It's an iOS project with cocoapods. I'm on an M1 pro chip.
Any idea ?
I would start with simply print(self) instruction and check what appears in the console.
I like also debug(self) function (prints the whole object hierarchy).
If you want to print thread, you can use Thread.callStackSymbols.forEach { print($0) }
Have you tried set a breakpoint and then browse the Variable List (left side of the Debug Area)?

Xcode Console "po" error: expression failed to parse

My Xcode cannot po anything suddenly, such as:
po param
error: expression failed to parse:
error: Couldn't realize type of self.
Everytime I use "po" to print something in console, it will show the errors above. It happens one month ago.
I know this does not fix the problem, but meanwhile you can use v param to achieve the expected result.
https://stackoverflow.com/a/60064468/2347811
well, you could click right button and choose "print..." at console.

Xcode po is not printing output in debugging area

Xcode is not giving expected results when i try to print any object. I am using Xcode 12.4 .. In another mac its working fine.
Ex: When i try to print the text inside the UITextField getting below
error
(lldb) po emailTextField.text
expression produced error: error:
/var/folders/5q/9vj8df5s0xs_2splf1fbwgzh0000gn/T/expr39-7ad9b9..swift:1:51:
error: cannot specialize a non-generic definition
Swift._DebuggerSupport.stringForPrintObject(Swift.UnsafePointer<Swift.Optional<Swift.String>>(bitPattern:
0x10ba5a660)!.pointee)
^
/var/folders/5q/9vj8df5s0xs_2splf1fbwgzh0000gn/T/expr39-7ad9b9..swift:1:64:
note: while parsing this '<' as a type parameter bracket
Swift._DebuggerSupport.stringForPrintObject(Swift.UnsafePointer<Swift.Optional<Swift.String>>(bitPattern:
0x10ba5a660)!.pointee)
^
(lldb)
I have tried all the options given in the App Dev answers and tried changing the xcode, still no luck
Spammers stay and Don't spam with your unrelated answers

Clunky lldb error while printing variables in XCode's debugger console

Lately I've got problem to print any kind of variable into XCode's debugger console. It doesn't matter which platform I'm building against. I've tried to reinstall whole XCode, command line tools + cleaned/removed the derived data of swift project I'm working on. None of these steps solved my issue, this error prevent me from using XCode for 100%.
Everytime I'm trying to print something I've got this error in debug console.
Printing description of X:
expression produced error: /var/folders/4y/mm1fk7rn5c57ct91syb3ndf40000gn/T/lldb/6651/expr11.swift:1:1:
error: cannot convert value of type 'Int' to expected argument type 'random type'
$__lldb__DumpForDebugger(Swift.UnsafePointer<Swift.Bool>(bitPattern: 0x104c5ced0).memory)
^~~~~~~~~~~~~~~~~~~~~~~~
<EXPR>:18:7: error: cannot convert value of type 'Int' to expected argument type 'random type'
if (1==1) {
where random type can be any type of class/type.
Have anybody came across the same problem lately? Seems like lldb is bit broken when it comes down to print values of swift variables.
I'm using XCode 7.3.1 (7D1014) with latest update of Mac OS X.

LLVM ERROR: Broken function found, compilation aborted

Here are couple of simple lines in swift:
let umAB: Unmanaged<ABAddressBookRef> = ABAddressBookCreate()
let ab: ABAddressBookRef = umAB.takeRetainedValue()
The second line breaks code compilation, here's the error that I get:
Bitcast requires both operands to be pointer or neither
%27 = bitcast %objc_object* %26 to %PSs9AnyObject_, !dbg !170
LLVM ERROR: Broken function found, compilation aborted!
Command /Applications/Xcode6-Beta2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift failed with exit code 1
Any ideas what's wrong with the second line?
This is late, but the answer is simple: This is a bug in the compiler. LLVM ERROR implies that bad LLVM IR has been generated, and that is a bug in the calling program.

Resources