r195419 - Make ASTUnit structure stable with NDEBUG

Alp Toker alp at nuanti.com
Thu Nov 21 23:49:39 PST 2013


Author: alp
Date: Fri Nov 22 01:49:39 2013
New Revision: 195419

URL: http://llvm.org/viewvc/llvm-project?rev=195419&view=rev
Log:
Make ASTUnit structure stable with NDEBUG

ASTUnit instances are allocated infrequently so it's fine to keep this field
around in all build configurations.

Assigns null to silence -Wunused-private-field in Release.

Modified:
    cfe/trunk/include/clang/Frontend/ASTUnit.h
    cfe/trunk/lib/Frontend/ASTUnit.cpp

Modified: cfe/trunk/include/clang/Frontend/ASTUnit.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/ASTUnit.h?rev=195419&r1=195418&r2=195419&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/ASTUnit.h (original)
+++ cfe/trunk/include/clang/Frontend/ASTUnit.h Fri Nov 22 01:49:39 2013
@@ -406,9 +406,7 @@ private:
   /// just about any usage.
   /// Becomes a noop in release mode; only useful for debug mode checking.
   class ConcurrencyState {
-#ifndef NDEBUG
     void *Mutex; // a llvm::sys::MutexImpl in debug;
-#endif
 
   public:
     ConcurrencyState();

Modified: cfe/trunk/lib/Frontend/ASTUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/ASTUnit.cpp?rev=195419&r1=195418&r2=195419&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/ASTUnit.cpp (original)
+++ cfe/trunk/lib/Frontend/ASTUnit.cpp Fri Nov 22 01:49:39 2013
@@ -2953,7 +2953,7 @@ void ASTUnit::ConcurrencyState::finish()
 
 #else // NDEBUG
 
-ASTUnit::ConcurrencyState::ConcurrencyState() {}
+ASTUnit::ConcurrencyState::ConcurrencyState() { Mutex = 0; }
 ASTUnit::ConcurrencyState::~ConcurrencyState() {}
 void ASTUnit::ConcurrencyState::start() {}
 void ASTUnit::ConcurrencyState::finish() {}





More information about the cfe-commits mailing list