diff options
author | Alp Toker <alp@nuanti.com> | 2014-01-04 13:47:14 +0000 |
---|---|---|
committer | Alp Toker <alp@nuanti.com> | 2014-01-04 13:47:14 +0000 |
commit | ef6b007dc5ff1290d48d71736fc5dc0f4c154331 (patch) | |
tree | 026adff363cfa2db801c13f8e6eb62bbe7141ab8 /clang/lib/Basic/SourceLocation.cpp | |
parent | c2dee7dc742f518fdd57d3c357cb28b2d2ffe79f (diff) | |
download | llvm-ef6b007dc5ff1290d48d71736fc5dc0f4c154331.zip llvm-ef6b007dc5ff1290d48d71736fc5dc0f4c154331.tar.gz llvm-ef6b007dc5ff1290d48d71736fc5dc0f4c154331.tar.bz2 |
Only mark dump() function definitions 'used' in debug builds
This has the dual effect of (1) enabling more dead-stripping in release builds
and (2) ensuring that debug helper functions aren't stripped away in debug
builds, as they're intended to be called from the debugger.
Note that the attribute is applied to definitions rather than declarations in
headers going forward because it's now conditional on NDEBUG:
/// \brief Mark debug helper function definitions like dump() that should not be
/// stripped from debug builds.
Requires corresponding macro added in LLVM r198456.
llvm-svn: 198489
Diffstat (limited to 'clang/lib/Basic/SourceLocation.cpp')
-rw-r--r-- | clang/lib/Basic/SourceLocation.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/clang/lib/Basic/SourceLocation.cpp b/clang/lib/Basic/SourceLocation.cpp index 1822091..0c06a48 100644 --- a/clang/lib/Basic/SourceLocation.cpp +++ b/clang/lib/Basic/SourceLocation.cpp @@ -61,14 +61,15 @@ void SourceLocation::print(raw_ostream &OS, const SourceManager &SM)const{ OS << '>'; } -std::string SourceLocation::printToString(const SourceManager &SM) const { +LLVM_DUMP_METHOD std::string +SourceLocation::printToString(const SourceManager &SM) const { std::string S; llvm::raw_string_ostream OS(S); print(OS, SM); return OS.str(); } -void SourceLocation::dump(const SourceManager &SM) const { +LLVM_DUMP_METHOD void SourceLocation::dump(const SourceManager &SM) const { print(llvm::errs(), SM); } @@ -122,7 +123,7 @@ bool FullSourceLoc::isBeforeInTranslationUnitThan(SourceLocation Loc) const { return SrcMgr->isBeforeInTranslationUnit(*this, Loc); } -void FullSourceLoc::dump() const { +LLVM_DUMP_METHOD void FullSourceLoc::dump() const { SourceLocation::dump(*SrcMgr); } |