aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGDebugInfo.cpp
diff options
context:
space:
mode:
authorRoman Divacky <rdivacky@FreeBSD.org>2010-07-13 17:21:42 +0000
committerRoman Divacky <rdivacky@FreeBSD.org>2010-07-13 17:21:42 +0000
commit4ba675006b5a8edfc48b6a9bd3dcf54a70cc08f2 (patch)
tree48b44512b5db8ced345df4a1a56b5065cf2a14d9 /lib/CodeGen/CGDebugInfo.cpp
parentd7279c4c177bca357ef96ff1379fd9bc420bfe83 (diff)
downloadsrc-4ba675006b5a8edfc48b6a9bd3dcf54a70cc08f2.tar.gz
src-4ba675006b5a8edfc48b6a9bd3dcf54a70cc08f2.zip
Update clang to r108243.vendor/clang/clang-r108243
Notes
Notes: svn path=/vendor/clang/dist/; revision=210008 svn path=/vendor/clang/clang-r108243/; revision=210076; tag=vendor/clang/clang-r108243
Diffstat (limited to 'lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r--lib/CodeGen/CGDebugInfo.cpp43
1 files changed, 29 insertions, 14 deletions
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp
index c9bcb1b7e043..a3c4003ff5be 100644
--- a/lib/CodeGen/CGDebugInfo.cpp
+++ b/lib/CodeGen/CGDebugInfo.cpp
@@ -21,7 +21,7 @@
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/FileManager.h"
#include "clang/Basic/Version.h"
-#include "clang/CodeGen/CodeGenOptions.h"
+#include "clang/Frontend/CodeGenOptions.h"
#include "llvm/Constants.h"
#include "llvm/DerivedTypes.h"
#include "llvm/Instructions.h"
@@ -536,6 +536,13 @@ CGDebugInfo::getOrCreateMethodType(const CXXMethodDecl *Method,
Context.getPointerType(Context.getTagDeclType(Method->getParent()));
llvm::DIType ThisPtrType =
DebugFactory.CreateArtificialType(getOrCreateType(ThisPtr, Unit));
+
+ if (Method->getTypeQualifiers() && Qualifiers::Const)
+ ThisPtrType =
+ DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_const_type,
+ Unit, "", Unit,
+ 0, 0, 0, 0, 0, ThisPtrType);
+
TypeCache[ThisPtr.getAsOpaquePtr()] = ThisPtrType;
Elts.push_back(ThisPtrType);
@@ -567,9 +574,9 @@ CGDebugInfo::CreateCXXMemberFunction(const CXXMethodDecl *Method,
// Since a single ctor/dtor corresponds to multiple functions, it doesn't
// make sense to give a single ctor/dtor a linkage name.
- MangleBuffer MethodLinkageName;
+ llvm::StringRef MethodLinkageName;
if (!IsCtorOrDtor)
- CGM.getMangledName(MethodLinkageName, Method);
+ MethodLinkageName = CGM.getMangledName(Method);
// Get the location for the method.
llvm::DIFile MethodDefUnit = getOrCreateFile(Method->getLocation());
@@ -598,7 +605,7 @@ CGDebugInfo::CreateCXXMemberFunction(const CXXMethodDecl *Method,
MethodLinkageName,
MethodDefUnit, MethodLine,
MethodTy, /*isLocalToUnit=*/false,
- Method->isThisDeclarationADefinition(),
+ /* isDefintion=*/ false,
Virtuality, VIndex, ContainingType);
// Don't cache ctors or dtors since we have to emit multiple functions for
@@ -758,22 +765,30 @@ llvm::DIType CGDebugInfo::CreateType(const RecordType *Ty,
// its members. Finally, we create a descriptor for the complete type (which
// may refer to the forward decl if the struct is recursive) and replace all
// uses of the forward declaration with the final definition.
+ llvm::DIDescriptor FDContext =
+ getContextDescriptor(dyn_cast<Decl>(RD->getDeclContext()), Unit);
+
+ // If this is just a forward declaration, construct an appropriately
+ // marked node and just return it.
+ if (!RD->getDefinition()) {
+ llvm::DICompositeType FwdDecl =
+ DebugFactory.CreateCompositeType(Tag, FDContext, RD->getName(),
+ DefUnit, Line, 0, 0, 0,
+ llvm::DIType::FlagFwdDecl,
+ llvm::DIType(), llvm::DIArray());
+
+ return FwdDecl;
+ }
// A RD->getName() is not unique. However, the debug info descriptors
// are uniqued so use type name to ensure uniquness.
llvm::SmallString<128> FwdDeclName;
llvm::raw_svector_ostream(FwdDeclName) << "fwd.type." << FwdDeclCount++;
- llvm::DIDescriptor FDContext =
- getContextDescriptor(dyn_cast<Decl>(RD->getDeclContext()), Unit);
llvm::DICompositeType FwdDecl =
DebugFactory.CreateCompositeType(Tag, FDContext, FwdDeclName,
DefUnit, Line, 0, 0, 0, 0,
llvm::DIType(), llvm::DIArray());
- // If this is just a forward declaration, return it.
- if (!RD->getDefinition())
- return FwdDecl;
-
llvm::MDNode *MN = FwdDecl;
llvm::TrackingVH<llvm::MDNode> FwdDeclNode = MN;
// Otherwise, insert it into the TypeCache so that recursive uses will find
@@ -1289,7 +1304,7 @@ void CGDebugInfo::EmitFunctionStart(GlobalDecl GD, QualType FnType,
CGBuilderTy &Builder) {
llvm::StringRef Name;
- MangleBuffer LinkageName;
+ llvm::StringRef LinkageName;
const Decl *D = GD.getDecl();
if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
@@ -1307,11 +1322,11 @@ void CGDebugInfo::EmitFunctionStart(GlobalDecl GD, QualType FnType,
}
Name = getFunctionName(FD);
// Use mangled name as linkage name for c/c++ functions.
- CGM.getMangledName(LinkageName, GD);
+ LinkageName = CGM.getMangledName(GD);
} else {
// Use llvm function name as linkage name.
Name = Fn->getName();
- LinkageName.setString(Name);
+ LinkageName = Name;
}
if (!Name.empty() && Name[0] == '\01')
Name = Name.substr(1);
@@ -1477,7 +1492,7 @@ void CGDebugInfo::EmitDeclare(const VarDecl *VD, unsigned Tag,
llvm::DIVariable D =
DebugFactory.CreateVariable(Tag, llvm::DIDescriptor(RegionStack.back()),
VD->getName(),
- Unit, Line, Ty);
+ Unit, Line, Ty, CGM.getLangOptions().Optimize);
// Insert an llvm.dbg.declare into the current block.
llvm::Instruction *Call =
DebugFactory.InsertDeclare(Storage, D, Builder.GetInsertBlock());