Revert "[Sema] Attempt to perform call-size-specific `__attribute__((alloc_align...
authorRoman Lebedev <lebedev.ri@gmail.com>
Thu, 23 Jan 2020 20:07:58 +0000 (23:07 +0300)
committerRoman Lebedev <lebedev.ri@gmail.com>
Thu, 23 Jan 2020 20:10:34 +0000 (23:10 +0300)
Likely makes bots angry.

This reverts commit c2a9061ac5166e48fe85ea2b6dbce9457c964958.

clang/lib/Sema/SemaChecking.cpp
clang/test/Sema/alloc-align-attr.c
clang/test/SemaCXX/alloc-align-attr.cpp

index 186f2b5b990c8d993104d69355cdc7202d336a0a..1539f3375c41b349d33c67696d72c3cf7b8608f3 100644 (file)
@@ -3653,25 +3653,6 @@ void Sema::checkCall(NamedDecl *FDecl, const FunctionProtoType *Proto,
     }
   }
 
-  if (FDecl && FDecl->hasAttr<AllocAlignAttr>()) {
-    auto *AA = FDecl->getAttr<AllocAlignAttr>();
-    const Expr *Arg = Args[AA->getParamIndex().getASTIndex()];
-    if (!Arg->isValueDependent()) {
-      llvm::APSInt I(64);
-      if (Arg->isIntegerConstantExpr(I, Context)) {
-        if (!I.isPowerOf2()) {
-          Diag(Arg->getExprLoc(), diag::err_alignment_not_power_of_two)
-              << Arg->getSourceRange();
-          return;
-        }
-
-        if (I > Sema::MaximumAlignment)
-          Diag(Arg->getExprLoc(), diag::warn_assume_aligned_too_great)
-              << Arg->getSourceRange() << Sema::MaximumAlignment;
-      }
-    }
-  }
-
   if (FD)
     diagnoseArgDependentDiagnoseIfAttrs(FD, ThisArg, Args, Loc);
 }
index aa0fbd2cee3db3601728306686464154f04937e0..ae514343aff4edee0269f69aa1ebf843be3b0056 100644 (file)
@@ -17,15 +17,3 @@ void *test_no_fn_proto(int x, int y) __attribute__((alloc_align)); // expected-e
 void *test_no_fn_proto(int x, int y) __attribute__((alloc_align())); // expected-error {{'alloc_align' attribute takes one argument}}
 void *test_no_fn_proto(int x, int y) __attribute__((alloc_align(32, 45, 37))); // expected-error {{'alloc_align' attribute takes one argument}}
 
-void *passthrought(int a) {
-  return test_ptr_alloc_align(a);
-}
-void *align16() {
-  return test_ptr_alloc_align(16);
-}
-void *align15() {
-  return test_ptr_alloc_align(15); // expected-error {{requested alignment is not a power of 2}}
-}
-void *align536870912() {
-  return test_ptr_alloc_align(1073741824); // expected-warning {{requested alignment must be 536870912 bytes or smaller; maximum alignment assumed}}
-}
index f910cbcf2c90703f0496d34e912fda9ca66e97cb..74cfb7d7e486b5ed37c24e8feb7b470b1b6a171f 100644 (file)
@@ -23,19 +23,13 @@ void* dependent_param_func(T param) __attribute__((alloc_align(1)));// expected-
 template <int T>
 void* illegal_align_param(int p) __attribute__((alloc_align(T))); // expected-error {{'alloc_align' attribute requires parameter 1 to be an integer constant}}
 
-void dependent_impl(int align) {
+void dependent_impl() {
   dependent_ret<int> a; // expected-note {{in instantiation of template class 'dependent_ret<int>' requested here}}
   a.Foo(1);
   a.Foo2(1);
-  dependent_ret<int *> b;
-  b.Foo(1);
-  b.Foo2(1);
-  b.Foo(3);           // expected-error {{requested alignment is not a power of 2}}
-  b.Foo2(3);          // expected-error {{requested alignment is not a power of 2}}
-  b.Foo(1073741824);  // expected-warning {{requested alignment must be 536870912 bytes or smaller; maximum alignment assumed}}
-  b.Foo2(1073741824); // expected-warning {{requested alignment must be 536870912 bytes or smaller; maximum alignment assumed}}
-  b.Foo(align);
-  b.Foo2(align);
+  dependent_ret<int*> b; 
+  a.Foo(1);
+  a.Foo2(1);
 
   dependent_param_struct<int> c; 
   c.Foo(1);