aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2013-03-28 03:27:52 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2013-03-28 03:27:52 +0000
commiteb82a53aaa7880b7d3fd733aeee38b9aeee919ba (patch)
treeaa951a1ad7b5f137efd0e8adff14a50adaa36af4 /lib
parent8c952cd40ccec9d720931f27e7d722fed207d536 (diff)
For -Wignored-qualifiers, don't warn on qualifiers which we acquire via a
typedef. Also don't warn on the _Atomic type specifier, just on the _Atomic type qualifier. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178218 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Sema/SemaType.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp
index efbd275b8a..2bf4023548 100644
--- a/lib/Sema/SemaType.cpp
+++ b/lib/Sema/SemaType.cpp
@@ -1888,7 +1888,9 @@ static void diagnoseIgnoredQualifiers(
SourceLocation VolatileQualLoc = SourceLocation(),
SourceLocation RestrictQualLoc = SourceLocation(),
SourceLocation AtomicQualLoc = SourceLocation()) {
- assert(Quals && "no qualifiers to diagnose");
+ if (!Quals)
+ return;
+
const SourceManager &SM = S.getSourceManager();
struct Qual {
@@ -1933,12 +1935,10 @@ static void diagnoseIgnoredQualifiers(
static void diagnoseIgnoredFunctionQualifiers(Sema &S, QualType RetTy,
Declarator &D,
unsigned FunctionChunkIndex) {
- unsigned AtomicQual = RetTy->isAtomicType() ? DeclSpec::TQ_atomic : 0;
-
if (D.getTypeObject(FunctionChunkIndex).Fun.hasTrailingReturnType()) {
// FIXME: TypeSourceInfo doesn't preserve location information for
// qualifiers.
- diagnoseIgnoredQualifiers(S, RetTy.getCVRQualifiers() | AtomicQual,
+ diagnoseIgnoredQualifiers(S, RetTy.getLocalCVRQualifiers(),
D.getIdentifierLoc());
return;
}
@@ -1970,6 +1970,7 @@ static void diagnoseIgnoredFunctionQualifiers(Sema &S, QualType RetTy,
case DeclaratorChunk::MemberPointer:
// FIXME: We can't currently provide an accurate source location and a
// fix-it hint for these.
+ unsigned AtomicQual = RetTy->isAtomicType() ? DeclSpec::TQ_atomic : 0;
diagnoseIgnoredQualifiers(S, RetTy.getCVRQualifiers() | AtomicQual,
D.getIdentifierLoc());
return;
@@ -1986,7 +1987,7 @@ static void diagnoseIgnoredFunctionQualifiers(Sema &S, QualType RetTy,
// Just parens all the way out to the decl specifiers. Diagnose any qualifiers
// which are present there.
- diagnoseIgnoredQualifiers(S, D.getDeclSpec().getTypeQualifiers() | AtomicQual,
+ diagnoseIgnoredQualifiers(S, D.getDeclSpec().getTypeQualifiers(),
D.getIdentifierLoc(),
D.getDeclSpec().getConstSpecLoc(),
D.getDeclSpec().getVolatileSpecLoc(),