blob: 1de85236a889a38bf116d169f84d36cd5dfca6cb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
//===- llvm/unittest/Support/DynamicLibrary/PipSqueak.cxx -----------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "PipSqueak.h"
#include <string>
struct Global {
std::string *Str;
Global() : Str(nullptr) {}
~Global() {
if (Str)
*Str = "Global::~Global";
}
};
struct Local {
std::string &Str;
Local(std::string &S) : Str(S) { Str = "Local::Local"; }
~Local() { Str = "Local::~Local"; }
};
static Global Glb;
extern "C" PIPSQUEAK_EXPORT void SetStrings(std::string &GStr,
std::string &LStr) {
static Local Lcl(LStr);
Glb.Str = &GStr;
}
extern "C" PIPSQUEAK_EXPORT const char *TestA() { return "LibCall"; }
|