diff options
-rw-r--r-- | tools/libclang/CIndexUSRs.cpp | 33 |
1 files changed, 4 insertions, 29 deletions
diff --git a/tools/libclang/CIndexUSRs.cpp b/tools/libclang/CIndexUSRs.cpp index 19b3f263a4..6140032729 100644 --- a/tools/libclang/CIndexUSRs.cpp +++ b/tools/libclang/CIndexUSRs.cpp @@ -805,36 +805,11 @@ bool cxcursor::getDeclCursorUSR(const Decl *D, SmallVectorImpl<char> &Buf) { if (!D || D->getLocStart().isInvalid()) return true; - // Check if the cursor has 'NoLinkage'. - if (const NamedDecl *ND = dyn_cast<NamedDecl>(D)) - switch (ND->getLinkage()) { - case ExternalLinkage: - // Generate USRs for all entities with external linkage. - break; - case NoLinkage: - case UniqueExternalLinkage: - // We allow enums, typedefs, and structs that have no linkage to - // have USRs that are anchored to the file they were defined in - // (e.g., the header). This is a little gross, but in principal - // enums/anonymous structs/etc. defined in a common header file - // are referred to across multiple translation units. - if (isa<TagDecl>(ND) || isa<TypedefDecl>(ND) || - isa<EnumConstantDecl>(ND) || isa<FieldDecl>(ND) || - isa<VarDecl>(ND) || isa<NamespaceDecl>(ND)) - break; - // Fall-through. - case InternalLinkage: - if (isa<FunctionDecl>(ND)) - break; - } - - { - USRGenerator UG(&D->getASTContext(), &Buf); - UG->Visit(const_cast<Decl*>(D)); + USRGenerator UG(&D->getASTContext(), &Buf); + UG->Visit(const_cast<Decl*>(D)); - if (UG->ignoreResults()) - return true; - } + if (UG->ignoreResults()) + return true; return false; } |