[llvm] r237627 - [opaque pointer type] Provide a convenience for IRBuilder::CreateCall that accepts a Function without needing to take an explicit callee Type

David Blaikie dblaikie at gmail.com
Mon May 18 15:46:39 PDT 2015


Yeah, something fun in Clang to look at. Reverted in 237629 while I look
into the issue.

On Mon, May 18, 2015 at 3:39 PM, Reid Kleckner <rnk at google.com> wrote:

> I don't think this one flies:
>
> [1523/1884] Building CXX object
> tools\clang\lib\CodeGen\CMakeFiles\clangCodeGen.dir\CGObjCGNU.cpp.obj
> FAILED: D:\src\llvm\build_stage1\bin\clang-cl.exe   /nologo /DWIN32
> /D_WINDOWS   -wd4146 -wd4180 -wd4244 -wd4258 -wd4267 -wd4291 -wd4345
> -wd4351 -wd4355 -wd4456 -wd4457 -wd4458 -wd4459 -wd4503 -wd4624 -wd4722
> -wd4800 -wd4100 -wd4127 -wd4512 -wd4505 -wd4610 -wd4510 -wd4702 -wd4245
> -wd4706 -wd4310 -wd4701 -wd4703 -wd4389 -wd4611 -wd4805 -wd4204 -wd4324
> -w14062 -we4238 /W4 /MD /O2 /Ob2 -Itools\clang\lib\CodeGen
> -I..\tools\clang\lib\CodeGen -I..\tools\clang\include -Itools\clang\include
> -Iinclude -I..\include    -UNDEBUG /EHs-c- /GR- /showIncludes
> -DCLANG_ENABLE_ARCMT -DCLANG_ENABLE_OBJC_REWRITER
> -DCLANG_ENABLE_STATIC_ANALYZER -DGTEST_HAS_RTTI=0 -DGTEST_HAS_SEH=0
> -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS
> -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_GNU_SOURCE
> -D_HAS_EXCEPTIONS=0 -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS
> -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
> /Fotools\clang\lib\CodeGen\CMakeFiles\clangCodeGen.dir\CGObjCGNU.cpp.obj
> /Fdtools\clang\lib\CodeGen\CMakeFiles\clangCodeGen.dir\ -c
> ..\tools\clang\lib\CodeGen\CGObjCGNU.cpp
>
> ..\tools\clang\lib\CodeGen\CGObjCGNU.cpp(2690,12) :  error: call to member
> function 'CreateCall' is ambiguous
>   return B.CreateCall(WeakReadFn, AddrWeakObj);
>          ~~^~~~~~~~~~
> ..\include\llvm/IR/IRBuilder.h(1465,13) :  note: candidate function
>   CallInst *CreateCall(Value *Callee, ArrayRef<Value *> Args,
>             ^
> ..\include\llvm/IR/IRBuilder.h(1470,13) :  note: candidate function
>   CallInst *CreateCall(Function *Callee, ArrayRef<Value *> Args,
>             ^
>
> On Mon, May 18, 2015 at 3:25 PM, David Blaikie <dblaikie at gmail.com> wrote:
>
>> Author: dblaikie
>> Date: Mon May 18 17:25:14 2015
>> New Revision: 237627
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=237627&view=rev
>> Log:
>> [opaque pointer type] Provide a convenience for IRBuilder::CreateCall
>> that accepts a Function without needing to take an explicit callee Type
>>
>> The common case is a direct call, so don't make all those users have to
>> explicitly pass the result of llvm::Function::getFunctionType.
>>
>> Modified:
>>     llvm/trunk/include/llvm/IR/IRBuilder.h
>>
>> Modified: llvm/trunk/include/llvm/IR/IRBuilder.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/IRBuilder.h?rev=237627&r1=237626&r2=237627&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/include/llvm/IR/IRBuilder.h (original)
>> +++ llvm/trunk/include/llvm/IR/IRBuilder.h Mon May 18 17:25:14 2015
>> @@ -21,6 +21,7 @@
>>  #include "llvm/IR/BasicBlock.h"
>>  #include "llvm/IR/ConstantFolder.h"
>>  #include "llvm/IR/DataLayout.h"
>> +#include "llvm/IR/Function.h"
>>  #include "llvm/IR/GlobalVariable.h"
>>  #include "llvm/IR/Instructions.h"
>>  #include "llvm/IR/LLVMContext.h"
>> @@ -1466,6 +1467,12 @@ public:
>>      return Insert(CallInst::Create(Callee, Args), Name);
>>    }
>>
>> +  CallInst *CreateCall(Function *Callee, ArrayRef<Value *> Args,
>> +                       const Twine &Name = "") {
>> +    return Insert(CallInst::Create(Callee->getFunctionType(), Callee,
>> Args),
>> +                  Name);
>> +  }
>> +
>>    Value *CreateSelect(Value *C, Value *True, Value *False,
>>                        const Twine &Name = "") {
>>      if (Constant *CC = dyn_cast<Constant>(C))
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150518/c4e1d003/attachment.html>


More information about the llvm-commits mailing list