<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">> ==============================================================================<br>

> --- cfe/trunk/lib/Sema/SemaLookup.cpp (original)<br>
> +++ cfe/trunk/lib/Sema/SemaLookup.cpp Wed Apr 23 07:57:01 2014<br>
> @@ -23,6 +23,9 @@<br>
> #include "clang/AST/ExprCXX.h"<br>
> #include "clang/Basic/Builtins.h"<br>
> #include "clang/Basic/LangOptions.h"<br>
> +#include "clang/Lex/HeaderSearch.h"<br>
> +#include "clang/Lex/ModuleLoader.h"<br>
> +#include "clang/Lex/Preprocessor.h"<br>
> #include "clang/Sema/DeclSpec.h"<br>
> #include "clang/Sema/ExternalSemaSource.h"<br>
> #include "clang/Sema/Overload.h"<br>
> @@ -32,6 +35,8 @@<br>
> #include "clang/Sema/SemaInternal.h"<br>
> #include "clang/Sema/TemplateDeduction.h"<br>
> #include "clang/Sema/TypoCorrection.h"<br>
> +#include "clang/Serialization/GlobalModuleIndex.h"<br>
> +#include "clang/Serialization/Module.h"<br>
> #include "llvm/ADT/STLExtras.h"<br>
> #include "llvm/ADT/SetVector.h"<br>
> #include "llvm/ADT/SmallPtrSet.h"<br>
> @@ -3924,6 +3929,7 @@ TypoCorrection Sema::CorrectTypo(const D<br>
>                                  Sema::LookupNameKind LookupKind,<br>
>                                  Scope *S, CXXScopeSpec *SS,<br>
>                                  CorrectionCandidateCallback &CCC,<br>
> +                                 CorrectTypoKind Mode,<br>
>                                  DeclContext *MemberContext,<br>
>                                  bool EnteringContext,<br>
>                                  const ObjCObjectPointerType *OPT,<br>
> @@ -3978,10 +3984,36 @@ TypoCorrection Sema::CorrectTypo(const D<br>
>   if (getLangOpts().AltiVec && Typo->isStr("vector"))<br>
>     return TypoCorrection();<br>
><br>
> -  NamespaceSpecifierSet Namespaces(Context, CurContext, SS);<br>
> -<br>
>   TypoCorrectionConsumer Consumer(*this, Typo);<br>
><br>
> +  // Get the module loader (usually compiler instance).<br>
> +  ModuleLoader &Loader = PP.getModuleLoader();<br>
> +<br>
> +  // Look for the symbol in non-imported modules, but only if an error<br>
> +  // actually occurred.<br>
> +  if ((Mode == CTK_ErrorRecovery) && !Loader.buildingModule() &&<br>
> +      getLangOpts().Modules && getLangOpts().ModulesSearchAll) {<br>
> +    // Load global module index, or retrieve a previously loaded one.<br>
> +    GlobalModuleIndex *GlobalIndex = Loader.loadGlobalModuleIndex(<br>
> +      TypoName.getLocStart());<br>
> +<br>
> +    // Only if we have a global index.<br>
> +    if (GlobalIndex) {<br>
> +      GlobalModuleIndex::HitSet FoundModules;<br>
> +<br>
> +      // Find the modules that reference the identifier.<br>
> +      // Note that this only finds top-level modules.<br>
> +      // We'll let diagnoseTypo find the actual declaration module.<br>
> +      if (GlobalIndex->lookupIdentifier(Typo->getName(), FoundModules)) {<br>
<br>
This introduces a cyclic dependency from clangSema to clangSerialization, breaking the shared cmake build.<br>
<br>
- Ben<br>
<br>
> +        TypoCorrection TC(TypoName.getName(), (NestedNameSpecifier *)0, 0);<br>
> +        TC.setCorrectionRange(SS, TypoName);<br>
> +        TC.setRequiresImport(true);<br>
> +      }<br>
> +    }<br>
> +  }<br>
> +<br><br>
> _______________________________________________<br>
> cfe-commits mailing list<br>
> <a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
<br>
</blockquote></div><div class="gmail_extra"><br></div>Sorry about that.  I'm going to refactor it with a callback.<br><br>-John<br clear="all"><div><br></div>-- <br>John Thompson<br><a href="mailto:John.Thompson.JTSoftware@gmail.com">John.Thompson.JTSoftware@gmail.com</a><br>

</div></div>