[cfe-commits] r128346 - in /cfe/trunk: lib/Basic/Diagnostic.cpp test/Index/pragma-diag-reparse.c

Argyrios Kyrtzidis akyrtzi at gmail.com
Sat Mar 26 11:58:17 PDT 2011


Author: akirtzidis
Date: Sat Mar 26 13:58:17 2011
New Revision: 128346

URL: http://llvm.org/viewvc/llvm-project?rev=128346&view=rev
Log:
For Diagnostic::Reset() also reset the state related to #pragma diagnostic. Fixes rdar://9170766.

Added:
    cfe/trunk/test/Index/pragma-diag-reparse.c
Modified:
    cfe/trunk/lib/Basic/Diagnostic.cpp

Modified: cfe/trunk/lib/Basic/Diagnostic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Diagnostic.cpp?rev=128346&r1=128345&r2=128346&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Diagnostic.cpp (original)
+++ cfe/trunk/lib/Basic/Diagnostic.cpp Sat Mar 26 13:58:17 2011
@@ -51,11 +51,6 @@
   ErrorLimit = 0;
   TemplateBacktraceLimit = 0;
 
-  // Create a DiagState and DiagStatePoint representing diagnostic changes
-  // through command-line.
-  DiagStates.push_back(DiagState());
-  PushDiagStatePoint(&DiagStates.back(), SourceLocation());
-
   Reset();
 }
 
@@ -102,6 +97,16 @@
   // displayed.
   LastDiagLevel = (DiagnosticIDs::Level)-1;
   DelayedDiagID = 0;
+
+  // Clear state related to #pragma diagnostic.
+  DiagStates.clear();
+  DiagStatePoints.clear();
+  DiagStateOnPushStack.clear();
+
+  // Create a DiagState and DiagStatePoint representing diagnostic changes
+  // through command-line.
+  DiagStates.push_back(DiagState());
+  PushDiagStatePoint(&DiagStates.back(), SourceLocation());
 }
 
 void Diagnostic::SetDelayedDiagnostic(unsigned DiagID, llvm::StringRef Arg1,

Added: cfe/trunk/test/Index/pragma-diag-reparse.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/pragma-diag-reparse.c?rev=128346&view=auto
==============================================================================
--- cfe/trunk/test/Index/pragma-diag-reparse.c (added)
+++ cfe/trunk/test/Index/pragma-diag-reparse.c Sat Mar 26 13:58:17 2011
@@ -0,0 +1,13 @@
+// RUN: env CINDEXTEST_EDITING=1 c-index-test -test-load-source-reparse 5 local %s | FileCheck %s
+
+int main (int argc, const char * argv[])
+{
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+  int x;
+#pragma clang diagnostic pop
+
+  return 0;
+}
+
+// CHECK: pragma-diag-reparse.c:7:7: VarDecl=x:7:7 (Definition) Extent=[7:3 - 7:8]





More information about the cfe-commits mailing list