Author: hans Date: Fri Jan 23 11:17:04 2015 New Revision: 226916 URL: http://llvm.org/viewvc/llvm-project?rev=226916&view=rev Log: Merging r226863: ------------------------------------------------------------------------ r226863 | joerg | 2015-01-22 13:01:00 -0800 (Thu, 22 Jan 2015) | 3 lines
When reporting constraints that should be constant, the type doesn't really help. Improve diagnostics. ------------------------------------------------------------------------ Modified: cfe/branches/release_36/ (props changed) cfe/branches/release_36/include/clang/Basic/DiagnosticSemaKinds.td cfe/branches/release_36/lib/Sema/SemaStmtAsm.cpp cfe/branches/release_36/test/Sema/inline-asm-validate-x86.c Propchange: cfe/branches/release_36/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Fri Jan 23 11:17:04 2015 @@ -1,4 +1,4 @@ /cfe/branches/type-system-rewrite:134693-134817 -/cfe/trunk:226008,226049,226136,226282,226624,226707,226754,226877 +/cfe/trunk:226008,226049,226136,226282,226624,226707,226754,226863,226877 /cfe/trunk/test:170344 /cfe/trunk/test/SemaTemplate:126920 Modified: cfe/branches/release_36/include/clang/Basic/DiagnosticSemaKinds.td URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_36/include/clang/Basic/DiagnosticSemaKinds.td?rev=226916&r1=226915&r2=226916&view=diff ============================================================================== --- cfe/branches/release_36/include/clang/Basic/DiagnosticSemaKinds.td (original) +++ cfe/branches/release_36/include/clang/Basic/DiagnosticSemaKinds.td Fri Jan 23 11:17:04 2015 @@ -6159,6 +6159,8 @@ let CategoryName = "Inline Assembly Issu "invalid lvalue in asm input for constraint '%0'">; def err_asm_invalid_input_constraint : Error< "invalid input constraint '%0' in asm">; + def err_asm_immediate_expected : Error<"constraint '%0' expects " + "an integer constant expression">; def err_asm_invalid_type_in_input : Error< "invalid type %0 in asm input for constraint '%1'">; def err_asm_tying_incompatible_types : Error< Modified: cfe/branches/release_36/lib/Sema/SemaStmtAsm.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_36/lib/Sema/SemaStmtAsm.cpp?rev=226916&r1=226915&r2=226916&view=diff ============================================================================== --- cfe/branches/release_36/lib/Sema/SemaStmtAsm.cpp (original) +++ cfe/branches/release_36/lib/Sema/SemaStmtAsm.cpp Fri Jan 23 11:17:04 2015 @@ -230,9 +230,8 @@ StmtResult Sema::ActOnGCCAsmStmt(SourceL llvm::APSInt Result; if (!InputExpr->EvaluateAsInt(Result, Context)) return StmtError( - Diag(InputExpr->getLocStart(), diag::err_asm_invalid_type_in_input) - << InputExpr->getType() << Info.getConstraintStr() - << InputExpr->getSourceRange()); + Diag(InputExpr->getLocStart(), diag::err_asm_immediate_expected) + << Info.getConstraintStr() << InputExpr->getSourceRange()); if (Result.slt(Info.getImmConstantMin()) || Result.sgt(Info.getImmConstantMax())) return StmtError(Diag(InputExpr->getLocStart(), Modified: cfe/branches/release_36/test/Sema/inline-asm-validate-x86.c URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_36/test/Sema/inline-asm-validate-x86.c?rev=226916&r1=226915&r2=226916&view=diff ============================================================================== --- cfe/branches/release_36/test/Sema/inline-asm-validate-x86.c (original) +++ cfe/branches/release_36/test/Sema/inline-asm-validate-x86.c Fri Jan 23 11:17:04 2015 @@ -6,7 +6,7 @@ void I(int i, int j) { static const int AboveMax = 32; __asm__("xorl %0,%2" : "=r"(i) - : "0"(i), "I"(j)); // expected-error{{invalid type 'int' in asm input for constraint 'I'}} + : "0"(i), "I"(j)); // expected-error{{constraint 'I' expects an integer constant expression}} __asm__("xorl %0,%2" : "=r"(i) : "0"(i), "I"(BelowMin)); // expected-error{{value '-1' out of range for constraint 'I'}} @@ -23,7 +23,7 @@ void J(int i, int j) { static const int AboveMax = 64; __asm__("xorl %0,%2" : "=r"(i) - : "0"(i), "J"(j)); // expected-error{{invalid type 'int' in asm input for constraint 'J'}} + : "0"(i), "J"(j)); // expected-error{{constraint 'J' expects an integer constant expression}} __asm__("xorl %0,%2" : "=r"(i) : "0"(i), "J"(BelowMin)); // expected-error{{value '-1' out of range for constraint 'J'}} @@ -40,7 +40,7 @@ void K(int i, int j) { static const int AboveMax = 128; __asm__("xorl %0,%2" : "=r"(i) - : "0"(i), "K"(j)); // expected-error{{invalid type 'int' in asm input for constraint 'K'}} + : "0"(i), "K"(j)); // expected-error{{constraint 'K' expects an integer constant expression}} __asm__("xorl %0,%2" : "=r"(i) : "0"(i), "K"(BelowMin)); // expected-error{{value '-129' out of range for constraint 'K'}} @@ -57,7 +57,7 @@ void M(int i, int j) { static const int AboveMax = 4; __asm__("xorl %0,%2" : "=r"(i) - : "0"(i), "M"(j)); // expected-error{{invalid type 'int' in asm input for constraint 'M'}} + : "0"(i), "M"(j)); // expected-error{{constraint 'M' expects an integer constant expression}} __asm__("xorl %0,%2" : "=r"(i) : "0"(i), "M"(BelowMin)); // expected-error{{value '-1' out of range for constraint 'M'}} @@ -74,7 +74,7 @@ void N(int i, int j) { static const int AboveMax = 256; __asm__("xorl %0,%2" : "=r"(i) - : "0"(i), "N"(j)); // expected-error{{invalid type 'int' in asm input for constraint 'N'}} + : "0"(i), "N"(j)); // expected-error{{constraint 'N' expects an integer constant expression}} __asm__("xorl %0,%2" : "=r"(i) : "0"(i), "N"(BelowMin)); // expected-error{{value '-1' out of range for constraint 'N'}} @@ -91,7 +91,7 @@ void O(int i, int j) { static const int AboveMax = 128; __asm__("xorl %0,%2" : "=r"(i) - : "0"(i), "O"(j)); // expected-error{{invalid type 'int' in asm input for constraint 'O'}} + : "0"(i), "O"(j)); // expected-error{{constraint 'O' expects an integer constant expression}} __asm__("xorl %0,%2" : "=r"(i) : "0"(i), "O"(BelowMin)); // expected-error{{value '-1' out of range for constraint 'O'}} _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-branch-commits