[cfe-commits] r74606 - in /cfe/trunk: include/clang/Parse/Ownership.h lib/Basic/Targets.cpp
Douglas Gregor
dgregor at apple.com
Wed Jul 1 08:13:17 PDT 2009
Author: dgregor
Date: Wed Jul 1 10:12:53 2009
New Revision: 74606
URL: http://llvm.org/viewvc/llvm-project?rev=74606&view=rev
Log:
Two fixes to make Clang build on Visual C++ (again), from Alisdair Meredith.
Modified:
cfe/trunk/include/clang/Parse/Ownership.h
cfe/trunk/lib/Basic/Targets.cpp
Modified: cfe/trunk/include/clang/Parse/Ownership.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Ownership.h?rev=74606&r1=74605&r2=74606&view=diff
==============================================================================
--- cfe/trunk/include/clang/Parse/Ownership.h (original)
+++ cfe/trunk/include/clang/Parse/Ownership.h Wed Jul 1 10:12:53 2009
@@ -574,6 +574,19 @@
#if !defined(DISABLE_SMART_POINTERS)
friend class moving::ASTMultiMover<Destroyer>;
+#if defined(_MSC_VER)
+ // Last tested with Visual Studio 2008.
+ // Visual C++ appears to have a bug where it does not recognise
+ // the return value from ASTMultiMover<Destroyer>::opeator-> as
+ // being a pointer to ASTMultiPtr. However, the diagnostics
+ // suggest it has the right name, simply that the pointer type
+ // is not convertible to itself.
+ // Either way, a classic C-style hard cast resolves any issue.
+ static ASTMultiPtr* hack(moving::ASTMultiMover<Destroyer> & source) {
+ return (ASTMultiPtr*)source.operator->();
+ }
+#endif
+
ASTMultiPtr(ASTMultiPtr&); // DO NOT IMPLEMENT
// Reference member prevents copy assignment.
@@ -594,7 +607,13 @@
: Actions(actions), Nodes(nodes), Count(count) {}
/// Move constructor
ASTMultiPtr(moving::ASTMultiMover<Destroyer> mover)
+#if defined(_MSC_VER)
+ // Apply the visual C++ hack supplied above.
+ // Last tested with Visual Studio 2008.
+ : Actions(hack(mover)->Actions), Nodes(hack(mover)->Nodes), Count(hack(mover)->Count) {
+#else
: Actions(mover->Actions), Nodes(mover->Nodes), Count(mover->Count) {
+#endif
mover.release();
}
#else
Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=74606&r1=74605&r2=74606&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Wed Jul 1 10:12:53 2009
@@ -62,17 +62,17 @@
// Defines specific to certain operating systems.
//===----------------------------------------------------------------------===//
namespace {
-template<typename TargetInfo>
-class OSTargetInfo : public TargetInfo {
+template<typename TgtInfo>
+class OSTargetInfo : public TgtInfo {
protected:
virtual void getOSDefines(const LangOptions &Opts, const char *Triple,
std::vector<char> &Defines) const=0;
public:
- OSTargetInfo(const std::string& triple) : TargetInfo(triple) {}
+ OSTargetInfo(const std::string& triple) : TgtInfo(triple) {}
virtual void getTargetDefines(const LangOptions &Opts,
std::vector<char> &Defines) const {
- TargetInfo::getTargetDefines(Opts, Defines);
- getOSDefines(Opts, TargetInfo::getTargetTriple(), Defines);
+ TgtInfo::getTargetDefines(Opts, Defines);
+ getOSDefines(Opts, TgtInfo::getTargetTriple(), Defines);
}
};
More information about the cfe-commits
mailing list