================
@@ -322,6 +322,50 @@ static Attr *handleUnlikely(Sema &S, Stmt *St, const 
ParsedAttr &A,
   return ::new (S.Context) UnlikelyAttr(S.Context, A);
 }
 
+CodeAlignAttr *Sema::BuildCodeAlignAttr(const AttributeCommonInfo &CI,
+                                        Expr *E) {
+  if (!E->isValueDependent()) {
+    llvm::APSInt ArgVal;
+    ExprResult Res = VerifyIntegerConstantExpression(E, &ArgVal);
+    if (Res.isInvalid())
+      return nullptr;
+    E = Res.get();
+
+    int align_value = ArgVal.getSExtValue();
+    if (align_value < CodeAlignAttr::getMinValue() ||
+        align_value > CodeAlignAttr::getMaxValue() || !ArgVal.isPowerOf2()) {
+      Diag(CI.getLoc(), diag::err_attribute_power_of_two_in_range)
+          << CI << CodeAlignAttr::getMinValue() << 
CodeAlignAttr::getMaxValue();
----------------
smanna12 wrote:

Thank you @AaronBallman for the suggestion. I have updated source code to pass 
the calculated alignment value 
https://github.com/llvm/llvm-project/pull/70762/commits/4c40ce27e81ae40f05aeabb513881032c04feb92


https://github.com/llvm/llvm-project/pull/70762
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to