本文整理汇总了C++中llvm::OwningPtr::reset方法的典型用法代码示例。如果您正苦于以下问题:C++ OwningPtr::reset方法的具体用法?C++ OwningPtr::reset怎么用?C++ OwningPtr::reset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类llvm::OwningPtr
的用法示例。
在下文中一共展示了OwningPtr::reset方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getMangledName
std::string getMangledName(FunctionDecl* FD) {
// Copied from Interpreter.cpp;
if (!m_MangleCtx)
m_MangleCtx.reset(FD->getASTContext().createMangleContext());
std::string mangledName;
if (m_MangleCtx->shouldMangleDeclName(FD)) {
llvm::raw_string_ostream RawStr(mangledName);
switch(FD->getKind()) {
case Decl::CXXConstructor:
//Ctor_Complete, // Complete object ctor
//Ctor_Base, // Base object ctor
//Ctor_CompleteAllocating // Complete object allocating ctor (unused)
m_MangleCtx->mangleCXXCtor(cast<CXXConstructorDecl>(FD),
Ctor_Complete, RawStr);
break;
case Decl::CXXDestructor:
//Dtor_Deleting, // Deleting dtor
//Dtor_Complete, // Complete object dtor
//Dtor_Base // Base object dtor
m_MangleCtx->mangleCXXDtor(cast<CXXDestructorDecl>(FD),
Dtor_Complete, RawStr);
break;
default :
m_MangleCtx->mangleName(FD, RawStr);
break;
}
RawStr.flush();
} else {
mangledName = FD->getNameAsString();
}
return mangledName;
}
示例2: aravdebug
aravdebug(const char * userfile, int lineno, const char *PATH) {
dataPath = getenv("DLOG_OUTPUT_FOLDER") + std::string(PATH);
//llvm::errs()<<"Data path ::"<<dataPath;
datatempPath = dataPath + ".temp";
// tagPath = dataPath + ".tag";
std::string syscall = "rm -f " + dataPath;
int status = system(syscall.c_str());
if (status < 0)
std::cout << "DLOG Error: " << strerror(errno) << '\n';
OS.reset((new llvm::raw_fd_ostream(datatempPath.c_str(), ErrorInfo)));
llvm::errs() << ErrorInfo;
id = gid++;
//llvm::errs()<<"created DLOG with id "<<id<<"\n";
tagset.insert("SYSTEM");
(*OS) << DIV("SYSTEM")<< "Created Debugger " << GREEN(id)
<< CALLINFO
<< EDIV;
tagset.insert("CALLINFO");
(*OS).flush();
}
示例3: Initialize
virtual void Initialize(ASTContext &Ctx) {
Context = &Ctx;
if (llvm::TimePassesIsEnabled)
LLVMIRGeneration.startTimer();
Gen->Initialize(Ctx);
TheModule.reset(Gen->GetModule());
if (llvm::TimePassesIsEnabled)
LLVMIRGeneration.stopTimer();
}
示例4: create
llvm::error_code FileOutputBuffer::create(FileHandle& pFileHandle,
size_t pSize, llvm::OwningPtr<FileOutputBuffer>& pResult)
{
llvm::error_code EC;
llvm::OwningPtr<mapped_file_region> mapped_file(new mapped_file_region(
pFileHandle.handler(),
false,
mapped_file_region::readwrite,
pSize,
0,
EC));
if (EC)
return EC;
pResult.reset(new FileOutputBuffer(mapped_file.get(), pFileHandle));
if (pResult)
mapped_file.take();
return llvm::error_code::success();
}
示例5: SetUpBuildDumpLog
static void SetUpBuildDumpLog(const DiagnosticOptions &DiagOpts,
unsigned argc, char **argv,
llvm::OwningPtr<DiagnosticClient> &DiagClient) {
std::string ErrorInfo;
llvm::raw_ostream *OS =
new llvm::raw_fd_ostream(DiagOpts.DumpBuildInformation.c_str(), ErrorInfo);
if (!ErrorInfo.empty()) {
// FIXME: Do not fail like this.
llvm::errs() << "error opening -dump-build-information file '"
<< DiagOpts.DumpBuildInformation << "', option ignored!\n";
delete OS;
return;
}
(*OS) << "clang -cc1 command line arguments: ";
for (unsigned i = 0; i != argc; ++i)
(*OS) << argv[i] << ' ';
(*OS) << '\n';
// Chain in a diagnostic client which will log the diagnostics.
DiagnosticClient *Logger =
new TextDiagnosticPrinter(*OS, DiagOpts, /*OwnsOutputStream=*/true);
DiagClient.reset(new ChainedDiagnosticClient(DiagClient.take(), Logger));
}
示例6: LazyInitialize
static inline void LazyInitialize(llvm::OwningPtr<BugType> &BT,
const char *name) {
if (BT)
return;
BT.reset(new BugType(name, "Unix API"));
}
示例7: DIV
~aravdebug() {
//llvm::errs()<<"Datapath "<<dataPath.c_str()<<"\n";
//llvm::errs()<<"datatempPath "<<datatempPath.c_str()<<"\n";
int status;
std::fstream fwrite;
fwrite.open(dataPath.c_str(), std::fstream::out);
fwrite
<< "<head>\n"
"<script type='text/javascript' src='js/aravind.js' ></script>\n"
"<script type='text/javascript' src='js/jquery-2.0.3.min.js'></script>\n";
fwrite
<< "<script type=\"text/javascript\">"
"$(document).ready(function() {"
"$(\"ar_menu\").click(function(){"
"$(this).toggleClass(\"active\");"
"$(this).next(\"div\").stop('true','true').slideToggle(\"500\");"
"});"
"});"
"</script>\n";
fwrite << "\n</head>\n ";
fwrite
<< "<body>\n"
"<style>div.floating-menu {background:#fff4c8;border:1px solid #ffcc00;width:150px;margin-top:5px;margin-bottom:10px; } "
"div.floating-menu a, div.floating-menu h3 {display:block;margin:0 0.5em;} </style>";
fwrite
<< "<style>"
"div.floating-container{top:35%;left:75%;position:fixed;z-index:100;}\n"
"div.floating-container ar_menu:hover{background:#FFFFE0}\n"
"div.floating-container ar_menu{list-style-type:none; cursor:pointer; border-top:2px solid #666666; border-bottom:2px solid #666666;padding:2px 2px 2px 2px;margin-top:10px;}\n"
"div.floating-container ar_menu div:hover{text-decoration:none !important;}\n"
"div.floating-container ar_menu:before {content: \" + \"; \n"
"padding:0px 5px 1px 5px; color:red; font-weight:bold;background:#4A5A6D}\n"
"div.floating-container ar_menu.active:before {content: \" - \";\n"
" padding:0px 5px 1px 5px; color:red; font-weight:bold;background:#4A5A6D}\n"
".floating-topic{background:#B7B8B5;display: inline-block; width:125px;margin-bottom:5px;}\n"
"</style>\n";
fwrite << DIV("floating-container");
auto it = tagset.begin();
//for callinfo
fwrite
<< "<ar_menu><span class=\"floating-topic\"><b> Extra info</b></span></ar_menu>\n";
fwrite << "<div class=\"floating-menu\">" << CHKBOX(*it) << EDIV;
//for avoiding collapsing problem
fwrite << DIV("") << EDIV;
//tags begin here
fwrite
<< "<ar_menu><span class=\"floating-topic\"><b> Tags</b></span></ar_menu>\n";
fwrite << "<div class=\"floating-menu\">";
++it;
for (; it != tagset.end(); ++it) {
fwrite << CHKBOX(*it);
}
fwrite
<< "<input id=\"clickMe\" type=\"button\" value=\"ALL\" onclick=\"toggle_chk_true(this);\" />\n";
fwrite
<< "<input id=\"clickMe\" type=\"button\" value=\"NONE\" onclick=\"toggle_chk_false(this);\" />"
<< mendl;
fwrite << EDIV;
fwrite << EDIV; //container
(*OS) << DIV("SYSTEM")<< br << "Destroyed Debugger " << GREEN(id)
<< EDIV;
fwrite << "</body> </html>";
fwrite.close();
if (!system(NULL))
(*OS) << RED("System command failed in debugger\n");
OS.reset(NULL);
std::string syscommand = "cat " + datatempPath + " >> " + dataPath;
//llvm::errs()<<syscommand;
status = system(syscommand.c_str());
if (status < 0)
std::cout << "DLOG Error: " << strerror(errno) << '\n';
syscommand = "rm -f " + datatempPath;
status = system(syscommand.c_str());
if (status < 0)
std::cout << "DLOG Error: " << strerror(errno) << '\n';
unsigned found = datatempPath.find_last_of("/\\");
//.........这里部分代码省略.........