r233494 - [parser] Push _Atomic locs through DeclaratorChunk.
Benjamin Kramer
benny.kra at googlemail.com
Sun Mar 29 09:42:07 PDT 2015
Author: d0k
Date: Sun Mar 29 11:42:06 2015
New Revision: 233494
URL: http://llvm.org/viewvc/llvm-project?rev=233494&view=rev
Log:
[parser] Push _Atomic locs through DeclaratorChunk.
Otherwise it stays uninitialized with potentially catastrophic results.
Found by afl-fuzz.
Modified:
cfe/trunk/include/clang/Sema/DeclSpec.h
cfe/trunk/lib/Parse/ParseDecl.cpp
cfe/trunk/test/Parser/atomic.c
Modified: cfe/trunk/include/clang/Sema/DeclSpec.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/DeclSpec.h?rev=233494&r1=233493&r2=233494&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/DeclSpec.h (original)
+++ cfe/trunk/include/clang/Sema/DeclSpec.h Sun Mar 29 11:42:06 2015
@@ -1415,7 +1415,8 @@ struct DeclaratorChunk {
static DeclaratorChunk getPointer(unsigned TypeQuals, SourceLocation Loc,
SourceLocation ConstQualLoc,
SourceLocation VolatileQualLoc,
- SourceLocation RestrictQualLoc) {
+ SourceLocation RestrictQualLoc,
+ SourceLocation AtomicQualLoc) {
DeclaratorChunk I;
I.Kind = Pointer;
I.Loc = Loc;
@@ -1423,6 +1424,7 @@ struct DeclaratorChunk {
I.Ptr.ConstQualLoc = ConstQualLoc.getRawEncoding();
I.Ptr.VolatileQualLoc = VolatileQualLoc.getRawEncoding();
I.Ptr.RestrictQualLoc = RestrictQualLoc.getRawEncoding();
+ I.Ptr.AtomicQualLoc = AtomicQualLoc.getRawEncoding();
I.Ptr.AttrList = nullptr;
return I;
}
Modified: cfe/trunk/lib/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=233494&r1=233493&r2=233494&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDecl.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDecl.cpp Sun Mar 29 11:42:06 2015
@@ -4782,7 +4782,8 @@ void Parser::ParseDeclaratorInternal(Dec
D.AddTypeInfo(DeclaratorChunk::getPointer(DS.getTypeQualifiers(), Loc,
DS.getConstSpecLoc(),
DS.getVolatileSpecLoc(),
- DS.getRestrictSpecLoc()),
+ DS.getRestrictSpecLoc(),
+ DS.getAtomicSpecLoc()),
DS.getAttributes(),
SourceLocation());
else
Modified: cfe/trunk/test/Parser/atomic.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/atomic.c?rev=233494&r1=233493&r2=233494&view=diff
==============================================================================
--- cfe/trunk/test/Parser/atomic.c (original)
+++ cfe/trunk/test/Parser/atomic.c Sun Mar 29 11:42:06 2015
@@ -36,3 +36,5 @@ typedef _Atomic(int __attribute__((vecto
struct S
_Atomic atomic_s_no_missing_semicolon;
+
+int *const _Atomic atomic_return_type();
More information about the cfe-commits
mailing list