From 89a19ac38d377e880b26dfacf968951fa4108a8f Mon Sep 17 00:00:00 2001 From: Aaron Smith Date: Fri, 23 Feb 2018 00:02:27 +0000 Subject: [PATCH] [PDB] Check the result of setLoadAddress() Summary: Change setLoadAddress() to return true or false on failure. Reviewers: zturner, llvm-commits Reviewed By: zturner Differential Revision: https://reviews.llvm.org/D43638 llvm-svn: 325843 --- llvm/include/llvm/DebugInfo/PDB/DIA/DIASession.h | 2 +- llvm/include/llvm/DebugInfo/PDB/IPDBSession.h | 2 +- llvm/include/llvm/DebugInfo/PDB/Native/NativeSession.h | 2 +- llvm/lib/DebugInfo/PDB/DIA/DIASession.cpp | 4 ++-- llvm/lib/DebugInfo/PDB/Native/NativeSession.cpp | 2 +- llvm/unittests/DebugInfo/PDB/PDBApiTest.cpp | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/llvm/include/llvm/DebugInfo/PDB/DIA/DIASession.h b/llvm/include/llvm/DebugInfo/PDB/DIA/DIASession.h index 66bd7a7e9c4e..9aeb8bf103b3 100644 --- a/llvm/include/llvm/DebugInfo/PDB/DIA/DIASession.h +++ b/llvm/include/llvm/DebugInfo/PDB/DIA/DIASession.h @@ -30,7 +30,7 @@ public: std::unique_ptr &Session); uint64_t getLoadAddress() const override; - void setLoadAddress(uint64_t Address) override; + bool setLoadAddress(uint64_t Address) override; std::unique_ptr getGlobalScope() override; std::unique_ptr getSymbolById(uint32_t SymbolId) const override; diff --git a/llvm/include/llvm/DebugInfo/PDB/IPDBSession.h b/llvm/include/llvm/DebugInfo/PDB/IPDBSession.h index 6291289de5bf..ce7dec5e8a02 100644 --- a/llvm/include/llvm/DebugInfo/PDB/IPDBSession.h +++ b/llvm/include/llvm/DebugInfo/PDB/IPDBSession.h @@ -28,7 +28,7 @@ public: virtual ~IPDBSession(); virtual uint64_t getLoadAddress() const = 0; - virtual void setLoadAddress(uint64_t Address) = 0; + virtual bool setLoadAddress(uint64_t Address) = 0; virtual std::unique_ptr getGlobalScope() = 0; virtual std::unique_ptr getSymbolById(uint32_t SymbolId) const = 0; diff --git a/llvm/include/llvm/DebugInfo/PDB/Native/NativeSession.h b/llvm/include/llvm/DebugInfo/PDB/Native/NativeSession.h index 2e68ced46bfe..24f01d400de5 100644 --- a/llvm/include/llvm/DebugInfo/PDB/Native/NativeSession.h +++ b/llvm/include/llvm/DebugInfo/PDB/Native/NativeSession.h @@ -49,7 +49,7 @@ public: SymIndexId findSymbolByTypeIndex(codeview::TypeIndex TI); uint64_t getLoadAddress() const override; - void setLoadAddress(uint64_t Address) override; + bool setLoadAddress(uint64_t Address) override; std::unique_ptr getGlobalScope() override; std::unique_ptr getSymbolById(uint32_t SymbolId) const override; diff --git a/llvm/lib/DebugInfo/PDB/DIA/DIASession.cpp b/llvm/lib/DebugInfo/PDB/DIA/DIASession.cpp index b8aaebbf7380..dcf29a56b9d3 100644 --- a/llvm/lib/DebugInfo/PDB/DIA/DIASession.cpp +++ b/llvm/lib/DebugInfo/PDB/DIA/DIASession.cpp @@ -148,8 +148,8 @@ uint64_t DIASession::getLoadAddress() const { return (success) ? LoadAddress : 0; } -void DIASession::setLoadAddress(uint64_t Address) { - Session->put_loadAddress(Address); +bool DIASession::setLoadAddress(uint64_t Address) { + return (S_OK == Session->put_loadAddress(Address)); } std::unique_ptr DIASession::getGlobalScope() { diff --git a/llvm/lib/DebugInfo/PDB/Native/NativeSession.cpp b/llvm/lib/DebugInfo/PDB/Native/NativeSession.cpp index b01c2b54796c..b5875a018074 100644 --- a/llvm/lib/DebugInfo/PDB/Native/NativeSession.cpp +++ b/llvm/lib/DebugInfo/PDB/Native/NativeSession.cpp @@ -165,7 +165,7 @@ SymIndexId NativeSession::findSymbolByTypeIndex(codeview::TypeIndex Index) { uint64_t NativeSession::getLoadAddress() const { return 0; } -void NativeSession::setLoadAddress(uint64_t Address) {} +bool NativeSession::setLoadAddress(uint64_t Address) { return false; } std::unique_ptr NativeSession::getGlobalScope() { const auto Id = static_cast(SymbolCache.size()); diff --git a/llvm/unittests/DebugInfo/PDB/PDBApiTest.cpp b/llvm/unittests/DebugInfo/PDB/PDBApiTest.cpp index ff49a9cb009d..569fc145bb5f 100644 --- a/llvm/unittests/DebugInfo/PDB/PDBApiTest.cpp +++ b/llvm/unittests/DebugInfo/PDB/PDBApiTest.cpp @@ -63,7 +63,7 @@ namespace { class MockSession : public IPDBSession { uint64_t getLoadAddress() const override { return 0; } - void setLoadAddress(uint64_t Address) override {} + bool setLoadAddress(uint64_t Address) override { return false; } std::unique_ptr getGlobalScope() override { return nullptr; } std::unique_ptr getSymbolById(uint32_t SymbolId) const override { return nullptr;