Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
147 commits
Select commit Hold shift + click to select a range
e7f8fa9
CachedReachabilityAA constructor: drop templates
aleclearmind Jan 29, 2023
b5e66fc
libc++ tests: link libc++abi too
aleclearmind Jan 29, 2023
2f98e72
cstdlib: implement aligned_alloc
aleclearmind Jan 29, 2023
96c0bae
libcxx: expect failures due to old glibc
aleclearmind Jan 31, 2023
40999c8
runtimes: forward CMAKE_C{,XX}_COMPILER
aleclearmind Jan 29, 2023
799f199
Ignore mold's $plt and $got symbols
aleclearmind Feb 4, 2024
118a82a
Silence noisy profiling counter warning
aleclearmind Apr 17, 2026
8feb943
Add -fcase-insensitive-paths flag
aleclearmind Feb 18, 2026
53d1141
Retain decl-only subprograms in CodeView
aleclearmind Feb 18, 2026
5ab7de2
Add -fdebug-info-allowed-file flag
aleclearmind Feb 18, 2026
e966bb5
Add LF_ALIAS support to CodeView type system
aleclearmind Feb 27, 2026
5e28924
[LVI] Use !range metadata for supported intrinsics
nikic Jan 26, 2023
4524bab
[ConstantRange] Handle `Intrinsic::ctlz`
antoniofrighetto Feb 17, 2023
9ad18d8
MachO: improve relocation information
aleclearmind May 21, 2019
5f14515
YAML::SequenceTraits: support custom inserter
aleclearmind Jan 27, 2021
fa58fc6
YAMLTraits: support quoted EnumScalar
aleclearmind Feb 10, 2021
22ac7be
Add support to Dominators for FilteredGraphTraits
pfez Feb 24, 2020
1eaa662
Enable PDT on GraphTraits using mapped_iterator
pfez May 27, 2021
440a98a
Quote ambiguous boolean-like strings
Mar 7, 2022
e2f5705
MLIR Dominance: use DominatorTreeOnView
mrjackv Jun 1, 2022
98ee492
mlir::raw_indented_ostream: custom indent value
mrjackv Jun 1, 2022
900d80c
[SimplifyIndVar] Make getInsertPointForUses() public
Oct 21, 2022
4adf649
Make ExitOnError constructor external
aleclearmind Dec 8, 2022
8672527
Triple.cpp: fix getArchTypeForLLVMName for "x86_64"
pfez Jun 23, 2020
216b68d
Fix memory leak in `CreateSigAltStack`
pfez Mar 5, 2019
3307db5
Drop `git remote` from --version
aleclearmind Sep 2, 2020
3ca701d
Drop: assertion too strict for revng usecase
drblallo Jul 1, 2022
ea7ad6d
Customize Doxygen documentation
andrealinux1 Nov 29, 2018
a7e8a97
~ErrorAdapter: add override
aleclearmind Apr 5, 2023
bf23ea6
GenericDomTreeConstruction: add parentheses
aleclearmind Apr 5, 2023
5a5775e
ScopedPrinter: mark destructors as override
aleclearmind Apr 5, 2023
73c4a67
DIFinder::processInstruction: handle revng.loop
aleclearmind Apr 13, 2023
4f85ee7
IntervalMap: suppress enum-related warnings
aleclearmind May 15, 2023
edf78cf
clang: mark ~TargetOMPContext as override
May 17, 2023
7ed37ea
InstPrinter: add missing `imm` tag for AT&T
Cvelth Apr 18, 2023
d2d53e5
InstPrinter: explicitly mark `pc` as `register`
Cvelth Apr 19, 2023
3f6b01b
InstPrinter: introduce address tagging for x86
Cvelth Apr 6, 2023
2e9f547
InstPrinter: introduce address tagging for AArch64
Cvelth Apr 6, 2023
a6a37ea
InstPrinter: introduce address tagging for ARM
Cvelth Apr 6, 2023
1fb4111
InstPrinter: introduce address tagging for Mips
Cvelth Apr 6, 2023
f554245
InstPrinter: introduce address tagging for SystemZ
Cvelth Apr 19, 2023
431b015
New SetOperations and unittesting for all SetOperations
teresajohnson Feb 16, 2023
210d7c1
[ADT][NFC] Fix compilation of headers under C++23
vogelsgesang May 4, 2023
5b57095
[llvm] Fix compilation of headers under C++23
Cvelth May 16, 2023
36f4998
MLIR: explicit instantiation for `DomTreeBuilder`
May 16, 2023
1a5116c
ViewOpGraph: introduce CFG edges printing
Mar 1, 2023
0a9750c
ViewOpGraph: option to print first and last ops
Apr 17, 2023
ca5212d
SetVector: implement `takeSet` method
Jul 19, 2023
92fa38a
mlir: do not force C++17
aleclearmind Aug 1, 2023
5fd1326
llvm::get_threadid: use pthread_self on Linux
aleclearmind Jan 15, 2023
5ce6582
Introduce llvm::Progress
aleclearmind Jan 15, 2023
4e4c676
Improve messages in progress bars
pfez Aug 29, 2023
46f1068
[mlir][LLVM] Add param attr verifiers
Dinistro Mar 5, 2023
3bc0a98
[mlir][LLVM] Add result attribute import support
Dinistro Mar 6, 2023
f51b538
[mlir][llvm] Import access group metadata.
gysit Mar 6, 2023
c3727e8
Reland "[mlir][LLVM] Add all LLVM parameter attributes"
Dinistro Mar 6, 2023
ce6122b
[MLIR] Convert remaining tests to opaque pointers (NFC)
nikic Mar 6, 2023
b7e52bb
[mlir][llvm] Opaque pointer support for atomic and call ops.
gysit Mar 6, 2023
501094f
[mlir][llvm] Add structured loop metadata
Dinistro Mar 6, 2023
927765d
[mlir][llvm] Use tablegen for enum conversion.
gysit Mar 6, 2023
bef18b5
[mlir][llvm] Fix bug in constant import from LLVM IR.
gysit Mar 6, 2023
752d21c
[mlir][llvm] Drop opaque ptr test in LLVM IR import.
gysit Mar 6, 2023
321eb61
[mlir][llvm] Add missing license header (NFC)
Dinistro Mar 6, 2023
ed4f94e
[mlir][llvm] Add support for loop metadata import
Dinistro Mar 6, 2023
f9c30f6
[mlir][llvm] Add MD_prof import error handling
Dinistro Mar 6, 2023
53d342e
[mlir][llvm] Purge struct_attr
Dinistro Mar 6, 2023
69748c7
[mlir][llvm] Add extra attributes to the atomic ops.
gysit Mar 6, 2023
9ba5616
[mlir][llvm] Fuse MD_access_group & MD_loop import
Dinistro Mar 6, 2023
2314bf2
[mlir][llvm] Store memory op metadata using op attributes.
gysit Mar 6, 2023
8a5f516
[mlir][llvm] Fix TBAA verfication crash
Dinistro Mar 6, 2023
a65660a
[mlir][llvm] Adapt loop metadata to match llvm
Dinistro Mar 6, 2023
920aa72
Reland [mlir][func] Use the generated pass options in func to llvm.
gysit Mar 6, 2023
3ec762b
[milr][llvm] Add remaining loop metadata support
Dinistro Mar 6, 2023
3c10b8e
[mlir][llvm] Improve LoadOp and StoreOp import.
gysit Mar 6, 2023
62db45a
[mlir][llvm] Reintroduce string based attribute setting.
gysit Mar 6, 2023
65c1d76
[mlir] Drop unused arith conversion class (NFC)
Dinistro Mar 6, 2023
e233161
[MLIR] Reintroduce shared attribute names in the LLVM dialect
Mar 6, 2023
c8e8bb1
[mlir][llvm] Make LoopAnnotations non-discardable
Dinistro Mar 6, 2023
467460d
[mlir][llvm] Import alias scope metadata from LLVM IR.
gysit Mar 6, 2023
9cbf47c
[mlir] Port Conversion Passes to LLVM to use TableGen generated const…
zero9178 Mar 6, 2023
8a09c6e
[mlir][MemRef] Add required address space cast when lowering alloc to…
zero9178 Mar 6, 2023
e0e3ea9
[mlir][Conversion] Rename the MemRefToLLVM pass
qcolombet Mar 6, 2023
620d2c8
[mlir] Add nontemporal field to memref.load/store and convey to llvm.…
grypp Mar 6, 2023
f07ea8d
[mlir][MemRef] Add option to to emit opaque pointers
zero9178 Mar 6, 2023
d42d893
[mlir][GPU] add required address space cast when lowering to LLVM
zero9178 Mar 6, 2023
a12167c
[mlir][LLVM] Verify correct pointer casts with
zero9178 Mar 6, 2023
35c7bfc
[mlir][llvm] Rename void debug type to null
Dinistro Mar 6, 2023
fd71c28
[mlir][llvm] Use before def debug intrinsic import
Dinistro Mar 6, 2023
5665654
[mlir][llvm] Verify LLVM module before import
Dinistro Mar 6, 2023
6186345
[mlir] fix LLVM IR translation of vector<... x index>
ftynse Mar 6, 2023
4adb556
[mlir][llvm] Add atomic support to the LoadOp.
gysit Mar 6, 2023
cb3ba88
[mlir][llvm] Make DI param optional to match LLVM
Dinistro Mar 6, 2023
4e6f95e
[mlir][llvm] Add DINamespace attribute
Dinistro Mar 6, 2023
ba467c2
[mlir][llvm] Fuse access_group & loop export (NFC)
Dinistro Mar 6, 2023
4486370
[mlir][llvm] Add atomic support to the StoreOp.
gysit Mar 6, 2023
9858b19
[mlir][llvm] Add FastmathFlagsInterface only once (NFC).
gysit Mar 6, 2023
d9b6d70
[mlir][llvm] Builders dont access null attr (NFC)
Dinistro Mar 6, 2023
48d3773
[mlir][llvm] Stop exporting empty debug MD strings
Dinistro Mar 6, 2023
cdfbd12
[mlir][llvm] Add missing bit manipulation intrs
Dinistro Jul 13, 2023
b526bba
[mlir][llvm] Fix bswap naming (NFC)
Dinistro Jul 13, 2023
f53c2fe
[mlir][llvm] Add trap intrinsics to the dialect
Jul 13, 2023
35ae208
[mlir][llvm] Saturation arithmetic intrinsics.
gysit Jul 18, 2023
5cdd836
GenericDomTreeConstruction: add `constexpr`
Jan 8, 2024
fb136e7
[mlir] Fix infinite recursion in alias initializer
zero9178 Aug 26, 2023
a1da679
ErrorHandling: reserve memory for OOM
mrjackv Sep 11, 2024
f070062
ErrorHandling: do not print stack twice on OOM
mrjackv Sep 16, 2024
3c90f1f
[STLExtras] Convert friend == and != to member
vasama-work Oct 30, 2024
22aff49
Add zstd support to llvm::parseIR
mrjackv Nov 14, 2024
d1de186
ADT::GenericCycleInfo: Introduce GraphView param
Jan 31, 2025
64ca0ff
Add SROANoArrays cl::opt
pfez Apr 7, 2025
1197e64
Make InstCombine MaxArraySize cl::opt public
pfez Apr 7, 2025
eaf4788
[mlir] Print aliases for recursive types
vasama-work Apr 28, 2025
c09d253
Add AsmPrinter::getCurrentTypeOrAttrAlias
vasama-work Apr 28, 2025
3815ef1
InstructionSimplify: respect NullPointerIsValid
pfez Jun 9, 2025
4c67a20
Add DialectBytecodeReader::getContext
vasama-work Apr 28, 2025
bb023b7
[DebugInfo][SimplifyCFGPass] Fix the missing debug location update fo…
Apochens Jul 5, 2024
4d36a0c
[DebugInfo][InstCombine] Fix missing source and variable locations af…
OCHyams Apr 27, 2023
7028be8
BasicBlockUtils: preserve `split` phi debug information
Cvelth Jul 14, 2025
cff29a2
BasicBlockUtils: preserve `.ph` phi debug information
Cvelth Jul 14, 2025
cb2caee
LoopSimplify: preserve `split` phi debug information
Cvelth Jul 14, 2025
5d0c83b
ScalarEvolutionExpander: preserve `indvar` phi debug information
Cvelth Jul 14, 2025
8077941
SimplifyCFG: preserve `.sink` phi debug information
Cvelth Jul 14, 2025
7f38b8e
LICM: preserve `.lcssa` phi debug information
Cvelth Jul 14, 2025
4630c47
SimplifyCFGPass: preserve `common.` basic block debug information
Cvelth Jul 14, 2025
9e26069
PointerReplacer: preserve phi debug information
Cvelth Jul 14, 2025
e659f8a
InstCombinePHI: preserve `.pn` phi debug information
Cvelth Jul 14, 2025
1100137
InstCombinePHI: preserve `.in` phi debug information
Cvelth Jul 14, 2025
0d5434a
InstCombinePHI: preserve `.shrunk` phi debug information
Cvelth Jul 14, 2025
a04c466
Introduce a debug information preservation style
Cvelth Aug 11, 2025
60bc843
LICM: do not discard debug information
Cvelth Jul 14, 2025
fd5eb05
PromoteMem2Reg: do not discard debug information
Cvelth Jul 14, 2025
04d1d9e
SimplifyCFG: do not discard debug information
Cvelth Jul 14, 2025
35001d7
SSAUpdater: attach basic debug information to new Phis
Cvelth Jul 14, 2025
d8814be
Error: print error messages in non-debug builds
Cvelth Jul 21, 2025
f250676
InstCombine: prevent usage of illegal types
aleclearmind Nov 12, 2025
f6c1856
CodeExtractor: fix debug message
aleclearmind Nov 27, 2025
ba502e0
AsmWriter: introduce --emit-hex-constant-literals-from
aleclearmind Nov 27, 2025
14d95e6
cloneModule: allow omitting values
mrjackv Jan 27, 2026
7c35108
[mlir] Relax requirement on memory buffer creation.
jpienaar Aug 30, 2023
272ff29
[ADT] Add deduction guide for iterator_range
steakhal Jul 3, 2023
098e77f
[NFC][ADT] Add reverse iterators and `value_type` to StringRef (#105579)
jurahul Aug 22, 2024
86c4166
[ADT] Allow reverse to find free rbegin/rend functions (#87840)
kuhar Mar 31, 2026
7ee1198
[ADT] Add llvm::mismatch and llvm::range_size range wrappers
aleclearmind Mar 31, 2026
f82a018
[NFC][ADT] Add RadixTree (#164524)
vitalybuka Mar 31, 2026
8955c8c
[ADT][NFC] Add missing #include <vector> (#165068)
rupprecht Oct 25, 2025
5c7d083
[ADT] Remove #include <limits> in RadixTree.h (NFC) (#165115)
kazutakahirata Oct 25, 2025
722c969
[RadixTree] Use std::optional for Node::Value (#165299)
vitalybuka Oct 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
18 changes: 9 additions & 9 deletions clang/docs/doxygen.cfg.in
Original file line number Diff line number Diff line change
Expand Up @@ -1126,7 +1126,7 @@ HTML_TIMESTAMP = YES
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.

HTML_DYNAMIC_SECTIONS = NO
HTML_DYNAMIC_SECTIONS = YES

# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries
# shown in the various tree structured indices initially; the user can expand
Expand All @@ -1153,7 +1153,7 @@ HTML_INDEX_NUM_ENTRIES = 100
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.

GENERATE_DOCSET = NO
GENERATE_DOCSET = YES

# This tag determines the name of the docset feed. A documentation feed provides
# an umbrella under which multiple documentation sets from a single provider
Expand All @@ -1169,15 +1169,15 @@ DOCSET_FEEDNAME = "Doxygen generated docs"
# The default value is: org.doxygen.Project.
# This tag requires that the tag GENERATE_DOCSET is set to YES.

DOCSET_BUNDLE_ID = org.doxygen.Project
DOCSET_BUNDLE_ID = clang

# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify
# the documentation publisher. This should be a reverse domain-name style
# string, e.g. com.mycompany.MyDocSet.documentation.
# The default value is: org.doxygen.Publisher.
# This tag requires that the tag GENERATE_DOCSET is set to YES.

DOCSET_PUBLISHER_ID = org.doxygen.Publisher
DOCSET_PUBLISHER_ID = Publisher

# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher.
# The default value is: Publisher.
Expand Down Expand Up @@ -1252,7 +1252,7 @@ TOC_EXPAND = NO
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.

GENERATE_QHP = @clang_doxygen_generate_qhp@
GENERATE_QHP = YES

# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify
# the file name of the resulting .qch file. The path specified is relative to
Expand All @@ -1267,7 +1267,7 @@ QCH_FILE = @clang_doxygen_qch_filename@
# The default value is: org.doxygen.Project.
# This tag requires that the tag GENERATE_QHP is set to YES.

QHP_NAMESPACE = @clang_doxygen_qhp_namespace@
QHP_NAMESPACE = clang

# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt
# Help Project output. For more information please see Qt Help Project / Virtual
Expand Down Expand Up @@ -1337,7 +1337,7 @@ ECLIPSE_DOC_ID = org.doxygen.Project
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.

DISABLE_INDEX = NO
DISABLE_INDEX = YES

# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
# structure should be generated to display hierarchical information. If the tag
Expand Down Expand Up @@ -1468,7 +1468,7 @@ MATHJAX_CODEFILE =
# The default value is: YES.
# This tag requires that the tag GENERATE_HTML is set to YES.

SEARCHENGINE = @enable_searchengine@
SEARCHENGINE = NO

# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
# implemented using a web server instead of a web client using Javascript. There
Expand Down Expand Up @@ -2090,7 +2090,7 @@ CLASS_GRAPH = YES
# The default value is: YES.
# This tag requires that the tag HAVE_DOT is set to YES.

COLLABORATION_GRAPH = YES
COLLABORATION_GRAPH = NO

# If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for
# groups, showing the direct groups dependencies.
Expand Down
2 changes: 1 addition & 1 deletion clang/include/clang/AST/OpenMPClause.h
Original file line number Diff line number Diff line change
Expand Up @@ -8851,7 +8851,7 @@ struct TargetOMPContext final : public llvm::omp::OMPContext {
const FunctionDecl *CurrentFunctionDecl,
ArrayRef<llvm::omp::TraitProperty> ConstructTraits);

virtual ~TargetOMPContext() = default;
virtual ~TargetOMPContext() override = default;

/// See llvm::omp::OMPContext::matchesISATrait
bool matchesISATrait(StringRef RawString) const override;
Expand Down
4 changes: 4 additions & 0 deletions clang/include/clang/Basic/CodeGenOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,10 @@ class CodeGenOptions : public CodeGenOptionsBase {
/// by sanitizer coverage pass.
std::vector<std::string> SanitizeCoverageAllowlistFiles;

/// Files whose declarations get rich debug info (types retained and
/// declaration-only subprograms emitted).
std::vector<std::string> DebugInfoAllowedFiles;

/// The guard style used for stack protector to get a initial value, this
/// value usually be gotten from TLS or get from __stack_chk_guard, or some
/// other styles we may implement in the future.
Expand Down
5 changes: 5 additions & 0 deletions clang/include/clang/Basic/FileSystemOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ class FileSystemOptions {
/// If set, paths are resolved as if the working directory was
/// set to the value of WorkingDir.
std::string WorkingDir;

/// If set, file lookups that fail are retried with a case-insensitive
/// directory scan. Useful for compiling against SDKs whose header paths
/// use a different case than the #include directives.
bool CaseInsensitivePaths = false;
};

} // end namespace clang
Expand Down
9 changes: 9 additions & 0 deletions clang/include/clang/Driver/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -1282,6 +1282,11 @@ def fdebug_compilation_dir_EQ : Joined<["-"], "fdebug-compilation-dir=">,
Group<f_Group>, Flags<[CC1Option, CC1AsOption, CoreOption]>,
HelpText<"The compilation directory to embed in the debug info">,
MarshallingInfoString<CodeGenOpts<"DebugCompilationDir">>;
def fdebug_info_allowed_file_EQ : Joined<["-"], "fdebug-info-allowed-file=">,
Group<f_Group>, Flags<[CC1Option, CoreOption]>,
HelpText<"Emit rich debug info only for declarations from the given file "
"(repeatable)">,
MarshallingInfoStringVector<CodeGenOpts<"DebugInfoAllowedFiles">>;
def fdebug_compilation_dir : Separate<["-"], "fdebug-compilation-dir">,
Group<f_Group>, Flags<[CC1Option, CC1AsOption, CoreOption]>,
Alias<fdebug_compilation_dir_EQ>;
Expand Down Expand Up @@ -4376,6 +4381,10 @@ def working_directory : Separate<["-"], "working-directory">, Flags<[CC1Option]>
MarshallingInfoString<FileSystemOpts<"WorkingDir">>;
def working_directory_EQ : Joined<["-"], "working-directory=">, Flags<[CC1Option]>,
Alias<working_directory>;
def fcase_insensitive_paths : Flag<["-"], "fcase-insensitive-paths">,
Flags<[CC1Option]>,
HelpText<"Retry failed file lookups with a case-insensitive directory scan">,
MarshallingInfoFlag<FileSystemOpts<"CaseInsensitivePaths">>;

// Double dash options, which are usually an alias for one of the previous
// options.
Expand Down
59 changes: 51 additions & 8 deletions clang/lib/Basic/FileManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,43 @@ FileManager::getBufferForFileImpl(StringRef Filename, int64_t FileSize,
isVolatile);
}

/// Walk a path component-by-component, resolving each level with a
/// case-insensitive directory scan. Returns the real-cased path on success.
static std::optional<std::string>
findPathCaseInsensitive(StringRef CaseInsensitivePath) {
using llvm::sys::fs::directory_iterator;
namespace path = llvm::sys::path;

SmallString<256> Resolved = path::root_path(CaseInsensitivePath);
StringRef Relative = path::relative_path(CaseInsensitivePath);
if (Relative.empty())
return std::nullopt;

for (StringRef Component :
llvm::make_range(path::begin(Relative), path::end(Relative))) {
std::error_code EC;
std::string Match;
unsigned Hits = 0;
for (directory_iterator It(Resolved, EC), End; It != End && !EC;
It.increment(EC)) {
StringRef EntryName = path::filename(It->path());
if (EntryName.equals_insensitive(Component)) {
Comment thread
pfez marked this conversation as resolved.
if (Hits == 0)
Match = EntryName.str();
++Hits;
}
}
if (EC || Hits == 0)
return std::nullopt;
if (Hits > 1)
llvm::errs() << "warning: ambiguous case-insensitive match for '"
<< Component << "' in '" << Resolved
<< "'; picking '" << Match << "'\n";
path::append(Resolved, Match);
}
return Resolved.str().str();
}

/// getStatValue - Get the 'stat' information for the specified path,
/// using the cache to accelerate it if possible. This returns true
/// if the path points to a virtual file or does not exist, or returns
Expand All @@ -587,15 +624,21 @@ FileManager::getStatValue(StringRef Path, llvm::vfs::Status &Status,
bool isFile, std::unique_ptr<llvm::vfs::File> *F) {
// FIXME: FileSystemOpts shouldn't be passed in here, all paths should be
// absolute!
if (FileSystemOpts.WorkingDir.empty())
return FileSystemStatCache::get(Path, Status, isFile, F,
StatCache.get(), *FS);

SmallString<128> FilePath(Path);
FixupRelativePath(FilePath);

return FileSystemStatCache::get(FilePath.c_str(), Status, isFile, F,
StatCache.get(), *FS);
if (!FileSystemOpts.WorkingDir.empty())
FixupRelativePath(FilePath);

auto stat = [&](StringRef P) {
return FileSystemStatCache::get(P, Status, isFile, F, StatCache.get(), *FS);
};

auto EC = stat(FilePath);
if (!EC)
return EC;
if (FileSystemOpts.CaseInsensitivePaths)
if (auto Resolved = findPathCaseInsensitive(FilePath))
return stat(*Resolved);
return EC;
}

std::error_code
Expand Down
12 changes: 11 additions & 1 deletion clang/lib/CodeGen/CGDebugInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4189,6 +4189,7 @@ void CGDebugInfo::EmitFunctionDecl(GlobalDecl GD, SourceLocation Loc,
llvm::DINode::DIFlags Flags = llvm::DINode::FlagZero;
llvm::DIFile *Unit = getOrCreateFile(Loc);
bool IsDeclForCallSite = Fn ? true : false;

llvm::DIScope *FDContext =
IsDeclForCallSite ? Unit : getDeclContextDescriptor(D);
llvm::DINodeArray TParamsArray;
Expand Down Expand Up @@ -4219,10 +4220,17 @@ void CGDebugInfo::EmitFunctionDecl(GlobalDecl GD, SourceLocation Loc,

llvm::DINodeArray Annotations = CollectBTFDeclTagAnnotations(D);
llvm::DISubroutineType *STy = getOrCreateFunctionType(D, FnType, Unit);
// Only link to a prior declaration when creating a call-site entry.
// For standalone declarations the SP *is* the declaration; passing
// getFunctionDeclaration() here would let DISubprogram::get() unique
// the new node to the existing member SP, producing a self-referencing
// declaration link that causes infinite recursion in the DWARF emitter.
llvm::DISubprogram *Decl =
IsDeclForCallSite ? getFunctionDeclaration(D) : nullptr;
Comment thread
pfez marked this conversation as resolved.
llvm::DISubprogram *SP =
DBuilder.createFunction(FDContext, Name, LinkageName, Unit, LineNo, STy,
ScopeLine, Flags, SPFlags, TParamsArray.get(),
getFunctionDeclaration(D), nullptr, Annotations);
Decl, nullptr, Annotations);

// Preserve btf_decl_tag attributes for parameters of extern functions
// for BPF target. The parameters created in this loop are attached as
Expand All @@ -4243,6 +4251,8 @@ void CGDebugInfo::EmitFunctionDecl(GlobalDecl GD, SourceLocation Loc,

if (IsDeclForCallSite)
Fn->setSubprogram(SP);
else if (CGM.getCodeGenOpts().hasMaybeUnusedDebugInfo())
DBuilder.retainType(SP);

DBuilder.finalizeSubprogram(SP);
}
Expand Down
50 changes: 45 additions & 5 deletions clang/lib/CodeGen/CodeGenModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6276,6 +6276,42 @@ void CodeGenModule::EmitDeclContext(const DeclContext *DC) {
}
}

/// Returns true if D comes from a file selected for rich debug info.
/// If -fdebug-info-allowed-file is not set, all declarations pass.
static bool isDeclInAllowedFiles(const Decl *D, CodeGenModule &CGM) {
const auto &Allowed = CGM.getCodeGenOpts().DebugInfoAllowedFiles;
if (Allowed.empty())
return true;
auto &SM = CGM.getContext().getSourceManager();
auto Filename = SM.getFilename(SM.getExpansionLoc(D->getLocation()));
if (Filename.empty())
return false;
for (const auto &F : Allowed)
if (Filename == F)
return true;
return false;
}

/// Emit a DISubprogram for a function declaration so its prototype ends
/// up in the debug output (LF_FUNC_ID in CodeView) even when the TU
/// has no definition.
static void emitFunctionDecl(CodeGenModule &CGM, const FunctionDecl *FD) {
// Only emit for declaration-only functions; definitions already get
// a DISubprogram through the normal codegen path.
if (FD->doesThisDeclarationHaveABody())
return;
// Skip declarations whose type can't be represented in debug info
// (e.g. undeduced auto return types, dependent template types).
const auto *FPT = FD->getType()->getAs<FunctionProtoType>();
if (!FPT || FPT->isDependentType() || FPT->isUndeducedType())
return;
Comment thread
pfez marked this conversation as resolved.
if (!isDeclInAllowedFiles(FD, CGM))
return;
CGDebugInfo *DI = CGM.getModuleDebugInfo();
if (DI)
DI->EmitFunctionDecl(GlobalDecl(FD), FD->getLocation(), QualType(FPT, 0));
}

/// EmitTopLevelDecl - Emit code for a single top level declaration.
void CodeGenModule::EmitTopLevelDecl(Decl *D) {
// Ignore dependent declarations.
Expand All @@ -6295,6 +6331,7 @@ void CodeGenModule::EmitTopLevelDecl(Decl *D) {
// Always provide some coverage mapping
// even for the functions that aren't emitted.
AddDeferredUnusedCoverageMapping(D);
emitFunctionDecl(*this, cast<FunctionDecl>(D));
break;

case Decl::CXXDeductionGuide:
Expand Down Expand Up @@ -6331,7 +6368,7 @@ void CodeGenModule::EmitTopLevelDecl(Decl *D) {
case Decl::CXXRecord: {
CXXRecordDecl *CRD = cast<CXXRecordDecl>(D);
if (CGDebugInfo *DI = getModuleDebugInfo()) {
if (CRD->hasDefinition())
if (CRD->hasDefinition() && isDeclInAllowedFiles(D, *this))
DI->EmitAndRetainType(getContext().getRecordType(cast<RecordDecl>(D)));
if (auto *ES = D->getASTContext().getExternalSource())
if (ES->hasExternalDefinitions(D) == ExternalASTSource::EK_Never)
Expand Down Expand Up @@ -6553,19 +6590,22 @@ void CodeGenModule::EmitTopLevelDecl(Decl *D) {
case Decl::Typedef:
case Decl::TypeAlias: // using foo = bar; [C++11]
if (CGDebugInfo *DI = getModuleDebugInfo())
DI->EmitAndRetainType(
getContext().getTypedefType(cast<TypedefNameDecl>(D)));
if (isDeclInAllowedFiles(D, *this))
DI->EmitAndRetainType(
getContext().getTypedefType(cast<TypedefNameDecl>(D)));
break;

case Decl::Record:
if (CGDebugInfo *DI = getModuleDebugInfo())
if (cast<RecordDecl>(D)->getDefinition())
if (cast<RecordDecl>(D)->getDefinition() &&
isDeclInAllowedFiles(D, *this))
DI->EmitAndRetainType(getContext().getRecordType(cast<RecordDecl>(D)));
break;

case Decl::Enum:
if (CGDebugInfo *DI = getModuleDebugInfo())
if (cast<EnumDecl>(D)->getDefinition())
if (cast<EnumDecl>(D)->getDefinition() &&
isDeclInAllowedFiles(D, *this))
DI->EmitAndRetainType(getContext().getEnumType(cast<EnumDecl>(D)));
break;

Expand Down
2 changes: 2 additions & 0 deletions clang/lib/Driver/ToolChains/Clang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5743,6 +5743,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
CmdArgs.push_back(D.ResourceDir.c_str());

Args.AddLastArg(CmdArgs, options::OPT_working_directory);
Args.AddLastArg(CmdArgs, options::OPT_fcase_insensitive_paths);
Args.AddAllArgs(CmdArgs, options::OPT_fdebug_info_allowed_file_EQ);

RenderARCMigrateToolOptions(D, Args, CmdArgs);

Expand Down
26 changes: 26 additions & 0 deletions clang/test/CodeGen/debug-info-allowed-file.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Verify that -fdebug-info-allowed-file restricts rich debug-info emission to
// declarations from the listed files.

// RUN: rm -rf %t && mkdir -p %t
// RUN: echo 'struct allowed_struct {}; void allowed_fn(int);' > %t/allowed.h
// RUN: echo 'struct excluded_struct {}; void excluded_fn(int);' > %t/excluded.h

// With the filter, only decls from allowed.h appear in the debug output.
// RUN: %clang_cc1 -debug-info-kind=unused-types -emit-llvm -o - %s -I %t \
// RUN: -fdebug-info-allowed-file=%t/allowed.h \
// RUN: | FileCheck %s --check-prefix=FILTERED

// Without the filter, both decls are emitted.
// RUN: %clang_cc1 -debug-info-kind=unused-types -emit-llvm -o - %s -I %t \
// RUN: | FileCheck %s --check-prefix=UNFILTERED

#include "allowed.h"
#include "excluded.h"

// FILTERED-DAG: name: "allowed_struct"
// FILTERED-DAG: name: "allowed_fn"
// FILTERED-NOT: name: "excluded_struct"
// FILTERED-NOT: name: "excluded_fn"

// UNFILTERED-DAG: name: "allowed_struct"
// UNFILTERED-DAG: name: "excluded_struct"
16 changes: 16 additions & 0 deletions clang/test/CodeGen/debug-info-codeview-emit-decl-subprogram.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Verify that a declaration-only function gets its DISubprogram retained
// and lowered to an LF_FUNC_ID record in the CodeView output.

// REQUIRES: x86-registered-target

// RUN: %clang_cc1 -triple x86_64-windows-msvc -gcodeview \
// RUN: -debug-info-kind=unused-types -emit-obj -o %t.o %s
// RUN: llvm-readobj %t.o --codeview | FileCheck %s

void declared_fn(int);

// CHECK: FuncId ({{.*}}) {
// CHECK-NEXT: TypeLeafKind: LF_FUNC_ID
// CHECK: FunctionType: void (int)
// CHECK-NEXT: Name: declared_fn
// CHECK-NEXT: }
3 changes: 3 additions & 0 deletions clang/test/Driver/fcase-insensitive-paths.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// RUN: %clang -### -fcase-insensitive-paths -c %s 2>&1 | FileCheck %s

// CHECK: "-fcase-insensitive-paths"
3 changes: 3 additions & 0 deletions clang/test/Driver/fdebug-info-allowed-file.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// RUN: %clang -### -fdebug-info-allowed-file=a.h -fdebug-info-allowed-file=b.h -c %s 2>&1 | FileCheck %s

// CHECK: "-fdebug-info-allowed-file=a.h" "-fdebug-info-allowed-file=b.h"
Loading