[cfe-commits] r103212

Richard Smith richard at metafoo.co.uk
Mon Nov 5 17:39:16 PST 2012


Hi Ted,

Revision 103212 has its 2.5th birthday today. It introduced a bug:

Index: tools/libclang/CIndexUSRs.cpp
===================================================================
--- tools/libclang/CIndexUSRs.cpp       (revision 103211)
+++ tools/libclang/CIndexUSRs.cpp       (revision 103212)
[...]
@@ -383,6 +394,7 @@
         // 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
@@ -390,14 +402,12 @@
         // are referred to across multiple translation units.
         if (isa<TagDecl>(ND) || isa<TypedefDecl>(ND) ||
             isa<EnumConstantDecl>(ND) || isa<FieldDecl>(ND) ||
-            isa<VarDecl>(ND))
+            isa<VarDecl>(ND) || isa<NamespaceDecl>(ND))
           break;
         // Fall-through.
       case InternalLinkage:
         if (isa<FunctionDecl>(ND))
           break;
-      case UniqueExternalLinkage:
-        return createCXString("");
     }

   StringUSRGenerator SUG(&C);

Note that we had fall-through into the 'return' statement before, and
now it's gone. This entire 'switch' statement just executes a bunch of
tests, then either 'break's or falls off the bottom. That can't be
what was intended...



More information about the cfe-commits mailing list