if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D))
return mangleFunctionDecl(FD);
+ if (const VarDecl *VD = dyn_cast<VarDecl>(D)) {
+ if (!Context.getLangOptions().CPlusPlus ||
+ isInCLinkageSpecification(D))
+ return false;
+
+ Out << "_Z";
+ mangleName(VD);
+ return true;
+ }
+
return false;
}
// RUN: grep unmangled_function %t | count 1 &&
extern "C" { namespace N { void unmangled_function() { } } }
-// RUN: grep unmangled_variable %t | count 1
+// RUN: grep unmangled_variable %t | count 1 &&
extern "C" { namespace N { int unmangled_variable; } }
+// RUN: grep _ZN1N1iE %t | count 1
+namespace N { int i; }