[cfe-commits] r153192 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td lib/Rewrite/RewriteModernObjC.cpp lib/Sema/SemaStmt.cpp
Fariborz Jahanian
fjahanian at apple.com
Wed Mar 21 09:17:23 PDT 2012
Author: fjahanian
Date: Wed Mar 21 11:17:22 2012
New Revision: 153192
URL: http://llvm.org/viewvc/llvm-project?rev=153192&view=rev
Log:
modern objective-c rewriter: remove 'const' from
pointer field declarations in several meta-data.
// rdar://11079898
Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Rewrite/RewriteModernObjC.cpp
cfe/trunk/lib/Sema/SemaStmt.cpp
Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=153192&r1=153191&r2=153192&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Wed Mar 21 11:17:22 2012
@@ -5159,7 +5159,7 @@
"should not return a value">,
DefaultError, InGroup<ReturnType>;
def ext_return_has_void_expr : Extension<
- "void %select{function|method}1 %0 should not return void expression">;
+ "void %select{function|method|block}1 %0 should not return void expression">;
def err_return_init_list : Error<
"%select{void function|void method|constructor|destructor}1 %0 "
"must not return a value">;
Modified: cfe/trunk/lib/Rewrite/RewriteModernObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Rewrite/RewriteModernObjC.cpp?rev=153192&r1=153191&r2=153192&view=diff
==============================================================================
--- cfe/trunk/lib/Rewrite/RewriteModernObjC.cpp (original)
+++ cfe/trunk/lib/Rewrite/RewriteModernObjC.cpp Wed Mar 21 11:17:22 2012
@@ -5227,10 +5227,10 @@
/// struct _protocol_t {
/// id isa; // NULL
-/// const char * const protocol_name;
+/// const char *protocol_name;
/// const struct _protocol_list_t * protocol_list; // super protocols
-/// const struct method_list_t * const instance_methods;
-/// const struct method_list_t * const class_methods;
+/// const struct method_list_t *instance_methods;
+/// const struct method_list_t *class_methods;
/// const struct method_list_t *optionalInstanceMethods;
/// const struct method_list_t *optionalClassMethods;
/// const struct _prop_list_t * properties;
@@ -5258,13 +5258,13 @@
/// uint32_t const instanceStart;
/// uint32_t const instanceSize;
/// uint32_t const reserved; // only when building for 64bit targets
-/// const uint8_t * const ivarLayout;
-/// const char *const name;
-/// const struct _method_list_t * const baseMethods;
-/// const struct _protocol_list_t *const baseProtocols;
-/// const struct _ivar_list_t *const ivars;
-/// const uint8_t * const weakIvarLayout;
-/// const struct _prop_list_t * const properties;
+/// const uint8_t *ivarLayout;
+/// const char *name;
+/// const struct _method_list_t *baseMethods;
+/// const struct _protocol_list_t *baseProtocols;
+/// const struct _ivar_list_t *ivars;
+/// const uint8_t *weakIvarLayout;
+/// const struct _prop_list_t *properties;
/// }
/// struct _class_t {
@@ -5276,12 +5276,12 @@
/// }
/// struct _category_t {
-/// const char * const name;
+/// const char *name;
/// struct _class_t *cls;
-/// const struct _method_list_t * const instance_methods;
-/// const struct _method_list_t * const class_methods;
-/// const struct _protocol_list_t * const protocols;
-/// const struct _prop_list_t * const properties;
+/// const struct _method_list_t *instance_methods;
+/// const struct _method_list_t *class_methods;
+/// const struct _protocol_list_t *protocols;
+/// const struct _prop_list_t *properties;
/// }
/// MessageRefTy - LLVM for:
@@ -5316,10 +5316,10 @@
Result += "\nstruct _protocol_t {\n";
Result += "\tvoid * isa; // NULL\n";
- Result += "\tconst char * const protocol_name;\n";
+ Result += "\tconst char *protocol_name;\n";
Result += "\tconst struct _protocol_list_t * protocol_list; // super protocols\n";
- Result += "\tconst struct method_list_t * const instance_methods;\n";
- Result += "\tconst struct method_list_t * const class_methods;\n";
+ Result += "\tconst struct method_list_t *instance_methods;\n";
+ Result += "\tconst struct method_list_t *class_methods;\n";
Result += "\tconst struct method_list_t *optionalInstanceMethods;\n";
Result += "\tconst struct method_list_t *optionalClassMethods;\n";
Result += "\tconst struct _prop_list_t * properties;\n";
@@ -5343,13 +5343,13 @@
const llvm::Triple &Triple(Context->getTargetInfo().getTriple());
if (Triple.getArch() == llvm::Triple::x86_64)
Result += "\tunsigned int const reserved;\n";
- Result += "\tconst unsigned char * const ivarLayout;\n";
- Result += "\tconst char *const name;\n";
- Result += "\tconst struct _method_list_t * const baseMethods;\n";
- Result += "\tconst struct _objc_protocol_list *const baseProtocols;\n";
- Result += "\tconst struct _ivar_list_t *const ivars;\n";
- Result += "\tconst unsigned char *const weakIvarLayout;\n";
- Result += "\tconst struct _prop_list_t *const properties;\n";
+ Result += "\tconst unsigned char *ivarLayout;\n";
+ Result += "\tconst char *name;\n";
+ Result += "\tconst struct _method_list_t *baseMethods;\n";
+ Result += "\tconst struct _objc_protocol_list *baseProtocols;\n";
+ Result += "\tconst struct _ivar_list_t *ivars;\n";
+ Result += "\tconst unsigned char *weakIvarLayout;\n";
+ Result += "\tconst struct _prop_list_t *properties;\n";
Result += "};\n";
Result += "\nstruct _class_t {\n";
@@ -5361,12 +5361,12 @@
Result += "};\n";
Result += "\nstruct _category_t {\n";
- Result += "\tconst char * const name;\n";
+ Result += "\tconst char *name;\n";
Result += "\tstruct _class_t *cls;\n";
- Result += "\tconst struct _method_list_t *const instance_methods;\n";
- Result += "\tconst struct _method_list_t *const class_methods;\n";
- Result += "\tconst struct _protocol_list_t *const protocols;\n";
- Result += "\tconst struct _prop_list_t *const properties;\n";
+ Result += "\tconst struct _method_list_t *instance_methods;\n";
+ Result += "\tconst struct _method_list_t *class_methods;\n";
+ Result += "\tconst struct _protocol_list_t *protocols;\n";
+ Result += "\tconst struct _prop_list_t *properties;\n";
Result += "};\n";
Result += "__declspec(dllimport) extern struct objc_cache _objc_empty_cache;\n";
@@ -6337,8 +6337,6 @@
void RewriteModernObjC::RewriteMetaDataIntoBuffer(std::string &Result) {
int ClsDefCount = ClassImplementation.size();
int CatDefCount = CategoryImplementation.size();
- if (LangOpts.MicrosoftExt)
- Result += "#pragma optimize(\"g\", on)";
// For each implemented class, write out all its meta data.
for (int i = 0; i < ClsDefCount; i++)
@@ -6408,8 +6406,6 @@
}
Result += "};\n";
}
- if (LangOpts.MicrosoftExt)
- Result += "#pragma optimize(\"\", on)\n";
}
void RewriteModernObjC::WriteImageInfo(std::string &Result) {
Modified: cfe/trunk/lib/Sema/SemaStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaStmt.cpp?rev=153192&r1=153191&r2=153192&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaStmt.cpp (original)
+++ cfe/trunk/lib/Sema/SemaStmt.cpp Wed Mar 21 11:17:22 2012
@@ -1886,8 +1886,13 @@
!(getLangOpts().CPlusPlus &&
(RetValExp->isTypeDependent() ||
RetValExp->getType()->isVoidType()))) {
- Diag(ReturnLoc, diag::err_return_block_has_expr);
- RetValExp = 0;
+ if (!getLangOpts().CPlusPlus &&
+ RetValExp->getType()->isVoidType())
+ Diag(ReturnLoc, diag::ext_return_has_void_expr) << "" << 2;
+ else {
+ Diag(ReturnLoc, diag::err_return_block_has_expr);
+ RetValExp = 0;
+ }
}
} else if (!RetValExp) {
return StmtError(Diag(ReturnLoc, diag::err_block_return_missing_expr));
More information about the cfe-commits
mailing list