private void doCreateLabel(Address addr, String label)
			throws DuplicateNameException, InvalidInputException {
		Symbol sym = program.getSymbolTable().getPrimarySymbol(addr);
		if (sym == null) {
			program.getSymbolTable().createLabel(addr, label, SourceType.ANALYSIS);
		}
		else if (sym.getSource() == SourceType.DEFAULT) {
			sym.setName(label, SourceType.ANALYSIS);
		}
		else {
			// do nothing if symbol matches new label otherwise make new label primary
			// but keep the other one around
			if (!sym.toString().equals(label)) {
				Symbol newSym =
					program.getSymbolTable().createLabel(addr, label, SourceType.ANALYSIS);
				newSym.setPrimary();
			}
		}
	}
Creates an analysis (not user defined) type of label with the specified name at the
program's address.
@param addr the address
@param label the name for the label
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/string/MakeStringsTask.java