@Override
	public boolean delete() {
		lock.acquire();
		try {
			boolean restoreLabel = isExternal() || (getSource() != SourceType.DEFAULT);
			String symName = getName();
			Symbol parentSymbol = getParentSymbol();
			String extOrigImportName = null;
			Address extProgramAddr = null;
			if (isExternal()) {
				// preserve external data
				extOrigImportName = getExternalOriginalImportedName();
				extProgramAddr = getExternalProgramAddress();
			}
			Namespace namespace = getParentNamespace();
			SourceType source = getSource();
			boolean pinned = isPinned();
			if (getID() > 0) {
				symbolMgr.removeChildren(this);
			}

			if (!functionMgr.doRemoveFunction(key)) {
				return false;
			}

			if (super.delete()) {
				if ((parentSymbol instanceof SymbolDB) && ((SymbolDB) parentSymbol).isDeleting()) {
					// do not replace function with label if parent namespace is getting removed
					return false;
				}
				if (restoreLabel) {
					// Recreate a symbol with the function symbol's name because deleting the function 
					// does not mean that we want to lose the function name (that is our policy).
					Symbol newSymbol;
					if (isExternal()) {
						newSymbol = symbolMgr.createExternalCodeSymbol(address, symName, namespace,
							source, extOrigImportName, extProgramAddr);
					}
					else {
						newSymbol = symbolMgr.createLabel(address, symName, namespace, source);
						newSymbol.setPrimary();
						if (pinned) {
							newSymbol.setPinned(true);
						}
					}
					if (newSymbol == null && isExternal()) {
						// remove all associated external references if external symbol not restored
						symbolMgr.getReferenceManager().removeAllReferencesTo(getAddress());
					}
				}
				return true;
			}
		}
		catch (InvalidInputException e) {
			// This shouldn't happen.
			Msg.error(this, "Unexpected Exception: " + e.getMessage(), e);
		}
		catch (IOException e) {
			symbolMgr.dbError(e);
		}
		finally {
			lock.release();
		}
		return false;
	}
Construct a new FunctionSymbol
@param symbolMgr the symbol manager.
@param cache symbol object cache
@param address the address for this symbol.
@param record the record for this symbol.
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/symbol/FunctionSymbol.java