[llvm-branch-commits] [cfe-tag] r95424 - in /cfe/tags/cremebrulee/cremebrulee-36.2/lib/Sema: Sema.cpp Sema.h SemaLookup.cpp

Ted Kremenek kremenek at apple.com
Fri Feb 5 12:08:06 PST 2010


Author: kremenek
Date: Fri Feb  5 14:08:06 2010
New Revision: 95424

URL: http://llvm.org/viewvc/llvm-project?rev=95424&view=rev
Log:
Merge in r95049.

Modified:
    cfe/tags/cremebrulee/cremebrulee-36.2/lib/Sema/Sema.cpp
    cfe/tags/cremebrulee/cremebrulee-36.2/lib/Sema/Sema.h
    cfe/tags/cremebrulee/cremebrulee-36.2/lib/Sema/SemaLookup.cpp

Modified: cfe/tags/cremebrulee/cremebrulee-36.2/lib/Sema/Sema.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/tags/cremebrulee/cremebrulee-36.2/lib/Sema/Sema.cpp?rev=95424&r1=95423&r2=95424&view=diff

==============================================================================
--- cfe/tags/cremebrulee/cremebrulee-36.2/lib/Sema/Sema.cpp (original)
+++ cfe/tags/cremebrulee/cremebrulee-36.2/lib/Sema/Sema.cpp Fri Feb  5 14:08:06 2010
@@ -363,7 +363,7 @@
     GlobalNewDeleteDeclared(false), 
     CompleteTranslationUnit(CompleteTranslationUnit),
     NumSFINAEErrors(0), NonInstantiationEntries(0), 
-    CurrentInstantiationScope(0) 
+    CurrentInstantiationScope(0), TyposCorrected(0)
 {
   TUScope = 0;
   if (getLangOptions().CPlusPlus)

Modified: cfe/tags/cremebrulee/cremebrulee-36.2/lib/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/tags/cremebrulee/cremebrulee-36.2/lib/Sema/Sema.h?rev=95424&r1=95423&r2=95424&view=diff

==============================================================================
--- cfe/tags/cremebrulee/cremebrulee-36.2/lib/Sema/Sema.h (original)
+++ cfe/tags/cremebrulee/cremebrulee-36.2/lib/Sema/Sema.h Fri Feb  5 14:08:06 2010
@@ -3245,6 +3245,9 @@
   /// variables.
   LocalInstantiationScope *CurrentInstantiationScope;
 
+  /// \brief The number of typos corrected by CorrectTypo.
+  unsigned TyposCorrected;
+
   /// \brief An entity for which implicit template instantiation is required.
   ///
   /// The source location associated with the declaration is the first place in

Modified: cfe/tags/cremebrulee/cremebrulee-36.2/lib/Sema/SemaLookup.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/tags/cremebrulee/cremebrulee-36.2/lib/Sema/SemaLookup.cpp?rev=95424&r1=95423&r2=95424&view=diff

==============================================================================
--- cfe/tags/cremebrulee/cremebrulee-36.2/lib/Sema/SemaLookup.cpp (original)
+++ cfe/tags/cremebrulee/cremebrulee-36.2/lib/Sema/SemaLookup.cpp Fri Feb  5 14:08:06 2010
@@ -2318,6 +2318,14 @@
   
   if (Diags.hasFatalErrorOccurred())
     return false;
+
+  // Provide a stop gap for files that are just seriously broken.  Trying
+  // to correct all typos can turn into a HUGE performance penalty, causing
+  // some files to take minutes to get rejected by the parser.
+  // FIXME: Is this the right solution?
+  if (TyposCorrected == 20)
+    return false;
+  ++TyposCorrected;
   
   // We only attempt to correct typos for identifiers.
   IdentifierInfo *Typo = Res.getLookupName().getAsIdentifierInfo();





More information about the llvm-branch-commits mailing list