private Symbol getFirstSymbol(String name, Namespace namespace, Predicate<Symbol> test) {
		if (namespace == null) {
			namespace = namespaceMgr.getGlobalNamespace();
		}

		if (isDeletedNamespace(namespace)) {
			return null;
		}
		checkValidNamespaceArgument(namespace);

		// if name is possible default parameter or local variable name, must do brute force search
		if (namespace instanceof Function &&
			SymbolUtilities.isPossibleDefaultLocalOrParamName(name)) {
			return searchNamespaceForFirstSymbol(name, namespace, test);
		}

		// if the name is a possible default external name, do brute force search
		if (namespace.isExternal() && SymbolUtilities.isPossibleDefaultExternalName(name)) {
			return searchNamespaceForFirstSymbol(name, namespace, test);
		}

		lock.acquire();
		try {
			RecordIterator it = adapter.getSymbolsByNameAndNamespace(name, namespace.getID());
			while (it.hasNext()) {
				SymbolDB symbol = getSymbol(it.next());
				if (test.test(symbol)) {
					return symbol;
				}
			}
			// didn't find one in the database, see if it is a default dynamic name
			Symbol symbol = getSymbolForDynamicName(name);
			if (symbol != null && symbol.getParentNamespace().equals(namespace) &&
				test.test(symbol)) {
				return symbol;
			}
		}
		catch (IOException e) {
			program.dbError(e);
		}
		finally {
			lock.release();
		}
		return null;
	}
Removes the symbol directly

@param sym the symbol to remove.
@return true if the symbol was removed, false otherwise.
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/symbol/SymbolManager.java