[lld] r341228 - [DebugInfo] Common behavior for error types

Alexandre Ganea via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 31 10:41:58 PDT 2018


Author: aganea
Date: Fri Aug 31 10:41:58 2018
New Revision: 341228

URL: http://llvm.org/viewvc/llvm-project?rev=341228&view=rev
Log:
[DebugInfo] Common behavior for error types

Following D50807, and heading towards D50664, this intermediary change does the following:

1. Upgrade all custom Error types in llvm/trunk/lib/DebugInfo/ to use the new StringError behavior (D50807).
2. Implement std::is_error_code_enum and make_error_code() for DebugInfo error enumerations.
3. Rename GenericError -> PDBError (the file will be renamed in a subsequent commit)
4. Update custom error messages to follow the same formatting: (\w\s*)+\.
5. Keep generic "file not found" (ENOENT) errors as they are in PDB code. Previously, there used to be a custom enumeration for that purpose.
6. Remove a few extraneous LF in log() implementations. Printing LF is a responsability at a higher level, not at the error level.

Differential Revision: https://reviews.llvm.org/D51499

Modified:
    lld/trunk/COFF/PDB.cpp

Modified: lld/trunk/COFF/PDB.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/PDB.cpp?rev=341228&r1=341227&r2=341228&view=diff
==============================================================================
--- lld/trunk/COFF/PDB.cpp (original)
+++ lld/trunk/COFF/PDB.cpp Fri Aug 31 10:41:58 2018
@@ -326,8 +326,8 @@ tryToLoadPDB(const GUID &GuidFromObj, St
   // PDB file doesn't mean it matches.  For it to match the InfoStream's GUID
   // must match the GUID specified in the TypeServer2 record.
   if (ExpectedInfo->getGuid() != GuidFromObj)
-    return make_error<pdb::GenericError>(
-        pdb::generic_error_code::type_server_not_found, TSPath);
+    return make_error<pdb::PDBError>(
+        pdb::pdb_error_code::type_server_not_found, TSPath);
 
   return std::move(NS);
 }
@@ -339,8 +339,8 @@ Expected<const CVIndexMap&> PDBLinker::m
 
   // First, check if the PDB has previously failed to load.
   if (MissingTypeServerPDBs.count(TSId))
-    return make_error<pdb::GenericError>(
-      pdb::generic_error_code::type_server_not_found, TSPath);
+    return make_error<pdb::PDBError>(
+      pdb::pdb_error_code::type_server_not_found, TSPath);
 
   // Second, check if we already loaded a PDB with this GUID. Return the type
   // index mapping if we have it.




More information about the llvm-commits mailing list