summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-05-12 21:44:00 +0000
committerChris Lattner <sabre@nondot.org>2009-05-12 21:44:00 +0000
commitd98e7cf7c10d3569b6d95af2d2f2ce11cd8ef5ba (patch)
tree7d41245f1bdef7e107241b60e876d8a50e0ada5e /clang/lib/Sema/SemaDecl.cpp
parent36312bb5ee3afe2b71c6a678929184c2962b8d41 (diff)
downloadbcm5719-llvm-d98e7cf7c10d3569b6d95af2d2f2ce11cd8ef5ba.tar.gz
bcm5719-llvm-d98e7cf7c10d3569b6d95af2d2f2ce11cd8ef5ba.zip
improve the diagnostic for uses of the GCC "global variable in a register" extension.
This implements rdar://6880449 - improve diagnostic for usage of "global register variable" GCC extension llvm-svn: 71599
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index d8b6f45e37a..b233021c42b 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -1742,7 +1742,13 @@ Sema::ActOnVariableDeclarator(Scope* S, Declarator& D, DeclContext* DC,
// C99 6.9p2: The storage-class specifiers auto and register shall not
// appear in the declaration specifiers in an external declaration.
if (SC == VarDecl::Auto || SC == VarDecl::Register) {
- Diag(D.getIdentifierLoc(), diag::err_typecheck_sclass_fscope);
+
+ // If this is a register variable with an asm label specified, then this
+ // is a GNU extension.
+ if (SC == VarDecl::Register && D.getAsmLabel())
+ Diag(D.getIdentifierLoc(), diag::err_unsupported_global_register);
+ else
+ Diag(D.getIdentifierLoc(), diag::err_typecheck_sclass_fscope);
D.setInvalidType();
}
}
OpenPOWER on IntegriCloud