[clang] 0d61cd2 - Verify that clang's max alignment is <= LLVM's max alignment
David Zarzycki via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 24 09:37:26 PST 2020
Author: David Zarzycki
Date: 2020-01-24T12:37:05-05:00
New Revision: 0d61cd25a6927a7700bfb1636faca1ef16c46428
URL: https://github.com/llvm/llvm-project/commit/0d61cd25a6927a7700bfb1636faca1ef16c46428
DIFF: https://github.com/llvm/llvm-project/commit/0d61cd25a6927a7700bfb1636faca1ef16c46428.diff
LOG: Verify that clang's max alignment is <= LLVM's max alignment
Reviewers: lebedev.ri
Reviewed By: lebedev.ri
Subscribers: cfe-commits
Tags: #llvm, #clang
Differential Revision: https://reviews.llvm.org/D73363
Added:
Modified:
clang/include/clang/Sema/Sema.h
clang/lib/CodeGen/CGValue.h
Removed:
################################################################################
diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index 92d964d6603d..029637563d41 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -372,16 +372,17 @@ class Sema final {
QualType ResultTy,
ArrayRef<QualType> Args);
+public:
/// The maximum alignment, same as in llvm::Value. We duplicate them here
/// because that allows us not to duplicate the constants in clang code,
/// which we must to since we can't directly use the llvm constants.
+ /// The value is verified against llvm here: lib/CodeGen/CGValue.h
///
/// This is the greatest alignment value supported by load, store, and alloca
/// instructions, and global values.
static const unsigned MaxAlignmentExponent = 29;
static const unsigned MaximumAlignment = 1u << MaxAlignmentExponent;
-public:
typedef OpaquePtr<DeclGroupRef> DeclGroupPtrTy;
typedef OpaquePtr<TemplateName> TemplateTy;
typedef OpaquePtr<QualType> TypeTy;
diff --git a/clang/lib/CodeGen/CGValue.h b/clang/lib/CodeGen/CGValue.h
index 9fd07bdb187d..4d6c3950e5e4 100644
--- a/clang/lib/CodeGen/CGValue.h
+++ b/clang/lib/CodeGen/CGValue.h
@@ -15,12 +15,16 @@
#define LLVM_CLANG_LIB_CODEGEN_CGVALUE_H
#include "clang/AST/ASTContext.h"
+#include "clang/Sema/Sema.h"
#include "clang/AST/Type.h"
#include "llvm/IR/Value.h"
#include "llvm/IR/Type.h"
#include "Address.h"
#include "CodeGenTBAA.h"
+static_assert(clang::Sema::MaximumAlignment <= llvm::Value::MaximumAlignment,
+ "Clang max alignment greater than what LLVM supports?");
+
namespace llvm {
class Constant;
class MDNode;
More information about the cfe-commits
mailing list