Fix savannah #99234.

The issue we experienced is that we couldn't pipe the output in the terminal.
The reason is that we were using llvm::outs() which closes explicitly the file
descriptor (thanks Axel for the help debugging).
We introduce our custom stream, which keeps the file descriptor open so that
we can use it in pipes. For debugging purposes, however we use/should use llvm::errs()

The lesson learned:
DONT USE LLVM::OUTS() ANYMORE!


git-svn-id: http://root.cern.ch/svn/root/trunk@48316 27541ba8-7e3a-0410-8455-c3a389f83636
This commit is contained in:
Vassil Vassilev 2013-01-17 15:27:14 +00:00
parent d98bece0ed
commit 1ae610b211
15 changed files with 188 additions and 163 deletions

View File

@ -45,12 +45,18 @@ namespace cling {
///
llvm::StringRef m_TopExecutingFile;
///\brief The output stream being used for various purposes.
///
llvm::raw_ostream& m_Outs;
public:
MetaProcessor(Interpreter& interp);
MetaProcessor(Interpreter& interp, llvm::raw_ostream& outs);
~MetaProcessor();
const Interpreter& getInterpreter() const { return m_Interp; }
llvm::raw_ostream& getOuts() const { return m_Outs; }
///\brief Process the input coming from the prompt and possibli returns
/// result of the execution of the last statement
/// @param[in] input_line - the user input

View File

@ -39,14 +39,14 @@ namespace cling {
Policy.DumpSourceManager = 0;
if (D) {
llvm::outs() << "\n-------------------Declaration---------------------\n";
llvm::errs() << "\n-------------------Declaration---------------------\n";
D->dump();
if (Stmt* Body = D->getBody()) {
llvm::outs() << "\n------------------Declaration Body---------------\n";
llvm::errs() << "\n------------------Declaration Body---------------\n";
Body->dump();
}
llvm::outs() << "\n---------------------------------------------------\n";
llvm::errs() << "\n---------------------------------------------------\n";
}
}
} // namespace cling

View File

@ -323,7 +323,7 @@ ExecutionContext::printModule(llvm::Module* m)
// Print module LLVM code in human-readable form.
//
llvm::PassManager PM;
PM.add(llvm::createPrintModulePass(&llvm::outs()));
PM.add(llvm::createPrintModulePass(&llvm::errs()));
PM.run(*m);
}

View File

