Do NOT use inline functions with LLVM_ATTRIBUTE_USED.

The function will be emitted into every single TU including the header!

llvm-svn: 161872
This commit is contained in:
Benjamin Kramer 2012-08-14 14:50:32 +00:00
parent bf479714f9
commit 9299d8c298
5 changed files with 16 additions and 3 deletions

View File

@ -858,10 +858,10 @@ public:
raw_ostream &Out, const PrintingPolicy &Policy,
unsigned Indentation = 0);
// Debuggers don't usually respect default arguments.
LLVM_ATTRIBUTE_USED void dump() const { dump(llvm::errs()); }
LLVM_ATTRIBUTE_USED void dump() const;
void dump(raw_ostream &Out) const;
// Debuggers don't usually respect default arguments.
LLVM_ATTRIBUTE_USED void dumpXML() const { dumpXML(llvm::errs()); }
LLVM_ATTRIBUTE_USED void dumpXML() const;
void dumpXML(raw_ostream &OS) const;
private:

View File

@ -328,7 +328,7 @@ public:
// For debugging purposes only
void dump(raw_ostream &Out) const;
LLVM_ATTRIBUTE_USED void dump() const { dump(llvm::errs()); }
LLVM_ATTRIBUTE_USED void dump() const;
static bool classof(const CallEvent *) { return true; }
};

View File

@ -175,6 +175,10 @@ void DeclContext::dumpDeclContext() const {
Printer.VisitDeclContext(const_cast<DeclContext *>(this), /*Indent=*/false);
}
void Decl::dump() const {
dump(llvm::errs());
}
void Decl::dump(raw_ostream &Out) const {
PrintingPolicy Policy = getASTContext().getPrintingPolicy();
Policy.Dump = true;

View File

@ -1022,12 +1022,17 @@ struct XMLDumper : public XMLDeclVisitor<XMLDumper>,
};
}
void Decl::dumpXML() const {
dump(llvm::errs());
}
void Decl::dumpXML(raw_ostream &out) const {
XMLDumper(out, getASTContext()).dispatch(const_cast<Decl*>(this));
}
#else /* ifndef NDEBUG */
void Decl::dumpXML() const {}
void Decl::dumpXML(raw_ostream &out) const {}
#endif

View File

@ -207,6 +207,10 @@ SourceRange CallEvent::getArgSourceRange(unsigned Index) const {
return ArgE->getSourceRange();
}
void CallEvent::dump() const {
dump(llvm::errs());
}
void CallEvent::dump(raw_ostream &Out) const {
ASTContext &Ctx = getState()->getStateManager().getContext();
if (const Expr *E = getOriginExpr()) {