private String validateCallingConvention(Program program, Function function,
			DemanglerOptions options) {

		if (!options.applyCallingConvention()) {
			return null;
		}

		if (callingConvention == null) {
			return null;
		}

		if (program.getCompilerSpec().getCallingConvention(callingConvention) == null) {
			// warn that calling convention not found.  Datatypes are still good,
			// the real calling convention can be figured out later
			//   For example X64 can have __cdecl, __fastcall, __stdcall, that
			//   are accepted but ignored
			BookmarkManager bm = program.getBookmarkManager();
			Address entry = function.getEntryPoint();
			bm.setBookmark(entry, BookmarkType.ANALYSIS, "Demangler",
				"Could not apply calling convention \"" + callingConvention +
					"\" not defined in Compiler Spec (.cspec)");
			return null;
		}

		return callingConvention;
	}
Determine if existing thunk relationship should be preserved and mangled symbol
discarded.  This is the case when the thunk function mangled name matches
the thunked function since we want to avoid duplicate symbol names.
@param thunkFunction thunk function with a mangled symbol which is currently
being demangled.
@return true if thunk should be preserved and mangled symbol discarded, otherwise
false if thunk relationship should be eliminated and demangled function information
should be applied as normal.
Ghidra/Features/Base/src/main/java/ghidra/app/util/demangler/DemangledFunction.java