From: Ted Kremenek Date: Tue, 6 Nov 2012 06:36:45 +0000 (+0000) Subject: Remove completely irrelevant code from USR generation. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3d615b2a4217200fe1226d77683f4ef57dffbffd;p=clang 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167442 91177308-0d34-0410-b5e6-96231b3b80d8 --- 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 &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; }