//
//===----------------------------------------------------------------------===//
+#include "CGCXXABI.h"
#include "CGDebugInfo.h"
#include "CodeGenFunction.h"
#include "CodeGenModule.h"
QualType Ty = D.getType();
assert(Ty->isConstantSizeType() && "VLAs can't be static");
- std::string Name = GetStaticDeclName(*this, D, Separator);
+ // Use the label if the variable is renamed with the asm-label extension.
+ std::string Name;
+ if (D.hasAttr<AsmLabelAttr>()) {
+ llvm::raw_string_ostream Out(Name);
+ CGM.getCXXABI().getMangleContext().mangleName(&D, Out);
+ } else {
+ Name = GetStaticDeclName(*this, D, Separator);
+ }
llvm::Type *LTy = CGM.getTypes().ConvertTypeForMem(Ty);
llvm::GlobalVariable *GV =
// RUN: %clang_cc1 -triple=i686-apple-darwin9 -emit-llvm %s -o - | FileCheck %s --check-prefix=DARWIN
char *strerror(int) asm("alias");
+int x __asm("foo");
-void test(void)
-{
- strerror(-1);
+int *test(void) {
+ static int y __asm("bar");
+ strerror(-1);
+ return &y;
}
+// LINUX: @bar = internal global i32 0
+// LINUX: @foo = common global i32 0
// LINUX: declare i8* @alias(i32)
+
+// DARWIN: @"\01bar" = internal global i32 0
+// DARWIN: @"\01foo" = common global i32 0
// DARWIN: declare i8* @"\01alias"(i32)