[PATCH] D42966: Fix USR generation in the presence of #line directives or linemarkes

Mikhail Ramalho via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 6 07:29:42 PST 2018


mikhail.ramalho created this revision.
mikhail.ramalho added reviewers: arphaman, rsmith.
Herald added a subscriber: cfe-commits.

Small change on how the USRGen code prints the location.

The patch fixes an issue when there are #line directives or linemarkes in the file, e.g.:

  #line 3
  int Func(int arg);
  
  #line 10 "file.h"
  int Func(int arg1);
  
  # 1 "file1.c" 1
  int Func(int arg);

These testes were added to test/Index/usrs.cpp.

I changed the printLoc function to, instead of adding the declaration offset to the name, it gets the presumedLoc (which handles line directives or linemarkes), and adds the line and column to the name, in the format <line>:<column>.

The patch only changes the printLoc function in lib/index/USRGeneration.cpp; the other changes are test updates.


Repository:
  rC Clang

https://reviews.llvm.org/D42966

Files:
  lib/Index/USRGeneration.cpp
  test/Index/cxx11-lambdas.cpp
  test/Index/get-cursor.cpp
  test/Index/index-templates.cpp
  test/Index/pch-opaque-value.cpp
  test/Index/usrs.cpp
  test/Index/usrs.m

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42966.132995.patch
Type: text/x-patch
Size: 19417 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180206/65c21273/attachment-0001.bin>


More information about the cfe-commits mailing list