This is an archive of the discontinued LLVM Phabricator instance.

[Sema] Store deduced type in TypeLoc
Changes PlannedPublic

Authored by ilya-biryukov on Jan 9 2020, 3:44 AM.

Details

Reviewers
None
Summary

This greatly simplifies source-level tools that need to know what 'auto'
deduced to, e.g. clangd.

Also change default presentation of such types to print 'auto' instead
of the deduced type. To print the deduced types, one shoould set the
PrintingPolicy::Flag to true.

Diff Detail

Event Timeline

ilya-biryukov created this revision.Jan 9 2020, 3:44 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 9 2020, 3:44 AM
ilya-biryukov planned changes to this revision.EditedJan 9 2020, 3:46 AM

This produces the following test failures after running check-clang:

Failing Tests (4):                                                                                                                                                                                                 
    Clang :: CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.class.deduct/p1.cpp                                                                                                                                            
    Clang :: SemaCXX/cxx1z-class-template-argument-deduction.cpp                                                                                                                                                   
    Clang-Unit :: Rename/./ClangRenameTests/RenameClassTests/RenameClassTest.RenameClasses/34                                                                                                                      
    Clang-Unit :: Rename/./ClangRenameTests/RenameEnumTests/RenameEnumTest.RenameEnums/7

All 4 are source-location and declaration-printing-related. Could probably be fixed.
Putting the change here, so that it does not get lost, but I've spent my time budget on this (at least for now).

Unit tests: fail. 61166 tests passed, 9 failed and 729 were skipped.

failed: Clang.CXX/dcl_dcl/dcl_spec/dcl_type/dcl_type_class_deduct/p1.cpp
failed: Clang.SemaCXX/cxx1z-class-template-argument-deduction.cpp
failed: Clang-Unit.Rename/_/ClangRenameTests/RenameClassTests/RenameClassTest.RenameClasses/34
failed: Clang-Unit.Rename/_/ClangRenameTests/RenameEnumTests/RenameEnumTest.RenameEnums/7
failed: Clangd Unit Tests._/ClangdTests/Hover.NoHover
failed: Clangd Unit Tests._/ClangdTests/SymbolInfoTests.All
failed: Clangd Unit Tests._/ClangdTests/TargetDeclTest.Lambda
failed: Clangd Unit Tests._/ClangdTests/TargetDeclTest.Types
failed: Extra Tools Unit Tests.clang-include-fixer/find-all-symbols/_/FindAllSymbolsTests/FindAllSymbolsTest.EnumTest

clang-tidy: pass.

clang-format: pass.

Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml

nridge added a subscriber: nridge.Jan 9 2020, 1:19 PM