]> granicus.if.org Git - clang/commitdiff
CXXThisScopeRAII objects aren't free, don't compute one if it's unused.
authorBenjamin Kramer <benny.kra@googlemail.com>
Thu, 17 May 2012 12:01:52 +0000 (12:01 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Thu, 17 May 2012 12:01:52 +0000 (12:01 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156987 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseCXXInlineMethods.cpp
lib/Parse/ParseDecl.cpp
lib/Sema/SemaTemplateInstantiate.cpp

index 2a64be53f77957ad1523aa7ee09f3162e9623496..d623abcff9ae6fc3ae216ca862557e173768a71d 100644 (file)
@@ -459,7 +459,7 @@ void Parser::ParseLexedMemberInitializers(ParsingClass &Class) {
     Actions.ActOnStartDelayedMemberDeclarations(getCurScope(),
                                                 Class.TagOrTemplate);
 
-  {
+  if (!Class.LateParsedDeclarations.empty()) {
     // C++11 [expr.prim.general]p4:
     //   Otherwise, if a member-declarator declares a non-static data member 
     //  (9.2) of a class X, the expression this is a prvalue of type "pointer
index d1350104bc3781d21071ba16b70fd24490b2fdb1..c3ffd9e135d151e311197304827afedbe694a960 100644 (file)
@@ -742,7 +742,7 @@ void Parser::ParseLexedAttributes(ParsingClass &Class) {
   if (!AlreadyHasClassScope)
     Actions.ActOnStartDelayedMemberDeclarations(getCurScope(),
                                                 Class.TagOrTemplate);
-  {
+  if (!Class.LateParsedDeclarations.empty()) {
     // Allow 'this' within late-parsed attributes.
     Sema::CXXThisScopeRAII ThisScope(Actions, Class.TagOrTemplate, 
                                      /*TypeQuals=*/0);
index 344af6097d8034ce65675353181d47e494732f67..dc0f288c50574d6d68199188139d633b11a9cd89 100644 (file)
@@ -1942,7 +1942,7 @@ Sema::InstantiateClass(SourceLocation PointOfInstantiation,
   CheckCompletedCXXClass(Instantiation);
 
   // Attach any in-class member initializers now the class is complete.
-  {
+  if (!FieldsWithMemberInitializers.empty()) {
     // C++11 [expr.prim.general]p4:
     //   Otherwise, if a member-declarator declares a non-static data member 
     //  (9.2) of a class X, the expression this is a prvalue of type "pointer