Skip to content

Commit 2a67c28

Browse files
committed
[IR] Update getOrInsertFunction() docs for opaque pointers (NFC)
This can no longer return a bitcast, but the function type in FunctionCallee may differ from the function type of the function.
1 parent 062d78e commit 2a67c28

File tree

1 file changed

+8
-15
lines changed

1 file changed

+8
-15
lines changed

llvm/include/llvm/IR/Module.h

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -385,30 +385,23 @@ class LLVM_EXTERNAL_VISIBILITY Module {
385385
/// @name Function Accessors
386386
/// @{
387387

388-
/// Look up the specified function in the module symbol table. Four
389-
/// possibilities:
390-
/// 1. If it does not exist, add a prototype for the function and return it.
391-
/// 2. Otherwise, if the existing function has the correct prototype, return
392-
/// the existing function.
393-
/// 3. Finally, the function exists but has the wrong prototype: return the
394-
/// function with a constantexpr cast to the right prototype.
388+
/// Look up the specified function in the module symbol table. If it does not
389+
/// exist, add a prototype for the function and return it. Otherwise, return
390+
/// the existing function.
395391
///
396392
/// In all cases, the returned value is a FunctionCallee wrapper around the
397-
/// 'FunctionType *T' passed in, as well as a 'Value*' either of the Function or
398-
/// the bitcast to the function.
393+
/// 'FunctionType *T' passed in, as well as the 'Value*' of the Function. The
394+
/// function type of the function may differ from the function type stored in
395+
/// FunctionCallee if it was previously created with a different type.
399396
///
400397
/// Note: For library calls getOrInsertLibFunc() should be used instead.
401398
FunctionCallee getOrInsertFunction(StringRef Name, FunctionType *T,
402399
AttributeList AttributeList);
403400

404401
FunctionCallee getOrInsertFunction(StringRef Name, FunctionType *T);
405402

406-
/// Look up the specified function in the module symbol table. If it does not
407-
/// exist, add a prototype for the function and return it. This function
408-
/// guarantees to return a constant of pointer to the specified function type
409-
/// or a ConstantExpr BitCast of that type if the named function has a
410-
/// different type. This version of the method takes a list of
411-
/// function arguments, which makes it easier for clients to use.
403+
/// Same as above, but takes a list of function arguments, which makes it
404+
/// easier for clients to use.
412405
template <typename... ArgsTy>
413406
FunctionCallee getOrInsertFunction(StringRef Name,
414407
AttributeList AttributeList, Type *RetTy,

0 commit comments

Comments
 (0)