r228119 - Register parameters have local storage.
Anna Zaks
ganna at apple.com
Tue Feb 3 23:15:12 PST 2015
Author: zaks
Date: Wed Feb 4 01:15:12 2015
New Revision: 228119
URL: http://llvm.org/viewvc/llvm-project?rev=228119&view=rev
Log:
Register parameters have local storage.
Fixes a regression introduced in r209149.
Modified:
cfe/trunk/include/clang/AST/Decl.h
cfe/trunk/test/Analysis/stack-addr-ps.c
Modified: cfe/trunk/include/clang/AST/Decl.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Decl.h?rev=228119&r1=228118&r2=228119&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Decl.h (original)
+++ cfe/trunk/include/clang/AST/Decl.h Wed Feb 4 01:15:12 2015
@@ -840,7 +840,7 @@ public:
return !isFileVarDecl() && getTSCSpec() == TSCS_unspecified;
// Global Named Register (GNU extension)
- if (getStorageClass() == SC_Register && !isLocalVarDecl())
+ if (getStorageClass() == SC_Register && !isLocalVarDeclOrParm())
return false;
// Return true for: Auto, Register.
Modified: cfe/trunk/test/Analysis/stack-addr-ps.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/stack-addr-ps.c?rev=228119&r1=228118&r2=228119&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/stack-addr-ps.c (original)
+++ cfe/trunk/test/Analysis/stack-addr-ps.c Wed Feb 4 01:15:12 2015
@@ -90,3 +90,10 @@ RDar10348049 test_rdar10348049(void) {
return b; // no-warning
}
+void testRegister(register const char *reg) {
+ if (reg) (void)reg[0];
+}
+void callTestRegister() {
+ char buf[20];
+ testRegister(buf); // no-warning
+}
More information about the cfe-commits
mailing list