[dragonegg] r178066 - Fix dragonegg compilation after recent debug info changes. Fix a test case that
Duncan Sands
baldrick at free.fr
Tue Mar 26 12:56:46 PDT 2013
Author: baldrick
Date: Tue Mar 26 14:56:45 2013
New Revision: 178066
URL: http://llvm.org/viewvc/llvm-project?rev=178066&view=rev
Log:
Fix dragonegg compilation after recent debug info changes. Fix a test case that
broke due to other debug info patches changing the metadata output. Note that
the fix is not perfect as I have some testcases that get assertion failures, but
hopefully it will bring some bots back to life.
Modified:
dragonegg/trunk/include/dragonegg/Debug.h
dragonegg/trunk/src/Debug.cpp
dragonegg/trunk/test/validator/c++/2010-07-23-DeclLoc.cpp
Modified: dragonegg/trunk/include/dragonegg/Debug.h
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/include/dragonegg/Debug.h?rev=178066&r1=178065&r2=178066&view=diff
==============================================================================
--- dragonegg/trunk/include/dragonegg/Debug.h (original)
+++ dragonegg/trunk/include/dragonegg/Debug.h Tue Mar 26 14:56:45 2013
@@ -88,6 +88,13 @@ public:
/// CreateFile - Create a new descriptor for the specified file.
DIFile CreateFile(StringRef Filename, StringRef Directory);
+ DIType CreateForwardDecl(unsigned Tag, StringRef Name, DIDescriptor Scope,
+ DIFile F, unsigned Line, unsigned RuntimeLang = 0,
+ uint64_t SizeInBits = 0, uint64_t AlignInBits = 0) {
+ return Builder.createForwardDecl(Tag, Name, Scope, F, Line, RuntimeLang,
+ SizeInBits, AlignInBits);
+ }
+
/// CreateEnumerator - Create a single enumerator value.
DIEnumerator CreateEnumerator(StringRef Name, uint64_t Val);
@@ -117,10 +124,6 @@ public:
uint64_t OffsetInBits, unsigned Flags, DIType DerivedFrom,
DIArray Elements, unsigned RunTimeLang = 0, MDNode *ContainingType = 0);
- /// CreateTemporaryType - Create a temporary forward-declared type.
- DIType CreateTemporaryType();
- DIType CreateTemporaryType(DIFile F);
-
/// CreateArtificialType - Create a new DIType with "artificial" flag set.
DIType CreateArtificialType(DIType Ty);
Modified: dragonegg/trunk/src/Debug.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Debug.cpp?rev=178066&r1=178065&r2=178066&view=diff
==============================================================================
--- dragonegg/trunk/src/Debug.cpp (original)
+++ dragonegg/trunk/src/Debug.cpp Tue Mar 26 14:56:45 2013
@@ -490,7 +490,10 @@ DIType DebugInfo::createMethodType(tree
// Create a place holder type first. The may be used as a context
// for the argument types.
- llvm::DIType FwdType = DebugFactory.CreateTemporaryType();
+ llvm::DIType FwdType = DebugFactory.CreateForwardDecl(
+ llvm::dwarf::DW_TAG_subroutine_type, StringRef(),
+ findRegion(TYPE_CONTEXT(type)), getOrCreateFile(main_input_filename),
+ 0, 0, 0, 0);
llvm::MDNode *FTN = FwdType;
llvm::TrackingVH<llvm::MDNode> FwdTypeNode = FTN;
TypeCache[type] = WeakVH(FwdType);
@@ -691,16 +694,13 @@ DIType DebugInfo::createStructType(tree
return DIType(TN);
}
- // forward declaration,
- if (TYPE_SIZE(type) == 0) {
- llvm::DICompositeType FwdDecl = DebugFactory.CreateCompositeType(
- Tag, TyContext, GetNodeName(type), getOrCreateFile(Loc.file), Loc.line,
- 0, 0, 0, SFlags | llvm::DIType::FlagFwdDecl, llvm::DIType(),
- llvm::DIArray(), RunTimeLang);
- return FwdDecl;
- }
+ llvm::DIType FwdDecl = DebugFactory.CreateForwardDecl(
+ Tag, GetNodeName(type), TyContext, getOrCreateFile(Loc.file), Loc.line,
+ 0, 0, 0);
- llvm::DIType FwdDecl = DebugFactory.CreateTemporaryType();
+ if (TYPE_SIZE(type) == 0)
+ // forward declaration,
+ return FwdDecl;
// Insert into the TypeCache so that recursive uses will find it.
llvm::MDNode *FDN = FwdDecl;
@@ -1218,16 +1218,6 @@ DICompositeType DIFactory::CreateComposi
llvm_unreachable("Unimplemented composite type tag");
}
-/// CreateTemporaryType - Create a temporary forward-declared type.
-DIType DIFactory::CreateTemporaryType() {
- return Builder.createTemporaryType();
-}
-
-/// CreateTemporaryType - Create a temporary forward-declared type.
-DIType DIFactory::CreateTemporaryType(DIFile F) {
- return Builder.createTemporaryType(F);
-}
-
/// CreateSubprogram - Create a new descriptor for the specified subprogram.
/// See comments in DISubprogram for descriptions of these fields. This
/// method does not unique the generated descriptors.
@@ -1252,8 +1242,9 @@ DISubprogram DIFactory::CreateSubprogram
if (SP.isDefinition())
return DISubprogram(SP);
+ DIFile File = Builder.createFile(SP.getFilename(), SP.getDirectory());
return Builder.createFunction(
- SP.getContext(), SP.getName(), SP.getLinkageName(), SP.getFile(),
+ SP.getContext(), SP.getName(), SP.getLinkageName(), File,
SP.getLineNumber(), SP.getType(), SP.isLocalToUnit(), true, LineNo,
SP.getFlags(), SP.isOptimized(), Fn, SP.getTemplateParams(), SP);
}
Modified: dragonegg/trunk/test/validator/c++/2010-07-23-DeclLoc.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/test/validator/c%2B%2B/2010-07-23-DeclLoc.cpp?rev=178066&r1=178065&r2=178066&view=diff
==============================================================================
--- dragonegg/trunk/test/validator/c++/2010-07-23-DeclLoc.cpp (original)
+++ dragonegg/trunk/test/validator/c++/2010-07-23-DeclLoc.cpp Tue Mar 26 14:56:45 2013
@@ -1,9 +1,8 @@
// RUN: %dragonegg -S -g %s -o - | FileCheck %s
// Require the template function declaration refer to the correct filename.
// First, locate the function decl in metadata, and pluck out the file handle:
-// CHECK: {{extract_dwarf_data_from_header.*extract_dwarf_data_from_header.*extract_dwarf_data_from_header.*[^ ]+", metadata !}}[[filetag:[0-9]+]],
+// CHECK: = metadata !{i32 {{[^,]*}}, metadata ![[filedata:[0-9]+]],{{.*extract_dwarf_data_from_header.*extract_dwarf_data_from_header.*extract_dwarf_data_from_header}}
// Second: Require that filetag refers to metadata holding the correct filename:
-// CHECK: {{^!}}[[filetag]] = metadata !{i32 786473, metadata ![[filedata:[0-9]+]]}
// CHECK: {{^!}}[[filedata]] = metadata !{metadata !"decl_should_be_here.hpp",
typedef long unsigned int __darwin_size_t;
typedef __darwin_size_t size_t;
More information about the llvm-commits
mailing list