Sarcasm / irony-mode

A C/C++ minor mode for Emacs powered by libclang
GNU General Public License v3.0
906 stars 99 forks source link

No irony completion for cuda .cu files #497

Open marty0801 opened 6 years ago

marty0801 commented 6 years ago

I have a C++/cuda project. My /src directory contains both .cpp and .cu files. Irony-company apparently works fine for the .cpp files, but produces the following error when invoking company-complete-common in any .cu file: irony-server-error complete-error "failed to perform code completion"

My hypothesis is that irony-company is somehow unable to use the cuda compiler, nvcc. My cmake build produces a compile_commands.json. Here is an excerpt

{
  "directory": "/home/ubuntu/proj/geo/cuda/xcorr2d/build",
  "command": "/usr/local/cuda/bin/nvcc   -I/usr/local/cuda/include    -x cu -c /home/ubuntu/proj/geo/cuda/xcorr2d/src/xcorr_utils.cu -o CMakeFiles/test.dir/xcorr_utils.cu.o",
  "file": "/home/ubuntu/proj/geo/cuda/xcorr2d/src/xcorr_utils.cu"
},
{
  "directory": "/home/ubuntu/proj/geo/cuda/xcorr2d/build",
  "command": "/usr/bin/c++   -I/usr/local/cuda/include    -std=gnu++11 -o CMakeFiles/test.dir/DeviceArray.cpp.o -c /home/ubuntu/proj/geo/cuda/xcorr2d/src/DeviceArray.cpp",
  "file": "/home/ubuntu/proj/geo/cuda/xcorr2d/src/DeviceArray.cpp"
},

Here is the output of the emacs debugger:


Debugger entered--Lisp error: (irony-server-error complete-error "failed to perform code completion" "/home/ubuntu/proj/geo/cuda/xcorr2d/src/xcorr2d.cu" 74 7)                                              
  signal(irony-server-error (complete-error "failed to perform code completion" "/home/ubuntu/proj/geo/cuda/xcorr2d/src/xcorr2d.cu" 74 7))                                                                  
  irony-iotask-result-get([cl-struct-irony-iotask-result error nil irony-server-error (complete-error "failed to perform code completion" "/home/ubuntu/proj/geo/cuda/xcorr2d/src/xcorr2d.cu" 74 7)])       
  #[257 "\300\301\302^C!!!\207" [#[257 "\300\301^B!!\207" [#[257 "\300\305\303\300\242\"\240\210\302\304^B!\240\210\301 \207" [((...)) #[0 "\303\242?\205^M^@\301\300\302\242\237!!\207" [#[257 "\300\301^B$
  byte-code("r^Hq\210   \304H\n>\204^R^@\305\306\307\310#\210   \311H^K!)\207" [cb-buffer ectx cl-struct-irony-iotask-ectx-tags result 0 error "%s accessing a non-%s" irony-iotask-ectx-callback irony-iot$
  irony-iotask-ectx-call-callback([cl-struct-irony-iotask-ectx t [cl-struct-irony-iotask-packaged-task (:start (lambda (file line column compile-options) (apply (function irony--server-send-command) "com$
  irony-iotask--check-result(#<process Irony>)                                                                                                                                                              
  irony-iotask-process-filter(#<process Irony> "(error . (complete-error \"failed to perform code completion\" \"/home/ubuntu/proj/geo/cuda/xcorr2d/src/xcorr2d.cu\" 74 7))\n\n;;EOT\n")                    
  sleep-for(0.03)                                                                                                                                                                                           
  company--force-sync(company-call-backend-raw (candidates "") (company-irony company-gtags))                                                                                                               
  company-call-backend(candidates "")                                                                                                                                                                       
  company--fetch-candidates("")                                                                                                                                                                             
  company-calculate-candidates("")                                                                                                                                                                          
  #[0 "\n\203   ^@\nC\202\n^@^K\211\205\212^@\211@\300^A9\204^\^@\306^B!\203+^@\307^B!\205/^@^A^Z\310\311!)\202/^@\312^B\311\"\240\210\300\242\203\203^@\313\300\242!\203}^@\314\300\242!^T\211^R\301\315\f$
  funcall(#[0 "\n\203   ^@\nC\202\n^@^K\211\205\212^@\211@\300^A9\204^\^@\306^B!\203+^@\307^B!\205/^@^A^Z\310\311!)\202/^@\312^B\311\"\240\210\300\242\203\203^@\313\300\242!\203}^@\314\300\242!^T\211^R\3$
  company--begin-new()                                                                                                                                                                                      
  company--perform()                                                                                                                                                                                        
  #[0 "\301 \210^H\207" [company-candidates company--perform] 1 "\n\n(fn)"]()                                                                                                                               
  funcall(#[0 "\301 \210^H\207" [company-candidates company--perform] 1 "\n\n(fn)"])                                                                                                                        
  company-auto-begin()                                                                                                                                                                                      
  company-manual-begin()                                                                                                                                                                                    
  company-complete-common()                                                                                                                                                                                 
  call-interactively(company-complete-common nil nil)                                                                                                                                                       
  command-execute(company-complete-common)