summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorEric Christopher <echristo@apple.com>2011-10-11 22:59:11 +0000
committerEric Christopher <echristo@apple.com>2011-10-11 22:59:11 +0000
commit6618a241f7ba2571a1a55b3733c4441d467baf42 (patch)
treeca10b111fbb600e6de43d2ece7b9b1550b2d0d8d /include
parent5ba7b501fd4b88e3fea590499e9464b4b2c153a4 (diff)
downloadllvm-6618a241f7ba2571a1a55b3733c4441d467baf42.tar.gz
llvm-6618a241f7ba2571a1a55b3733c4441d467baf42.tar.bz2
llvm-6618a241f7ba2571a1a55b3733c4441d467baf42.tar.xz
Add a new wrapper node for a DILexicalBlock that encapsulates it and a
file. Since it should only be used when necessary propagate it through the backend code generation and tweak testcases accordingly. This helps with code like in clang's test/CodeGen/debug-info-line.c where we have multiple #line directives within a single lexical block and want to generate only a single block that contains each file change. Part of rdar://10246360 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141729 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Analysis/DIBuilder.h9
-rw-r--r--include/llvm/Analysis/DebugInfo.h23
2 files changed, 32 insertions, 0 deletions
diff --git a/include/llvm/Analysis/DIBuilder.h b/include/llvm/Analysis/DIBuilder.h
index a29d762b46..ee24226c74 100644
--- a/include/llvm/Analysis/DIBuilder.h
+++ b/include/llvm/Analysis/DIBuilder.h
@@ -37,6 +37,7 @@ namespace llvm {
class DINameSpace;
class DIVariable;
class DISubrange;
+ class DILexicalBlockFile;
class DILexicalBlock;
class DISubprogram;
class DITemplateTypeParameter;
@@ -463,6 +464,14 @@ namespace llvm {
DIFile File, unsigned LineNo);
+ /// createLexicalBlockFile - This creates a descriptor for a lexical
+ /// block with a new file attached. This merely extends the existing
+ /// lexical block as it crosses a file.
+ /// @param Scope Lexical block.
+ /// @param File Source file.
+ DILexicalBlockFile createLexicalBlockFile(DIDescriptor Scope,
+ DIFile File);
+
/// createLexicalBlock - This creates a descriptor for a lexical block
/// with the specified parent context.
/// @param Scope Parent lexical scope.
diff --git a/include/llvm/Analysis/DebugInfo.h b/include/llvm/Analysis/DebugInfo.h
index 1022302868..d2bb29bd71 100644
--- a/include/llvm/Analysis/DebugInfo.h
+++ b/include/llvm/Analysis/DebugInfo.h
@@ -40,6 +40,7 @@ namespace llvm {
class DIFile;
class DISubprogram;
class DILexicalBlock;
+ class DILexicalBlockFile;
class DIVariable;
class DIType;
@@ -84,6 +85,7 @@ namespace llvm {
explicit DIDescriptor(const MDNode *N) : DbgNode(N) {}
explicit DIDescriptor(const DIFile F);
explicit DIDescriptor(const DISubprogram F);
+ explicit DIDescriptor(const DILexicalBlockFile F);
explicit DIDescriptor(const DILexicalBlock F);
explicit DIDescriptor(const DIVariable F);
explicit DIDescriptor(const DIType F);
@@ -117,6 +119,7 @@ namespace llvm {
bool isFile() const;
bool isCompileUnit() const;
bool isNameSpace() const;
+ bool isLexicalBlockFile() const;
bool isLexicalBlock() const;
bool isSubrange() const;
bool isEnumerator() const;
@@ -699,6 +702,26 @@ namespace llvm {
}
};
+ /// DILexicalBlockFile - This is a wrapper for a lexical block with
+ /// a filename change.
+ class DILexicalBlockFile : public DIScope {
+ public:
+ explicit DILexicalBlockFile(const MDNode *N = 0) : DIScope(N) {}
+ DIScope getContext() const { return getScope().getFieldAs<DIScope>(1); }
+ unsigned getLineNumber() const { return getScope().getUnsignedField(2); }
+ unsigned getColumnNumber() const { return getScope().getUnsignedField(3); }
+ StringRef getDirectory() const {
+ StringRef dir = getFieldAs<DIFile>(2).getDirectory();
+ return !dir.empty() ? dir : getContext().getDirectory();
+ }
+ StringRef getFilename() const {
+ StringRef filename = getFieldAs<DIFile>(2).getFilename();
+ assert(!filename.empty() && "Why'd you create this then?");
+ return filename;
+ }
+ DILexicalBlock getScope() const { return getFieldAs<DILexicalBlock>(1); }
+ };
+
/// DINameSpace - A wrapper for a C++ style name space.
class DINameSpace : public DIScope {
public: