summaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/CGBuilder.h
diff options
context:
space:
mode:
authorEric Christopher <echristo@gmail.com>2016-03-12 01:47:11 +0000
committerEric Christopher <echristo@gmail.com>2016-03-12 01:47:11 +0000
commitf511f8fb79d0fefd4cbfc81fc886387acc5ab419 (patch)
tree5e0ddf32d1691cc1d3ae53aae139a8fa17d86b9c /lib/CodeGen/CGBuilder.h
parent779896bbdb9d3551f116a23ca8ed38663a0f7f5e (diff)
Temporarily revert these patches:
commit 60d9845f6a037122d9be9a6d92d4de617ef45b04 Author: Mehdi Amini <mehdi.amini@apple.com> Date: Fri Mar 11 18:48:02 2016 +0000 Fix clang crash: when CodeGenAction is initialized without a context, use the member and not the parameter From: Mehdi Amini <mehdi.amini@apple.com> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@263273 91177308-0d34-0410-b5e6-96231b3b80d8 commit af7ce3bf04a75ad5124b457b805df26006bd215b Author: Mehdi Amini <mehdi.amini@apple.com> Date: Fri Mar 11 17:32:58 2016 +0000 Fix build: use -> with pointers and not . Silly typo. From: Mehdi Amini <mehdi.amini@apple.com> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@263267 91177308-0d34-0410-b5e6-96231b3b80d8 commit d0eea119192814954e7368c77d0dc5a9eeec1fbb Author: Mehdi Amini <mehdi.amini@apple.com> Date: Fri Mar 11 17:15:44 2016 +0000 Remove compile time PreserveName switch based on NDEBUG Summary: Following r263086, we are now relying on a flag on the Context to discard Value names in release builds. Reviewers: chandlerc Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D18024 From: Mehdi Amini <mehdi.amini@apple.com> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@263257 91177308-0d34-0410-b5e6-96231b3b80d8 until we can fix the Release builds. This reverts commits 263257, 263267, 263273 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@263320 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGBuilder.h')
-rw-r--r--lib/CodeGen/CGBuilder.h19
1 files changed, 15 insertions, 4 deletions
diff --git a/lib/CodeGen/CGBuilder.h b/lib/CodeGen/CGBuilder.h
index 027435d7c5..baba30d5bf 100644
--- a/lib/CodeGen/CGBuilder.h
+++ b/lib/CodeGen/CGBuilder.h
@@ -23,7 +23,9 @@ class CodeGenFunction;
/// \brief This is an IRBuilder insertion helper that forwards to
/// CodeGenFunction::InsertHelper, which adds necessary metadata to
/// instructions.
-class CGBuilderInserter : protected llvm::IRBuilderDefaultInserter {
+template <bool PreserveNames>
+class CGBuilderInserter
+ : protected llvm::IRBuilderDefaultInserter<PreserveNames> {
public:
CGBuilderInserter() = default;
explicit CGBuilderInserter(CodeGenFunction *CGF) : CGF(CGF) {}
@@ -37,10 +39,17 @@ private:
CodeGenFunction *CGF = nullptr;
};
-typedef CGBuilderInserter CGBuilderInserterTy;
+// Don't preserve names on values in an optimized build.
+#ifdef NDEBUG
+#define PreserveNames false
+#else
+#define PreserveNames true
+#endif
+
+typedef CGBuilderInserter<PreserveNames> CGBuilderInserterTy;
-typedef llvm::IRBuilder<llvm::ConstantFolder, CGBuilderInserterTy>
- CGBuilderBaseTy;
+typedef llvm::IRBuilder<PreserveNames, llvm::ConstantFolder,
+ CGBuilderInserterTy> CGBuilderBaseTy;
class CGBuilderTy : public CGBuilderBaseTy {
/// Storing a reference to the type cache here makes it a lot easier
@@ -296,6 +305,8 @@ public:
}
};
+#undef PreserveNames
+
} // end namespace CodeGen
} // end namespace clang