summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MachineDominators.cpp
diff options
context:
space:
mode:
authorEric Liu <ioeric@google.com>2018-02-28 09:33:15 +0000
committerEric Liu <ioeric@google.com>2018-02-28 09:33:15 +0000
commitcf8601b0097ca3bf559a10df3bab829d24d15fec (patch)
treebb11528627be7b95a27e939ee7cc3451806109f2 /llvm/lib/CodeGen/MachineDominators.cpp
parent4df80bda4057cd242d40364ea6aa9aaa1f0fb69f (diff)
downloadbcm5719-llvm-cf8601b0097ca3bf559a10df3bab829d24d15fec.tar.gz
bcm5719-llvm-cf8601b0097ca3bf559a10df3bab829d24d15fec.zip
[clangd] Prefer the definition of a TagDecl (e.g. class) as CanonicalDeclaration.
Summary: Currently, we pick the first declaration of a symbol in a TU, which is considered canonical in the clangIndex, as the canonical declaration in clangd. This causes forward declarations that might appear in a random header to be used as a canonical declaration, which is not desirable for features like go-to-declaration or include insertion. For example, for class X, we would consider the forward declaration in fwd.h to be the canonical declaration, while the preferred canonical declaration should be the actual definition in x.h. ``` // fwd.h class X; // forward decl // x.h class X {}; ``` This patch fixes the issue by making symbol collector favor the actual definition of a TagDecl (i.e. class/struct/enum/union) found in a header file over the first seen declarations in a TU. Other symbol types like functions are not handled because using the first seen declarations as canonical declarations is usually a good heuristic for them. Reviewers: sammccall Subscribers: klimek, ilya-biryukov, jkorous-apple, cfe-commits Differential Revision: https://reviews.llvm.org/D43823 llvm-svn: 326313
Diffstat (limited to 'llvm/lib/CodeGen/MachineDominators.cpp')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud