File tree Expand file tree Collapse file tree 2 files changed +21
-15
lines changed Expand file tree Collapse file tree 2 files changed +21
-15
lines changed Original file line number Diff line number Diff line change @@ -687,26 +687,29 @@ bool ByteCodeStmtGen<Emitter>::visitDefaultStmt(const DefaultStmt *S) {
687
687
template <class Emitter >
688
688
bool ByteCodeStmtGen<Emitter>::visitAttributedStmt(const AttributedStmt *S) {
689
689
690
- for (const Attr *A : S->getAttrs ()) {
691
- auto *AA = dyn_cast<CXXAssumeAttr>(A);
692
- if (!AA)
693
- continue ;
690
+ if (this ->Ctx .getLangOpts ().CXXAssumptions &&
691
+ !this ->Ctx .getLangOpts ().MSVCCompat ) {
692
+ for (const Attr *A : S->getAttrs ()) {
693
+ auto *AA = dyn_cast<CXXAssumeAttr>(A);
694
+ if (!AA)
695
+ continue ;
694
696
695
- assert (isa<NullStmt>(S->getSubStmt ()));
697
+ assert (isa<NullStmt>(S->getSubStmt ()));
696
698
697
- const Expr *Assumption = AA->getAssumption ();
698
- if (Assumption->isValueDependent ())
699
- return false ;
699
+ const Expr *Assumption = AA->getAssumption ();
700
+ if (Assumption->isValueDependent ())
701
+ return false ;
700
702
701
- if (Assumption->HasSideEffects (this ->Ctx .getASTContext ()))
702
- continue ;
703
+ if (Assumption->HasSideEffects (this ->Ctx .getASTContext ()))
704
+ continue ;
703
705
704
- // Evaluate assumption.
705
- if (!this ->visitBool (Assumption))
706
- return false ;
706
+ // Evaluate assumption.
707
+ if (!this ->visitBool (Assumption))
708
+ return false ;
707
709
708
- if (!this ->emitAssume (Assumption))
709
- return false ;
710
+ if (!this ->emitAssume (Assumption))
711
+ return false ;
712
+ }
710
713
}
711
714
712
715
// Ignore other attributes.
Original file line number Diff line number Diff line change 1
1
// RUN: %clang_cc1 -std=c++23 -x c++ %s -fno-assumptions -verify
2
2
// RUN: %clang_cc1 -std=c++23 -x c++ %s -fms-compatibility -verify
3
+ // RUN: %clang_cc1 -std=c++23 -x c++ %s -fno-assumptions -fexperimental-new-constant-interpreter -verify
4
+ // RUN: %clang_cc1 -std=c++23 -x c++ %s -fms-compatibility -fexperimental-new-constant-interpreter -verify
5
+
3
6
// expected-no-diagnostics
4
7
5
8
// We don't check assumptions at compile time if '-fno-assumptions' is passed,
You can’t perform that action at this time.
0 commit comments