Go to file
Eric Liu cf8601b009 [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
2018-02-28 09:33:15 +00:00
clang [ObjC] Allow declaring __strong pointer fields in structs in Objective-C 2018-02-28 07:15:55 +00:00
clang-tools-extra [clangd] Prefer the definition of a TagDecl (e.g. class) as CanonicalDeclaration. 2018-02-28 09:33:15 +00:00
compiler-rt Disable ASan exceptions on NetBSD 2018-02-27 18:05:49 +00:00
debuginfo-tests [Darwin] Specify DWARF 2/4 when running apple accelerator tests. 2018-02-26 20:56:45 +00:00
libclc utils: Adapt to llvm r325155 2018-02-23 07:37:03 +00:00
libcxx [libcxx] [test] Fix MSVC warnings and errors. 2018-02-26 20:47:46 +00:00
libcxxabi [demangler] Support for exception specifications on function types. 2018-02-14 01:08:20 +00:00
libunwind [libunwind][MIPS]: Add support for unwinding in N32 processes. 2018-02-27 21:24:02 +00:00
lld [ELF] Process linker scripts deeper when declaring symbols. 2018-02-28 05:55:56 +00:00
lldb Add EmulateInstructionPPC64.cpp to xcode project file. 2018-02-28 04:11:37 +00:00
llgo irgen: Create functions instead of global variables for builtin hash and equal algorithms. 2017-06-04 22:11:28 +00:00
llvm [GlobalIsel][X86] Support G_PTRTOINT instruction. 2018-02-28 09:18:47 +00:00
openmp [OMPT] Fix inconsistent testcases 2018-02-28 09:28:51 +00:00
parallel-libs [Axccel] Remove -Wno-missing-braces in build 2016-12-19 21:34:07 +00:00
polly isl: "isl_schedule_get_map: handle trees with divergent filter node parameters" 2018-02-26 09:26:41 +00:00
README.md Add an svn project to contain the files that appear at the root of the 2017-10-19 21:09:49 +00:00

README.md

Low Level Virtual Machine (LLVM)

This directory and its subdirectories contain source code for LLVM, a toolkit for the construction of highly optimized compilers, optimizers, and runtime environments.