@ -212,7 +212,7 @@ namespace cling {
void Interpreter::handleFrontendOptions() {
if (m_Opts.ShowVersion) {
llvm::outs() << getVersion() << '\n';
llvm::errs() << getVersion() << '\n';
}
if (m_Opts.Help) {
m_Opts.PrintHelp();
@ -244,7 +244,7 @@ namespace cling {
GetIncludePaths(IncPaths, true /*withSystem*/, true /*withFlags*/);
// print'em all
for (unsigned i = 0; i < IncPaths.size(); ++i) {
llvm::outs() << IncPaths[i] <<"\n";
llvm::errs() << IncPaths[i] <<"\n";
}
}

View File

@ -97,11 +97,15 @@ cling::InvocationOptions::CreateFromArgs(int argc, const char* const argv[],
void cling::InvocationOptions::PrintHelp() {
llvm::OwningPtr<OptTable> Opts(CreateClingOptTable());
Opts->PrintHelp(llvm::outs(), "cling",
// We need stream that doesn't close its file descriptor, thus we are not
// using llvm::outs. Keeping file descriptor open we will be able to use
// the results in pipes (Savannah #99234).
Opts->PrintHelp(llvm::errs(), "cling",
"cling: LLVM/clang C++ Interpreter: http://cern.ch/cling");
llvm::OwningPtr<OptTable> OptsC1(createDriverOptTable());
OptsC1->PrintHelp(llvm::outs(), "clang -cc1",
OptsC1->PrintHelp(llvm::errs(), "clang -cc1",
"LLVM 'Clang' Compiler: http://clang.llvm.org");
}

View File

@ -38,7 +38,7 @@ int64_t StoredValueRef::StoredValue::getAllocSizeInBytes(
void StoredValueRef::dump(ASTContext& ctx) const {
StreamStoredValueRef(llvm::outs(), this, ctx);
StreamStoredValueRef(llvm::errs(), this, ctx);
}
StoredValueRef StoredValueRef::allocate(const ASTContext& ctx, QualType t) {

View File

@ -52,7 +52,7 @@ namespace cling {
ASTContext& C = getFirstDecl().getSingleDecl()->getASTContext();
PrintingPolicy Policy = C.getPrintingPolicy();
Policy.DumpSourceManager = &C.getSourceManager();
print(llvm::outs(), Policy, /*Indent*/0, /*PrintInstantiation*/true);
print(llvm::errs(), Policy, /*Indent*/0, /*PrintInstantiation*/true);
}
void Transaction::dumpPretty() const {
@ -65,7 +65,7 @@ namespace cling {
C = &(getFirstDecl().getSingleDecl()->getASTContext());
PrintingPolicy Policy(C->getLangOpts());
print(llvm::outs(), Policy, /*Indent*/0, /*PrintInstantiation*/true);
print(llvm::errs(), Policy, /*Indent*/0, /*PrintInstantiation*/true);
}
void Transaction::print(llvm::raw_ostream& Out, const PrintingPolicy& Policy,

View File

@ -20,6 +20,7 @@
#include "llvm/Support/raw_ostream.h"
#include <string>
#include <cstdio>
using namespace cling;
@ -30,9 +31,14 @@ extern "C" void cling_PrintValue(void* /*clang::Expr**/ E,
clang::Expr* Exp = (clang::Expr*)E;
clang::ASTContext* Context = (clang::ASTContext*)C;
ValuePrinterInfo VPI(Exp->getType(), Context);
printValuePublic(llvm::outs(), value, value, VPI);
flushOStream(llvm::outs());
// We need stream that doesn't close its file descriptor, thus we are not
// using llvm::outs. Keeping file descriptor open we will be able to use
// the results in pipes (Savannah #99234).
llvm::raw_fd_ostream outs (STDOUT_FILENO, /*ShouldClose*/false);
printValuePublic(outs, value, value, VPI);
flushOStream(outs);
}
@ -302,6 +308,8 @@ namespace cling {
}
void flushOStream(llvm::raw_ostream& o) {
// We want to keep stdout and o in sync if o is different from stdout.
fflush(stdout);
o.flush();
}

View File

@ -417,14 +417,16 @@ private:
FILEPrintHelper::FILEPrintHelper(llvm::raw_ostream& stream)
: fStream(stream)
{
fStream.flush();
}
//______________________________________________________________________________
void FILEPrintHelper::Print(const char* msg)const
{
assert(msg != 0 && "Print, 'msg' parameter is null");
fStream<<msg;
// We want to keep stdout and fStream in sync if fStream is different.
fflush(stdout);
fStream << msg;
fStream.flush();
}

View File

@ -28,7 +28,8 @@ using namespace clang;
namespace cling {
MetaProcessor::MetaProcessor(Interpreter& interp) : m_Interp(interp) {
MetaProcessor::MetaProcessor(Interpreter& interp, raw_ostream& outs)
: m_Interp(interp), m_Outs(outs) {
m_InputValidator.reset(new InputValidator());
m_MetaParser.reset(new MetaParser(new MetaSema(interp, *this)));
}

View File

@ -17,12 +17,18 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/raw_ostream.h" // for llvm::outs() FIXME
#include <cstdlib>
namespace cling {
MetaSema::MetaSema(Interpreter& interp, MetaProcessor& meta)
: m_Interpreter(interp), m_MetaProcessor(meta), m_IsQuitRequested(false),
m_Outs(m_MetaProcessor.getOuts()){
m_LastResultedValue = StoredValueRef::invalidValue();
}
void MetaSema::actOnLCommand(llvm::sys::Path file) const {
m_Interpreter.loadFile(file.str());
// TODO: extra checks. Eg if the path is readable, if the file exists...
@ -62,7 +68,7 @@ namespace cling {
bool flag = !m_Interpreter.isRawInputEnabled();
m_Interpreter.enableRawInput(flag);
// FIXME:
llvm::outs() << (flag ? "U" :"Not u") << "sing raw input\n";
m_Outs << (flag ? "U" :"Not u") << "sing raw input\n";
}
else
m_Interpreter.enableRawInput(mode);
@ -73,7 +79,7 @@ namespace cling {
bool flag = !m_Interpreter.isPrintingAST();
m_Interpreter.enablePrintAST(flag);
// FIXME:
llvm::outs() << (flag ? "P" : "Not p") << "rinting AST\n";
m_Outs << (flag ? "P" : "Not p") << "rinting AST\n";
}
else
m_Interpreter.enablePrintAST(mode);
@ -85,7 +91,7 @@ namespace cling {
bool flag = !m_Interpreter.isDynamicLookupEnabled();
m_Interpreter.enableDynamicLookup(flag);
// FIXME:
llvm::outs() << (flag ? "U" : "Not u") << "sing dynamic extensions\n";
m_Outs << (flag ? "U" : "Not u") << "sing dynamic extensions\n";
}
else
m_Interpreter.enableDynamicLookup(mode);
@ -93,36 +99,36 @@ namespace cling {
void MetaSema::actOnhelpCommand() const {
std::string& metaString = m_Interpreter.getOptions().MetaString;
llvm::outs() << "Cling meta commands usage\n";
llvm::outs() << "Syntax: .Command [arg0 arg1 ... argN]\n";
llvm::outs() << "\n";
llvm::outs() << metaString << "q\t\t\t\t- Exit the program\n";
llvm::outs() << metaString << "L <filename>\t\t\t - Load file or library\n";
llvm::outs() << metaString << "(x|X) <filename>[args]\t\t- Same as .L and runs a ";
llvm::outs() << "function with signature ";
llvm::outs() << "\t\t\t\tret_type filename(args)\n";
llvm::outs() << metaString << "I [path]\t\t\t- Shows the include path. If a path is ";
llvm::outs() << "given - \n\t\t\t\tadds the path to the include paths\n";
llvm::outs() << metaString << "@ \t\t\t\t- Cancels and ignores the multiline input\n";
llvm::outs() << metaString << "rawInput [0|1]\t\t\t- Toggle wrapping and printing ";
llvm::outs() << "the execution\n\t\t\t\tresults of the input\n";
llvm::outs() << metaString << "dynamicExtensions [0|1]\t- Toggles the use of the ";
llvm::outs() << "dynamic scopes and the \t\t\t\tlate binding\n";
llvm::outs() << metaString << "printAST [0|1]\t\t\t- Toggles the printing of input's ";
llvm::outs() << "corresponding \t\t\t\tAST nodes\n";
llvm::outs() << metaString << "help\t\t\t\t- Shows this information\n";
m_Outs << "Cling meta commands usage\n";
m_Outs << "Syntax: .Command [arg0 arg1 ... argN]\n";
m_Outs << "\n";
m_Outs << metaString << "q\t\t\t\t- Exit the program\n";
m_Outs << metaString << "L <filename>\t\t\t - Load file or library\n";
m_Outs << metaString << "(x|X) <filename>[args]\t\t- Same as .L and runs a ";
m_Outs << "function with signature ";
m_Outs << "\t\t\t\tret_type filename(args)\n";
m_Outs << metaString << "I [path]\t\t\t- Shows the include path. If a path is ";
m_Outs << "given - \n\t\t\t\tadds the path to the include paths\n";
m_Outs << metaString << "@ \t\t\t\t- Cancels and ignores the multiline input\n";
m_Outs << metaString << "rawInput [0|1]\t\t\t- Toggle wrapping and printing ";
m_Outs << "the execution\n\t\t\t\tresults of the input\n";
m_Outs << metaString << "dynamicExtensions [0|1]\t- Toggles the use of the ";
m_Outs << "dynamic scopes and the \t\t\t\tlate binding\n";
m_Outs << metaString << "printAST [0|1]\t\t\t- Toggles the printing of input's ";
m_Outs << "corresponding \t\t\t\tAST nodes\n";
m_Outs << metaString << "help\t\t\t\t- Shows this information\n";
}
void MetaSema::actOnfileExCommand() const {
const clang::SourceManager& SM = m_Interpreter.getCI()->getSourceManager();
SM.getFileManager().PrintStats();
llvm::outs() << "\n***\n\n";
m_Outs << "\n***\n\n";
for (clang::SourceManager::fileinfo_iterator I = SM.fileinfo_begin(),
E = SM.fileinfo_end(); I != E; ++I) {
llvm::outs() << (*I).first->getName();
llvm::outs() << "\n";
m_Outs << (*I).first->getName();
m_Outs << "\n";
}
/* Only available in clang's trunk:
clang::ASTReader* Reader = m_Interpreter.getCI()->getModuleManager();
@ -136,8 +142,8 @@ namespace cling {
const InputFiles_t& InputFiles = (*I)->InputFilesLoaded;
for (InputFiles_t::const_iterator IFI = InputFiles.begin(),
IFE = InputFiles.end(); IFI != IFE; ++IFI) {
llvm::outs() << IFI->getPointer()->getName();
llvm::outs() << "\n";
m_Outs << IFI->getPointer()->getName();
m_Outs << "\n";
}
}
*/
@ -149,34 +155,33 @@ namespace cling {
for (LoadedFiles_t::const_iterator I = LoadedFiles.begin(),
E = LoadedFiles.end(); I != E; ++I) {
char cType[] = { 'S', 'D', 'B' };
llvm::outs() << '[' << cType[(*I)->getType()] << "] "
<< (*I)->getName() << '\n';
m_Outs << '[' << cType[(*I)->getType()] << "] "<< (*I)->getName() << '\n';
}
}
void MetaSema::actOnclassCommand(llvm::StringRef className) const {
if (!className.empty())
DisplayClass(llvm::outs(), &m_Interpreter, className.str().c_str(), true);
DisplayClass(m_Outs, &m_Interpreter, className.str().c_str(), true);
else
DisplayClasses(llvm::outs(), &m_Interpreter, false);
DisplayClasses(m_Outs, &m_Interpreter, false);
}
void MetaSema::actOnClassCommand() const {
DisplayClasses(llvm::outs(), &m_Interpreter, true);
DisplayClasses(m_Outs, &m_Interpreter, true);
}
void MetaSema::actOngCommand(llvm::StringRef varName) const {
if (varName.empty())
DisplayGlobals(llvm::outs(), &m_Interpreter);
DisplayGlobals(m_Outs, &m_Interpreter);
else
DisplayGlobal(llvm::outs(), &m_Interpreter, varName.str().c_str());
DisplayGlobal(m_Outs, &m_Interpreter, varName.str().c_str());
}
void MetaSema::actOnTypedefCommand(llvm::StringRef typedefName) const {
if (typedefName.empty())
DisplayTypedefs(llvm::outs(), &m_Interpreter);
DisplayTypedefs(m_Outs, &m_Interpreter);
else
DisplayTypedef(llvm::outs(), &m_Interpreter, typedefName.str().c_str());
DisplayTypedef(m_Outs, &m_Interpreter, typedefName.str().c_str());
}
void MetaSema::actOnShellCommand(llvm::StringRef commandLine) const {

View File

@ -11,6 +11,7 @@
namespace llvm {
class StringRef;
class raw_ostream;
namespace sys {
class Path;
}
@ -28,6 +29,7 @@ namespace cling {
MetaProcessor& m_MetaProcessor;
bool m_IsQuitRequested;
StoredValueRef m_LastResultedValue;
llvm::raw_ostream& m_Outs; // Shortens m_MetaProcessor->getOuts()
public:
enum SwitchMode {
kOff = 0,
@ -35,10 +37,7 @@ namespace cling {
kToggle = 2
};
public:
MetaSema(Interpreter& interp, MetaProcessor& meta)
: m_Interpreter(interp), m_MetaProcessor(meta), m_IsQuitRequested(false) {
m_LastResultedValue = StoredValueRef::invalidValue();
}
MetaSema(Interpreter& interp, MetaProcessor& meta);
const Interpreter& getInterpreter() const { return m_Interpreter; }
bool isQuitRequested() const { return m_IsQuitRequested; }

View File

@ -16,7 +16,11 @@
namespace cling {
UserInterface::UserInterface(Interpreter& interp) {
m_MetaProcessor.reset(new MetaProcessor(interp));
// We need stream that doesn't close its file descriptor, thus we are not
// using llvm::outs. Keeping file descriptor open we will be able to use
// the results in pipes (Savannah #99234).
static llvm::raw_fd_ostream m_MPOuts (STDOUT_FILENO, /*ShouldClose*/false);
m_MetaProcessor.reset(new MetaProcessor(interp, m_MPOuts));
}
UserInterface::~UserInterface() {}
@ -40,7 +44,7 @@ namespace cling {
std::string line;
while (true) {
llvm::outs().flush();
m_MetaProcessor->getOuts().flush();
TextInput::EReadResult RR = TI.ReadInput();
TI.TakeInput(line);
if (RR == TextInput::kRREOF) {
@ -67,10 +71,11 @@ namespace cling {
}
void UserInterface::PrintLogo() {
llvm::outs() << "\n";
llvm::outs() << "****************** CLING ******************" << "\n";
llvm::outs() << "* Type C++ code and press enter to run it *" << "\n";
llvm::outs() << "* Type .q to exit *" << "\n";
llvm::outs() << "*******************************************" << "\n";
llvm::raw_ostream& outs = m_MetaProcessor->getOuts();
outs << "\n";
outs << "****************** CLING ******************" << "\n";
outs << "* Type C++ code and press enter to run it *" << "\n";
outs << "* Type .q to exit *" << "\n";
outs << "*******************************************" << "\n";
}
} // end namespace cling

View File

@ -161,14 +161,14 @@ const clang::FunctionDecl* G_f_proto = lookup.findFunctionProto(G, "G_f", "");
printf("G_f_args: 0x%lx\n", (unsigned long) G_f_args);
//CHECK-NEXT: G_f_args: 0x{{[1-9a-f][0-9a-f]*$}}
G_f_args->print(llvm::outs());
G_f_args->print(llvm::errs());
//CHECK-NEXT: void G_f() {
//CHECK-NEXT: int x = 1;
//CHECK-NEXT: }
printf("G_f_proto: 0x%lx\n", (unsigned long) G_f_proto);
//CHECK: G_f_proto: 0x{{[1-9a-f][0-9a-f]*$}}
G_f_proto->print(llvm::outs());
G_f_proto->print(llvm::errs());
//CHECK-NEXT: void G_f() {
//CHECK-NEXT: int x = 1;
//CHECK-NEXT: }
@ -184,14 +184,14 @@ const clang::FunctionDecl* G_a_proto = lookup.findFunctionProto(G, "G_a", "int")
printf("G_a_args: 0x%lx\n", (unsigned long) G_a_args);
//CHECK: G_a_args: 0x{{[1-9a-f][0-9a-f]*$}}
G_a_args->print(llvm::outs());
G_a_args->print(llvm::errs());
//CHECK-NEXT: void G_a(int v) {
//CHECK-NEXT: int x = v;
//CHECK-NEXT: }
printf("G_a_proto: 0x%lx\n", (unsigned long) G_a_proto);
//CHECK: G_a_proto: 0x{{[1-9a-f][0-9a-f]*$}}
G_a_proto->print(llvm::outs());
G_a_proto->print(llvm::errs());
//CHECK-NEXT: void G_a(int v) {
//CHECK-NEXT: int x = v;
//CHECK-NEXT: }
@ -207,7 +207,7 @@ const clang::FunctionDecl* G_b_proto = lookup.findFunctionProto(G, "G_b", "int,d
printf("G_b_args: 0x%lx\n", (unsigned long) G_b_args);
//CHECK: G_b_args: 0x{{[1-9a-f][0-9a-f]*$}}
G_b_args->print(llvm::outs());
G_b_args->print(llvm::errs());
//CHECK-NEXT: void G_b(int vi, double vd) {
//CHECK-NEXT: int x = vi;
//CHECK-NEXT: double y = vd;
@ -215,7 +215,7 @@ G_b_args->print(llvm::outs());
printf("G_b_proto: 0x%lx\n", (unsigned long) G_b_proto);
//CHECK: G_b_proto: 0x{{[1-9a-f][0-9a-f]*$}}
G_b_proto->print(llvm::outs());
G_b_proto->print(llvm::errs());
//CHECK-NEXT: void G_b(int vi, double vd) {
//CHECK-NEXT: int x = vi;
//CHECK-NEXT: double y = vd;
@ -232,7 +232,7 @@ const clang::FunctionDecl* G_c1_proto = lookup.findFunctionProto(G, "G_c", "int,
printf("G_c1_args: 0x%lx\n", (unsigned long) G_c1_args);
//CHECK: G_c1_args: 0x{{[1-9a-f][0-9a-f]*$}}
G_c1_args->print(llvm::outs());
G_c1_args->print(llvm::errs());
//CHECK-NEXT: void G_c(int vi, int vj) {
//CHECK-NEXT: int x = vi;
//CHECK-NEXT: int y = vj;
@ -240,7 +240,7 @@ G_c1_args->print(llvm::outs());
printf("G_c1_proto: 0x%lx\n", (unsigned long) G_c1_proto);
//CHECK: G_c1_proto: 0x{{[1-9a-f][0-9a-f]*$}}
G_c1_proto->print(llvm::outs());
G_c1_proto->print(llvm::errs());
//CHECK-NEXT: void G_c(int vi, int vj) {
//CHECK-NEXT: int x = vi;
//CHECK-NEXT: int y = vj;
@ -251,7 +251,7 @@ const clang::FunctionDecl* G_c2_proto = lookup.findFunctionProto(G, "G_c", "int,
printf("G_c2_args: 0x%lx\n", (unsigned long) G_c2_args);
//CHECK: G_c2_args: 0x{{[1-9a-f][0-9a-f]*$}}
G_c2_args->print(llvm::outs());
G_c2_args->print(llvm::errs());
//CHECK-NEXT: void G_c(int vi, double vd) {
//CHECK-NEXT: int x = vi;
//CHECK-NEXT: double y = vd;
@ -259,7 +259,7 @@ G_c2_args->print(llvm::outs());
printf("G_c2_proto: 0x%lx\n", (unsigned long) G_c2_proto);
//CHECK: G_c2_proto: 0x{{[1-9a-f][0-9a-f]*$}}
G_c2_proto->print(llvm::outs());
G_c2_proto->print(llvm::errs());
//CHECK-NEXT: void G_c(int vi, double vd) {
//CHECK-NEXT: int x = vi;
//CHECK-NEXT: double y = vd;
@ -276,14 +276,14 @@ const clang::FunctionDecl* G_d1_proto = lookup.findFunctionProto(G, "G_d<int>",
printf("G_d1_args: 0x%lx\n", (unsigned long) G_d1_args);
//CHECK: G_d1_args: 0x{{[1-9a-f][0-9a-f]*$}}
G_d1_args->print(llvm::outs());
G_d1_args->print(llvm::errs());
//CHECK-NEXT: void G_d(int v) {
//CHECK-NEXT: int x = v;
//CHECK-NEXT: }
printf("G_d1_proto: 0x%lx\n", (unsigned long) G_d1_proto);
//CHECK: G_d1_proto: 0x{{[1-9a-f][0-9a-f]*$}}
G_d1_proto->print(llvm::outs());
G_d1_proto->print(llvm::errs());
//CHECK-NEXT: void G_d(int v) {
//CHECK-NEXT: int x = v;
//CHECK-NEXT: }
@ -293,14 +293,14 @@ const clang::FunctionDecl* G_d2_proto = lookup.findFunctionProto(G, "G_d<double>
printf("G_d2_args: 0x%lx\n", (unsigned long) G_d2_args);
//CHECK: G_d2_args: 0x{{[1-9a-f][0-9a-f]*$}}
G_d2_args->print(llvm::outs());
G_d2_args->print(llvm::errs());
//CHECK-NEXT: void G_d(double v) {
//CHECK-NEXT: double x = v;
//CHECK-NEXT: }
printf("G_d2_proto: 0x%lx\n", (unsigned long) G_d2_proto);
//CHECK: G_d2_proto: 0x{{[1-9a-f][0-9a-f]*$}}
G_d2_proto->print(llvm::outs());
G_d2_proto->print(llvm::errs());
//CHECK-NEXT: void G_d(double v) {
//CHECK-NEXT: double x = v;
//CHECK-NEXT: }
@ -316,14 +316,14 @@ const clang::FunctionDecl* H_f_proto = lookup.findFunctionProto(namespace_N, "H_
printf("H_f_args: 0x%lx\n", (unsigned long) H_f_args);
//CHECK: H_f_args: 0x{{[1-9a-f][0-9a-f]*$}}
H_f_args->print(llvm::outs());
H_f_args->print(llvm::errs());
//CHECK-NEXT: void H_f() {
//CHECK-NEXT: int x = 1;
//CHECK-NEXT: }
printf("H_f_proto: 0x%lx\n", (unsigned long) H_f_proto);
//CHECK: H_f_proto: 0x{{[1-9a-f][0-9a-f]*$}}
H_f_proto->print(llvm::outs());
H_f_proto->print(llvm::errs());
//CHECK-NEXT: void H_f() {
//CHECK-NEXT: int x = 1;
//CHECK-NEXT: }
@ -339,14 +339,14 @@ const clang::FunctionDecl* H_a_proto = lookup.findFunctionProto(namespace_N, "H_
printf("H_a_args: 0x%lx\n", (unsigned long) H_a_args);
//CHECK: H_a_args: 0x{{[1-9a-f][0-9a-f]*$}}
H_a_args->print(llvm::outs());
H_a_args->print(llvm::errs());
//CHECK-NEXT: void H_a(int v) {
//CHECK-NEXT: int x = v;
//CHECK-NEXT: }
printf("H_a_proto: 0x%lx\n", (unsigned long) H_a_proto);
//CHECK: H_a_proto: 0x{{[1-9a-f][0-9a-f]*$}}
H_a_proto->print(llvm::outs());
H_a_proto->print(llvm::errs());
//CHECK-NEXT: void H_a(int v) {
//CHECK-NEXT: int x = v;
//CHECK-NEXT: }
@ -362,7 +362,7 @@ const clang::FunctionDecl* H_b_proto = lookup.findFunctionProto(namespace_N, "H_
printf("H_b_args: 0x%lx\n", (unsigned long) H_b_args);
//CHECK: H_b_args: 0x{{[1-9a-f][0-9a-f]*$}}
H_b_args->print(llvm::outs());
H_b_args->print(llvm::errs());
//CHECK-NEXT: void H_b(int vi, double vd) {
//CHECK-NEXT: int x = vi;
//CHECK-NEXT: double y = vd;
@ -370,7 +370,7 @@ H_b_args->print(llvm::outs());
printf("H_b_proto: 0x%lx\n", (unsigned long) H_b_proto);
//CHECK: H_b_proto: 0x{{[1-9a-f][0-9a-f]*$}}
H_b_proto->print(llvm::outs());
H_b_proto->print(llvm::errs());
//CHECK-NEXT: void H_b(int vi, double vd) {
//CHECK-NEXT: int x = vi;
//CHECK-NEXT: double y = vd;
@ -387,7 +387,7 @@ const clang::FunctionDecl* H_c1_proto = lookup.findFunctionProto(namespace_N, "H
printf("H_c1_args: 0x%lx\n", (unsigned long) H_c1_args);
//CHECK: H_c1_args: 0x{{[1-9a-f][0-9a-f]*$}}
H_c1_args->print(llvm::outs());
H_c1_args->print(llvm::errs());
//CHECK-NEXT: void H_c(int vi, int vj) {
//CHECK-NEXT: int x = vi;
//CHECK-NEXT: int y = vj;
@ -395,7 +395,7 @@ H_c1_args->print(llvm::outs());
printf("H_c1_proto: 0x%lx\n", (unsigned long) H_c1_proto);
//CHECK: H_c1_proto: 0x{{[1-9a-f][0-9a-f]*$}}
H_c1_proto->print(llvm::outs());
H_c1_proto->print(llvm::errs());
//CHECK-NEXT: void H_c(int vi, int vj) {
//CHECK-NEXT: int x = vi;
//CHECK-NEXT: int y = vj;
@ -406,7 +406,7 @@ const clang::FunctionDecl* H_c2_proto = lookup.findFunctionProto(namespace_N, "H
printf("H_c2_args: 0x%lx\n", (unsigned long) H_c2_args);
//CHECK: H_c2_args: 0x{{[1-9a-f][0-9a-f]*$}}
H_c2_args->print(llvm::outs());
H_c2_args->print(llvm::errs());
//CHECK-NEXT: void H_c(int vi, double vd) {
//CHECK-NEXT: int x = vi;
//CHECK-NEXT: double y = vd;
@ -414,7 +414,7 @@ H_c2_args->print(llvm::outs());
printf("H_c2_proto: 0x%lx\n", (unsigned long) H_c2_proto);
//CHECK: H_c2_proto: 0x{{[1-9a-f][0-9a-f]*$}}
H_c2_proto->print(llvm::outs());
H_c2_proto->print(llvm::errs());
//CHECK-NEXT: void H_c(int vi, double vd) {
//CHECK-NEXT: int x = vi;
//CHECK-NEXT: double y = vd;
@ -431,14 +431,14 @@ const clang::FunctionDecl* H_d1_proto = lookup.findFunctionProto(namespace_N, "H
printf("H_d1_args: 0x%lx\n", (unsigned long) H_d1_args);
//CHECK: H_d1_args: 0x{{[1-9a-f][0-9a-f]*$}}
H_d1_args->print(llvm::outs());
H_d1_args->print(llvm::errs());
//CHECK-NEXT: void H_d(int v) {
//CHECK-NEXT: int x = v;
//CHECK-NEXT: }
printf("H_d1_proto: 0x%lx\n", (unsigned long) H_d1_proto);
//CHECK: H_d1_proto: 0x{{[1-9a-f][0-9a-f]*$}}
H_d1_proto->print(llvm::outs());
H_d1_proto->print(llvm::errs());
//CHECK-NEXT: void H_d(int v) {
//CHECK-NEXT: int x = v;
//CHECK-NEXT: }
@ -448,14 +448,14 @@ const clang::FunctionDecl* H_d2_proto = lookup.findFunctionProto(namespace_N, "H
printf("H_d2_args: 0x%lx\n", (unsigned long) H_d2_args);
//CHECK: H_d2_args: 0x{{[1-9a-f][0-9a-f]*$}}
H_d2_args->print(llvm::outs());
H_d2_args->print(llvm::errs());
//CHECK-NEXT: void H_d(double v) {
//CHECK-NEXT: double x = v;
//CHECK-NEXT: }
printf("H_d2_proto: 0x%lx\n", (unsigned long) H_d2_proto);
//CHECK: H_d2_proto: 0x{{[1-9a-f][0-9a-f]*$}}
H_d2_proto->print(llvm::outs());
H_d2_proto->print(llvm::errs());
//CHECK-NEXT: void H_d(double v) {
//CHECK-NEXT: double x = v;
//CHECK-NEXT: }
@ -471,14 +471,14 @@ const clang::FunctionDecl* func_A_f_proto = lookup.findFunctionProto(class_A, "A
printf("func_A_f_args: 0x%lx\n", (unsigned long) func_A_f_args);
//CHECK: func_A_f_args: 0x{{[1-9a-f][0-9a-f]*$}}
func_A_f_args->print(llvm::outs());
func_A_f_args->print(llvm::errs());
//CHECK-NEXT: void A_f() {
//CHECK-NEXT: int x = 1;
//CHECK-NEXT: }
printf("func_A_f_proto: 0x%lx\n", (unsigned long) func_A_f_proto);
//CHECK: func_A_f_proto: 0x{{[1-9a-f][0-9a-f]*$}}
func_A_f_proto->print(llvm::outs());
func_A_f_proto->print(llvm::errs());
//CHECK-NEXT: void A_f() {
//CHECK-NEXT: int x = 1;
//CHECK-NEXT: }
@ -494,14 +494,14 @@ const clang::FunctionDecl* func_A_g_proto = lookup.findFunctionProto(class_A, "A
printf("func_A_g_args: 0x%lx\n", (unsigned long) func_A_g_args);
//CHECK: func_A_g_args: 0x{{[1-9a-f][0-9a-f]*$}}
func_A_g_args->print(llvm::outs());
func_A_g_args->print(llvm::errs());
//CHECK-NEXT: void A_g(int v) {
//CHECK-NEXT: int x = v;
//CHECK-NEXT: }
printf("func_A_g_proto: 0x%lx\n", (unsigned long) func_A_g_proto);
//CHECK: func_A_g_proto: 0x{{[1-9a-f][0-9a-f]*$}}
func_A_g_proto->print(llvm::outs());
func_A_g_proto->print(llvm::errs());
//CHECK-NEXT: void A_g(int v) {
//CHECK-NEXT: int x = v;
//CHECK-NEXT: }
@ -517,7 +517,7 @@ const clang::FunctionDecl* func_A_h_proto = lookup.findFunctionProto(class_A, "A
printf("func_A_h_args: 0x%lx\n", (unsigned long) func_A_h_args);
//CHECK: func_A_h_args: 0x{{[1-9a-f][0-9a-f]*$}}
func_A_h_args->print(llvm::outs());
func_A_h_args->print(llvm::errs());
//CHECK-NEXT: void A_h(int vi, double vd) {
//CHECK-NEXT: int x = vi;
//CHECK-NEXT: double y = vd;
@ -525,7 +525,7 @@ func_A_h_args->print(llvm::outs());
printf("func_A_h_proto: 0x%lx\n", (unsigned long) func_A_h_proto);
//CHECK: func_A_h_proto: 0x{{[1-9a-f][0-9a-f]*$}}
func_A_h_proto->print(llvm::outs());
func_A_h_proto->print(llvm::errs());
//CHECK-NEXT: void A_h(int vi, double vd) {
//CHECK-NEXT: int x = vi;
//CHECK-NEXT: double y = vd;
@ -542,7 +542,7 @@ const clang::FunctionDecl* func_A_j1_proto = lookup.findFunctionProto(class_A, "
printf("func_A_j1_args: 0x%lx\n", (unsigned long) func_A_j1_args);
//CHECK: func_A_j1_args: 0x{{[1-9a-f][0-9a-f]*$}}
func_A_j1_args->print(llvm::outs());
func_A_j1_args->print(llvm::errs());
//CHECK-NEXT: void A_j(int vi, int vj) {
//CHECK-NEXT: int x = vi;
//CHECK-NEXT: int y = vj;
@ -550,7 +550,7 @@ func_A_j1_args->print(llvm::outs());
printf("func_A_j1_proto: 0x%lx\n", (unsigned long) func_A_j1_proto);
//CHECK: func_A_j1_proto: 0x{{[1-9a-f][0-9a-f]*$}}
func_A_j1_proto->print(llvm::outs());
func_A_j1_proto->print(llvm::errs());
//CHECK-NEXT: void A_j(int vi, int vj) {
//CHECK-NEXT: int x = vi;
//CHECK-NEXT: int y = vj;
@ -561,7 +561,7 @@ const clang::FunctionDecl* func_A_j2_proto = lookup.findFunctionProto(class_A, "
printf("func_A_j2_args: 0x%lx\n", (unsigned long) func_A_j2_args);
//CHECK: func_A_j2_args: 0x{{[1-9a-f][0-9a-f]*$}}
func_A_j2_args->print(llvm::outs());
func_A_j2_args->print(llvm::errs());
//CHECK-NEXT: void A_j(int vi, double vd) {
//CHECK-NEXT: int x = vi;
//CHECK-NEXT: double y = vd;
@ -569,7 +569,7 @@ func_A_j2_args->print(llvm::outs());
printf("func_A_j2_proto: 0x%lx\n", (unsigned long) func_A_j2_proto);
//CHECK: func_A_j2_proto: 0x{{[1-9a-f][0-9a-f]*$}}
func_A_j2_proto->print(llvm::outs());
func_A_j2_proto->print(llvm::errs());
//CHECK-NEXT: void A_j(int vi, double vd) {
//CHECK-NEXT: int x = vi;
//CHECK-NEXT: double y = vd;
@ -586,14 +586,14 @@ const clang::FunctionDecl* func_A_k1_proto = lookup.findFunctionProto(class_A, "
printf("func_A_k1_args: 0x%lx\n", (unsigned long) func_A_k1_args);
//CHECK: func_A_k1_args: 0x{{[1-9a-f][0-9a-f]*$}}
func_A_k1_args->print(llvm::outs());
func_A_k1_args->print(llvm::errs());
//CHECK-NEXT: void A_k(int v) {
//CHECK-NEXT: int x = v;
//CHECK-NEXT: }
printf("func_A_k1_proto: 0x%lx\n", (unsigned long) func_A_k1_proto);
//CHECK: func_A_k1_proto: 0x{{[1-9a-f][0-9a-f]*$}}
func_A_k1_proto->print(llvm::outs());
func_A_k1_proto->print(llvm::errs());
//CHECK-NEXT: void A_k(int v) {
//CHECK-NEXT: int x = v;
//CHECK-NEXT: }
@ -603,14 +603,14 @@ const clang::FunctionDecl* func_A_k2_proto = lookup.findFunctionProto(class_A, "
printf("func_A_k2_args: 0x%lx\n", (unsigned long) func_A_k2_args);
//CHECK: func_A_k2_args: 0x{{[1-9a-f][0-9a-f]*$}}
func_A_k2_args->print(llvm::outs());
func_A_k2_args->print(llvm::errs());
//CHECK-NEXT: void A_k(double v) {
//CHECK-NEXT: double x = v;
//CHECK-NEXT: }
printf("func_A_k2_proto: 0x%lx\n", (unsigned long) func_A_k2_proto);
//CHECK: func_A_k2_proto: 0x{{[1-9a-f][0-9a-f]*$}}
func_A_k2_proto->print(llvm::outs());
func_A_k2_proto->print(llvm::errs());
//CHECK-NEXT: void A_k(double v) {
//CHECK-NEXT: double x = v;
//CHECK-NEXT: }
@ -626,14 +626,14 @@ const clang::FunctionDecl* func_A_m_proto = lookup.findFunctionProto(class_A, "A
printf("func_A_m_args: 0x%lx\n", (unsigned long) func_A_m_args);
//CHECK: func_A_m_args: 0x{{[1-9a-f][0-9a-f]*$}}
func_A_m_args->print(llvm::outs());
func_A_m_args->print(llvm::errs());
//CHECK-NEXT: void A_m(const int &v) {
//CHECK-NEXT: int y = v;
//CHECK-NEXT: }
printf("func_A_m_proto: 0x%lx\n", (unsigned long) func_A_m_proto);
//CHECK: func_A_m_proto: 0x{{[1-9a-f][0-9a-f]*$}}
func_A_m_proto->print(llvm::outs());
func_A_m_proto->print(llvm::errs());
//CHECK-NEXT: void A_m(const int &v) {
//CHECK-NEXT: int y = v;
//CHECK-NEXT: }
@ -646,14 +646,14 @@ const clang::FunctionDecl* func_A_n_proto = lookup.findFunctionProto(class_A, "A
printf("func_A_n_args: 0x%lx\n", (unsigned long) func_A_n_args);
//CHECK: func_A_n_args: 0x{{[1-9a-f][0-9a-f]*$}}
func_A_n_args->print(llvm::outs());
func_A_n_args->print(llvm::errs());
//CHECK-NEXT: void A_n(B &b) {
//CHECK-NEXT: b.B_f();
//CHECK-NEXT: }
printf("func_A_n_proto: 0x%lx\n", (unsigned long) func_A_n_proto);
//CHECK: func_A_n_proto: 0x{{[1-9a-f][0-9a-f]*$}}
func_A_n_proto->print(llvm::outs());
func_A_n_proto->print(llvm::errs());
//CHECK-NEXT: void A_n(B &b) {
//CHECK-NEXT: b.B_f();
//CHECK-NEXT: }
@ -666,7 +666,7 @@ const clang::FunctionDecl* func_A_n2_proto = lookup.findFunctionProto(class_A, "
printf("func_A_n2_args: 0x%lx\n", (unsigned long) func_A_n2_args);
//CHECK: func_A_n2_args: 0x{{[1-9a-f][0-9a-f]*$}}
func_A_n2_args->print(llvm::outs());
func_A_n2_args->print(llvm::errs());
//CHECK-NEXT: void A_n(const char *msg, int ndim = 0) {
//CHECK-NEXT: if (ndim)
//CHECK-NEXT: ++msg;
@ -674,7 +674,7 @@ func_A_n2_args->print(llvm::outs());
printf("func_A_n2_proto: 0x%lx\n", (unsigned long) func_A_n2_proto);
//CHECK: func_A_n2_proto: 0x{{[1-9a-f][0-9a-f]*$}}
func_A_n2_proto->print(llvm::outs());
func_A_n2_proto->print(llvm::errs());
//CHECK-NEXT: void A_n(const char *msg, int ndim = 0) {
//CHECK-NEXT: if (ndim)
//CHECK-NEXT: ++msg;
@ -690,14 +690,14 @@ const clang::FunctionDecl* func_B_F_proto = lookup.findFunctionProto(class_A, "B
printf("func_B_F_args: 0x%lx\n", (unsigned long) func_B_F_args);
//CHECK: func_B_F_args: 0x{{[1-9a-f][0-9a-f]*$}}
func_B_F_args->print(llvm::outs());
func_B_F_args->print(llvm::errs());
//CHECK-NEXT: void B_f() {
//CHECK-NEXT: int x = 1;
//CHECK-NEXT: }
printf("func_B_F_proto: 0x%lx\n", (unsigned long) func_B_F_proto);
//CHECK: func_B_F_proto: 0x{{[1-9a-f][0-9a-f]*$}}
func_B_F_proto->print(llvm::outs());
func_B_F_proto->print(llvm::errs());
//CHECK-NEXT: void B_f() {
//CHECK-NEXT: int x = 1;
//CHECK-NEXT: }
@ -713,14 +713,14 @@ const clang::FunctionDecl* func_B_G_proto = lookup.findFunctionProto(class_A, "B
printf("func_B_G_args: 0x%lx\n", (unsigned long) func_B_G_args);
//CHECK: func_B_G_args: 0x{{[1-9a-f][0-9a-f]*$}}
func_B_G_args->print(llvm::outs());
func_B_G_args->print(llvm::errs());
//CHECK-NEXT: void B_g(int v) {
//CHECK-NEXT: int x = v;
//CHECK-NEXT: }
printf("func_B_G_proto: 0x%lx\n", (unsigned long) func_B_G_proto);
//CHECK: func_B_G_proto: 0x{{[1-9a-f][0-9a-f]*$}}
func_B_G_proto->print(llvm::outs());
func_B_G_proto->print(llvm::errs());
//CHECK-NEXT: void B_g(int v) {
//CHECK-NEXT: int x = v;
//CHECK-NEXT: }
@ -737,7 +737,7 @@ const clang::FunctionDecl* func_B_h_proto = lookup.findFunctionProto(class_A, "B
printf("func_B_h_args: 0x%lx\n", (unsigned long) func_B_h_args);
//CHECK: func_B_h_args: 0x{{[1-9a-f][0-9a-f]*$}}
func_B_h_args->print(llvm::outs());
func_B_h_args->print(llvm::errs());
//CHECK-NEXT: void B_h(int vi, double vd) {
//CHECK-NEXT: int x = vi;
//CHECK-NEXT: double y = vd;
@ -745,7 +745,7 @@ func_B_h_args->print(llvm::outs());
printf("func_B_h_proto: 0x%lx\n", (unsigned long) func_B_h_proto);
//CHECK: func_B_h_proto: 0x{{[1-9a-f][0-9a-f]*$}}
func_B_h_proto->print(llvm::outs());
func_B_h_proto->print(llvm::errs());
//CHECK-NEXT: void B_h(int vi, double vd) {
//CHECK-NEXT: int x = vi;
//CHECK-NEXT: double y = vd;
@ -762,7 +762,7 @@ const clang::FunctionDecl* func_B_j1_proto = lookup.findFunctionProto(class_A, "
printf("func_B_j1_args: 0x%lx\n", (unsigned long) func_B_j1_args);
//CHECK: func_B_j1_args: 0x{{[1-9a-f][0-9a-f]*$}}
func_B_j1_args->print(llvm::outs());
func_B_j1_args->print(llvm::errs());
//CHECK-NEXT: void B_j(int vi, int vj) {
//CHECK-NEXT: int x = vi;
//CHECK-NEXT: int y = vj;
@ -770,7 +770,7 @@ func_B_j1_args->print(llvm::outs());
printf("func_B_j1_proto: 0x%lx\n", (unsigned long) func_B_j1_proto);
//CHECK: func_B_j1_proto: 0x{{[1-9a-f][0-9a-f]*$}}
func_B_j1_proto->print(llvm::outs());
func_B_j1_proto->print(llvm::errs());
//CHECK-NEXT: void B_j(int vi, int vj) {
//CHECK-NEXT: int x = vi;
//CHECK-NEXT: int y = vj;
@ -781,7 +781,7 @@ const clang::FunctionDecl* func_B_j2_proto = lookup.findFunctionProto(class_A, "
printf("func_B_j2_args: 0x%lx\n", (unsigned long) func_B_j2_args);
//CHECK: func_B_j2_args: 0x{{[1-9a-f][0-9a-f]*$}}
func_B_j2_args->print(llvm::outs());
func_B_j2_args->print(llvm::errs());
//CHECK-NEXT: void B_j(int vi, double vd) {
//CHECK-NEXT: int x = vi;
//CHECK-NEXT: double y = vd;
@ -789,7 +789,7 @@ func_B_j2_args->print(llvm::outs());
printf("func_B_j2_proto: 0x%lx\n", (unsigned long) func_B_j2_proto);
//CHECK: func_B_j2_proto: 0x{{[1-9a-f][0-9a-f]*$}}
func_B_j2_proto->print(llvm::outs());
func_B_j2_proto->print(llvm::errs());
//CHECK-NEXT: void B_j(int vi, double vd) {
//CHECK-NEXT: int x = vi;
//CHECK-NEXT: double y = vd;
@ -806,14 +806,14 @@ const clang::FunctionDecl* func_B_k1_proto = lookup.findFunctionProto(class_A, "
printf("func_B_k1_args: 0x%lx\n", (unsigned long) func_B_k1_args);
//CHECK: func_B_k1_args: 0x{{[1-9a-f][0-9a-f]*$}}
func_B_k1_args->print(llvm::outs());
func_B_k1_args->print(llvm::errs());
//CHECK-NEXT: void B_k(int v) {
//CHECK-NEXT: int x = v;
//CHECK-NEXT: }
printf("func_B_k1_proto: 0x%lx\n", (unsigned long) func_B_k1_proto);
//CHECK: func_B_k1_proto: 0x{{[1-9a-f][0-9a-f]*$}}
func_B_k1_proto->print(llvm::outs());
func_B_k1_proto->print(llvm::errs());
//CHECK-NEXT: void B_k(int v) {
//CHECK-NEXT: int x = v;
//CHECK-NEXT: }
@ -823,14 +823,14 @@ const clang::FunctionDecl* func_B_k2_proto = lookup.findFunctionProto(class_A, "
printf("func_B_k2_args: 0x%lx\n", (unsigned long) func_B_k2_args);
//CHECK: func_B_k2_args: 0x{{[1-9a-f][0-9a-f]*$}}
func_B_k2_args->print(llvm::outs());
func_B_k2_args->print(llvm::errs());
//CHECK-NEXT: void B_k(double v) {
//CHECK-NEXT: double x = v;
//CHECK-NEXT: }
printf("func_B_k2_proto: 0x%lx\n", (unsigned long) func_B_k2_proto);
//CHECK: func_B_k2_proto: 0x{{[1-9a-f][0-9a-f]*$}}
func_B_k2_proto->print(llvm::outs());
func_B_k2_proto->print(llvm::errs());
//CHECK-NEXT: void B_k(double v) {
//CHECK-NEXT: double x = v;
//CHECK-NEXT: }
@ -846,14 +846,14 @@ const clang::FunctionDecl* func_B_m_proto = lookup.findFunctionProto(class_A, "B
printf("func_B_m_args: 0x%lx\n", (unsigned long) func_B_m_args);
//CHECK: func_B_m_args: 0x{{[1-9a-f][0-9a-f]*$}}
func_B_m_args->print(llvm::outs());
func_B_m_args->print(llvm::errs());
//CHECK-NEXT: void B_m(const int &v) {
//CHECK-NEXT: int y = v;
//CHECK-NEXT: }
printf("func_B_m_proto: 0x%lx\n", (unsigned long) func_B_m_proto);
//CHECK: func_B_m_proto: 0x{{[1-9a-f][0-9a-f]*$}}
func_B_m_proto->print(llvm::outs());
func_B_m_proto->print(llvm::errs());
//CHECK-NEXT: void B_m(const int &v) {
//CHECK-NEXT: int y = v;
//CHECK-NEXT: }
@ -870,14 +870,14 @@ const clang::FunctionDecl* func_B_ctr1_proto = lookup.findFunctionProto(class_B,
printf("func_B_ctr1_args: 0x%lx\n", (unsigned long) func_B_ctr1_args);
//CHECK: func_B_ctr1_args: 0x{{[1-9a-f][0-9a-f]*$}}
func_B_ctr1_args->print(llvm::outs());
func_B_ctr1_args->print(llvm::errs());
//CHECK-NEXT: B() : m_B_i(0), m_B_d(0.), m_B_ip(0) {
//CHECK-NEXT: }
printf("func_B_ctr1_proto: 0x%lx\n", (unsigned long) func_B_ctr1_proto);
//CHECK: func_B_ctr1_proto: 0x{{[1-9a-f][0-9a-f]*$}}
func_B_ctr1_proto->print(llvm::outs());
func_B_ctr1_proto->print(llvm::errs());
//CHECK-NEXT: B() : m_B_i(0), m_B_d(0.), m_B_ip(0) {
//CHECK-NEXT: }
@ -887,14 +887,14 @@ const clang::FunctionDecl* func_B_ctr2_proto = lookup.findFunctionProto(class_B,
printf("func_B_ctr2_args: 0x%lx\n", (unsigned long) func_B_ctr2_args);
//CHECK: func_B_ctr2_args: 0x{{[1-9a-f][0-9a-f]*$}}
func_B_ctr2_args->print(llvm::outs());
func_B_ctr2_args->print(llvm::errs());
//CHECK-NEXT: B(int vi, double vd) : m_B_i(vi), m_B_d(vd), m_B_ip(0) {
//CHECK-NEXT: }
printf("func_B_ctr2_proto: 0x%lx\n", (unsigned long) func_B_ctr2_proto);
//CHECK: func_B_ctr2_proto: 0x{{[1-9a-f][0-9a-f]*$}}
func_B_ctr2_proto->print(llvm::outs());
func_B_ctr2_proto->print(llvm::errs());
//CHECK-NEXT: B(int vi, double vd) : m_B_i(vi), m_B_d(vd), m_B_ip(0) {
//CHECK-NEXT: }
@ -910,7 +910,7 @@ cast<clang::NamedDecl>(func_B_ctr3_args)->getNameForDiagnostic(buf, Policy, /*Qu
printf("func_B_ctr3_args name: %s\n", buf.c_str());
//CHECK-NEXT: func_B_ctr3_args name: B::B<char>
func_B_ctr3_args->print(llvm::outs());
func_B_ctr3_args->print(llvm::errs());
//CHECK-NEXT: {
//CHECK-NEXT: this->m_B_i = (char)v;
//CHECK-NEXT: }
@ -923,7 +923,7 @@ cast<clang::NamedDecl>(func_B_ctr3_proto)->getNameForDiagnostic(buf, Policy, /*Q
printf("func_B_ctr3_proto name: %s\n", buf.c_str());
//CHECK-NEXT: func_B_ctr3_proto name: B::B<char>
func_B_ctr3_proto->print(llvm::outs());
func_B_ctr3_proto->print(llvm::errs());
//CHECK-NEXT: {
//CHECK-NEXT: this->m_B_i = (char)v;
//CHECK-NEXT: }
@ -940,7 +940,7 @@ cast<clang::NamedDecl>(func_B_ctr4_args)->getNameForDiagnostic(buf, Policy, /*Qu
printf("func_B_ctr4_args name: %s\n", buf.c_str());
//CHECK-NEXT: func_B_ctr4_args name: B::B<char>
func_B_ctr4_args->print(llvm::outs());
func_B_ctr4_args->print(llvm::errs());
//CHECK-NEXT: B(char *v) : m_B_i(0), m_B_d(0.), m_B_ip(0) {
//CHECK-NEXT: this->m_B_i = (long)(char *)v;
//CHECK-NEXT: this->m_B_d = 1.;
@ -956,7 +956,7 @@ printf("func_B_ctr4_proto name: %s\n", buf.c_str());
printf("func_B_ctr4_proto has body: %d\n", func_B_ctr4_proto->hasBody());
//CHECK-NEXT: func_B_ctr4_proto has body: 1
func_B_ctr4_proto->print(llvm::outs());
func_B_ctr4_proto->print(llvm::errs());
//CHECK-NEXT: B(char *v) : m_B_i(0), m_B_d(0.), m_B_ip(0) {
//CHECK-NEXT: this->m_B_i = (long)(char *)v;
//CHECK-NEXT: this->m_B_d = 1.;
@ -977,7 +977,7 @@ cast<clang::NamedDecl>(func_B_dtr_args)->getNameForDiagnostic(buf, Policy, /*Qua
printf("func_B_dtr_args name: %s\n", buf.c_str());
//CHECK-NEXT: func_B_dtr_args name: B::~B
func_B_dtr_args->print(llvm::outs());
func_B_dtr_args->print(llvm::errs());
//CHECK-NEXT: virtual void ~B() {
//CHECK-NEXT: delete this->m_B_ip;
//CHECK-NEXT: this->m_B_ip = 0;
@ -991,7 +991,7 @@ cast<clang::NamedDecl>(func_B_dtr_proto)->getNameForDiagnostic(buf, Policy, /*Qu
printf("func_B_dtr_proto name: %s\n", buf.c_str());
//CHECK-NEXT: func_B_dtr_proto name: B::~B
func_B_dtr_proto->print(llvm::outs());
func_B_dtr_proto->print(llvm::errs());
//CHECK-NEXT: virtual void ~B() {
//CHECK-NEXT: delete this->m_B_ip;
//CHECK-NEXT: this->m_B_ip = 0;
@ -1014,7 +1014,7 @@ cast<clang::NamedDecl>(func_B_new_args)->getNameForDiagnostic(buf, Policy, /*Qua
printf("func_B_new_args name: %s\n", buf.c_str());
//CHECK-NEXT: func_B_new_args name: B::operator new
func_B_new_args->print(llvm::outs());
func_B_new_args->print(llvm::errs());
//CHECK-NEXT: void *operator new(std::size_t sz) {
//CHECK-NEXT: return ::operator new(sz);
//CHECK-NEXT: }
@ -1027,7 +1027,7 @@ cast<clang::NamedDecl>(func_B_new_proto)->getNameForDiagnostic(buf, Policy, /*Qu
printf("func_B_new_proto name: %s\n", buf.c_str());
//CHECK-NEXT: func_B_new_proto name: B::operator new
func_B_new_proto->print(llvm::outs());
func_B_new_proto->print(llvm::errs());
//CHECK-NEXT: void *operator new(std::size_t sz) {
//CHECK-NEXT: return ::operator new(sz);
//CHECK-NEXT: }
@ -1043,7 +1043,7 @@ cast<clang::NamedDecl>(func_B_new_plcmt_args)->getNameForDiagnostic(buf, Policy,
printf("func_B_new_plcmt_args name: %s\n", buf.c_str());
//CHECK-NEXT: func_B_new_plcmt_args name: B::operator new
func_B_new_plcmt_args->print(llvm::outs());
func_B_new_plcmt_args->print(llvm::errs());
//CHECK-NEXT: void *operator new(std::size_t sz, void *arena) {
//CHECK-NEXT: return arena;
//CHECK-NEXT: }
@ -1056,7 +1056,7 @@ cast<clang::NamedDecl>(func_B_new_plcmt_proto)->getNameForDiagnostic(buf, Policy
printf("func_B_new_plcmt_proto name: %s\n", buf.c_str());
//CHECK-NEXT: func_B_new_plcmt_proto name: B::operator new
func_B_new_plcmt_proto->print(llvm::outs());
func_B_new_plcmt_proto->print(llvm::errs());
//CHECK-NEXT: void *operator new(std::size_t sz, void *arena) {
//CHECK-NEXT: return arena;
//CHECK-NEXT: }
@ -1072,7 +1072,7 @@ cast<clang::NamedDecl>(func_B_new_ary_args)->getNameForDiagnostic(buf, Policy, /
printf("func_B_new_ary_args name: %s\n", buf.c_str());
//CHECK-NEXT: func_B_new_ary_args name: B::operator new[]
func_B_new_ary_args->print(llvm::outs());
func_B_new_ary_args->print(llvm::errs());
//CHECK-NEXT: void *operator new[](std::size_t sz) {
//CHECK-NEXT: return ::operator new[](sz);
//CHECK-NEXT: }
@ -1085,7 +1085,7 @@ cast<clang::NamedDecl>(func_B_new_ary_proto)->getNameForDiagnostic(buf, Policy,
printf("func_B_new_ary_proto name: %s\n", buf.c_str());
//CHECK-NEXT: func_B_new_ary_proto name: B::operator new[]
func_B_new_ary_proto->print(llvm::outs());
func_B_new_ary_proto->print(llvm::errs());
//CHECK-NEXT: void *operator new[](std::size_t sz) {
//CHECK-NEXT: return ::operator new[](sz);
//CHECK-NEXT: }
@ -1101,7 +1101,7 @@ cast<clang::NamedDecl>(func_B_new_ary_plcmt_args)->getNameForDiagnostic(buf, Pol
printf("func_B_new_ary_plcmt_args name: %s\n", buf.c_str());
//CHECK-NEXT: func_B_new_ary_plcmt_args name: B::operator new[]
func_B_new_ary_plcmt_args->print(llvm::outs());
func_B_new_ary_plcmt_args->print(llvm::errs());
//CHECK-NEXT: void *operator new[](std::size_t sz, void *arena) {
//CHECK-NEXT: return arena;
//CHECK-NEXT: }
@ -1114,7 +1114,7 @@ cast<clang::NamedDecl>(func_B_new_ary_plcmt_proto)->getNameForDiagnostic(buf, Po
printf("func_B_new_ary_plcmt_proto name: %s\n", buf.c_str());
//CHECK-NEXT: func_B_new_ary_plcmt_proto name: B::operator new[]
func_B_new_ary_plcmt_proto->print(llvm::outs());
func_B_new_ary_plcmt_proto->print(llvm::errs());
//CHECK-NEXT: void *operator new[](std::size_t sz, void *arena) {
//CHECK-NEXT: return arena;
//CHECK-NEXT: }
@ -1134,7 +1134,7 @@ cast<clang::NamedDecl>(func_B_del_args)->getNameForDiagnostic(buf, Policy, /*Qua
printf("func_B_del_args name: %s\n", buf.c_str());
//CHECK-NEXT: func_B_del_args name: B::operator delete
func_B_del_args->print(llvm::outs());
func_B_del_args->print(llvm::errs());
//CHECK-NEXT: void operator delete(void *vp) {
//CHECK-NEXT: ::operator delete(vp);
//CHECK-NEXT: }
@ -1147,7 +1147,7 @@ cast<clang::NamedDecl>(func_B_del_proto)->getNameForDiagnostic(buf, Policy, /*Qu
printf("func_B_del_proto name: %s\n", buf.c_str());
//CHECK-NEXT: func_B_del_proto name: B::operator delete
func_B_del_proto->print(llvm::outs());
func_B_del_proto->print(llvm::errs());
//CHECK-NEXT: void operator delete(void *vp) {
//CHECK-NEXT: ::operator delete(vp);
//CHECK-NEXT: }
@ -1163,7 +1163,7 @@ cast<clang::NamedDecl>(func_B_del_plcmt_args)->getNameForDiagnostic(buf, Policy,
printf("func_B_del_plcmt_args name: %s\n", buf.c_str());
//CHECK-NEXT: func_B_del_plcmt_args name: B::operator delete
func_B_del_plcmt_args->print(llvm::outs());
func_B_del_plcmt_args->print(llvm::errs());
//CHECK-NEXT: void operator delete(void *vp, void *arena) {
//CHECK-NEXT: }
@ -1175,7 +1175,7 @@ cast<clang::NamedDecl>(func_B_del_plcmt_proto)->getNameForDiagnostic(buf, Policy
printf("func_B_del_plcmt_proto name: %s\n", buf.c_str());
//CHECK-NEXT: func_B_del_plcmt_proto name: B::operator delete
func_B_del_plcmt_proto->print(llvm::outs());
func_B_del_plcmt_proto->print(llvm::errs());
//CHECK-NEXT: void operator delete(void *vp, void *arena) {
//CHECK-NEXT: }
@ -1190,7 +1190,7 @@ cast<clang::NamedDecl>(func_B_del_ary_args)->getNameForDiagnostic(buf, Policy, /
printf("func_B_del_ary_args name: %s\n", buf.c_str());
//CHECK-NEXT: func_B_del_ary_args name: B::operator delete[]
func_B_del_ary_args->print(llvm::outs());
func_B_del_ary_args->print(llvm::errs());
//CHECK-NEXT: void operator delete[](void *vp) {
//CHECK-NEXT: ::operator delete[](vp);
//CHECK-NEXT: }
@ -1203,7 +1203,7 @@ cast<clang::NamedDecl>(func_B_del_ary_proto)->getNameForDiagnostic(buf, Policy,
printf("func_B_del_ary_proto name: %s\n", buf.c_str());
//CHECK-NEXT: func_B_del_ary_proto name: B::operator delete[]
func_B_del_ary_proto->print(llvm::outs());
func_B_del_ary_proto->print(llvm::errs());
//CHECK-NEXT: void operator delete[](void *vp) {
//CHECK-NEXT: ::operator delete[](vp);
//CHECK-NEXT: }
@ -1219,7 +1219,7 @@ cast<clang::NamedDecl>(func_B_del_ary_plcmt_args)->getNameForDiagnostic(buf, Pol
printf("func_B_del_ary_plcmt_args name: %s\n", buf.c_str());
//CHECK-NEXT: func_B_del_ary_plcmt_args name: B::operator delete[]
func_B_del_ary_plcmt_args->print(llvm::outs());
func_B_del_ary_plcmt_args->print(llvm::errs());
//CHECK-NEXT: void operator delete[](void *vp, void *arena) {
//CHECK-NEXT: }
@ -1231,7 +1231,7 @@ cast<clang::NamedDecl>(func_B_del_ary_plcmt_proto)->getNameForDiagnostic(buf, Po
printf("func_B_del_ary_plcmt_proto name: %s\n", buf.c_str());
//CHECK-NEXT: func_B_del_ary_plcmt_proto name: B::operator delete[]
func_B_del_ary_plcmt_proto->print(llvm::outs());
func_B_del_ary_plcmt_proto->print(llvm::errs());
//CHECK-NEXT: void operator delete[](void *vp, void *arena) {
//CHECK-NEXT: }
@ -1252,7 +1252,7 @@ cast<clang::NamedDecl>(func_B_star_args)->getNameForDiagnostic(buf, Policy, /*Qu
printf("func_B_star_args name: %s\n", buf.c_str());
//CHECK-NEXT: func_B_star_args name: B::operator*
func_B_star_args->print(llvm::outs());
func_B_star_args->print(llvm::errs());
//CHECK-NEXT: B &operator*() {
//CHECK-NEXT: return *this;
//CHECK-NEXT: }
@ -1265,7 +1265,7 @@ cast<clang::NamedDecl>(func_B_star_proto)->getNameForDiagnostic(buf, Policy, /*Q
printf("func_B_star_proto name: %s\n", buf.c_str());
//CHECK-NEXT: func_B_star_proto name: B::operator*
func_B_star_proto->print(llvm::outs());
func_B_star_proto->print(llvm::errs());
//CHECK-NEXT: B &operator*() {
//CHECK-NEXT: return *this;
//CHECK-NEXT: }
@ -1287,7 +1287,7 @@ cast<clang::NamedDecl>(func_B_plus_args)->getNameForDiagnostic(buf, Policy, /*Qu
printf("func_B_plus_args name: %s\n", buf.c_str());
//CHECK-NEXT: func_B_plus_args name: B::operator+
func_B_plus_args->print(llvm::outs());
func_B_plus_args->print(llvm::errs());
//CHECK-NEXT: B operator+(B b) {
//CHECK-NEXT: return b;
//CHECK-NEXT: }
@ -1300,7 +1300,7 @@ cast<clang::NamedDecl>(func_B_plus_proto)->getNameForDiagnostic(buf, Policy, /*Q
printf("func_B_plus_proto name: %s\n", buf.c_str());
//CHECK-NEXT: func_B_plus_proto name: B::operator+
func_B_plus_proto->print(llvm::outs());
func_B_plus_proto->print(llvm::errs());
//CHECK-NEXT: B operator+(B b) {
//CHECK-NEXT: return b;
//CHECK-NEXT: }

View File

@ -1,5 +1,4 @@
// RUN: cat %s | %cling | FileCheck %s
// XFAIL: *
// Checks:
// Savannah #99210 https://savannah.cern.ch/bugs/index.php?99210
@ -40,10 +39,6 @@ RAII R2(42);R2.incr();int res2 = R2.get()
// CHECK: 43
.q
// This fails due to printf not printing into stdout at destruction time
// but into some other file stream that happens to end up in the terminal
// but cannot be piped.
// Likely bug https://savannah.cern.ch/bugs/?99234
// CHECK: ~RAII2
// CHECK: ~RAII1
// Enforce that only two objects got ever constructed: