From ccf3b4299d8c74f8c5cb8918bcfe2e0e09186a2f Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Tue, 6 Nov 2012 06:36:45 +0000 Subject: [PATCH] Remove completely irrelevant code from USR generation. Thanks to Richard Smith for pointing this out. This code stopped serving its purpose during r103212 in a refactoring. My initial fix was to add back the logic to abort the USR generation for InternalLinkage, but enough tests broke suspiciously that I fear that USR generation for cursors with InternalLinkage is now expected by some clients (where it wasn't the case when the refactoring took place). I don't own this code anymore and have not looked at it for some time, but clearly this code is dead and can be removed pending further review on the proper logic here. llvm-svn: 167442 --- clang/tools/libclang/CIndexUSRs.cpp | 33 ++++----------------------------- 1 file changed, 4 insertions(+), 29 deletions(-) diff --git a/clang/tools/libclang/CIndexUSRs.cpp b/clang/tools/libclang/CIndexUSRs.cpp index 19b3f26..6140032 100644 --- a/clang/tools/libclang/CIndexUSRs.cpp +++ b/clang/tools/libclang/CIndexUSRs.cpp @@ -805,36 +805,11 @@ bool cxcursor::getDeclCursorUSR(const Decl *D, SmallVectorImpl &Buf) { if (!D || D->getLocStart().isInvalid()) return true; - // Check if the cursor has 'NoLinkage'. - if (const NamedDecl *ND = dyn_cast(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(ND) || isa(ND) || - isa(ND) || isa(ND) || - isa(ND) || isa(ND)) - break; - // Fall-through. - case InternalLinkage: - if (isa(ND)) - break; - } - - { - USRGenerator UG(&D->getASTContext(), &Buf); - UG->Visit(const_cast(D)); + USRGenerator UG(&D->getASTContext(), &Buf); + UG->Visit(const_cast(D)); - if (UG->ignoreResults()) - return true; - } + if (UG->ignoreResults()) + return true; return false; } -- 2.7.4