[cfe-commits] r82915 - in /cfe/trunk: lib/CodeGen/Mangle.cpp test/CodeGenCXX/mangle.cpp
Anders Carlsson
andersca at mac.com
Sun Sep 27 13:11:35 PDT 2009
Author: andersca
Date: Sun Sep 27 15:11:34 2009
New Revision: 82915
URL: http://llvm.org/viewvc/llvm-project?rev=82915&view=rev
Log:
Mangle dependent name expressions. Fixes PR5063.
Modified:
cfe/trunk/lib/CodeGen/Mangle.cpp
cfe/trunk/test/CodeGenCXX/mangle.cpp
Modified: cfe/trunk/lib/CodeGen/Mangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/Mangle.cpp?rev=82915&r1=82914&r2=82915&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/Mangle.cpp (original)
+++ cfe/trunk/lib/CodeGen/Mangle.cpp Sun Sep 27 15:11:34 2009
@@ -20,6 +20,7 @@
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/DeclTemplate.h"
+#include "clang/AST/ExprCXX.h"
#include "clang/Basic/SourceManager.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/raw_ostream.h"
@@ -971,7 +972,26 @@
}
}
+
+ break;
+ }
+
+ case Expr::UnresolvedDeclRefExprClass: {
+ const UnresolvedDeclRefExpr *DRE = cast<UnresolvedDeclRefExpr>(E);
+ const Type *QTy = DRE->getQualifier()->getAsType();
+ assert(QTy && "Qualifier was not type!");
+
+ // ::= sr <type> <unqualified-name> # dependent name
+ Out << "sr";
+ mangleType(QualType(QTy, 0));
+
+ assert(DRE->getDeclName().getNameKind() == DeclarationName::Identifier &&
+ "Unhandled decl name kind!");
+ mangleSourceName(DRE->getDeclName().getAsIdentifierInfo());
+
+ break;
}
+
}
}
Modified: cfe/trunk/test/CodeGenCXX/mangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/mangle.cpp?rev=82915&r1=82914&r2=82915&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/mangle.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/mangle.cpp Sun Sep 27 15:11:34 2009
@@ -180,3 +180,21 @@
// CHECK: @_Z3ft6I1SENT_1UERKS1_
template int ft6<S>(const S&);
+
+template<typename> struct __is_scalar {
+ enum { __value = 1 };
+};
+
+template<bool, typename> struct __enable_if { };
+
+template<typename T> struct __enable_if<true, T> {
+ typedef T __type;
+};
+
+// PR5063
+template<typename T> typename __enable_if<__is_scalar<T>::__value, void>::__type ft7() { }
+
+// CHECK: @_Z3ft7IiEN11__enable_ifIXsr11__is_scalarIT_E7__valueEvE6__typeEv
+template void ft7<int>();
+// CHECK: @_Z3ft7IPvEN11__enable_ifIXsr11__is_scalarIT_E7__valueEvE6__typeEv
+template void ft7<void*>();
More information about the cfe-commits
mailing list