[all-commits] [llvm/llvm-project] bce360: Detect source location overflow due includes

dnsampaio via All-commits all-commits at lists.llvm.org
Fri Jan 24 15:56:52 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: bce360b7048cc6306c9d04faf27b71eec8762041
      https://github.com/llvm/llvm-project/commit/bce360b7048cc6306c9d04faf27b71eec8762041
  Author: Diogo Sampaio <diogo.sampaio at arm.com>
  Date:   2020-01-24 (Fri, 24 Jan 2020)

  Changed paths:
    M clang/include/clang/Basic/DiagnosticCommonKinds.td
    M clang/include/clang/Lex/Preprocessor.h
    M clang/lib/Basic/SourceManager.cpp
    M clang/lib/Lex/PPDirectives.cpp
    M clang/lib/Lex/Preprocessor.cpp
    A clang/test/Lexer/Inputs/inc1.h
    A clang/test/Lexer/Inputs/inc2.h
    A clang/test/Lexer/SourceLocationsOverflow.c

  Log Message:
  -----------
  Detect source location overflow due includes

Summary:
As discussed in http://lists.llvm.org/pipermail/cfe-dev/2019-October/063459.html
the overflow of the souce locations (limited to 2^31 chars) can generate all sorts of
weird things (bogus warnings, hangs, crashes, miscompilation and correct compilation).
In debug mode this assert would fail. So it might be a good start, as in PR42301,
to detect the failure and exit with a proper error message.

Reviewers: rsmith, thakis, miyuki

Reviewed By: miyuki

Subscribers: cfe-commits

Tags: #clang

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




More information about the All-commits mailing list