[llvm-commits] CVS: llvm/lib/System/Win32/Win32.h
Chris Lattner
lattner at cs.uiuc.edu
Fri Jul 7 10:13:22 PDT 2006
Changes in directory llvm/lib/System/Win32:
Win32.h updated: 1.4 -> 1.5
---
Log message:
Add a helper function
---
Diffs of the changes: (+10 -0)
Win32.h | 10 ++++++++++
1 files changed, 10 insertions(+)
Index: llvm/lib/System/Win32/Win32.h
diff -u llvm/lib/System/Win32/Win32.h:1.4 llvm/lib/System/Win32/Win32.h:1.5
--- llvm/lib/System/Win32/Win32.h:1.4 Tue Jul 12 21:15:17 2005
+++ llvm/lib/System/Win32/Win32.h Fri Jul 7 12:13:10 2006
@@ -24,6 +24,16 @@
#include <cassert>
#include <string>
+inline bool GetError(const std::string &Prefix, std::string *Dest) {
+ if (Dest == 0) return;
+ char *buffer = NULL;
+ FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM,
+ NULL, GetLastError(), 0, (LPSTR)&buffer, 1, NULL);
+ *Dest = Prefix + buffer;
+ LocalFree(buffer);
+ return true;
+}
+
inline void ThrowError(const std::string& msg) {
char *buffer = NULL;
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM,
More information about the llvm-commits
mailing list